| 1 |
|
| 2 |
|
| 3 |
import typing |
| 4 |
|
| 5 |
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper |
| 6 |
from ...core.pagination import AsyncPager, SyncPager |
| 7 |
from ...core.request_options import RequestOptions |
| 8 |
from ...types.connection_enabled_client import ConnectionEnabledClient |
| 9 |
from ...types.get_connection_enabled_clients_response_content import GetConnectionEnabledClientsResponseContent |
| 10 |
from ...types.update_enabled_client_connections_request_content import UpdateEnabledClientConnectionsRequestContent |
| 11 |
from .raw_client import AsyncRawClientsClient, RawClientsClient |
| 12 |
|
| 13 |
|
| 14 |
OMIT = typing.cast(typing.Any, ...) |
| 15 |
|
| 16 |
|
| 17 |
class ClientsClient: |
| 18 |
def __init__(self, *, client_wrapper: SyncClientWrapper): |
| 19 |
self._raw_client = RawClientsClient(client_wrapper=client_wrapper) |
| 20 |
|
| 21 |
@property |
| 22 |
def with_raw_response(self) -> RawClientsClient: |
| 23 |
""" |
| 24 |
Retrieves a raw implementation of this client that returns raw responses. |
| 25 |
|
| 26 |
Returns |
| 27 |
------- |
| 28 |
RawClientsClient |
| 29 |
""" |
| 30 |
return self._raw_client |
| 31 |
|
| 32 |
def get( |
| 33 |
self, |
| 34 |
id: str, |
| 35 |
*, |
| 36 |
take: typing.Optional[int] = 50, |
| 37 |
from_: typing.Optional[str] = None, |
| 38 |
request_options: typing.Optional[RequestOptions] = None, |
| 39 |
) -> SyncPager[ConnectionEnabledClient, GetConnectionEnabledClientsResponseContent]: |
| 40 |
""" |
| 41 |
Retrieve all clients that have the specified [connection](https://auth0.com/docs/authenticate/identity-providers) enabled. |
| 42 |
|
| 43 |
**Note**: The first time you call this endpoint, omit the `from` parameter. If there are more results, a `next` value is included in the response. You can use this for subsequent API calls. When `next` is no longer included in the response, no further results are remaining. |
| 44 |
|
| 45 |
Parameters |
| 46 |
---------- |
| 47 |
id : str |
| 48 |
The id of the connection for which enabled clients are to be retrieved |
| 49 |
|
| 50 |
take : typing.Optional[int] |
| 51 |
Number of results per page. Defaults to 50. |
| 52 |
|
| 53 |
from_ : typing.Optional[str] |
| 54 |
Optional Id from which to start selection. |
| 55 |
|
| 56 |
request_options : typing.Optional[RequestOptions] |
| 57 |
Request-specific configuration. |
| 58 |
|
| 59 |
Returns |
| 60 |
------- |
| 61 |
SyncPager[ConnectionEnabledClient, GetConnectionEnabledClientsResponseContent] |
| 62 |
Success |
| 63 |
|
| 64 |
Examples |
| 65 |
-------- |
| 66 |
from auth0 import Auth0 |
| 67 |
|
| 68 |
client = Auth0( |
| 69 |
token="YOUR_TOKEN", |
| 70 |
) |
| 71 |
response = client.connections.clients.get( |
| 72 |
id="id", |
| 73 |
take=1, |
| 74 |
from_="from", |
| 75 |
) |
| 76 |
for item in response: |
| 77 |
yield item |
| 78 |
# alternatively, you can paginate page-by-page |
| 79 |
for page in response.iter_pages(): |
| 80 |
yield page |
| 81 |
""" |
| 82 |
return self._raw_client.get(id, take=take, from_=from_, request_options=request_options) |
| 83 |
|
| 84 |
def update( |
| 85 |
self, |
| 86 |
id: str, |
| 87 |
*, |
| 88 |
request: UpdateEnabledClientConnectionsRequestContent, |
| 89 |
request_options: typing.Optional[RequestOptions] = None, |
| 90 |
) -> None: |
| 91 |
""" |
| 92 |
Parameters |
| 93 |
---------- |
| 94 |
id : str |
| 95 |
The id of the connection to modify |
| 96 |
|
| 97 |
request : UpdateEnabledClientConnectionsRequestContent |
| 98 |
|
| 99 |
request_options : typing.Optional[RequestOptions] |
| 100 |
Request-specific configuration. |
| 101 |
|
| 102 |
Returns |
| 103 |
------- |
| 104 |
None |
| 105 |
|
| 106 |
Examples |
| 107 |
-------- |
| 108 |
from auth0 import Auth0, UpdateEnabledClientConnectionsRequestContentItem |
| 109 |
|
| 110 |
client = Auth0( |
| 111 |
token="YOUR_TOKEN", |
| 112 |
) |
| 113 |
client.connections.clients.update( |
| 114 |
id="id", |
| 115 |
request=[ |
| 116 |
UpdateEnabledClientConnectionsRequestContentItem( |
| 117 |
client_id="client_id", |
| 118 |
status=True, |
| 119 |
) |
| 120 |
], |
| 121 |
) |
| 122 |
""" |
| 123 |
_response = self._raw_client.update(id, request=request, request_options=request_options) |
| 124 |
return _response.data |
| 125 |
|
| 126 |
|
| 127 |
class AsyncClientsClient: |
| 128 |
def __init__(self, *, client_wrapper: AsyncClientWrapper): |
| 129 |
self._raw_client = AsyncRawClientsClient(client_wrapper=client_wrapper) |
| 130 |
|
| 131 |
@property |
| 132 |
def with_raw_response(self) -> AsyncRawClientsClient: |
| 133 |
""" |
| 134 |
Retrieves a raw implementation of this client that returns raw responses. |
| 135 |
|
| 136 |
Returns |
| 137 |
------- |
| 138 |
AsyncRawClientsClient |
| 139 |
""" |
| 140 |
return self._raw_client |
| 141 |
|
| 142 |
async def get( |
| 143 |
self, |
| 144 |
id: str, |
| 145 |
*, |
| 146 |
take: typing.Optional[int] = 50, |
| 147 |
from_: typing.Optional[str] = None, |
| 148 |
request_options: typing.Optional[RequestOptions] = None, |
| 149 |
) -> AsyncPager[ConnectionEnabledClient, GetConnectionEnabledClientsResponseContent]: |
| 150 |
""" |
| 151 |
Retrieve all clients that have the specified [connection](https://auth0.com/docs/authenticate/identity-providers) enabled. |
| 152 |
|
| 153 |
**Note**: The first time you call this endpoint, omit the `from` parameter. If there are more results, a `next` value is included in the response. You can use this for subsequent API calls. When `next` is no longer included in the response, no further results are remaining. |
| 154 |
|
| 155 |
Parameters |
| 156 |
---------- |
| 157 |
id : str |
| 158 |
The id of the connection for which enabled clients are to be retrieved |
| 159 |
|
| 160 |
take : typing.Optional[int] |
| 161 |
Number of results per page. Defaults to 50. |
| 162 |
|
| 163 |
from_ : typing.Optional[str] |
| 164 |
Optional Id from which to start selection. |
| 165 |
|
| 166 |
request_options : typing.Optional[RequestOptions] |
| 167 |
Request-specific configuration. |
| 168 |
|
| 169 |
Returns |
| 170 |
------- |
| 171 |
AsyncPager[ConnectionEnabledClient, GetConnectionEnabledClientsResponseContent] |
| 172 |
Success |
| 173 |
|
| 174 |
Examples |
| 175 |
-------- |
| 176 |
import asyncio |
| 177 |
|
| 178 |
from auth0 import AsyncAuth0 |
| 179 |
|
| 180 |
client = AsyncAuth0( |
| 181 |
token="YOUR_TOKEN", |
| 182 |
) |
| 183 |
|
| 184 |
|
| 185 |
async def main() -> None: |
| 186 |
response = await client.connections.clients.get( |
| 187 |
id="id", |
| 188 |
take=1, |
| 189 |
from_="from", |
| 190 |
) |
| 191 |
async for item in response: |
| 192 |
yield item |
| 193 |
|
| 194 |
# alternatively, you can paginate page-by-page |
| 195 |
async for page in response.iter_pages(): |
| 196 |
yield page |
| 197 |
|
| 198 |
|
| 199 |
asyncio.run(main()) |
| 200 |
""" |
| 201 |
return await self._raw_client.get(id, take=take, from_=from_, request_options=request_options) |
| 202 |
|
| 203 |
async def update( |
| 204 |
self, |
| 205 |
id: str, |
| 206 |
*, |
| 207 |
request: UpdateEnabledClientConnectionsRequestContent, |
| 208 |
request_options: typing.Optional[RequestOptions] = None, |
| 209 |
) -> None: |
| 210 |
""" |
| 211 |
Parameters |
| 212 |
---------- |
| 213 |
id : str |
| 214 |
The id of the connection to modify |
| 215 |
|
| 216 |
request : UpdateEnabledClientConnectionsRequestContent |
| 217 |
|
| 218 |
request_options : typing.Optional[RequestOptions] |
| 219 |
Request-specific configuration. |
| 220 |
|
| 221 |
Returns |
| 222 |
------- |
| 223 |
None |
| 224 |
|
| 225 |
Examples |
| 226 |
-------- |
| 227 |
import asyncio |
| 228 |
|
| 229 |
from auth0 import AsyncAuth0, UpdateEnabledClientConnectionsRequestContentItem |
| 230 |
|
| 231 |
client = AsyncAuth0( |
| 232 |
token="YOUR_TOKEN", |
| 233 |
) |
| 234 |
|
| 235 |
|
| 236 |
async def main() -> None: |
| 237 |
await client.connections.clients.update( |
| 238 |
id="id", |
| 239 |
request=[ |
| 240 |
UpdateEnabledClientConnectionsRequestContentItem( |
| 241 |
client_id="client_id", |
| 242 |
status=True, |
| 243 |
) |
| 244 |
], |
| 245 |
) |
| 246 |
|
| 247 |
|
| 248 |
asyncio.run(main()) |
| 249 |
""" |
| 250 |
_response = await self._raw_client.update(id, request=request, request_options=request_options) |
| 251 |
return _response.data |