Debian Codegraph @

src/auth0/management/branding/phone/providers/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.create_branding_phone_provider_response_content import CreateBrandingPhoneProviderResponseContent
8 from ....types.create_phone_provider_send_test_response_content import CreatePhoneProviderSendTestResponseContent
9 from ....types.get_branding_phone_provider_response_content import GetBrandingPhoneProviderResponseContent
10 from ....types.list_branding_phone_providers_response_content import ListBrandingPhoneProvidersResponseContent
11 from ....types.phone_provider_configuration import PhoneProviderConfiguration
12 from ....types.phone_provider_credentials import PhoneProviderCredentials
13 from ....types.phone_provider_delivery_method_enum import PhoneProviderDeliveryMethodEnum
14 from ....types.phone_provider_name_enum import PhoneProviderNameEnum
15 from ....types.update_branding_phone_provider_response_content import UpdateBrandingPhoneProviderResponseContent
16 from .raw_client import AsyncRawProvidersClient, RawProvidersClient
17
18 # this is used as the default value for optional parameters
19 OMIT = typing.cast(typing.Any, ...)
20
21
22 class ProvidersClient:
23 def __init__(self, *, client_wrapper: SyncClientWrapper):
24 self._raw_client = RawProvidersClient(client_wrapper=client_wrapper)
25
26 @property
27 def with_raw_response(self) -> RawProvidersClient:
28 """
29 Retrieves a raw implementation of this client that returns raw responses.
30
31 Returns
32 -------
33 RawProvidersClient
34 """
35 return self._raw_client
36
37 def list(
38 self, *, disabled: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None
39 ) -> ListBrandingPhoneProvidersResponseContent:
40 """
41 Retrieve a list of [phone providers](https://auth0.com/docs/customize/phone-messages/configure-phone-messaging-providers) details set for a Tenant. A list of fields to include or exclude may also be specified.
42
43 Parameters
44 ----------
45 disabled : typing.Optional[bool]
46 Whether the provider is enabled (false) or disabled (true).
47
48 request_options : typing.Optional[RequestOptions]
49 Request-specific configuration.
50
51 Returns
52 -------
53 ListBrandingPhoneProvidersResponseContent
54 Phone providers have been successfully retrieved.
55
56 Examples
57 --------
58 from auth0 import Auth0
59
60 client = Auth0(
61 token="YOUR_TOKEN",
62 )
63 client.branding.phone.providers.list(
64 disabled=True,
65 )
66 """
67 _response = self._raw_client.list(disabled=disabled, request_options=request_options)
68 return _response.data
69
70 def create(
71 self,
72 *,
73 name: PhoneProviderNameEnum,
74 credentials: PhoneProviderCredentials,
75 disabled: typing.Optional[bool] = OMIT,
76 configuration: typing.Optional[PhoneProviderConfiguration] = OMIT,
77 request_options: typing.Optional[RequestOptions] = None,
78 ) -> CreateBrandingPhoneProviderResponseContent:
79 """
80 Create a [phone provider](https://auth0.com/docs/customize/phone-messages/configure-phone-messaging-providers).
81 The `credentials` object requires different properties depending on the phone provider (which is specified using the `name` property).
82
83 Parameters
84 ----------
85 name : PhoneProviderNameEnum
86
87 credentials : PhoneProviderCredentials
88
89 disabled : typing.Optional[bool]
90 Whether the provider is enabled (false) or disabled (true).
91
92 configuration : typing.Optional[PhoneProviderConfiguration]
93
94 request_options : typing.Optional[RequestOptions]
95 Request-specific configuration.
96
97 Returns
98 -------
99 CreateBrandingPhoneProviderResponseContent
100 Phone notification provider successfully created.
101
102 Examples
103 --------
104 from auth0 import Auth0, TwilioProviderCredentials
105
106 client = Auth0(
107 token="YOUR_TOKEN",
108 )
109 client.branding.phone.providers.create(
110 name="twilio",
111 credentials=TwilioProviderCredentials(
112 auth_token="auth_token",
113 ),
114 )
115 """
116 _response = self._raw_client.create(
117 name=name,
118 credentials=credentials,
119 disabled=disabled,
120 configuration=configuration,
121 request_options=request_options,
122 )
123 return _response.data
124
125 def get(
126 self, id: str, *, request_options: typing.Optional[RequestOptions] = None
127 ) -> GetBrandingPhoneProviderResponseContent:
128 """
129 Retrieve [phone provider](https://auth0.com/docs/customize/phone-messages/configure-phone-messaging-providers) details. A list of fields to include or exclude may also be specified.
130
131 Parameters
132 ----------
133 id : str
134
135 request_options : typing.Optional[RequestOptions]
136 Request-specific configuration.
137
138 Returns
139 -------
140 GetBrandingPhoneProviderResponseContent
141 Phone provider successfully retrieved.
142
143 Examples
144 --------
145 from auth0 import Auth0
146
147 client = Auth0(
148 token="YOUR_TOKEN",
149 )
150 client.branding.phone.providers.get(
151 id="id",
152 )
153 """
154 _response = self._raw_client.get(id, request_options=request_options)
155 return _response.data
156
157 def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
158 """
159 Delete the configured phone provider.
160
161 Parameters
162 ----------
163 id : str
164
165 request_options : typing.Optional[RequestOptions]
166 Request-specific configuration.
167
168 Returns
169 -------
170 None
171
172 Examples
173 --------
174 from auth0 import Auth0
175
176 client = Auth0(
177 token="YOUR_TOKEN",
178 )
179 client.branding.phone.providers.delete(
180 id="id",
181 )
182 """
183 _response = self._raw_client.delete(id, request_options=request_options)
184 return _response.data
185
186 def update(
187 self,
188 id: str,
189 *,
190 name: typing.Optional[PhoneProviderNameEnum] = OMIT,
191 disabled: typing.Optional[bool] = OMIT,
192 credentials: typing.Optional[PhoneProviderCredentials] = OMIT,
193 configuration: typing.Optional[PhoneProviderConfiguration] = OMIT,
194 request_options: typing.Optional[RequestOptions] = None,
195 ) -> UpdateBrandingPhoneProviderResponseContent:
196 """
197 Update a [phone provider](https://auth0.com/docs/customize/phone-messages/configure-phone-messaging-providers).
198 The `credentials` object requires different properties depending on the phone provider (which is specified using the `name` property).
199
200 Parameters
201 ----------
202 id : str
203
204 name : typing.Optional[PhoneProviderNameEnum]
205
206 disabled : typing.Optional[bool]
207 Whether the provider is enabled (false) or disabled (true).
208
209 credentials : typing.Optional[PhoneProviderCredentials]
210
211 configuration : typing.Optional[PhoneProviderConfiguration]
212
213 request_options : typing.Optional[RequestOptions]
214 Request-specific configuration.
215
216 Returns
217 -------
218 UpdateBrandingPhoneProviderResponseContent
219 Phone provider successfully updated.
220
221 Examples
222 --------
223 from auth0 import Auth0
224
225 client = Auth0(
226 token="YOUR_TOKEN",
227 )
228 client.branding.phone.providers.update(
229 id="id",
230 )
231 """
232 _response = self._raw_client.update(
233 id,
234 name=name,
235 disabled=disabled,
236 credentials=credentials,
237 configuration=configuration,
238 request_options=request_options,
239 )
240 return _response.data
241
242 def test(
243 self,
244 id: str,
245 *,
246 to: str,
247 delivery_method: typing.Optional[PhoneProviderDeliveryMethodEnum] = OMIT,
248 request_options: typing.Optional[RequestOptions] = None,
249 ) -> CreatePhoneProviderSendTestResponseContent:
250 """
251 Parameters
252 ----------
253 id : str
254
255 to : str
256 The recipient phone number to receive a given notification.
257
258 delivery_method : typing.Optional[PhoneProviderDeliveryMethodEnum]
259
260 request_options : typing.Optional[RequestOptions]
261 Request-specific configuration.
262
263 Returns
264 -------
265 CreatePhoneProviderSendTestResponseContent
266 Phone notification sent.
267
268 Examples
269 --------
270 from auth0 import Auth0
271
272 client = Auth0(
273 token="YOUR_TOKEN",
274 )
275 client.branding.phone.providers.test(
276 id="id",
277 to="to",
278 )
279 """
280 _response = self._raw_client.test(id, to=to, delivery_method=delivery_method, request_options=request_options)
281 return _response.data
282
283
284 class AsyncProvidersClient:
285 def __init__(self, *, client_wrapper: AsyncClientWrapper):
286 self._raw_client = AsyncRawProvidersClient(client_wrapper=client_wrapper)
287
288 @property
289 def with_raw_response(self) -> AsyncRawProvidersClient:
290 """
291 Retrieves a raw implementation of this client that returns raw responses.
292
293 Returns
294 -------
295 AsyncRawProvidersClient
296 """
297 return self._raw_client
298
299 async def list(
300 self, *, disabled: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None
301 ) -> ListBrandingPhoneProvidersResponseContent:
302 """
303 Retrieve a list of [phone providers](https://auth0.com/docs/customize/phone-messages/configure-phone-messaging-providers) details set for a Tenant. A list of fields to include or exclude may also be specified.
304
305 Parameters
306 ----------
307 disabled : typing.Optional[bool]
308 Whether the provider is enabled (false) or disabled (true).
309
310 request_options : typing.Optional[RequestOptions]
311 Request-specific configuration.
312
313 Returns
314 -------
315 ListBrandingPhoneProvidersResponseContent
316 Phone providers have been successfully retrieved.
317
318 Examples
319 --------
320 import asyncio
321
322 from auth0 import AsyncAuth0
323
324 client = AsyncAuth0(
325 token="YOUR_TOKEN",
326 )
327
328
329 async def main() -> None:
330 await client.branding.phone.providers.list(
331 disabled=True,
332 )
333
334
335 asyncio.run(main())
336 """
337 _response = await self._raw_client.list(disabled=disabled, request_options=request_options)
338 return _response.data
339
340 async def create(
341 self,
342 *,
343 name: PhoneProviderNameEnum,
344 credentials: PhoneProviderCredentials,
345 disabled: typing.Optional[bool] = OMIT,
346 configuration: typing.Optional[PhoneProviderConfiguration] = OMIT,
347 request_options: typing.Optional[RequestOptions] = None,
348 ) -> CreateBrandingPhoneProviderResponseContent:
349 """
350 Create a [phone provider](https://auth0.com/docs/customize/phone-messages/configure-phone-messaging-providers).
351 The `credentials` object requires different properties depending on the phone provider (which is specified using the `name` property).
352
353 Parameters
354 ----------
355 name : PhoneProviderNameEnum
356
357 credentials : PhoneProviderCredentials
358
359 disabled : typing.Optional[bool]
360 Whether the provider is enabled (false) or disabled (true).
361
362 configuration : typing.Optional[PhoneProviderConfiguration]
363
364 request_options : typing.Optional[RequestOptions]
365 Request-specific configuration.
366
367 Returns
368 -------
369 CreateBrandingPhoneProviderResponseContent
370 Phone notification provider successfully created.
371
372 Examples
373 --------
374 import asyncio
375
376 from auth0 import AsyncAuth0, TwilioProviderCredentials
377
378 client = AsyncAuth0(
379 token="YOUR_TOKEN",
380 )
381
382
383 async def main() -> None:
384 await client.branding.phone.providers.create(
385 name="twilio",
386 credentials=TwilioProviderCredentials(
387 auth_token="auth_token",
388 ),
389 )
390
391
392 asyncio.run(main())
393 """
394 _response = await self._raw_client.create(
395 name=name,
396 credentials=credentials,
397 disabled=disabled,
398 configuration=configuration,
399 request_options=request_options,
400 )
401 return _response.data
402
403 async def get(
404 self, id: str, *, request_options: typing.Optional[RequestOptions] = None
405 ) -> GetBrandingPhoneProviderResponseContent:
406 """
407 Retrieve [phone provider](https://auth0.com/docs/customize/phone-messages/configure-phone-messaging-providers) details. A list of fields to include or exclude may also be specified.
408
409 Parameters
410 ----------
411 id : str
412
413 request_options : typing.Optional[RequestOptions]
414 Request-specific configuration.
415
416 Returns
417 -------
418 GetBrandingPhoneProviderResponseContent
419 Phone provider successfully retrieved.
420
421 Examples
422 --------
423 import asyncio
424
425 from auth0 import AsyncAuth0
426
427 client = AsyncAuth0(
428 token="YOUR_TOKEN",
429 )
430
431
432 async def main() -> None:
433 await client.branding.phone.providers.get(
434 id="id",
435 )
436
437
438 asyncio.run(main())
439 """
440 _response = await self._raw_client.get(id, request_options=request_options)
441 return _response.data
442
443 async def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
444 """
445 Delete the configured phone provider.
446
447 Parameters
448 ----------
449 id : str
450
451 request_options : typing.Optional[RequestOptions]
452 Request-specific configuration.
453
454 Returns
455 -------
456 None
457
458 Examples
459 --------
460 import asyncio
461
462 from auth0 import AsyncAuth0
463
464 client = AsyncAuth0(
465 token="YOUR_TOKEN",
466 )
467
468
469 async def main() -> None:
470 await client.branding.phone.providers.delete(
471 id="id",
472 )
473
474
475 asyncio.run(main())
476 """
477 _response = await self._raw_client.delete(id, request_options=request_options)
478 return _response.data
479
480 async def update(
481 self,
482 id: str,
483 *,
484 name: typing.Optional[PhoneProviderNameEnum] = OMIT,
485 disabled: typing.Optional[bool] = OMIT,
486 credentials: typing.Optional[PhoneProviderCredentials] = OMIT,
487 configuration: typing.Optional[PhoneProviderConfiguration] = OMIT,
488 request_options: typing.Optional[RequestOptions] = None,
489 ) -> UpdateBrandingPhoneProviderResponseContent:
490 """
491 Update a [phone provider](https://auth0.com/docs/customize/phone-messages/configure-phone-messaging-providers).
492 The `credentials` object requires different properties depending on the phone provider (which is specified using the `name` property).
493
494 Parameters
495 ----------
496 id : str
497
498 name : typing.Optional[PhoneProviderNameEnum]
499
500 disabled : typing.Optional[bool]
501 Whether the provider is enabled (false) or disabled (true).
502
503 credentials : typing.Optional[PhoneProviderCredentials]
504
505 configuration : typing.Optional[PhoneProviderConfiguration]
506
507 request_options : typing.Optional[RequestOptions]
508 Request-specific configuration.
509
510 Returns
511 -------
512 UpdateBrandingPhoneProviderResponseContent
513 Phone provider successfully updated.
514
515 Examples
516 --------
517 import asyncio
518
519 from auth0 import AsyncAuth0
520
521 client = AsyncAuth0(
522 token="YOUR_TOKEN",
523 )
524
525
526 async def main() -> None:
527 await client.branding.phone.providers.update(
528 id="id",
529 )
530
531
532 asyncio.run(main())
533 """
534 _response = await self._raw_client.update(
535 id,
536 name=name,
537 disabled=disabled,
538 credentials=credentials,
539 configuration=configuration,
540 request_options=request_options,
541 )
542 return _response.data
543
544 async def test(
545 self,
546 id: str,
547 *,
548 to: str,
549 delivery_method: typing.Optional[PhoneProviderDeliveryMethodEnum] = OMIT,
550 request_options: typing.Optional[RequestOptions] = None,
551 ) -> CreatePhoneProviderSendTestResponseContent:
552 """
553 Parameters
554 ----------
555 id : str
556
557 to : str
558 The recipient phone number to receive a given notification.
559
560 delivery_method : typing.Optional[PhoneProviderDeliveryMethodEnum]
561
562 request_options : typing.Optional[RequestOptions]
563 Request-specific configuration.
564
565 Returns
566 -------
567 CreatePhoneProviderSendTestResponseContent
568 Phone notification sent.
569
570 Examples
571 --------
572 import asyncio
573
574 from auth0 import AsyncAuth0
575
576 client = AsyncAuth0(
577 token="YOUR_TOKEN",
578 )
579
580
581 async def main() -> None:
582 await client.branding.phone.providers.test(
583 id="id",
584 to="to",
585 )
586
587
588 asyncio.run(main())
589 """
590 _response = await self._raw_client.test(
591 id, to=to, delivery_method=delivery_method, request_options=request_options
592 )
593 return _response.data