b2c_tooling_sdk.operations.orgs
Account Manager organization management operations.
Mirrors src/operations/orgs/index.ts. Provides high-level functions for managing organizations in Account Manager, including retrieving organization details.
Core Organization Functions
get_org-- Get organization details by IDget_org_by_name-- Get organization details by namelist_orgs-- List organizations with pagination
Usage
from b2c_tooling_sdk.operations.orgs import get_org, get_org_by_name, list_orgs
from b2c_tooling_sdk.clients import create_account_manager_orgs_client
from b2c_tooling_sdk.auth import OAuthStrategy
auth = OAuthStrategy(client_id="your-client-id", client_secret="your-client-secret")
client = create_account_manager_orgs_client(config, auth)
# Get an organization by ID
org = await get_org(client, "org-id")
# Get an organization by name
org = await get_org_by_name(client, "My Organization")
# List organizations
orgs = await list_orgs(client, ListOrgsOptions(size=25, page=0))Authentication
Organization operations require OAuth authentication with appropriate Account Manager permissions.
Functions
get_org
async def get_org(client: AccountManagerOrgsClient, org_id: str) -> AccountManagerOrganizationGet an organization by ID.
Parameters
| Name | Type | Description |
|---|---|---|
client | AccountManagerOrgsClient | Account Manager Organizations client. |
org_id | str | Organization ID. |
Returns: Organization details.
Raises
RuntimeError— If the organization is not found (404), authentication fails (401), permission is denied (403), or other request failures occur.
get_org_by_name
async def get_org_by_name(client: AccountManagerOrgsClient, name: str) -> AccountManagerOrganizationGet an organization by name.
Performs a case-sensitive prefix search using startsWith, filters to an exact match if multiple results are found, and raises if ambiguous.
Parameters
| Name | Type | Description |
|---|---|---|
client | AccountManagerOrgsClient | Account Manager Organizations client. |
name | str | Organization name. |
Returns: Organization details.
Raises
RuntimeError— If the organization is not found or if multiple organizations match the name.
list_orgs
async def list_orgs(client: AccountManagerOrgsClient, options: ListOrgsOptions | None = None) -> OrganizationCollectionList organizations with pagination.
Parameters
| Name | Type | Description |
|---|---|---|
client | AccountManagerOrgsClient | Account Manager Organizations client. |
options | ListOrgsOptions | None | Pagination options. Set all=True to retrieve all organizations using the max page size of 5000. |
Returns: Paginated organization collection with pagination metadata (totalElements, totalPages, number, size).
Re-exports
Also exported from this module; documented elsewhere: