Debian Codegraph @

src/auth0/management/guardian/factors/phone/client.py

raw symbols SCIP
1 # This file was auto-generated by Fern from our API Definition.
2
3 import typing
4
5 from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
6 from ....core.request_options import RequestOptions
7 from ....types.get_guardian_factor_phone_message_types_response_content import (
8 GetGuardianFactorPhoneMessageTypesResponseContent,
9 )
10 from ....types.get_guardian_factor_phone_templates_response_content import (
11 GetGuardianFactorPhoneTemplatesResponseContent,
12 )
13 from ....types.get_guardian_factors_provider_phone_response_content import (
14 GetGuardianFactorsProviderPhoneResponseContent,
15 )
16 from ....types.get_guardian_factors_provider_phone_twilio_response_content import (
17 GetGuardianFactorsProviderPhoneTwilioResponseContent,
18 )
19 from ....types.guardian_factor_phone_factor_message_type_enum import GuardianFactorPhoneFactorMessageTypeEnum
20 from ....types.guardian_factors_provider_sms_provider_enum import GuardianFactorsProviderSmsProviderEnum
21 from ....types.set_guardian_factor_phone_message_types_response_content import (
22 SetGuardianFactorPhoneMessageTypesResponseContent,
23 )
24 from ....types.set_guardian_factor_phone_templates_response_content import (
25 SetGuardianFactorPhoneTemplatesResponseContent,
26 )
27 from ....types.set_guardian_factors_provider_phone_response_content import (
28 SetGuardianFactorsProviderPhoneResponseContent,
29 )
30 from ....types.set_guardian_factors_provider_phone_twilio_response_content import (
31 SetGuardianFactorsProviderPhoneTwilioResponseContent,
32 )
33 from .raw_client import AsyncRawPhoneClient, RawPhoneClient
34
35 # this is used as the default value for optional parameters
36 OMIT = typing.cast(typing.Any, ...)
37
38
39 class PhoneClient:
40 def __init__(self, *, client_wrapper: SyncClientWrapper):
41 self._raw_client = RawPhoneClient(client_wrapper=client_wrapper)
42
43 @property
44 def with_raw_response(self) -> RawPhoneClient:
45 """
46 Retrieves a raw implementation of this client that returns raw responses.
47
48 Returns
49 -------
50 RawPhoneClient
51 """
52 return self._raw_client
53
54 def get_message_types(
55 self, *, request_options: typing.Optional[RequestOptions] = None
56 ) -> GetGuardianFactorPhoneMessageTypesResponseContent:
57 """
58 Retrieve list of <a href="https://auth0.com/docs/secure/multi-factor-authentication/multi-factor-authentication-factors/configure-sms-voice-notifications-mfa">phone-type MFA factors</a> (i.e., sms and voice) that are enabled for your tenant.
59
60 Parameters
61 ----------
62 request_options : typing.Optional[RequestOptions]
63 Request-specific configuration.
64
65 Returns
66 -------
67 GetGuardianFactorPhoneMessageTypesResponseContent
68 Returns the enabled phone factors
69
70 Examples
71 --------
72 from auth0 import Auth0
73
74 client = Auth0(
75 token="YOUR_TOKEN",
76 )
77 client.guardian.factors.phone.get_message_types()
78 """
79 _response = self._raw_client.get_message_types(request_options=request_options)
80 return _response.data
81
82 def set_message_types(
83 self,
84 *,
85 message_types: typing.Sequence[GuardianFactorPhoneFactorMessageTypeEnum],
86 request_options: typing.Optional[RequestOptions] = None,
87 ) -> SetGuardianFactorPhoneMessageTypesResponseContent:
88 """
89 Replace the list of <a href="https://auth0.com/docs/secure/multi-factor-authentication/multi-factor-authentication-factors/configure-sms-voice-notifications-mfa">phone-type MFA factors</a> (i.e., sms and voice) that are enabled for your tenant.
90
91 Parameters
92 ----------
93 message_types : typing.Sequence[GuardianFactorPhoneFactorMessageTypeEnum]
94 The list of phone factors to enable on the tenant. Can include `sms` and `voice`.
95
96 request_options : typing.Optional[RequestOptions]
97 Request-specific configuration.
98
99 Returns
100 -------
101 SetGuardianFactorPhoneMessageTypesResponseContent
102 Returns selected SMS provider configuration
103
104 Examples
105 --------
106 from auth0 import Auth0
107
108 client = Auth0(
109 token="YOUR_TOKEN",
110 )
111 client.guardian.factors.phone.set_message_types(
112 message_types=["sms"],
113 )
114 """
115 _response = self._raw_client.set_message_types(message_types=message_types, request_options=request_options)
116 return _response.data
117
118 def get_twilio_provider(
119 self, *, request_options: typing.Optional[RequestOptions] = None
120 ) -> GetGuardianFactorsProviderPhoneTwilioResponseContent:
121 """
122 Retrieve configuration details for a Twilio phone provider that has been set up in your tenant. To learn more, review <a href="https://auth0.com/docs/secure/multi-factor-authentication/multi-factor-authentication-factors/configure-sms-voice-notifications-mfa">Configure SMS and Voice Notifications for MFA</a>.
123
124 Parameters
125 ----------
126 request_options : typing.Optional[RequestOptions]
127 Request-specific configuration.
128
129 Returns
130 -------
131 GetGuardianFactorsProviderPhoneTwilioResponseContent
132 Twilio Phone configuration successfully retrieved.
133
134 Examples
135 --------
136 from auth0 import Auth0
137
138 client = Auth0(
139 token="YOUR_TOKEN",
140 )
141 client.guardian.factors.phone.get_twilio_provider()
142 """
143 _response = self._raw_client.get_twilio_provider(request_options=request_options)
144 return _response.data
145
146 def set_twilio_provider(
147 self,
148 *,
149 from_: typing.Optional[str] = OMIT,
150 messaging_service_sid: typing.Optional[str] = OMIT,
151 auth_token: typing.Optional[str] = OMIT,
152 sid: typing.Optional[str] = OMIT,
153 request_options: typing.Optional[RequestOptions] = None,
154 ) -> SetGuardianFactorsProviderPhoneTwilioResponseContent:
155 """
156 Update the configuration of a Twilio phone provider that has been set up in your tenant. To learn more, review <a href="https://auth0.com/docs/secure/multi-factor-authentication/multi-factor-authentication-factors/configure-sms-voice-notifications-mfa">Configure SMS and Voice Notifications for MFA</a>.
157
158 Parameters
159 ----------
160 from_ : typing.Optional[str]
161 From number
162
163 messaging_service_sid : typing.Optional[str]
164 Copilot SID
165
166 auth_token : typing.Optional[str]
167 Twilio Authentication token
168
169 sid : typing.Optional[str]
170 Twilio SID
171
172 request_options : typing.Optional[RequestOptions]
173 Request-specific configuration.
174
175 Returns
176 -------
177 SetGuardianFactorsProviderPhoneTwilioResponseContent
178 Twilio Phone configuration successfully updated.
179
180 Examples
181 --------
182 from auth0 import Auth0
183
184 client = Auth0(
185 token="YOUR_TOKEN",
186 )
187 client.guardian.factors.phone.set_twilio_provider()
188 """
189 _response = self._raw_client.set_twilio_provider(
190 from_=from_,
191 messaging_service_sid=messaging_service_sid,
192 auth_token=auth_token,
193 sid=sid,
194 request_options=request_options,
195 )
196 return _response.data
197
198 def get_selected_provider(
199 self, *, request_options: typing.Optional[RequestOptions] = None
200 ) -> GetGuardianFactorsProviderPhoneResponseContent:
201 """
202 Retrieve details of the multi-factor authentication phone provider configured for your tenant.
203
204 Parameters
205 ----------
206 request_options : typing.Optional[RequestOptions]
207 Request-specific configuration.
208
209 Returns
210 -------
211 GetGuardianFactorsProviderPhoneResponseContent
212 Returns selected Phone provider configuration
213
214 Examples
215 --------
216 from auth0 import Auth0
217
218 client = Auth0(
219 token="YOUR_TOKEN",
220 )
221 client.guardian.factors.phone.get_selected_provider()
222 """
223 _response = self._raw_client.get_selected_provider(request_options=request_options)
224 return _response.data
225
226 def set_provider(
227 self,
228 *,
229 provider: GuardianFactorsProviderSmsProviderEnum,
230 request_options: typing.Optional[RequestOptions] = None,
231 ) -> SetGuardianFactorsProviderPhoneResponseContent:
232 """
233 Parameters
234 ----------
235 provider : GuardianFactorsProviderSmsProviderEnum
236
237 request_options : typing.Optional[RequestOptions]
238 Request-specific configuration.
239
240 Returns
241 -------
242 SetGuardianFactorsProviderPhoneResponseContent
243 Returns selected Phone provider configuration
244
245 Examples
246 --------
247 from auth0 import Auth0
248
249 client = Auth0(
250 token="YOUR_TOKEN",
251 )
252 client.guardian.factors.phone.set_provider(
253 provider="auth0",
254 )
255 """
256 _response = self._raw_client.set_provider(provider=provider, request_options=request_options)
257 return _response.data
258
259 def get_templates(
260 self, *, request_options: typing.Optional[RequestOptions] = None
261 ) -> GetGuardianFactorPhoneTemplatesResponseContent:
262 """
263 Retrieve details of the multi-factor authentication enrollment and verification templates for phone-type factors available in your tenant.
264
265 Parameters
266 ----------
267 request_options : typing.Optional[RequestOptions]
268 Request-specific configuration.
269
270 Returns
271 -------
272 GetGuardianFactorPhoneTemplatesResponseContent
273 Phone enrollment and verification templates successfully retrieved.
274
275 Examples
276 --------
277 from auth0 import Auth0
278
279 client = Auth0(
280 token="YOUR_TOKEN",
281 )
282 client.guardian.factors.phone.get_templates()
283 """
284 _response = self._raw_client.get_templates(request_options=request_options)
285 return _response.data
286
287 def set_templates(
288 self,
289 *,
290 enrollment_message: str,
291 verification_message: str,
292 request_options: typing.Optional[RequestOptions] = None,
293 ) -> SetGuardianFactorPhoneTemplatesResponseContent:
294 """
295 Customize the messages sent to complete phone enrollment and verification (subscription required).
296
297 Parameters
298 ----------
299 enrollment_message : str
300 Message sent to the user when they are invited to enroll with a phone number.
301
302 verification_message : str
303 Message sent to the user when they are prompted to verify their account.
304
305 request_options : typing.Optional[RequestOptions]
306 Request-specific configuration.
307
308 Returns
309 -------
310 SetGuardianFactorPhoneTemplatesResponseContent
311 Phone enrollment and verification templates successfully updated.
312
313 Examples
314 --------
315 from auth0 import Auth0
316
317 client = Auth0(
318 token="YOUR_TOKEN",
319 )
320 client.guardian.factors.phone.set_templates(
321 enrollment_message="enrollment_message",
322 verification_message="verification_message",
323 )
324 """
325 _response = self._raw_client.set_templates(
326 enrollment_message=enrollment_message,
327 verification_message=verification_message,
328 request_options=request_options,
329 )
330 return _response.data
331
332
333 class AsyncPhoneClient:
334 def __init__(self, *, client_wrapper: AsyncClientWrapper):
335 self._raw_client = AsyncRawPhoneClient(client_wrapper=client_wrapper)
336
337 @property
338 def with_raw_response(self) -> AsyncRawPhoneClient:
339 """
340 Retrieves a raw implementation of this client that returns raw responses.
341
342 Returns
343 -------
344 AsyncRawPhoneClient
345 """
346 return self._raw_client
347
348 async def get_message_types(
349 self, *, request_options: typing.Optional[RequestOptions] = None
350 ) -> GetGuardianFactorPhoneMessageTypesResponseContent:
351 """
352 Retrieve list of <a href="https://auth0.com/docs/secure/multi-factor-authentication/multi-factor-authentication-factors/configure-sms-voice-notifications-mfa">phone-type MFA factors</a> (i.e., sms and voice) that are enabled for your tenant.
353
354 Parameters
355 ----------
356 request_options : typing.Optional[RequestOptions]
357 Request-specific configuration.
358
359 Returns
360 -------
361 GetGuardianFactorPhoneMessageTypesResponseContent
362 Returns the enabled phone factors
363
364 Examples
365 --------
366 import asyncio
367
368 from auth0 import AsyncAuth0
369
370 client = AsyncAuth0(
371 token="YOUR_TOKEN",
372 )
373
374
375 async def main() -> None:
376 await client.guardian.factors.phone.get_message_types()
377
378
379 asyncio.run(main())
380 """
381 _response = await self._raw_client.get_message_types(request_options=request_options)
382 return _response.data
383
384 async def set_message_types(
385 self,
386 *,
387 message_types: typing.Sequence[GuardianFactorPhoneFactorMessageTypeEnum],
388 request_options: typing.Optional[RequestOptions] = None,
389 ) -> SetGuardianFactorPhoneMessageTypesResponseContent:
390 """
391 Replace the list of <a href="https://auth0.com/docs/secure/multi-factor-authentication/multi-factor-authentication-factors/configure-sms-voice-notifications-mfa">phone-type MFA factors</a> (i.e., sms and voice) that are enabled for your tenant.
392
393 Parameters
394 ----------
395 message_types : typing.Sequence[GuardianFactorPhoneFactorMessageTypeEnum]
396 The list of phone factors to enable on the tenant. Can include `sms` and `voice`.
397
398 request_options : typing.Optional[RequestOptions]
399 Request-specific configuration.
400
401 Returns
402 -------
403 SetGuardianFactorPhoneMessageTypesResponseContent
404 Returns selected SMS provider configuration
405
406 Examples
407 --------
408 import asyncio
409
410 from auth0 import AsyncAuth0
411
412 client = AsyncAuth0(
413 token="YOUR_TOKEN",
414 )
415
416
417 async def main() -> None:
418 await client.guardian.factors.phone.set_message_types(
419 message_types=["sms"],
420 )
421
422
423 asyncio.run(main())
424 """
425 _response = await self._raw_client.set_message_types(
426 message_types=message_types, request_options=request_options
427 )
428 return _response.data
429
430 async def get_twilio_provider(
431 self, *, request_options: typing.Optional[RequestOptions] = None
432 ) -> GetGuardianFactorsProviderPhoneTwilioResponseContent:
433 """
434 Retrieve configuration details for a Twilio phone provider that has been set up in your tenant. To learn more, review <a href="https://auth0.com/docs/secure/multi-factor-authentication/multi-factor-authentication-factors/configure-sms-voice-notifications-mfa">Configure SMS and Voice Notifications for MFA</a>.
435
436 Parameters
437 ----------
438 request_options : typing.Optional[RequestOptions]
439 Request-specific configuration.
440
441 Returns
442 -------
443 GetGuardianFactorsProviderPhoneTwilioResponseContent
444 Twilio Phone configuration successfully retrieved.
445
446 Examples
447 --------
448 import asyncio
449
450 from auth0 import AsyncAuth0
451
452 client = AsyncAuth0(
453 token="YOUR_TOKEN",
454 )
455
456
457 async def main() -> None:
458 await client.guardian.factors.phone.get_twilio_provider()
459
460
461 asyncio.run(main())
462 """
463 _response = await self._raw_client.get_twilio_provider(request_options=request_options)
464 return _response.data
465
466 async def set_twilio_provider(
467 self,
468 *,
469 from_: typing.Optional[str] = OMIT,
470 messaging_service_sid: typing.Optional[str] = OMIT,
471 auth_token: typing.Optional[str] = OMIT,
472 sid: typing.Optional[str] = OMIT,
473 request_options: typing.Optional[RequestOptions] = None,
474 ) -> SetGuardianFactorsProviderPhoneTwilioResponseContent:
475 """
476 Update the configuration of a Twilio phone provider that has been set up in your tenant. To learn more, review <a href="https://auth0.com/docs/secure/multi-factor-authentication/multi-factor-authentication-factors/configure-sms-voice-notifications-mfa">Configure SMS and Voice Notifications for MFA</a>.
477
478 Parameters
479 ----------
480 from_ : typing.Optional[str]
481 From number
482
483 messaging_service_sid : typing.Optional[str]
484 Copilot SID
485
486 auth_token : typing.Optional[str]
487 Twilio Authentication token
488
489 sid : typing.Optional[str]
490 Twilio SID
491
492 request_options : typing.Optional[RequestOptions]
493 Request-specific configuration.
494
495 Returns
496 -------
497 SetGuardianFactorsProviderPhoneTwilioResponseContent
498 Twilio Phone configuration successfully updated.
499
500 Examples
501 --------
502 import asyncio
503
504 from auth0 import AsyncAuth0
505
506 client = AsyncAuth0(
507 token="YOUR_TOKEN",
508 )
509
510
511 async def main() -> None:
512 await client.guardian.factors.phone.set_twilio_provider()
513
514
515 asyncio.run(main())
516 """
517 _response = await self._raw_client.set_twilio_provider(
518 from_=from_,
519 messaging_service_sid=messaging_service_sid,
520 auth_token=auth_token,
521 sid=sid,
522 request_options=request_options,
523 )
524 return _response.data
525
526 async def get_selected_provider(
527 self, *, request_options: typing.Optional[RequestOptions] = None
528 ) -> GetGuardianFactorsProviderPhoneResponseContent:
529 """
530 Retrieve details of the multi-factor authentication phone provider configured for your tenant.
531
532 Parameters
533 ----------
534 request_options : typing.Optional[RequestOptions]
535 Request-specific configuration.
536
537 Returns
538 -------
539 GetGuardianFactorsProviderPhoneResponseContent
540 Returns selected Phone provider configuration
541
542 Examples
543 --------
544 import asyncio
545
546 from auth0 import AsyncAuth0
547
548 client = AsyncAuth0(
549 token="YOUR_TOKEN",
550 )
551
552
553 async def main() -> None:
554 await client.guardian.factors.phone.get_selected_provider()
555
556
557 asyncio.run(main())
558 """
559 _response = await self._raw_client.get_selected_provider(request_options=request_options)
560 return _response.data
561
562 async def set_provider(
563 self,
564 *,
565 provider: GuardianFactorsProviderSmsProviderEnum,
566 request_options: typing.Optional[RequestOptions] = None,
567 ) -> SetGuardianFactorsProviderPhoneResponseContent:
568 """
569 Parameters
570 ----------
571 provider : GuardianFactorsProviderSmsProviderEnum
572
573 request_options : typing.Optional[RequestOptions]
574 Request-specific configuration.
575
576 Returns
577 -------
578 SetGuardianFactorsProviderPhoneResponseContent
579 Returns selected Phone provider configuration
580
581 Examples
582 --------
583 import asyncio
584
585 from auth0 import AsyncAuth0
586
587 client = AsyncAuth0(
588 token="YOUR_TOKEN",
589 )
590
591
592 async def main() -> None:
593 await client.guardian.factors.phone.set_provider(
594 provider="auth0",
595 )
596
597
598 asyncio.run(main())
599 """
600 _response = await self._raw_client.set_provider(provider=provider, request_options=request_options)
601 return _response.data
602
603 async def get_templates(
604 self, *, request_options: typing.Optional[RequestOptions] = None
605 ) -> GetGuardianFactorPhoneTemplatesResponseContent:
606 """
607 Retrieve details of the multi-factor authentication enrollment and verification templates for phone-type factors available in your tenant.
608
609 Parameters
610 ----------
611 request_options : typing.Optional[RequestOptions]
612 Request-specific configuration.
613
614 Returns
615 -------
616 GetGuardianFactorPhoneTemplatesResponseContent
617 Phone enrollment and verification templates successfully retrieved.
618
619 Examples
620 --------
621 import asyncio
622
623 from auth0 import AsyncAuth0
624
625 client = AsyncAuth0(
626 token="YOUR_TOKEN",
627 )
628
629
630 async def main() -> None:
631 await client.guardian.factors.phone.get_templates()
632
633
634 asyncio.run(main())
635 """
636 _response = await self._raw_client.get_templates(request_options=request_options)
637 return _response.data
638
639 async def set_templates(
640 self,
641 *,
642 enrollment_message: str,
643 verification_message: str,
644 request_options: typing.Optional[RequestOptions] = None,
645 ) -> SetGuardianFactorPhoneTemplatesResponseContent:
646 """
647 Customize the messages sent to complete phone enrollment and verification (subscription required).
648
649 Parameters
650 ----------
651 enrollment_message : str
652 Message sent to the user when they are invited to enroll with a phone number.
653
654 verification_message : str
655 Message sent to the user when they are prompted to verify their account.
656
657 request_options : typing.Optional[RequestOptions]
658 Request-specific configuration.
659
660 Returns
661 -------
662 SetGuardianFactorPhoneTemplatesResponseContent
663 Phone enrollment and verification templates successfully updated.
664
665 Examples
666 --------
667 import asyncio
668
669 from auth0 import AsyncAuth0
670
671 client = AsyncAuth0(
672 token="YOUR_TOKEN",
673 )
674
675
676 async def main() -> None:
677 await client.guardian.factors.phone.set_templates(
678 enrollment_message="enrollment_message",
679 verification_message="verification_message",
680 )
681
682
683 asyncio.run(main())
684 """
685 _response = await self._raw_client.set_templates(
686 enrollment_message=enrollment_message,
687 verification_message=verification_message,
688 request_options=request_options,
689 )
690 return _response.data