| 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_risk_assessments_settings_response_content import GetRiskAssessmentsSettingsResponseContent |
| 10 |
from ...types.update_risk_assessments_settings_response_content import UpdateRiskAssessmentsSettingsResponseContent |
| 11 |
from .raw_client import AsyncRawSettingsClient, RawSettingsClient |
| 12 |
|
| 13 |
if typing.TYPE_CHECKING: |
| 14 |
from .new_device.client import AsyncNewDeviceClient, NewDeviceClient |
| 15 |
|
| 16 |
OMIT = typing.cast(typing.Any, ...) |
| 17 |
|
| 18 |
|
| 19 |
class SettingsClient: |
| 20 |
def __init__(self, *, client_wrapper: SyncClientWrapper): |
| 21 |
self._raw_client = RawSettingsClient(client_wrapper=client_wrapper) |
| 22 |
self._client_wrapper = client_wrapper |
| 23 |
self._new_device: typing.Optional[NewDeviceClient] = None |
| 24 |
|
| 25 |
@property |
| 26 |
def with_raw_response(self) -> RawSettingsClient: |
| 27 |
""" |
| 28 |
Retrieves a raw implementation of this client that returns raw responses. |
| 29 |
|
| 30 |
Returns |
| 31 |
------- |
| 32 |
RawSettingsClient |
| 33 |
""" |
| 34 |
return self._raw_client |
| 35 |
|
| 36 |
def get( |
| 37 |
self, *, request_options: typing.Optional[RequestOptions] = None |
| 38 |
) -> GetRiskAssessmentsSettingsResponseContent: |
| 39 |
""" |
| 40 |
Gets the tenant settings for risk assessments |
| 41 |
|
| 42 |
Parameters |
| 43 |
---------- |
| 44 |
request_options : typing.Optional[RequestOptions] |
| 45 |
Request-specific configuration. |
| 46 |
|
| 47 |
Returns |
| 48 |
------- |
| 49 |
GetRiskAssessmentsSettingsResponseContent |
| 50 |
Returning risk assessment settings for the tenant |
| 51 |
|
| 52 |
Examples |
| 53 |
-------- |
| 54 |
from auth0 import Auth0 |
| 55 |
|
| 56 |
client = Auth0( |
| 57 |
token="YOUR_TOKEN", |
| 58 |
) |
| 59 |
client.risk_assessments.settings.get() |
| 60 |
""" |
| 61 |
_response = self._raw_client.get(request_options=request_options) |
| 62 |
return _response.data |
| 63 |
|
| 64 |
def update( |
| 65 |
self, *, enabled: bool, request_options: typing.Optional[RequestOptions] = None |
| 66 |
) -> UpdateRiskAssessmentsSettingsResponseContent: |
| 67 |
""" |
| 68 |
Updates the tenant settings for risk assessments |
| 69 |
|
| 70 |
Parameters |
| 71 |
---------- |
| 72 |
enabled : bool |
| 73 |
Whether or not risk assessment is enabled. |
| 74 |
|
| 75 |
request_options : typing.Optional[RequestOptions] |
| 76 |
Request-specific configuration. |
| 77 |
|
| 78 |
Returns |
| 79 |
------- |
| 80 |
UpdateRiskAssessmentsSettingsResponseContent |
| 81 |
Returning risk assessment settings for the tenant |
| 82 |
|
| 83 |
Examples |
| 84 |
-------- |
| 85 |
from auth0 import Auth0 |
| 86 |
|
| 87 |
client = Auth0( |
| 88 |
token="YOUR_TOKEN", |
| 89 |
) |
| 90 |
client.risk_assessments.settings.update( |
| 91 |
enabled=True, |
| 92 |
) |
| 93 |
""" |
| 94 |
_response = self._raw_client.update(enabled=enabled, request_options=request_options) |
| 95 |
return _response.data |
| 96 |
|
| 97 |
@property |
| 98 |
def new_device(self): |
| 99 |
if self._new_device is None: |
| 100 |
from .new_device.client import NewDeviceClient |
| 101 |
|
| 102 |
self._new_device = NewDeviceClient(client_wrapper=self._client_wrapper) |
| 103 |
return self._new_device |
| 104 |
|
| 105 |
|
| 106 |
class AsyncSettingsClient: |
| 107 |
def __init__(self, *, client_wrapper: AsyncClientWrapper): |
| 108 |
self._raw_client = AsyncRawSettingsClient(client_wrapper=client_wrapper) |
| 109 |
self._client_wrapper = client_wrapper |
| 110 |
self._new_device: typing.Optional[AsyncNewDeviceClient] = None |
| 111 |
|
| 112 |
@property |
| 113 |
def with_raw_response(self) -> AsyncRawSettingsClient: |
| 114 |
""" |
| 115 |
Retrieves a raw implementation of this client that returns raw responses. |
| 116 |
|
| 117 |
Returns |
| 118 |
------- |
| 119 |
AsyncRawSettingsClient |
| 120 |
""" |
| 121 |
return self._raw_client |
| 122 |
|
| 123 |
async def get( |
| 124 |
self, *, request_options: typing.Optional[RequestOptions] = None |
| 125 |
) -> GetRiskAssessmentsSettingsResponseContent: |
| 126 |
""" |
| 127 |
Gets the tenant settings for risk assessments |
| 128 |
|
| 129 |
Parameters |
| 130 |
---------- |
| 131 |
request_options : typing.Optional[RequestOptions] |
| 132 |
Request-specific configuration. |
| 133 |
|
| 134 |
Returns |
| 135 |
------- |
| 136 |
GetRiskAssessmentsSettingsResponseContent |
| 137 |
Returning risk assessment settings for the tenant |
| 138 |
|
| 139 |
Examples |
| 140 |
-------- |
| 141 |
import asyncio |
| 142 |
|
| 143 |
from auth0 import AsyncAuth0 |
| 144 |
|
| 145 |
client = AsyncAuth0( |
| 146 |
token="YOUR_TOKEN", |
| 147 |
) |
| 148 |
|
| 149 |
|
| 150 |
async def main() -> None: |
| 151 |
await client.risk_assessments.settings.get() |
| 152 |
|
| 153 |
|
| 154 |
asyncio.run(main()) |
| 155 |
""" |
| 156 |
_response = await self._raw_client.get(request_options=request_options) |
| 157 |
return _response.data |
| 158 |
|
| 159 |
async def update( |
| 160 |
self, *, enabled: bool, request_options: typing.Optional[RequestOptions] = None |
| 161 |
) -> UpdateRiskAssessmentsSettingsResponseContent: |
| 162 |
""" |
| 163 |
Updates the tenant settings for risk assessments |
| 164 |
|
| 165 |
Parameters |
| 166 |
---------- |
| 167 |
enabled : bool |
| 168 |
Whether or not risk assessment is enabled. |
| 169 |
|
| 170 |
request_options : typing.Optional[RequestOptions] |
| 171 |
Request-specific configuration. |
| 172 |
|
| 173 |
Returns |
| 174 |
------- |
| 175 |
UpdateRiskAssessmentsSettingsResponseContent |
| 176 |
Returning risk assessment settings for the tenant |
| 177 |
|
| 178 |
Examples |
| 179 |
-------- |
| 180 |
import asyncio |
| 181 |
|
| 182 |
from auth0 import AsyncAuth0 |
| 183 |
|
| 184 |
client = AsyncAuth0( |
| 185 |
token="YOUR_TOKEN", |
| 186 |
) |
| 187 |
|
| 188 |
|
| 189 |
async def main() -> None: |
| 190 |
await client.risk_assessments.settings.update( |
| 191 |
enabled=True, |
| 192 |
) |
| 193 |
|
| 194 |
|
| 195 |
asyncio.run(main()) |
| 196 |
""" |
| 197 |
_response = await self._raw_client.update(enabled=enabled, request_options=request_options) |
| 198 |
return _response.data |
| 199 |
|
| 200 |
@property |
| 201 |
def new_device(self): |
| 202 |
if self._new_device is None: |
| 203 |
from .new_device.client import AsyncNewDeviceClient |
| 204 |
|
| 205 |
self._new_device = AsyncNewDeviceClient(client_wrapper=self._client_wrapper) |
| 206 |
return self._new_device |