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