| 1 |
|
| 2 |
|
| 3 |
from __future__ import annotations |
| 4 |
|
| 5 |
import typing |
| 6 |
|
| 7 |
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper |
| 8 |
from ..core.request_options import RequestOptions |
| 9 |
from ..types.get_branding_response_content import GetBrandingResponseContent |
| 10 |
from ..types.update_branding_colors import UpdateBrandingColors |
| 11 |
from ..types.update_branding_font import UpdateBrandingFont |
| 12 |
from ..types.update_branding_response_content import UpdateBrandingResponseContent |
| 13 |
from .raw_client import AsyncRawBrandingClient, RawBrandingClient |
| 14 |
|
| 15 |
if typing.TYPE_CHECKING: |
| 16 |
from .phone.client import AsyncPhoneClient, PhoneClient |
| 17 |
from .templates.client import AsyncTemplatesClient, TemplatesClient |
| 18 |
from .themes.client import AsyncThemesClient, ThemesClient |
| 19 |
|
| 20 |
OMIT = typing.cast(typing.Any, ...) |
| 21 |
|
| 22 |
|
| 23 |
class BrandingClient: |
| 24 |
def __init__(self, *, client_wrapper: SyncClientWrapper): |
| 25 |
self._raw_client = RawBrandingClient(client_wrapper=client_wrapper) |
| 26 |
self._client_wrapper = client_wrapper |
| 27 |
self._templates: typing.Optional[TemplatesClient] = None |
| 28 |
self._themes: typing.Optional[ThemesClient] = None |
| 29 |
self._phone: typing.Optional[PhoneClient] = None |
| 30 |
|
| 31 |
@property |
| 32 |
def with_raw_response(self) -> RawBrandingClient: |
| 33 |
""" |
| 34 |
Retrieves a raw implementation of this client that returns raw responses. |
| 35 |
|
| 36 |
Returns |
| 37 |
------- |
| 38 |
RawBrandingClient |
| 39 |
""" |
| 40 |
return self._raw_client |
| 41 |
|
| 42 |
def get(self, *, request_options: typing.Optional[RequestOptions] = None) -> GetBrandingResponseContent: |
| 43 |
""" |
| 44 |
Retrieve branding settings. |
| 45 |
|
| 46 |
Parameters |
| 47 |
---------- |
| 48 |
request_options : typing.Optional[RequestOptions] |
| 49 |
Request-specific configuration. |
| 50 |
|
| 51 |
Returns |
| 52 |
------- |
| 53 |
GetBrandingResponseContent |
| 54 |
Branding settings successfully retrieved. |
| 55 |
|
| 56 |
Examples |
| 57 |
-------- |
| 58 |
from auth0 import Auth0 |
| 59 |
|
| 60 |
client = Auth0( |
| 61 |
token="YOUR_TOKEN", |
| 62 |
) |
| 63 |
client.branding.get() |
| 64 |
""" |
| 65 |
_response = self._raw_client.get(request_options=request_options) |
| 66 |
return _response.data |
| 67 |
|
| 68 |
def update( |
| 69 |
self, |
| 70 |
*, |
| 71 |
colors: typing.Optional[UpdateBrandingColors] = OMIT, |
| 72 |
favicon_url: typing.Optional[str] = OMIT, |
| 73 |
logo_url: typing.Optional[str] = OMIT, |
| 74 |
font: typing.Optional[UpdateBrandingFont] = OMIT, |
| 75 |
request_options: typing.Optional[RequestOptions] = None, |
| 76 |
) -> UpdateBrandingResponseContent: |
| 77 |
""" |
| 78 |
Update branding settings. |
| 79 |
|
| 80 |
Parameters |
| 81 |
---------- |
| 82 |
colors : typing.Optional[UpdateBrandingColors] |
| 83 |
|
| 84 |
favicon_url : typing.Optional[str] |
| 85 |
URL for the favicon. Must use HTTPS. |
| 86 |
|
| 87 |
logo_url : typing.Optional[str] |
| 88 |
URL for the logo. Must use HTTPS. |
| 89 |
|
| 90 |
font : typing.Optional[UpdateBrandingFont] |
| 91 |
|
| 92 |
request_options : typing.Optional[RequestOptions] |
| 93 |
Request-specific configuration. |
| 94 |
|
| 95 |
Returns |
| 96 |
------- |
| 97 |
UpdateBrandingResponseContent |
| 98 |
Branding settings successfully updated. |
| 99 |
|
| 100 |
Examples |
| 101 |
-------- |
| 102 |
from auth0 import Auth0 |
| 103 |
|
| 104 |
client = Auth0( |
| 105 |
token="YOUR_TOKEN", |
| 106 |
) |
| 107 |
client.branding.update() |
| 108 |
""" |
| 109 |
_response = self._raw_client.update( |
| 110 |
colors=colors, favicon_url=favicon_url, logo_url=logo_url, font=font, request_options=request_options |
| 111 |
) |
| 112 |
return _response.data |
| 113 |
|
| 114 |
@property |
| 115 |
def templates(self): |
| 116 |
if self._templates is None: |
| 117 |
from .templates.client import TemplatesClient |
| 118 |
|
| 119 |
self._templates = TemplatesClient(client_wrapper=self._client_wrapper) |
| 120 |
return self._templates |
| 121 |
|
| 122 |
@property |
| 123 |
def themes(self): |
| 124 |
if self._themes is None: |
| 125 |
from .themes.client import ThemesClient |
| 126 |
|
| 127 |
self._themes = ThemesClient(client_wrapper=self._client_wrapper) |
| 128 |
return self._themes |
| 129 |
|
| 130 |
@property |
| 131 |
def phone(self): |
| 132 |
if self._phone is None: |
| 133 |
from .phone.client import PhoneClient |
| 134 |
|
| 135 |
self._phone = PhoneClient(client_wrapper=self._client_wrapper) |
| 136 |
return self._phone |
| 137 |
|
| 138 |
|
| 139 |
class AsyncBrandingClient: |
| 140 |
def __init__(self, *, client_wrapper: AsyncClientWrapper): |
| 141 |
self._raw_client = AsyncRawBrandingClient(client_wrapper=client_wrapper) |
| 142 |
self._client_wrapper = client_wrapper |
| 143 |
self._templates: typing.Optional[AsyncTemplatesClient] = None |
| 144 |
self._themes: typing.Optional[AsyncThemesClient] = None |
| 145 |
self._phone: typing.Optional[AsyncPhoneClient] = None |
| 146 |
|
| 147 |
@property |
| 148 |
def with_raw_response(self) -> AsyncRawBrandingClient: |
| 149 |
""" |
| 150 |
Retrieves a raw implementation of this client that returns raw responses. |
| 151 |
|
| 152 |
Returns |
| 153 |
------- |
| 154 |
AsyncRawBrandingClient |
| 155 |
""" |
| 156 |
return self._raw_client |
| 157 |
|
| 158 |
async def get(self, *, request_options: typing.Optional[RequestOptions] = None) -> GetBrandingResponseContent: |
| 159 |
""" |
| 160 |
Retrieve branding settings. |
| 161 |
|
| 162 |
Parameters |
| 163 |
---------- |
| 164 |
request_options : typing.Optional[RequestOptions] |
| 165 |
Request-specific configuration. |
| 166 |
|
| 167 |
Returns |
| 168 |
------- |
| 169 |
GetBrandingResponseContent |
| 170 |
Branding settings successfully retrieved. |
| 171 |
|
| 172 |
Examples |
| 173 |
-------- |
| 174 |
import asyncio |
| 175 |
|
| 176 |
from auth0 import AsyncAuth0 |
| 177 |
|
| 178 |
client = AsyncAuth0( |
| 179 |
token="YOUR_TOKEN", |
| 180 |
) |
| 181 |
|
| 182 |
|
| 183 |
async def main() -> None: |
| 184 |
await client.branding.get() |
| 185 |
|
| 186 |
|
| 187 |
asyncio.run(main()) |
| 188 |
""" |
| 189 |
_response = await self._raw_client.get(request_options=request_options) |
| 190 |
return _response.data |
| 191 |
|
| 192 |
async def update( |
| 193 |
self, |
| 194 |
*, |
| 195 |
colors: typing.Optional[UpdateBrandingColors] = OMIT, |
| 196 |
favicon_url: typing.Optional[str] = OMIT, |
| 197 |
logo_url: typing.Optional[str] = OMIT, |
| 198 |
font: typing.Optional[UpdateBrandingFont] = OMIT, |
| 199 |
request_options: typing.Optional[RequestOptions] = None, |
| 200 |
) -> UpdateBrandingResponseContent: |
| 201 |
""" |
| 202 |
Update branding settings. |
| 203 |
|
| 204 |
Parameters |
| 205 |
---------- |
| 206 |
colors : typing.Optional[UpdateBrandingColors] |
| 207 |
|
| 208 |
favicon_url : typing.Optional[str] |
| 209 |
URL for the favicon. Must use HTTPS. |
| 210 |
|
| 211 |
logo_url : typing.Optional[str] |
| 212 |
URL for the logo. Must use HTTPS. |
| 213 |
|
| 214 |
font : typing.Optional[UpdateBrandingFont] |
| 215 |
|
| 216 |
request_options : typing.Optional[RequestOptions] |
| 217 |
Request-specific configuration. |
| 218 |
|
| 219 |
Returns |
| 220 |
------- |
| 221 |
UpdateBrandingResponseContent |
| 222 |
Branding settings successfully updated. |
| 223 |
|
| 224 |
Examples |
| 225 |
-------- |
| 226 |
import asyncio |
| 227 |
|
| 228 |
from auth0 import AsyncAuth0 |
| 229 |
|
| 230 |
client = AsyncAuth0( |
| 231 |
token="YOUR_TOKEN", |
| 232 |
) |
| 233 |
|
| 234 |
|
| 235 |
async def main() -> None: |
| 236 |
await client.branding.update() |
| 237 |
|
| 238 |
|
| 239 |
asyncio.run(main()) |
| 240 |
""" |
| 241 |
_response = await self._raw_client.update( |
| 242 |
colors=colors, favicon_url=favicon_url, logo_url=logo_url, font=font, request_options=request_options |
| 243 |
) |
| 244 |
return _response.data |
| 245 |
|
| 246 |
@property |
| 247 |
def templates(self): |
| 248 |
if self._templates is None: |
| 249 |
from .templates.client import AsyncTemplatesClient |
| 250 |
|
| 251 |
self._templates = AsyncTemplatesClient(client_wrapper=self._client_wrapper) |
| 252 |
return self._templates |
| 253 |
|
| 254 |
@property |
| 255 |
def themes(self): |
| 256 |
if self._themes is None: |
| 257 |
from .themes.client import AsyncThemesClient |
| 258 |
|
| 259 |
self._themes = AsyncThemesClient(client_wrapper=self._client_wrapper) |
| 260 |
return self._themes |
| 261 |
|
| 262 |
@property |
| 263 |
def phone(self): |
| 264 |
if self._phone is None: |
| 265 |
from .phone.client import AsyncPhoneClient |
| 266 |
|
| 267 |
self._phone = AsyncPhoneClient(client_wrapper=self._client_wrapper) |
| 268 |
return self._phone |