| 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.connection_for_organization import ConnectionForOrganization |
| 11 |
from ..types.create_organization_response_content import CreateOrganizationResponseContent |
| 12 |
from ..types.create_token_quota import CreateTokenQuota |
| 13 |
from ..types.get_organization_by_name_response_content import GetOrganizationByNameResponseContent |
| 14 |
from ..types.get_organization_response_content import GetOrganizationResponseContent |
| 15 |
from ..types.list_organizations_paginated_response_content import ListOrganizationsPaginatedResponseContent |
| 16 |
from ..types.organization import Organization |
| 17 |
from ..types.organization_branding import OrganizationBranding |
| 18 |
from ..types.organization_metadata import OrganizationMetadata |
| 19 |
from ..types.organization_third_party_client_access_enum import OrganizationThirdPartyClientAccessEnum |
| 20 |
from ..types.update_organization_response_content import UpdateOrganizationResponseContent |
| 21 |
from ..types.update_token_quota import UpdateTokenQuota |
| 22 |
from .raw_client import AsyncRawOrganizationsClient, RawOrganizationsClient |
| 23 |
|
| 24 |
if typing.TYPE_CHECKING: |
| 25 |
from .client_grants.client import AsyncClientGrantsClient, ClientGrantsClient |
| 26 |
from .connections.client import AsyncConnectionsClient, ConnectionsClient |
| 27 |
from .discovery_domains.client import AsyncDiscoveryDomainsClient, DiscoveryDomainsClient |
| 28 |
from .enabled_connections.client import AsyncEnabledConnectionsClient, EnabledConnectionsClient |
| 29 |
from .groups.client import AsyncGroupsClient, GroupsClient |
| 30 |
from .invitations.client import AsyncInvitationsClient, InvitationsClient |
| 31 |
from .members.client import AsyncMembersClient, MembersClient |
| 32 |
from .roles.client import AsyncRolesClient, RolesClient |
| 33 |
|
| 34 |
OMIT = typing.cast(typing.Any, ...) |
| 35 |
|
| 36 |
|
| 37 |
class OrganizationsClient: |
| 38 |
def __init__(self, *, client_wrapper: SyncClientWrapper): |
| 39 |
self._raw_client = RawOrganizationsClient(client_wrapper=client_wrapper) |
| 40 |
self._client_wrapper = client_wrapper |
| 41 |
self._client_grants: typing.Optional[ClientGrantsClient] = None |
| 42 |
self._connections: typing.Optional[ConnectionsClient] = None |
| 43 |
self._discovery_domains: typing.Optional[DiscoveryDomainsClient] = None |
| 44 |
self._enabled_connections: typing.Optional[EnabledConnectionsClient] = None |
| 45 |
self._invitations: typing.Optional[InvitationsClient] = None |
| 46 |
self._members: typing.Optional[MembersClient] = None |
| 47 |
self._groups: typing.Optional[GroupsClient] = None |
| 48 |
self._roles: typing.Optional[RolesClient] = None |
| 49 |
|
| 50 |
@property |
| 51 |
def with_raw_response(self) -> RawOrganizationsClient: |
| 52 |
""" |
| 53 |
Retrieves a raw implementation of this client that returns raw responses. |
| 54 |
|
| 55 |
Returns |
| 56 |
------- |
| 57 |
RawOrganizationsClient |
| 58 |
""" |
| 59 |
return self._raw_client |
| 60 |
|
| 61 |
def list( |
| 62 |
self, |
| 63 |
*, |
| 64 |
from_: typing.Optional[str] = None, |
| 65 |
take: typing.Optional[int] = 50, |
| 66 |
sort: typing.Optional[str] = None, |
| 67 |
request_options: typing.Optional[RequestOptions] = None, |
| 68 |
) -> SyncPager[Organization, ListOrganizationsPaginatedResponseContent]: |
| 69 |
""" |
| 70 |
Retrieve detailed list of all Organizations available in your tenant. For more information, see Auth0 Organizations. |
| 71 |
|
| 72 |
This endpoint supports two types of pagination: |
| 73 |
|
| 74 |
- Offset pagination |
| 75 |
- Checkpoint pagination |
| 76 |
|
| 77 |
Checkpoint pagination must be used if you need to retrieve more than 1000 organizations. |
| 78 |
|
| 79 |
**Checkpoint Pagination** |
| 80 |
|
| 81 |
To search by checkpoint, use the following parameters: |
| 82 |
|
| 83 |
- `from`: Optional id from which to start selection. |
| 84 |
- `take`: The total number of entries to retrieve when using the `from` parameter. Defaults to 50. |
| 85 |
|
| 86 |
**Note**: The first time you call this endpoint using checkpoint pagination, 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 pages are remaining. |
| 87 |
|
| 88 |
Parameters |
| 89 |
---------- |
| 90 |
from_ : typing.Optional[str] |
| 91 |
Optional Id from which to start selection. |
| 92 |
|
| 93 |
take : typing.Optional[int] |
| 94 |
Number of results per page. Defaults to 50. |
| 95 |
|
| 96 |
sort : typing.Optional[str] |
| 97 |
Field to sort by. Use <code>field:order</code> where order is <code>1</code> for ascending and <code>-1</code> for descending. e.g. <code>created_at:1</code>. We currently support sorting by the following fields: <code>name</code>, <code>display_name</code> and <code>created_at</code>. |
| 98 |
|
| 99 |
request_options : typing.Optional[RequestOptions] |
| 100 |
Request-specific configuration. |
| 101 |
|
| 102 |
Returns |
| 103 |
------- |
| 104 |
SyncPager[Organization, ListOrganizationsPaginatedResponseContent] |
| 105 |
Organizations successfully retrieved. |
| 106 |
|
| 107 |
Examples |
| 108 |
-------- |
| 109 |
from auth0 import Auth0 |
| 110 |
|
| 111 |
client = Auth0( |
| 112 |
token="YOUR_TOKEN", |
| 113 |
) |
| 114 |
response = client.organizations.list( |
| 115 |
from_="from", |
| 116 |
take=1, |
| 117 |
sort="sort", |
| 118 |
) |
| 119 |
for item in response: |
| 120 |
yield item |
| 121 |
# alternatively, you can paginate page-by-page |
| 122 |
for page in response.iter_pages(): |
| 123 |
yield page |
| 124 |
""" |
| 125 |
return self._raw_client.list(from_=from_, take=take, sort=sort, request_options=request_options) |
| 126 |
|
| 127 |
def create( |
| 128 |
self, |
| 129 |
*, |
| 130 |
name: str, |
| 131 |
display_name: typing.Optional[str] = OMIT, |
| 132 |
branding: typing.Optional[OrganizationBranding] = OMIT, |
| 133 |
metadata: typing.Optional[OrganizationMetadata] = OMIT, |
| 134 |
enabled_connections: typing.Optional[typing.Sequence[ConnectionForOrganization]] = OMIT, |
| 135 |
token_quota: typing.Optional[CreateTokenQuota] = OMIT, |
| 136 |
third_party_client_access: typing.Optional[OrganizationThirdPartyClientAccessEnum] = OMIT, |
| 137 |
request_options: typing.Optional[RequestOptions] = None, |
| 138 |
) -> CreateOrganizationResponseContent: |
| 139 |
""" |
| 140 |
Create a new Organization within your tenant. To learn more about Organization settings, behavior, and configuration options, review [Create Your First Organization](https://auth0.com/docs/manage-users/organizations/create-first-organization). |
| 141 |
|
| 142 |
Parameters |
| 143 |
---------- |
| 144 |
name : str |
| 145 |
The name of this organization. |
| 146 |
|
| 147 |
display_name : typing.Optional[str] |
| 148 |
Friendly name of this organization. |
| 149 |
|
| 150 |
branding : typing.Optional[OrganizationBranding] |
| 151 |
|
| 152 |
metadata : typing.Optional[OrganizationMetadata] |
| 153 |
|
| 154 |
enabled_connections : typing.Optional[typing.Sequence[ConnectionForOrganization]] |
| 155 |
Connections that will be enabled for this organization. See POST enabled_connections endpoint for the object format. (Max of 10 connections allowed) |
| 156 |
|
| 157 |
token_quota : typing.Optional[CreateTokenQuota] |
| 158 |
|
| 159 |
third_party_client_access : typing.Optional[OrganizationThirdPartyClientAccessEnum] |
| 160 |
|
| 161 |
request_options : typing.Optional[RequestOptions] |
| 162 |
Request-specific configuration. |
| 163 |
|
| 164 |
Returns |
| 165 |
------- |
| 166 |
CreateOrganizationResponseContent |
| 167 |
Organization successfully created. |
| 168 |
|
| 169 |
Examples |
| 170 |
-------- |
| 171 |
from auth0 import Auth0 |
| 172 |
|
| 173 |
client = Auth0( |
| 174 |
token="YOUR_TOKEN", |
| 175 |
) |
| 176 |
client.organizations.create( |
| 177 |
name="name", |
| 178 |
) |
| 179 |
""" |
| 180 |
_response = self._raw_client.create( |
| 181 |
name=name, |
| 182 |
display_name=display_name, |
| 183 |
branding=branding, |
| 184 |
metadata=metadata, |
| 185 |
enabled_connections=enabled_connections, |
| 186 |
token_quota=token_quota, |
| 187 |
third_party_client_access=third_party_client_access, |
| 188 |
request_options=request_options, |
| 189 |
) |
| 190 |
return _response.data |
| 191 |
|
| 192 |
def get_by_name( |
| 193 |
self, name: str, *, request_options: typing.Optional[RequestOptions] = None |
| 194 |
) -> GetOrganizationByNameResponseContent: |
| 195 |
""" |
| 196 |
Retrieve details about a single Organization specified by name. |
| 197 |
|
| 198 |
Parameters |
| 199 |
---------- |
| 200 |
name : str |
| 201 |
name of the organization to retrieve. |
| 202 |
|
| 203 |
request_options : typing.Optional[RequestOptions] |
| 204 |
Request-specific configuration. |
| 205 |
|
| 206 |
Returns |
| 207 |
------- |
| 208 |
GetOrganizationByNameResponseContent |
| 209 |
Organization successfully retrieved. |
| 210 |
|
| 211 |
Examples |
| 212 |
-------- |
| 213 |
from auth0 import Auth0 |
| 214 |
|
| 215 |
client = Auth0( |
| 216 |
token="YOUR_TOKEN", |
| 217 |
) |
| 218 |
client.organizations.get_by_name( |
| 219 |
name="name", |
| 220 |
) |
| 221 |
""" |
| 222 |
_response = self._raw_client.get_by_name(name, request_options=request_options) |
| 223 |
return _response.data |
| 224 |
|
| 225 |
def get( |
| 226 |
self, id: str, *, request_options: typing.Optional[RequestOptions] = None |
| 227 |
) -> GetOrganizationResponseContent: |
| 228 |
""" |
| 229 |
Retrieve details about a single Organization specified by ID. |
| 230 |
|
| 231 |
Parameters |
| 232 |
---------- |
| 233 |
id : str |
| 234 |
ID of the organization to retrieve. |
| 235 |
|
| 236 |
request_options : typing.Optional[RequestOptions] |
| 237 |
Request-specific configuration. |
| 238 |
|
| 239 |
Returns |
| 240 |
------- |
| 241 |
GetOrganizationResponseContent |
| 242 |
Organization successfully retrieved. |
| 243 |
|
| 244 |
Examples |
| 245 |
-------- |
| 246 |
from auth0 import Auth0 |
| 247 |
|
| 248 |
client = Auth0( |
| 249 |
token="YOUR_TOKEN", |
| 250 |
) |
| 251 |
client.organizations.get( |
| 252 |
id="id", |
| 253 |
) |
| 254 |
""" |
| 255 |
_response = self._raw_client.get(id, request_options=request_options) |
| 256 |
return _response.data |
| 257 |
|
| 258 |
def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: |
| 259 |
""" |
| 260 |
Remove an Organization from your tenant. This action cannot be undone. |
| 261 |
|
| 262 |
**Note**: Members are automatically disassociated from an Organization when it is deleted. However, this action does **not** delete these users from your tenant. |
| 263 |
|
| 264 |
Parameters |
| 265 |
---------- |
| 266 |
id : str |
| 267 |
Organization identifier. |
| 268 |
|
| 269 |
request_options : typing.Optional[RequestOptions] |
| 270 |
Request-specific configuration. |
| 271 |
|
| 272 |
Returns |
| 273 |
------- |
| 274 |
None |
| 275 |
|
| 276 |
Examples |
| 277 |
-------- |
| 278 |
from auth0 import Auth0 |
| 279 |
|
| 280 |
client = Auth0( |
| 281 |
token="YOUR_TOKEN", |
| 282 |
) |
| 283 |
client.organizations.delete( |
| 284 |
id="id", |
| 285 |
) |
| 286 |
""" |
| 287 |
_response = self._raw_client.delete(id, request_options=request_options) |
| 288 |
return _response.data |
| 289 |
|
| 290 |
def update( |
| 291 |
self, |
| 292 |
id: str, |
| 293 |
*, |
| 294 |
display_name: typing.Optional[str] = OMIT, |
| 295 |
name: typing.Optional[str] = OMIT, |
| 296 |
branding: typing.Optional[OrganizationBranding] = OMIT, |
| 297 |
metadata: typing.Optional[OrganizationMetadata] = OMIT, |
| 298 |
token_quota: typing.Optional[UpdateTokenQuota] = OMIT, |
| 299 |
third_party_client_access: typing.Optional[OrganizationThirdPartyClientAccessEnum] = OMIT, |
| 300 |
request_options: typing.Optional[RequestOptions] = None, |
| 301 |
) -> UpdateOrganizationResponseContent: |
| 302 |
""" |
| 303 |
Update the details of a specific [Organization](https://auth0.com/docs/manage-users/organizations/configure-organizations/create-organizations), such as name and display name, branding options, and metadata. |
| 304 |
|
| 305 |
Parameters |
| 306 |
---------- |
| 307 |
id : str |
| 308 |
ID of the organization to update. |
| 309 |
|
| 310 |
display_name : typing.Optional[str] |
| 311 |
Friendly name of this organization. |
| 312 |
|
| 313 |
name : typing.Optional[str] |
| 314 |
The name of this organization. |
| 315 |
|
| 316 |
branding : typing.Optional[OrganizationBranding] |
| 317 |
|
| 318 |
metadata : typing.Optional[OrganizationMetadata] |
| 319 |
|
| 320 |
token_quota : typing.Optional[UpdateTokenQuota] |
| 321 |
|
| 322 |
third_party_client_access : typing.Optional[OrganizationThirdPartyClientAccessEnum] |
| 323 |
|
| 324 |
request_options : typing.Optional[RequestOptions] |
| 325 |
Request-specific configuration. |
| 326 |
|
| 327 |
Returns |
| 328 |
------- |
| 329 |
UpdateOrganizationResponseContent |
| 330 |
Organization successfully updated. |
| 331 |
|
| 332 |
Examples |
| 333 |
-------- |
| 334 |
from auth0 import Auth0 |
| 335 |
|
| 336 |
client = Auth0( |
| 337 |
token="YOUR_TOKEN", |
| 338 |
) |
| 339 |
client.organizations.update( |
| 340 |
id="id", |
| 341 |
) |
| 342 |
""" |
| 343 |
_response = self._raw_client.update( |
| 344 |
id, |
| 345 |
display_name=display_name, |
| 346 |
name=name, |
| 347 |
branding=branding, |
| 348 |
metadata=metadata, |
| 349 |
token_quota=token_quota, |
| 350 |
third_party_client_access=third_party_client_access, |
| 351 |
request_options=request_options, |
| 352 |
) |
| 353 |
return _response.data |
| 354 |
|
| 355 |
@property |
| 356 |
def client_grants(self): |
| 357 |
if self._client_grants is None: |
| 358 |
from .client_grants.client import ClientGrantsClient |
| 359 |
|
| 360 |
self._client_grants = ClientGrantsClient(client_wrapper=self._client_wrapper) |
| 361 |
return self._client_grants |
| 362 |
|
| 363 |
@property |
| 364 |
def connections(self): |
| 365 |
if self._connections is None: |
| 366 |
from .connections.client import ConnectionsClient |
| 367 |
|
| 368 |
self._connections = ConnectionsClient(client_wrapper=self._client_wrapper) |
| 369 |
return self._connections |
| 370 |
|
| 371 |
@property |
| 372 |
def discovery_domains(self): |
| 373 |
if self._discovery_domains is None: |
| 374 |
from .discovery_domains.client import DiscoveryDomainsClient |
| 375 |
|
| 376 |
self._discovery_domains = DiscoveryDomainsClient(client_wrapper=self._client_wrapper) |
| 377 |
return self._discovery_domains |
| 378 |
|
| 379 |
@property |
| 380 |
def enabled_connections(self): |
| 381 |
if self._enabled_connections is None: |
| 382 |
from .enabled_connections.client import EnabledConnectionsClient |
| 383 |
|
| 384 |
self._enabled_connections = EnabledConnectionsClient(client_wrapper=self._client_wrapper) |
| 385 |
return self._enabled_connections |
| 386 |
|
| 387 |
@property |
| 388 |
def invitations(self): |
| 389 |
if self._invitations is None: |
| 390 |
from .invitations.client import InvitationsClient |
| 391 |
|
| 392 |
self._invitations = InvitationsClient(client_wrapper=self._client_wrapper) |
| 393 |
return self._invitations |
| 394 |
|
| 395 |
@property |
| 396 |
def members(self): |
| 397 |
if self._members is None: |
| 398 |
from .members.client import MembersClient |
| 399 |
|
| 400 |
self._members = MembersClient(client_wrapper=self._client_wrapper) |
| 401 |
return self._members |
| 402 |
|
| 403 |
@property |
| 404 |
def groups(self): |
| 405 |
if self._groups is None: |
| 406 |
from .groups.client import GroupsClient |
| 407 |
|
| 408 |
self._groups = GroupsClient(client_wrapper=self._client_wrapper) |
| 409 |
return self._groups |
| 410 |
|
| 411 |
@property |
| 412 |
def roles(self): |
| 413 |
if self._roles is None: |
| 414 |
from .roles.client import RolesClient |
| 415 |
|
| 416 |
self._roles = RolesClient(client_wrapper=self._client_wrapper) |
| 417 |
return self._roles |
| 418 |
|
| 419 |
|
| 420 |
class AsyncOrganizationsClient: |
| 421 |
def __init__(self, *, client_wrapper: AsyncClientWrapper): |
| 422 |
self._raw_client = AsyncRawOrganizationsClient(client_wrapper=client_wrapper) |
| 423 |
self._client_wrapper = client_wrapper |
| 424 |
self._client_grants: typing.Optional[AsyncClientGrantsClient] = None |
| 425 |
self._connections: typing.Optional[AsyncConnectionsClient] = None |
| 426 |
self._discovery_domains: typing.Optional[AsyncDiscoveryDomainsClient] = None |
| 427 |
self._enabled_connections: typing.Optional[AsyncEnabledConnectionsClient] = None |
| 428 |
self._invitations: typing.Optional[AsyncInvitationsClient] = None |
| 429 |
self._members: typing.Optional[AsyncMembersClient] = None |
| 430 |
self._groups: typing.Optional[AsyncGroupsClient] = None |
| 431 |
self._roles: typing.Optional[AsyncRolesClient] = None |
| 432 |
|
| 433 |
@property |
| 434 |
def with_raw_response(self) -> AsyncRawOrganizationsClient: |
| 435 |
""" |
| 436 |
Retrieves a raw implementation of this client that returns raw responses. |
| 437 |
|
| 438 |
Returns |
| 439 |
------- |
| 440 |
AsyncRawOrganizationsClient |
| 441 |
""" |
| 442 |
return self._raw_client |
| 443 |
|
| 444 |
async def list( |
| 445 |
self, |
| 446 |
*, |
| 447 |
from_: typing.Optional[str] = None, |
| 448 |
take: typing.Optional[int] = 50, |
| 449 |
sort: typing.Optional[str] = None, |
| 450 |
request_options: typing.Optional[RequestOptions] = None, |
| 451 |
) -> AsyncPager[Organization, ListOrganizationsPaginatedResponseContent]: |
| 452 |
""" |
| 453 |
Retrieve detailed list of all Organizations available in your tenant. For more information, see Auth0 Organizations. |
| 454 |
|
| 455 |
This endpoint supports two types of pagination: |
| 456 |
|
| 457 |
- Offset pagination |
| 458 |
- Checkpoint pagination |
| 459 |
|
| 460 |
Checkpoint pagination must be used if you need to retrieve more than 1000 organizations. |
| 461 |
|
| 462 |
**Checkpoint Pagination** |
| 463 |
|
| 464 |
To search by checkpoint, use the following parameters: |
| 465 |
|
| 466 |
- `from`: Optional id from which to start selection. |
| 467 |
- `take`: The total number of entries to retrieve when using the `from` parameter. Defaults to 50. |
| 468 |
|
| 469 |
**Note**: The first time you call this endpoint using checkpoint pagination, 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 pages are remaining. |
| 470 |
|
| 471 |
Parameters |
| 472 |
---------- |
| 473 |
from_ : typing.Optional[str] |
| 474 |
Optional Id from which to start selection. |
| 475 |
|
| 476 |
take : typing.Optional[int] |
| 477 |
Number of results per page. Defaults to 50. |
| 478 |
|
| 479 |
sort : typing.Optional[str] |
| 480 |
Field to sort by. Use <code>field:order</code> where order is <code>1</code> for ascending and <code>-1</code> for descending. e.g. <code>created_at:1</code>. We currently support sorting by the following fields: <code>name</code>, <code>display_name</code> and <code>created_at</code>. |
| 481 |
|
| 482 |
request_options : typing.Optional[RequestOptions] |
| 483 |
Request-specific configuration. |
| 484 |
|
| 485 |
Returns |
| 486 |
------- |
| 487 |
AsyncPager[Organization, ListOrganizationsPaginatedResponseContent] |
| 488 |
Organizations successfully retrieved. |
| 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 |
response = await client.organizations.list( |
| 503 |
from_="from", |
| 504 |
take=1, |
| 505 |
sort="sort", |
| 506 |
) |
| 507 |
async for item in response: |
| 508 |
yield item |
| 509 |
|
| 510 |
# alternatively, you can paginate page-by-page |
| 511 |
async for page in response.iter_pages(): |
| 512 |
yield page |
| 513 |
|
| 514 |
|
| 515 |
asyncio.run(main()) |
| 516 |
""" |
| 517 |
return await self._raw_client.list(from_=from_, take=take, sort=sort, request_options=request_options) |
| 518 |
|
| 519 |
async def create( |
| 520 |
self, |
| 521 |
*, |
| 522 |
name: str, |
| 523 |
display_name: typing.Optional[str] = OMIT, |
| 524 |
branding: typing.Optional[OrganizationBranding] = OMIT, |
| 525 |
metadata: typing.Optional[OrganizationMetadata] = OMIT, |
| 526 |
enabled_connections: typing.Optional[typing.Sequence[ConnectionForOrganization]] = OMIT, |
| 527 |
token_quota: typing.Optional[CreateTokenQuota] = OMIT, |
| 528 |
third_party_client_access: typing.Optional[OrganizationThirdPartyClientAccessEnum] = OMIT, |
| 529 |
request_options: typing.Optional[RequestOptions] = None, |
| 530 |
) -> CreateOrganizationResponseContent: |
| 531 |
""" |
| 532 |
Create a new Organization within your tenant. To learn more about Organization settings, behavior, and configuration options, review [Create Your First Organization](https://auth0.com/docs/manage-users/organizations/create-first-organization). |
| 533 |
|
| 534 |
Parameters |
| 535 |
---------- |
| 536 |
name : str |
| 537 |
The name of this organization. |
| 538 |
|
| 539 |
display_name : typing.Optional[str] |
| 540 |
Friendly name of this organization. |
| 541 |
|
| 542 |
branding : typing.Optional[OrganizationBranding] |
| 543 |
|
| 544 |
metadata : typing.Optional[OrganizationMetadata] |
| 545 |
|
| 546 |
enabled_connections : typing.Optional[typing.Sequence[ConnectionForOrganization]] |
| 547 |
Connections that will be enabled for this organization. See POST enabled_connections endpoint for the object format. (Max of 10 connections allowed) |
| 548 |
|
| 549 |
token_quota : typing.Optional[CreateTokenQuota] |
| 550 |
|
| 551 |
third_party_client_access : typing.Optional[OrganizationThirdPartyClientAccessEnum] |
| 552 |
|
| 553 |
request_options : typing.Optional[RequestOptions] |
| 554 |
Request-specific configuration. |
| 555 |
|
| 556 |
Returns |
| 557 |
------- |
| 558 |
CreateOrganizationResponseContent |
| 559 |
Organization successfully created. |
| 560 |
|
| 561 |
Examples |
| 562 |
-------- |
| 563 |
import asyncio |
| 564 |
|
| 565 |
from auth0 import AsyncAuth0 |
| 566 |
|
| 567 |
client = AsyncAuth0( |
| 568 |
token="YOUR_TOKEN", |
| 569 |
) |
| 570 |
|
| 571 |
|
| 572 |
async def main() -> None: |
| 573 |
await client.organizations.create( |
| 574 |
name="name", |
| 575 |
) |
| 576 |
|
| 577 |
|
| 578 |
asyncio.run(main()) |
| 579 |
""" |
| 580 |
_response = await self._raw_client.create( |
| 581 |
name=name, |
| 582 |
display_name=display_name, |
| 583 |
branding=branding, |
| 584 |
metadata=metadata, |
| 585 |
enabled_connections=enabled_connections, |
| 586 |
token_quota=token_quota, |
| 587 |
third_party_client_access=third_party_client_access, |
| 588 |
request_options=request_options, |
| 589 |
) |
| 590 |
return _response.data |
| 591 |
|
| 592 |
async def get_by_name( |
| 593 |
self, name: str, *, request_options: typing.Optional[RequestOptions] = None |
| 594 |
) -> GetOrganizationByNameResponseContent: |
| 595 |
""" |
| 596 |
Retrieve details about a single Organization specified by name. |
| 597 |
|
| 598 |
Parameters |
| 599 |
---------- |
| 600 |
name : str |
| 601 |
name of the organization to retrieve. |
| 602 |
|
| 603 |
request_options : typing.Optional[RequestOptions] |
| 604 |
Request-specific configuration. |
| 605 |
|
| 606 |
Returns |
| 607 |
------- |
| 608 |
GetOrganizationByNameResponseContent |
| 609 |
Organization successfully retrieved. |
| 610 |
|
| 611 |
Examples |
| 612 |
-------- |
| 613 |
import asyncio |
| 614 |
|
| 615 |
from auth0 import AsyncAuth0 |
| 616 |
|
| 617 |
client = AsyncAuth0( |
| 618 |
token="YOUR_TOKEN", |
| 619 |
) |
| 620 |
|
| 621 |
|
| 622 |
async def main() -> None: |
| 623 |
await client.organizations.get_by_name( |
| 624 |
name="name", |
| 625 |
) |
| 626 |
|
| 627 |
|
| 628 |
asyncio.run(main()) |
| 629 |
""" |
| 630 |
_response = await self._raw_client.get_by_name(name, request_options=request_options) |
| 631 |
return _response.data |
| 632 |
|
| 633 |
async def get( |
| 634 |
self, id: str, *, request_options: typing.Optional[RequestOptions] = None |
| 635 |
) -> GetOrganizationResponseContent: |
| 636 |
""" |
| 637 |
Retrieve details about a single Organization specified by ID. |
| 638 |
|
| 639 |
Parameters |
| 640 |
---------- |
| 641 |
id : str |
| 642 |
ID of the organization to retrieve. |
| 643 |
|
| 644 |
request_options : typing.Optional[RequestOptions] |
| 645 |
Request-specific configuration. |
| 646 |
|
| 647 |
Returns |
| 648 |
------- |
| 649 |
GetOrganizationResponseContent |
| 650 |
Organization successfully retrieved. |
| 651 |
|
| 652 |
Examples |
| 653 |
-------- |
| 654 |
import asyncio |
| 655 |
|
| 656 |
from auth0 import AsyncAuth0 |
| 657 |
|
| 658 |
client = AsyncAuth0( |
| 659 |
token="YOUR_TOKEN", |
| 660 |
) |
| 661 |
|
| 662 |
|
| 663 |
async def main() -> None: |
| 664 |
await client.organizations.get( |
| 665 |
id="id", |
| 666 |
) |
| 667 |
|
| 668 |
|
| 669 |
asyncio.run(main()) |
| 670 |
""" |
| 671 |
_response = await self._raw_client.get(id, request_options=request_options) |
| 672 |
return _response.data |
| 673 |
|
| 674 |
async def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: |
| 675 |
""" |
| 676 |
Remove an Organization from your tenant. This action cannot be undone. |
| 677 |
|
| 678 |
**Note**: Members are automatically disassociated from an Organization when it is deleted. However, this action does **not** delete these users from your tenant. |
| 679 |
|
| 680 |
Parameters |
| 681 |
---------- |
| 682 |
id : str |
| 683 |
Organization identifier. |
| 684 |
|
| 685 |
request_options : typing.Optional[RequestOptions] |
| 686 |
Request-specific configuration. |
| 687 |
|
| 688 |
Returns |
| 689 |
------- |
| 690 |
None |
| 691 |
|
| 692 |
Examples |
| 693 |
-------- |
| 694 |
import asyncio |
| 695 |
|
| 696 |
from auth0 import AsyncAuth0 |
| 697 |
|
| 698 |
client = AsyncAuth0( |
| 699 |
token="YOUR_TOKEN", |
| 700 |
) |
| 701 |
|
| 702 |
|
| 703 |
async def main() -> None: |
| 704 |
await client.organizations.delete( |
| 705 |
id="id", |
| 706 |
) |
| 707 |
|
| 708 |
|
| 709 |
asyncio.run(main()) |
| 710 |
""" |
| 711 |
_response = await self._raw_client.delete(id, request_options=request_options) |
| 712 |
return _response.data |
| 713 |
|
| 714 |
async def update( |
| 715 |
self, |
| 716 |
id: str, |
| 717 |
*, |
| 718 |
display_name: typing.Optional[str] = OMIT, |
| 719 |
name: typing.Optional[str] = OMIT, |
| 720 |
branding: typing.Optional[OrganizationBranding] = OMIT, |
| 721 |
metadata: typing.Optional[OrganizationMetadata] = OMIT, |
| 722 |
token_quota: typing.Optional[UpdateTokenQuota] = OMIT, |
| 723 |
third_party_client_access: typing.Optional[OrganizationThirdPartyClientAccessEnum] = OMIT, |
| 724 |
request_options: typing.Optional[RequestOptions] = None, |
| 725 |
) -> UpdateOrganizationResponseContent: |
| 726 |
""" |
| 727 |
Update the details of a specific [Organization](https://auth0.com/docs/manage-users/organizations/configure-organizations/create-organizations), such as name and display name, branding options, and metadata. |
| 728 |
|
| 729 |
Parameters |
| 730 |
---------- |
| 731 |
id : str |
| 732 |
ID of the organization to update. |
| 733 |
|
| 734 |
display_name : typing.Optional[str] |
| 735 |
Friendly name of this organization. |
| 736 |
|
| 737 |
name : typing.Optional[str] |
| 738 |
The name of this organization. |
| 739 |
|
| 740 |
branding : typing.Optional[OrganizationBranding] |
| 741 |
|
| 742 |
metadata : typing.Optional[OrganizationMetadata] |
| 743 |
|
| 744 |
token_quota : typing.Optional[UpdateTokenQuota] |
| 745 |
|
| 746 |
third_party_client_access : typing.Optional[OrganizationThirdPartyClientAccessEnum] |
| 747 |
|
| 748 |
request_options : typing.Optional[RequestOptions] |
| 749 |
Request-specific configuration. |
| 750 |
|
| 751 |
Returns |
| 752 |
------- |
| 753 |
UpdateOrganizationResponseContent |
| 754 |
Organization successfully updated. |
| 755 |
|
| 756 |
Examples |
| 757 |
-------- |
| 758 |
import asyncio |
| 759 |
|
| 760 |
from auth0 import AsyncAuth0 |
| 761 |
|
| 762 |
client = AsyncAuth0( |
| 763 |
token="YOUR_TOKEN", |
| 764 |
) |
| 765 |
|
| 766 |
|
| 767 |
async def main() -> None: |
| 768 |
await client.organizations.update( |
| 769 |
id="id", |
| 770 |
) |
| 771 |
|
| 772 |
|
| 773 |
asyncio.run(main()) |
| 774 |
""" |
| 775 |
_response = await self._raw_client.update( |
| 776 |
id, |
| 777 |
display_name=display_name, |
| 778 |
name=name, |
| 779 |
branding=branding, |
| 780 |
metadata=metadata, |
| 781 |
token_quota=token_quota, |
| 782 |
third_party_client_access=third_party_client_access, |
| 783 |
request_options=request_options, |
| 784 |
) |
| 785 |
return _response.data |
| 786 |
|
| 787 |
@property |
| 788 |
def client_grants(self): |
| 789 |
if self._client_grants is None: |
| 790 |
from .client_grants.client import AsyncClientGrantsClient |
| 791 |
|
| 792 |
self._client_grants = AsyncClientGrantsClient(client_wrapper=self._client_wrapper) |
| 793 |
return self._client_grants |
| 794 |
|
| 795 |
@property |
| 796 |
def connections(self): |
| 797 |
if self._connections is None: |
| 798 |
from .connections.client import AsyncConnectionsClient |
| 799 |
|
| 800 |
self._connections = AsyncConnectionsClient(client_wrapper=self._client_wrapper) |
| 801 |
return self._connections |
| 802 |
|
| 803 |
@property |
| 804 |
def discovery_domains(self): |
| 805 |
if self._discovery_domains is None: |
| 806 |
from .discovery_domains.client import AsyncDiscoveryDomainsClient |
| 807 |
|
| 808 |
self._discovery_domains = AsyncDiscoveryDomainsClient(client_wrapper=self._client_wrapper) |
| 809 |
return self._discovery_domains |
| 810 |
|
| 811 |
@property |
| 812 |
def enabled_connections(self): |
| 813 |
if self._enabled_connections is None: |
| 814 |
from .enabled_connections.client import AsyncEnabledConnectionsClient |
| 815 |
|
| 816 |
self._enabled_connections = AsyncEnabledConnectionsClient(client_wrapper=self._client_wrapper) |
| 817 |
return self._enabled_connections |
| 818 |
|
| 819 |
@property |
| 820 |
def invitations(self): |
| 821 |
if self._invitations is None: |
| 822 |
from .invitations.client import AsyncInvitationsClient |
| 823 |
|
| 824 |
self._invitations = AsyncInvitationsClient(client_wrapper=self._client_wrapper) |
| 825 |
return self._invitations |
| 826 |
|
| 827 |
@property |
| 828 |
def members(self): |
| 829 |
if self._members is None: |
| 830 |
from .members.client import AsyncMembersClient |
| 831 |
|
| 832 |
self._members = AsyncMembersClient(client_wrapper=self._client_wrapper) |
| 833 |
return self._members |
| 834 |
|
| 835 |
@property |
| 836 |
def groups(self): |
| 837 |
if self._groups is None: |
| 838 |
from .groups.client import AsyncGroupsClient |
| 839 |
|
| 840 |
self._groups = AsyncGroupsClient(client_wrapper=self._client_wrapper) |
| 841 |
return self._groups |
| 842 |
|
| 843 |
@property |
| 844 |
def roles(self): |
| 845 |
if self._roles is None: |
| 846 |
from .roles.client import AsyncRolesClient |
| 847 |
|
| 848 |
self._roles = AsyncRolesClient(client_wrapper=self._client_wrapper) |
| 849 |
return self._roles |