| 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_email_template_response_content import CreateEmailTemplateResponseContent |
| 8 |
from ..types.email_template_name_enum import EmailTemplateNameEnum |
| 9 |
from ..types.get_email_template_response_content import GetEmailTemplateResponseContent |
| 10 |
from ..types.set_email_template_response_content import SetEmailTemplateResponseContent |
| 11 |
from ..types.update_email_template_response_content import UpdateEmailTemplateResponseContent |
| 12 |
from .raw_client import AsyncRawEmailTemplatesClient, RawEmailTemplatesClient |
| 13 |
|
| 14 |
|
| 15 |
OMIT = typing.cast(typing.Any, ...) |
| 16 |
|
| 17 |
|
| 18 |
class EmailTemplatesClient: |
| 19 |
def __init__(self, *, client_wrapper: SyncClientWrapper): |
| 20 |
self._raw_client = RawEmailTemplatesClient(client_wrapper=client_wrapper) |
| 21 |
|
| 22 |
@property |
| 23 |
def with_raw_response(self) -> RawEmailTemplatesClient: |
| 24 |
""" |
| 25 |
Retrieves a raw implementation of this client that returns raw responses. |
| 26 |
|
| 27 |
Returns |
| 28 |
------- |
| 29 |
RawEmailTemplatesClient |
| 30 |
""" |
| 31 |
return self._raw_client |
| 32 |
|
| 33 |
def create( |
| 34 |
self, |
| 35 |
*, |
| 36 |
template: EmailTemplateNameEnum, |
| 37 |
body: typing.Optional[str] = OMIT, |
| 38 |
from_: typing.Optional[str] = OMIT, |
| 39 |
result_url: typing.Optional[str] = OMIT, |
| 40 |
subject: typing.Optional[str] = OMIT, |
| 41 |
syntax: typing.Optional[str] = OMIT, |
| 42 |
url_lifetime_in_seconds: typing.Optional[float] = OMIT, |
| 43 |
include_email_in_redirect: typing.Optional[bool] = OMIT, |
| 44 |
enabled: typing.Optional[bool] = OMIT, |
| 45 |
request_options: typing.Optional[RequestOptions] = None, |
| 46 |
) -> CreateEmailTemplateResponseContent: |
| 47 |
""" |
| 48 |
Create an email template. |
| 49 |
|
| 50 |
Parameters |
| 51 |
---------- |
| 52 |
template : EmailTemplateNameEnum |
| 53 |
|
| 54 |
body : typing.Optional[str] |
| 55 |
Body of the email template. |
| 56 |
|
| 57 |
from_ : typing.Optional[str] |
| 58 |
Senders `from` email address. |
| 59 |
|
| 60 |
result_url : typing.Optional[str] |
| 61 |
URL to redirect the user to after a successful action. |
| 62 |
|
| 63 |
subject : typing.Optional[str] |
| 64 |
Subject line of the email. |
| 65 |
|
| 66 |
syntax : typing.Optional[str] |
| 67 |
Syntax of the template body. |
| 68 |
|
| 69 |
url_lifetime_in_seconds : typing.Optional[float] |
| 70 |
Lifetime in seconds that the link within the email will be valid for. |
| 71 |
|
| 72 |
include_email_in_redirect : typing.Optional[bool] |
| 73 |
Whether the `reset_email` and `verify_email` templates should include the user's email address as the `email` parameter in the returnUrl (true) or whether no email address should be included in the redirect (false). Defaults to true. |
| 74 |
|
| 75 |
enabled : typing.Optional[bool] |
| 76 |
Whether the template is enabled (true) or disabled (false). |
| 77 |
|
| 78 |
request_options : typing.Optional[RequestOptions] |
| 79 |
Request-specific configuration. |
| 80 |
|
| 81 |
Returns |
| 82 |
------- |
| 83 |
CreateEmailTemplateResponseContent |
| 84 |
Template successfully created. |
| 85 |
|
| 86 |
Examples |
| 87 |
-------- |
| 88 |
from auth0 import Auth0 |
| 89 |
|
| 90 |
client = Auth0( |
| 91 |
token="YOUR_TOKEN", |
| 92 |
) |
| 93 |
client.email_templates.create( |
| 94 |
template="verify_email", |
| 95 |
) |
| 96 |
""" |
| 97 |
_response = self._raw_client.create( |
| 98 |
template=template, |
| 99 |
body=body, |
| 100 |
from_=from_, |
| 101 |
result_url=result_url, |
| 102 |
subject=subject, |
| 103 |
syntax=syntax, |
| 104 |
url_lifetime_in_seconds=url_lifetime_in_seconds, |
| 105 |
include_email_in_redirect=include_email_in_redirect, |
| 106 |
enabled=enabled, |
| 107 |
request_options=request_options, |
| 108 |
) |
| 109 |
return _response.data |
| 110 |
|
| 111 |
def get( |
| 112 |
self, template_name: EmailTemplateNameEnum, *, request_options: typing.Optional[RequestOptions] = None |
| 113 |
) -> GetEmailTemplateResponseContent: |
| 114 |
""" |
| 115 |
Retrieve an email template by pre-defined name. These names are `verify_email`, `verify_email_by_code`, `auth_email_by_code`, `reset_email`, `reset_email_by_code`, `welcome_email`, `blocked_account`, `stolen_credentials`, `enrollment_email`, `mfa_oob_code`, `user_invitation`, and `async_approval`. The names `change_password`, and `password_reset` are also supported for legacy scenarios. |
| 116 |
|
| 117 |
Parameters |
| 118 |
---------- |
| 119 |
template_name : EmailTemplateNameEnum |
| 120 |
Template name. Can be `verify_email`, `verify_email_by_code`, `auth_email_by_code`, `reset_email`, `reset_email_by_code`, `welcome_email`, `blocked_account`, `stolen_credentials`, `enrollment_email`, `mfa_oob_code`, `user_invitation`, `async_approval`, `change_password` (legacy), or `password_reset` (legacy). |
| 121 |
|
| 122 |
request_options : typing.Optional[RequestOptions] |
| 123 |
Request-specific configuration. |
| 124 |
|
| 125 |
Returns |
| 126 |
------- |
| 127 |
GetEmailTemplateResponseContent |
| 128 |
Template successfully retrieved. |
| 129 |
|
| 130 |
Examples |
| 131 |
-------- |
| 132 |
from auth0 import Auth0 |
| 133 |
|
| 134 |
client = Auth0( |
| 135 |
token="YOUR_TOKEN", |
| 136 |
) |
| 137 |
client.email_templates.get( |
| 138 |
template_name="verify_email", |
| 139 |
) |
| 140 |
""" |
| 141 |
_response = self._raw_client.get(template_name, request_options=request_options) |
| 142 |
return _response.data |
| 143 |
|
| 144 |
def set( |
| 145 |
self, |
| 146 |
template_name: EmailTemplateNameEnum, |
| 147 |
*, |
| 148 |
template: EmailTemplateNameEnum, |
| 149 |
body: typing.Optional[str] = OMIT, |
| 150 |
from_: typing.Optional[str] = OMIT, |
| 151 |
result_url: typing.Optional[str] = OMIT, |
| 152 |
subject: typing.Optional[str] = OMIT, |
| 153 |
syntax: typing.Optional[str] = OMIT, |
| 154 |
url_lifetime_in_seconds: typing.Optional[float] = OMIT, |
| 155 |
include_email_in_redirect: typing.Optional[bool] = OMIT, |
| 156 |
enabled: typing.Optional[bool] = OMIT, |
| 157 |
request_options: typing.Optional[RequestOptions] = None, |
| 158 |
) -> SetEmailTemplateResponseContent: |
| 159 |
""" |
| 160 |
Update an email template. |
| 161 |
|
| 162 |
Parameters |
| 163 |
---------- |
| 164 |
template_name : EmailTemplateNameEnum |
| 165 |
Template name. Can be `verify_email`, `verify_email_by_code`, `auth_email_by_code`, `reset_email`, `reset_email_by_code`, `welcome_email`, `blocked_account`, `stolen_credentials`, `enrollment_email`, `mfa_oob_code`, `user_invitation`, `async_approval`, `change_password` (legacy), or `password_reset` (legacy). |
| 166 |
|
| 167 |
template : EmailTemplateNameEnum |
| 168 |
|
| 169 |
body : typing.Optional[str] |
| 170 |
Body of the email template. |
| 171 |
|
| 172 |
from_ : typing.Optional[str] |
| 173 |
Senders `from` email address. |
| 174 |
|
| 175 |
result_url : typing.Optional[str] |
| 176 |
URL to redirect the user to after a successful action. |
| 177 |
|
| 178 |
subject : typing.Optional[str] |
| 179 |
Subject line of the email. |
| 180 |
|
| 181 |
syntax : typing.Optional[str] |
| 182 |
Syntax of the template body. |
| 183 |
|
| 184 |
url_lifetime_in_seconds : typing.Optional[float] |
| 185 |
Lifetime in seconds that the link within the email will be valid for. |
| 186 |
|
| 187 |
include_email_in_redirect : typing.Optional[bool] |
| 188 |
Whether the `reset_email` and `verify_email` templates should include the user's email address as the `email` parameter in the returnUrl (true) or whether no email address should be included in the redirect (false). Defaults to true. |
| 189 |
|
| 190 |
enabled : typing.Optional[bool] |
| 191 |
Whether the template is enabled (true) or disabled (false). |
| 192 |
|
| 193 |
request_options : typing.Optional[RequestOptions] |
| 194 |
Request-specific configuration. |
| 195 |
|
| 196 |
Returns |
| 197 |
------- |
| 198 |
SetEmailTemplateResponseContent |
| 199 |
Template successfully updated. |
| 200 |
|
| 201 |
Examples |
| 202 |
-------- |
| 203 |
from auth0 import Auth0 |
| 204 |
|
| 205 |
client = Auth0( |
| 206 |
token="YOUR_TOKEN", |
| 207 |
) |
| 208 |
client.email_templates.set( |
| 209 |
template_name="verify_email", |
| 210 |
template="verify_email", |
| 211 |
) |
| 212 |
""" |
| 213 |
_response = self._raw_client.set( |
| 214 |
template_name, |
| 215 |
template=template, |
| 216 |
body=body, |
| 217 |
from_=from_, |
| 218 |
result_url=result_url, |
| 219 |
subject=subject, |
| 220 |
syntax=syntax, |
| 221 |
url_lifetime_in_seconds=url_lifetime_in_seconds, |
| 222 |
include_email_in_redirect=include_email_in_redirect, |
| 223 |
enabled=enabled, |
| 224 |
request_options=request_options, |
| 225 |
) |
| 226 |
return _response.data |
| 227 |
|
| 228 |
def update( |
| 229 |
self, |
| 230 |
template_name: EmailTemplateNameEnum, |
| 231 |
*, |
| 232 |
template: typing.Optional[EmailTemplateNameEnum] = OMIT, |
| 233 |
body: typing.Optional[str] = OMIT, |
| 234 |
from_: typing.Optional[str] = OMIT, |
| 235 |
result_url: typing.Optional[str] = OMIT, |
| 236 |
subject: typing.Optional[str] = OMIT, |
| 237 |
syntax: typing.Optional[str] = OMIT, |
| 238 |
url_lifetime_in_seconds: typing.Optional[float] = OMIT, |
| 239 |
include_email_in_redirect: typing.Optional[bool] = OMIT, |
| 240 |
enabled: typing.Optional[bool] = OMIT, |
| 241 |
request_options: typing.Optional[RequestOptions] = None, |
| 242 |
) -> UpdateEmailTemplateResponseContent: |
| 243 |
""" |
| 244 |
Modify an email template. |
| 245 |
|
| 246 |
Parameters |
| 247 |
---------- |
| 248 |
template_name : EmailTemplateNameEnum |
| 249 |
Template name. Can be `verify_email`, `verify_email_by_code`, `auth_email_by_code`, `reset_email`, `reset_email_by_code`, `welcome_email`, `blocked_account`, `stolen_credentials`, `enrollment_email`, `mfa_oob_code`, `user_invitation`, `async_approval`, `change_password` (legacy), or `password_reset` (legacy). |
| 250 |
|
| 251 |
template : typing.Optional[EmailTemplateNameEnum] |
| 252 |
|
| 253 |
body : typing.Optional[str] |
| 254 |
Body of the email template. |
| 255 |
|
| 256 |
from_ : typing.Optional[str] |
| 257 |
Senders `from` email address. |
| 258 |
|
| 259 |
result_url : typing.Optional[str] |
| 260 |
URL to redirect the user to after a successful action. |
| 261 |
|
| 262 |
subject : typing.Optional[str] |
| 263 |
Subject line of the email. |
| 264 |
|
| 265 |
syntax : typing.Optional[str] |
| 266 |
Syntax of the template body. |
| 267 |
|
| 268 |
url_lifetime_in_seconds : typing.Optional[float] |
| 269 |
Lifetime in seconds that the link within the email will be valid for. |
| 270 |
|
| 271 |
include_email_in_redirect : typing.Optional[bool] |
| 272 |
Whether the `reset_email` and `verify_email` templates should include the user's email address as the `email` parameter in the returnUrl (true) or whether no email address should be included in the redirect (false). Defaults to true. |
| 273 |
|
| 274 |
enabled : typing.Optional[bool] |
| 275 |
Whether the template is enabled (true) or disabled (false). |
| 276 |
|
| 277 |
request_options : typing.Optional[RequestOptions] |
| 278 |
Request-specific configuration. |
| 279 |
|
| 280 |
Returns |
| 281 |
------- |
| 282 |
UpdateEmailTemplateResponseContent |
| 283 |
Template successfully updated. |
| 284 |
|
| 285 |
Examples |
| 286 |
-------- |
| 287 |
from auth0 import Auth0 |
| 288 |
|
| 289 |
client = Auth0( |
| 290 |
token="YOUR_TOKEN", |
| 291 |
) |
| 292 |
client.email_templates.update( |
| 293 |
template_name="verify_email", |
| 294 |
) |
| 295 |
""" |
| 296 |
_response = self._raw_client.update( |
| 297 |
template_name, |
| 298 |
template=template, |
| 299 |
body=body, |
| 300 |
from_=from_, |
| 301 |
result_url=result_url, |
| 302 |
subject=subject, |
| 303 |
syntax=syntax, |
| 304 |
url_lifetime_in_seconds=url_lifetime_in_seconds, |
| 305 |
include_email_in_redirect=include_email_in_redirect, |
| 306 |
enabled=enabled, |
| 307 |
request_options=request_options, |
| 308 |
) |
| 309 |
return _response.data |
| 310 |
|
| 311 |
|
| 312 |
class AsyncEmailTemplatesClient: |
| 313 |
def __init__(self, *, client_wrapper: AsyncClientWrapper): |
| 314 |
self._raw_client = AsyncRawEmailTemplatesClient(client_wrapper=client_wrapper) |
| 315 |
|
| 316 |
@property |
| 317 |
def with_raw_response(self) -> AsyncRawEmailTemplatesClient: |
| 318 |
""" |
| 319 |
Retrieves a raw implementation of this client that returns raw responses. |
| 320 |
|
| 321 |
Returns |
| 322 |
------- |
| 323 |
AsyncRawEmailTemplatesClient |
| 324 |
""" |
| 325 |
return self._raw_client |
| 326 |
|
| 327 |
async def create( |
| 328 |
self, |
| 329 |
*, |
| 330 |
template: EmailTemplateNameEnum, |
| 331 |
body: typing.Optional[str] = OMIT, |
| 332 |
from_: typing.Optional[str] = OMIT, |
| 333 |
result_url: typing.Optional[str] = OMIT, |
| 334 |
subject: typing.Optional[str] = OMIT, |
| 335 |
syntax: typing.Optional[str] = OMIT, |
| 336 |
url_lifetime_in_seconds: typing.Optional[float] = OMIT, |
| 337 |
include_email_in_redirect: typing.Optional[bool] = OMIT, |
| 338 |
enabled: typing.Optional[bool] = OMIT, |
| 339 |
request_options: typing.Optional[RequestOptions] = None, |
| 340 |
) -> CreateEmailTemplateResponseContent: |
| 341 |
""" |
| 342 |
Create an email template. |
| 343 |
|
| 344 |
Parameters |
| 345 |
---------- |
| 346 |
template : EmailTemplateNameEnum |
| 347 |
|
| 348 |
body : typing.Optional[str] |
| 349 |
Body of the email template. |
| 350 |
|
| 351 |
from_ : typing.Optional[str] |
| 352 |
Senders `from` email address. |
| 353 |
|
| 354 |
result_url : typing.Optional[str] |
| 355 |
URL to redirect the user to after a successful action. |
| 356 |
|
| 357 |
subject : typing.Optional[str] |
| 358 |
Subject line of the email. |
| 359 |
|
| 360 |
syntax : typing.Optional[str] |
| 361 |
Syntax of the template body. |
| 362 |
|
| 363 |
url_lifetime_in_seconds : typing.Optional[float] |
| 364 |
Lifetime in seconds that the link within the email will be valid for. |
| 365 |
|
| 366 |
include_email_in_redirect : typing.Optional[bool] |
| 367 |
Whether the `reset_email` and `verify_email` templates should include the user's email address as the `email` parameter in the returnUrl (true) or whether no email address should be included in the redirect (false). Defaults to true. |
| 368 |
|
| 369 |
enabled : typing.Optional[bool] |
| 370 |
Whether the template is enabled (true) or disabled (false). |
| 371 |
|
| 372 |
request_options : typing.Optional[RequestOptions] |
| 373 |
Request-specific configuration. |
| 374 |
|
| 375 |
Returns |
| 376 |
------- |
| 377 |
CreateEmailTemplateResponseContent |
| 378 |
Template successfully created. |
| 379 |
|
| 380 |
Examples |
| 381 |
-------- |
| 382 |
import asyncio |
| 383 |
|
| 384 |
from auth0 import AsyncAuth0 |
| 385 |
|
| 386 |
client = AsyncAuth0( |
| 387 |
token="YOUR_TOKEN", |
| 388 |
) |
| 389 |
|
| 390 |
|
| 391 |
async def main() -> None: |
| 392 |
await client.email_templates.create( |
| 393 |
template="verify_email", |
| 394 |
) |
| 395 |
|
| 396 |
|
| 397 |
asyncio.run(main()) |
| 398 |
""" |
| 399 |
_response = await self._raw_client.create( |
| 400 |
template=template, |
| 401 |
body=body, |
| 402 |
from_=from_, |
| 403 |
result_url=result_url, |
| 404 |
subject=subject, |
| 405 |
syntax=syntax, |
| 406 |
url_lifetime_in_seconds=url_lifetime_in_seconds, |
| 407 |
include_email_in_redirect=include_email_in_redirect, |
| 408 |
enabled=enabled, |
| 409 |
request_options=request_options, |
| 410 |
) |
| 411 |
return _response.data |
| 412 |
|
| 413 |
async def get( |
| 414 |
self, template_name: EmailTemplateNameEnum, *, request_options: typing.Optional[RequestOptions] = None |
| 415 |
) -> GetEmailTemplateResponseContent: |
| 416 |
""" |
| 417 |
Retrieve an email template by pre-defined name. These names are `verify_email`, `verify_email_by_code`, `auth_email_by_code`, `reset_email`, `reset_email_by_code`, `welcome_email`, `blocked_account`, `stolen_credentials`, `enrollment_email`, `mfa_oob_code`, `user_invitation`, and `async_approval`. The names `change_password`, and `password_reset` are also supported for legacy scenarios. |
| 418 |
|
| 419 |
Parameters |
| 420 |
---------- |
| 421 |
template_name : EmailTemplateNameEnum |
| 422 |
Template name. Can be `verify_email`, `verify_email_by_code`, `auth_email_by_code`, `reset_email`, `reset_email_by_code`, `welcome_email`, `blocked_account`, `stolen_credentials`, `enrollment_email`, `mfa_oob_code`, `user_invitation`, `async_approval`, `change_password` (legacy), or `password_reset` (legacy). |
| 423 |
|
| 424 |
request_options : typing.Optional[RequestOptions] |
| 425 |
Request-specific configuration. |
| 426 |
|
| 427 |
Returns |
| 428 |
------- |
| 429 |
GetEmailTemplateResponseContent |
| 430 |
Template successfully retrieved. |
| 431 |
|
| 432 |
Examples |
| 433 |
-------- |
| 434 |
import asyncio |
| 435 |
|
| 436 |
from auth0 import AsyncAuth0 |
| 437 |
|
| 438 |
client = AsyncAuth0( |
| 439 |
token="YOUR_TOKEN", |
| 440 |
) |
| 441 |
|
| 442 |
|
| 443 |
async def main() -> None: |
| 444 |
await client.email_templates.get( |
| 445 |
template_name="verify_email", |
| 446 |
) |
| 447 |
|
| 448 |
|
| 449 |
asyncio.run(main()) |
| 450 |
""" |
| 451 |
_response = await self._raw_client.get(template_name, request_options=request_options) |
| 452 |
return _response.data |
| 453 |
|
| 454 |
async def set( |
| 455 |
self, |
| 456 |
template_name: EmailTemplateNameEnum, |
| 457 |
*, |
| 458 |
template: EmailTemplateNameEnum, |
| 459 |
body: typing.Optional[str] = OMIT, |
| 460 |
from_: typing.Optional[str] = OMIT, |
| 461 |
result_url: typing.Optional[str] = OMIT, |
| 462 |
subject: typing.Optional[str] = OMIT, |
| 463 |
syntax: typing.Optional[str] = OMIT, |
| 464 |
url_lifetime_in_seconds: typing.Optional[float] = OMIT, |
| 465 |
include_email_in_redirect: typing.Optional[bool] = OMIT, |
| 466 |
enabled: typing.Optional[bool] = OMIT, |
| 467 |
request_options: typing.Optional[RequestOptions] = None, |
| 468 |
) -> SetEmailTemplateResponseContent: |
| 469 |
""" |
| 470 |
Update an email template. |
| 471 |
|
| 472 |
Parameters |
| 473 |
---------- |
| 474 |
template_name : EmailTemplateNameEnum |
| 475 |
Template name. Can be `verify_email`, `verify_email_by_code`, `auth_email_by_code`, `reset_email`, `reset_email_by_code`, `welcome_email`, `blocked_account`, `stolen_credentials`, `enrollment_email`, `mfa_oob_code`, `user_invitation`, `async_approval`, `change_password` (legacy), or `password_reset` (legacy). |
| 476 |
|
| 477 |
template : EmailTemplateNameEnum |
| 478 |
|
| 479 |
body : typing.Optional[str] |
| 480 |
Body of the email template. |
| 481 |
|
| 482 |
from_ : typing.Optional[str] |
| 483 |
Senders `from` email address. |
| 484 |
|
| 485 |
result_url : typing.Optional[str] |
| 486 |
URL to redirect the user to after a successful action. |
| 487 |
|
| 488 |
subject : typing.Optional[str] |
| 489 |
Subject line of the email. |
| 490 |
|
| 491 |
syntax : typing.Optional[str] |
| 492 |
Syntax of the template body. |
| 493 |
|
| 494 |
url_lifetime_in_seconds : typing.Optional[float] |
| 495 |
Lifetime in seconds that the link within the email will be valid for. |
| 496 |
|
| 497 |
include_email_in_redirect : typing.Optional[bool] |
| 498 |
Whether the `reset_email` and `verify_email` templates should include the user's email address as the `email` parameter in the returnUrl (true) or whether no email address should be included in the redirect (false). Defaults to true. |
| 499 |
|
| 500 |
enabled : typing.Optional[bool] |
| 501 |
Whether the template is enabled (true) or disabled (false). |
| 502 |
|
| 503 |
request_options : typing.Optional[RequestOptions] |
| 504 |
Request-specific configuration. |
| 505 |
|
| 506 |
Returns |
| 507 |
------- |
| 508 |
SetEmailTemplateResponseContent |
| 509 |
Template successfully updated. |
| 510 |
|
| 511 |
Examples |
| 512 |
-------- |
| 513 |
import asyncio |
| 514 |
|
| 515 |
from auth0 import AsyncAuth0 |
| 516 |
|
| 517 |
client = AsyncAuth0( |
| 518 |
token="YOUR_TOKEN", |
| 519 |
) |
| 520 |
|
| 521 |
|
| 522 |
async def main() -> None: |
| 523 |
await client.email_templates.set( |
| 524 |
template_name="verify_email", |
| 525 |
template="verify_email", |
| 526 |
) |
| 527 |
|
| 528 |
|
| 529 |
asyncio.run(main()) |
| 530 |
""" |
| 531 |
_response = await self._raw_client.set( |
| 532 |
template_name, |
| 533 |
template=template, |
| 534 |
body=body, |
| 535 |
from_=from_, |
| 536 |
result_url=result_url, |
| 537 |
subject=subject, |
| 538 |
syntax=syntax, |
| 539 |
url_lifetime_in_seconds=url_lifetime_in_seconds, |
| 540 |
include_email_in_redirect=include_email_in_redirect, |
| 541 |
enabled=enabled, |
| 542 |
request_options=request_options, |
| 543 |
) |
| 544 |
return _response.data |
| 545 |
|
| 546 |
async def update( |
| 547 |
self, |
| 548 |
template_name: EmailTemplateNameEnum, |
| 549 |
*, |
| 550 |
template: typing.Optional[EmailTemplateNameEnum] = OMIT, |
| 551 |
body: typing.Optional[str] = OMIT, |
| 552 |
from_: typing.Optional[str] = OMIT, |
| 553 |
result_url: typing.Optional[str] = OMIT, |
| 554 |
subject: typing.Optional[str] = OMIT, |
| 555 |
syntax: typing.Optional[str] = OMIT, |
| 556 |
url_lifetime_in_seconds: typing.Optional[float] = OMIT, |
| 557 |
include_email_in_redirect: typing.Optional[bool] = OMIT, |
| 558 |
enabled: typing.Optional[bool] = OMIT, |
| 559 |
request_options: typing.Optional[RequestOptions] = None, |
| 560 |
) -> UpdateEmailTemplateResponseContent: |
| 561 |
""" |
| 562 |
Modify an email template. |
| 563 |
|
| 564 |
Parameters |
| 565 |
---------- |
| 566 |
template_name : EmailTemplateNameEnum |
| 567 |
Template name. Can be `verify_email`, `verify_email_by_code`, `auth_email_by_code`, `reset_email`, `reset_email_by_code`, `welcome_email`, `blocked_account`, `stolen_credentials`, `enrollment_email`, `mfa_oob_code`, `user_invitation`, `async_approval`, `change_password` (legacy), or `password_reset` (legacy). |
| 568 |
|
| 569 |
template : typing.Optional[EmailTemplateNameEnum] |
| 570 |
|
| 571 |
body : typing.Optional[str] |
| 572 |
Body of the email template. |
| 573 |
|
| 574 |
from_ : typing.Optional[str] |
| 575 |
Senders `from` email address. |
| 576 |
|
| 577 |
result_url : typing.Optional[str] |
| 578 |
URL to redirect the user to after a successful action. |
| 579 |
|
| 580 |
subject : typing.Optional[str] |
| 581 |
Subject line of the email. |
| 582 |
|
| 583 |
syntax : typing.Optional[str] |
| 584 |
Syntax of the template body. |
| 585 |
|
| 586 |
url_lifetime_in_seconds : typing.Optional[float] |
| 587 |
Lifetime in seconds that the link within the email will be valid for. |
| 588 |
|
| 589 |
include_email_in_redirect : typing.Optional[bool] |
| 590 |
Whether the `reset_email` and `verify_email` templates should include the user's email address as the `email` parameter in the returnUrl (true) or whether no email address should be included in the redirect (false). Defaults to true. |
| 591 |
|
| 592 |
enabled : typing.Optional[bool] |
| 593 |
Whether the template is enabled (true) or disabled (false). |
| 594 |
|
| 595 |
request_options : typing.Optional[RequestOptions] |
| 596 |
Request-specific configuration. |
| 597 |
|
| 598 |
Returns |
| 599 |
------- |
| 600 |
UpdateEmailTemplateResponseContent |
| 601 |
Template successfully updated. |
| 602 |
|
| 603 |
Examples |
| 604 |
-------- |
| 605 |
import asyncio |
| 606 |
|
| 607 |
from auth0 import AsyncAuth0 |
| 608 |
|
| 609 |
client = AsyncAuth0( |
| 610 |
token="YOUR_TOKEN", |
| 611 |
) |
| 612 |
|
| 613 |
|
| 614 |
async def main() -> None: |
| 615 |
await client.email_templates.update( |
| 616 |
template_name="verify_email", |
| 617 |
) |
| 618 |
|
| 619 |
|
| 620 |
asyncio.run(main()) |
| 621 |
""" |
| 622 |
_response = await self._raw_client.update( |
| 623 |
template_name, |
| 624 |
template=template, |
| 625 |
body=body, |
| 626 |
from_=from_, |
| 627 |
result_url=result_url, |
| 628 |
subject=subject, |
| 629 |
syntax=syntax, |
| 630 |
url_lifetime_in_seconds=url_lifetime_in_seconds, |
| 631 |
include_email_in_redirect=include_email_in_redirect, |
| 632 |
enabled=enabled, |
| 633 |
request_options=request_options, |
| 634 |
) |
| 635 |
return _response.data |