| 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_verification_email_response_content import CreateVerificationEmailResponseContent |
| 8 |
from ...types.identity import Identity |
| 9 |
from .raw_client import AsyncRawVerificationEmailClient, RawVerificationEmailClient |
| 10 |
|
| 11 |
|
| 12 |
OMIT = typing.cast(typing.Any, ...) |
| 13 |
|
| 14 |
|
| 15 |
class VerificationEmailClient: |
| 16 |
def __init__(self, *, client_wrapper: SyncClientWrapper): |
| 17 |
self._raw_client = RawVerificationEmailClient(client_wrapper=client_wrapper) |
| 18 |
|
| 19 |
@property |
| 20 |
def with_raw_response(self) -> RawVerificationEmailClient: |
| 21 |
""" |
| 22 |
Retrieves a raw implementation of this client that returns raw responses. |
| 23 |
|
| 24 |
Returns |
| 25 |
------- |
| 26 |
RawVerificationEmailClient |
| 27 |
""" |
| 28 |
return self._raw_client |
| 29 |
|
| 30 |
def create( |
| 31 |
self, |
| 32 |
*, |
| 33 |
user_id: str, |
| 34 |
client_id: typing.Optional[str] = OMIT, |
| 35 |
identity: typing.Optional[Identity] = OMIT, |
| 36 |
organization_id: typing.Optional[str] = OMIT, |
| 37 |
request_options: typing.Optional[RequestOptions] = None, |
| 38 |
) -> CreateVerificationEmailResponseContent: |
| 39 |
""" |
| 40 |
Send an email to the specified user that asks them to click a link to [verify their email address](https://auth0.com/docs/email/custom#verification-email). |
| 41 |
|
| 42 |
Note: You must have the `Status` toggle enabled for the verification email template for the email to be sent. |
| 43 |
|
| 44 |
Parameters |
| 45 |
---------- |
| 46 |
user_id : str |
| 47 |
user_id of the user to send the verification email to. |
| 48 |
|
| 49 |
client_id : typing.Optional[str] |
| 50 |
client_id of the client (application). If no value provided, the global Client ID will be used. |
| 51 |
|
| 52 |
identity : typing.Optional[Identity] |
| 53 |
|
| 54 |
organization_id : typing.Optional[str] |
| 55 |
(Optional) Organization ID – the ID of the Organization. If provided, organization parameters will be made available to the email template and organization branding will be applied to the prompt. In addition, the redirect link in the prompt will include organization_id and organization_name query string parameters. |
| 56 |
|
| 57 |
request_options : typing.Optional[RequestOptions] |
| 58 |
Request-specific configuration. |
| 59 |
|
| 60 |
Returns |
| 61 |
------- |
| 62 |
CreateVerificationEmailResponseContent |
| 63 |
Job successfully created. |
| 64 |
|
| 65 |
Examples |
| 66 |
-------- |
| 67 |
from auth0 import Auth0 |
| 68 |
|
| 69 |
client = Auth0( |
| 70 |
token="YOUR_TOKEN", |
| 71 |
) |
| 72 |
client.jobs.verification_email.create( |
| 73 |
user_id="user_id", |
| 74 |
) |
| 75 |
""" |
| 76 |
_response = self._raw_client.create( |
| 77 |
user_id=user_id, |
| 78 |
client_id=client_id, |
| 79 |
identity=identity, |
| 80 |
organization_id=organization_id, |
| 81 |
request_options=request_options, |
| 82 |
) |
| 83 |
return _response.data |
| 84 |
|
| 85 |
|
| 86 |
class AsyncVerificationEmailClient: |
| 87 |
def __init__(self, *, client_wrapper: AsyncClientWrapper): |
| 88 |
self._raw_client = AsyncRawVerificationEmailClient(client_wrapper=client_wrapper) |
| 89 |
|
| 90 |
@property |
| 91 |
def with_raw_response(self) -> AsyncRawVerificationEmailClient: |
| 92 |
""" |
| 93 |
Retrieves a raw implementation of this client that returns raw responses. |
| 94 |
|
| 95 |
Returns |
| 96 |
------- |
| 97 |
AsyncRawVerificationEmailClient |
| 98 |
""" |
| 99 |
return self._raw_client |
| 100 |
|
| 101 |
async def create( |
| 102 |
self, |
| 103 |
*, |
| 104 |
user_id: str, |
| 105 |
client_id: typing.Optional[str] = OMIT, |
| 106 |
identity: typing.Optional[Identity] = OMIT, |
| 107 |
organization_id: typing.Optional[str] = OMIT, |
| 108 |
request_options: typing.Optional[RequestOptions] = None, |
| 109 |
) -> CreateVerificationEmailResponseContent: |
| 110 |
""" |
| 111 |
Send an email to the specified user that asks them to click a link to [verify their email address](https://auth0.com/docs/email/custom#verification-email). |
| 112 |
|
| 113 |
Note: You must have the `Status` toggle enabled for the verification email template for the email to be sent. |
| 114 |
|
| 115 |
Parameters |
| 116 |
---------- |
| 117 |
user_id : str |
| 118 |
user_id of the user to send the verification email to. |
| 119 |
|
| 120 |
client_id : typing.Optional[str] |
| 121 |
client_id of the client (application). If no value provided, the global Client ID will be used. |
| 122 |
|
| 123 |
identity : typing.Optional[Identity] |
| 124 |
|
| 125 |
organization_id : typing.Optional[str] |
| 126 |
(Optional) Organization ID – the ID of the Organization. If provided, organization parameters will be made available to the email template and organization branding will be applied to the prompt. In addition, the redirect link in the prompt will include organization_id and organization_name query string parameters. |
| 127 |
|
| 128 |
request_options : typing.Optional[RequestOptions] |
| 129 |
Request-specific configuration. |
| 130 |
|
| 131 |
Returns |
| 132 |
------- |
| 133 |
CreateVerificationEmailResponseContent |
| 134 |
Job successfully created. |
| 135 |
|
| 136 |
Examples |
| 137 |
-------- |
| 138 |
import asyncio |
| 139 |
|
| 140 |
from auth0 import AsyncAuth0 |
| 141 |
|
| 142 |
client = AsyncAuth0( |
| 143 |
token="YOUR_TOKEN", |
| 144 |
) |
| 145 |
|
| 146 |
|
| 147 |
async def main() -> None: |
| 148 |
await client.jobs.verification_email.create( |
| 149 |
user_id="user_id", |
| 150 |
) |
| 151 |
|
| 152 |
|
| 153 |
asyncio.run(main()) |
| 154 |
""" |
| 155 |
_response = await self._raw_client.create( |
| 156 |
user_id=user_id, |
| 157 |
client_id=client_id, |
| 158 |
identity=identity, |
| 159 |
organization_id=organization_id, |
| 160 |
request_options=request_options, |
| 161 |
) |
| 162 |
return _response.data |