Debian Codegraph @

src/auth0/management/guardian/factors/sms/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_sms_templates_response_content import GetGuardianFactorSmsTemplatesResponseContent
8 from ....types.get_guardian_factors_provider_sms_response_content import GetGuardianFactorsProviderSmsResponseContent
9 from ....types.get_guardian_factors_provider_sms_twilio_response_content import (
10 GetGuardianFactorsProviderSmsTwilioResponseContent,
11 )
12 from ....types.guardian_factors_provider_sms_provider_enum import GuardianFactorsProviderSmsProviderEnum
13 from ....types.set_guardian_factor_sms_templates_response_content import SetGuardianFactorSmsTemplatesResponseContent
14 from ....types.set_guardian_factors_provider_sms_response_content import SetGuardianFactorsProviderSmsResponseContent
15 from ....types.set_guardian_factors_provider_sms_twilio_response_content import (
16 SetGuardianFactorsProviderSmsTwilioResponseContent,
17 )
18 from .raw_client import AsyncRawSmsClient, RawSmsClient
19
20 # this is used as the default value for optional parameters
21 OMIT = typing.cast(typing.Any, ...)
22
23
24 class SmsClient:
25 def __init__(self, *, client_wrapper: SyncClientWrapper):
26 self._raw_client = RawSmsClient(client_wrapper=client_wrapper)
27
28 @property
29 def with_raw_response(self) -> RawSmsClient:
30 """
31 Retrieves a raw implementation of this client that returns raw responses.
32
33 Returns
34 -------
35 RawSmsClient
36 """
37 return self._raw_client
38
39 def get_twilio_provider(
40 self, *, request_options: typing.Optional[RequestOptions] = None
41 ) -> GetGuardianFactorsProviderSmsTwilioResponseContent:
42 """
43 Retrieve the <a href="https://auth0.com/docs/multifactor-authentication/twilio-configuration">Twilio SMS provider configuration</a> (subscription required).
44
45 A new endpoint is available to retrieve the Twilio configuration related to phone factors (<a href='https://auth0.com/docs/api/management/v2/#!/Guardian/get_twilio'>phone Twilio configuration</a>). It has the same payload as this one. Please use it instead.
46
47 Parameters
48 ----------
49 request_options : typing.Optional[RequestOptions]
50 Request-specific configuration.
51
52 Returns
53 -------
54 GetGuardianFactorsProviderSmsTwilioResponseContent
55 Twilio SMS configuration successfully retrieved.
56
57 Examples
58 --------
59 from auth0 import Auth0
60
61 client = Auth0(
62 token="YOUR_TOKEN",
63 )
64 client.guardian.factors.sms.get_twilio_provider()
65 """
66 _response = self._raw_client.get_twilio_provider(request_options=request_options)
67 return _response.data
68
69 def set_twilio_provider(
70 self,
71 *,
72 from_: typing.Optional[str] = OMIT,
73 messaging_service_sid: typing.Optional[str] = OMIT,
74 auth_token: typing.Optional[str] = OMIT,
75 sid: typing.Optional[str] = OMIT,
76 request_options: typing.Optional[RequestOptions] = None,
77 ) -> SetGuardianFactorsProviderSmsTwilioResponseContent:
78 """
79 This endpoint has been deprecated. To complete this action, use the <a href="https://auth0.com/docs/api/management/v2/guardian/put-twilio">Update Twilio phone configuration</a> endpoint.
80
81 <b>Previous functionality</b>: Update the Twilio SMS provider configuration.
82
83 Parameters
84 ----------
85 from_ : typing.Optional[str]
86 From number
87
88 messaging_service_sid : typing.Optional[str]
89 Copilot SID
90
91 auth_token : typing.Optional[str]
92 Twilio Authentication token
93
94 sid : typing.Optional[str]
95 Twilio SID
96
97 request_options : typing.Optional[RequestOptions]
98 Request-specific configuration.
99
100 Returns
101 -------
102 SetGuardianFactorsProviderSmsTwilioResponseContent
103 Twilio SMS configuration successfully updated.
104
105 Examples
106 --------
107 from auth0 import Auth0
108
109 client = Auth0(
110 token="YOUR_TOKEN",
111 )
112 client.guardian.factors.sms.set_twilio_provider()
113 """
114 _response = self._raw_client.set_twilio_provider(
115 from_=from_,
116 messaging_service_sid=messaging_service_sid,
117 auth_token=auth_token,
118 sid=sid,
119 request_options=request_options,
120 )
121 return _response.data
122
123 def get_selected_provider(
124 self, *, request_options: typing.Optional[RequestOptions] = None
125 ) -> GetGuardianFactorsProviderSmsResponseContent:
126 """
127 This endpoint has been deprecated. To complete this action, use the <a href="https://auth0.com/docs/api/management/v2/guardian/get-phone-providers">Retrieve phone configuration</a> endpoint instead.
128
129 <b>Previous functionality</b>: Retrieve details for the multi-factor authentication SMS provider configured for your tenant.
130
131 Parameters
132 ----------
133 request_options : typing.Optional[RequestOptions]
134 Request-specific configuration.
135
136 Returns
137 -------
138 GetGuardianFactorsProviderSmsResponseContent
139 Returns selected SMS provider configuration
140
141 Examples
142 --------
143 from auth0 import Auth0
144
145 client = Auth0(
146 token="YOUR_TOKEN",
147 )
148 client.guardian.factors.sms.get_selected_provider()
149 """
150 _response = self._raw_client.get_selected_provider(request_options=request_options)
151 return _response.data
152
153 def set_provider(
154 self,
155 *,
156 provider: GuardianFactorsProviderSmsProviderEnum,
157 request_options: typing.Optional[RequestOptions] = None,
158 ) -> SetGuardianFactorsProviderSmsResponseContent:
159 """
160 This endpoint has been deprecated. To complete this action, use the <a href="https://auth0.com/docs/api/management/v2/guardian/put-phone-providers">Update phone configuration</a> endpoint instead.
161
162 <b>Previous functionality</b>: Update the multi-factor authentication SMS provider configuration in your tenant.
163
164 Parameters
165 ----------
166 provider : GuardianFactorsProviderSmsProviderEnum
167
168 request_options : typing.Optional[RequestOptions]
169 Request-specific configuration.
170
171 Returns
172 -------
173 SetGuardianFactorsProviderSmsResponseContent
174 Returns selected SMS provider configuration
175
176 Examples
177 --------
178 from auth0 import Auth0
179
180 client = Auth0(
181 token="YOUR_TOKEN",
182 )
183 client.guardian.factors.sms.set_provider(
184 provider="auth0",
185 )
186 """
187 _response = self._raw_client.set_provider(provider=provider, request_options=request_options)
188 return _response.data
189
190 def get_templates(
191 self, *, request_options: typing.Optional[RequestOptions] = None
192 ) -> typing.Optional[GetGuardianFactorSmsTemplatesResponseContent]:
193 """
194 This endpoint has been deprecated. To complete this action, use the <a href="https://auth0.com/docs/api/management/v2/guardian/get-factor-phone-templates">Retrieve enrollment and verification phone templates</a> endpoint instead.
195
196 <b>Previous function</b>: Retrieve details of SMS enrollment and verification templates configured for your tenant.
197
198 Parameters
199 ----------
200 request_options : typing.Optional[RequestOptions]
201 Request-specific configuration.
202
203 Returns
204 -------
205 typing.Optional[GetGuardianFactorSmsTemplatesResponseContent]
206 SMS enrollment and verification templates successfully retrieved.
207
208 Examples
209 --------
210 from auth0 import Auth0
211
212 client = Auth0(
213 token="YOUR_TOKEN",
214 )
215 client.guardian.factors.sms.get_templates()
216 """
217 _response = self._raw_client.get_templates(request_options=request_options)
218 return _response.data
219
220 def set_templates(
221 self,
222 *,
223 enrollment_message: str,
224 verification_message: str,
225 request_options: typing.Optional[RequestOptions] = None,
226 ) -> SetGuardianFactorSmsTemplatesResponseContent:
227 """
228 This endpoint has been deprecated. To complete this action, use the <a href="https://auth0.com/docs/api/management/v2/guardian/put-factor-phone-templates">Update enrollment and verification phone templates</a> endpoint instead.
229
230 <b>Previous functionality</b>: Customize the messages sent to complete SMS enrollment and verification.
231
232 Parameters
233 ----------
234 enrollment_message : str
235 Message sent to the user when they are invited to enroll with a phone number.
236
237 verification_message : str
238 Message sent to the user when they are prompted to verify their account.
239
240 request_options : typing.Optional[RequestOptions]
241 Request-specific configuration.
242
243 Returns
244 -------
245 SetGuardianFactorSmsTemplatesResponseContent
246 SMS enrollment and verification templates successfully updated.
247
248 Examples
249 --------
250 from auth0 import Auth0
251
252 client = Auth0(
253 token="YOUR_TOKEN",
254 )
255 client.guardian.factors.sms.set_templates(
256 enrollment_message="enrollment_message",
257 verification_message="verification_message",
258 )
259 """
260 _response = self._raw_client.set_templates(
261 enrollment_message=enrollment_message,
262 verification_message=verification_message,
263 request_options=request_options,
264 )
265 return _response.data
266
267
268 class AsyncSmsClient:
269 def __init__(self, *, client_wrapper: AsyncClientWrapper):
270 self._raw_client = AsyncRawSmsClient(client_wrapper=client_wrapper)
271
272 @property
273 def with_raw_response(self) -> AsyncRawSmsClient:
274 """
275 Retrieves a raw implementation of this client that returns raw responses.
276
277 Returns
278 -------
279 AsyncRawSmsClient
280 """
281 return self._raw_client
282
283 async def get_twilio_provider(
284 self, *, request_options: typing.Optional[RequestOptions] = None
285 ) -> GetGuardianFactorsProviderSmsTwilioResponseContent:
286 """
287 Retrieve the <a href="https://auth0.com/docs/multifactor-authentication/twilio-configuration">Twilio SMS provider configuration</a> (subscription required).
288
289 A new endpoint is available to retrieve the Twilio configuration related to phone factors (<a href='https://auth0.com/docs/api/management/v2/#!/Guardian/get_twilio'>phone Twilio configuration</a>). It has the same payload as this one. Please use it instead.
290
291 Parameters
292 ----------
293 request_options : typing.Optional[RequestOptions]
294 Request-specific configuration.
295
296 Returns
297 -------
298 GetGuardianFactorsProviderSmsTwilioResponseContent
299 Twilio SMS configuration successfully retrieved.
300
301 Examples
302 --------
303 import asyncio
304
305 from auth0 import AsyncAuth0
306
307 client = AsyncAuth0(
308 token="YOUR_TOKEN",
309 )
310
311
312 async def main() -> None:
313 await client.guardian.factors.sms.get_twilio_provider()
314
315
316 asyncio.run(main())
317 """
318 _response = await self._raw_client.get_twilio_provider(request_options=request_options)
319 return _response.data
320
321 async def set_twilio_provider(
322 self,
323 *,
324 from_: typing.Optional[str] = OMIT,
325 messaging_service_sid: typing.Optional[str] = OMIT,
326 auth_token: typing.Optional[str] = OMIT,
327 sid: typing.Optional[str] = OMIT,
328 request_options: typing.Optional[RequestOptions] = None,
329 ) -> SetGuardianFactorsProviderSmsTwilioResponseContent:
330 """
331 This endpoint has been deprecated. To complete this action, use the <a href="https://auth0.com/docs/api/management/v2/guardian/put-twilio">Update Twilio phone configuration</a> endpoint.
332
333 <b>Previous functionality</b>: Update the Twilio SMS provider configuration.
334
335 Parameters
336 ----------
337 from_ : typing.Optional[str]
338 From number
339
340 messaging_service_sid : typing.Optional[str]
341 Copilot SID
342
343 auth_token : typing.Optional[str]
344 Twilio Authentication token
345
346 sid : typing.Optional[str]
347 Twilio SID
348
349 request_options : typing.Optional[RequestOptions]
350 Request-specific configuration.
351
352 Returns
353 -------
354 SetGuardianFactorsProviderSmsTwilioResponseContent
355 Twilio SMS configuration successfully updated.
356
357 Examples
358 --------
359 import asyncio
360
361 from auth0 import AsyncAuth0
362
363 client = AsyncAuth0(
364 token="YOUR_TOKEN",
365 )
366
367
368 async def main() -> None:
369 await client.guardian.factors.sms.set_twilio_provider()
370
371
372 asyncio.run(main())
373 """
374 _response = await self._raw_client.set_twilio_provider(
375 from_=from_,
376 messaging_service_sid=messaging_service_sid,
377 auth_token=auth_token,
378 sid=sid,
379 request_options=request_options,
380 )
381 return _response.data
382
383 async def get_selected_provider(
384 self, *, request_options: typing.Optional[RequestOptions] = None
385 ) -> GetGuardianFactorsProviderSmsResponseContent:
386 """
387 This endpoint has been deprecated. To complete this action, use the <a href="https://auth0.com/docs/api/management/v2/guardian/get-phone-providers">Retrieve phone configuration</a> endpoint instead.
388
389 <b>Previous functionality</b>: Retrieve details for the multi-factor authentication SMS provider configured for your tenant.
390
391 Parameters
392 ----------
393 request_options : typing.Optional[RequestOptions]
394 Request-specific configuration.
395
396 Returns
397 -------
398 GetGuardianFactorsProviderSmsResponseContent
399 Returns selected SMS provider configuration
400
401 Examples
402 --------
403 import asyncio
404
405 from auth0 import AsyncAuth0
406
407 client = AsyncAuth0(
408 token="YOUR_TOKEN",
409 )
410
411
412 async def main() -> None:
413 await client.guardian.factors.sms.get_selected_provider()
414
415
416 asyncio.run(main())
417 """
418 _response = await self._raw_client.get_selected_provider(request_options=request_options)
419 return _response.data
420
421 async def set_provider(
422 self,
423 *,
424 provider: GuardianFactorsProviderSmsProviderEnum,
425 request_options: typing.Optional[RequestOptions] = None,
426 ) -> SetGuardianFactorsProviderSmsResponseContent:
427 """
428 This endpoint has been deprecated. To complete this action, use the <a href="https://auth0.com/docs/api/management/v2/guardian/put-phone-providers">Update phone configuration</a> endpoint instead.
429
430 <b>Previous functionality</b>: Update the multi-factor authentication SMS provider configuration in your tenant.
431
432 Parameters
433 ----------
434 provider : GuardianFactorsProviderSmsProviderEnum
435
436 request_options : typing.Optional[RequestOptions]
437 Request-specific configuration.
438
439 Returns
440 -------
441 SetGuardianFactorsProviderSmsResponseContent
442 Returns selected SMS provider configuration
443
444 Examples
445 --------
446 import asyncio
447
448 from auth0 import AsyncAuth0
449
450 client = AsyncAuth0(
451 token="YOUR_TOKEN",
452 )
453
454
455 async def main() -> None:
456 await client.guardian.factors.sms.set_provider(
457 provider="auth0",
458 )
459
460
461 asyncio.run(main())
462 """
463 _response = await self._raw_client.set_provider(provider=provider, request_options=request_options)
464 return _response.data
465
466 async def get_templates(
467 self, *, request_options: typing.Optional[RequestOptions] = None
468 ) -> typing.Optional[GetGuardianFactorSmsTemplatesResponseContent]:
469 """
470 This endpoint has been deprecated. To complete this action, use the <a href="https://auth0.com/docs/api/management/v2/guardian/get-factor-phone-templates">Retrieve enrollment and verification phone templates</a> endpoint instead.
471
472 <b>Previous function</b>: Retrieve details of SMS enrollment and verification templates configured for your tenant.
473
474 Parameters
475 ----------
476 request_options : typing.Optional[RequestOptions]
477 Request-specific configuration.
478
479 Returns
480 -------
481 typing.Optional[GetGuardianFactorSmsTemplatesResponseContent]
482 SMS enrollment and verification templates successfully retrieved.
483
484 Examples
485 --------
486 import asyncio
487
488 from auth0 import AsyncAuth0
489
490 client = AsyncAuth0(
491 token="YOUR_TOKEN",
492 )
493
494
495 async def main() -> None:
496 await client.guardian.factors.sms.get_templates()
497
498
499 asyncio.run(main())
500 """
501 _response = await self._raw_client.get_templates(request_options=request_options)
502 return _response.data
503
504 async def set_templates(
505 self,
506 *,
507 enrollment_message: str,
508 verification_message: str,
509 request_options: typing.Optional[RequestOptions] = None,
510 ) -> SetGuardianFactorSmsTemplatesResponseContent:
511 """
512 This endpoint has been deprecated. To complete this action, use the <a href="https://auth0.com/docs/api/management/v2/guardian/put-factor-phone-templates">Update enrollment and verification phone templates</a> endpoint instead.
513
514 <b>Previous functionality</b>: Customize the messages sent to complete SMS enrollment and verification.
515
516 Parameters
517 ----------
518 enrollment_message : str
519 Message sent to the user when they are invited to enroll with a phone number.
520
521 verification_message : str
522 Message sent to the user when they are prompted to verify their account.
523
524 request_options : typing.Optional[RequestOptions]
525 Request-specific configuration.
526
527 Returns
528 -------
529 SetGuardianFactorSmsTemplatesResponseContent
530 SMS enrollment and verification templates successfully updated.
531
532 Examples
533 --------
534 import asyncio
535
536 from auth0 import AsyncAuth0
537
538 client = AsyncAuth0(
539 token="YOUR_TOKEN",
540 )
541
542
543 async def main() -> None:
544 await client.guardian.factors.sms.set_templates(
545 enrollment_message="enrollment_message",
546 verification_message="verification_message",
547 )
548
549
550 asyncio.run(main())
551 """
552 _response = await self._raw_client.set_templates(
553 enrollment_message=enrollment_message,
554 verification_message=verification_message,
555 request_options=request_options,
556 )
557 return _response.data