From f2945aa177f54a1c94b7fac438b859aefab7896b Mon Sep 17 00:00:00 2001 From: "workos-sdk-automation[bot]" <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Date: Fri, 13 Nov 2026 20:15:22 +0000 Subject: [PATCH 1/3] feat(pipes): Update Pipes API surface --- ...tegration_vended_credential_auth_method.py | 14 +++++ src/workos/pipes/_resource.py | 44 ++++++++++++++-- src/workos/pipes/models/__init__.py | 3 -- .../pipes/models/connected_account_input.py | 5 ++ .../pipes/models/create_connected_account.py | 10 ++++ .../create_organization_connected_account.py | 10 ++++ .../data_integration_access_token_response.py | 2 +- .../data_integration_credentials_response.py | 3 +- .../models/organization_connected_account.py | 5 ++ src/workos/pipes_provider/_resource.py | 45 +++++++++++++++- src/workos/pipes_provider/models/__init__.py | 4 ++ .../models/pipes_provider_ownership.py | 22 ++++++++ tests/fixtures/connected_account_input.json | 1 + tests/fixtures/create_connected_account.json | 2 + ...create_organization_connected_account.json | 2 + .../organization_connected_account.json | 1 + tests/test_pipes_provider.py | 51 +++++++++++++++++++ 17 files changed, 213 insertions(+), 11 deletions(-) create mode 100644 src/workos/common/models/data_integration_vended_credential_auth_method.py create mode 100644 src/workos/pipes_provider/models/pipes_provider_ownership.py diff --git a/src/workos/common/models/data_integration_vended_credential_auth_method.py b/src/workos/common/models/data_integration_vended_credential_auth_method.py new file mode 100644 index 000000000..a3d330423 --- /dev/null +++ b/src/workos/common/models/data_integration_vended_credential_auth_method.py @@ -0,0 +1,14 @@ +# This file is auto-generated by oagen. Do not edit. + +from typing import Literal, TypeAlias + +from .connected_account_auth_method import ConnectedAccountAuthMethod + +DataIntegrationVendedCredentialAuthMethod: TypeAlias = ConnectedAccountAuthMethod +DataIntegrationVendedCredentialAuthMethodLiteral: TypeAlias = Literal[ + "oauth", "api_key", "client_credentials" +] +__all__ = [ + "DataIntegrationVendedCredentialAuthMethod", + "DataIntegrationVendedCredentialAuthMethodLiteral", +] diff --git a/src/workos/pipes/_resource.py b/src/workos/pipes/_resource.py index 872af3b8a..52cac69de 100644 --- a/src/workos/pipes/_resource.py +++ b/src/workos/pipes/_resource.py @@ -1046,11 +1046,13 @@ def create_organization_connected_account( user_id: str, account_display_name: str | None | NotGiven = NOT_GIVEN, account_identifier: str | None | NotGiven = NOT_GIVEN, + config: dict[str, str] | None = None, access_token: str | None = None, refresh_token: str | None = None, expires_at: datetime | str | None = None, scopes: list[str] | None = None, state: CreateOrganizationConnectedAccountState | str | None = None, + metadata: dict[str, Any] | None = None, connection_intent: Literal["add"] | None = None, idempotency_key: str | None = None, request_options: RequestOptions | None = None, @@ -1064,12 +1066,14 @@ def create_organization_connected_account( slug: The slug identifier of the provider (e.g., `github`, `slack`, `notion`). account_display_name: A mutable, non-unique connection label; null clears it. Not an account identifier. account_identifier: A developer-attested account identifier; null clears it. + config: Installation-scoped provider configuration for this connection, such as Salesforce salesforce_host. Imports apply supplied values over installation-scoped integration pins and inherit other config from the credential source. Credential-bearing imports must satisfy required configuration even when config is omitted or {}. On update, a supplied object replaces installation-scoped values; omitted config preserves the stored snapshot. Stored integration-scoped values remain bound to the OAuth client and cannot be overridden or replaced with current integration pins. Replacements must satisfy required configuration; {} and empty-string values clear installation-scoped values only when the result is valid. Provider defaults count toward completeness but are resolved at read time, not stored. Only tokenless needs_reauthorization placeholders may remain incomplete; attaching their first tokens validates configuration even when config is omitted. Unrelated updates do not revalidate unchanged configuration. Clearing salesforce_host falls back to login.salesforce.com, which may not work for sandbox or My Domain-only connections. access_token: The OAuth access token for the connected account. refresh_token: The OAuth refresh token for the connected account. expires_at: The ISO-8601 timestamp when the access token expires. Required when `access_token` is provided for tokens that expire. scopes: The OAuth scopes granted for this connection. state: Explicitly set the state of the connected account. When omitted, the state is derived from the token combination provided. user_id: The [User](https://workos.com/docs/reference/authkit/user) identifier of the organization member on whose behalf the connected account is being imported or updated. The user must be an active member of the organization. + metadata: Provider token-response metadata to preserve during import, such as Salesforce instance_url. Only allowlisted, non-sensitive scalar fields from this provider are accepted, including nested fields. Provider refresh responses can update these values. Not accepted on update. connection_intent: Set to `add` to create another connected account. Omit this field for permanent compatibility behavior. idempotency_key: Optional idempotency key for safe retries. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. @@ -1089,12 +1093,14 @@ def create_organization_connected_account( body: dict[str, Any] = { k: v for k, v in { + "config": config, "access_token": access_token, "refresh_token": refresh_token, "expires_at": expires_at, "scopes": scopes, "state": enum_value(state) if state is not None else None, "user_id": user_id, + "metadata": metadata, "connection_intent": connection_intent, }.items() if v is not None @@ -1125,6 +1131,7 @@ def update_organization_connected_account( user_id: str, account_display_name: str | None | NotGiven = NOT_GIVEN, account_identifier: str | None | NotGiven = NOT_GIVEN, + config: dict[str, str] | None = None, access_token: str | None = None, refresh_token: str | None = None, expires_at: datetime | str | None = None, @@ -1137,13 +1144,14 @@ def update_organization_connected_account( ) -> ConnectedAccount: """Update an organization connected account - Updates an organization's [connected account](https://workos.com/docs/reference/pipes/connected-account) tokens, scopes, or state for a specific provider. + Updates an organization's [connected account](https://workos.com/docs/reference/pipes/connected-account) tokens, scopes, state, or provider configuration for a specific provider. Args: organization_id: An [Organization](https://workos.com/docs/reference/organization) identifier. slug: The slug identifier of the provider (e.g., `github`, `slack`, `notion`). account_display_name: A mutable, non-unique connection label; null clears it. Not an account identifier. account_identifier: A developer-attested account identifier; null clears it. + config: Installation-scoped provider configuration for this connection, such as Salesforce salesforce_host. Imports apply supplied values over installation-scoped integration pins and inherit other config from the credential source. Credential-bearing imports must satisfy required configuration even when config is omitted or {}. On update, a supplied object replaces installation-scoped values; omitted config preserves the stored snapshot. Stored integration-scoped values remain bound to the OAuth client and cannot be overridden or replaced with current integration pins. Replacements must satisfy required configuration; {} and empty-string values clear installation-scoped values only when the result is valid. Provider defaults count toward completeness but are resolved at read time, not stored. Only tokenless needs_reauthorization placeholders may remain incomplete; attaching their first tokens validates configuration even when config is omitted. Unrelated updates do not revalidate unchanged configuration. Clearing salesforce_host falls back to login.salesforce.com, which may not work for sandbox or My Domain-only connections. access_token: The OAuth access token for the connected account. refresh_token: The OAuth refresh token for the connected account. expires_at: The ISO-8601 timestamp when the access token expires. Required when `access_token` is provided for tokens that expire. @@ -1171,6 +1179,7 @@ def update_organization_connected_account( body: dict[str, Any] = { k: v for k, v in { + "config": config, "access_token": access_token, "refresh_token": refresh_token, "expires_at": expires_at, @@ -1358,11 +1367,13 @@ def create_user_connected_account( *, account_display_name: str | None | NotGiven = NOT_GIVEN, account_identifier: str | None | NotGiven = NOT_GIVEN, + config: dict[str, str] | None = None, access_token: str | None = None, refresh_token: str | None = None, expires_at: datetime | str | None = None, scopes: list[str] | None = None, state: CreateConnectedAccountState | str | None = None, + metadata: dict[str, Any] | None = None, connection_intent: Literal["add"] | None = None, organization_id: str | None = None, idempotency_key: str | None = None, @@ -1377,11 +1388,13 @@ def create_user_connected_account( slug: The slug identifier of the provider (e.g., `github`, `slack`, `notion`). account_display_name: A mutable, non-unique connection label; null clears it. Not an account identifier. account_identifier: A developer-attested account identifier; null clears it. + config: Installation-scoped provider configuration for this connection, such as Salesforce salesforce_host. Imports apply supplied values over installation-scoped integration pins and inherit other config from the credential source. Credential-bearing imports must satisfy required configuration even when config is omitted or {}. On update, a supplied object replaces installation-scoped values; omitted config preserves the stored snapshot. Stored integration-scoped values remain bound to the OAuth client and cannot be overridden or replaced with current integration pins. Replacements must satisfy required configuration; {} and empty-string values clear installation-scoped values only when the result is valid. Provider defaults count toward completeness but are resolved at read time, not stored. Only tokenless needs_reauthorization placeholders may remain incomplete; attaching their first tokens validates configuration even when config is omitted. Unrelated updates do not revalidate unchanged configuration. Clearing salesforce_host falls back to login.salesforce.com, which may not work for sandbox or My Domain-only connections. access_token: The OAuth access token for the connected account. refresh_token: The OAuth refresh token for the connected account. expires_at: The ISO-8601 timestamp when the access token expires. Required when `access_token` is provided for tokens that expire. scopes: The OAuth scopes granted for this connection. state: Explicitly set the state of the connected account. When omitted, the state is derived from the token combination provided. + metadata: Provider token-response metadata to preserve during import, such as Salesforce instance_url. Only allowlisted, non-sensitive scalar fields from this provider are accepted, including nested fields. Provider refresh responses can update these values. Not accepted on update. connection_intent: Set to `add` to create another connected account. Omit this field for permanent compatibility behavior. organization_id: An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter if the connection is scoped to an organization. idempotency_key: Optional idempotency key for safe retries. @@ -1401,11 +1414,13 @@ def create_user_connected_account( body: dict[str, Any] = { k: v for k, v in { + "config": config, "access_token": access_token, "refresh_token": refresh_token, "expires_at": expires_at, "scopes": scopes, "state": enum_value(state) if state is not None else None, + "metadata": metadata, "connection_intent": connection_intent, }.items() if v is not None @@ -1444,6 +1459,7 @@ def update_user_connected_account( *, account_display_name: str | None | NotGiven = NOT_GIVEN, account_identifier: str | None | NotGiven = NOT_GIVEN, + config: dict[str, str] | None = None, access_token: str | None = None, refresh_token: str | None = None, expires_at: datetime | str | None = None, @@ -1457,13 +1473,14 @@ def update_user_connected_account( ) -> ConnectedAccount: """Update a connected account - Updates a user's [connected account](https://workos.com/docs/reference/pipes/connected-account) tokens, scopes, or state for a specific provider. + Updates a user's [connected account](https://workos.com/docs/reference/pipes/connected-account) tokens, scopes, state, or provider configuration for a specific provider. Args: user_id: A [User](https://workos.com/docs/reference/authkit/user) identifier. slug: The slug identifier of the provider (e.g., `github`, `slack`, `notion`). account_display_name: A mutable, non-unique connection label; null clears it. Not an account identifier. account_identifier: A developer-attested account identifier; null clears it. + config: Installation-scoped provider configuration for this connection, such as Salesforce salesforce_host. Imports apply supplied values over installation-scoped integration pins and inherit other config from the credential source. Credential-bearing imports must satisfy required configuration even when config is omitted or {}. On update, a supplied object replaces installation-scoped values; omitted config preserves the stored snapshot. Stored integration-scoped values remain bound to the OAuth client and cannot be overridden or replaced with current integration pins. Replacements must satisfy required configuration; {} and empty-string values clear installation-scoped values only when the result is valid. Provider defaults count toward completeness but are resolved at read time, not stored. Only tokenless needs_reauthorization placeholders may remain incomplete; attaching their first tokens validates configuration even when config is omitted. Unrelated updates do not revalidate unchanged configuration. Clearing salesforce_host falls back to login.salesforce.com, which may not work for sandbox or My Domain-only connections. access_token: The OAuth access token for the connected account. refresh_token: The OAuth refresh token for the connected account. expires_at: The ISO-8601 timestamp when the access token expires. Required when `access_token` is provided for tokens that expire. @@ -1490,6 +1507,7 @@ def update_user_connected_account( body: dict[str, Any] = { k: v for k, v in { + "config": config, "access_token": access_token, "refresh_token": refresh_token, "expires_at": expires_at, @@ -2597,11 +2615,13 @@ async def create_organization_connected_account( user_id: str, account_display_name: str | None | NotGiven = NOT_GIVEN, account_identifier: str | None | NotGiven = NOT_GIVEN, + config: dict[str, str] | None = None, access_token: str | None = None, refresh_token: str | None = None, expires_at: datetime | str | None = None, scopes: list[str] | None = None, state: CreateOrganizationConnectedAccountState | str | None = None, + metadata: dict[str, Any] | None = None, connection_intent: Literal["add"] | None = None, idempotency_key: str | None = None, request_options: RequestOptions | None = None, @@ -2615,12 +2635,14 @@ async def create_organization_connected_account( slug: The slug identifier of the provider (e.g., `github`, `slack`, `notion`). account_display_name: A mutable, non-unique connection label; null clears it. Not an account identifier. account_identifier: A developer-attested account identifier; null clears it. + config: Installation-scoped provider configuration for this connection, such as Salesforce salesforce_host. Imports apply supplied values over installation-scoped integration pins and inherit other config from the credential source. Credential-bearing imports must satisfy required configuration even when config is omitted or {}. On update, a supplied object replaces installation-scoped values; omitted config preserves the stored snapshot. Stored integration-scoped values remain bound to the OAuth client and cannot be overridden or replaced with current integration pins. Replacements must satisfy required configuration; {} and empty-string values clear installation-scoped values only when the result is valid. Provider defaults count toward completeness but are resolved at read time, not stored. Only tokenless needs_reauthorization placeholders may remain incomplete; attaching their first tokens validates configuration even when config is omitted. Unrelated updates do not revalidate unchanged configuration. Clearing salesforce_host falls back to login.salesforce.com, which may not work for sandbox or My Domain-only connections. access_token: The OAuth access token for the connected account. refresh_token: The OAuth refresh token for the connected account. expires_at: The ISO-8601 timestamp when the access token expires. Required when `access_token` is provided for tokens that expire. scopes: The OAuth scopes granted for this connection. state: Explicitly set the state of the connected account. When omitted, the state is derived from the token combination provided. user_id: The [User](https://workos.com/docs/reference/authkit/user) identifier of the organization member on whose behalf the connected account is being imported or updated. The user must be an active member of the organization. + metadata: Provider token-response metadata to preserve during import, such as Salesforce instance_url. Only allowlisted, non-sensitive scalar fields from this provider are accepted, including nested fields. Provider refresh responses can update these values. Not accepted on update. connection_intent: Set to `add` to create another connected account. Omit this field for permanent compatibility behavior. idempotency_key: Optional idempotency key for safe retries. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. @@ -2640,12 +2662,14 @@ async def create_organization_connected_account( body: dict[str, Any] = { k: v for k, v in { + "config": config, "access_token": access_token, "refresh_token": refresh_token, "expires_at": expires_at, "scopes": scopes, "state": enum_value(state) if state is not None else None, "user_id": user_id, + "metadata": metadata, "connection_intent": connection_intent, }.items() if v is not None @@ -2676,6 +2700,7 @@ async def update_organization_connected_account( user_id: str, account_display_name: str | None | NotGiven = NOT_GIVEN, account_identifier: str | None | NotGiven = NOT_GIVEN, + config: dict[str, str] | None = None, access_token: str | None = None, refresh_token: str | None = None, expires_at: datetime | str | None = None, @@ -2688,13 +2713,14 @@ async def update_organization_connected_account( ) -> ConnectedAccount: """Update an organization connected account - Updates an organization's [connected account](https://workos.com/docs/reference/pipes/connected-account) tokens, scopes, or state for a specific provider. + Updates an organization's [connected account](https://workos.com/docs/reference/pipes/connected-account) tokens, scopes, state, or provider configuration for a specific provider. Args: organization_id: An [Organization](https://workos.com/docs/reference/organization) identifier. slug: The slug identifier of the provider (e.g., `github`, `slack`, `notion`). account_display_name: A mutable, non-unique connection label; null clears it. Not an account identifier. account_identifier: A developer-attested account identifier; null clears it. + config: Installation-scoped provider configuration for this connection, such as Salesforce salesforce_host. Imports apply supplied values over installation-scoped integration pins and inherit other config from the credential source. Credential-bearing imports must satisfy required configuration even when config is omitted or {}. On update, a supplied object replaces installation-scoped values; omitted config preserves the stored snapshot. Stored integration-scoped values remain bound to the OAuth client and cannot be overridden or replaced with current integration pins. Replacements must satisfy required configuration; {} and empty-string values clear installation-scoped values only when the result is valid. Provider defaults count toward completeness but are resolved at read time, not stored. Only tokenless needs_reauthorization placeholders may remain incomplete; attaching their first tokens validates configuration even when config is omitted. Unrelated updates do not revalidate unchanged configuration. Clearing salesforce_host falls back to login.salesforce.com, which may not work for sandbox or My Domain-only connections. access_token: The OAuth access token for the connected account. refresh_token: The OAuth refresh token for the connected account. expires_at: The ISO-8601 timestamp when the access token expires. Required when `access_token` is provided for tokens that expire. @@ -2722,6 +2748,7 @@ async def update_organization_connected_account( body: dict[str, Any] = { k: v for k, v in { + "config": config, "access_token": access_token, "refresh_token": refresh_token, "expires_at": expires_at, @@ -2909,11 +2936,13 @@ async def create_user_connected_account( *, account_display_name: str | None | NotGiven = NOT_GIVEN, account_identifier: str | None | NotGiven = NOT_GIVEN, + config: dict[str, str] | None = None, access_token: str | None = None, refresh_token: str | None = None, expires_at: datetime | str | None = None, scopes: list[str] | None = None, state: CreateConnectedAccountState | str | None = None, + metadata: dict[str, Any] | None = None, connection_intent: Literal["add"] | None = None, organization_id: str | None = None, idempotency_key: str | None = None, @@ -2928,11 +2957,13 @@ async def create_user_connected_account( slug: The slug identifier of the provider (e.g., `github`, `slack`, `notion`). account_display_name: A mutable, non-unique connection label; null clears it. Not an account identifier. account_identifier: A developer-attested account identifier; null clears it. + config: Installation-scoped provider configuration for this connection, such as Salesforce salesforce_host. Imports apply supplied values over installation-scoped integration pins and inherit other config from the credential source. Credential-bearing imports must satisfy required configuration even when config is omitted or {}. On update, a supplied object replaces installation-scoped values; omitted config preserves the stored snapshot. Stored integration-scoped values remain bound to the OAuth client and cannot be overridden or replaced with current integration pins. Replacements must satisfy required configuration; {} and empty-string values clear installation-scoped values only when the result is valid. Provider defaults count toward completeness but are resolved at read time, not stored. Only tokenless needs_reauthorization placeholders may remain incomplete; attaching their first tokens validates configuration even when config is omitted. Unrelated updates do not revalidate unchanged configuration. Clearing salesforce_host falls back to login.salesforce.com, which may not work for sandbox or My Domain-only connections. access_token: The OAuth access token for the connected account. refresh_token: The OAuth refresh token for the connected account. expires_at: The ISO-8601 timestamp when the access token expires. Required when `access_token` is provided for tokens that expire. scopes: The OAuth scopes granted for this connection. state: Explicitly set the state of the connected account. When omitted, the state is derived from the token combination provided. + metadata: Provider token-response metadata to preserve during import, such as Salesforce instance_url. Only allowlisted, non-sensitive scalar fields from this provider are accepted, including nested fields. Provider refresh responses can update these values. Not accepted on update. connection_intent: Set to `add` to create another connected account. Omit this field for permanent compatibility behavior. organization_id: An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter if the connection is scoped to an organization. idempotency_key: Optional idempotency key for safe retries. @@ -2952,11 +2983,13 @@ async def create_user_connected_account( body: dict[str, Any] = { k: v for k, v in { + "config": config, "access_token": access_token, "refresh_token": refresh_token, "expires_at": expires_at, "scopes": scopes, "state": enum_value(state) if state is not None else None, + "metadata": metadata, "connection_intent": connection_intent, }.items() if v is not None @@ -2995,6 +3028,7 @@ async def update_user_connected_account( *, account_display_name: str | None | NotGiven = NOT_GIVEN, account_identifier: str | None | NotGiven = NOT_GIVEN, + config: dict[str, str] | None = None, access_token: str | None = None, refresh_token: str | None = None, expires_at: datetime | str | None = None, @@ -3008,13 +3042,14 @@ async def update_user_connected_account( ) -> ConnectedAccount: """Update a connected account - Updates a user's [connected account](https://workos.com/docs/reference/pipes/connected-account) tokens, scopes, or state for a specific provider. + Updates a user's [connected account](https://workos.com/docs/reference/pipes/connected-account) tokens, scopes, state, or provider configuration for a specific provider. Args: user_id: A [User](https://workos.com/docs/reference/authkit/user) identifier. slug: The slug identifier of the provider (e.g., `github`, `slack`, `notion`). account_display_name: A mutable, non-unique connection label; null clears it. Not an account identifier. account_identifier: A developer-attested account identifier; null clears it. + config: Installation-scoped provider configuration for this connection, such as Salesforce salesforce_host. Imports apply supplied values over installation-scoped integration pins and inherit other config from the credential source. Credential-bearing imports must satisfy required configuration even when config is omitted or {}. On update, a supplied object replaces installation-scoped values; omitted config preserves the stored snapshot. Stored integration-scoped values remain bound to the OAuth client and cannot be overridden or replaced with current integration pins. Replacements must satisfy required configuration; {} and empty-string values clear installation-scoped values only when the result is valid. Provider defaults count toward completeness but are resolved at read time, not stored. Only tokenless needs_reauthorization placeholders may remain incomplete; attaching their first tokens validates configuration even when config is omitted. Unrelated updates do not revalidate unchanged configuration. Clearing salesforce_host falls back to login.salesforce.com, which may not work for sandbox or My Domain-only connections. access_token: The OAuth access token for the connected account. refresh_token: The OAuth refresh token for the connected account. expires_at: The ISO-8601 timestamp when the access token expires. Required when `access_token` is provided for tokens that expire. @@ -3041,6 +3076,7 @@ async def update_user_connected_account( body: dict[str, Any] = { k: v for k, v in { + "config": config, "access_token": access_token, "refresh_token": refresh_token, "expires_at": expires_at, diff --git a/src/workos/pipes/models/__init__.py b/src/workos/pipes/models/__init__.py index f4d3be132..5574e41da 100644 --- a/src/workos/pipes/models/__init__.py +++ b/src/workos/pipes/models/__init__.py @@ -29,9 +29,6 @@ DataIntegrationsListResponseDataConnectedAccountWarning as DataIntegrationsListResponseDataConnectedAccountWarning, ) -from .add_data_integrations_get_data_integration_authorize_url_request_connection_owner_literal import ( - AddDataIntegrationsGetDataIntegrationAuthorizeUrlRequestConnectionOwnerLiteral as AddDataIntegrationsGetDataIntegrationAuthorizeUrlRequestConnectionOwnerLiteral, -) from .api_key_installation import ApiKeyInstallation as ApiKeyInstallation from .connected_account_input import ConnectedAccountInput as ConnectedAccountInput from .create_connected_account import CreateConnectedAccount as CreateConnectedAccount diff --git a/src/workos/pipes/models/connected_account_input.py b/src/workos/pipes/models/connected_account_input.py index 7312b16fe..6688b516a 100644 --- a/src/workos/pipes/models/connected_account_input.py +++ b/src/workos/pipes/models/connected_account_input.py @@ -21,6 +21,8 @@ class ConnectedAccountInput: """A mutable, non-unique connection label; null clears it. Not an account identifier.""" account_identifier: str | None = None """A developer-attested account identifier; null clears it.""" + config: dict[str, str] | None = None + """Installation-scoped provider configuration for this connection, such as Salesforce salesforce_host. Imports apply supplied values over installation-scoped integration pins and inherit other config from the credential source. Credential-bearing imports must satisfy required configuration even when config is omitted or {}. On update, a supplied object replaces installation-scoped values; omitted config preserves the stored snapshot. Stored integration-scoped values remain bound to the OAuth client and cannot be overridden or replaced with current integration pins. Replacements must satisfy required configuration; {} and empty-string values clear installation-scoped values only when the result is valid. Provider defaults count toward completeness but are resolved at read time, not stored. Only tokenless needs_reauthorization placeholders may remain incomplete; attaching their first tokens validates configuration even when config is omitted. Unrelated updates do not revalidate unchanged configuration. Clearing salesforce_host falls back to login.salesforce.com, which may not work for sandbox or My Domain-only connections.""" access_token: str | None = None """The OAuth access token for the connected account.""" refresh_token: str | None = None @@ -39,6 +41,7 @@ def from_dict(cls, data: dict[str, Any]) -> ConnectedAccountInput: return cls( account_display_name=data.get("account_display_name"), account_identifier=data.get("account_identifier"), + config=data.get("config"), access_token=data.get("access_token"), refresh_token=data.get("refresh_token"), expires_at=_parse_datetime(_v_expires_at) @@ -63,6 +66,8 @@ def to_dict(self) -> dict[str, Any]: result["account_identifier"] = self.account_identifier else: result["account_identifier"] = None + if self.config is not None: + result["config"] = self.config if self.access_token is not None: result["access_token"] = self.access_token if self.refresh_token is not None: diff --git a/src/workos/pipes/models/create_connected_account.py b/src/workos/pipes/models/create_connected_account.py index 4fa63904e..57968bbc7 100644 --- a/src/workos/pipes/models/create_connected_account.py +++ b/src/workos/pipes/models/create_connected_account.py @@ -21,6 +21,8 @@ class CreateConnectedAccount: """A mutable, non-unique connection label; null clears it. Not an account identifier.""" account_identifier: str | None = None """A developer-attested account identifier; null clears it.""" + config: dict[str, str] | None = None + """Installation-scoped provider configuration for this connection, such as Salesforce salesforce_host. Imports apply supplied values over installation-scoped integration pins and inherit other config from the credential source. Credential-bearing imports must satisfy required configuration even when config is omitted or {}. On update, a supplied object replaces installation-scoped values; omitted config preserves the stored snapshot. Stored integration-scoped values remain bound to the OAuth client and cannot be overridden or replaced with current integration pins. Replacements must satisfy required configuration; {} and empty-string values clear installation-scoped values only when the result is valid. Provider defaults count toward completeness but are resolved at read time, not stored. Only tokenless needs_reauthorization placeholders may remain incomplete; attaching their first tokens validates configuration even when config is omitted. Unrelated updates do not revalidate unchanged configuration. Clearing salesforce_host falls back to login.salesforce.com, which may not work for sandbox or My Domain-only connections.""" access_token: str | None = None """The OAuth access token for the connected account.""" refresh_token: str | None = None @@ -31,6 +33,8 @@ class CreateConnectedAccount: """The OAuth scopes granted for this connection.""" state: CreateConnectedAccountState | None = None """Explicitly set the state of the connected account. When omitted, the state is derived from the token combination provided.""" + metadata: dict[str, Any] | None = None + """Provider token-response metadata to preserve during import, such as Salesforce instance_url. Only allowlisted, non-sensitive scalar fields from this provider are accepted, including nested fields. Provider refresh responses can update these values. Not accepted on update.""" connection_intent: Literal["add"] | None = None """Set to `add` to create another connected account. Omit this field for permanent compatibility behavior.""" @@ -41,6 +45,7 @@ def from_dict(cls, data: dict[str, Any]) -> CreateConnectedAccount: return cls( account_display_name=data.get("account_display_name"), account_identifier=data.get("account_identifier"), + config=data.get("config"), access_token=data.get("access_token"), refresh_token=data.get("refresh_token"), expires_at=_parse_datetime(_v_expires_at) @@ -50,6 +55,7 @@ def from_dict(cls, data: dict[str, Any]) -> CreateConnectedAccount: state=CreateConnectedAccountState(_v_state) if (_v_state := data.get("state")) is not None else None, + metadata=data.get("metadata"), connection_intent=data.get("connection_intent"), ) except (KeyError, ValueError) as e: @@ -66,6 +72,8 @@ def to_dict(self) -> dict[str, Any]: result["account_identifier"] = self.account_identifier else: result["account_identifier"] = None + if self.config is not None: + result["config"] = self.config if self.access_token is not None: result["access_token"] = self.access_token if self.refresh_token is not None: @@ -78,6 +86,8 @@ def to_dict(self) -> dict[str, Any]: result["state"] = ( self.state.value if isinstance(self.state, Enum) else self.state ) + if self.metadata is not None: + result["metadata"] = self.metadata if self.connection_intent is not None: result["connection_intent"] = self.connection_intent return result diff --git a/src/workos/pipes/models/create_organization_connected_account.py b/src/workos/pipes/models/create_organization_connected_account.py index 0321c0adf..a881e167a 100644 --- a/src/workos/pipes/models/create_organization_connected_account.py +++ b/src/workos/pipes/models/create_organization_connected_account.py @@ -23,6 +23,8 @@ class CreateOrganizationConnectedAccount: """A mutable, non-unique connection label; null clears it. Not an account identifier.""" account_identifier: str | None = None """A developer-attested account identifier; null clears it.""" + config: dict[str, str] | None = None + """Installation-scoped provider configuration for this connection, such as Salesforce salesforce_host. Imports apply supplied values over installation-scoped integration pins and inherit other config from the credential source. Credential-bearing imports must satisfy required configuration even when config is omitted or {}. On update, a supplied object replaces installation-scoped values; omitted config preserves the stored snapshot. Stored integration-scoped values remain bound to the OAuth client and cannot be overridden or replaced with current integration pins. Replacements must satisfy required configuration; {} and empty-string values clear installation-scoped values only when the result is valid. Provider defaults count toward completeness but are resolved at read time, not stored. Only tokenless needs_reauthorization placeholders may remain incomplete; attaching their first tokens validates configuration even when config is omitted. Unrelated updates do not revalidate unchanged configuration. Clearing salesforce_host falls back to login.salesforce.com, which may not work for sandbox or My Domain-only connections.""" access_token: str | None = None """The OAuth access token for the connected account.""" refresh_token: str | None = None @@ -33,6 +35,8 @@ class CreateOrganizationConnectedAccount: """The OAuth scopes granted for this connection.""" state: CreateOrganizationConnectedAccountState | None = None """Explicitly set the state of the connected account. When omitted, the state is derived from the token combination provided.""" + metadata: dict[str, Any] | None = None + """Provider token-response metadata to preserve during import, such as Salesforce instance_url. Only allowlisted, non-sensitive scalar fields from this provider are accepted, including nested fields. Provider refresh responses can update these values. Not accepted on update.""" connection_intent: Literal["add"] | None = None """Set to `add` to create another connected account. Omit this field for permanent compatibility behavior.""" @@ -44,6 +48,7 @@ def from_dict(cls, data: dict[str, Any]) -> CreateOrganizationConnectedAccount: user_id=data["user_id"], account_display_name=data.get("account_display_name"), account_identifier=data.get("account_identifier"), + config=data.get("config"), access_token=data.get("access_token"), refresh_token=data.get("refresh_token"), expires_at=_parse_datetime(_v_expires_at) @@ -53,6 +58,7 @@ def from_dict(cls, data: dict[str, Any]) -> CreateOrganizationConnectedAccount: state=CreateOrganizationConnectedAccountState(_v_state) if (_v_state := data.get("state")) is not None else None, + metadata=data.get("metadata"), connection_intent=data.get("connection_intent"), ) except (KeyError, ValueError) as e: @@ -70,6 +76,8 @@ def to_dict(self) -> dict[str, Any]: result["account_identifier"] = self.account_identifier else: result["account_identifier"] = None + if self.config is not None: + result["config"] = self.config if self.access_token is not None: result["access_token"] = self.access_token if self.refresh_token is not None: @@ -82,6 +90,8 @@ def to_dict(self) -> dict[str, Any]: result["state"] = ( self.state.value if isinstance(self.state, Enum) else self.state ) + if self.metadata is not None: + result["metadata"] = self.metadata if self.connection_intent is not None: result["connection_intent"] = self.connection_intent return result diff --git a/src/workos/pipes/models/data_integration_access_token_response.py b/src/workos/pipes/models/data_integration_access_token_response.py index 03f2a1968..04bcb94df 100644 --- a/src/workos/pipes/models/data_integration_access_token_response.py +++ b/src/workos/pipes/models/data_integration_access_token_response.py @@ -19,7 +19,7 @@ class DataIntegrationAccessTokenResponse: """Data Integration Access Token Response model.""" - active: Literal[True] | None = None + active: Literal[True, False] | None = None """Indicates whether the access token is valid and ready for use, or if reauthorization is required.""" access_token: DataIntegrationAccessTokenResponseAccessToken | None = None """The [access token](https://workos.com/docs/reference/pipes/access-token) object, present when `active` is `true`.""" diff --git a/src/workos/pipes/models/data_integration_credentials_response.py b/src/workos/pipes/models/data_integration_credentials_response.py index 553384506..a6698a662 100644 --- a/src/workos/pipes/models/data_integration_credentials_response.py +++ b/src/workos/pipes/models/data_integration_credentials_response.py @@ -20,8 +20,7 @@ class DataIntegrationCredentialsResponse: """Data Integration Credentials Response model.""" - active: Literal[True] | None = None - """Indicates credentials are available.""" + active: Literal[True, False] | None = None credential: DataIntegrationVendedCredentialVariant | None = None """The credential object containing the vended secret.""" error: DataIntegrationCredentialsResponseError | None = None diff --git a/src/workos/pipes/models/organization_connected_account.py b/src/workos/pipes/models/organization_connected_account.py index 2adce19dc..65917d4c5 100644 --- a/src/workos/pipes/models/organization_connected_account.py +++ b/src/workos/pipes/models/organization_connected_account.py @@ -23,6 +23,8 @@ class OrganizationConnectedAccount: """A mutable, non-unique connection label; null clears it. Not an account identifier.""" account_identifier: str | None = None """A developer-attested account identifier; null clears it.""" + config: dict[str, str] | None = None + """Installation-scoped provider configuration for this connection, such as Salesforce salesforce_host. Imports apply supplied values over installation-scoped integration pins and inherit other config from the credential source. Credential-bearing imports must satisfy required configuration even when config is omitted or {}. On update, a supplied object replaces installation-scoped values; omitted config preserves the stored snapshot. Stored integration-scoped values remain bound to the OAuth client and cannot be overridden or replaced with current integration pins. Replacements must satisfy required configuration; {} and empty-string values clear installation-scoped values only when the result is valid. Provider defaults count toward completeness but are resolved at read time, not stored. Only tokenless needs_reauthorization placeholders may remain incomplete; attaching their first tokens validates configuration even when config is omitted. Unrelated updates do not revalidate unchanged configuration. Clearing salesforce_host falls back to login.salesforce.com, which may not work for sandbox or My Domain-only connections.""" access_token: str | None = None """The OAuth access token for the connected account.""" refresh_token: str | None = None @@ -42,6 +44,7 @@ def from_dict(cls, data: dict[str, Any]) -> OrganizationConnectedAccount: user_id=data["user_id"], account_display_name=data.get("account_display_name"), account_identifier=data.get("account_identifier"), + config=data.get("config"), access_token=data.get("access_token"), refresh_token=data.get("refresh_token"), expires_at=_parse_datetime(_v_expires_at) @@ -67,6 +70,8 @@ def to_dict(self) -> dict[str, Any]: result["account_identifier"] = self.account_identifier else: result["account_identifier"] = None + if self.config is not None: + result["config"] = self.config if self.access_token is not None: result["access_token"] = self.access_token if self.refresh_token is not None: diff --git a/src/workos/pipes_provider/_resource.py b/src/workos/pipes_provider/_resource.py index 55d2e09b0..ae30e3b2a 100644 --- a/src/workos/pipes_provider/_resource.py +++ b/src/workos/pipes_provider/_resource.py @@ -7,10 +7,11 @@ if TYPE_CHECKING: from .._client import AsyncWorkOSClient, WorkOSClient -from .._types import NOT_GIVEN, NotGiven, RequestOptions +from .._types import NOT_GIVEN, NotGiven, RequestOptions, enum_value from .models import ( DataIntegrationConfigurationListResponse, DataIntegrationConfigurationResponse, + PipesProviderOwnership, ) @@ -24,6 +25,7 @@ def list_organization_data_integration_configurations( self, organization_id: str, *, + ownership: PipesProviderOwnership | str | None = None, request_options: RequestOptions | None = None, ) -> DataIntegrationConfigurationListResponse: """List providers for an organization @@ -32,6 +34,7 @@ def list_organization_data_integration_configurations( Args: organization_id: An [Organization](https://workos.com/docs/reference/organization) identifier to list provider configurations for. + ownership: Select the provider configuration for `user` connections or `organization` shared connections. Defaults to `user`; never falls back to the other ownership. Defaults to `user`. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: @@ -40,9 +43,17 @@ def list_organization_data_integration_configurations( Raises: AuthenticationError: If the API key is invalid (401). NotFoundError: If the resource is not found (404). + UnprocessableEntityError: If the request data is unprocessable (422). RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ + params: dict[str, Any] = { + k: v + for k, v in { + "ownership": enum_value(ownership) if ownership is not None else None, + }.items() + if v is not None + } return self._client.request( method="get", path=( @@ -50,6 +61,7 @@ def list_organization_data_integration_configurations( str(organization_id), "data_integration_configurations", ), + params=params, model=DataIntegrationConfigurationListResponse, request_options=request_options, ) @@ -64,6 +76,7 @@ def update_organization_data_integration_configuration( client_id: str | None = None, client_secret: str | None = None, config: dict[str, str] | None = None, + ownership: PipesProviderOwnership | str | None = None, request_options: RequestOptions | None = None, ) -> DataIntegrationConfigurationResponse: """Configure a provider for an organization @@ -78,6 +91,7 @@ def update_organization_data_integration_configuration( client_id: The OAuth client ID of the organization's own application. Must be provided together with `client_secret`, and only for providers whose credentials are supplied by the organization. client_secret: The OAuth client secret of the organization's own application. Must be provided together with `client_id`. config: Provider-specific config values to set for the organization, keyed by config field. Only fields the provider declares are accepted, and each value must match that field's pattern. Accepted only for providers whose credentials are organization-managed; for shared or custom credential providers, config belongs on the integration itself (via the data-integrations API) and supplying it here is rejected. + ownership: Select the provider configuration for `user` connections or `organization` shared connections. Defaults to `user`; never falls back to the other ownership. Defaults to `user`. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: @@ -103,6 +117,13 @@ def update_organization_data_integration_configuration( } if not isinstance(scopes, NotGiven): body["scopes"] = scopes + params: dict[str, Any] = { + k: v + for k, v in { + "ownership": enum_value(ownership) if ownership is not None else None, + }.items() + if v is not None + } return self._client.request( method="put", path=( @@ -112,6 +133,7 @@ def update_organization_data_integration_configuration( str(slug), ), body=body, + params=params, model=DataIntegrationConfigurationResponse, request_options=request_options, ) @@ -127,6 +149,7 @@ async def list_organization_data_integration_configurations( self, organization_id: str, *, + ownership: PipesProviderOwnership | str | None = None, request_options: RequestOptions | None = None, ) -> DataIntegrationConfigurationListResponse: """List providers for an organization @@ -135,6 +158,7 @@ async def list_organization_data_integration_configurations( Args: organization_id: An [Organization](https://workos.com/docs/reference/organization) identifier to list provider configurations for. + ownership: Select the provider configuration for `user` connections or `organization` shared connections. Defaults to `user`; never falls back to the other ownership. Defaults to `user`. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: @@ -143,9 +167,17 @@ async def list_organization_data_integration_configurations( Raises: AuthenticationError: If the API key is invalid (401). NotFoundError: If the resource is not found (404). + UnprocessableEntityError: If the request data is unprocessable (422). RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ + params: dict[str, Any] = { + k: v + for k, v in { + "ownership": enum_value(ownership) if ownership is not None else None, + }.items() + if v is not None + } return await self._client.request( method="get", path=( @@ -153,6 +185,7 @@ async def list_organization_data_integration_configurations( str(organization_id), "data_integration_configurations", ), + params=params, model=DataIntegrationConfigurationListResponse, request_options=request_options, ) @@ -167,6 +200,7 @@ async def update_organization_data_integration_configuration( client_id: str | None = None, client_secret: str | None = None, config: dict[str, str] | None = None, + ownership: PipesProviderOwnership | str | None = None, request_options: RequestOptions | None = None, ) -> DataIntegrationConfigurationResponse: """Configure a provider for an organization @@ -181,6 +215,7 @@ async def update_organization_data_integration_configuration( client_id: The OAuth client ID of the organization's own application. Must be provided together with `client_secret`, and only for providers whose credentials are supplied by the organization. client_secret: The OAuth client secret of the organization's own application. Must be provided together with `client_id`. config: Provider-specific config values to set for the organization, keyed by config field. Only fields the provider declares are accepted, and each value must match that field's pattern. Accepted only for providers whose credentials are organization-managed; for shared or custom credential providers, config belongs on the integration itself (via the data-integrations API) and supplying it here is rejected. + ownership: Select the provider configuration for `user` connections or `organization` shared connections. Defaults to `user`; never falls back to the other ownership. Defaults to `user`. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: @@ -206,6 +241,13 @@ async def update_organization_data_integration_configuration( } if not isinstance(scopes, NotGiven): body["scopes"] = scopes + params: dict[str, Any] = { + k: v + for k, v in { + "ownership": enum_value(ownership) if ownership is not None else None, + }.items() + if v is not None + } return await self._client.request( method="put", path=( @@ -215,6 +257,7 @@ async def update_organization_data_integration_configuration( str(slug), ), body=body, + params=params, model=DataIntegrationConfigurationResponse, request_options=request_options, ) diff --git a/src/workos/pipes_provider/models/__init__.py b/src/workos/pipes_provider/models/__init__.py index 4b40798ff..466c87dfd 100644 --- a/src/workos/pipes_provider/models/__init__.py +++ b/src/workos/pipes_provider/models/__init__.py @@ -12,3 +12,7 @@ from .data_integration_credentials import ( DataIntegrationCredentials as DataIntegrationCredentials, ) +from .pipes_provider_ownership import PipesProviderOwnership as PipesProviderOwnership +from .pipes_provider_ownership import ( + PipesProviderOwnershipLiteral as PipesProviderOwnershipLiteral, +) diff --git a/src/workos/pipes_provider/models/pipes_provider_ownership.py b/src/workos/pipes_provider/models/pipes_provider_ownership.py new file mode 100644 index 000000000..3509f7423 --- /dev/null +++ b/src/workos/pipes_provider/models/pipes_provider_ownership.py @@ -0,0 +1,22 @@ +# This file is auto-generated by oagen. Do not edit. + +from typing import TYPE_CHECKING, Literal, TypeAlias + +if TYPE_CHECKING: + from workos.common.models.create_data_integration_ownership import ( + CreateDataIntegrationOwnership as PipesProviderOwnership, + ) +else: + + def __getattr__(name: str): + if name == "PipesProviderOwnership": + from workos.common.models.create_data_integration_ownership import ( + CreateDataIntegrationOwnership, + ) + + return CreateDataIntegrationOwnership + raise AttributeError(f"module {__name__!r} has no attribute {name!r}") + + +PipesProviderOwnershipLiteral: TypeAlias = Literal["user", "organization"] +__all__ = ["PipesProviderOwnership", "PipesProviderOwnershipLiteral"] diff --git a/tests/fixtures/connected_account_input.json b/tests/fixtures/connected_account_input.json index 0a1814417..371fc9454 100644 --- a/tests/fixtures/connected_account_input.json +++ b/tests/fixtures/connected_account_input.json @@ -1,6 +1,7 @@ { "account_display_name": "Acme production", "account_identifier": "workspace_123", + "config": {}, "access_token": "gho_16C7e42F292c6912E7710c838347Ae178B4a", "refresh_token": "ghr_xxxxxxxxxxxxxxxxxxxx", "expires_at": "2025-12-31T23:59:59.000Z", diff --git a/tests/fixtures/create_connected_account.json b/tests/fixtures/create_connected_account.json index 58d0459bb..ab11edc11 100644 --- a/tests/fixtures/create_connected_account.json +++ b/tests/fixtures/create_connected_account.json @@ -1,6 +1,7 @@ { "account_display_name": "Acme production", "account_identifier": "workspace_123", + "config": {}, "access_token": "gho_16C7e42F292c6912E7710c838347Ae178B4a", "refresh_token": "ghr_xxxxxxxxxxxxxxxxxxxx", "expires_at": "2025-12-31T23:59:59.000Z", @@ -9,5 +10,6 @@ "user:email" ], "state": "connected", + "metadata": {}, "connection_intent": "add" } diff --git a/tests/fixtures/create_organization_connected_account.json b/tests/fixtures/create_organization_connected_account.json index c7c70483c..511d7a54e 100644 --- a/tests/fixtures/create_organization_connected_account.json +++ b/tests/fixtures/create_organization_connected_account.json @@ -1,6 +1,7 @@ { "account_display_name": "Acme production", "account_identifier": "workspace_123", + "config": {}, "access_token": "gho_16C7e42F292c6912E7710c838347Ae178B4a", "refresh_token": "ghr_xxxxxxxxxxxxxxxxxxxx", "expires_at": "2025-12-31T23:59:59.000Z", @@ -10,5 +11,6 @@ ], "state": "connected", "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", + "metadata": {}, "connection_intent": "add" } diff --git a/tests/fixtures/organization_connected_account.json b/tests/fixtures/organization_connected_account.json index 698788840..1dc8d6047 100644 --- a/tests/fixtures/organization_connected_account.json +++ b/tests/fixtures/organization_connected_account.json @@ -1,6 +1,7 @@ { "account_display_name": "Acme production", "account_identifier": "workspace_123", + "config": {}, "access_token": "gho_16C7e42F292c6912E7710c838347Ae178B4a", "refresh_token": "ghr_xxxxxxxxxxxxxxxxxxxx", "expires_at": "2025-12-31T23:59:59.000Z", diff --git a/tests/test_pipes_provider.py b/tests/test_pipes_provider.py index 63de2bdca..f6fb62d71 100644 --- a/tests/test_pipes_provider.py +++ b/tests/test_pipes_provider.py @@ -16,6 +16,7 @@ from workos.pipes_provider.models import ( DataIntegrationConfigurationListResponse, DataIntegrationConfigurationResponse, + PipesProviderOwnership, ) @@ -39,6 +40,18 @@ def test_list_organization_data_integration_configurations( "/organizations/test_organizationId/data_integration_configurations" ) + def test_list_organization_data_integration_configurations_encodes_query_params( + self, workos, httpx_mock + ): + httpx_mock.add_response( + json=load_fixture("data_integration_configuration_list_response.json") + ) + workos.pipes_provider.list_organization_data_integration_configurations( + "test_organizationId", ownership=PipesProviderOwnership("user") + ) + request = httpx_mock.get_request() + assert request.url.params["ownership"] == "user" + def test_update_organization_data_integration_configuration( self, workos, httpx_mock ): @@ -59,6 +72,18 @@ def test_update_organization_data_integration_configuration( "/organizations/test_organizationId/data_integration_configurations/test_slug" ) + def test_update_organization_data_integration_configuration_encodes_query_params( + self, workos, httpx_mock + ): + httpx_mock.add_response( + json=load_fixture("data_integration_configuration_response.json") + ) + workos.pipes_provider.update_organization_data_integration_configuration( + "test_organizationId", "test_slug", ownership=PipesProviderOwnership("user") + ) + request = httpx_mock.get_request() + assert request.url.params["ownership"] == "user" + def test_list_organization_data_integration_configurations_with_request_options( self, workos, httpx_mock ): @@ -183,6 +208,19 @@ async def test_list_organization_data_integration_configurations( "/organizations/test_organizationId/data_integration_configurations" ) + @pytest.mark.asyncio + async def test_list_organization_data_integration_configurations_encodes_query_params( + self, async_workos, httpx_mock + ): + httpx_mock.add_response( + json=load_fixture("data_integration_configuration_list_response.json") + ) + await async_workos.pipes_provider.list_organization_data_integration_configurations( + "test_organizationId", ownership=PipesProviderOwnership("user") + ) + request = httpx_mock.get_request() + assert request.url.params["ownership"] == "user" + @pytest.mark.asyncio async def test_update_organization_data_integration_configuration( self, async_workos, httpx_mock @@ -202,6 +240,19 @@ async def test_update_organization_data_integration_configuration( "/organizations/test_organizationId/data_integration_configurations/test_slug" ) + @pytest.mark.asyncio + async def test_update_organization_data_integration_configuration_encodes_query_params( + self, async_workos, httpx_mock + ): + httpx_mock.add_response( + json=load_fixture("data_integration_configuration_response.json") + ) + await async_workos.pipes_provider.update_organization_data_integration_configuration( + "test_organizationId", "test_slug", ownership=PipesProviderOwnership("user") + ) + request = httpx_mock.get_request() + assert request.url.params["ownership"] == "user" + @pytest.mark.asyncio async def test_list_organization_data_integration_configurations_with_request_options( self, async_workos, httpx_mock From 4eec105a1cfbfe33a164bc5c038c6aab82c0d4ee Mon Sep 17 00:00:00 2001 From: "workos-sdk-automation[bot]" <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Date: Fri, 13 Nov 2026 20:15:22 +0000 Subject: [PATCH 2/3] chore(generated): regenerate shared files for AdminPortal, Agents, ApiKeys, AuditLogs, Authorization, ClientApi, Connect, DirectorySync, Events, FeatureFlags, Groups, MultiFactorAuth, OrganizationDomains, OrganizationMembership, Organizations, Pipes, PipesProvider, PlatformTeams, Radar, SSO, UserManagement, Vault, Webhooks, Widgets --- .last-synced-sha | 2 +- .oagen-manifest.json | 40 +- src/workos/audit_logs/_resource.py | 8 +- .../models/audit_log_export_creation.py | 4 +- src/workos/client_api/_resource.py | 16 +- .../client_api/models/client_api_token.py | 4 +- .../models/client_api_token_response.py | 2 +- src/workos/common/__init__.py | 8 +- src/workos/common/models/__init__.py | 10 +- ..._admin_validate_credential_request_type.py | 2 + ...lueprints_token_mint_token_request_type.py | 4 + ...agent_registration_claim_completed_data.py | 5 + ...on_email_verification_failed_data_error.py | 5 + ...authentication_radar_risk_detected_data.py | 5 + src/workos/common/models/error_body_code.py | 2 - .../common/models/error_body_with_code.py | 37 +- .../common/models/policy_denied_error_body.py | 5 + ...or_body_with_connection_ids_list_email.py} | 9 +- src/workos/directory_sync/_resource.py | 411 +++++++++++++++++- src/workos/directory_sync/models/__init__.py | 4 + .../models/directory_user_with_groups.py | 2 +- ...ze_url_request_connection_owner_literal.py | 26 -- .../agent_registration_claim_completed.json | 1 + ...ent_registration_claim_completed_data.json | 1 + tests/fixtures/audit_log_export_creation.json | 2 +- ...hentication_email_verification_failed.json | 3 +- ...cation_email_verification_failed_data.json | 3 +- ..._email_verification_failed_data_error.json | 3 +- .../authentication_magic_auth_failed.json | 3 +- ...authentication_magic_auth_failed_data.json | 3 +- ...tication_magic_auth_failed_data_error.json | 3 +- tests/fixtures/authentication_mfa_failed.json | 3 +- .../authentication_mfa_failed_data.json | 3 +- .../authentication_mfa_failed_data_error.json | 3 +- .../fixtures/authentication_oauth_failed.json | 3 +- .../authentication_oauth_failed_data.json | 3 +- ...uthentication_oauth_failed_data_error.json | 3 +- .../authentication_passkey_failed.json | 3 +- .../authentication_passkey_failed_data.json | 3 +- ...hentication_passkey_failed_data_error.json | 3 +- .../authentication_password_failed.json | 3 +- .../authentication_password_failed_data.json | 3 +- ...entication_password_failed_data_error.json | 3 +- .../authentication_radar_risk_detected.json | 3 +- ...thentication_radar_risk_detected_data.json | 3 +- tests/fixtures/authentication_sso_failed.json | 3 +- .../authentication_sso_failed_data.json | 3 +- .../authentication_sso_failed_data_error.json | 3 +- .../authentication_sso_timed_out.json | 3 +- .../authentication_sso_timed_out_data.json | 3 +- ...thentication_sso_timed_out_data_error.json | 3 +- tests/fixtures/list_directory_user.json | 46 ++ tests/fixtures/policy_denied_error_body.json | 3 +- ...r_body_with_connection_ids_list_email.json | 9 + tests/test_common_models_round_trip.py | 393 +++++++++-------- tests/test_directory_sync.py | 214 ++++++++- .../test_directory_sync_models_round_trip.py | 169 +++++++ 57 files changed, 1220 insertions(+), 307 deletions(-) rename src/workos/common/models/{sso_required_oauth_error_body_with_connection_ids_list_email_pending_authentication_token.py => sso_required_oauth_error_body_with_connection_ids_list_email.py} (87%) delete mode 100644 src/workos/pipes/models/add_data_integrations_get_data_integration_authorize_url_request_connection_owner_literal.py create mode 100644 tests/fixtures/list_directory_user.json create mode 100644 tests/fixtures/sso_required_oauth_error_body_with_connection_ids_list_email.json diff --git a/.last-synced-sha b/.last-synced-sha index 9d939a0b7..64a7b26d3 100644 --- a/.last-synced-sha +++ b/.last-synced-sha @@ -1 +1 @@ -2029e6d3b84733c408b209a314e20fd748e3d970 +cd2274094c76488d1aef6d661898b31138af5f3e diff --git a/.oagen-manifest.json b/.oagen-manifest.json index 4733b2f69..88d924527 100644 --- a/.oagen-manifest.json +++ b/.oagen-manifest.json @@ -351,6 +351,7 @@ "src/workos/common/models/data_integration_ownership.py", "src/workos/common/models/data_integration_state.py", "src/workos/common/models/data_integration_vended_credential.py", + "src/workos/common/models/data_integration_vended_credential_auth_method.py", "src/workos/common/models/data_integrations_create_api_key_connection_request_connection_owner.py", "src/workos/common/models/data_integrations_create_client_credentials_connection_request_connection_owner.py", "src/workos/common/models/data_integrations_get_data_integration_authorize_url_request_connection_intent.py", @@ -739,7 +740,7 @@ "src/workos/common/models/slow_down_oauth_error_body.py", "src/workos/common/models/sms_challenge_quota_reached_error_body.py", "src/workos/common/models/sms_challenge_rate_limited_error_body.py", - "src/workos/common/models/sso_required_oauth_error_body_with_connection_ids_list_email_pending_authentication_token.py", + "src/workos/common/models/sso_required_oauth_error_body_with_connection_ids_list_email.py", "src/workos/common/models/sub_resource_scoped_role_not_allowed_error_body_with_role_slug.py", "src/workos/common/models/team_production_state.py", "src/workos/common/models/token_query_grant_type.py", @@ -911,7 +912,6 @@ "src/workos/pipes/__init__.py", "src/workos/pipes/_resource.py", "src/workos/pipes/models/__init__.py", - "src/workos/pipes/models/add_data_integrations_get_data_integration_authorize_url_request_connection_owner_literal.py", "src/workos/pipes/models/api_key_installation.py", "src/workos/pipes/models/connected_account_input.py", "src/workos/pipes/models/create_connected_account.py", @@ -946,6 +946,7 @@ "src/workos/pipes_provider/models/data_integration_configuration_list_response.py", "src/workos/pipes_provider/models/data_integration_configuration_response.py", "src/workos/pipes_provider/models/data_integration_credentials.py", + "src/workos/pipes_provider/models/pipes_provider_ownership.py", "src/workos/platform_teams/__init__.py", "src/workos/platform_teams/_resource.py", "src/workos/platform_teams/models/__init__.py", @@ -1643,6 +1644,7 @@ "tests/fixtures/list_data_integration.json", "tests/fixtures/list_directory.json", "tests/fixtures/list_directory_group.json", + "tests/fixtures/list_directory_user.json", "tests/fixtures/list_directory_user_with_groups.json", "tests/fixtures/list_event_schema.json", "tests/fixtures/list_flag.json", @@ -1846,7 +1848,7 @@ "tests/fixtures/sso_device_authorization_request.json", "tests/fixtures/sso_logout_authorize_request.json", "tests/fixtures/sso_logout_authorize_response.json", - "tests/fixtures/sso_required_oauth_error_body_with_connection_ids_list_email_pending_authentication_token.json", + "tests/fixtures/sso_required_oauth_error_body_with_connection_ids_list_email.json", "tests/fixtures/sso_token_response.json", "tests/fixtures/sso_token_response_oauth_token.json", "tests/fixtures/sub_resource_scoped_role_not_allowed_error_body_with_role_slug.json", @@ -2449,20 +2451,20 @@ "sdkMethod": "create_directory_sync", "service": "directory_sync" }, - "GET /directory_groups": { - "sdkMethod": "list_groups", + "GET /directories/{directoryId}/groups": { + "sdkMethod": "list_directory_groups", "service": "directory_sync" }, - "GET /directory_groups/{id}": { - "sdkMethod": "get_group", + "GET /directories/{directoryId}/groups/{groupId}": { + "sdkMethod": "get_directory_group", "service": "directory_sync" }, - "GET /directory_users": { - "sdkMethod": "list_users", + "GET /directories/{directoryId}/users": { + "sdkMethod": "list_directory_users", "service": "directory_sync" }, - "GET /directory_users/{id}": { - "sdkMethod": "get_user", + "GET /directories/{directoryId}/users/{userId}": { + "sdkMethod": "get_directory_user", "service": "directory_sync" }, "GET /events": { @@ -3076,6 +3078,22 @@ "GET /audit_logs/exports/{auditLogExportId}": { "sdkMethod": "get_export", "service": "audit_logs" + }, + "GET /directory_groups": { + "sdkMethod": "list_groups", + "service": "directory_sync" + }, + "GET /directory_groups/{id}": { + "sdkMethod": "get_group", + "service": "directory_sync" + }, + "GET /directory_users": { + "sdkMethod": "list_users", + "service": "directory_sync" + }, + "GET /directory_users/{id}": { + "sdkMethod": "get_user", + "service": "directory_sync" } } } diff --git a/src/workos/audit_logs/_resource.py b/src/workos/audit_logs/_resource.py index c2a35239c..876a5abd7 100644 --- a/src/workos/audit_logs/_resource.py +++ b/src/workos/audit_logs/_resource.py @@ -327,8 +327,8 @@ def create_export( Args: organization_id: The unique ID of the Organization. - range_start: ISO-8601 value for start of the export range. - range_end: ISO-8601 value for end of the export range. + range_start: ISO-8601 value for start of the export range. The range must span no more than 31 days. + range_end: ISO-8601 value for end of the export range. Must be no more than 31 days after the start. actions: List of actions to filter against. actors: (deprecated) Deprecated. Use `actor_names` instead. actor_names: List of actor names to filter against. @@ -682,8 +682,8 @@ async def create_export( Args: organization_id: The unique ID of the Organization. - range_start: ISO-8601 value for start of the export range. - range_end: ISO-8601 value for end of the export range. + range_start: ISO-8601 value for start of the export range. The range must span no more than 31 days. + range_end: ISO-8601 value for end of the export range. Must be no more than 31 days after the start. actions: List of actions to filter against. actors: (deprecated) Deprecated. Use `actor_names` instead. actor_names: List of actor names to filter against. diff --git a/src/workos/audit_logs/models/audit_log_export_creation.py b/src/workos/audit_logs/models/audit_log_export_creation.py index ce381f4a1..9bb7f4aab 100644 --- a/src/workos/audit_logs/models/audit_log_export_creation.py +++ b/src/workos/audit_logs/models/audit_log_export_creation.py @@ -16,9 +16,9 @@ class AuditLogExportCreation: organization_id: str """The unique ID of the Organization.""" range_start: datetime - """ISO-8601 value for start of the export range.""" + """ISO-8601 value for start of the export range. The range must span no more than 31 days.""" range_end: datetime - """ISO-8601 value for end of the export range.""" + """ISO-8601 value for end of the export range. Must be no more than 31 days after the start.""" actions: list[str] | None = None """List of actions to filter against.""" actors: list[str] | None = None diff --git a/src/workos/client_api/_resource.py b/src/workos/client_api/_resource.py index ccce09ce8..d084a9fbf 100644 --- a/src/workos/client_api/_resource.py +++ b/src/workos/client_api/_resource.py @@ -24,13 +24,13 @@ def create_token( user_id: str, request_options: RequestOptions | None = None, ) -> ClientApiTokenResponse: - """Generate a Client API token + """Generate a Widgets API token - Generate a short-lived, session-bound token for the Client GraphQL API, scoped to an organization and user. + Generate a short-lived, session-bound token for the Widgets API, scoped to an organization and user. Args: - organization_id: The ID of the organization to scope the Client API token to. - user_id: The ID of the user to issue the Client API token for. + organization_id: The ID of the organization to scope the Widgets API token to. + user_id: The ID of the user to issue the Widgets API token for. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: @@ -70,13 +70,13 @@ async def create_token( user_id: str, request_options: RequestOptions | None = None, ) -> ClientApiTokenResponse: - """Generate a Client API token + """Generate a Widgets API token - Generate a short-lived, session-bound token for the Client GraphQL API, scoped to an organization and user. + Generate a short-lived, session-bound token for the Widgets API, scoped to an organization and user. Args: - organization_id: The ID of the organization to scope the Client API token to. - user_id: The ID of the user to issue the Client API token for. + organization_id: The ID of the organization to scope the Widgets API token to. + user_id: The ID of the user to issue the Widgets API token for. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: diff --git a/src/workos/client_api/models/client_api_token.py b/src/workos/client_api/models/client_api_token.py index cb8906cbb..12f48b5cd 100644 --- a/src/workos/client_api/models/client_api_token.py +++ b/src/workos/client_api/models/client_api_token.py @@ -13,9 +13,9 @@ class ClientApiToken: """Client Api Token model.""" organization_id: str - """The ID of the organization to scope the Client API token to.""" + """The ID of the organization to scope the Widgets API token to.""" user_id: str - """The ID of the user to issue the Client API token for.""" + """The ID of the user to issue the Widgets API token for.""" @classmethod def from_dict(cls, data: dict[str, Any]) -> ClientApiToken: diff --git a/src/workos/client_api/models/client_api_token_response.py b/src/workos/client_api/models/client_api_token_response.py index 6cc9c9d26..46b1572fd 100644 --- a/src/workos/client_api/models/client_api_token_response.py +++ b/src/workos/client_api/models/client_api_token_response.py @@ -13,7 +13,7 @@ class ClientApiTokenResponse: """Client Api Token Response model.""" token: str - """The Client API token.""" + """The Widgets API token.""" @classmethod def from_dict(cls, data: dict[str, Any]) -> ClientApiTokenResponse: diff --git a/src/workos/common/__init__.py b/src/workos/common/__init__.py index aa8ae9eb7..2ce907f1a 100644 --- a/src/workos/common/__init__.py +++ b/src/workos/common/__init__.py @@ -725,6 +725,12 @@ DataIntegrationsVendCredentialsRequestConnectionOwnerLiteral as DataIntegrationsVendCredentialsRequestConnectionOwnerLiteral, ) from .models import DataIntegrationVendedCredential as DataIntegrationVendedCredential +from .models import ( + DataIntegrationVendedCredentialAuthMethod as DataIntegrationVendedCredentialAuthMethod, +) +from .models import ( + DataIntegrationVendedCredentialAuthMethodLiteral as DataIntegrationVendedCredentialAuthMethodLiteral, +) from .models import ( DataIntegrationVendedCredentialUnknown as DataIntegrationVendedCredentialUnknown, ) @@ -1552,7 +1558,7 @@ ) from .models import SmsChallengeRateLimitedErrorBody as SmsChallengeRateLimitedErrorBody from .models import ( - SSORequiredOAuthErrorBodyWithConnectionIdsListEmailPendingAuthenticationToken as SSORequiredOAuthErrorBodyWithConnectionIdsListEmailPendingAuthenticationToken, + SSORequiredOAuthErrorBodyWithConnectionIdsListEmail as SSORequiredOAuthErrorBodyWithConnectionIdsListEmail, ) from .models import ( SubResourceScopedRoleNotAllowedErrorBodyWithRoleSlug as SubResourceScopedRoleNotAllowedErrorBodyWithRoleSlug, diff --git a/src/workos/common/models/__init__.py b/src/workos/common/models/__init__.py index 58491df39..39cbd9a09 100644 --- a/src/workos/common/models/__init__.py +++ b/src/workos/common/models/__init__.py @@ -869,6 +869,12 @@ from .data_integration_vended_credential import ( DataIntegrationVendedCredentialVariant as DataIntegrationVendedCredentialVariant, ) +from .data_integration_vended_credential_auth_method import ( + DataIntegrationVendedCredentialAuthMethod as DataIntegrationVendedCredentialAuthMethod, +) +from .data_integration_vended_credential_auth_method import ( + DataIntegrationVendedCredentialAuthMethodLiteral as DataIntegrationVendedCredentialAuthMethodLiteral, +) from .data_integrations_create_api_key_connection_request_connection_owner import ( DataIntegrationsCreateApiKeyConnectionRequestConnectionOwner as DataIntegrationsCreateApiKeyConnectionRequestConnectionOwner, ) @@ -2069,8 +2075,8 @@ from .sms_challenge_rate_limited_error_body import ( SmsChallengeRateLimitedErrorBody as SmsChallengeRateLimitedErrorBody, ) -from .sso_required_oauth_error_body_with_connection_ids_list_email_pending_authentication_token import ( - SSORequiredOAuthErrorBodyWithConnectionIdsListEmailPendingAuthenticationToken as SSORequiredOAuthErrorBodyWithConnectionIdsListEmailPendingAuthenticationToken, +from .sso_required_oauth_error_body_with_connection_ids_list_email import ( + SSORequiredOAuthErrorBodyWithConnectionIdsListEmail as SSORequiredOAuthErrorBodyWithConnectionIdsListEmail, ) from .sub_resource_scoped_role_not_allowed_error_body_with_role_slug import ( SubResourceScopedRoleNotAllowedErrorBodyWithRoleSlug as SubResourceScopedRoleNotAllowedErrorBodyWithRoleSlug, diff --git a/src/workos/common/models/agent_admin_validate_credential_request_type.py b/src/workos/common/models/agent_admin_validate_credential_request_type.py index 819b5c59c..17dc29092 100644 --- a/src/workos/common/models/agent_admin_validate_credential_request_type.py +++ b/src/workos/common/models/agent_admin_validate_credential_request_type.py @@ -12,7 +12,9 @@ class AgentAdminValidateCredentialRequestType(str, Enum): """Known values for AgentAdminValidateCredentialRequestType.""" API_KEY = "api_key" + """The kind of credential being validated — an agent API key or an agent access token.""" ACCESS_TOKEN = "access_token" + """The kind of credential being validated — an agent API key or an agent access token.""" @classmethod def _missing_(cls, value: object) -> AgentAdminValidateCredentialRequestType | None: diff --git a/src/workos/common/models/agent_blueprints_token_mint_token_request_type.py b/src/workos/common/models/agent_blueprints_token_mint_token_request_type.py index c22e5750c..d19dd1e3f 100644 --- a/src/workos/common/models/agent_blueprints_token_mint_token_request_type.py +++ b/src/workos/common/models/agent_blueprints_token_mint_token_request_type.py @@ -12,9 +12,13 @@ class AgentBlueprintsTokenMintTokenRequestType(str, Enum): """Known values for AgentBlueprintsTokenMintTokenRequestType.""" USER_DELEGATED = "user_delegated" + """How the session is minted: `user_delegated`, `autonomous`, `agent_delegated`, or `refresh`.""" AUTONOMOUS = "autonomous" + """How the session is minted: `user_delegated`, `autonomous`, `agent_delegated`, or `refresh`.""" AGENT_DELEGATED = "agent_delegated" + """How the session is minted: `user_delegated`, `autonomous`, `agent_delegated`, or `refresh`.""" REFRESH = "refresh" + """How the session is minted: `user_delegated`, `autonomous`, `agent_delegated`, or `refresh`.""" @classmethod def _missing_( diff --git a/src/workos/common/models/agent_registration_claim_completed_data.py b/src/workos/common/models/agent_registration_claim_completed_data.py index 2d45c7306..5fbffffbf 100644 --- a/src/workos/common/models/agent_registration_claim_completed_data.py +++ b/src/workos/common/models/agent_registration_claim_completed_data.py @@ -32,6 +32,8 @@ class AgentRegistrationClaimCompletedData: """The timestamp when the claim was created.""" updated_at: str """The timestamp when the claim was last updated.""" + organization_id: str | None = None + """The ID of the organization the registration belongs to.""" @classmethod def from_dict(cls, data: dict[str, Any]) -> AgentRegistrationClaimCompletedData: @@ -48,6 +50,7 @@ def from_dict(cls, data: dict[str, Any]) -> AgentRegistrationClaimCompletedData: completed_at=data["completed_at"], created_at=data["created_at"], updated_at=data["updated_at"], + organization_id=data.get("organization_id"), ) except (KeyError, ValueError) as e: _raise_deserialize_error("AgentRegistrationClaimCompletedData", e) @@ -63,4 +66,6 @@ def to_dict(self) -> dict[str, Any]: result["completed_at"] = self.completed_at result["created_at"] = self.created_at result["updated_at"] = self.updated_at + if self.organization_id is not None: + result["organization_id"] = self.organization_id return result diff --git a/src/workos/common/models/authentication_email_verification_failed_data_error.py b/src/workos/common/models/authentication_email_verification_failed_data_error.py index 8c7e7f8f8..76d1db3a9 100644 --- a/src/workos/common/models/authentication_email_verification_failed_data_error.py +++ b/src/workos/common/models/authentication_email_verification_failed_data_error.py @@ -16,6 +16,8 @@ class AuthenticationEmailVerificationFailedDataError: """The error code.""" message: str """A human-readable error message.""" + radar_detection_id: str | None = None + """The ID of the Radar detection that blocked the authentication. Only set on `policy_denied` errors.""" @classmethod def from_dict( @@ -26,6 +28,7 @@ def from_dict( return cls( code=data["code"], message=data["message"], + radar_detection_id=data.get("radar_detection_id"), ) except (KeyError, ValueError) as e: _raise_deserialize_error( @@ -37,4 +40,6 @@ def to_dict(self) -> dict[str, Any]: result: dict[str, Any] = {} result["code"] = self.code result["message"] = self.message + if self.radar_detection_id is not None: + result["radar_detection_id"] = self.radar_detection_id return result diff --git a/src/workos/common/models/authentication_radar_risk_detected_data.py b/src/workos/common/models/authentication_radar_risk_detected_data.py index a8eaf151f..97c505fa1 100644 --- a/src/workos/common/models/authentication_radar_risk_detected_data.py +++ b/src/workos/common/models/authentication_radar_risk_detected_data.py @@ -32,6 +32,8 @@ class AuthenticationRadarRiskDetectedData: """The ID of the user.""" email: str """The email address of the user.""" + radar_detection_id: str | None = None + """The ID of the Radar detection that challenged the authentication.""" @classmethod def from_dict(cls, data: dict[str, Any]) -> AuthenticationRadarRiskDetectedData: @@ -46,6 +48,7 @@ def from_dict(cls, data: dict[str, Any]) -> AuthenticationRadarRiskDetectedData: user_agent=data["user_agent"], user_id=data["user_id"], email=data["email"], + radar_detection_id=data.get("radar_detection_id"), ) except (KeyError, ValueError) as e: _raise_deserialize_error("AuthenticationRadarRiskDetectedData", e) @@ -75,4 +78,6 @@ def to_dict(self) -> dict[str, Any]: result["user_agent"] = None result["user_id"] = self.user_id result["email"] = self.email + if self.radar_detection_id is not None: + result["radar_detection_id"] = self.radar_detection_id return result diff --git a/src/workos/common/models/error_body_code.py b/src/workos/common/models/error_body_code.py index 2b38b69ff..a02fb5cab 100644 --- a/src/workos/common/models/error_body_code.py +++ b/src/workos/common/models/error_body_code.py @@ -163,7 +163,6 @@ class ErrorBodyCode(str, Enum): PERMISSION_NOT_FOUND = "permission_not_found" PERMISSION_SLUG_CONFLICT = "permission_slug_conflict" PHONE_NUMBER_REQUIRED = "phone_number_required" - POLICY_DENIED = "policy_denied" PRODUCTION_FEATURE_REQUIRES_BILLING = "production_feature_requires_billing" RADAR_CHALLENGE = "radar_challenge" RADAR_SIGN_UP_CHALLENGE = "radar_sign_up_challenge" @@ -349,7 +348,6 @@ def _missing_(cls, value: object) -> ErrorBodyCode | None: "permission_not_found", "permission_slug_conflict", "phone_number_required", - "policy_denied", "production_feature_requires_billing", "radar_challenge", "radar_sign_up_challenge", diff --git a/src/workos/common/models/error_body_with_code.py b/src/workos/common/models/error_body_with_code.py index 6b3fc7769..4035c1ce3 100644 --- a/src/workos/common/models/error_body_with_code.py +++ b/src/workos/common/models/error_body_with_code.py @@ -1,9 +1,36 @@ # This file is auto-generated by oagen. Do not edit. -from typing import TypeAlias +from __future__ import annotations -from .authentication_email_verification_failed_data_error import ( - AuthenticationEmailVerificationFailedDataError, -) +from dataclasses import dataclass +from typing import Any -ErrorBodyWithCode: TypeAlias = AuthenticationEmailVerificationFailedDataError +from workos._types import _raise_deserialize_error + + +@dataclass(slots=True) +class ErrorBodyWithCode: + """Error Body With Code model.""" + + code: str + """The error code identifying the type of error.""" + message: str + """A human-readable description of the error.""" + + @classmethod + def from_dict(cls, data: dict[str, Any]) -> ErrorBodyWithCode: + """Deserialize from a dictionary.""" + try: + return cls( + code=data["code"], + message=data["message"], + ) + except (KeyError, ValueError) as e: + _raise_deserialize_error("ErrorBodyWithCode", e) + + def to_dict(self) -> dict[str, Any]: + """Serialize to a dictionary.""" + result: dict[str, Any] = {} + result["code"] = self.code + result["message"] = self.message + return result diff --git a/src/workos/common/models/policy_denied_error_body.py b/src/workos/common/models/policy_denied_error_body.py index 9a7c50c2a..7eb1dd942 100644 --- a/src/workos/common/models/policy_denied_error_body.py +++ b/src/workos/common/models/policy_denied_error_body.py @@ -16,6 +16,8 @@ class PolicyDeniedErrorBody: """The error code identifying the type of error.""" message: str """A human-readable description of the error.""" + radar_detection_id: str | None = None + """The ID of the Radar detection that blocked the request. Only set when Radar blocked it.""" @classmethod def from_dict(cls, data: dict[str, Any]) -> PolicyDeniedErrorBody: @@ -24,6 +26,7 @@ def from_dict(cls, data: dict[str, Any]) -> PolicyDeniedErrorBody: return cls( code=data.get("code", "policy_denied"), message=data["message"], + radar_detection_id=data.get("radar_detection_id"), ) except (KeyError, ValueError) as e: _raise_deserialize_error("PolicyDeniedErrorBody", e) @@ -33,4 +36,6 @@ def to_dict(self) -> dict[str, Any]: result: dict[str, Any] = {} result["code"] = self.code result["message"] = self.message + if self.radar_detection_id is not None: + result["radar_detection_id"] = self.radar_detection_id return result diff --git a/src/workos/common/models/sso_required_oauth_error_body_with_connection_ids_list_email_pending_authentication_token.py b/src/workos/common/models/sso_required_oauth_error_body_with_connection_ids_list_email.py similarity index 87% rename from src/workos/common/models/sso_required_oauth_error_body_with_connection_ids_list_email_pending_authentication_token.py rename to src/workos/common/models/sso_required_oauth_error_body_with_connection_ids_list_email.py index cdc0349b8..a42d364b4 100644 --- a/src/workos/common/models/sso_required_oauth_error_body_with_connection_ids_list_email_pending_authentication_token.py +++ b/src/workos/common/models/sso_required_oauth_error_body_with_connection_ids_list_email.py @@ -9,8 +9,8 @@ @dataclass(slots=True) -class SSORequiredOAuthErrorBodyWithConnectionIdsListEmailPendingAuthenticationToken: - """SSO Required O Auth Error Body With Connection Ids List Email Pending Authentication Token model.""" +class SSORequiredOAuthErrorBodyWithConnectionIdsListEmail: + """SSO Required O Auth Error Body With Connection Ids List Email model.""" error: Literal["sso_required"] """The OAuth error code.""" @@ -26,7 +26,7 @@ class SSORequiredOAuthErrorBodyWithConnectionIdsListEmailPendingAuthenticationTo @classmethod def from_dict( cls, data: dict[str, Any] - ) -> SSORequiredOAuthErrorBodyWithConnectionIdsListEmailPendingAuthenticationToken: + ) -> SSORequiredOAuthErrorBodyWithConnectionIdsListEmail: """Deserialize from a dictionary.""" try: return cls( @@ -38,8 +38,7 @@ def from_dict( ) except (KeyError, ValueError) as e: _raise_deserialize_error( - "SSORequiredOAuthErrorBodyWithConnectionIdsListEmailPendingAuthenticationToken", - e, + "SSORequiredOAuthErrorBodyWithConnectionIdsListEmail", e ) def to_dict(self) -> dict[str, Any]: diff --git a/src/workos/directory_sync/_resource.py b/src/workos/directory_sync/_resource.py index ba9bad15c..b1e065177 100644 --- a/src/workos/directory_sync/_resource.py +++ b/src/workos/directory_sync/_resource.py @@ -7,7 +7,10 @@ if TYPE_CHECKING: from .._client import AsyncWorkOSClient, WorkOSClient +import warnings + from workos.common.models.directory_group import DirectoryGroup +from workos.common.models.directory_user import DirectoryUser from workos.common.models.pagination_order import PaginationOrder from .._pagination import AsyncPage, SyncPage @@ -168,6 +171,186 @@ def create_directory_sync( request_options=request_options, ) + def list_directory_groups( + self, + directory_id: str, + *, + limit: int | None = None, + before: str | None = None, + after: str | None = None, + order: PaginationOrder | str | None = "desc", + user: str | None = None, + request_options: RequestOptions | None = None, + ) -> SyncPage[DirectoryGroup]: + """List Groups for a Directory + + Get a list of the Directory Groups in a Directory, optionally filtered to the groups a Directory User belongs to. + + Args: + directory_id: Unique identifier of the Directory. + limit: Upper limit on the number of objects to return, between `1` and `100`. Defaults to `10`. + before: An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `\"obj_123\"`, your subsequent call can include `before=\"obj_123\"` to fetch a new batch of objects before `\"obj_123\"`. + after: An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `\"obj_123\"`, your subsequent call can include `after=\"obj_123\"` to fetch a new batch of objects after `\"obj_123\"`. + order: Order the results by the creation time. Supported values are `\"asc\"` (ascending), `\"desc\"` (descending), and `\"normal\"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to `desc`. + user: Filter Directory Groups to those this Directory User belongs to. + request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. + + Returns: + SyncPage[DirectoryGroup] + + Raises: + AuthorizationError: If the request is forbidden (403). + NotFoundError: If the resource is not found (404). + UnprocessableEntityError: If the request data is unprocessable (422). + AuthenticationError: If the API key is invalid (401). + RateLimitExceededError: If rate limited (429). + ServerError: If the server returns a 5xx error. + """ + params = { + k: v + for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + "user": user, + }.items() + if v is not None + } + return self._client.request_page( + method="get", + path=("directories", str(directory_id), "groups"), + model=DirectoryGroup, + params=params, + request_options=request_options, + ) + + def get_directory_group( + self, + directory_id: str, + group_id: str, + *, + request_options: RequestOptions | None = None, + ) -> DirectoryGroup: + """Get a Group for a Directory + + Get the details of a Directory Group in a Directory. + + Args: + directory_id: Unique identifier of the Directory. + group_id: Unique identifier for the Directory Group. + request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. + + Returns: + DirectoryGroup + + Raises: + AuthorizationError: If the request is forbidden (403). + NotFoundError: If the resource is not found (404). + AuthenticationError: If the API key is invalid (401). + RateLimitExceededError: If rate limited (429). + ServerError: If the server returns a 5xx error. + """ + return self._client.request( + method="get", + path=("directories", str(directory_id), "groups", str(group_id)), + model=DirectoryGroup, + request_options=request_options, + ) + + def list_directory_users( + self, + directory_id: str, + *, + limit: int | None = None, + before: str | None = None, + after: str | None = None, + order: PaginationOrder | str | None = "desc", + group: str | None = None, + idp_id: str | None = None, + email: str | None = None, + request_options: RequestOptions | None = None, + ) -> SyncPage[DirectoryUser]: + """List Users for a Directory + + Get a list of the Directory Users in a Directory, optionally filtered to the members of a Directory Group. + + Args: + directory_id: Unique identifier of the Directory. + limit: Upper limit on the number of objects to return, between `1` and `100`. Defaults to `10`. + before: An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `\"obj_123\"`, your subsequent call can include `before=\"obj_123\"` to fetch a new batch of objects before `\"obj_123\"`. + after: An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `\"obj_123\"`, your subsequent call can include `after=\"obj_123\"` to fetch a new batch of objects after `\"obj_123\"`. + order: Order the results by the creation time. Supported values are `\"asc\"` (ascending), `\"desc\"` (descending), and `\"normal\"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to `desc`. + group: Filter Directory Users to the members of this Directory Group. + idp_id: Filter Directory Users by the identity provider's unique identifier (`idp_id`). + email: Filter Directory Users by their primary email address. + request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. + + Returns: + SyncPage[DirectoryUser] + + Raises: + AuthorizationError: If the request is forbidden (403). + NotFoundError: If the resource is not found (404). + UnprocessableEntityError: If the request data is unprocessable (422). + AuthenticationError: If the API key is invalid (401). + RateLimitExceededError: If rate limited (429). + ServerError: If the server returns a 5xx error. + """ + params = { + k: v + for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + "group": group, + "idp_id": idp_id, + "email": email, + }.items() + if v is not None + } + return self._client.request_page( + method="get", + path=("directories", str(directory_id), "users"), + model=DirectoryUser, + params=params, + request_options=request_options, + ) + + def get_directory_user( + self, + directory_id: str, + user_id: str, + *, + request_options: RequestOptions | None = None, + ) -> DirectoryUser: + """Get a User for a Directory + + Get the details of a Directory User in a Directory. + + Args: + directory_id: Unique identifier of the Directory. + user_id: Unique identifier for the Directory User. + request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. + + Returns: + DirectoryUser + + Raises: + AuthorizationError: If the request is forbidden (403). + NotFoundError: If the resource is not found (404). + AuthenticationError: If the API key is invalid (401). + RateLimitExceededError: If rate limited (429). + ServerError: If the server returns a 5xx error. + """ + return self._client.request( + method="get", + path=("directories", str(directory_id), "users", str(user_id)), + model=DirectoryUser, + request_options=request_options, + ) + def list_groups( self, *, @@ -181,7 +364,7 @@ def list_groups( ) -> SyncPage[DirectoryGroup]: """List Directory Groups - Get a list of all of existing directory groups matching the criteria specified. + Get a list of all of existing directory groups matching the criteria specified. Deprecated: use `GET /directories/{directoryId}/groups` instead. Args: limit: Upper limit on the number of objects to return, between `1` and `100`. Defaults to `10`. @@ -202,7 +385,11 @@ def list_groups( AuthenticationError: If the API key is invalid (401). RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. + + .. deprecated:: + This operation is deprecated. See the migration guide for alternatives. """ + warnings.warn("list is deprecated", DeprecationWarning, stacklevel=2) params = { k: v for k, v in { @@ -231,7 +418,7 @@ def get_group( ) -> DirectoryGroup: """Get a Directory Group - Get the details of an existing Directory Group. + Get the details of an existing Directory Group. Deprecated: use `GET /directories/{directoryId}/groups/{groupId}` instead. Args: id: Unique identifier for the Directory Group. @@ -246,7 +433,11 @@ def get_group( AuthenticationError: If the API key is invalid (401). RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. + + .. deprecated:: + This operation is deprecated. See the migration guide for alternatives. """ + warnings.warn("find is deprecated", DeprecationWarning, stacklevel=2) return self._client.request( method="get", path=("directory_groups", str(id)), @@ -269,7 +460,7 @@ def list_users( ) -> SyncPage[DirectoryUserWithGroups]: """List Directory Users - Get a list of all of existing Directory Users matching the criteria specified. + Get a list of all of existing Directory Users matching the criteria specified. Deprecated: use `GET /directories/{directoryId}/users` instead. Args: limit: Upper limit on the number of objects to return, between `1` and `100`. Defaults to `10`. @@ -292,7 +483,11 @@ def list_users( RateLimitExceededError: If rate limited (429). AuthenticationError: If the API key is invalid (401). ServerError: If the server returns a 5xx error. + + .. deprecated:: + This operation is deprecated. See the migration guide for alternatives. """ + warnings.warn("list is deprecated", DeprecationWarning, stacklevel=2) params = { k: v for k, v in { @@ -323,7 +518,7 @@ def get_user( ) -> DirectoryUserWithGroups: """Get a Directory User - Get the details of an existing Directory User. + Get the details of an existing Directory User. Deprecated: use `GET /directories/{directoryId}/users/{userId}` instead. Args: id: Unique identifier for the Directory User. @@ -338,7 +533,11 @@ def get_user( AuthenticationError: If the API key is invalid (401). RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. + + .. deprecated:: + This operation is deprecated. See the migration guide for alternatives. """ + warnings.warn("find is deprecated", DeprecationWarning, stacklevel=2) return self._client.request( method="get", path=("directory_users", str(id)), @@ -500,6 +699,186 @@ async def create_directory_sync( request_options=request_options, ) + async def list_directory_groups( + self, + directory_id: str, + *, + limit: int | None = None, + before: str | None = None, + after: str | None = None, + order: PaginationOrder | str | None = "desc", + user: str | None = None, + request_options: RequestOptions | None = None, + ) -> AsyncPage[DirectoryGroup]: + """List Groups for a Directory + + Get a list of the Directory Groups in a Directory, optionally filtered to the groups a Directory User belongs to. + + Args: + directory_id: Unique identifier of the Directory. + limit: Upper limit on the number of objects to return, between `1` and `100`. Defaults to `10`. + before: An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `\"obj_123\"`, your subsequent call can include `before=\"obj_123\"` to fetch a new batch of objects before `\"obj_123\"`. + after: An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `\"obj_123\"`, your subsequent call can include `after=\"obj_123\"` to fetch a new batch of objects after `\"obj_123\"`. + order: Order the results by the creation time. Supported values are `\"asc\"` (ascending), `\"desc\"` (descending), and `\"normal\"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to `desc`. + user: Filter Directory Groups to those this Directory User belongs to. + request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. + + Returns: + AsyncPage[DirectoryGroup] + + Raises: + AuthorizationError: If the request is forbidden (403). + NotFoundError: If the resource is not found (404). + UnprocessableEntityError: If the request data is unprocessable (422). + AuthenticationError: If the API key is invalid (401). + RateLimitExceededError: If rate limited (429). + ServerError: If the server returns a 5xx error. + """ + params = { + k: v + for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + "user": user, + }.items() + if v is not None + } + return await self._client.request_page( + method="get", + path=("directories", str(directory_id), "groups"), + model=DirectoryGroup, + params=params, + request_options=request_options, + ) + + async def get_directory_group( + self, + directory_id: str, + group_id: str, + *, + request_options: RequestOptions | None = None, + ) -> DirectoryGroup: + """Get a Group for a Directory + + Get the details of a Directory Group in a Directory. + + Args: + directory_id: Unique identifier of the Directory. + group_id: Unique identifier for the Directory Group. + request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. + + Returns: + DirectoryGroup + + Raises: + AuthorizationError: If the request is forbidden (403). + NotFoundError: If the resource is not found (404). + AuthenticationError: If the API key is invalid (401). + RateLimitExceededError: If rate limited (429). + ServerError: If the server returns a 5xx error. + """ + return await self._client.request( + method="get", + path=("directories", str(directory_id), "groups", str(group_id)), + model=DirectoryGroup, + request_options=request_options, + ) + + async def list_directory_users( + self, + directory_id: str, + *, + limit: int | None = None, + before: str | None = None, + after: str | None = None, + order: PaginationOrder | str | None = "desc", + group: str | None = None, + idp_id: str | None = None, + email: str | None = None, + request_options: RequestOptions | None = None, + ) -> AsyncPage[DirectoryUser]: + """List Users for a Directory + + Get a list of the Directory Users in a Directory, optionally filtered to the members of a Directory Group. + + Args: + directory_id: Unique identifier of the Directory. + limit: Upper limit on the number of objects to return, between `1` and `100`. Defaults to `10`. + before: An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `\"obj_123\"`, your subsequent call can include `before=\"obj_123\"` to fetch a new batch of objects before `\"obj_123\"`. + after: An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `\"obj_123\"`, your subsequent call can include `after=\"obj_123\"` to fetch a new batch of objects after `\"obj_123\"`. + order: Order the results by the creation time. Supported values are `\"asc\"` (ascending), `\"desc\"` (descending), and `\"normal\"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to `desc`. + group: Filter Directory Users to the members of this Directory Group. + idp_id: Filter Directory Users by the identity provider's unique identifier (`idp_id`). + email: Filter Directory Users by their primary email address. + request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. + + Returns: + AsyncPage[DirectoryUser] + + Raises: + AuthorizationError: If the request is forbidden (403). + NotFoundError: If the resource is not found (404). + UnprocessableEntityError: If the request data is unprocessable (422). + AuthenticationError: If the API key is invalid (401). + RateLimitExceededError: If rate limited (429). + ServerError: If the server returns a 5xx error. + """ + params = { + k: v + for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + "group": group, + "idp_id": idp_id, + "email": email, + }.items() + if v is not None + } + return await self._client.request_page( + method="get", + path=("directories", str(directory_id), "users"), + model=DirectoryUser, + params=params, + request_options=request_options, + ) + + async def get_directory_user( + self, + directory_id: str, + user_id: str, + *, + request_options: RequestOptions | None = None, + ) -> DirectoryUser: + """Get a User for a Directory + + Get the details of a Directory User in a Directory. + + Args: + directory_id: Unique identifier of the Directory. + user_id: Unique identifier for the Directory User. + request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. + + Returns: + DirectoryUser + + Raises: + AuthorizationError: If the request is forbidden (403). + NotFoundError: If the resource is not found (404). + AuthenticationError: If the API key is invalid (401). + RateLimitExceededError: If rate limited (429). + ServerError: If the server returns a 5xx error. + """ + return await self._client.request( + method="get", + path=("directories", str(directory_id), "users", str(user_id)), + model=DirectoryUser, + request_options=request_options, + ) + async def list_groups( self, *, @@ -513,7 +892,7 @@ async def list_groups( ) -> AsyncPage[DirectoryGroup]: """List Directory Groups - Get a list of all of existing directory groups matching the criteria specified. + Get a list of all of existing directory groups matching the criteria specified. Deprecated: use `GET /directories/{directoryId}/groups` instead. Args: limit: Upper limit on the number of objects to return, between `1` and `100`. Defaults to `10`. @@ -534,7 +913,11 @@ async def list_groups( AuthenticationError: If the API key is invalid (401). RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. + + .. deprecated:: + This operation is deprecated. See the migration guide for alternatives. """ + warnings.warn("list is deprecated", DeprecationWarning, stacklevel=2) params = { k: v for k, v in { @@ -563,7 +946,7 @@ async def get_group( ) -> DirectoryGroup: """Get a Directory Group - Get the details of an existing Directory Group. + Get the details of an existing Directory Group. Deprecated: use `GET /directories/{directoryId}/groups/{groupId}` instead. Args: id: Unique identifier for the Directory Group. @@ -578,7 +961,11 @@ async def get_group( AuthenticationError: If the API key is invalid (401). RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. + + .. deprecated:: + This operation is deprecated. See the migration guide for alternatives. """ + warnings.warn("find is deprecated", DeprecationWarning, stacklevel=2) return await self._client.request( method="get", path=("directory_groups", str(id)), @@ -601,7 +988,7 @@ async def list_users( ) -> AsyncPage[DirectoryUserWithGroups]: """List Directory Users - Get a list of all of existing Directory Users matching the criteria specified. + Get a list of all of existing Directory Users matching the criteria specified. Deprecated: use `GET /directories/{directoryId}/users` instead. Args: limit: Upper limit on the number of objects to return, between `1` and `100`. Defaults to `10`. @@ -624,7 +1011,11 @@ async def list_users( RateLimitExceededError: If rate limited (429). AuthenticationError: If the API key is invalid (401). ServerError: If the server returns a 5xx error. + + .. deprecated:: + This operation is deprecated. See the migration guide for alternatives. """ + warnings.warn("list is deprecated", DeprecationWarning, stacklevel=2) params = { k: v for k, v in { @@ -655,7 +1046,7 @@ async def get_user( ) -> DirectoryUserWithGroups: """Get a Directory User - Get the details of an existing Directory User. + Get the details of an existing Directory User. Deprecated: use `GET /directories/{directoryId}/users/{userId}` instead. Args: id: Unique identifier for the Directory User. @@ -670,7 +1061,11 @@ async def get_user( AuthenticationError: If the API key is invalid (401). RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. + + .. deprecated:: + This operation is deprecated. See the migration guide for alternatives. """ + warnings.warn("find is deprecated", DeprecationWarning, stacklevel=2) return await self._client.request( method="get", path=("directory_users", str(id)), diff --git a/src/workos/directory_sync/models/__init__.py b/src/workos/directory_sync/models/__init__.py index ecee47f39..030a43ad8 100644 --- a/src/workos/directory_sync/models/__init__.py +++ b/src/workos/directory_sync/models/__init__.py @@ -1,6 +1,10 @@ # This file is auto-generated by oagen. Do not edit. from workos.common.models.directory_group import DirectoryGroup as DirectoryGroup +from workos.common.models.directory_user import DirectoryUser as DirectoryUser +from workos.common.models.directory_user_email import ( + DirectoryUserEmail as DirectoryUserEmail, +) from .directory import Directory as Directory from .directory_metadata import DirectoryMetadata as DirectoryMetadata diff --git a/src/workos/directory_sync/models/directory_user_with_groups.py b/src/workos/directory_sync/models/directory_user_with_groups.py index 69fd5624c..f1a66231d 100644 --- a/src/workos/directory_sync/models/directory_user_with_groups.py +++ b/src/workos/directory_sync/models/directory_user_with_groups.py @@ -67,7 +67,7 @@ class DirectoryUserWithGroups: roles: list[SlimRole] | None = None """All roles assigned to the user.""" groups: list[DirectoryGroup] | None = None - """The directory groups the user belongs to. Deprecated: starting May 1, 2026, this field returns an empty array by default for newly created teams. Existing teams currently depending on this field should migrate to the new access pattern for better throughput performance — the field is unbounded by user, so users with many group memberships produce large, slow response payloads. Use the List Directory Groups endpoint with a `user` filter to fetch a user's group memberships. + """The directory groups the user belongs to. Deprecated: use `GET /directories/{directoryId}/groups?user={userId}` instead. .. deprecated:: This field is deprecated.""" diff --git a/src/workos/pipes/models/add_data_integrations_get_data_integration_authorize_url_request_connection_owner_literal.py b/src/workos/pipes/models/add_data_integrations_get_data_integration_authorize_url_request_connection_owner_literal.py deleted file mode 100644 index 2365b51dc..000000000 --- a/src/workos/pipes/models/add_data_integrations_get_data_integration_authorize_url_request_connection_owner_literal.py +++ /dev/null @@ -1,26 +0,0 @@ -# This file is auto-generated by oagen. Do not edit. - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from workos.common.models.create_data_integration_ownership import ( - CreateDataIntegrationOwnership as AddDataIntegrationsGetDataIntegrationAuthorizeUrlRequestConnectionOwnerLiteral, - ) -else: - - def __getattr__(name: str): - if ( - name - == "AddDataIntegrationsGetDataIntegrationAuthorizeUrlRequestConnectionOwnerLiteral" - ): - from workos.common.models.create_data_integration_ownership import ( - CreateDataIntegrationOwnership, - ) - - return CreateDataIntegrationOwnership - raise AttributeError(f"module {__name__!r} has no attribute {name!r}") - - -__all__ = [ - "AddDataIntegrationsGetDataIntegrationAuthorizeUrlRequestConnectionOwnerLiteral" -] diff --git a/tests/fixtures/agent_registration_claim_completed.json b/tests/fixtures/agent_registration_claim_completed.json index af38aac7c..58e43675d 100644 --- a/tests/fixtures/agent_registration_claim_completed.json +++ b/tests/fixtures/agent_registration_claim_completed.json @@ -6,6 +6,7 @@ "object": "agent_registration_claim", "id": "agent_reg_claim_01EHWNCE74X7JSDV0X3SZ3KJNY", "agent_registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY", + "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "completed_by_attempt_id": "agent_reg_claim_attempt_01EHWNCE74X7JSDV0X3SZ3KJNY", "claimed_by": { "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", diff --git a/tests/fixtures/agent_registration_claim_completed_data.json b/tests/fixtures/agent_registration_claim_completed_data.json index a2d1b41ca..4d0db1c45 100644 --- a/tests/fixtures/agent_registration_claim_completed_data.json +++ b/tests/fixtures/agent_registration_claim_completed_data.json @@ -2,6 +2,7 @@ "object": "agent_registration_claim", "id": "agent_reg_claim_01EHWNCE74X7JSDV0X3SZ3KJNY", "agent_registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY", + "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "completed_by_attempt_id": "agent_reg_claim_attempt_01EHWNCE74X7JSDV0X3SZ3KJNY", "claimed_by": { "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", diff --git a/tests/fixtures/audit_log_export_creation.json b/tests/fixtures/audit_log_export_creation.json index bf28c7b08..9e7c2c3d1 100644 --- a/tests/fixtures/audit_log_export_creation.json +++ b/tests/fixtures/audit_log_export_creation.json @@ -1,7 +1,7 @@ { "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT", "range_start": "2022-07-02T18:09:06.000Z", - "range_end": "2022-09-02T18:09:06.000Z", + "range_end": "2022-08-02T18:09:06.000Z", "actions": [ "user.signed_in" ], diff --git a/tests/fixtures/authentication_email_verification_failed.json b/tests/fixtures/authentication_email_verification_failed.json index d29437509..4d761ec69 100644 --- a/tests/fixtures/authentication_email_verification_failed.json +++ b/tests/fixtures/authentication_email_verification_failed.json @@ -11,7 +11,8 @@ "email": "user@example.com", "error": { "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed." + "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X" } }, "created_at": "2026-01-15T12:00:00.000Z", diff --git a/tests/fixtures/authentication_email_verification_failed_data.json b/tests/fixtures/authentication_email_verification_failed_data.json index fead19870..d9374dc27 100644 --- a/tests/fixtures/authentication_email_verification_failed_data.json +++ b/tests/fixtures/authentication_email_verification_failed_data.json @@ -7,6 +7,7 @@ "email": "user@example.com", "error": { "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed." + "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X" } } diff --git a/tests/fixtures/authentication_email_verification_failed_data_error.json b/tests/fixtures/authentication_email_verification_failed_data_error.json index 8729bbbfd..d414eeb9d 100644 --- a/tests/fixtures/authentication_email_verification_failed_data_error.json +++ b/tests/fixtures/authentication_email_verification_failed_data_error.json @@ -1,4 +1,5 @@ { "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed." + "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X" } diff --git a/tests/fixtures/authentication_magic_auth_failed.json b/tests/fixtures/authentication_magic_auth_failed.json index dae55e92f..c097ff80e 100644 --- a/tests/fixtures/authentication_magic_auth_failed.json +++ b/tests/fixtures/authentication_magic_auth_failed.json @@ -11,7 +11,8 @@ "email": "user@example.com", "error": { "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed." + "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X" } }, "created_at": "2026-01-15T12:00:00.000Z", diff --git a/tests/fixtures/authentication_magic_auth_failed_data.json b/tests/fixtures/authentication_magic_auth_failed_data.json index 00bff0366..e27e55895 100644 --- a/tests/fixtures/authentication_magic_auth_failed_data.json +++ b/tests/fixtures/authentication_magic_auth_failed_data.json @@ -7,6 +7,7 @@ "email": "user@example.com", "error": { "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed." + "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X" } } diff --git a/tests/fixtures/authentication_magic_auth_failed_data_error.json b/tests/fixtures/authentication_magic_auth_failed_data_error.json index 8729bbbfd..d414eeb9d 100644 --- a/tests/fixtures/authentication_magic_auth_failed_data_error.json +++ b/tests/fixtures/authentication_magic_auth_failed_data_error.json @@ -1,4 +1,5 @@ { "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed." + "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X" } diff --git a/tests/fixtures/authentication_mfa_failed.json b/tests/fixtures/authentication_mfa_failed.json index 1aca1447e..0ef3d55b8 100644 --- a/tests/fixtures/authentication_mfa_failed.json +++ b/tests/fixtures/authentication_mfa_failed.json @@ -11,7 +11,8 @@ "email": "user@example.com", "error": { "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed." + "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X" } }, "created_at": "2026-01-15T12:00:00.000Z", diff --git a/tests/fixtures/authentication_mfa_failed_data.json b/tests/fixtures/authentication_mfa_failed_data.json index ed6732f80..7e7a43133 100644 --- a/tests/fixtures/authentication_mfa_failed_data.json +++ b/tests/fixtures/authentication_mfa_failed_data.json @@ -7,6 +7,7 @@ "email": "user@example.com", "error": { "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed." + "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X" } } diff --git a/tests/fixtures/authentication_mfa_failed_data_error.json b/tests/fixtures/authentication_mfa_failed_data_error.json index 8729bbbfd..d414eeb9d 100644 --- a/tests/fixtures/authentication_mfa_failed_data_error.json +++ b/tests/fixtures/authentication_mfa_failed_data_error.json @@ -1,4 +1,5 @@ { "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed." + "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X" } diff --git a/tests/fixtures/authentication_oauth_failed.json b/tests/fixtures/authentication_oauth_failed.json index 75ae2dfc4..83425de3d 100644 --- a/tests/fixtures/authentication_oauth_failed.json +++ b/tests/fixtures/authentication_oauth_failed.json @@ -11,7 +11,8 @@ "email": "user@example.com", "error": { "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed." + "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X" }, "provider": "GoogleOAuth" }, diff --git a/tests/fixtures/authentication_oauth_failed_data.json b/tests/fixtures/authentication_oauth_failed_data.json index 2df3c7677..3d4504848 100644 --- a/tests/fixtures/authentication_oauth_failed_data.json +++ b/tests/fixtures/authentication_oauth_failed_data.json @@ -7,7 +7,8 @@ "email": "user@example.com", "error": { "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed." + "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X" }, "provider": "GoogleOAuth" } diff --git a/tests/fixtures/authentication_oauth_failed_data_error.json b/tests/fixtures/authentication_oauth_failed_data_error.json index 8729bbbfd..d414eeb9d 100644 --- a/tests/fixtures/authentication_oauth_failed_data_error.json +++ b/tests/fixtures/authentication_oauth_failed_data_error.json @@ -1,4 +1,5 @@ { "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed." + "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X" } diff --git a/tests/fixtures/authentication_passkey_failed.json b/tests/fixtures/authentication_passkey_failed.json index f1937fe24..194ebfecd 100644 --- a/tests/fixtures/authentication_passkey_failed.json +++ b/tests/fixtures/authentication_passkey_failed.json @@ -11,7 +11,8 @@ "email": "user@example.com", "error": { "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed." + "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X" } }, "created_at": "2026-01-15T12:00:00.000Z", diff --git a/tests/fixtures/authentication_passkey_failed_data.json b/tests/fixtures/authentication_passkey_failed_data.json index 071fd18df..a0a54722e 100644 --- a/tests/fixtures/authentication_passkey_failed_data.json +++ b/tests/fixtures/authentication_passkey_failed_data.json @@ -7,6 +7,7 @@ "email": "user@example.com", "error": { "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed." + "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X" } } diff --git a/tests/fixtures/authentication_passkey_failed_data_error.json b/tests/fixtures/authentication_passkey_failed_data_error.json index 8729bbbfd..d414eeb9d 100644 --- a/tests/fixtures/authentication_passkey_failed_data_error.json +++ b/tests/fixtures/authentication_passkey_failed_data_error.json @@ -1,4 +1,5 @@ { "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed." + "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X" } diff --git a/tests/fixtures/authentication_password_failed.json b/tests/fixtures/authentication_password_failed.json index cdff4d0d8..dcc39ccbf 100644 --- a/tests/fixtures/authentication_password_failed.json +++ b/tests/fixtures/authentication_password_failed.json @@ -11,7 +11,8 @@ "email": "user@example.com", "error": { "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed." + "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X" } }, "created_at": "2026-01-15T12:00:00.000Z", diff --git a/tests/fixtures/authentication_password_failed_data.json b/tests/fixtures/authentication_password_failed_data.json index f2abf7296..1066d1bc4 100644 --- a/tests/fixtures/authentication_password_failed_data.json +++ b/tests/fixtures/authentication_password_failed_data.json @@ -7,6 +7,7 @@ "email": "user@example.com", "error": { "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed." + "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X" } } diff --git a/tests/fixtures/authentication_password_failed_data_error.json b/tests/fixtures/authentication_password_failed_data_error.json index 8729bbbfd..d414eeb9d 100644 --- a/tests/fixtures/authentication_password_failed_data_error.json +++ b/tests/fixtures/authentication_password_failed_data_error.json @@ -1,4 +1,5 @@ { "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed." + "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X" } diff --git a/tests/fixtures/authentication_radar_risk_detected.json b/tests/fixtures/authentication_radar_risk_detected.json index 919306e88..a90da4eca 100644 --- a/tests/fixtures/authentication_radar_risk_detected.json +++ b/tests/fixtures/authentication_radar_risk_detected.json @@ -10,7 +10,8 @@ "ip_address": "203.0.113.42", "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com" + "email": "user@example.com", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X" }, "created_at": "2026-01-15T12:00:00.000Z", "context": { diff --git a/tests/fixtures/authentication_radar_risk_detected_data.json b/tests/fixtures/authentication_radar_risk_detected_data.json index 7210f9e5c..8b975276b 100644 --- a/tests/fixtures/authentication_radar_risk_detected_data.json +++ b/tests/fixtures/authentication_radar_risk_detected_data.json @@ -6,5 +6,6 @@ "ip_address": "203.0.113.42", "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com" + "email": "user@example.com", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X" } diff --git a/tests/fixtures/authentication_sso_failed.json b/tests/fixtures/authentication_sso_failed.json index a77c6c594..1f69810b4 100644 --- a/tests/fixtures/authentication_sso_failed.json +++ b/tests/fixtures/authentication_sso_failed.json @@ -16,7 +16,8 @@ }, "error": { "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed." + "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X" } }, "created_at": "2026-01-15T12:00:00.000Z", diff --git a/tests/fixtures/authentication_sso_failed_data.json b/tests/fixtures/authentication_sso_failed_data.json index d7d10d34a..6772312e9 100644 --- a/tests/fixtures/authentication_sso_failed_data.json +++ b/tests/fixtures/authentication_sso_failed_data.json @@ -12,6 +12,7 @@ }, "error": { "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed." + "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X" } } diff --git a/tests/fixtures/authentication_sso_failed_data_error.json b/tests/fixtures/authentication_sso_failed_data_error.json index 8729bbbfd..d414eeb9d 100644 --- a/tests/fixtures/authentication_sso_failed_data_error.json +++ b/tests/fixtures/authentication_sso_failed_data_error.json @@ -1,4 +1,5 @@ { "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed." + "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X" } diff --git a/tests/fixtures/authentication_sso_timed_out.json b/tests/fixtures/authentication_sso_timed_out.json index 11f48ea3e..4c2745d92 100644 --- a/tests/fixtures/authentication_sso_timed_out.json +++ b/tests/fixtures/authentication_sso_timed_out.json @@ -16,7 +16,8 @@ }, "error": { "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed." + "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X" } }, "created_at": "2026-01-15T12:00:00.000Z", diff --git a/tests/fixtures/authentication_sso_timed_out_data.json b/tests/fixtures/authentication_sso_timed_out_data.json index 4f6fe32f9..2e87586c4 100644 --- a/tests/fixtures/authentication_sso_timed_out_data.json +++ b/tests/fixtures/authentication_sso_timed_out_data.json @@ -12,6 +12,7 @@ }, "error": { "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed." + "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X" } } diff --git a/tests/fixtures/authentication_sso_timed_out_data_error.json b/tests/fixtures/authentication_sso_timed_out_data_error.json index 8729bbbfd..d414eeb9d 100644 --- a/tests/fixtures/authentication_sso_timed_out_data_error.json +++ b/tests/fixtures/authentication_sso_timed_out_data_error.json @@ -1,4 +1,5 @@ { "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed." + "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X" } diff --git a/tests/fixtures/list_directory_user.json b/tests/fixtures/list_directory_user.json new file mode 100644 index 000000000..81b85607d --- /dev/null +++ b/tests/fixtures/list_directory_user.json @@ -0,0 +1,46 @@ +{ + "data": [ + { + "object": "directory_user", + "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", + "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", + "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", + "idp_id": "2836", + "email": "marcelina.davis@example.com", + "first_name": "Marcelina", + "last_name": "Davis", + "name": "Marcelina Davis", + "emails": [ + { + "primary": true, + "type": "work", + "value": "marcelina.davis@example.com" + } + ], + "job_title": "Software Engineer", + "username": "mdavis", + "state": "active", + "raw_attributes": { + "key": {} + }, + "custom_attributes": { + "department": "Engineering", + "job_title": "Software Engineer" + }, + "role": { + "slug": "admin" + }, + "roles": [ + { + "slug": "admin" + } + ], + "created_at": "2026-01-15T12:00:00.000Z", + "updated_at": "2026-01-15T12:00:00.000Z" + } + ], + "list_metadata": { + "before": null, + "after": null + } +} diff --git a/tests/fixtures/policy_denied_error_body.json b/tests/fixtures/policy_denied_error_body.json index 126df463a..db0e5e0a6 100644 --- a/tests/fixtures/policy_denied_error_body.json +++ b/tests/fixtures/policy_denied_error_body.json @@ -1,4 +1,5 @@ { "code": "policy_denied", - "message": "Request could not be processed." + "message": "Request could not be processed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X" } diff --git a/tests/fixtures/sso_required_oauth_error_body_with_connection_ids_list_email.json b/tests/fixtures/sso_required_oauth_error_body_with_connection_ids_list_email.json new file mode 100644 index 000000000..f03e88f03 --- /dev/null +++ b/tests/fixtures/sso_required_oauth_error_body_with_connection_ids_list_email.json @@ -0,0 +1,9 @@ +{ + "error": "sso_required", + "error_description": "The request failed due to: sso_required.", + "connection_ids": [ + "connection_ids_01234" + ], + "email": "user@example.com", + "pending_authentication_token": "pat_01FVYZ..." +} diff --git a/tests/test_common_models_round_trip.py b/tests/test_common_models_round_trip.py index 40d9b4766..b1ad907a5 100644 --- a/tests/test_common_models_round_trip.py +++ b/tests/test_common_models_round_trip.py @@ -156,8 +156,6 @@ DataIntegrationCredentialsResponseWithCredential, DataIntegrationCredentialsResponseWithError, DirectorySyncRateLimitError, - DirectoryUser, - DirectoryUserEmail, DsyncActivated, DsyncActivatedData, DsyncActivatedDataDomain, @@ -433,7 +431,7 @@ SlowDownOAuthErrorBody, SmsChallengeQuotaReachedErrorBody, SmsChallengeRateLimitedErrorBody, - SSORequiredOAuthErrorBodyWithConnectionIdsListEmailPendingAuthenticationToken, + SSORequiredOAuthErrorBodyWithConnectionIdsListEmail, SubResourceScopedRoleNotAllowedErrorBodyWithRoleSlug, TokenTooBigOAuthErrorBody, TooManyFailedVerificationAttemptsErrorBodyWithRetryAfter, @@ -1164,6 +1162,27 @@ def test_oauth_error_body_minimal_payload(self): assert serialized["error"] == data["error"] assert serialized["error_description"] == data["error_description"] + def test_policy_denied_error_body_round_trip(self): + data = load_fixture("policy_denied_error_body.json") + instance = PolicyDeniedErrorBody.from_dict(data) + serialized = instance.to_dict() + assert serialized == data + restored = PolicyDeniedErrorBody.from_dict(serialized) + assert restored.to_dict() == serialized + + def test_policy_denied_error_body_minimal_payload(self): + data = {"code": "policy_denied", "message": "Request could not be processed."} + instance = PolicyDeniedErrorBody.from_dict(data) + serialized = instance.to_dict() + assert serialized["code"] == data["code"] + assert serialized["message"] == data["message"] + + def test_policy_denied_error_body_omits_absent_optional_non_nullable_fields(self): + data = {"code": "policy_denied", "message": "Request could not be processed."} + instance = PolicyDeniedErrorBody.from_dict(data) + serialized = instance.to_dict() + assert "radar_detection_id" not in serialized + def test_sub_resource_scoped_role_not_allowed_error_body_with_role_slug_round_trip( self, ): @@ -2614,21 +2633,6 @@ def test_application_consent_required_error_body_minimal_payload(self): assert serialized["code"] == data["code"] assert serialized["message"] == data["message"] - def test_policy_denied_error_body_round_trip(self): - data = load_fixture("policy_denied_error_body.json") - instance = PolicyDeniedErrorBody.from_dict(data) - serialized = instance.to_dict() - assert serialized == data - restored = PolicyDeniedErrorBody.from_dict(serialized) - assert restored.to_dict() == serialized - - def test_policy_denied_error_body_minimal_payload(self): - data = {"code": "policy_denied", "message": "Request could not be processed."} - instance = PolicyDeniedErrorBody.from_dict(data) - serialized = instance.to_dict() - assert serialized["code"] == data["code"] - assert serialized["message"] == data["message"] - def test_action_denied_error_body_round_trip(self): data = load_fixture("action_denied_error_body.json") instance = ActionDeniedErrorBody.from_dict(data) @@ -2933,147 +2937,6 @@ def test_event_context_omits_absent_optional_non_nullable_fields(self): assert "actor" not in serialized assert "previous_attributes" not in serialized - def test_directory_user_round_trip(self): - data = load_fixture("directory_user.json") - instance = DirectoryUser.from_dict(data) - serialized = instance.to_dict() - assert serialized == data - restored = DirectoryUser.from_dict(serialized) - assert restored.to_dict() == serialized - - def test_directory_user_minimal_payload(self): - data = { - "object": "directory_user", - "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "idp_id": "2836", - "email": None, - "state": "active", - "raw_attributes": {"key": {}}, - "custom_attributes": { - "department": "Engineering", - "job_title": "Software Engineer", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } - instance = DirectoryUser.from_dict(data) - serialized = instance.to_dict() - assert serialized["object"] == data["object"] - assert serialized["id"] == data["id"] - assert serialized["directory_id"] == data["directory_id"] - assert serialized["organization_id"] == data["organization_id"] - assert serialized["idp_id"] == data["idp_id"] - assert serialized["email"] == data["email"] - assert serialized["state"] == data["state"] - assert serialized["raw_attributes"] == data["raw_attributes"] - assert serialized["custom_attributes"] == data["custom_attributes"] - assert serialized["created_at"] == data["created_at"] - assert serialized["updated_at"] == data["updated_at"] - - def test_directory_user_omits_absent_optional_non_nullable_fields(self): - data = { - "object": "directory_user", - "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "idp_id": "2836", - "email": "marcelina.davis@example.com", - "first_name": "Marcelina", - "last_name": "Davis", - "name": "Marcelina Davis", - "job_title": "Software Engineer", - "username": "mdavis", - "state": "active", - "raw_attributes": {"key": {}}, - "custom_attributes": { - "department": "Engineering", - "job_title": "Software Engineer", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } - instance = DirectoryUser.from_dict(data) - serialized = instance.to_dict() - assert "emails" not in serialized - assert "role" not in serialized - assert "roles" not in serialized - - def test_directory_user_preserves_nullable_fields(self): - data = { - "object": "directory_user", - "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "idp_id": "2836", - "email": None, - "first_name": None, - "last_name": None, - "name": None, - "emails": [ - { - "primary": True, - "type": "work", - "value": "marcelina.davis@example.com", - } - ], - "job_title": None, - "username": None, - "state": "active", - "raw_attributes": {"key": {}}, - "custom_attributes": { - "department": "Engineering", - "job_title": "Software Engineer", - }, - "role": {"slug": "admin"}, - "roles": [{"slug": "admin"}], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } - instance = DirectoryUser.from_dict(data) - serialized = instance.to_dict() - assert serialized["email"] is None - assert serialized["first_name"] is None - assert serialized["last_name"] is None - assert serialized["name"] is None - assert serialized["job_title"] is None - assert serialized["username"] is None - - def test_directory_user_round_trips_unknown_enum_values(self): - data = { - "object": "directory_user", - "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "idp_id": "2836", - "email": "marcelina.davis@example.com", - "first_name": "Marcelina", - "last_name": "Davis", - "name": "Marcelina Davis", - "emails": [ - { - "primary": True, - "type": "work", - "value": "marcelina.davis@example.com", - } - ], - "job_title": "Software Engineer", - "username": "mdavis", - "state": "unexpected_directory_user_state", - "raw_attributes": {"key": {}}, - "custom_attributes": { - "department": "Engineering", - "job_title": "Software Engineer", - }, - "role": {"slug": "admin"}, - "roles": [{"slug": "admin"}], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } - instance = DirectoryUser.from_dict(data) - assert instance.to_dict() == data - def test_flag_rule_round_trip(self): data = load_fixture("flag_rule.json") instance = FlagRule.from_dict(data) @@ -4627,6 +4490,7 @@ def test_agent_registration_claim_completed_minimal_payload(self): "object": "agent_registration_claim", "id": "agent_reg_claim_01EHWNCE74X7JSDV0X3SZ3KJNY", "agent_registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY", + "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "completed_by_attempt_id": "agent_reg_claim_attempt_01EHWNCE74X7JSDV0X3SZ3KJNY", "claimed_by": { "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", @@ -4657,6 +4521,7 @@ def test_agent_registration_claim_completed_omits_absent_optional_non_nullable_f "object": "agent_registration_claim", "id": "agent_reg_claim_01EHWNCE74X7JSDV0X3SZ3KJNY", "agent_registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY", + "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "completed_by_attempt_id": "agent_reg_claim_attempt_01EHWNCE74X7JSDV0X3SZ3KJNY", "claimed_by": { "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", @@ -4705,6 +4570,26 @@ def test_agent_registration_claim_completed_data_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["updated_at"] == data["updated_at"] + def test_agent_registration_claim_completed_data_omits_absent_optional_non_nullable_fields( + self, + ): + data = { + "object": "agent_registration_claim", + "id": "agent_reg_claim_01EHWNCE74X7JSDV0X3SZ3KJNY", + "agent_registration_id": "agent_reg_01EHWNCE74X7JSDV0X3SZ3KJNY", + "completed_by_attempt_id": "agent_reg_claim_attempt_01EHWNCE74X7JSDV0X3SZ3KJNY", + "claimed_by": { + "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", + "organization_id": None, + }, + "completed_at": "2024-01-15T10:32:00.000Z", + "created_at": "2024-01-15T10:30:00.000Z", + "updated_at": "2024-01-15T10:32:00.000Z", + } + instance = AgentRegistrationClaimCompletedData.from_dict(data) + serialized = instance.to_dict() + assert "organization_id" not in serialized + def test_agent_registration_claim_completed_data_claimed_by_round_trip(self): data = load_fixture("agent_registration_claim_completed_data_claimed_by.json") instance = AgentRegistrationClaimCompletedDataClaimedBy.from_dict(data) @@ -5762,6 +5647,7 @@ def test_authentication_email_verification_failed_minimal_payload(self): "error": { "code": "mfa_challenge_failed", "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X", }, }, "created_at": "2026-01-15T12:00:00.000Z", @@ -5791,6 +5677,7 @@ def test_authentication_email_verification_failed_omits_absent_optional_non_null "error": { "code": "mfa_challenge_failed", "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X", }, }, "created_at": "2026-01-15T12:00:00.000Z", @@ -5818,6 +5705,7 @@ def test_authentication_email_verification_failed_data_minimal_payload(self): "error": { "code": "mfa_challenge_failed", "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X", }, } instance = AuthenticationEmailVerificationFailedData.from_dict(data) @@ -5843,6 +5731,7 @@ def test_authentication_email_verification_failed_data_preserves_nullable_fields "error": { "code": "mfa_challenge_failed", "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X", }, } instance = AuthenticationEmailVerificationFailedData.from_dict(data) @@ -5870,6 +5759,17 @@ def test_authentication_email_verification_failed_data_error_minimal_payload(sel assert serialized["code"] == data["code"] assert serialized["message"] == data["message"] + def test_authentication_email_verification_failed_data_error_omits_absent_optional_non_nullable_fields( + self, + ): + data = { + "code": "mfa_challenge_failed", + "message": "The MFA challenge has failed.", + } + instance = AuthenticationEmailVerificationFailedDataError.from_dict(data) + serialized = instance.to_dict() + assert "radar_detection_id" not in serialized + def test_authentication_email_verification_succeeded_round_trip(self): data = load_fixture("authentication_email_verification_succeeded.json") instance = AuthenticationEmailVerificationSucceeded.from_dict(data) @@ -5987,6 +5887,7 @@ def test_authentication_magic_auth_failed_minimal_payload(self): "error": { "code": "mfa_challenge_failed", "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X", }, }, "created_at": "2026-01-15T12:00:00.000Z", @@ -6016,6 +5917,7 @@ def test_authentication_magic_auth_failed_omits_absent_optional_non_nullable_fie "error": { "code": "mfa_challenge_failed", "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X", }, }, "created_at": "2026-01-15T12:00:00.000Z", @@ -6043,6 +5945,7 @@ def test_authentication_magic_auth_failed_data_minimal_payload(self): "error": { "code": "mfa_challenge_failed", "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X", }, } instance = AuthenticationMagicAuthFailedData.from_dict(data) @@ -6066,6 +5969,7 @@ def test_authentication_magic_auth_failed_data_preserves_nullable_fields(self): "error": { "code": "mfa_challenge_failed", "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X", }, } instance = AuthenticationMagicAuthFailedData.from_dict(data) @@ -6093,6 +5997,17 @@ def test_authentication_magic_auth_failed_data_error_minimal_payload(self): assert serialized["code"] == data["code"] assert serialized["message"] == data["message"] + def test_authentication_magic_auth_failed_data_error_omits_absent_optional_non_nullable_fields( + self, + ): + data = { + "code": "mfa_challenge_failed", + "message": "The MFA challenge has failed.", + } + instance = AuthenticationMagicAuthFailedDataError.from_dict(data) + serialized = instance.to_dict() + assert "radar_detection_id" not in serialized + def test_authentication_magic_auth_succeeded_round_trip(self): data = load_fixture("authentication_magic_auth_succeeded.json") instance = AuthenticationMagicAuthSucceeded.from_dict(data) @@ -6208,6 +6123,7 @@ def test_authentication_mfa_failed_minimal_payload(self): "error": { "code": "mfa_challenge_failed", "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X", }, }, "created_at": "2026-01-15T12:00:00.000Z", @@ -6235,6 +6151,7 @@ def test_authentication_mfa_failed_omits_absent_optional_non_nullable_fields(sel "error": { "code": "mfa_challenge_failed", "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X", }, }, "created_at": "2026-01-15T12:00:00.000Z", @@ -6262,6 +6179,7 @@ def test_authentication_mfa_failed_data_minimal_payload(self): "error": { "code": "mfa_challenge_failed", "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X", }, } instance = AuthenticationMFAFailedData.from_dict(data) @@ -6285,6 +6203,7 @@ def test_authentication_mfa_failed_data_preserves_nullable_fields(self): "error": { "code": "mfa_challenge_failed", "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X", }, } instance = AuthenticationMFAFailedData.from_dict(data) @@ -6312,6 +6231,17 @@ def test_authentication_mfa_failed_data_error_minimal_payload(self): assert serialized["code"] == data["code"] assert serialized["message"] == data["message"] + def test_authentication_mfa_failed_data_error_omits_absent_optional_non_nullable_fields( + self, + ): + data = { + "code": "mfa_challenge_failed", + "message": "The MFA challenge has failed.", + } + instance = AuthenticationMFAFailedDataError.from_dict(data) + serialized = instance.to_dict() + assert "radar_detection_id" not in serialized + def test_authentication_mfa_succeeded_round_trip(self): data = load_fixture("authentication_mfa_succeeded.json") instance = AuthenticationMFASucceeded.from_dict(data) @@ -6427,6 +6357,7 @@ def test_authentication_oauth_failed_minimal_payload(self): "error": { "code": "mfa_challenge_failed", "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X", }, "provider": "GoogleOAuth", }, @@ -6457,6 +6388,7 @@ def test_authentication_oauth_failed_omits_absent_optional_non_nullable_fields( "error": { "code": "mfa_challenge_failed", "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X", }, "provider": "GoogleOAuth", }, @@ -6485,6 +6417,7 @@ def test_authentication_oauth_failed_data_minimal_payload(self): "error": { "code": "mfa_challenge_failed", "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X", }, } instance = AuthenticationOAuthFailedData.from_dict(data) @@ -6510,6 +6443,7 @@ def test_authentication_oauth_failed_data_omits_absent_optional_non_nullable_fie "error": { "code": "mfa_challenge_failed", "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X", }, } instance = AuthenticationOAuthFailedData.from_dict(data) @@ -6527,6 +6461,7 @@ def test_authentication_oauth_failed_data_preserves_nullable_fields(self): "error": { "code": "mfa_challenge_failed", "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X", }, "provider": "GoogleOAuth", } @@ -6555,6 +6490,17 @@ def test_authentication_oauth_failed_data_error_minimal_payload(self): assert serialized["code"] == data["code"] assert serialized["message"] == data["message"] + def test_authentication_oauth_failed_data_error_omits_absent_optional_non_nullable_fields( + self, + ): + data = { + "code": "mfa_challenge_failed", + "message": "The MFA challenge has failed.", + } + instance = AuthenticationOAuthFailedDataError.from_dict(data) + serialized = instance.to_dict() + assert "radar_detection_id" not in serialized + def test_authentication_oauth_succeeded_round_trip(self): data = load_fixture("authentication_oauth_succeeded.json") instance = AuthenticationOAuthSucceeded.from_dict(data) @@ -6689,6 +6635,7 @@ def test_authentication_passkey_failed_minimal_payload(self): "error": { "code": "mfa_challenge_failed", "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X", }, }, "created_at": "2026-01-15T12:00:00.000Z", @@ -6718,6 +6665,7 @@ def test_authentication_passkey_failed_omits_absent_optional_non_nullable_fields "error": { "code": "mfa_challenge_failed", "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X", }, }, "created_at": "2026-01-15T12:00:00.000Z", @@ -6745,6 +6693,7 @@ def test_authentication_passkey_failed_data_minimal_payload(self): "error": { "code": "mfa_challenge_failed", "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X", }, } instance = AuthenticationPasskeyFailedData.from_dict(data) @@ -6768,6 +6717,7 @@ def test_authentication_passkey_failed_data_preserves_nullable_fields(self): "error": { "code": "mfa_challenge_failed", "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X", }, } instance = AuthenticationPasskeyFailedData.from_dict(data) @@ -6795,6 +6745,17 @@ def test_authentication_passkey_failed_data_error_minimal_payload(self): assert serialized["code"] == data["code"] assert serialized["message"] == data["message"] + def test_authentication_passkey_failed_data_error_omits_absent_optional_non_nullable_fields( + self, + ): + data = { + "code": "mfa_challenge_failed", + "message": "The MFA challenge has failed.", + } + instance = AuthenticationPasskeyFailedDataError.from_dict(data) + serialized = instance.to_dict() + assert "radar_detection_id" not in serialized + def test_authentication_passkey_succeeded_round_trip(self): data = load_fixture("authentication_passkey_succeeded.json") instance = AuthenticationPasskeySucceeded.from_dict(data) @@ -6910,6 +6871,7 @@ def test_authentication_password_failed_minimal_payload(self): "error": { "code": "mfa_challenge_failed", "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X", }, }, "created_at": "2026-01-15T12:00:00.000Z", @@ -6939,6 +6901,7 @@ def test_authentication_password_failed_omits_absent_optional_non_nullable_field "error": { "code": "mfa_challenge_failed", "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X", }, }, "created_at": "2026-01-15T12:00:00.000Z", @@ -6966,6 +6929,7 @@ def test_authentication_password_failed_data_minimal_payload(self): "error": { "code": "mfa_challenge_failed", "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X", }, } instance = AuthenticationPasswordFailedData.from_dict(data) @@ -6989,6 +6953,7 @@ def test_authentication_password_failed_data_preserves_nullable_fields(self): "error": { "code": "mfa_challenge_failed", "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X", }, } instance = AuthenticationPasswordFailedData.from_dict(data) @@ -7016,6 +6981,17 @@ def test_authentication_password_failed_data_error_minimal_payload(self): assert serialized["code"] == data["code"] assert serialized["message"] == data["message"] + def test_authentication_password_failed_data_error_omits_absent_optional_non_nullable_fields( + self, + ): + data = { + "code": "mfa_challenge_failed", + "message": "The MFA challenge has failed.", + } + instance = AuthenticationPasswordFailedDataError.from_dict(data) + serialized = instance.to_dict() + assert "radar_detection_id" not in serialized + def test_authentication_password_succeeded_round_trip(self): data = load_fixture("authentication_password_succeeded.json") instance = AuthenticationPasswordSucceeded.from_dict(data) @@ -7130,6 +7106,7 @@ def test_authentication_radar_risk_detected_minimal_payload(self): "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X", }, "created_at": "2026-01-15T12:00:00.000Z", } @@ -7157,6 +7134,7 @@ def test_authentication_radar_risk_detected_omits_absent_optional_non_nullable_f "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X", }, "created_at": "2026-01-15T12:00:00.000Z", } @@ -7194,6 +7172,23 @@ def test_authentication_radar_risk_detected_data_minimal_payload(self): assert serialized["user_id"] == data["user_id"] assert serialized["email"] == data["email"] + def test_authentication_radar_risk_detected_data_omits_absent_optional_non_nullable_fields( + self, + ): + data = { + "auth_method": "password", + "action": "signup", + "control": "block", + "blocklist_type": "ip", + "ip_address": "203.0.113.42", + "user_agent": "Mozilla/5.0", + "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", + "email": "user@example.com", + } + instance = AuthenticationRadarRiskDetectedData.from_dict(data) + serialized = instance.to_dict() + assert "radar_detection_id" not in serialized + def test_authentication_radar_risk_detected_data_preserves_nullable_fields(self): data = { "auth_method": "password", @@ -7204,6 +7199,7 @@ def test_authentication_radar_risk_detected_data_preserves_nullable_fields(self) "user_agent": None, "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X", } instance = AuthenticationRadarRiskDetectedData.from_dict(data) serialized = instance.to_dict() @@ -7224,6 +7220,7 @@ def test_authentication_radar_risk_detected_data_round_trips_unknown_enum_values "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X", } instance = AuthenticationRadarRiskDetectedData.from_dict(data) assert instance.to_dict() == data @@ -7350,6 +7347,7 @@ def test_authentication_sso_failed_minimal_payload(self): "error": { "code": "mfa_challenge_failed", "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X", }, }, "created_at": "2026-01-15T12:00:00.000Z", @@ -7382,6 +7380,7 @@ def test_authentication_sso_failed_omits_absent_optional_non_nullable_fields(sel "error": { "code": "mfa_challenge_failed", "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X", }, }, "created_at": "2026-01-15T12:00:00.000Z", @@ -7414,6 +7413,7 @@ def test_authentication_sso_failed_data_minimal_payload(self): "error": { "code": "mfa_challenge_failed", "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X", }, } instance = AuthenticationSSOFailedData.from_dict(data) @@ -7443,6 +7443,7 @@ def test_authentication_sso_failed_data_preserves_nullable_fields(self): "error": { "code": "mfa_challenge_failed", "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X", }, } instance = AuthenticationSSOFailedData.from_dict(data) @@ -7494,6 +7495,17 @@ def test_authentication_sso_failed_data_error_minimal_payload(self): assert serialized["code"] == data["code"] assert serialized["message"] == data["message"] + def test_authentication_sso_failed_data_error_omits_absent_optional_non_nullable_fields( + self, + ): + data = { + "code": "mfa_challenge_failed", + "message": "The MFA challenge has failed.", + } + instance = AuthenticationSSOFailedDataError.from_dict(data) + serialized = instance.to_dict() + assert "radar_detection_id" not in serialized + def test_authentication_sso_started_round_trip(self): data = load_fixture("authentication_sso_started.json") instance = AuthenticationSSOStarted.from_dict(data) @@ -7797,6 +7809,7 @@ def test_authentication_sso_timed_out_minimal_payload(self): "error": { "code": "mfa_challenge_failed", "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X", }, }, "created_at": "2026-01-15T12:00:00.000Z", @@ -7831,6 +7844,7 @@ def test_authentication_sso_timed_out_omits_absent_optional_non_nullable_fields( "error": { "code": "mfa_challenge_failed", "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X", }, }, "created_at": "2026-01-15T12:00:00.000Z", @@ -7863,6 +7877,7 @@ def test_authentication_sso_timed_out_data_minimal_payload(self): "error": { "code": "mfa_challenge_failed", "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X", }, } instance = AuthenticationSSOTimedOutData.from_dict(data) @@ -7892,6 +7907,7 @@ def test_authentication_sso_timed_out_data_preserves_nullable_fields(self): "error": { "code": "mfa_challenge_failed", "message": "The MFA challenge has failed.", + "radar_detection_id": "detection_01HZBC6N1EB1ZY7KG32X", }, } instance = AuthenticationSSOTimedOutData.from_dict(data) @@ -7943,6 +7959,17 @@ def test_authentication_sso_timed_out_data_error_minimal_payload(self): assert serialized["code"] == data["code"] assert serialized["message"] == data["message"] + def test_authentication_sso_timed_out_data_error_omits_absent_optional_non_nullable_fields( + self, + ): + data = { + "code": "mfa_challenge_failed", + "message": "The MFA challenge has failed.", + } + instance = AuthenticationSSOTimedOutDataError.from_dict(data) + serialized = instance.to_dict() + assert "radar_detection_id" not in serialized + def test_connection_activated_round_trip(self): data = load_fixture("connection_activated.json") instance = ConnectionActivated.from_dict(data) @@ -19826,32 +19853,6 @@ def test_data_integration_credentials_response_with_error_round_trips_unknown_en instance = DataIntegrationCredentialsResponseWithError.from_dict(data) assert instance.to_dict() == data - def test_directory_user_email_round_trip(self): - data = load_fixture("directory_user_email.json") - instance = DirectoryUserEmail.from_dict(data) - serialized = instance.to_dict() - assert serialized == data - restored = DirectoryUserEmail.from_dict(serialized) - assert restored.to_dict() == serialized - - def test_directory_user_email_minimal_payload(self): - data = {} - instance = DirectoryUserEmail.from_dict(data) - assert instance.to_dict() is not None - - def test_directory_user_email_omits_absent_optional_non_nullable_fields(self): - data = {"value": "marcelina.davis@example.com"} - instance = DirectoryUserEmail.from_dict(data) - serialized = instance.to_dict() - assert "primary" not in serialized - assert "type" not in serialized - - def test_directory_user_email_preserves_nullable_fields(self): - data = {"primary": True, "type": "work", "value": None} - instance = DirectoryUserEmail.from_dict(data) - serialized = instance.to_dict() - assert serialized["value"] is None - def test_event_context_google_analytics_session_round_trip(self): data = load_fixture("event_context_google_analytics_session.json") instance = EventContextGoogleAnalyticsSession.from_dict(data) @@ -19875,23 +19876,21 @@ def test_event_context_google_analytics_session_omits_absent_optional_non_nullab assert "sessionId" not in serialized assert "sessionNumber" not in serialized - def test_sso_required_oauth_error_body_with_connection_ids_list_email_pending_authentication_token_round_trip( + def test_sso_required_oauth_error_body_with_connection_ids_list_email_round_trip( self, ): data = load_fixture( - "sso_required_oauth_error_body_with_connection_ids_list_email_pending_authentication_token.json" - ) - instance = SSORequiredOAuthErrorBodyWithConnectionIdsListEmailPendingAuthenticationToken.from_dict( - data + "sso_required_oauth_error_body_with_connection_ids_list_email.json" ) + instance = SSORequiredOAuthErrorBodyWithConnectionIdsListEmail.from_dict(data) serialized = instance.to_dict() assert serialized == data - restored = SSORequiredOAuthErrorBodyWithConnectionIdsListEmailPendingAuthenticationToken.from_dict( + restored = SSORequiredOAuthErrorBodyWithConnectionIdsListEmail.from_dict( serialized ) assert restored.to_dict() == serialized - def test_sso_required_oauth_error_body_with_connection_ids_list_email_pending_authentication_token_minimal_payload( + def test_sso_required_oauth_error_body_with_connection_ids_list_email_minimal_payload( self, ): data = { @@ -19900,16 +19899,14 @@ def test_sso_required_oauth_error_body_with_connection_ids_list_email_pending_au "connection_ids": ["connection_ids_01234"], "email": "user@example.com", } - instance = SSORequiredOAuthErrorBodyWithConnectionIdsListEmailPendingAuthenticationToken.from_dict( - data - ) + instance = SSORequiredOAuthErrorBodyWithConnectionIdsListEmail.from_dict(data) serialized = instance.to_dict() assert serialized["error"] == data["error"] assert serialized["error_description"] == data["error_description"] assert serialized["connection_ids"] == data["connection_ids"] assert serialized["email"] == data["email"] - def test_sso_required_oauth_error_body_with_connection_ids_list_email_pending_authentication_token_omits_absent_optional_non_nullable_fields( + def test_sso_required_oauth_error_body_with_connection_ids_list_email_omits_absent_optional_non_nullable_fields( self, ): data = { @@ -19918,8 +19915,6 @@ def test_sso_required_oauth_error_body_with_connection_ids_list_email_pending_au "connection_ids": ["connection_ids_01234"], "email": "user@example.com", } - instance = SSORequiredOAuthErrorBodyWithConnectionIdsListEmailPendingAuthenticationToken.from_dict( - data - ) + instance = SSORequiredOAuthErrorBodyWithConnectionIdsListEmail.from_dict(data) serialized = instance.to_dict() assert "pending_authentication_token" not in serialized diff --git a/tests/test_directory_sync.py b/tests/test_directory_sync.py index 68bf109c3..5d7e42d69 100644 --- a/tests/test_directory_sync.py +++ b/tests/test_directory_sync.py @@ -14,7 +14,7 @@ UnprocessableEntityError, ) from workos._pagination import AsyncPage, SyncPage -from workos.common.models import DirectoryGroup, PaginationOrder +from workos.common.models import DirectoryGroup, DirectoryUser, PaginationOrder from workos.directory_sync.models import ( Directory, DirectorySyncResponse, @@ -89,6 +89,106 @@ def test_create_directory_sync(self, workos, httpx_mock): assert request.method == "POST" assert request.url.path.endswith("/directories/test_id/sync") + def test_list_directory_groups(self, workos, httpx_mock): + httpx_mock.add_response( + json=load_fixture("list_directory_group.json"), + ) + page = workos.directory_sync.list_directory_groups("test_directoryId") + assert isinstance(page, SyncPage) + assert len(page.data) == 1 + assert isinstance(page.data[0], DirectoryGroup) + + def test_list_directory_groups_empty_page(self, workos, httpx_mock): + httpx_mock.add_response(json={"data": [], "list_metadata": {}}) + page = workos.directory_sync.list_directory_groups("test_directoryId") + assert isinstance(page, SyncPage) + assert page.data == [] + + def test_list_directory_groups_encodes_query_params(self, workos, httpx_mock): + httpx_mock.add_response(json={"data": [], "list_metadata": {}}) + workos.directory_sync.list_directory_groups( + "test_directoryId", + limit=10, + before="cursor before", + after="cursor/after", + order=PaginationOrder("value_order"), + user="value user/test", + ) + request = httpx_mock.get_request() + assert request.url.params["limit"] == "10" + assert request.url.params["before"] == "cursor before" + assert request.url.params["after"] == "cursor/after" + assert request.url.params["order"] == "value_order" + assert request.url.params["user"] == "value user/test" + + def test_get_directory_group(self, workos, httpx_mock): + httpx_mock.add_response( + json=load_fixture("directory_group.json"), + ) + result = workos.directory_sync.get_directory_group( + "test_directoryId", "test_groupId" + ) + assert isinstance(result, DirectoryGroup) + assert result.object == "directory_group" + assert result.id == "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z" + request = httpx_mock.get_request() + assert request.method == "GET" + assert request.url.path.endswith( + "/directories/test_directoryId/groups/test_groupId" + ) + + def test_list_directory_users(self, workos, httpx_mock): + httpx_mock.add_response( + json=load_fixture("list_directory_user.json"), + ) + page = workos.directory_sync.list_directory_users("test_directoryId") + assert isinstance(page, SyncPage) + assert len(page.data) == 1 + assert isinstance(page.data[0], DirectoryUser) + + def test_list_directory_users_empty_page(self, workos, httpx_mock): + httpx_mock.add_response(json={"data": [], "list_metadata": {}}) + page = workos.directory_sync.list_directory_users("test_directoryId") + assert isinstance(page, SyncPage) + assert page.data == [] + + def test_list_directory_users_encodes_query_params(self, workos, httpx_mock): + httpx_mock.add_response(json={"data": [], "list_metadata": {}}) + workos.directory_sync.list_directory_users( + "test_directoryId", + limit=10, + before="cursor before", + after="cursor/after", + order=PaginationOrder("value_order"), + group="value group/test", + idp_id="value idp_id/test", + email="value email/test", + ) + request = httpx_mock.get_request() + assert request.url.params["limit"] == "10" + assert request.url.params["before"] == "cursor before" + assert request.url.params["after"] == "cursor/after" + assert request.url.params["order"] == "value_order" + assert request.url.params["group"] == "value group/test" + assert request.url.params["idp_id"] == "value idp_id/test" + assert request.url.params["email"] == "value email/test" + + def test_get_directory_user(self, workos, httpx_mock): + httpx_mock.add_response( + json=load_fixture("directory_user.json"), + ) + result = workos.directory_sync.get_directory_user( + "test_directoryId", "test_userId" + ) + assert isinstance(result, DirectoryUser) + assert result.object == "directory_user" + assert result.id == "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ" + request = httpx_mock.get_request() + assert request.method == "GET" + assert request.url.path.endswith( + "/directories/test_directoryId/users/test_userId" + ) + def test_list_groups(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("list_directory_group.json"), @@ -328,6 +428,118 @@ async def test_create_directory_sync(self, async_workos, httpx_mock): assert request.method == "POST" assert request.url.path.endswith("/directories/test_id/sync") + @pytest.mark.asyncio + async def test_list_directory_groups(self, async_workos, httpx_mock): + httpx_mock.add_response(json=load_fixture("list_directory_group.json")) + page = await async_workos.directory_sync.list_directory_groups( + "test_directoryId" + ) + assert isinstance(page, AsyncPage) + assert len(page.data) == 1 + assert isinstance(page.data[0], DirectoryGroup) + + @pytest.mark.asyncio + async def test_list_directory_groups_empty_page(self, async_workos, httpx_mock): + httpx_mock.add_response(json={"data": [], "list_metadata": {}}) + page = await async_workos.directory_sync.list_directory_groups( + "test_directoryId" + ) + assert isinstance(page, AsyncPage) + assert page.data == [] + + @pytest.mark.asyncio + async def test_list_directory_groups_encodes_query_params( + self, async_workos, httpx_mock + ): + httpx_mock.add_response(json={"data": [], "list_metadata": {}}) + await async_workos.directory_sync.list_directory_groups( + "test_directoryId", + limit=10, + before="cursor before", + after="cursor/after", + order=PaginationOrder("value_order"), + user="value user/test", + ) + request = httpx_mock.get_request() + assert request.url.params["limit"] == "10" + assert request.url.params["before"] == "cursor before" + assert request.url.params["after"] == "cursor/after" + assert request.url.params["order"] == "value_order" + assert request.url.params["user"] == "value user/test" + + @pytest.mark.asyncio + async def test_get_directory_group(self, async_workos, httpx_mock): + httpx_mock.add_response(json=load_fixture("directory_group.json")) + result = await async_workos.directory_sync.get_directory_group( + "test_directoryId", "test_groupId" + ) + assert isinstance(result, DirectoryGroup) + assert result.object == "directory_group" + assert result.id == "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z" + request = httpx_mock.get_request() + assert request.method == "GET" + assert request.url.path.endswith( + "/directories/test_directoryId/groups/test_groupId" + ) + + @pytest.mark.asyncio + async def test_list_directory_users(self, async_workos, httpx_mock): + httpx_mock.add_response(json=load_fixture("list_directory_user.json")) + page = await async_workos.directory_sync.list_directory_users( + "test_directoryId" + ) + assert isinstance(page, AsyncPage) + assert len(page.data) == 1 + assert isinstance(page.data[0], DirectoryUser) + + @pytest.mark.asyncio + async def test_list_directory_users_empty_page(self, async_workos, httpx_mock): + httpx_mock.add_response(json={"data": [], "list_metadata": {}}) + page = await async_workos.directory_sync.list_directory_users( + "test_directoryId" + ) + assert isinstance(page, AsyncPage) + assert page.data == [] + + @pytest.mark.asyncio + async def test_list_directory_users_encodes_query_params( + self, async_workos, httpx_mock + ): + httpx_mock.add_response(json={"data": [], "list_metadata": {}}) + await async_workos.directory_sync.list_directory_users( + "test_directoryId", + limit=10, + before="cursor before", + after="cursor/after", + order=PaginationOrder("value_order"), + group="value group/test", + idp_id="value idp_id/test", + email="value email/test", + ) + request = httpx_mock.get_request() + assert request.url.params["limit"] == "10" + assert request.url.params["before"] == "cursor before" + assert request.url.params["after"] == "cursor/after" + assert request.url.params["order"] == "value_order" + assert request.url.params["group"] == "value group/test" + assert request.url.params["idp_id"] == "value idp_id/test" + assert request.url.params["email"] == "value email/test" + + @pytest.mark.asyncio + async def test_get_directory_user(self, async_workos, httpx_mock): + httpx_mock.add_response(json=load_fixture("directory_user.json")) + result = await async_workos.directory_sync.get_directory_user( + "test_directoryId", "test_userId" + ) + assert isinstance(result, DirectoryUser) + assert result.object == "directory_user" + assert result.id == "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ" + request = httpx_mock.get_request() + assert request.method == "GET" + assert request.url.path.endswith( + "/directories/test_directoryId/users/test_userId" + ) + @pytest.mark.asyncio async def test_list_groups(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("list_directory_group.json")) diff --git a/tests/test_directory_sync_models_round_trip.py b/tests/test_directory_sync_models_round_trip.py index 3864abaf1..8af231cd6 100644 --- a/tests/test_directory_sync_models_round_trip.py +++ b/tests/test_directory_sync_models_round_trip.py @@ -9,6 +9,8 @@ DirectoryMetadata, DirectoryMetadataUser, DirectorySyncResponse, + DirectoryUser, + DirectoryUserEmail, DirectoryUserWithGroups, DirectoryUserWithGroupsEmail, ) @@ -140,6 +142,147 @@ def test_directory_group_omits_absent_optional_non_nullable_fields(self): serialized = instance.to_dict() assert "raw_attributes" not in serialized + def test_directory_user_round_trip(self): + data = load_fixture("directory_user.json") + instance = DirectoryUser.from_dict(data) + serialized = instance.to_dict() + assert serialized == data + restored = DirectoryUser.from_dict(serialized) + assert restored.to_dict() == serialized + + def test_directory_user_minimal_payload(self): + data = { + "object": "directory_user", + "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", + "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", + "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", + "idp_id": "2836", + "email": None, + "state": "active", + "raw_attributes": {"key": {}}, + "custom_attributes": { + "department": "Engineering", + "job_title": "Software Engineer", + }, + "created_at": "2026-01-15T12:00:00.000Z", + "updated_at": "2026-01-15T12:00:00.000Z", + } + instance = DirectoryUser.from_dict(data) + serialized = instance.to_dict() + assert serialized["object"] == data["object"] + assert serialized["id"] == data["id"] + assert serialized["directory_id"] == data["directory_id"] + assert serialized["organization_id"] == data["organization_id"] + assert serialized["idp_id"] == data["idp_id"] + assert serialized["email"] == data["email"] + assert serialized["state"] == data["state"] + assert serialized["raw_attributes"] == data["raw_attributes"] + assert serialized["custom_attributes"] == data["custom_attributes"] + assert serialized["created_at"] == data["created_at"] + assert serialized["updated_at"] == data["updated_at"] + + def test_directory_user_omits_absent_optional_non_nullable_fields(self): + data = { + "object": "directory_user", + "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", + "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", + "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", + "idp_id": "2836", + "email": "marcelina.davis@example.com", + "first_name": "Marcelina", + "last_name": "Davis", + "name": "Marcelina Davis", + "job_title": "Software Engineer", + "username": "mdavis", + "state": "active", + "raw_attributes": {"key": {}}, + "custom_attributes": { + "department": "Engineering", + "job_title": "Software Engineer", + }, + "created_at": "2026-01-15T12:00:00.000Z", + "updated_at": "2026-01-15T12:00:00.000Z", + } + instance = DirectoryUser.from_dict(data) + serialized = instance.to_dict() + assert "emails" not in serialized + assert "role" not in serialized + assert "roles" not in serialized + + def test_directory_user_preserves_nullable_fields(self): + data = { + "object": "directory_user", + "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", + "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", + "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", + "idp_id": "2836", + "email": None, + "first_name": None, + "last_name": None, + "name": None, + "emails": [ + { + "primary": True, + "type": "work", + "value": "marcelina.davis@example.com", + } + ], + "job_title": None, + "username": None, + "state": "active", + "raw_attributes": {"key": {}}, + "custom_attributes": { + "department": "Engineering", + "job_title": "Software Engineer", + }, + "role": {"slug": "admin"}, + "roles": [{"slug": "admin"}], + "created_at": "2026-01-15T12:00:00.000Z", + "updated_at": "2026-01-15T12:00:00.000Z", + } + instance = DirectoryUser.from_dict(data) + serialized = instance.to_dict() + assert serialized["email"] is None + assert serialized["first_name"] is None + assert serialized["last_name"] is None + assert serialized["name"] is None + assert serialized["job_title"] is None + assert serialized["username"] is None + + def test_directory_user_round_trips_unknown_enum_values(self): + data = { + "object": "directory_user", + "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", + "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", + "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", + "idp_id": "2836", + "email": "marcelina.davis@example.com", + "first_name": "Marcelina", + "last_name": "Davis", + "name": "Marcelina Davis", + "emails": [ + { + "primary": True, + "type": "work", + "value": "marcelina.davis@example.com", + } + ], + "job_title": "Software Engineer", + "username": "mdavis", + "state": "unexpected_directory_user_state", + "raw_attributes": {"key": {}}, + "custom_attributes": { + "department": "Engineering", + "job_title": "Software Engineer", + }, + "role": {"slug": "admin"}, + "roles": [{"slug": "admin"}], + "created_at": "2026-01-15T12:00:00.000Z", + "updated_at": "2026-01-15T12:00:00.000Z", + } + instance = DirectoryUser.from_dict(data) + assert instance.to_dict() == data + def test_directory_user_with_groups_round_trip(self): data = load_fixture("directory_user_with_groups.json") instance = DirectoryUserWithGroups.from_dict(data) @@ -362,6 +505,32 @@ def test_directory_user_with_groups_email_preserves_nullable_fields(self): serialized = instance.to_dict() assert serialized["value"] is None + def test_directory_user_email_round_trip(self): + data = load_fixture("directory_user_email.json") + instance = DirectoryUserEmail.from_dict(data) + serialized = instance.to_dict() + assert serialized == data + restored = DirectoryUserEmail.from_dict(serialized) + assert restored.to_dict() == serialized + + def test_directory_user_email_minimal_payload(self): + data = {} + instance = DirectoryUserEmail.from_dict(data) + assert instance.to_dict() is not None + + def test_directory_user_email_omits_absent_optional_non_nullable_fields(self): + data = {"value": "marcelina.davis@example.com"} + instance = DirectoryUserEmail.from_dict(data) + serialized = instance.to_dict() + assert "primary" not in serialized + assert "type" not in serialized + + def test_directory_user_email_preserves_nullable_fields(self): + data = {"primary": True, "type": "work", "value": None} + instance = DirectoryUserEmail.from_dict(data) + serialized = instance.to_dict() + assert serialized["value"] is None + def test_directory_metadata_round_trip(self): data = load_fixture("directory_metadata.json") instance = DirectoryMetadata.from_dict(data) From 829b2868728888c8b93e1cb148fbe0f992083799 Mon Sep 17 00:00:00 2001 From: "workos-sdk-automation[bot]" <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Date: Fri, 13 Nov 2026 20:15:29 +0000 Subject: [PATCH 3/3] chore(generated): add release notes fragment --- ...4538c87e0ffd5ebd0cbd7fc2092129e13ec0b60.md | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .changelog-pending/2026-11-13T20-15-29-d4538c87e0ffd5ebd0cbd7fc2092129e13ec0b60.md diff --git a/.changelog-pending/2026-11-13T20-15-29-d4538c87e0ffd5ebd0cbd7fc2092129e13ec0b60.md b/.changelog-pending/2026-11-13T20-15-29-d4538c87e0ffd5ebd0cbd7fc2092129e13ec0b60.md new file mode 100644 index 000000000..d81c1058b --- /dev/null +++ b/.changelog-pending/2026-11-13T20-15-29-d4538c87e0ffd5ebd0cbd7fc2092129e13ec0b60.md @@ -0,0 +1,70 @@ +* [#777](https://github.com/workos/workos-python/pull/777) feat(generated): regenerate from spec (1 change) + + **⚠️ Breaking** + * **[directory_sync](https://workos.com/docs/reference/directory-sync)**: + * Added parameter `Directories.find.directoryId` + * Added parameter `Directories.find.groupId` + * Removed parameter `Directories.find.id` + * Changed path for endpoint `GET /directories/{directoryId}/groups/{groupId}` + * Changed server default for parameter `DirectoryGroups.list` + * Changed server default for parameter `DirectoryGroups.find` + * Changed server default for parameter `DirectoryUsers.list` + * Changed server default for parameter `DirectoryUsers.find` + + **Features** + * **[directory_sync](https://workos.com/docs/reference/directory-sync)**: + * Added endpoint `GET /directories/{id}` + * Added endpoint `GET /directories/{directoryId}/groups` + * Added endpoint `GET /directories/{directoryId}/users` + * Added endpoint `GET /directories/{directoryId}/users/{userId}` + * **[multi_factor_auth](https://workos.com/docs/reference/authkit/mfa)**: + * Added model `TooManyFailedVerificationAttemptsErrorBodyWithRetryAfter` + * Changed errors for endpoint `POST /auth/challenges/{id}/verify` + * **[pipes](https://workos.com/docs/reference/pipes)**: + * Added `config` to `CreateOrganizationConnectedAccount` + * Added `metadata` to `CreateOrganizationConnectedAccount` + * Added `config` to `OrganizationConnectedAccount` + * Added `config` to `CreateConnectedAccount` + * Added `metadata` to `CreateConnectedAccount` + * Added `config` to `ConnectedAccountInput` + * Added `too_many_failed_verification_attempts` to `ErrorBodyCode` + * Added `ip_address_required` to `ErrorBodyCode` + * Added enum `PipesProviderOwnership` + * Added parameter `PipesProvider.listForOrganization.ownership` + * Changed errors for endpoint `GET /organizations/{organizationId}/data_integration_configurations` + * Added parameter `PipesProvider.configure.ownership` + * **[user_management](https://workos.com/docs/reference/authkit/user)**: + * Added `radar_detection_id` to `PolicyDeniedErrorBody` + * **[webhooks](https://workos.com/docs/reference/webhooks)**: + * Added `feature_flags.flag.created` to `CreateWebhookEndpointEvents` + * Added `feature_flags.flag.updated` to `CreateWebhookEndpointEvents` + * Added `feature_flags.flag.deleted` to `CreateWebhookEndpointEvents` + * Added `feature_flags.flag_rule.created` to `CreateWebhookEndpointEvents` + * Added `feature_flags.flag_rule.updated` to `CreateWebhookEndpointEvents` + * Added `feature_flags.flag_target.created` to `CreateWebhookEndpointEvents` + * Added `feature_flags.flag_rule.deleted` to `CreateWebhookEndpointEvents` + * Added `feature_flags.flag_target.deleted` to `CreateWebhookEndpointEvents` + * Added `feature_flags.flag.created` to `UpdateWebhookEndpointEvents` + * Added `feature_flags.flag.updated` to `UpdateWebhookEndpointEvents` + * Added `feature_flags.flag.deleted` to `UpdateWebhookEndpointEvents` + * Added `feature_flags.flag_rule.created` to `UpdateWebhookEndpointEvents` + * Added `feature_flags.flag_rule.updated` to `UpdateWebhookEndpointEvents` + * Added `feature_flags.flag_target.created` to `UpdateWebhookEndpointEvents` + * Added `feature_flags.flag_rule.deleted` to `UpdateWebhookEndpointEvents` + * Added `feature_flags.flag_target.deleted` to `UpdateWebhookEndpointEvents` + + **Fixes** + * **[directory_sync](https://workos.com/docs/reference/directory-sync)**: + * Changed response of `Directories.find` from `Directory` to `DirectoryGroup` + * Updated endpoint `GET /directory_groups` + * Updated endpoint `GET /directory_groups/{id}` + * Updated endpoint `GET /directory_users` + * Updated endpoint `GET /directory_users/{id}` + * **[events](https://workos.com/docs/reference/events)**: + * Updated model `EventSchema` + * **[pipes](https://workos.com/docs/reference/pipes)**: + * Removed `policy_denied` from `ErrorBodyCode` + * **[user_management](https://workos.com/docs/reference/authkit/user)**: + * Changed errors for endpoint `POST /user_management/users` + * Changed errors for endpoint `POST /user_management/magic_auth` + * Changed errors for endpoint `POST /user_management/authenticate`