| 1 |
|
| 2 |
|
| 3 |
import typing |
| 4 |
|
| 5 |
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper |
| 6 |
from ...core.request_options import RequestOptions |
| 7 |
from ...types.get_custom_texts_by_language_response_content import GetCustomTextsByLanguageResponseContent |
| 8 |
from ...types.prompt_group_name_enum import PromptGroupNameEnum |
| 9 |
from ...types.prompt_language_enum import PromptLanguageEnum |
| 10 |
from ...types.sets_custom_texts_by_language_request_content import SetsCustomTextsByLanguageRequestContent |
| 11 |
from .raw_client import AsyncRawCustomTextClient, RawCustomTextClient |
| 12 |
|
| 13 |
|
| 14 |
OMIT = typing.cast(typing.Any, ...) |
| 15 |
|
| 16 |
|
| 17 |
class CustomTextClient: |
| 18 |
def __init__(self, *, client_wrapper: SyncClientWrapper): |
| 19 |
self._raw_client = RawCustomTextClient(client_wrapper=client_wrapper) |
| 20 |
|
| 21 |
@property |
| 22 |
def with_raw_response(self) -> RawCustomTextClient: |
| 23 |
""" |
| 24 |
Retrieves a raw implementation of this client that returns raw responses. |
| 25 |
|
| 26 |
Returns |
| 27 |
------- |
| 28 |
RawCustomTextClient |
| 29 |
""" |
| 30 |
return self._raw_client |
| 31 |
|
| 32 |
def get( |
| 33 |
self, |
| 34 |
prompt: PromptGroupNameEnum, |
| 35 |
language: PromptLanguageEnum, |
| 36 |
*, |
| 37 |
request_options: typing.Optional[RequestOptions] = None, |
| 38 |
) -> GetCustomTextsByLanguageResponseContent: |
| 39 |
""" |
| 40 |
Retrieve custom text for a specific prompt and language. |
| 41 |
|
| 42 |
Parameters |
| 43 |
---------- |
| 44 |
prompt : PromptGroupNameEnum |
| 45 |
Name of the prompt. |
| 46 |
|
| 47 |
language : PromptLanguageEnum |
| 48 |
Language to update. |
| 49 |
|
| 50 |
request_options : typing.Optional[RequestOptions] |
| 51 |
Request-specific configuration. |
| 52 |
|
| 53 |
Returns |
| 54 |
------- |
| 55 |
GetCustomTextsByLanguageResponseContent |
| 56 |
Prompt dictionaries successfully retrieved. |
| 57 |
|
| 58 |
Examples |
| 59 |
-------- |
| 60 |
from auth0 import Auth0 |
| 61 |
|
| 62 |
client = Auth0( |
| 63 |
token="YOUR_TOKEN", |
| 64 |
) |
| 65 |
client.prompts.custom_text.get( |
| 66 |
prompt="login", |
| 67 |
language="am", |
| 68 |
) |
| 69 |
""" |
| 70 |
_response = self._raw_client.get(prompt, language, request_options=request_options) |
| 71 |
return _response.data |
| 72 |
|
| 73 |
def set( |
| 74 |
self, |
| 75 |
prompt: PromptGroupNameEnum, |
| 76 |
language: PromptLanguageEnum, |
| 77 |
*, |
| 78 |
request: SetsCustomTextsByLanguageRequestContent, |
| 79 |
request_options: typing.Optional[RequestOptions] = None, |
| 80 |
) -> None: |
| 81 |
""" |
| 82 |
Set custom text for a specific prompt. Existing texts will be overwritten. |
| 83 |
|
| 84 |
Parameters |
| 85 |
---------- |
| 86 |
prompt : PromptGroupNameEnum |
| 87 |
Name of the prompt. |
| 88 |
|
| 89 |
language : PromptLanguageEnum |
| 90 |
Language to update. |
| 91 |
|
| 92 |
request : SetsCustomTextsByLanguageRequestContent |
| 93 |
|
| 94 |
request_options : typing.Optional[RequestOptions] |
| 95 |
Request-specific configuration. |
| 96 |
|
| 97 |
Returns |
| 98 |
------- |
| 99 |
None |
| 100 |
|
| 101 |
Examples |
| 102 |
-------- |
| 103 |
from auth0 import Auth0 |
| 104 |
|
| 105 |
client = Auth0( |
| 106 |
token="YOUR_TOKEN", |
| 107 |
) |
| 108 |
client.prompts.custom_text.set( |
| 109 |
prompt="login", |
| 110 |
language="am", |
| 111 |
request={"key": "value"}, |
| 112 |
) |
| 113 |
""" |
| 114 |
_response = self._raw_client.set(prompt, language, request=request, request_options=request_options) |
| 115 |
return _response.data |
| 116 |
|
| 117 |
|
| 118 |
class AsyncCustomTextClient: |
| 119 |
def __init__(self, *, client_wrapper: AsyncClientWrapper): |
| 120 |
self._raw_client = AsyncRawCustomTextClient(client_wrapper=client_wrapper) |
| 121 |
|
| 122 |
@property |
| 123 |
def with_raw_response(self) -> AsyncRawCustomTextClient: |
| 124 |
""" |
| 125 |
Retrieves a raw implementation of this client that returns raw responses. |
| 126 |
|
| 127 |
Returns |
| 128 |
------- |
| 129 |
AsyncRawCustomTextClient |
| 130 |
""" |
| 131 |
return self._raw_client |
| 132 |
|
| 133 |
async def get( |
| 134 |
self, |
| 135 |
prompt: PromptGroupNameEnum, |
| 136 |
language: PromptLanguageEnum, |
| 137 |
*, |
| 138 |
request_options: typing.Optional[RequestOptions] = None, |
| 139 |
) -> GetCustomTextsByLanguageResponseContent: |
| 140 |
""" |
| 141 |
Retrieve custom text for a specific prompt and language. |
| 142 |
|
| 143 |
Parameters |
| 144 |
---------- |
| 145 |
prompt : PromptGroupNameEnum |
| 146 |
Name of the prompt. |
| 147 |
|
| 148 |
language : PromptLanguageEnum |
| 149 |
Language to update. |
| 150 |
|
| 151 |
request_options : typing.Optional[RequestOptions] |
| 152 |
Request-specific configuration. |
| 153 |
|
| 154 |
Returns |
| 155 |
------- |
| 156 |
GetCustomTextsByLanguageResponseContent |
| 157 |
Prompt dictionaries successfully retrieved. |
| 158 |
|
| 159 |
Examples |
| 160 |
-------- |
| 161 |
import asyncio |
| 162 |
|
| 163 |
from auth0 import AsyncAuth0 |
| 164 |
|
| 165 |
client = AsyncAuth0( |
| 166 |
token="YOUR_TOKEN", |
| 167 |
) |
| 168 |
|
| 169 |
|
| 170 |
async def main() -> None: |
| 171 |
await client.prompts.custom_text.get( |
| 172 |
prompt="login", |
| 173 |
language="am", |
| 174 |
) |
| 175 |
|
| 176 |
|
| 177 |
asyncio.run(main()) |
| 178 |
""" |
| 179 |
_response = await self._raw_client.get(prompt, language, request_options=request_options) |
| 180 |
return _response.data |
| 181 |
|
| 182 |
async def set( |
| 183 |
self, |
| 184 |
prompt: PromptGroupNameEnum, |
| 185 |
language: PromptLanguageEnum, |
| 186 |
*, |
| 187 |
request: SetsCustomTextsByLanguageRequestContent, |
| 188 |
request_options: typing.Optional[RequestOptions] = None, |
| 189 |
) -> None: |
| 190 |
""" |
| 191 |
Set custom text for a specific prompt. Existing texts will be overwritten. |
| 192 |
|
| 193 |
Parameters |
| 194 |
---------- |
| 195 |
prompt : PromptGroupNameEnum |
| 196 |
Name of the prompt. |
| 197 |
|
| 198 |
language : PromptLanguageEnum |
| 199 |
Language to update. |
| 200 |
|
| 201 |
request : SetsCustomTextsByLanguageRequestContent |
| 202 |
|
| 203 |
request_options : typing.Optional[RequestOptions] |
| 204 |
Request-specific configuration. |
| 205 |
|
| 206 |
Returns |
| 207 |
------- |
| 208 |
None |
| 209 |
|
| 210 |
Examples |
| 211 |
-------- |
| 212 |
import asyncio |
| 213 |
|
| 214 |
from auth0 import AsyncAuth0 |
| 215 |
|
| 216 |
client = AsyncAuth0( |
| 217 |
token="YOUR_TOKEN", |
| 218 |
) |
| 219 |
|
| 220 |
|
| 221 |
async def main() -> None: |
| 222 |
await client.prompts.custom_text.set( |
| 223 |
prompt="login", |
| 224 |
language="am", |
| 225 |
request={"key": "value"}, |
| 226 |
) |
| 227 |
|
| 228 |
|
| 229 |
asyncio.run(main()) |
| 230 |
""" |
| 231 |
_response = await self._raw_client.set(prompt, language, request=request, request_options=request_options) |
| 232 |
return _response.data |