| 1 |
|
| 2 |
|
| 3 |
from __future__ import annotations |
| 4 |
|
| 5 |
import typing |
| 6 |
|
| 7 |
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper |
| 8 |
from ..core.pagination import AsyncPager, SyncPager |
| 9 |
from ..core.request_options import RequestOptions |
| 10 |
from ..types.client_grant_allow_any_organization_enum import ClientGrantAllowAnyOrganizationEnum |
| 11 |
from ..types.client_grant_default_for_enum import ClientGrantDefaultForEnum |
| 12 |
from ..types.client_grant_organization_nullable_usage_enum import ClientGrantOrganizationNullableUsageEnum |
| 13 |
from ..types.client_grant_organization_usage_enum import ClientGrantOrganizationUsageEnum |
| 14 |
from ..types.client_grant_response_content import ClientGrantResponseContent |
| 15 |
from ..types.client_grant_subject_type_enum import ClientGrantSubjectTypeEnum |
| 16 |
from ..types.create_client_grant_response_content import CreateClientGrantResponseContent |
| 17 |
from ..types.get_client_grant_response_content import GetClientGrantResponseContent |
| 18 |
from ..types.list_client_grant_paginated_response_content import ListClientGrantPaginatedResponseContent |
| 19 |
from ..types.update_client_grant_response_content import UpdateClientGrantResponseContent |
| 20 |
from .raw_client import AsyncRawClientGrantsClient, RawClientGrantsClient |
| 21 |
|
| 22 |
if typing.TYPE_CHECKING: |
| 23 |
from .organizations.client import AsyncOrganizationsClient, OrganizationsClient |
| 24 |
|
| 25 |
OMIT = typing.cast(typing.Any, ...) |
| 26 |
|
| 27 |
|
| 28 |
class ClientGrantsClient: |
| 29 |
def __init__(self, *, client_wrapper: SyncClientWrapper): |
| 30 |
self._raw_client = RawClientGrantsClient(client_wrapper=client_wrapper) |
| 31 |
self._client_wrapper = client_wrapper |
| 32 |
self._organizations: typing.Optional[OrganizationsClient] = None |
| 33 |
|
| 34 |
@property |
| 35 |
def with_raw_response(self) -> RawClientGrantsClient: |
| 36 |
""" |
| 37 |
Retrieves a raw implementation of this client that returns raw responses. |
| 38 |
|
| 39 |
Returns |
| 40 |
------- |
| 41 |
RawClientGrantsClient |
| 42 |
""" |
| 43 |
return self._raw_client |
| 44 |
|
| 45 |
def list( |
| 46 |
self, |
| 47 |
*, |
| 48 |
from_: typing.Optional[str] = None, |
| 49 |
take: typing.Optional[int] = 50, |
| 50 |
audience: typing.Optional[str] = None, |
| 51 |
client_id: typing.Optional[str] = None, |
| 52 |
allow_any_organization: typing.Optional[ClientGrantAllowAnyOrganizationEnum] = None, |
| 53 |
subject_type: typing.Optional[ClientGrantSubjectTypeEnum] = None, |
| 54 |
default_for: typing.Optional[ClientGrantDefaultForEnum] = None, |
| 55 |
request_options: typing.Optional[RequestOptions] = None, |
| 56 |
) -> SyncPager[ClientGrantResponseContent, ListClientGrantPaginatedResponseContent]: |
| 57 |
""" |
| 58 |
Retrieve a list of [client grants](https://auth0.com/docs/get-started/applications/application-access-to-apis-client-grants), including the scopes associated with the application/API pair. |
| 59 |
|
| 60 |
Parameters |
| 61 |
---------- |
| 62 |
from_ : typing.Optional[str] |
| 63 |
Optional Id from which to start selection. |
| 64 |
|
| 65 |
take : typing.Optional[int] |
| 66 |
Number of results per page. Defaults to 50. |
| 67 |
|
| 68 |
audience : typing.Optional[str] |
| 69 |
Optional filter on audience. |
| 70 |
|
| 71 |
client_id : typing.Optional[str] |
| 72 |
Optional filter on client_id. |
| 73 |
|
| 74 |
allow_any_organization : typing.Optional[ClientGrantAllowAnyOrganizationEnum] |
| 75 |
Optional filter on allow_any_organization. |
| 76 |
|
| 77 |
subject_type : typing.Optional[ClientGrantSubjectTypeEnum] |
| 78 |
The type of application access the client grant allows. |
| 79 |
|
| 80 |
default_for : typing.Optional[ClientGrantDefaultForEnum] |
| 81 |
Applies this client grant as the default for all clients in the specified group. The only accepted value is <a href="https://auth0.com/docs/get-started/applications/application-access-to-apis-client-grants#default-permissions-for-third-party-applications">`third_party_clients`</a>, which applies the grant to all third-party clients. Per-client grants for the same audience take precedence. Mutually exclusive with `client_id`. |
| 82 |
|
| 83 |
request_options : typing.Optional[RequestOptions] |
| 84 |
Request-specific configuration. |
| 85 |
|
| 86 |
Returns |
| 87 |
------- |
| 88 |
SyncPager[ClientGrantResponseContent, ListClientGrantPaginatedResponseContent] |
| 89 |
Client grants successfully retrieved. |
| 90 |
|
| 91 |
Examples |
| 92 |
-------- |
| 93 |
from auth0 import Auth0 |
| 94 |
|
| 95 |
client = Auth0( |
| 96 |
token="YOUR_TOKEN", |
| 97 |
) |
| 98 |
response = client.client_grants.list( |
| 99 |
from_="from", |
| 100 |
take=1, |
| 101 |
audience="audience", |
| 102 |
client_id="client_id", |
| 103 |
allow_any_organization=True, |
| 104 |
subject_type="client", |
| 105 |
default_for="third_party_clients", |
| 106 |
) |
| 107 |
for item in response: |
| 108 |
yield item |
| 109 |
# alternatively, you can paginate page-by-page |
| 110 |
for page in response.iter_pages(): |
| 111 |
yield page |
| 112 |
""" |
| 113 |
return self._raw_client.list( |
| 114 |
from_=from_, |
| 115 |
take=take, |
| 116 |
audience=audience, |
| 117 |
client_id=client_id, |
| 118 |
allow_any_organization=allow_any_organization, |
| 119 |
subject_type=subject_type, |
| 120 |
default_for=default_for, |
| 121 |
request_options=request_options, |
| 122 |
) |
| 123 |
|
| 124 |
def create( |
| 125 |
self, |
| 126 |
*, |
| 127 |
audience: str, |
| 128 |
client_id: typing.Optional[str] = OMIT, |
| 129 |
default_for: typing.Optional[ClientGrantDefaultForEnum] = OMIT, |
| 130 |
organization_usage: typing.Optional[ClientGrantOrganizationUsageEnum] = OMIT, |
| 131 |
allow_any_organization: typing.Optional[bool] = OMIT, |
| 132 |
scope: typing.Optional[typing.Sequence[str]] = OMIT, |
| 133 |
subject_type: typing.Optional[ClientGrantSubjectTypeEnum] = OMIT, |
| 134 |
authorization_details_types: typing.Optional[typing.Sequence[str]] = OMIT, |
| 135 |
allow_all_scopes: typing.Optional[bool] = OMIT, |
| 136 |
request_options: typing.Optional[RequestOptions] = None, |
| 137 |
) -> CreateClientGrantResponseContent: |
| 138 |
""" |
| 139 |
Create a client grant for a machine-to-machine login flow. To learn more, read [Client Credential Flow](https://www.auth0.com/docs/get-started/authentication-and-authorization-flow/client-credentials-flow). |
| 140 |
|
| 141 |
Parameters |
| 142 |
---------- |
| 143 |
audience : str |
| 144 |
The audience (API identifier) of this client grant |
| 145 |
|
| 146 |
client_id : typing.Optional[str] |
| 147 |
ID of the client. |
| 148 |
|
| 149 |
default_for : typing.Optional[ClientGrantDefaultForEnum] |
| 150 |
|
| 151 |
organization_usage : typing.Optional[ClientGrantOrganizationUsageEnum] |
| 152 |
|
| 153 |
allow_any_organization : typing.Optional[bool] |
| 154 |
If enabled, any organization can be used with this grant. If disabled (default), the grant must be explicitly assigned to the desired organizations. |
| 155 |
|
| 156 |
scope : typing.Optional[typing.Sequence[str]] |
| 157 |
Scopes allowed for this client grant. |
| 158 |
|
| 159 |
subject_type : typing.Optional[ClientGrantSubjectTypeEnum] |
| 160 |
|
| 161 |
authorization_details_types : typing.Optional[typing.Sequence[str]] |
| 162 |
Types of authorization_details allowed for this client grant. |
| 163 |
|
| 164 |
allow_all_scopes : typing.Optional[bool] |
| 165 |
If enabled, all scopes configured on the resource server are allowed for this grant. |
| 166 |
|
| 167 |
request_options : typing.Optional[RequestOptions] |
| 168 |
Request-specific configuration. |
| 169 |
|
| 170 |
Returns |
| 171 |
------- |
| 172 |
CreateClientGrantResponseContent |
| 173 |
Client grant successfully created. |
| 174 |
|
| 175 |
Examples |
| 176 |
-------- |
| 177 |
from auth0 import Auth0 |
| 178 |
|
| 179 |
client = Auth0( |
| 180 |
token="YOUR_TOKEN", |
| 181 |
) |
| 182 |
client.client_grants.create( |
| 183 |
audience="audience", |
| 184 |
) |
| 185 |
""" |
| 186 |
_response = self._raw_client.create( |
| 187 |
audience=audience, |
| 188 |
client_id=client_id, |
| 189 |
default_for=default_for, |
| 190 |
organization_usage=organization_usage, |
| 191 |
allow_any_organization=allow_any_organization, |
| 192 |
scope=scope, |
| 193 |
subject_type=subject_type, |
| 194 |
authorization_details_types=authorization_details_types, |
| 195 |
allow_all_scopes=allow_all_scopes, |
| 196 |
request_options=request_options, |
| 197 |
) |
| 198 |
return _response.data |
| 199 |
|
| 200 |
def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> GetClientGrantResponseContent: |
| 201 |
""" |
| 202 |
Retrieve a single [client grant](https://auth0.com/docs/get-started/applications/application-access-to-apis-client-grants), including the |
| 203 |
scopes associated with the application/API pair. |
| 204 |
|
| 205 |
Parameters |
| 206 |
---------- |
| 207 |
id : str |
| 208 |
The ID of the client grant to retrieve. |
| 209 |
|
| 210 |
request_options : typing.Optional[RequestOptions] |
| 211 |
Request-specific configuration. |
| 212 |
|
| 213 |
Returns |
| 214 |
------- |
| 215 |
GetClientGrantResponseContent |
| 216 |
Client grant successfully retrieved. |
| 217 |
|
| 218 |
Examples |
| 219 |
-------- |
| 220 |
from auth0 import Auth0 |
| 221 |
|
| 222 |
client = Auth0( |
| 223 |
token="YOUR_TOKEN", |
| 224 |
) |
| 225 |
client.client_grants.get( |
| 226 |
id="id", |
| 227 |
) |
| 228 |
""" |
| 229 |
_response = self._raw_client.get(id, request_options=request_options) |
| 230 |
return _response.data |
| 231 |
|
| 232 |
def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: |
| 233 |
""" |
| 234 |
Delete the [Client Credential Flow](https://www.auth0.com/docs/get-started/authentication-and-authorization-flow/client-credentials-flow) from your machine-to-machine application. |
| 235 |
|
| 236 |
Parameters |
| 237 |
---------- |
| 238 |
id : str |
| 239 |
ID of the client grant to delete. |
| 240 |
|
| 241 |
request_options : typing.Optional[RequestOptions] |
| 242 |
Request-specific configuration. |
| 243 |
|
| 244 |
Returns |
| 245 |
------- |
| 246 |
None |
| 247 |
|
| 248 |
Examples |
| 249 |
-------- |
| 250 |
from auth0 import Auth0 |
| 251 |
|
| 252 |
client = Auth0( |
| 253 |
token="YOUR_TOKEN", |
| 254 |
) |
| 255 |
client.client_grants.delete( |
| 256 |
id="id", |
| 257 |
) |
| 258 |
""" |
| 259 |
_response = self._raw_client.delete(id, request_options=request_options) |
| 260 |
return _response.data |
| 261 |
|
| 262 |
def update( |
| 263 |
self, |
| 264 |
id: str, |
| 265 |
*, |
| 266 |
scope: typing.Optional[typing.Sequence[str]] = OMIT, |
| 267 |
organization_usage: typing.Optional[ClientGrantOrganizationNullableUsageEnum] = OMIT, |
| 268 |
allow_any_organization: typing.Optional[bool] = OMIT, |
| 269 |
authorization_details_types: typing.Optional[typing.Sequence[str]] = OMIT, |
| 270 |
allow_all_scopes: typing.Optional[bool] = OMIT, |
| 271 |
request_options: typing.Optional[RequestOptions] = None, |
| 272 |
) -> UpdateClientGrantResponseContent: |
| 273 |
""" |
| 274 |
Update a client grant. |
| 275 |
|
| 276 |
Parameters |
| 277 |
---------- |
| 278 |
id : str |
| 279 |
ID of the client grant to update. |
| 280 |
|
| 281 |
scope : typing.Optional[typing.Sequence[str]] |
| 282 |
Scopes allowed for this client grant. |
| 283 |
|
| 284 |
organization_usage : typing.Optional[ClientGrantOrganizationNullableUsageEnum] |
| 285 |
|
| 286 |
allow_any_organization : typing.Optional[bool] |
| 287 |
Controls allowing any organization to be used with this grant |
| 288 |
|
| 289 |
authorization_details_types : typing.Optional[typing.Sequence[str]] |
| 290 |
Types of authorization_details allowed for this client grant. |
| 291 |
|
| 292 |
allow_all_scopes : typing.Optional[bool] |
| 293 |
If enabled, all scopes configured on the resource server are allowed for this grant. |
| 294 |
|
| 295 |
request_options : typing.Optional[RequestOptions] |
| 296 |
Request-specific configuration. |
| 297 |
|
| 298 |
Returns |
| 299 |
------- |
| 300 |
UpdateClientGrantResponseContent |
| 301 |
Client grant successfully updated. |
| 302 |
|
| 303 |
Examples |
| 304 |
-------- |
| 305 |
from auth0 import Auth0 |
| 306 |
|
| 307 |
client = Auth0( |
| 308 |
token="YOUR_TOKEN", |
| 309 |
) |
| 310 |
client.client_grants.update( |
| 311 |
id="id", |
| 312 |
) |
| 313 |
""" |
| 314 |
_response = self._raw_client.update( |
| 315 |
id, |
| 316 |
scope=scope, |
| 317 |
organization_usage=organization_usage, |
| 318 |
allow_any_organization=allow_any_organization, |
| 319 |
authorization_details_types=authorization_details_types, |
| 320 |
allow_all_scopes=allow_all_scopes, |
| 321 |
request_options=request_options, |
| 322 |
) |
| 323 |
return _response.data |
| 324 |
|
| 325 |
@property |
| 326 |
def organizations(self): |
| 327 |
if self._organizations is None: |
| 328 |
from .organizations.client import OrganizationsClient |
| 329 |
|
| 330 |
self._organizations = OrganizationsClient(client_wrapper=self._client_wrapper) |
| 331 |
return self._organizations |
| 332 |
|
| 333 |
|
| 334 |
class AsyncClientGrantsClient: |
| 335 |
def __init__(self, *, client_wrapper: AsyncClientWrapper): |
| 336 |
self._raw_client = AsyncRawClientGrantsClient(client_wrapper=client_wrapper) |
| 337 |
self._client_wrapper = client_wrapper |
| 338 |
self._organizations: typing.Optional[AsyncOrganizationsClient] = None |
| 339 |
|
| 340 |
@property |
| 341 |
def with_raw_response(self) -> AsyncRawClientGrantsClient: |
| 342 |
""" |
| 343 |
Retrieves a raw implementation of this client that returns raw responses. |
| 344 |
|
| 345 |
Returns |
| 346 |
------- |
| 347 |
AsyncRawClientGrantsClient |
| 348 |
""" |
| 349 |
return self._raw_client |
| 350 |
|
| 351 |
async def list( |
| 352 |
self, |
| 353 |
*, |
| 354 |
from_: typing.Optional[str] = None, |
| 355 |
take: typing.Optional[int] = 50, |
| 356 |
audience: typing.Optional[str] = None, |
| 357 |
client_id: typing.Optional[str] = None, |
| 358 |
allow_any_organization: typing.Optional[ClientGrantAllowAnyOrganizationEnum] = None, |
| 359 |
subject_type: typing.Optional[ClientGrantSubjectTypeEnum] = None, |
| 360 |
default_for: typing.Optional[ClientGrantDefaultForEnum] = None, |
| 361 |
request_options: typing.Optional[RequestOptions] = None, |
| 362 |
) -> AsyncPager[ClientGrantResponseContent, ListClientGrantPaginatedResponseContent]: |
| 363 |
""" |
| 364 |
Retrieve a list of [client grants](https://auth0.com/docs/get-started/applications/application-access-to-apis-client-grants), including the scopes associated with the application/API pair. |
| 365 |
|
| 366 |
Parameters |
| 367 |
---------- |
| 368 |
from_ : typing.Optional[str] |
| 369 |
Optional Id from which to start selection. |
| 370 |
|
| 371 |
take : typing.Optional[int] |
| 372 |
Number of results per page. Defaults to 50. |
| 373 |
|
| 374 |
audience : typing.Optional[str] |
| 375 |
Optional filter on audience. |
| 376 |
|
| 377 |
client_id : typing.Optional[str] |
| 378 |
Optional filter on client_id. |
| 379 |
|
| 380 |
allow_any_organization : typing.Optional[ClientGrantAllowAnyOrganizationEnum] |
| 381 |
Optional filter on allow_any_organization. |
| 382 |
|
| 383 |
subject_type : typing.Optional[ClientGrantSubjectTypeEnum] |
| 384 |
The type of application access the client grant allows. |
| 385 |
|
| 386 |
default_for : typing.Optional[ClientGrantDefaultForEnum] |
| 387 |
Applies this client grant as the default for all clients in the specified group. The only accepted value is <a href="https://auth0.com/docs/get-started/applications/application-access-to-apis-client-grants#default-permissions-for-third-party-applications">`third_party_clients`</a>, which applies the grant to all third-party clients. Per-client grants for the same audience take precedence. Mutually exclusive with `client_id`. |
| 388 |
|
| 389 |
request_options : typing.Optional[RequestOptions] |
| 390 |
Request-specific configuration. |
| 391 |
|
| 392 |
Returns |
| 393 |
------- |
| 394 |
AsyncPager[ClientGrantResponseContent, ListClientGrantPaginatedResponseContent] |
| 395 |
Client grants successfully retrieved. |
| 396 |
|
| 397 |
Examples |
| 398 |
-------- |
| 399 |
import asyncio |
| 400 |
|
| 401 |
from auth0 import AsyncAuth0 |
| 402 |
|
| 403 |
client = AsyncAuth0( |
| 404 |
token="YOUR_TOKEN", |
| 405 |
) |
| 406 |
|
| 407 |
|
| 408 |
async def main() -> None: |
| 409 |
response = await client.client_grants.list( |
| 410 |
from_="from", |
| 411 |
take=1, |
| 412 |
audience="audience", |
| 413 |
client_id="client_id", |
| 414 |
allow_any_organization=True, |
| 415 |
subject_type="client", |
| 416 |
default_for="third_party_clients", |
| 417 |
) |
| 418 |
async for item in response: |
| 419 |
yield item |
| 420 |
|
| 421 |
# alternatively, you can paginate page-by-page |
| 422 |
async for page in response.iter_pages(): |
| 423 |
yield page |
| 424 |
|
| 425 |
|
| 426 |
asyncio.run(main()) |
| 427 |
""" |
| 428 |
return await self._raw_client.list( |
| 429 |
from_=from_, |
| 430 |
take=take, |
| 431 |
audience=audience, |
| 432 |
client_id=client_id, |
| 433 |
allow_any_organization=allow_any_organization, |
| 434 |
subject_type=subject_type, |
| 435 |
default_for=default_for, |
| 436 |
request_options=request_options, |
| 437 |
) |
| 438 |
|
| 439 |
async def create( |
| 440 |
self, |
| 441 |
*, |
| 442 |
audience: str, |
| 443 |
client_id: typing.Optional[str] = OMIT, |
| 444 |
default_for: typing.Optional[ClientGrantDefaultForEnum] = OMIT, |
| 445 |
organization_usage: typing.Optional[ClientGrantOrganizationUsageEnum] = OMIT, |
| 446 |
allow_any_organization: typing.Optional[bool] = OMIT, |
| 447 |
scope: typing.Optional[typing.Sequence[str]] = OMIT, |
| 448 |
subject_type: typing.Optional[ClientGrantSubjectTypeEnum] = OMIT, |
| 449 |
authorization_details_types: typing.Optional[typing.Sequence[str]] = OMIT, |
| 450 |
allow_all_scopes: typing.Optional[bool] = OMIT, |
| 451 |
request_options: typing.Optional[RequestOptions] = None, |
| 452 |
) -> CreateClientGrantResponseContent: |
| 453 |
""" |
| 454 |
Create a client grant for a machine-to-machine login flow. To learn more, read [Client Credential Flow](https://www.auth0.com/docs/get-started/authentication-and-authorization-flow/client-credentials-flow). |
| 455 |
|
| 456 |
Parameters |
| 457 |
---------- |
| 458 |
audience : str |
| 459 |
The audience (API identifier) of this client grant |
| 460 |
|
| 461 |
client_id : typing.Optional[str] |
| 462 |
ID of the client. |
| 463 |
|
| 464 |
default_for : typing.Optional[ClientGrantDefaultForEnum] |
| 465 |
|
| 466 |
organization_usage : typing.Optional[ClientGrantOrganizationUsageEnum] |
| 467 |
|
| 468 |
allow_any_organization : typing.Optional[bool] |
| 469 |
If enabled, any organization can be used with this grant. If disabled (default), the grant must be explicitly assigned to the desired organizations. |
| 470 |
|
| 471 |
scope : typing.Optional[typing.Sequence[str]] |
| 472 |
Scopes allowed for this client grant. |
| 473 |
|
| 474 |
subject_type : typing.Optional[ClientGrantSubjectTypeEnum] |
| 475 |
|
| 476 |
authorization_details_types : typing.Optional[typing.Sequence[str]] |
| 477 |
Types of authorization_details allowed for this client grant. |
| 478 |
|
| 479 |
allow_all_scopes : typing.Optional[bool] |
| 480 |
If enabled, all scopes configured on the resource server are allowed for this grant. |
| 481 |
|
| 482 |
request_options : typing.Optional[RequestOptions] |
| 483 |
Request-specific configuration. |
| 484 |
|
| 485 |
Returns |
| 486 |
------- |
| 487 |
CreateClientGrantResponseContent |
| 488 |
Client grant successfully created. |
| 489 |
|
| 490 |
Examples |
| 491 |
-------- |
| 492 |
import asyncio |
| 493 |
|
| 494 |
from auth0 import AsyncAuth0 |
| 495 |
|
| 496 |
client = AsyncAuth0( |
| 497 |
token="YOUR_TOKEN", |
| 498 |
) |
| 499 |
|
| 500 |
|
| 501 |
async def main() -> None: |
| 502 |
await client.client_grants.create( |
| 503 |
audience="audience", |
| 504 |
) |
| 505 |
|
| 506 |
|
| 507 |
asyncio.run(main()) |
| 508 |
""" |
| 509 |
_response = await self._raw_client.create( |
| 510 |
audience=audience, |
| 511 |
client_id=client_id, |
| 512 |
default_for=default_for, |
| 513 |
organization_usage=organization_usage, |
| 514 |
allow_any_organization=allow_any_organization, |
| 515 |
scope=scope, |
| 516 |
subject_type=subject_type, |
| 517 |
authorization_details_types=authorization_details_types, |
| 518 |
allow_all_scopes=allow_all_scopes, |
| 519 |
request_options=request_options, |
| 520 |
) |
| 521 |
return _response.data |
| 522 |
|
| 523 |
async def get( |
| 524 |
self, id: str, *, request_options: typing.Optional[RequestOptions] = None |
| 525 |
) -> GetClientGrantResponseContent: |
| 526 |
""" |
| 527 |
Retrieve a single [client grant](https://auth0.com/docs/get-started/applications/application-access-to-apis-client-grants), including the |
| 528 |
scopes associated with the application/API pair. |
| 529 |
|
| 530 |
Parameters |
| 531 |
---------- |
| 532 |
id : str |
| 533 |
The ID of the client grant to retrieve. |
| 534 |
|
| 535 |
request_options : typing.Optional[RequestOptions] |
| 536 |
Request-specific configuration. |
| 537 |
|
| 538 |
Returns |
| 539 |
------- |
| 540 |
GetClientGrantResponseContent |
| 541 |
Client grant successfully retrieved. |
| 542 |
|
| 543 |
Examples |
| 544 |
-------- |
| 545 |
import asyncio |
| 546 |
|
| 547 |
from auth0 import AsyncAuth0 |
| 548 |
|
| 549 |
client = AsyncAuth0( |
| 550 |
token="YOUR_TOKEN", |
| 551 |
) |
| 552 |
|
| 553 |
|
| 554 |
async def main() -> None: |
| 555 |
await client.client_grants.get( |
| 556 |
id="id", |
| 557 |
) |
| 558 |
|
| 559 |
|
| 560 |
asyncio.run(main()) |
| 561 |
""" |
| 562 |
_response = await self._raw_client.get(id, request_options=request_options) |
| 563 |
return _response.data |
| 564 |
|
| 565 |
async def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: |
| 566 |
""" |
| 567 |
Delete the [Client Credential Flow](https://www.auth0.com/docs/get-started/authentication-and-authorization-flow/client-credentials-flow) from your machine-to-machine application. |
| 568 |
|
| 569 |
Parameters |
| 570 |
---------- |
| 571 |
id : str |
| 572 |
ID of the client grant to delete. |
| 573 |
|
| 574 |
request_options : typing.Optional[RequestOptions] |
| 575 |
Request-specific configuration. |
| 576 |
|
| 577 |
Returns |
| 578 |
------- |
| 579 |
None |
| 580 |
|
| 581 |
Examples |
| 582 |
-------- |
| 583 |
import asyncio |
| 584 |
|
| 585 |
from auth0 import AsyncAuth0 |
| 586 |
|
| 587 |
client = AsyncAuth0( |
| 588 |
token="YOUR_TOKEN", |
| 589 |
) |
| 590 |
|
| 591 |
|
| 592 |
async def main() -> None: |
| 593 |
await client.client_grants.delete( |
| 594 |
id="id", |
| 595 |
) |
| 596 |
|
| 597 |
|
| 598 |
asyncio.run(main()) |
| 599 |
""" |
| 600 |
_response = await self._raw_client.delete(id, request_options=request_options) |
| 601 |
return _response.data |
| 602 |
|
| 603 |
async def update( |
| 604 |
self, |
| 605 |
id: str, |
| 606 |
*, |
| 607 |
scope: typing.Optional[typing.Sequence[str]] = OMIT, |
| 608 |
organization_usage: typing.Optional[ClientGrantOrganizationNullableUsageEnum] = OMIT, |
| 609 |
allow_any_organization: typing.Optional[bool] = OMIT, |
| 610 |
authorization_details_types: typing.Optional[typing.Sequence[str]] = OMIT, |
| 611 |
allow_all_scopes: typing.Optional[bool] = OMIT, |
| 612 |
request_options: typing.Optional[RequestOptions] = None, |
| 613 |
) -> UpdateClientGrantResponseContent: |
| 614 |
""" |
| 615 |
Update a client grant. |
| 616 |
|
| 617 |
Parameters |
| 618 |
---------- |
| 619 |
id : str |
| 620 |
ID of the client grant to update. |
| 621 |
|
| 622 |
scope : typing.Optional[typing.Sequence[str]] |
| 623 |
Scopes allowed for this client grant. |
| 624 |
|
| 625 |
organization_usage : typing.Optional[ClientGrantOrganizationNullableUsageEnum] |
| 626 |
|
| 627 |
allow_any_organization : typing.Optional[bool] |
| 628 |
Controls allowing any organization to be used with this grant |
| 629 |
|
| 630 |
authorization_details_types : typing.Optional[typing.Sequence[str]] |
| 631 |
Types of authorization_details allowed for this client grant. |
| 632 |
|
| 633 |
allow_all_scopes : typing.Optional[bool] |
| 634 |
If enabled, all scopes configured on the resource server are allowed for this grant. |
| 635 |
|
| 636 |
request_options : typing.Optional[RequestOptions] |
| 637 |
Request-specific configuration. |
| 638 |
|
| 639 |
Returns |
| 640 |
------- |
| 641 |
UpdateClientGrantResponseContent |
| 642 |
Client grant successfully updated. |
| 643 |
|
| 644 |
Examples |
| 645 |
-------- |
| 646 |
import asyncio |
| 647 |
|
| 648 |
from auth0 import AsyncAuth0 |
| 649 |
|
| 650 |
client = AsyncAuth0( |
| 651 |
token="YOUR_TOKEN", |
| 652 |
) |
| 653 |
|
| 654 |
|
| 655 |
async def main() -> None: |
| 656 |
await client.client_grants.update( |
| 657 |
id="id", |
| 658 |
) |
| 659 |
|
| 660 |
|
| 661 |
asyncio.run(main()) |
| 662 |
""" |
| 663 |
_response = await self._raw_client.update( |
| 664 |
id, |
| 665 |
scope=scope, |
| 666 |
organization_usage=organization_usage, |
| 667 |
allow_any_organization=allow_any_organization, |
| 668 |
authorization_details_types=authorization_details_types, |
| 669 |
allow_all_scopes=allow_all_scopes, |
| 670 |
request_options=request_options, |
| 671 |
) |
| 672 |
return _response.data |
| 673 |
|
| 674 |
@property |
| 675 |
def organizations(self): |
| 676 |
if self._organizations is None: |
| 677 |
from .organizations.client import AsyncOrganizationsClient |
| 678 |
|
| 679 |
self._organizations = AsyncOrganizationsClient(client_wrapper=self._client_wrapper) |
| 680 |
return self._organizations |