diff --git a/.changelog-pending/2026-09-16T19-24-23-949c30cb87778129af801fadc33546518853d045.md b/.changelog-pending/2026-09-16T19-24-23-949c30cb87778129af801fadc33546518853d045.md new file mode 100644 index 00000000..744a55f6 --- /dev/null +++ b/.changelog-pending/2026-09-16T19-24-23-949c30cb87778129af801fadc33546518853d045.md @@ -0,0 +1,40 @@ +* [#732](https://github.com/workos/workos-python/pull/732) fix(generated): regenerate from spec (1 change) + + **Features** + * **[multi_factor_auth](https://workos.com/docs/reference/authkit/mfa)**: + * Changed errors for endpoint `POST /auth/factors/{id}/challenge` + * **[pipes](https://workos.com/docs/reference/pipes)**: + * Added `connection_owner` to `DataIntegrationsListResponseData` + * Added enum `DataIntegrationsListResponseDataConnectionOwner` + * Added `connection_role` to `DataIntegrationsListResponseDataConnectedAccount` + * Added `account_identifier` to `DataIntegrationsListResponseDataConnectedAccount` + * Added `account_display_name` to `DataIntegrationsListResponseDataConnectedAccount` + * Added enum `DataIntegrationsListResponseDataConnectedAccountConnectionRole` + * Added `connection_role` to `DataIntegrationInstallation` + * Added `account_identifier` to `DataIntegrationInstallation` + * Added `account_display_name` to `DataIntegrationInstallation` + * Added enum `DataIntegrationInstallationConnectionRole` + * Added `connection_owner` to `DataIntegrationsGetDataIntegrationAuthorizeUrlRequest` + * Added enum `DataIntegrationsGetDataIntegrationAuthorizeUrlRequestConnectionOwner` + * **[connect](https://workos.com/docs/reference/workos-connect/standalone)**: + * Added `connection_role` to `ConnectedAccount` + * Added `account_identifier` to `ConnectedAccount` + * Added `account_display_name` to `ConnectedAccount` + * Added enum `ConnectedAccountConnectionRole` + * **[organizations](https://workos.com/docs/reference/organization)**: + * Added service `OrganizationsDataProviders` + * **[webhooks](https://workos.com/docs/reference/webhooks)**: + * Added `pipes.account_connection.add_failed` to `CreateWebhookEndpointEvents` + * Added `pipes.account_connection.connected` to `CreateWebhookEndpointEvents` + * Added `pipes.account_connection.connection_failed` to `CreateWebhookEndpointEvents` + * Added `pipes.account_connection.disconnected` to `CreateWebhookEndpointEvents` + * Added `pipes.account_connection.reauthorization_needed` to `CreateWebhookEndpointEvents` + * Added `pipes.account_connection.add_failed` to `UpdateWebhookEndpointEvents` + * Added `pipes.account_connection.connected` to `UpdateWebhookEndpointEvents` + * Added `pipes.account_connection.connection_failed` to `UpdateWebhookEndpointEvents` + * Added `pipes.account_connection.disconnected` to `UpdateWebhookEndpointEvents` + * Added `pipes.account_connection.reauthorization_needed` to `UpdateWebhookEndpointEvents` + + **Fixes** + * **[multi_factor_auth](https://workos.com/docs/reference/authkit/mfa)**: + * Changed errors for endpoint `POST /auth/factors/{id}/challenge` diff --git a/.last-synced-sha b/.last-synced-sha index 1c2b758d..b7efc9db 100644 --- a/.last-synced-sha +++ b/.last-synced-sha @@ -1 +1 @@ -d3fa61120f8b9e73972b9dc5f4b5ea2bc0526636 +13ba15b32754d2d635b7799ab779867df2b611d6 diff --git a/.oagen-manifest.json b/.oagen-manifest.json index 587c9f92..056fa1e7 100644 --- a/.oagen-manifest.json +++ b/.oagen-manifest.json @@ -247,6 +247,8 @@ "src/workos/common/models/connect_application_oauth_redirect_uris.py", "src/workos/common/models/connected_account.py", "src/workos/common/models/connected_account_auth_method.py", + "src/workos/common/models/connected_account_connection_role.py", + "src/workos/common/models/connected_account_input.py", "src/workos/common/models/connected_account_input_state.py", "src/workos/common/models/connected_account_state.py", "src/workos/common/models/connection_activated.py", @@ -294,12 +296,19 @@ "src/workos/common/models/data_integration_credentials_input_type.py", "src/workos/common/models/data_integration_credentials_response_error.py", "src/workos/common/models/data_integration_custom_provider_authenticate_via.py", + "src/workos/common/models/data_integration_installation_connection_role.py", "src/workos/common/models/data_integration_ownership.py", "src/workos/common/models/data_integration_state.py", + "src/workos/common/models/data_integrations_get_data_integration_authorize_url_request_connection_owner.py", "src/workos/common/models/data_integrations_get_user_token_request_connection_owner.py", + "src/workos/common/models/data_integrations_list_response.py", + "src/workos/common/models/data_integrations_list_response_data.py", "src/workos/common/models/data_integrations_list_response_data_auth_methods.py", + "src/workos/common/models/data_integrations_list_response_data_connected_account.py", "src/workos/common/models/data_integrations_list_response_data_connected_account_auth_method.py", + "src/workos/common/models/data_integrations_list_response_data_connected_account_connection_role.py", "src/workos/common/models/data_integrations_list_response_data_connected_account_state.py", + "src/workos/common/models/data_integrations_list_response_data_connection_owner.py", "src/workos/common/models/data_integrations_list_response_data_ownership.py", "src/workos/common/models/data_integrations_upsert_api_key_request_connection_owner.py", "src/workos/common/models/data_integrations_upsert_client_credentials_request_connection_owner.py", @@ -483,7 +492,16 @@ "src/workos/common/models/permission_updated.py", "src/workos/common/models/permission_updated_data.py", "src/workos/common/models/pipe_connected_account.py", + "src/workos/common/models/pipe_connected_account_auth_method.py", + "src/workos/common/models/pipe_connected_account_connection_role.py", "src/workos/common/models/pipe_connected_account_state.py", + "src/workos/common/models/pipes_account_connection_add_failed.py", + "src/workos/common/models/pipes_account_connection_add_failed_data.py", + "src/workos/common/models/pipes_account_connection_connected.py", + "src/workos/common/models/pipes_account_connection_connection_failed.py", + "src/workos/common/models/pipes_account_connection_connection_failed_data.py", + "src/workos/common/models/pipes_account_connection_disconnected.py", + "src/workos/common/models/pipes_account_connection_reauthorization_needed.py", "src/workos/common/models/pipes_connected_account_connected.py", "src/workos/common/models/pipes_connected_account_connection_failed.py", "src/workos/common/models/pipes_connected_account_connection_failed_data.py", @@ -672,6 +690,9 @@ "src/workos/organizations/models/organization_input.py", "src/workos/organizations/models/update_audit_logs_retention.py", "src/workos/organizations/models/update_organization.py", + "src/workos/organizations_data_providers/__init__.py", + "src/workos/organizations_data_providers/_resource.py", + "src/workos/organizations_data_providers/models/__init__.py", "src/workos/pipes/__init__.py", "src/workos/pipes/_resource.py", "src/workos/pipes/models/__init__.py", @@ -771,6 +792,7 @@ "src/workos/types/organization_domains/__init__.py", "src/workos/types/organization_membership/__init__.py", "src/workos/types/organizations/__init__.py", + "src/workos/types/organizations_data_providers/__init__.py", "src/workos/types/pipes/__init__.py", "src/workos/types/pipes_provider/__init__.py", "src/workos/types/platform_teams/__init__.py", @@ -1366,6 +1388,13 @@ "tests/fixtures/permission_updated.json", "tests/fixtures/permission_updated_data.json", "tests/fixtures/pipe_connected_account.json", + "tests/fixtures/pipes_account_connection_add_failed.json", + "tests/fixtures/pipes_account_connection_add_failed_data.json", + "tests/fixtures/pipes_account_connection_connected.json", + "tests/fixtures/pipes_account_connection_connection_failed.json", + "tests/fixtures/pipes_account_connection_connection_failed_data.json", + "tests/fixtures/pipes_account_connection_disconnected.json", + "tests/fixtures/pipes_account_connection_reauthorization_needed.json", "tests/fixtures/pipes_connected_account_connected.json", "tests/fixtures/pipes_connected_account_connection_failed.json", "tests/fixtures/pipes_connected_account_connection_failed_data.json", @@ -1544,6 +1573,8 @@ "tests/test_organization_membership.py", "tests/test_organization_membership_models_round_trip.py", "tests/test_organizations.py", + "tests/test_organizations_data_providers.py", + "tests/test_organizations_data_providers_models_round_trip.py", "tests/test_organizations_models_round_trip.py", "tests/test_pipes.py", "tests/test_pipes_models_round_trip.py", @@ -2588,6 +2619,26 @@ "DELETE /user_management/authkit_oauth_resources/{id}": { "sdkMethod": "delete_authkit_oauth_resource", "service": "user_management" + }, + "GET /organizations/{organization_id}/connected_accounts/{slug}": { + "sdkMethod": "get_organization_connected_account", + "service": "organizations_data_providers" + }, + "POST /organizations/{organization_id}/connected_accounts/{slug}": { + "sdkMethod": "create_organization_connected_account", + "service": "organizations_data_providers" + }, + "PUT /organizations/{organization_id}/connected_accounts/{slug}": { + "sdkMethod": "update_organization_connected_account", + "service": "organizations_data_providers" + }, + "DELETE /organizations/{organization_id}/connected_accounts/{slug}": { + "sdkMethod": "delete_organization_connected_account", + "service": "organizations_data_providers" + }, + "GET /organizations/{organization_id}/data_providers": { + "sdkMethod": "list_organization_data_providers", + "service": "organizations_data_providers" } } } diff --git a/src/workos/_client.py b/src/workos/_client.py index 9776dd23..035d16f6 100644 --- a/src/workos/_client.py +++ b/src/workos/_client.py @@ -32,6 +32,10 @@ OrganizationMembershipService, ) from .organizations._resource import AsyncOrganizations, Organizations +from .organizations_data_providers._resource import ( + AsyncOrganizationsDataProviders, + OrganizationsDataProviders, +) from .passwordless import AsyncPasswordless, Passwordless from .pipes._resource import AsyncPipes, Pipes from .pipes_provider._resource import AsyncPipesProvider, PipesProvider @@ -123,6 +127,11 @@ def groups(self) -> Groups: """Groups API resources.""" return Groups(self) + @functools.cached_property + def organizations_data_providers(self) -> OrganizationsDataProviders: + """Organizations Data Providers API resources.""" + return OrganizationsDataProviders(self) + @functools.cached_property def platform_teams(self) -> PlatformTeams: """Platform Teams API resources.""" @@ -271,6 +280,11 @@ def groups(self) -> AsyncGroups: """Groups API resources.""" return AsyncGroups(self) + @functools.cached_property + def organizations_data_providers(self) -> AsyncOrganizationsDataProviders: + """Organizations Data Providers API resources.""" + return AsyncOrganizationsDataProviders(self) + @functools.cached_property def platform_teams(self) -> AsyncPlatformTeams: """Platform Teams API resources.""" diff --git a/src/workos/agents/_resource.py b/src/workos/agents/_resource.py index 34ade28a..a9325f5f 100644 --- a/src/workos/agents/_resource.py +++ b/src/workos/agents/_resource.py @@ -55,9 +55,9 @@ def list_blueprints( Args: 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`. + 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`. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: @@ -498,9 +498,9 @@ def list_instances( Args: 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`. + 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`. organization_id: Only return instances acting within this organization. agent_blueprint_id: Only return instances minted from this blueprint. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. @@ -607,9 +607,9 @@ def list_sessions( Args: 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`. + 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`. organization_id: Only return sessions of instances acting within this organization. agent_blueprint_id: Only return sessions of instances minted from this blueprint. agent_instance_id: Only return sessions belonging to this agent instance. @@ -727,9 +727,9 @@ async def list_blueprints( Args: 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`. + 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`. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: @@ -1170,9 +1170,9 @@ async def list_instances( Args: 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`. + 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`. organization_id: Only return instances acting within this organization. agent_blueprint_id: Only return instances minted from this blueprint. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. @@ -1279,9 +1279,9 @@ async def list_sessions( Args: 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`. + 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`. organization_id: Only return sessions of instances acting within this organization. agent_blueprint_id: Only return sessions of instances minted from this blueprint. agent_instance_id: Only return sessions belonging to this agent instance. diff --git a/src/workos/api_keys/models/api_key.py b/src/workos/api_keys/models/api_key.py index 05228dbb..4b941613 100644 --- a/src/workos/api_keys/models/api_key.py +++ b/src/workos/api_keys/models/api_key.py @@ -51,7 +51,8 @@ def from_dict(cls, data: dict[str, Any]) -> ApiKey: _owner_cls = _owner_disc_map.get(_owner_disc) if _owner_cls is None: raise ValueError( - f"Unknown discriminator 'type' for ApiKey.owner: {_owner_disc!r}. " + "Unknown discriminator 'type' for ApiKey.owner: " + f"{_owner_disc!r}. " f"Expected one of {sorted(_owner_disc_map)}." ) return cls( diff --git a/src/workos/authorization/_resource.py b/src/workos/authorization/_resource.py index d654d493..a1b6f72c 100644 --- a/src/workos/authorization/_resource.py +++ b/src/workos/authorization/_resource.py @@ -99,9 +99,9 @@ def list_group_role_assignments( Args: group_id: The ID of the group. 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`. + 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`. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: @@ -407,16 +407,16 @@ def list_resources_for_membership( ) -> SyncPage[AuthorizationResource]: """List resources for organization membership - Returns all child resources of a parent resource where the organization membership has a specific permission. This is useful for resource discovery—answering "What projects can this user access in this workspace?" + Returns all child resources of a parent resource where the organization membership has a specific permission. This is useful for resource discovery—answering \"What projects can this user access in this workspace?\" You must provide either `parent_resource_id` or both `parent_resource_external_id` and `parent_resource_type_slug` to identify the parent resource. Args: organization_membership_id: The ID of the organization membership. 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`. + 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`. permission_slug: The permission slug to filter by. Only child resources where the organization membership has this permission are returned. parent_resource: Identifies the parent resource. One of: ParentResourceById, ParentResourceByExternalId. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. @@ -485,9 +485,9 @@ def list_effective_permissions( organization_membership_id: The ID of the organization membership. resource_id: The ID of the authorization resource. 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`. + 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`. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: @@ -547,9 +547,9 @@ def list_effective_permissions_by_external_id( resource_type_slug: The slug of the resource type. external_id: An identifier you provide to reference the resource in your system. 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`. + 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`. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: @@ -609,9 +609,9 @@ def list_role_assignments( Args: organization_membership_id: The ID of the organization membership. 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`. + 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`. resource_id: Filter assignments by the ID of the resource. resource_external_id: Filter assignments by the external ID of the resource. resource_type_slug: Filter assignments by the slug of the resource type. @@ -1313,18 +1313,18 @@ def list_memberships_for_resource_by_external_id( ) -> SyncPage[UserOrganizationMembershipBaseListData]: """List memberships for a resource by external ID - Returns all organization memberships that have a specific permission on a resource, using the resource's external ID. This is useful for answering "Who can access this resource?" when you only have the external ID. + Returns all organization memberships that have a specific permission on a resource, using the resource's external ID. This is useful for answering \"Who can access this resource?\" when you only have the external ID. Args: organization_id: The ID of the organization that owns the resource. resource_type_slug: The slug of the resource type this resource belongs to. external_id: An identifier you provide to reference the resource in your system. 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`. + 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`. permission_slug: The permission slug to filter by. Only users with this permission on the resource are returned. - assignment: Filter by assignment type. Use "direct" for direct assignments only, or "indirect" to include inherited assignments. + assignment: Filter by assignment type. Use \"direct\" for direct assignments only, or \"indirect\" to include inherited assignments. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: @@ -1391,9 +1391,9 @@ def list_role_assignments_for_resource_by_external_id( resource_type_slug: The slug of the resource type. external_id: An identifier you provide to reference the resource in your system. 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`. + 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`. role_slug: Filter assignments by the slug of the role. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. @@ -1453,9 +1453,9 @@ def list_resources( Args: 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`. + 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`. organization_id: Filter resources by organization ID. resource_type_slug: Filter resources by resource type slug. resource_external_id: Filter resources by external ID. @@ -1708,14 +1708,14 @@ def list_memberships_for_resource( ) -> SyncPage[UserOrganizationMembershipBaseListData]: """List organization memberships for resource - Returns all organization memberships that have a specific permission on a resource instance. This is useful for answering "Who can access this resource?". + Returns all organization memberships that have a specific permission on a resource instance. This is useful for answering \"Who can access this resource?\". Args: resource_id: The ID of the authorization resource. 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`. + 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`. permission_slug: The permission slug to filter by. Only users with this permission on the resource are returned. assignment: Filter by assignment type. Use `direct` for direct assignments only, or `indirect` to include inherited assignments. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. @@ -1777,9 +1777,9 @@ def list_role_assignments_for_resource( Args: resource_id: The ID of the authorization resource. 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`. + 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`. role_slug: Filter assignments by the slug of the role. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. @@ -2060,9 +2060,9 @@ def list_permissions( Args: 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`. + 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`. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: @@ -2270,9 +2270,9 @@ async def list_group_role_assignments( Args: group_id: The ID of the group. 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`. + 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`. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: @@ -2578,16 +2578,16 @@ async def list_resources_for_membership( ) -> AsyncPage[AuthorizationResource]: """List resources for organization membership - Returns all child resources of a parent resource where the organization membership has a specific permission. This is useful for resource discovery—answering "What projects can this user access in this workspace?" + Returns all child resources of a parent resource where the organization membership has a specific permission. This is useful for resource discovery—answering \"What projects can this user access in this workspace?\" You must provide either `parent_resource_id` or both `parent_resource_external_id` and `parent_resource_type_slug` to identify the parent resource. Args: organization_membership_id: The ID of the organization membership. 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`. + 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`. permission_slug: The permission slug to filter by. Only child resources where the organization membership has this permission are returned. parent_resource: Identifies the parent resource. One of: ParentResourceById, ParentResourceByExternalId. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. @@ -2656,9 +2656,9 @@ async def list_effective_permissions( organization_membership_id: The ID of the organization membership. resource_id: The ID of the authorization resource. 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`. + 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`. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: @@ -2718,9 +2718,9 @@ async def list_effective_permissions_by_external_id( resource_type_slug: The slug of the resource type. external_id: An identifier you provide to reference the resource in your system. 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`. + 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`. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: @@ -2780,9 +2780,9 @@ async def list_role_assignments( Args: organization_membership_id: The ID of the organization membership. 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`. + 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`. resource_id: Filter assignments by the ID of the resource. resource_external_id: Filter assignments by the external ID of the resource. resource_type_slug: Filter assignments by the slug of the resource type. @@ -3484,18 +3484,18 @@ async def list_memberships_for_resource_by_external_id( ) -> AsyncPage[UserOrganizationMembershipBaseListData]: """List memberships for a resource by external ID - Returns all organization memberships that have a specific permission on a resource, using the resource's external ID. This is useful for answering "Who can access this resource?" when you only have the external ID. + Returns all organization memberships that have a specific permission on a resource, using the resource's external ID. This is useful for answering \"Who can access this resource?\" when you only have the external ID. Args: organization_id: The ID of the organization that owns the resource. resource_type_slug: The slug of the resource type this resource belongs to. external_id: An identifier you provide to reference the resource in your system. 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`. + 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`. permission_slug: The permission slug to filter by. Only users with this permission on the resource are returned. - assignment: Filter by assignment type. Use "direct" for direct assignments only, or "indirect" to include inherited assignments. + assignment: Filter by assignment type. Use \"direct\" for direct assignments only, or \"indirect\" to include inherited assignments. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: @@ -3562,9 +3562,9 @@ async def list_role_assignments_for_resource_by_external_id( resource_type_slug: The slug of the resource type. external_id: An identifier you provide to reference the resource in your system. 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`. + 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`. role_slug: Filter assignments by the slug of the role. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. @@ -3624,9 +3624,9 @@ async def list_resources( Args: 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`. + 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`. organization_id: Filter resources by organization ID. resource_type_slug: Filter resources by resource type slug. resource_external_id: Filter resources by external ID. @@ -3879,14 +3879,14 @@ async def list_memberships_for_resource( ) -> AsyncPage[UserOrganizationMembershipBaseListData]: """List organization memberships for resource - Returns all organization memberships that have a specific permission on a resource instance. This is useful for answering "Who can access this resource?". + Returns all organization memberships that have a specific permission on a resource instance. This is useful for answering \"Who can access this resource?\". Args: resource_id: The ID of the authorization resource. 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`. + 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`. permission_slug: The permission slug to filter by. Only users with this permission on the resource are returned. assignment: Filter by assignment type. Use `direct` for direct assignments only, or `indirect` to include inherited assignments. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. @@ -3948,9 +3948,9 @@ async def list_role_assignments_for_resource( Args: resource_id: The ID of the authorization resource. 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`. + 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`. role_slug: Filter assignments by the slug of the role. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. @@ -4231,9 +4231,9 @@ async def list_permissions( Args: 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`. + 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`. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: diff --git a/src/workos/common/__init__.py b/src/workos/common/__init__.py index 931b156b..3d04b325 100644 --- a/src/workos/common/__init__.py +++ b/src/workos/common/__init__.py @@ -221,6 +221,8 @@ from .models import ConnectApplicationVariant as ConnectApplicationVariant from .models import ConnectedAccount as ConnectedAccount from .models import ConnectedAccountAuthMethod as ConnectedAccountAuthMethod +from .models import ConnectedAccountConnectionRole as ConnectedAccountConnectionRole +from .models import ConnectedAccountInput as ConnectedAccountInput from .models import ConnectedAccountInputState as ConnectedAccountInputState from .models import ConnectedAccountState as ConnectedAccountState from .models import ConnectionActivated as ConnectionActivated @@ -288,19 +290,36 @@ from .models import ( DataIntegrationCustomProviderAuthenticateVia as DataIntegrationCustomProviderAuthenticateVia, ) +from .models import ( + DataIntegrationInstallationConnectionRole as DataIntegrationInstallationConnectionRole, +) from .models import DataIntegrationOwnership as DataIntegrationOwnership +from .models import ( + DataIntegrationsGetDataIntegrationAuthorizeUrlRequestConnectionOwner as DataIntegrationsGetDataIntegrationAuthorizeUrlRequestConnectionOwner, +) from .models import ( DataIntegrationsGetUserTokenRequestConnectionOwner as DataIntegrationsGetUserTokenRequestConnectionOwner, ) +from .models import DataIntegrationsListResponse as DataIntegrationsListResponse +from .models import DataIntegrationsListResponseData as DataIntegrationsListResponseData from .models import ( DataIntegrationsListResponseDataAuthMethods as DataIntegrationsListResponseDataAuthMethods, ) +from .models import ( + DataIntegrationsListResponseDataConnectedAccount as DataIntegrationsListResponseDataConnectedAccount, +) from .models import ( DataIntegrationsListResponseDataConnectedAccountAuthMethod as DataIntegrationsListResponseDataConnectedAccountAuthMethod, ) +from .models import ( + DataIntegrationsListResponseDataConnectedAccountConnectionRole as DataIntegrationsListResponseDataConnectedAccountConnectionRole, +) from .models import ( DataIntegrationsListResponseDataConnectedAccountState as DataIntegrationsListResponseDataConnectedAccountState, ) +from .models import ( + DataIntegrationsListResponseDataConnectionOwner as DataIntegrationsListResponseDataConnectionOwner, +) from .models import ( DataIntegrationsListResponseDataOwnership as DataIntegrationsListResponseDataOwnership, ) @@ -498,6 +517,23 @@ from .models import PermissionUpdated as PermissionUpdated from .models import PermissionUpdatedData as PermissionUpdatedData from .models import PipeConnectedAccount as PipeConnectedAccount +from .models import PipesAccountConnectionAddFailed as PipesAccountConnectionAddFailed +from .models import ( + PipesAccountConnectionAddFailedData as PipesAccountConnectionAddFailedData, +) +from .models import PipesAccountConnectionConnected as PipesAccountConnectionConnected +from .models import ( + PipesAccountConnectionConnectionFailed as PipesAccountConnectionConnectionFailed, +) +from .models import ( + PipesAccountConnectionConnectionFailedData as PipesAccountConnectionConnectionFailedData, +) +from .models import ( + PipesAccountConnectionDisconnected as PipesAccountConnectionDisconnected, +) +from .models import ( + PipesAccountConnectionReauthorizationNeeded as PipesAccountConnectionReauthorizationNeeded, +) from .models import PipesConnectedAccountConnected as PipesConnectedAccountConnected from .models import ( PipesConnectedAccountConnectionFailed as PipesConnectedAccountConnectionFailed, diff --git a/src/workos/common/models/__init__.py b/src/workos/common/models/__init__.py index 5890f9ad..7aa3f369 100644 --- a/src/workos/common/models/__init__.py +++ b/src/workos/common/models/__init__.py @@ -366,6 +366,10 @@ from .connected_account_auth_method import ( ConnectedAccountAuthMethod as ConnectedAccountAuthMethod, ) +from .connected_account_connection_role import ( + ConnectedAccountConnectionRole as ConnectedAccountConnectionRole, +) +from .connected_account_input import ConnectedAccountInput as ConnectedAccountInput from .connected_account_input_state import ( ConnectedAccountInputState as ConnectedAccountInputState, ) @@ -471,22 +475,43 @@ from .data_integration_custom_provider_authenticate_via import ( DataIntegrationCustomProviderAuthenticateVia as DataIntegrationCustomProviderAuthenticateVia, ) +from .data_integration_installation_connection_role import ( + DataIntegrationInstallationConnectionRole as DataIntegrationInstallationConnectionRole, +) from .data_integration_ownership import ( DataIntegrationOwnership as DataIntegrationOwnership, ) from .data_integration_state import DataIntegrationState as DataIntegrationState +from .data_integrations_get_data_integration_authorize_url_request_connection_owner import ( + DataIntegrationsGetDataIntegrationAuthorizeUrlRequestConnectionOwner as DataIntegrationsGetDataIntegrationAuthorizeUrlRequestConnectionOwner, +) from .data_integrations_get_user_token_request_connection_owner import ( DataIntegrationsGetUserTokenRequestConnectionOwner as DataIntegrationsGetUserTokenRequestConnectionOwner, ) +from .data_integrations_list_response import ( + DataIntegrationsListResponse as DataIntegrationsListResponse, +) +from .data_integrations_list_response_data import ( + DataIntegrationsListResponseData as DataIntegrationsListResponseData, +) from .data_integrations_list_response_data_auth_methods import ( DataIntegrationsListResponseDataAuthMethods as DataIntegrationsListResponseDataAuthMethods, ) +from .data_integrations_list_response_data_connected_account import ( + DataIntegrationsListResponseDataConnectedAccount as DataIntegrationsListResponseDataConnectedAccount, +) from .data_integrations_list_response_data_connected_account_auth_method import ( DataIntegrationsListResponseDataConnectedAccountAuthMethod as DataIntegrationsListResponseDataConnectedAccountAuthMethod, ) +from .data_integrations_list_response_data_connected_account_connection_role import ( + DataIntegrationsListResponseDataConnectedAccountConnectionRole as DataIntegrationsListResponseDataConnectedAccountConnectionRole, +) from .data_integrations_list_response_data_connected_account_state import ( DataIntegrationsListResponseDataConnectedAccountState as DataIntegrationsListResponseDataConnectedAccountState, ) +from .data_integrations_list_response_data_connection_owner import ( + DataIntegrationsListResponseDataConnectionOwner as DataIntegrationsListResponseDataConnectionOwner, +) from .data_integrations_list_response_data_ownership import ( DataIntegrationsListResponseDataOwnership as DataIntegrationsListResponseDataOwnership, ) @@ -801,6 +826,27 @@ from .permission_updated_data import PermissionUpdatedData as PermissionUpdatedData from .pipe_connected_account import PipeConnectedAccount as PipeConnectedAccount from .pipe_connected_account_state import * +from .pipes_account_connection_add_failed import ( + PipesAccountConnectionAddFailed as PipesAccountConnectionAddFailed, +) +from .pipes_account_connection_add_failed_data import ( + PipesAccountConnectionAddFailedData as PipesAccountConnectionAddFailedData, +) +from .pipes_account_connection_connected import ( + PipesAccountConnectionConnected as PipesAccountConnectionConnected, +) +from .pipes_account_connection_connection_failed import ( + PipesAccountConnectionConnectionFailed as PipesAccountConnectionConnectionFailed, +) +from .pipes_account_connection_connection_failed_data import ( + PipesAccountConnectionConnectionFailedData as PipesAccountConnectionConnectionFailedData, +) +from .pipes_account_connection_disconnected import ( + PipesAccountConnectionDisconnected as PipesAccountConnectionDisconnected, +) +from .pipes_account_connection_reauthorization_needed import ( + PipesAccountConnectionReauthorizationNeeded as PipesAccountConnectionReauthorizationNeeded, +) from .pipes_connected_account_connected import ( PipesConnectedAccountConnected as PipesConnectedAccountConnected, ) diff --git a/src/workos/common/models/agent_registration_credential_issued_data.py b/src/workos/common/models/agent_registration_credential_issued_data.py index c6e225f3..61aa9891 100644 --- a/src/workos/common/models/agent_registration_credential_issued_data.py +++ b/src/workos/common/models/agent_registration_credential_issued_data.py @@ -49,7 +49,8 @@ def from_dict(cls, data: dict[str, Any]) -> AgentRegistrationCredentialIssuedDat _detail_cls = _detail_disc_map.get(_detail_disc) if _detail_cls is None: raise ValueError( - f"Unknown discriminator 'kind' for AgentRegistrationCredentialIssuedData.detail: {_detail_disc!r}. " + "Unknown discriminator 'kind' for AgentRegistrationCredentialIssuedData.detail: " + f"{_detail_disc!r}. " f"Expected one of {sorted(_detail_disc_map)}." ) return cls( diff --git a/src/workos/common/models/api_key_created_data.py b/src/workos/common/models/api_key_created_data.py index ce67304c..ffb53079 100644 --- a/src/workos/common/models/api_key_created_data.py +++ b/src/workos/common/models/api_key_created_data.py @@ -51,7 +51,8 @@ def from_dict(cls, data: dict[str, Any]) -> ApiKeyCreatedData: _owner_cls = _owner_disc_map.get(_owner_disc) if _owner_cls is None: raise ValueError( - f"Unknown discriminator 'type' for ApiKeyCreatedData.owner: {_owner_disc!r}. " + "Unknown discriminator 'type' for ApiKeyCreatedData.owner: " + f"{_owner_disc!r}. " f"Expected one of {sorted(_owner_disc_map)}." ) return cls( diff --git a/src/workos/common/models/api_key_updated_data.py b/src/workos/common/models/api_key_updated_data.py index 22df787e..c1042b2f 100644 --- a/src/workos/common/models/api_key_updated_data.py +++ b/src/workos/common/models/api_key_updated_data.py @@ -54,7 +54,8 @@ def from_dict(cls, data: dict[str, Any]) -> ApiKeyUpdatedData: _owner_cls = _owner_disc_map.get(_owner_disc) if _owner_cls is None: raise ValueError( - f"Unknown discriminator 'type' for ApiKeyUpdatedData.owner: {_owner_disc!r}. " + "Unknown discriminator 'type' for ApiKeyUpdatedData.owner: " + f"{_owner_disc!r}. " f"Expected one of {sorted(_owner_disc_map)}." ) return cls( diff --git a/src/workos/common/models/connected_account.py b/src/workos/common/models/connected_account.py index 838d5159..2eb3a183 100644 --- a/src/workos/common/models/connected_account.py +++ b/src/workos/common/models/connected_account.py @@ -9,6 +9,7 @@ from workos._types import _raise_deserialize_error from .connected_account_auth_method import ConnectedAccountAuthMethod +from .connected_account_connection_role import ConnectedAccountConnectionRole from .connected_account_state import ConnectedAccountState @@ -20,6 +21,12 @@ class ConnectedAccount: """Distinguishes the connected account object.""" id: str """The unique identifier of the connected account.""" + connection_role: ConnectedAccountConnectionRole + """Whether this row is the compatibility connection visible to undeclared clients or a standard peer for plural-aware clients. The role does not indicate preference or creation order.""" + account_identifier: str | None + """A best-effort identifier for the provider account this connection points at. It is correlation metadata, not the connection identifier or a selector.""" + account_display_name: str | None + """A mutable, non-unique display name for the provider account connection.""" user_id: str | None """The [User](https://workos.com/docs/reference/authkit/user) identifier associated with this connection.""" organization_id: str | None @@ -53,6 +60,9 @@ def from_dict(cls, data: dict[str, Any]) -> ConnectedAccount: return cls( object=data.get("object", "connected_account"), id=data["id"], + connection_role=ConnectedAccountConnectionRole(data["connection_role"]), + account_identifier=data["account_identifier"], + account_display_name=data["account_display_name"], user_id=data["user_id"], organization_id=data["organization_id"], scopes=data["scopes"], @@ -75,6 +85,19 @@ def to_dict(self) -> dict[str, Any]: result: dict[str, Any] = {} result["object"] = self.object result["id"] = self.id + result["connection_role"] = ( + self.connection_role.value + if isinstance(self.connection_role, Enum) + else self.connection_role + ) + if self.account_identifier is not None: + result["account_identifier"] = self.account_identifier + else: + result["account_identifier"] = None + if self.account_display_name is not None: + result["account_display_name"] = self.account_display_name + else: + result["account_display_name"] = None if self.user_id is not None: result["user_id"] = self.user_id else: diff --git a/src/workos/common/models/connected_account_connection_role.py b/src/workos/common/models/connected_account_connection_role.py new file mode 100644 index 00000000..6a33b4bb --- /dev/null +++ b/src/workos/common/models/connected_account_connection_role.py @@ -0,0 +1,27 @@ +# This file is auto-generated by oagen. Do not edit. + +"""Enumeration of connected account connection role values.""" + +from __future__ import annotations + +from enum import Enum +from typing import Literal, TypeAlias + + +class ConnectedAccountConnectionRole(str, Enum): + """Known values for ConnectedAccountConnectionRole.""" + + COMPATIBILITY = "compatibility" + STANDARD = "standard" + + @classmethod + def _missing_(cls, value: object) -> ConnectedAccountConnectionRole | None: + if not isinstance(value, str): + return None + unknown = str.__new__(cls, value) + unknown._name_ = value.upper() + unknown._value_ = value + return unknown + + +ConnectedAccountConnectionRoleLiteral: TypeAlias = Literal["compatibility", "standard"] diff --git a/src/workos/common/models/connected_account_input.py b/src/workos/common/models/connected_account_input.py new file mode 100644 index 00000000..fe664f5b --- /dev/null +++ b/src/workos/common/models/connected_account_input.py @@ -0,0 +1,63 @@ +# This file is auto-generated by oagen. Do not edit. + +from __future__ import annotations + +from dataclasses import dataclass +from datetime import datetime +from enum import Enum +from typing import Any + +from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error + +from .connected_account_input_state import ConnectedAccountInputState + + +@dataclass(slots=True) +class ConnectedAccountInput: + """Connected Account Input model.""" + + access_token: str | None = None + """The OAuth access token for the connected account.""" + refresh_token: str | None = None + """The OAuth refresh token for the connected account.""" + expires_at: datetime | None = None + """The ISO-8601 timestamp when the access token expires. Required when `access_token` is provided for tokens that expire.""" + scopes: list[str] | None = None + """The OAuth scopes granted for this connection.""" + state: ConnectedAccountInputState | None = None + """Explicitly set the state of the connected account. When omitted, the state is derived from the token combination provided.""" + + @classmethod + def from_dict(cls, data: dict[str, Any]) -> ConnectedAccountInput: + """Deserialize from a dictionary.""" + try: + return cls( + access_token=data.get("access_token"), + refresh_token=data.get("refresh_token"), + expires_at=_parse_datetime(_v_expires_at) + if (_v_expires_at := data.get("expires_at")) is not None + else None, + scopes=data.get("scopes"), + state=ConnectedAccountInputState(_v_state) + if (_v_state := data.get("state")) is not None + else None, + ) + except (KeyError, ValueError) as e: + _raise_deserialize_error("ConnectedAccountInput", e) + + def to_dict(self) -> dict[str, Any]: + """Serialize to a dictionary.""" + result: dict[str, Any] = {} + if self.access_token is not None: + result["access_token"] = self.access_token + if self.refresh_token is not None: + result["refresh_token"] = self.refresh_token + if self.expires_at is not None: + result["expires_at"] = _format_datetime(self.expires_at) + if self.scopes is not None: + result["scopes"] = self.scopes + if self.state is not None: + result["state"] = ( + self.state.value if isinstance(self.state, Enum) else self.state + ) + return result diff --git a/src/workos/common/models/create_webhook_endpoint_events.py b/src/workos/common/models/create_webhook_endpoint_events.py index 987fbc4e..f288ba99 100644 --- a/src/workos/common/models/create_webhook_endpoint_events.py +++ b/src/workos/common/models/create_webhook_endpoint_events.py @@ -112,6 +112,15 @@ class CreateWebhookEndpointEvents(str, Enum): PERMISSION_CREATED = "permission.created" PERMISSION_DELETED = "permission.deleted" PERMISSION_UPDATED = "permission.updated" + PIPES_ACCOUNT_CONNECTION_ADD_FAILED = "pipes.account_connection.add_failed" + PIPES_ACCOUNT_CONNECTION_CONNECTED = "pipes.account_connection.connected" + PIPES_ACCOUNT_CONNECTION_CONNECTION_FAILED = ( + "pipes.account_connection.connection_failed" + ) + PIPES_ACCOUNT_CONNECTION_DISCONNECTED = "pipes.account_connection.disconnected" + PIPES_ACCOUNT_CONNECTION_REAUTHORIZATION_NEEDED = ( + "pipes.account_connection.reauthorization_needed" + ) PIPES_CONNECTED_ACCOUNT_CONNECTED = "pipes.connected_account.connected" PIPES_CONNECTED_ACCOUNT_CONNECTION_FAILED = ( "pipes.connected_account.connection_failed" @@ -228,6 +237,11 @@ def _missing_(cls, value: object) -> CreateWebhookEndpointEvents | None: "permission.created", "permission.deleted", "permission.updated", + "pipes.account_connection.add_failed", + "pipes.account_connection.connected", + "pipes.account_connection.connection_failed", + "pipes.account_connection.disconnected", + "pipes.account_connection.reauthorization_needed", "pipes.connected_account.connected", "pipes.connected_account.connection_failed", "pipes.connected_account.disconnected", diff --git a/src/workos/common/models/data_integration_installation_connection_role.py b/src/workos/common/models/data_integration_installation_connection_role.py new file mode 100644 index 00000000..d619922a --- /dev/null +++ b/src/workos/common/models/data_integration_installation_connection_role.py @@ -0,0 +1,8 @@ +# This file is auto-generated by oagen. Do not edit. + +from typing import TypeAlias + +from .connected_account_connection_role import ConnectedAccountConnectionRole + +DataIntegrationInstallationConnectionRole: TypeAlias = ConnectedAccountConnectionRole +__all__ = ["DataIntegrationInstallationConnectionRole"] diff --git a/src/workos/common/models/data_integrations_get_data_integration_authorize_url_request_connection_owner.py b/src/workos/common/models/data_integrations_get_data_integration_authorize_url_request_connection_owner.py new file mode 100644 index 00000000..f114ebc0 --- /dev/null +++ b/src/workos/common/models/data_integrations_get_data_integration_authorize_url_request_connection_owner.py @@ -0,0 +1,10 @@ +# This file is auto-generated by oagen. Do not edit. + +from typing import TypeAlias + +from .create_data_integration_ownership import CreateDataIntegrationOwnership + +DataIntegrationsGetDataIntegrationAuthorizeUrlRequestConnectionOwner: TypeAlias = ( + CreateDataIntegrationOwnership +) +__all__ = ["DataIntegrationsGetDataIntegrationAuthorizeUrlRequestConnectionOwner"] diff --git a/src/workos/common/models/data_integrations_list_response.py b/src/workos/common/models/data_integrations_list_response.py new file mode 100644 index 00000000..a8482582 --- /dev/null +++ b/src/workos/common/models/data_integrations_list_response.py @@ -0,0 +1,43 @@ +# This file is auto-generated by oagen. Do not edit. + +from __future__ import annotations + +from dataclasses import dataclass +from typing import Any, Literal, cast + +from workos._types import _raise_deserialize_error + +from .data_integrations_list_response_data import DataIntegrationsListResponseData + + +@dataclass(slots=True) +class DataIntegrationsListResponse: + """Data Integrations List Response model.""" + + object: Literal["list"] + """Indicates this is a list response.""" + data: list[DataIntegrationsListResponseData] + """A list of [providers](https://workos.com/docs/reference/pipes/provider), each including the legacy `connected_account` field and the additive `connected_accounts` collection.""" + + @classmethod + def from_dict(cls, data: dict[str, Any]) -> DataIntegrationsListResponse: + """Deserialize from a dictionary.""" + try: + return cls( + object=data.get("object", "list"), + data=[ + DataIntegrationsListResponseData.from_dict( + cast(dict[str, Any], item) + ) + for item in cast(list[Any], data["data"]) + ], + ) + except (KeyError, ValueError) as e: + _raise_deserialize_error("DataIntegrationsListResponse", e) + + def to_dict(self) -> dict[str, Any]: + """Serialize to a dictionary.""" + result: dict[str, Any] = {} + result["object"] = self.object + result["data"] = [item.to_dict() for item in self.data] + return result diff --git a/src/workos/common/models/data_integrations_list_response_data.py b/src/workos/common/models/data_integrations_list_response_data.py new file mode 100644 index 00000000..84a9e835 --- /dev/null +++ b/src/workos/common/models/data_integrations_list_response_data.py @@ -0,0 +1,146 @@ +# This file is auto-generated by oagen. Do not edit. + +from __future__ import annotations + +from dataclasses import dataclass +from enum import Enum +from typing import Any, Literal, cast + +from workos._types import _raise_deserialize_error + +from .data_integrations_list_response_data_auth_methods import ( + DataIntegrationsListResponseDataAuthMethods, +) +from .data_integrations_list_response_data_connected_account import ( + DataIntegrationsListResponseDataConnectedAccount, +) +from .data_integrations_list_response_data_connection_owner import ( + DataIntegrationsListResponseDataConnectionOwner, +) +from .data_integrations_list_response_data_ownership import ( + DataIntegrationsListResponseDataOwnership, +) + + +@dataclass(slots=True) +class DataIntegrationsListResponseData: + """Data Integrations List Response Data model.""" + + object: Literal["data_provider"] + """Distinguishes the data provider object.""" + id: str + """The unique identifier of the provider.""" + name: str + """The display name of the provider (e.g., \"GitHub\", \"Slack\").""" + description: str | None + """A description of the provider explaining how it will be used, if configured.""" + slug: str + """The slug identifier used in API calls (e.g., `github`, `slack`, `notion`).""" + integration_type: str + """The type of integration (e.g., `github`, `slack`).""" + credentials_type: str + """The type of credentials used by the provider (e.g., `oauth2`).""" + scopes: list[str] | None + """The OAuth scopes configured for this provider, or `null` if none are configured.""" + connection_owner: DataIntegrationsListResponseDataConnectionOwner + """Who owns connections made through this provider: `user` for connections owned by individual users, or `organization` for a connection shared by every member of the organization. A provider row can exist before any connected account does.""" + created_at: str + """The timestamp when the provider was created.""" + updated_at: str + """The timestamp when the provider was last updated.""" + connected_account: DataIntegrationsListResponseDataConnectedAccount | None + """The user's compatibility [connected account](https://workos.com/docs/reference/pipes/connected-account) for this provider, or `null` when the compatibility slot is empty. This legacy field never selects a standard connection.""" + connected_accounts: list[DataIntegrationsListResponseDataConnectedAccount] + """The user's connected accounts for this provider in the requested ownership context. This contains only the compatibility connection unless `supports_multiple_connections` is `true`.""" + auth_methods: list[DataIntegrationsListResponseDataAuthMethods] | None = None + """The authentication methods supported by this provider (`oauth`, `api_key`, `client_credentials`, or a combination). Defaults to `[\"oauth\"]` if absent.""" + ownership: DataIntegrationsListResponseDataOwnership | None = None + """Use `connection_owner` instead. Legacy spelling of the same value: `userland_user` corresponds to `connection_owner: \"user\"` and `organization` to `connection_owner: \"organization\"`. + + .. deprecated:: This field is deprecated.""" + + @classmethod + def from_dict(cls, data: dict[str, Any]) -> DataIntegrationsListResponseData: + """Deserialize from a dictionary.""" + try: + return cls( + object=data.get("object", "data_provider"), + id=data["id"], + name=data["name"], + description=data["description"], + slug=data["slug"], + integration_type=data["integration_type"], + credentials_type=data["credentials_type"], + scopes=data["scopes"], + connection_owner=DataIntegrationsListResponseDataConnectionOwner( + data["connection_owner"] + ), + created_at=data["created_at"], + updated_at=data["updated_at"], + connected_account=DataIntegrationsListResponseDataConnectedAccount.from_dict( + cast(dict[str, Any], _v_connected_account) + ) + if (_v_connected_account := data["connected_account"]) is not None + else None, + connected_accounts=[ + DataIntegrationsListResponseDataConnectedAccount.from_dict( + cast(dict[str, Any], item) + ) + for item in cast(list[Any], data["connected_accounts"]) + ], + auth_methods=[ + DataIntegrationsListResponseDataAuthMethods(item) + for item in cast(list[Any], _v_auth_methods) + ] + if (_v_auth_methods := data.get("auth_methods")) is not None + else None, + ownership=DataIntegrationsListResponseDataOwnership(_v_ownership) + if (_v_ownership := data.get("ownership")) is not None + else None, + ) + except (KeyError, ValueError) as e: + _raise_deserialize_error("DataIntegrationsListResponseData", e) + + def to_dict(self) -> dict[str, Any]: + """Serialize to a dictionary.""" + result: dict[str, Any] = {} + result["object"] = self.object + result["id"] = self.id + result["name"] = self.name + if self.description is not None: + result["description"] = self.description + else: + result["description"] = None + result["slug"] = self.slug + result["integration_type"] = self.integration_type + result["credentials_type"] = self.credentials_type + if self.scopes is not None: + result["scopes"] = self.scopes + else: + result["scopes"] = None + result["connection_owner"] = ( + self.connection_owner.value + if isinstance(self.connection_owner, Enum) + else self.connection_owner + ) + result["created_at"] = self.created_at + result["updated_at"] = self.updated_at + if self.connected_account is not None: + result["connected_account"] = self.connected_account.to_dict() + else: + result["connected_account"] = None + result["connected_accounts"] = [ + item.to_dict() for item in self.connected_accounts + ] + if self.auth_methods is not None: + result["auth_methods"] = [ + item.value if isinstance(item, Enum) else item + for item in self.auth_methods + ] + if self.ownership is not None: + result["ownership"] = ( + self.ownership.value + if isinstance(self.ownership, Enum) + else self.ownership + ) + return result diff --git a/src/workos/common/models/data_integrations_list_response_data_connected_account.py b/src/workos/common/models/data_integrations_list_response_data_connected_account.py new file mode 100644 index 00000000..fa3e57c8 --- /dev/null +++ b/src/workos/common/models/data_integrations_list_response_data_connected_account.py @@ -0,0 +1,162 @@ +# This file is auto-generated by oagen. Do not edit. + +from __future__ import annotations + +from dataclasses import dataclass +from enum import Enum +from typing import Any, Literal + +from workos._types import _raise_deserialize_error + +from .data_integrations_list_response_data_connected_account_auth_method import ( + DataIntegrationsListResponseDataConnectedAccountAuthMethod, +) +from .data_integrations_list_response_data_connected_account_connection_role import ( + DataIntegrationsListResponseDataConnectedAccountConnectionRole, +) +from .data_integrations_list_response_data_connected_account_state import ( + DataIntegrationsListResponseDataConnectedAccountState, +) + + +@dataclass(slots=True) +class DataIntegrationsListResponseDataConnectedAccount: + """Data Integrations List Response Data Connected Account model.""" + + object: Literal["connected_account"] + """Distinguishes the connected account object.""" + id: str + """The unique identifier of the connected account.""" + connection_role: DataIntegrationsListResponseDataConnectedAccountConnectionRole + """Whether this row is the compatibility connection visible to undeclared clients or a standard peer for plural-aware clients. The role does not indicate preference or creation order.""" + account_identifier: str | None + """A best-effort identifier for the provider account this connection points at. It is correlation metadata, not the connection identifier or a selector.""" + account_display_name: str | None + """A mutable, non-unique display name for the provider account connection.""" + user_id: str | None + """The [User](https://workos.com/docs/reference/authkit/user) identifier associated with this connection.""" + organization_id: str | None + """The [Organization](https://workos.com/docs/reference/organization) identifier associated with this connection, or `null` if not scoped to an organization.""" + scopes: list[str] + """The OAuth scopes granted for this connection.""" + state: DataIntegrationsListResponseDataConnectedAccountState + """The state of the connected account: +- `connected`: The connection is active and tokens are valid. +- `needs_reauthorization`: The user needs to reauthorize the connection, typically because required scopes have changed. +- `disconnected`: The connection has been disconnected.""" + created_at: str + """The timestamp when the connection was created.""" + updated_at: str + """The timestamp when the connection was last updated.""" + auth_method: DataIntegrationsListResponseDataConnectedAccountAuthMethod | None = ( + None + ) + """The authentication method used for this connection (`oauth`, `api_key`, or `client_credentials`). Defaults to `oauth` if absent.""" + api_key_last_4: str | None = None + """The last four characters of the API key, or `null` for OAuth connections.""" + client_id: str | None = None + """The client ID supplied for this connection. Only present when `auth_method` is `client_credentials`.""" + client_secret_last_4: str | None = None + """The last four characters of the client secret supplied for this connection, or `null` when it can't be read. Only present when `auth_method` is `client_credentials`.""" + config: dict[str, str] | None = None + """The connection-level configuration values stored for this connection — the fields the provider declares at `installation` scope, excluding any it declares as secret. Only present when `auth_method` is `client_credentials`.""" + userland_user_id: str | None = None + """Use `user_id` instead. + + .. deprecated:: This field is deprecated.""" + + @classmethod + def from_dict( + cls, data: dict[str, Any] + ) -> DataIntegrationsListResponseDataConnectedAccount: + """Deserialize from a dictionary.""" + try: + return cls( + object=data.get("object", "connected_account"), + id=data["id"], + connection_role=DataIntegrationsListResponseDataConnectedAccountConnectionRole( + data["connection_role"] + ), + account_identifier=data["account_identifier"], + account_display_name=data["account_display_name"], + user_id=data["user_id"], + organization_id=data["organization_id"], + scopes=data["scopes"], + state=DataIntegrationsListResponseDataConnectedAccountState( + data["state"] + ), + created_at=data["created_at"], + updated_at=data["updated_at"], + auth_method=DataIntegrationsListResponseDataConnectedAccountAuthMethod( + _v_auth_method + ) + if (_v_auth_method := data.get("auth_method")) is not None + else None, + api_key_last_4=data.get("api_key_last_4"), + client_id=data.get("client_id"), + client_secret_last_4=data.get("client_secret_last_4"), + config=data.get("config"), + userland_user_id=data.get("userlandUserId"), + ) + except (KeyError, ValueError) as e: + _raise_deserialize_error( + "DataIntegrationsListResponseDataConnectedAccount", e + ) + + def to_dict(self) -> dict[str, Any]: + """Serialize to a dictionary.""" + result: dict[str, Any] = {} + result["object"] = self.object + result["id"] = self.id + result["connection_role"] = ( + self.connection_role.value + if isinstance(self.connection_role, Enum) + else self.connection_role + ) + if self.account_identifier is not None: + result["account_identifier"] = self.account_identifier + else: + result["account_identifier"] = None + if self.account_display_name is not None: + result["account_display_name"] = self.account_display_name + else: + result["account_display_name"] = None + if self.user_id is not None: + result["user_id"] = self.user_id + else: + result["user_id"] = None + if self.organization_id is not None: + result["organization_id"] = self.organization_id + else: + result["organization_id"] = None + result["scopes"] = self.scopes + result["state"] = ( + self.state.value if isinstance(self.state, Enum) else self.state + ) + result["created_at"] = self.created_at + result["updated_at"] = self.updated_at + if self.auth_method is not None: + result["auth_method"] = ( + self.auth_method.value + if isinstance(self.auth_method, Enum) + else self.auth_method + ) + if self.api_key_last_4 is not None: + result["api_key_last_4"] = self.api_key_last_4 + else: + result["api_key_last_4"] = None + if self.client_id is not None: + result["client_id"] = self.client_id + else: + result["client_id"] = None + if self.client_secret_last_4 is not None: + result["client_secret_last_4"] = self.client_secret_last_4 + else: + result["client_secret_last_4"] = None + if self.config is not None: + result["config"] = self.config + if self.userland_user_id is not None: + result["userlandUserId"] = self.userland_user_id + else: + result["userlandUserId"] = None + return result diff --git a/src/workos/common/models/data_integrations_list_response_data_connected_account_connection_role.py b/src/workos/common/models/data_integrations_list_response_data_connected_account_connection_role.py new file mode 100644 index 00000000..c30af3ad --- /dev/null +++ b/src/workos/common/models/data_integrations_list_response_data_connected_account_connection_role.py @@ -0,0 +1,10 @@ +# This file is auto-generated by oagen. Do not edit. + +from typing import TypeAlias + +from .connected_account_connection_role import ConnectedAccountConnectionRole + +DataIntegrationsListResponseDataConnectedAccountConnectionRole: TypeAlias = ( + ConnectedAccountConnectionRole +) +__all__ = ["DataIntegrationsListResponseDataConnectedAccountConnectionRole"] diff --git a/src/workos/common/models/data_integrations_list_response_data_connection_owner.py b/src/workos/common/models/data_integrations_list_response_data_connection_owner.py new file mode 100644 index 00000000..9286682a --- /dev/null +++ b/src/workos/common/models/data_integrations_list_response_data_connection_owner.py @@ -0,0 +1,10 @@ +# This file is auto-generated by oagen. Do not edit. + +from typing import TypeAlias + +from .create_data_integration_ownership import CreateDataIntegrationOwnership + +DataIntegrationsListResponseDataConnectionOwner: TypeAlias = ( + CreateDataIntegrationOwnership +) +__all__ = ["DataIntegrationsListResponseDataConnectionOwner"] diff --git a/src/workos/common/models/pipe_connected_account.py b/src/workos/common/models/pipe_connected_account.py index 345b31fd..348465b7 100644 --- a/src/workos/common/models/pipe_connected_account.py +++ b/src/workos/common/models/pipe_connected_account.py @@ -9,6 +9,8 @@ from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error +from .pipe_connected_account_auth_method import PipeConnectedAccountAuthMethod +from .pipe_connected_account_connection_role import PipeConnectedAccountConnectionRole from .pipe_connected_account_state import PipeConnectedAccountState @@ -36,6 +38,16 @@ class PipeConnectedAccount: """An ISO 8601 timestamp.""" updated_at: datetime """An ISO 8601 timestamp.""" + connection_role: PipeConnectedAccountConnectionRole | None = None + """Whether this is the compatibility connection visible to undeclared clients or a standard connection for plural-aware clients. Historical events may omit this field.""" + account_identifier: str | None = None + """A best-effort identifier for the provider account this connection points at. It is not the connection identifier or a selector. Historical events may omit this field.""" + account_display_name: str | None = None + """A mutable, non-unique display name for the provider account connection. Historical events may omit this field.""" + auth_method: PipeConnectedAccountAuthMethod | None = None + """How the connection authenticates. Historical events may omit this field.""" + api_key_last_4: str | None = None + """The last four characters of the API key, or null for other authentication methods. Historical events may omit this field.""" @classmethod def from_dict(cls, data: dict[str, Any]) -> PipeConnectedAccount: @@ -52,6 +64,15 @@ def from_dict(cls, data: dict[str, Any]) -> PipeConnectedAccount: state=PipeConnectedAccountState(data["state"]), created_at=_parse_datetime(data["created_at"]), updated_at=_parse_datetime(data["updated_at"]), + connection_role=PipeConnectedAccountConnectionRole(_v_connection_role) + if (_v_connection_role := data.get("connection_role")) is not None + else None, + account_identifier=data.get("account_identifier"), + account_display_name=data.get("account_display_name"), + auth_method=PipeConnectedAccountAuthMethod(_v_auth_method) + if (_v_auth_method := data.get("auth_method")) is not None + else None, + api_key_last_4=data.get("api_key_last_4"), ) except (KeyError, ValueError) as e: _raise_deserialize_error("PipeConnectedAccount", e) @@ -77,4 +98,28 @@ def to_dict(self) -> dict[str, Any]: ) result["created_at"] = _format_datetime(self.created_at) result["updated_at"] = _format_datetime(self.updated_at) + if self.connection_role is not None: + result["connection_role"] = ( + self.connection_role.value + if isinstance(self.connection_role, Enum) + else self.connection_role + ) + if self.account_identifier is not None: + result["account_identifier"] = self.account_identifier + else: + result["account_identifier"] = None + if self.account_display_name is not None: + result["account_display_name"] = self.account_display_name + else: + result["account_display_name"] = None + if self.auth_method is not None: + result["auth_method"] = ( + self.auth_method.value + if isinstance(self.auth_method, Enum) + else self.auth_method + ) + if self.api_key_last_4 is not None: + result["api_key_last_4"] = self.api_key_last_4 + else: + result["api_key_last_4"] = None return result diff --git a/src/workos/common/models/pipe_connected_account_auth_method.py b/src/workos/common/models/pipe_connected_account_auth_method.py new file mode 100644 index 00000000..aec489f8 --- /dev/null +++ b/src/workos/common/models/pipe_connected_account_auth_method.py @@ -0,0 +1,8 @@ +# This file is auto-generated by oagen. Do not edit. + +from typing import TypeAlias + +from .connected_account_auth_method import ConnectedAccountAuthMethod + +PipeConnectedAccountAuthMethod: TypeAlias = ConnectedAccountAuthMethod +__all__ = ["PipeConnectedAccountAuthMethod"] diff --git a/src/workos/common/models/pipe_connected_account_connection_role.py b/src/workos/common/models/pipe_connected_account_connection_role.py new file mode 100644 index 00000000..8a2e8549 --- /dev/null +++ b/src/workos/common/models/pipe_connected_account_connection_role.py @@ -0,0 +1,8 @@ +# This file is auto-generated by oagen. Do not edit. + +from typing import TypeAlias + +from .connected_account_connection_role import ConnectedAccountConnectionRole + +PipeConnectedAccountConnectionRole: TypeAlias = ConnectedAccountConnectionRole +__all__ = ["PipeConnectedAccountConnectionRole"] diff --git a/src/workos/common/models/pipes_account_connection_add_failed.py b/src/workos/common/models/pipes_account_connection_add_failed.py new file mode 100644 index 00000000..9b15ba9b --- /dev/null +++ b/src/workos/common/models/pipes_account_connection_add_failed.py @@ -0,0 +1,61 @@ +# This file is auto-generated by oagen. Do not edit. + +from __future__ import annotations + +from dataclasses import dataclass +from datetime import datetime +from typing import Any, Literal, cast + +from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error + +from .event_context import EventContext +from .pipes_account_connection_add_failed_data import ( + PipesAccountConnectionAddFailedData, +) + + +@dataclass(slots=True) +class PipesAccountConnectionAddFailed: + """Pipes Account Connection Add Failed model.""" + + object: Literal["event"] + """Distinguishes the Event object.""" + id: str + """Unique identifier for the event.""" + event: Literal["pipes.account_connection.add_failed"] + data: PipesAccountConnectionAddFailedData + """The event payload.""" + created_at: datetime + """An ISO 8601 timestamp.""" + context: EventContext | None = None + + @classmethod + def from_dict(cls, data: dict[str, Any]) -> PipesAccountConnectionAddFailed: + """Deserialize from a dictionary.""" + try: + return cls( + object=data.get("object", "event"), + id=data["id"], + event=data.get("event", "pipes.account_connection.add_failed"), + data=PipesAccountConnectionAddFailedData.from_dict( + cast(dict[str, Any], data["data"]) + ), + created_at=_parse_datetime(data["created_at"]), + context=EventContext.from_dict(cast(dict[str, Any], _v_context)) + if (_v_context := data.get("context")) is not None + else None, + ) + except (KeyError, ValueError) as e: + _raise_deserialize_error("PipesAccountConnectionAddFailed", e) + + def to_dict(self) -> dict[str, Any]: + """Serialize to a dictionary.""" + result: dict[str, Any] = {} + result["object"] = self.object + result["id"] = self.id + result["event"] = self.event + result["data"] = self.data.to_dict() + result["created_at"] = _format_datetime(self.created_at) + if self.context is not None: + result["context"] = self.context.to_dict() + return result diff --git a/src/workos/common/models/pipes_account_connection_add_failed_data.py b/src/workos/common/models/pipes_account_connection_add_failed_data.py new file mode 100644 index 00000000..588cd526 --- /dev/null +++ b/src/workos/common/models/pipes_account_connection_add_failed_data.py @@ -0,0 +1,91 @@ +# This file is auto-generated by oagen. Do not edit. + +from __future__ import annotations + +from dataclasses import dataclass +from datetime import datetime +from typing import Any, Literal + +from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error + + +@dataclass(slots=True) +class PipesAccountConnectionAddFailedData: + """The event payload.""" + + object: Literal["connection_failed"] + """The object type.""" + data_integration_id: str + """The unique ID of the data integration.""" + provider_slug: str + """The provider slug for this connection attempt.""" + user_id: str | None + """The ID of the User the connection attempt belongs to.""" + organization_id: str | None + """The ID of the Organization the connection attempt belongs to.""" + error_code: str + """A machine-readable error code for the failure.""" + error_reason: str | None + """A human-readable explanation of the failure.""" + provider_error: str | None + """The raw error code returned by the OAuth provider.""" + provider_error_description: str | None + """The raw error description returned by the OAuth provider.""" + created_at: datetime + """An ISO 8601 timestamp.""" + account_identifier: str | None = None + """A best-effort identifier for the provider account involved in the attempt. It is not a connection identifier or selector. Historical events may omit this field.""" + + @classmethod + def from_dict(cls, data: dict[str, Any]) -> PipesAccountConnectionAddFailedData: + """Deserialize from a dictionary.""" + try: + return cls( + object=data.get("object", "connection_failed"), + data_integration_id=data["data_integration_id"], + provider_slug=data["provider_slug"], + user_id=data["user_id"], + organization_id=data["organization_id"], + error_code=data["error_code"], + error_reason=data["error_reason"], + provider_error=data["provider_error"], + provider_error_description=data["provider_error_description"], + created_at=_parse_datetime(data["created_at"]), + account_identifier=data.get("account_identifier"), + ) + except (KeyError, ValueError) as e: + _raise_deserialize_error("PipesAccountConnectionAddFailedData", e) + + def to_dict(self) -> dict[str, Any]: + """Serialize to a dictionary.""" + result: dict[str, Any] = {} + result["object"] = self.object + result["data_integration_id"] = self.data_integration_id + result["provider_slug"] = self.provider_slug + if self.user_id is not None: + result["user_id"] = self.user_id + else: + result["user_id"] = None + if self.organization_id is not None: + result["organization_id"] = self.organization_id + else: + result["organization_id"] = None + result["error_code"] = self.error_code + if self.error_reason is not None: + result["error_reason"] = self.error_reason + else: + result["error_reason"] = None + if self.provider_error is not None: + result["provider_error"] = self.provider_error + else: + result["provider_error"] = None + if self.provider_error_description is not None: + result["provider_error_description"] = self.provider_error_description + else: + result["provider_error_description"] = None + result["created_at"] = _format_datetime(self.created_at) + if self.account_identifier is not None: + result["account_identifier"] = self.account_identifier + else: + result["account_identifier"] = None + return result diff --git a/src/workos/common/models/pipes_account_connection_connected.py b/src/workos/common/models/pipes_account_connection_connected.py new file mode 100644 index 00000000..206520bf --- /dev/null +++ b/src/workos/common/models/pipes_account_connection_connected.py @@ -0,0 +1,57 @@ +# This file is auto-generated by oagen. Do not edit. + +from __future__ import annotations + +from dataclasses import dataclass +from datetime import datetime +from typing import Any, Literal, cast + +from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error + +from .event_context import EventContext +from .pipe_connected_account import PipeConnectedAccount + + +@dataclass(slots=True) +class PipesAccountConnectionConnected: + """Pipes Account Connection Connected model.""" + + object: Literal["event"] + """Distinguishes the Event object.""" + id: str + """Unique identifier for the event.""" + event: Literal["pipes.account_connection.connected"] + data: PipeConnectedAccount + """The event payload.""" + created_at: datetime + """An ISO 8601 timestamp.""" + context: EventContext | None = None + + @classmethod + def from_dict(cls, data: dict[str, Any]) -> PipesAccountConnectionConnected: + """Deserialize from a dictionary.""" + try: + return cls( + object=data.get("object", "event"), + id=data["id"], + event=data.get("event", "pipes.account_connection.connected"), + data=PipeConnectedAccount.from_dict(cast(dict[str, Any], data["data"])), + created_at=_parse_datetime(data["created_at"]), + context=EventContext.from_dict(cast(dict[str, Any], _v_context)) + if (_v_context := data.get("context")) is not None + else None, + ) + except (KeyError, ValueError) as e: + _raise_deserialize_error("PipesAccountConnectionConnected", e) + + def to_dict(self) -> dict[str, Any]: + """Serialize to a dictionary.""" + result: dict[str, Any] = {} + result["object"] = self.object + result["id"] = self.id + result["event"] = self.event + result["data"] = self.data.to_dict() + result["created_at"] = _format_datetime(self.created_at) + if self.context is not None: + result["context"] = self.context.to_dict() + return result diff --git a/src/workos/common/models/pipes_account_connection_connection_failed.py b/src/workos/common/models/pipes_account_connection_connection_failed.py new file mode 100644 index 00000000..dd4feab2 --- /dev/null +++ b/src/workos/common/models/pipes_account_connection_connection_failed.py @@ -0,0 +1,61 @@ +# This file is auto-generated by oagen. Do not edit. + +from __future__ import annotations + +from dataclasses import dataclass +from datetime import datetime +from typing import Any, Literal, cast + +from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error + +from .event_context import EventContext +from .pipes_account_connection_connection_failed_data import ( + PipesAccountConnectionConnectionFailedData, +) + + +@dataclass(slots=True) +class PipesAccountConnectionConnectionFailed: + """Pipes Account Connection Connection Failed model.""" + + object: Literal["event"] + """Distinguishes the Event object.""" + id: str + """Unique identifier for the event.""" + event: Literal["pipes.account_connection.connection_failed"] + data: PipesAccountConnectionConnectionFailedData + """The event payload.""" + created_at: datetime + """An ISO 8601 timestamp.""" + context: EventContext | None = None + + @classmethod + def from_dict(cls, data: dict[str, Any]) -> PipesAccountConnectionConnectionFailed: + """Deserialize from a dictionary.""" + try: + return cls( + object=data.get("object", "event"), + id=data["id"], + event=data.get("event", "pipes.account_connection.connection_failed"), + data=PipesAccountConnectionConnectionFailedData.from_dict( + cast(dict[str, Any], data["data"]) + ), + created_at=_parse_datetime(data["created_at"]), + context=EventContext.from_dict(cast(dict[str, Any], _v_context)) + if (_v_context := data.get("context")) is not None + else None, + ) + except (KeyError, ValueError) as e: + _raise_deserialize_error("PipesAccountConnectionConnectionFailed", e) + + def to_dict(self) -> dict[str, Any]: + """Serialize to a dictionary.""" + result: dict[str, Any] = {} + result["object"] = self.object + result["id"] = self.id + result["event"] = self.event + result["data"] = self.data.to_dict() + result["created_at"] = _format_datetime(self.created_at) + if self.context is not None: + result["context"] = self.context.to_dict() + return result diff --git a/src/workos/common/models/pipes_account_connection_connection_failed_data.py b/src/workos/common/models/pipes_account_connection_connection_failed_data.py new file mode 100644 index 00000000..1893a36e --- /dev/null +++ b/src/workos/common/models/pipes_account_connection_connection_failed_data.py @@ -0,0 +1,11 @@ +# This file is auto-generated by oagen. Do not edit. + +from typing import TypeAlias + +from .pipes_account_connection_add_failed_data import ( + PipesAccountConnectionAddFailedData, +) + +PipesAccountConnectionConnectionFailedData: TypeAlias = ( + PipesAccountConnectionAddFailedData +) diff --git a/src/workos/common/models/pipes_account_connection_disconnected.py b/src/workos/common/models/pipes_account_connection_disconnected.py new file mode 100644 index 00000000..1f7109c0 --- /dev/null +++ b/src/workos/common/models/pipes_account_connection_disconnected.py @@ -0,0 +1,57 @@ +# This file is auto-generated by oagen. Do not edit. + +from __future__ import annotations + +from dataclasses import dataclass +from datetime import datetime +from typing import Any, Literal, cast + +from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error + +from .event_context import EventContext +from .pipe_connected_account import PipeConnectedAccount + + +@dataclass(slots=True) +class PipesAccountConnectionDisconnected: + """Pipes Account Connection Disconnected model.""" + + object: Literal["event"] + """Distinguishes the Event object.""" + id: str + """Unique identifier for the event.""" + event: Literal["pipes.account_connection.disconnected"] + data: PipeConnectedAccount + """The event payload.""" + created_at: datetime + """An ISO 8601 timestamp.""" + context: EventContext | None = None + + @classmethod + def from_dict(cls, data: dict[str, Any]) -> PipesAccountConnectionDisconnected: + """Deserialize from a dictionary.""" + try: + return cls( + object=data.get("object", "event"), + id=data["id"], + event=data.get("event", "pipes.account_connection.disconnected"), + data=PipeConnectedAccount.from_dict(cast(dict[str, Any], data["data"])), + created_at=_parse_datetime(data["created_at"]), + context=EventContext.from_dict(cast(dict[str, Any], _v_context)) + if (_v_context := data.get("context")) is not None + else None, + ) + except (KeyError, ValueError) as e: + _raise_deserialize_error("PipesAccountConnectionDisconnected", e) + + def to_dict(self) -> dict[str, Any]: + """Serialize to a dictionary.""" + result: dict[str, Any] = {} + result["object"] = self.object + result["id"] = self.id + result["event"] = self.event + result["data"] = self.data.to_dict() + result["created_at"] = _format_datetime(self.created_at) + if self.context is not None: + result["context"] = self.context.to_dict() + return result diff --git a/src/workos/common/models/pipes_account_connection_reauthorization_needed.py b/src/workos/common/models/pipes_account_connection_reauthorization_needed.py new file mode 100644 index 00000000..890701aa --- /dev/null +++ b/src/workos/common/models/pipes_account_connection_reauthorization_needed.py @@ -0,0 +1,61 @@ +# This file is auto-generated by oagen. Do not edit. + +from __future__ import annotations + +from dataclasses import dataclass +from datetime import datetime +from typing import Any, Literal, cast + +from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error + +from .event_context import EventContext +from .pipe_connected_account import PipeConnectedAccount + + +@dataclass(slots=True) +class PipesAccountConnectionReauthorizationNeeded: + """Pipes Account Connection Reauthorization Needed model.""" + + object: Literal["event"] + """Distinguishes the Event object.""" + id: str + """Unique identifier for the event.""" + event: Literal["pipes.account_connection.reauthorization_needed"] + data: PipeConnectedAccount + """The event payload.""" + created_at: datetime + """An ISO 8601 timestamp.""" + context: EventContext | None = None + + @classmethod + def from_dict( + cls, data: dict[str, Any] + ) -> PipesAccountConnectionReauthorizationNeeded: + """Deserialize from a dictionary.""" + try: + return cls( + object=data.get("object", "event"), + id=data["id"], + event=data.get( + "event", "pipes.account_connection.reauthorization_needed" + ), + data=PipeConnectedAccount.from_dict(cast(dict[str, Any], data["data"])), + created_at=_parse_datetime(data["created_at"]), + context=EventContext.from_dict(cast(dict[str, Any], _v_context)) + if (_v_context := data.get("context")) is not None + else None, + ) + except (KeyError, ValueError) as e: + _raise_deserialize_error("PipesAccountConnectionReauthorizationNeeded", e) + + def to_dict(self) -> dict[str, Any]: + """Serialize to a dictionary.""" + result: dict[str, Any] = {} + result["object"] = self.object + result["id"] = self.id + result["event"] = self.event + result["data"] = self.data.to_dict() + result["created_at"] = _format_datetime(self.created_at) + if self.context is not None: + result["context"] = self.context.to_dict() + return result diff --git a/src/workos/common/models/pipes_connected_account_connection_failed_data.py b/src/workos/common/models/pipes_connected_account_connection_failed_data.py index fdee3e18..a2ac2194 100644 --- a/src/workos/common/models/pipes_connected_account_connection_failed_data.py +++ b/src/workos/common/models/pipes_connected_account_connection_failed_data.py @@ -1,86 +1,11 @@ # This file is auto-generated by oagen. Do not edit. -from __future__ import annotations +from typing import TypeAlias -from dataclasses import dataclass -from datetime import datetime -from typing import Any, Literal +from .pipes_account_connection_add_failed_data import ( + PipesAccountConnectionAddFailedData, +) -from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error - - -@dataclass(slots=True) -class PipesConnectedAccountConnectionFailedData: - """The event payload.""" - - object: Literal["connection_failed"] - """The object type.""" - data_integration_id: str - """The unique ID of the data integration.""" - provider_slug: str - """The provider slug for this connection attempt.""" - user_id: str | None - """The ID of the User the connection attempt belongs to.""" - organization_id: str | None - """The ID of the Organization the connection attempt belongs to.""" - error_code: str - """A machine-readable error code for the failure.""" - error_reason: str | None - """A human-readable explanation of the failure.""" - provider_error: str | None - """The raw error code returned by the OAuth provider.""" - provider_error_description: str | None - """The raw error description returned by the OAuth provider.""" - created_at: datetime - """An ISO 8601 timestamp.""" - - @classmethod - def from_dict( - cls, data: dict[str, Any] - ) -> PipesConnectedAccountConnectionFailedData: - """Deserialize from a dictionary.""" - try: - return cls( - object=data.get("object", "connection_failed"), - data_integration_id=data["data_integration_id"], - provider_slug=data["provider_slug"], - user_id=data["user_id"], - organization_id=data["organization_id"], - error_code=data["error_code"], - error_reason=data["error_reason"], - provider_error=data["provider_error"], - provider_error_description=data["provider_error_description"], - created_at=_parse_datetime(data["created_at"]), - ) - except (KeyError, ValueError) as e: - _raise_deserialize_error("PipesConnectedAccountConnectionFailedData", e) - - def to_dict(self) -> dict[str, Any]: - """Serialize to a dictionary.""" - result: dict[str, Any] = {} - result["object"] = self.object - result["data_integration_id"] = self.data_integration_id - result["provider_slug"] = self.provider_slug - if self.user_id is not None: - result["user_id"] = self.user_id - else: - result["user_id"] = None - if self.organization_id is not None: - result["organization_id"] = self.organization_id - else: - result["organization_id"] = None - result["error_code"] = self.error_code - if self.error_reason is not None: - result["error_reason"] = self.error_reason - else: - result["error_reason"] = None - if self.provider_error is not None: - result["provider_error"] = self.provider_error - else: - result["provider_error"] = None - if self.provider_error_description is not None: - result["provider_error_description"] = self.provider_error_description - else: - result["provider_error_description"] = None - result["created_at"] = _format_datetime(self.created_at) - return result +PipesConnectedAccountConnectionFailedData: TypeAlias = ( + PipesAccountConnectionAddFailedData +) diff --git a/src/workos/common/models/resource_export_completed_data_resource_type.py b/src/workos/common/models/resource_export_completed_data_resource_type.py index 4d08f5cc..d9e58dc1 100644 --- a/src/workos/common/models/resource_export_completed_data_resource_type.py +++ b/src/workos/common/models/resource_export_completed_data_resource_type.py @@ -17,6 +17,7 @@ class ResourceExportCompletedDataResourceType(str, Enum): SESSIONS = "sessions" AUDIT_LOG_EVENTS = "auditLogEvents" CONNECTIONS = "connections" + DIRECTORY_USERS = "directoryUsers" @classmethod def _missing_(cls, value: object) -> ResourceExportCompletedDataResourceType | None: @@ -29,5 +30,11 @@ def _missing_(cls, value: object) -> ResourceExportCompletedDataResourceType | N ResourceExportCompletedDataResourceTypeLiteral: TypeAlias = Literal[ - "users", "organizations", "events", "sessions", "auditLogEvents", "connections" + "users", + "organizations", + "events", + "sessions", + "auditLogEvents", + "connections", + "directoryUsers", ] diff --git a/src/workos/connect/_resource.py b/src/workos/connect/_resource.py index 0c65c13d..9f06c2eb 100644 --- a/src/workos/connect/_resource.py +++ b/src/workos/connect/_resource.py @@ -110,9 +110,9 @@ def list_applications( Args: 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`. + 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`. registration_types: Filter Connect Applications by registration type. Specify multiple as a comma-separated list (e.g. `registration_types=dynamic,authenticated`). Defaults to `authenticated` only when not specified. organization_id: Filter Connect Applications by organization ID. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. @@ -552,9 +552,9 @@ async def list_applications( Args: 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`. + 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`. registration_types: Filter Connect Applications by registration type. Specify multiple as a comma-separated list (e.g. `registration_types=dynamic,authenticated`). Defaults to `authenticated` only when not specified. organization_id: Filter Connect Applications by organization ID. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. diff --git a/src/workos/directory_sync/_resource.py b/src/workos/directory_sync/_resource.py index 48531284..0a7bdd45 100644 --- a/src/workos/directory_sync/_resource.py +++ b/src/workos/directory_sync/_resource.py @@ -152,9 +152,9 @@ def list_groups( Args: 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`. + 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`. directory: Unique identifier of the WorkOS Directory. This value can be obtained from the WorkOS dashboard or from the WorkOS API. user: Unique identifier of the WorkOS Directory User. This value can be obtained from the WorkOS API. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. @@ -240,9 +240,9 @@ def list_users( Args: 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`. + 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`. directory: Unique identifier of the WorkOS Directory. This value can be obtained from the WorkOS dashboard or from the WorkOS API. group: Unique identifier of the WorkOS Directory Group. This value can be obtained from the WorkOS API. idp_id: Filter Directory Users by the identity provider's unique identifier (`idp_id`). Requires the `directory` parameter to also be provided. @@ -451,9 +451,9 @@ async def list_groups( Args: 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`. + 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`. directory: Unique identifier of the WorkOS Directory. This value can be obtained from the WorkOS dashboard or from the WorkOS API. user: Unique identifier of the WorkOS Directory User. This value can be obtained from the WorkOS API. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. @@ -539,9 +539,9 @@ async def list_users( Args: 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`. + 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`. directory: Unique identifier of the WorkOS Directory. This value can be obtained from the WorkOS dashboard or from the WorkOS API. group: Unique identifier of the WorkOS Directory Group. This value can be obtained from the WorkOS API. idp_id: Filter Directory Users by the identity provider's unique identifier (`idp_id`). Requires the `directory` parameter to also be provided. diff --git a/src/workos/events/_resource.py b/src/workos/events/_resource.py index fcb68d34..a5caef77 100644 --- a/src/workos/events/_resource.py +++ b/src/workos/events/_resource.py @@ -39,9 +39,9 @@ def list_events( Args: 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`. + 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`. events: Filter events by one or more event types (e.g. `dsync.user.created`). range_start: ISO-8601 date string to filter events created after this date. range_end: ISO-8601 date string to filter events created before this date. @@ -109,9 +109,9 @@ async def list_events( Args: 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`. + 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`. events: Filter events by one or more event types (e.g. `dsync.user.created`). range_start: ISO-8601 date string to filter events created after this date. range_end: ISO-8601 date string to filter events created before this date. diff --git a/src/workos/events/models/event_schema.py b/src/workos/events/models/event_schema.py index eded15c9..886e0966 100644 --- a/src/workos/events/models/event_schema.py +++ b/src/workos/events/models/event_schema.py @@ -144,6 +144,21 @@ from workos.common.models.permission_created import PermissionCreated from workos.common.models.permission_deleted import PermissionDeleted from workos.common.models.permission_updated import PermissionUpdated +from workos.common.models.pipes_account_connection_add_failed import ( + PipesAccountConnectionAddFailed, +) +from workos.common.models.pipes_account_connection_connected import ( + PipesAccountConnectionConnected, +) +from workos.common.models.pipes_account_connection_connection_failed import ( + PipesAccountConnectionConnectionFailed, +) +from workos.common.models.pipes_account_connection_disconnected import ( + PipesAccountConnectionDisconnected, +) +from workos.common.models.pipes_account_connection_reauthorization_needed import ( + PipesAccountConnectionReauthorizationNeeded, +) from workos.common.models.pipes_connected_account_connected import ( PipesConnectedAccountConnected, ) @@ -296,6 +311,11 @@ def to_dict(self) -> dict[str, Any]: PermissionCreated, PermissionDeleted, PermissionUpdated, + PipesAccountConnectionAddFailed, + PipesAccountConnectionConnected, + PipesAccountConnectionConnectionFailed, + PipesAccountConnectionDisconnected, + PipesAccountConnectionReauthorizationNeeded, PipesConnectedAccountConnected, PipesConnectedAccountConnectionFailed, PipesConnectedAccountDisconnected, @@ -426,6 +446,11 @@ class EventSchema: "permission.created": PermissionCreated, "permission.deleted": PermissionDeleted, "permission.updated": PermissionUpdated, + "pipes.account_connection.add_failed": PipesAccountConnectionAddFailed, + "pipes.account_connection.connected": PipesAccountConnectionConnected, + "pipes.account_connection.connection_failed": PipesAccountConnectionConnectionFailed, + "pipes.account_connection.disconnected": PipesAccountConnectionDisconnected, + "pipes.account_connection.reauthorization_needed": PipesAccountConnectionReauthorizationNeeded, "pipes.connected_account.connected": PipesConnectedAccountConnected, "pipes.connected_account.connection_failed": PipesConnectedAccountConnectionFailed, "pipes.connected_account.disconnected": PipesConnectedAccountDisconnected, diff --git a/src/workos/feature_flags/_resource.py b/src/workos/feature_flags/_resource.py index e5c12aae..e3ee805a 100644 --- a/src/workos/feature_flags/_resource.py +++ b/src/workos/feature_flags/_resource.py @@ -172,7 +172,7 @@ def add_flag_target( Enables a feature flag for a specific target in the current environment. Currently, supported targets include users and organizations. Args: - resource_id: The resource ID in format "user_" or "org_". + resource_id: The resource ID in format \"user_\" or \"org_\". slug: The unique slug identifier of the feature flag. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. @@ -202,7 +202,7 @@ def remove_flag_target( Removes a target from the feature flag's target list in the current environment. Currently, supported targets include users and organizations. Args: - resource_id: The resource ID in format "user_" or "org_". + resource_id: The resource ID in format \"user_\" or \"org_\". slug: The unique slug identifier of the feature flag. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. @@ -476,7 +476,7 @@ async def add_flag_target( Enables a feature flag for a specific target in the current environment. Currently, supported targets include users and organizations. Args: - resource_id: The resource ID in format "user_" or "org_". + resource_id: The resource ID in format \"user_\" or \"org_\". slug: The unique slug identifier of the feature flag. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. @@ -506,7 +506,7 @@ async def remove_flag_target( Removes a target from the feature flag's target list in the current environment. Currently, supported targets include users and organizations. Args: - resource_id: The resource ID in format "user_" or "org_". + resource_id: The resource ID in format \"user_\" or \"org_\". slug: The unique slug identifier of the feature flag. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. diff --git a/src/workos/groups/_resource.py b/src/workos/groups/_resource.py index c8a070e7..aa11a988 100644 --- a/src/workos/groups/_resource.py +++ b/src/workos/groups/_resource.py @@ -41,9 +41,9 @@ def list_organization_groups( Args: organization_id: The ID of the organization. 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`. + 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`. search: Search groups by name or by group ID. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. @@ -249,9 +249,9 @@ def list_group_organization_memberships( organization_id: Unique identifier of the Organization. group_id: Unique identifier of the Group. 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`. + 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`. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: @@ -398,9 +398,9 @@ async def list_organization_groups( Args: organization_id: The ID of the organization. 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`. + 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`. search: Search groups by name or by group ID. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. @@ -606,9 +606,9 @@ async def list_group_organization_memberships( organization_id: Unique identifier of the Organization. group_id: Unique identifier of the Group. 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`. + 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`. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: diff --git a/src/workos/multi_factor_auth/_resource.py b/src/workos/multi_factor_auth/_resource.py index 62610cf2..e466a385 100644 --- a/src/workos/multi_factor_auth/_resource.py +++ b/src/workos/multi_factor_auth/_resource.py @@ -188,7 +188,7 @@ def challenge_factor( Args: id: The unique ID of the Authentication Factor to be challenged. - sms_template: A custom template for the SMS message. Use the {{code}} placeholder to include the verification code. + sms_template: A custom template for the SMS message. Use the {{code}} placeholder to include the verification code. Must not contain URLs or domain names. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: @@ -197,8 +197,8 @@ def challenge_factor( Raises: 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). + AuthenticationError: If the API key is invalid (401). ServerError: If the server returns a 5xx error. """ body: dict[str, Any] = { @@ -478,7 +478,7 @@ async def challenge_factor( Args: id: The unique ID of the Authentication Factor to be challenged. - sms_template: A custom template for the SMS message. Use the {{code}} placeholder to include the verification code. + sms_template: A custom template for the SMS message. Use the {{code}} placeholder to include the verification code. Must not contain URLs or domain names. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: @@ -487,8 +487,8 @@ async def challenge_factor( Raises: 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). + AuthenticationError: If the API key is invalid (401). ServerError: If the server returns a 5xx error. """ body: dict[str, Any] = { diff --git a/src/workos/multi_factor_auth/models/challenge_authentication_factor.py b/src/workos/multi_factor_auth/models/challenge_authentication_factor.py index 2ae35115..2d197d07 100644 --- a/src/workos/multi_factor_auth/models/challenge_authentication_factor.py +++ b/src/workos/multi_factor_auth/models/challenge_authentication_factor.py @@ -13,7 +13,7 @@ class ChallengeAuthenticationFactor: """Challenge Authentication Factor model.""" sms_template: str | None = None - """A custom template for the SMS message. Use the {{code}} placeholder to include the verification code.""" + """A custom template for the SMS message. Use the {{code}} placeholder to include the verification code. Must not contain URLs or domain names.""" @classmethod def from_dict(cls, data: dict[str, Any]) -> ChallengeAuthenticationFactor: diff --git a/src/workos/organization_membership/_resource.py b/src/workos/organization_membership/_resource.py index 1c020c59..4004faca 100644 --- a/src/workos/organization_membership/_resource.py +++ b/src/workos/organization_membership/_resource.py @@ -60,9 +60,9 @@ def list_organization_memberships( Args: 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`. + 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`. organization_id: The ID of the [organization](https://workos.com/docs/reference/organization) which the user belongs to. statuses: Filter by the status of the organization membership. Array including any of `active`, `inactive`, or `pending`. user_id: The ID of the [user](https://workos.com/docs/reference/authkit/user). @@ -337,9 +337,9 @@ def list_organization_membership_groups( Args: om_id: Unique identifier of the Organization Membership. 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`. + 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`. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: @@ -395,9 +395,9 @@ async def list_organization_memberships( Args: 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`. + 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`. organization_id: The ID of the [organization](https://workos.com/docs/reference/organization) which the user belongs to. statuses: Filter by the status of the organization membership. Array including any of `active`, `inactive`, or `pending`. user_id: The ID of the [user](https://workos.com/docs/reference/authkit/user). @@ -672,9 +672,9 @@ async def list_organization_membership_groups( Args: om_id: Unique identifier of the Organization Membership. 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`. + 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`. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: diff --git a/src/workos/organizations/_resource.py b/src/workos/organizations/_resource.py index e1d5671e..bdc2b66e 100644 --- a/src/workos/organizations/_resource.py +++ b/src/workos/organizations/_resource.py @@ -45,9 +45,9 @@ def list_organizations( Args: 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`. + 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`. domains: The domains of an Organization. Any Organization with a matching domain will be returned. search: Searchable text for an Organization. Matches against the organization name. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. @@ -341,9 +341,9 @@ def list_authorized_applications( Args: organization_id: The ID of the organization. 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`. + 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`. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: @@ -580,9 +580,9 @@ async def list_organizations( Args: 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`. + 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`. domains: The domains of an Organization. Any Organization with a matching domain will be returned. search: Searchable text for an Organization. Matches against the organization name. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. @@ -876,9 +876,9 @@ async def list_authorized_applications( Args: organization_id: The ID of the organization. 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`. + 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`. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: diff --git a/src/workos/organizations_data_providers/__init__.py b/src/workos/organizations_data_providers/__init__.py new file mode 100644 index 00000000..b773fa2d --- /dev/null +++ b/src/workos/organizations_data_providers/__init__.py @@ -0,0 +1,7 @@ +# This file is auto-generated by oagen. Do not edit. + +from ._resource import ( + AsyncOrganizationsDataProviders as AsyncOrganizationsDataProviders, +) +from ._resource import OrganizationsDataProviders as OrganizationsDataProviders +from .models import * diff --git a/src/workos/organizations_data_providers/_resource.py b/src/workos/organizations_data_providers/_resource.py new file mode 100644 index 00000000..f593134d --- /dev/null +++ b/src/workos/organizations_data_providers/_resource.py @@ -0,0 +1,584 @@ +# This file is auto-generated by oagen. Do not edit. + +from __future__ import annotations + +from typing import TYPE_CHECKING, Any + +if TYPE_CHECKING: + from .._client import AsyncWorkOSClient, WorkOSClient + +from workos.common.models.connected_account import ConnectedAccount +from workos.common.models.connected_account_input_state import ( + ConnectedAccountInputState, +) +from workos.common.models.data_integrations_list_response import ( + DataIntegrationsListResponse, +) + +from .._types import RequestOptions, enum_value + + +class OrganizationsDataProviders: + """Organizations Data Providers API resources.""" + + def __init__(self, client: WorkOSClient) -> None: + self._client = client + + def get_organization_connected_account( + self, + organization_id: str, + slug: str, + *, + supports_multiple_connections: bool | None = None, + connected_account_id: str | None = None, + request_options: RequestOptions | None = None, + ) -> ConnectedAccount: + """Get an organization connected account + + Retrieves an organization's [connected account](https://workos.com/docs/reference/pipes/connected-account) 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`). + supports_multiple_connections: Set to `true` to use the plural connection contract. When omitted or `false`, only the compatibility connection is considered. + connected_account_id: A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select a specific connection when the organization has several for this provider. + request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. + + Returns: + ConnectedAccount + + Raises: + BadRequestError: If the request is malformed (400). + AuthenticationError: If the API key is invalid (401). + NotFoundError: If the resource is not found (404). + ConflictError: If a conflict occurs (409). + RateLimitExceededError: If rate limited (429). + ServerError: If the server returns a 5xx error. + """ + params: dict[str, Any] = { + k: v + for k, v in { + "supports_multiple_connections": supports_multiple_connections, + "connected_account_id": connected_account_id, + }.items() + if v is not None + } + return self._client.request( + method="get", + path=( + "organizations", + str(organization_id), + "connected_accounts", + str(slug), + ), + params=params, + model=ConnectedAccount, + request_options=request_options, + ) + + def create_organization_connected_account( + self, + organization_id: str, + slug: str, + *, + access_token: str | None = None, + refresh_token: str | None = None, + expires_at: str | None = None, + scopes: list[str] | None = None, + state: ConnectedAccountInputState | str | None = None, + request_options: RequestOptions | None = None, + ) -> ConnectedAccount: + """Import an organization connected account + + Imports an organization-owned [connected account](https://workos.com/docs/reference/pipes/connected-account) by providing OAuth tokens directly. Use this to migrate existing connections or set up connections without going through the OAuth flow. + + Args: + organization_id: An [Organization](https://workos.com/docs/reference/organization) identifier. + slug: The slug identifier of the provider (e.g., `github`, `slack`, `notion`). + 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. + request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. + + Returns: + ConnectedAccount + + Raises: + AuthenticationError: If the API key is invalid (401). + NotFoundError: If the resource is not found (404). + ConflictError: If a conflict occurs (409). + UnprocessableEntityError: If the request data is unprocessable (422). + RateLimitExceededError: If rate limited (429). + ServerError: If the server returns a 5xx error. + """ + body: dict[str, Any] = { + k: v + for k, v in { + "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, + }.items() + if v is not None + } + return self._client.request( + method="post", + path=( + "organizations", + str(organization_id), + "connected_accounts", + str(slug), + ), + body=body, + model=ConnectedAccount, + request_options=request_options, + ) + + def update_organization_connected_account( + self, + organization_id: str, + slug: str, + *, + access_token: str | None = None, + refresh_token: str | None = None, + expires_at: str | None = None, + scopes: list[str] | None = None, + state: ConnectedAccountInputState | str | None = None, + supports_multiple_connections: bool | None = None, + connected_account_id: str | None = None, + request_options: RequestOptions | None = None, + ) -> 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. + + Args: + organization_id: An [Organization](https://workos.com/docs/reference/organization) identifier. + slug: The slug identifier of the provider (e.g., `github`, `slack`, `notion`). + 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. + supports_multiple_connections: Set to `true` to use the plural connection contract. When omitted or `false`, only the compatibility connection is considered. + connected_account_id: A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select the connection to update. + request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. + + Returns: + ConnectedAccount + + Raises: + BadRequestError: If the request is malformed (400). + AuthenticationError: If the API key is invalid (401). + NotFoundError: If the resource is not found (404). + ConflictError: If a conflict occurs (409). + UnprocessableEntityError: If the request data is unprocessable (422). + RateLimitExceededError: If rate limited (429). + ServerError: If the server returns a 5xx error. + """ + body: dict[str, Any] = { + k: v + for k, v in { + "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, + }.items() + if v is not None + } + params: dict[str, Any] = { + k: v + for k, v in { + "supports_multiple_connections": supports_multiple_connections, + "connected_account_id": connected_account_id, + }.items() + if v is not None + } + return self._client.request( + method="put", + path=( + "organizations", + str(organization_id), + "connected_accounts", + str(slug), + ), + body=body, + params=params, + model=ConnectedAccount, + request_options=request_options, + ) + + def delete_organization_connected_account( + self, + organization_id: str, + slug: str, + *, + supports_multiple_connections: bool | None = None, + connected_account_id: str | None = None, + request_options: RequestOptions | None = None, + ) -> None: + """Delete an organization connected account + + Disconnects the organization's account for the provider, including removing any stored access and refresh tokens. A member will need to reauthorize if the organization wants to reconnect. This does not revoke access on the provider side. + + Args: + organization_id: An [Organization](https://workos.com/docs/reference/organization) identifier. + slug: The slug identifier of the provider (e.g., `github`, `slack`, `notion`). + supports_multiple_connections: Set to `true` to use the plural connection contract. When omitted or `false`, only the compatibility connection is considered. + connected_account_id: A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select the connection to delete. + request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. + + Raises: + BadRequestError: If the request is malformed (400). + AuthenticationError: If the API key is invalid (401). + NotFoundError: If the resource is not found (404). + ConflictError: If a conflict occurs (409). + RateLimitExceededError: If rate limited (429). + ServerError: If the server returns a 5xx error. + """ + params: dict[str, Any] = { + k: v + for k, v in { + "supports_multiple_connections": supports_multiple_connections, + "connected_account_id": connected_account_id, + }.items() + if v is not None + } + self._client.request( + method="delete", + path=( + "organizations", + str(organization_id), + "connected_accounts", + str(slug), + ), + params=params, + request_options=request_options, + ) + + def list_organization_data_providers( + self, + organization_id: str, + *, + supports_multiple_connections: bool | None = None, + request_options: RequestOptions | None = None, + ) -> DataIntegrationsListResponse: + """List providers for an organization + + Retrieves the organization-owned providers configured for your environment and the organization's [connected account](https://workos.com/docs/reference/pipes/connected-account) information for each. Providers owned by individual users are not included. + + Args: + organization_id: An [Organization](https://workos.com/docs/reference/organization) identifier to list providers and connected accounts for. + supports_multiple_connections: Set to `true` to use the plural connection contract. When omitted or `false`, only the compatibility connection is considered. + request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. + + Returns: + DataIntegrationsListResponse + + Raises: + AuthenticationError: If the API key is invalid (401). + NotFoundError: If the resource is not found (404). + RateLimitExceededError: If rate limited (429). + ServerError: If the server returns a 5xx error. + """ + params: dict[str, Any] = { + k: v + for k, v in { + "supports_multiple_connections": supports_multiple_connections, + }.items() + if v is not None + } + return self._client.request( + method="get", + path=("organizations", str(organization_id), "data_providers"), + params=params, + model=DataIntegrationsListResponse, + request_options=request_options, + ) + + +class AsyncOrganizationsDataProviders: + """Organizations Data Providers API resources (async).""" + + def __init__(self, client: AsyncWorkOSClient) -> None: + self._client = client + + async def get_organization_connected_account( + self, + organization_id: str, + slug: str, + *, + supports_multiple_connections: bool | None = None, + connected_account_id: str | None = None, + request_options: RequestOptions | None = None, + ) -> ConnectedAccount: + """Get an organization connected account + + Retrieves an organization's [connected account](https://workos.com/docs/reference/pipes/connected-account) 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`). + supports_multiple_connections: Set to `true` to use the plural connection contract. When omitted or `false`, only the compatibility connection is considered. + connected_account_id: A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select a specific connection when the organization has several for this provider. + request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. + + Returns: + ConnectedAccount + + Raises: + BadRequestError: If the request is malformed (400). + AuthenticationError: If the API key is invalid (401). + NotFoundError: If the resource is not found (404). + ConflictError: If a conflict occurs (409). + RateLimitExceededError: If rate limited (429). + ServerError: If the server returns a 5xx error. + """ + params: dict[str, Any] = { + k: v + for k, v in { + "supports_multiple_connections": supports_multiple_connections, + "connected_account_id": connected_account_id, + }.items() + if v is not None + } + return await self._client.request( + method="get", + path=( + "organizations", + str(organization_id), + "connected_accounts", + str(slug), + ), + params=params, + model=ConnectedAccount, + request_options=request_options, + ) + + async def create_organization_connected_account( + self, + organization_id: str, + slug: str, + *, + access_token: str | None = None, + refresh_token: str | None = None, + expires_at: str | None = None, + scopes: list[str] | None = None, + state: ConnectedAccountInputState | str | None = None, + request_options: RequestOptions | None = None, + ) -> ConnectedAccount: + """Import an organization connected account + + Imports an organization-owned [connected account](https://workos.com/docs/reference/pipes/connected-account) by providing OAuth tokens directly. Use this to migrate existing connections or set up connections without going through the OAuth flow. + + Args: + organization_id: An [Organization](https://workos.com/docs/reference/organization) identifier. + slug: The slug identifier of the provider (e.g., `github`, `slack`, `notion`). + 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. + request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. + + Returns: + ConnectedAccount + + Raises: + AuthenticationError: If the API key is invalid (401). + NotFoundError: If the resource is not found (404). + ConflictError: If a conflict occurs (409). + UnprocessableEntityError: If the request data is unprocessable (422). + RateLimitExceededError: If rate limited (429). + ServerError: If the server returns a 5xx error. + """ + body: dict[str, Any] = { + k: v + for k, v in { + "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, + }.items() + if v is not None + } + return await self._client.request( + method="post", + path=( + "organizations", + str(organization_id), + "connected_accounts", + str(slug), + ), + body=body, + model=ConnectedAccount, + request_options=request_options, + ) + + async def update_organization_connected_account( + self, + organization_id: str, + slug: str, + *, + access_token: str | None = None, + refresh_token: str | None = None, + expires_at: str | None = None, + scopes: list[str] | None = None, + state: ConnectedAccountInputState | str | None = None, + supports_multiple_connections: bool | None = None, + connected_account_id: str | None = None, + request_options: RequestOptions | None = None, + ) -> 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. + + Args: + organization_id: An [Organization](https://workos.com/docs/reference/organization) identifier. + slug: The slug identifier of the provider (e.g., `github`, `slack`, `notion`). + 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. + supports_multiple_connections: Set to `true` to use the plural connection contract. When omitted or `false`, only the compatibility connection is considered. + connected_account_id: A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select the connection to update. + request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. + + Returns: + ConnectedAccount + + Raises: + BadRequestError: If the request is malformed (400). + AuthenticationError: If the API key is invalid (401). + NotFoundError: If the resource is not found (404). + ConflictError: If a conflict occurs (409). + UnprocessableEntityError: If the request data is unprocessable (422). + RateLimitExceededError: If rate limited (429). + ServerError: If the server returns a 5xx error. + """ + body: dict[str, Any] = { + k: v + for k, v in { + "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, + }.items() + if v is not None + } + params: dict[str, Any] = { + k: v + for k, v in { + "supports_multiple_connections": supports_multiple_connections, + "connected_account_id": connected_account_id, + }.items() + if v is not None + } + return await self._client.request( + method="put", + path=( + "organizations", + str(organization_id), + "connected_accounts", + str(slug), + ), + body=body, + params=params, + model=ConnectedAccount, + request_options=request_options, + ) + + async def delete_organization_connected_account( + self, + organization_id: str, + slug: str, + *, + supports_multiple_connections: bool | None = None, + connected_account_id: str | None = None, + request_options: RequestOptions | None = None, + ) -> None: + """Delete an organization connected account + + Disconnects the organization's account for the provider, including removing any stored access and refresh tokens. A member will need to reauthorize if the organization wants to reconnect. This does not revoke access on the provider side. + + Args: + organization_id: An [Organization](https://workos.com/docs/reference/organization) identifier. + slug: The slug identifier of the provider (e.g., `github`, `slack`, `notion`). + supports_multiple_connections: Set to `true` to use the plural connection contract. When omitted or `false`, only the compatibility connection is considered. + connected_account_id: A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select the connection to delete. + request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. + + Raises: + BadRequestError: If the request is malformed (400). + AuthenticationError: If the API key is invalid (401). + NotFoundError: If the resource is not found (404). + ConflictError: If a conflict occurs (409). + RateLimitExceededError: If rate limited (429). + ServerError: If the server returns a 5xx error. + """ + params: dict[str, Any] = { + k: v + for k, v in { + "supports_multiple_connections": supports_multiple_connections, + "connected_account_id": connected_account_id, + }.items() + if v is not None + } + await self._client.request( + method="delete", + path=( + "organizations", + str(organization_id), + "connected_accounts", + str(slug), + ), + params=params, + request_options=request_options, + ) + + async def list_organization_data_providers( + self, + organization_id: str, + *, + supports_multiple_connections: bool | None = None, + request_options: RequestOptions | None = None, + ) -> DataIntegrationsListResponse: + """List providers for an organization + + Retrieves the organization-owned providers configured for your environment and the organization's [connected account](https://workos.com/docs/reference/pipes/connected-account) information for each. Providers owned by individual users are not included. + + Args: + organization_id: An [Organization](https://workos.com/docs/reference/organization) identifier to list providers and connected accounts for. + supports_multiple_connections: Set to `true` to use the plural connection contract. When omitted or `false`, only the compatibility connection is considered. + request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. + + Returns: + DataIntegrationsListResponse + + Raises: + AuthenticationError: If the API key is invalid (401). + NotFoundError: If the resource is not found (404). + RateLimitExceededError: If rate limited (429). + ServerError: If the server returns a 5xx error. + """ + params: dict[str, Any] = { + k: v + for k, v in { + "supports_multiple_connections": supports_multiple_connections, + }.items() + if v is not None + } + return await self._client.request( + method="get", + path=("organizations", str(organization_id), "data_providers"), + params=params, + model=DataIntegrationsListResponse, + request_options=request_options, + ) diff --git a/src/workos/organizations_data_providers/models/__init__.py b/src/workos/organizations_data_providers/models/__init__.py new file mode 100644 index 00000000..5271119e --- /dev/null +++ b/src/workos/organizations_data_providers/models/__init__.py @@ -0,0 +1,14 @@ +# This file is auto-generated by oagen. Do not edit. + +from workos.common.models.connected_account_input import ( + ConnectedAccountInput as ConnectedAccountInput, +) +from workos.common.models.data_integrations_list_response import ( + DataIntegrationsListResponse as DataIntegrationsListResponse, +) +from workos.common.models.data_integrations_list_response_data import ( + DataIntegrationsListResponseData as DataIntegrationsListResponseData, +) +from workos.common.models.data_integrations_list_response_data_connected_account import ( + DataIntegrationsListResponseDataConnectedAccount as DataIntegrationsListResponseDataConnectedAccount, +) diff --git a/src/workos/pipes/_resource.py b/src/workos/pipes/_resource.py index a9287d72..d716edff 100644 --- a/src/workos/pipes/_resource.py +++ b/src/workos/pipes/_resource.py @@ -17,9 +17,15 @@ from workos.common.models.create_data_integration_ownership import ( CreateDataIntegrationOwnership, ) +from workos.common.models.data_integrations_get_data_integration_authorize_url_request_connection_owner import ( + DataIntegrationsGetDataIntegrationAuthorizeUrlRequestConnectionOwner, +) from workos.common.models.data_integrations_get_user_token_request_connection_owner import ( DataIntegrationsGetUserTokenRequestConnectionOwner, ) +from workos.common.models.data_integrations_list_response import ( + DataIntegrationsListResponse, +) from workos.common.models.data_integrations_upsert_api_key_request_connection_owner import ( DataIntegrationsUpsertApiKeyRequestConnectionOwner, ) @@ -41,7 +47,6 @@ DataIntegrationAuthorizeUrlResponse, DataIntegrationCredentialsInput, DataIntegrationCredentialsResponse, - DataIntegrationsListResponse, PipesOwnership, UpdateCustomProviderDefinition, ) @@ -69,9 +74,9 @@ def list_data_integrations( Args: 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`. + 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`. ownership: Only return Data Integrations with this ownership: `user` for the integrations users connect their own accounts to, or `organization` for the roots organizations connect to. Omit to return both. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. @@ -121,7 +126,7 @@ def create_data_integration( ) -> DataIntegration: """Create a data integration - Creates a data integration for a provider. Set `credentials.type` to `custom` to use your own OAuth app credentials or `organization` to have each organization supply its own. Set `auth_methods` to `["api_key"]` to create an API key integration; you may optionally supply an `api_key` block to install a first tenant in the same call. Set `auth_methods` to `["client_credentials"]` to create a client-credentials integration; client credentials are installed per-tenant afterwards. Set `ownership` to `organization` to create the integration organizations connect to instead of the default user-owned one; a provider may have one of each. For a built-in provider, pass its slug as `provider`. For a custom provider, pass a new slug plus a `custom_provider` definition, or the slug of an existing custom provider (without `custom_provider`) to add the other ownership. + Creates a data integration for a provider. Set `credentials.type` to `custom` to use your own OAuth app credentials or `organization` to have each organization supply its own. Set `auth_methods` to `[\"api_key\"]` to create an API key integration; you may optionally supply an `api_key` block to install a first tenant in the same call. Set `auth_methods` to `[\"client_credentials\"]` to create a client-credentials integration; client credentials are installed per-tenant afterwards. Set `ownership` to `organization` to create the integration organizations connect to instead of the default user-owned one; a provider may have one of each. For a built-in provider, pass its slug as `provider`. For a custom provider, pass a new slug plus a `custom_provider` definition, or the slug of an existing custom provider (without `custom_provider`) to add the other ownership. Args: provider: The provider to create a Data Integration for. For a built-in provider use its slug (e.g. `github`, `slack`). For a custom provider, this is the new provider slug and `custom_provider` must be supplied. A custom provider slug cannot shadow an existing global provider slug. @@ -129,9 +134,9 @@ def create_data_integration( description: An optional description of the Data Integration. enabled: Whether the Data Integration is enabled. Defaults to `false`. scopes: The OAuth scopes to request for the Data Integration. Defaults to the provider's configured scopes when omitted. - auth_methods: How accounts authenticate with the provider. Defaults to `["oauth"]`. Use `["api_key"]` to declare an API key integration; `credentials` is then not required and keys are supplied per-tenant (optionally via `api_key` on this request). Use `["client_credentials"]` to declare a client-credentials integration; `credentials` is likewise not required and client credentials are supplied per-tenant. + auth_methods: How accounts authenticate with the provider. Defaults to `[\"oauth\"]`. Use `[\"api_key\"]` to declare an API key integration; `credentials` is then not required and keys are supplied per-tenant (optionally via `api_key` on this request). Use `[\"client_credentials\"]` to declare a client-credentials integration; `credentials` is likewise not required and client credentials are supplied per-tenant. config: Provider-specific config values (e.g. a Snowflake `account`), keyed by the config field. Only fields the built-in provider declares are accepted. - credentials: The OAuth credentials to configure for the Data Integration. Required for OAuth integrations; omit when `auth_methods` is `["api_key"]`. + credentials: The OAuth credentials to configure for the Data Integration. Required for OAuth integrations; omit when `auth_methods` is `[\"api_key\"]`. api_key: An optional API key to install for the first tenant on an `api_key` integration. Omit to declare a keyless integration; tenants can be added later via the per-installation API key path. custom_provider: The OAuth definition for a custom provider. Supply this to define a custom provider; omit it to create an integration for a built-in provider. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. @@ -366,6 +371,9 @@ def authorize_data_integration( *, user_id: str, organization_id: str | None = None, + connection_owner: DataIntegrationsGetDataIntegrationAuthorizeUrlRequestConnectionOwner + | str + | None = None, return_to: str | None = None, config: dict[str, str] | None = None, request_options: RequestOptions | None = None, @@ -376,8 +384,9 @@ def authorize_data_integration( Args: slug: The slug identifier of the provider (e.g., `github`, `slack`, `notion`). - user_id: The ID of the user to authorize. - organization_id: An organization ID to scope the authorization to a specific organization. + user_id: The ID of the user to authorize. When `connection_owner` is `organization`, this is the user authorizing on behalf of the organization; they must be an active member of the organization and do not become the owner of the resulting connected account. + organization_id: An organization ID to scope the authorization to a specific organization. Required when `connection_owner` is `organization`. + connection_owner: Who will own the connected account. `user` (the default) connects the user's own account. `organization` connects the organization's shared account and requires `organization_id`. return_to: The URL to redirect the user to after authorization. config: Connect-time config values for the provider-declared `installation`-scope fields (e.g. a Zendesk `subdomain`), keyed by the config field. Only fields the provider declares may be supplied, and required fields must be provided unless already pinned on the integration. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. @@ -398,6 +407,9 @@ def authorize_data_integration( for k, v in { "user_id": user_id, "organization_id": organization_id, + "connection_owner": enum_value(connection_owner) + if connection_owner is not None + else None, "return_to": return_to, "config": config, }.items() @@ -1044,9 +1056,9 @@ async def list_data_integrations( Args: 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`. + 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`. ownership: Only return Data Integrations with this ownership: `user` for the integrations users connect their own accounts to, or `organization` for the roots organizations connect to. Omit to return both. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. @@ -1096,7 +1108,7 @@ async def create_data_integration( ) -> DataIntegration: """Create a data integration - Creates a data integration for a provider. Set `credentials.type` to `custom` to use your own OAuth app credentials or `organization` to have each organization supply its own. Set `auth_methods` to `["api_key"]` to create an API key integration; you may optionally supply an `api_key` block to install a first tenant in the same call. Set `auth_methods` to `["client_credentials"]` to create a client-credentials integration; client credentials are installed per-tenant afterwards. Set `ownership` to `organization` to create the integration organizations connect to instead of the default user-owned one; a provider may have one of each. For a built-in provider, pass its slug as `provider`. For a custom provider, pass a new slug plus a `custom_provider` definition, or the slug of an existing custom provider (without `custom_provider`) to add the other ownership. + Creates a data integration for a provider. Set `credentials.type` to `custom` to use your own OAuth app credentials or `organization` to have each organization supply its own. Set `auth_methods` to `[\"api_key\"]` to create an API key integration; you may optionally supply an `api_key` block to install a first tenant in the same call. Set `auth_methods` to `[\"client_credentials\"]` to create a client-credentials integration; client credentials are installed per-tenant afterwards. Set `ownership` to `organization` to create the integration organizations connect to instead of the default user-owned one; a provider may have one of each. For a built-in provider, pass its slug as `provider`. For a custom provider, pass a new slug plus a `custom_provider` definition, or the slug of an existing custom provider (without `custom_provider`) to add the other ownership. Args: provider: The provider to create a Data Integration for. For a built-in provider use its slug (e.g. `github`, `slack`). For a custom provider, this is the new provider slug and `custom_provider` must be supplied. A custom provider slug cannot shadow an existing global provider slug. @@ -1104,9 +1116,9 @@ async def create_data_integration( description: An optional description of the Data Integration. enabled: Whether the Data Integration is enabled. Defaults to `false`. scopes: The OAuth scopes to request for the Data Integration. Defaults to the provider's configured scopes when omitted. - auth_methods: How accounts authenticate with the provider. Defaults to `["oauth"]`. Use `["api_key"]` to declare an API key integration; `credentials` is then not required and keys are supplied per-tenant (optionally via `api_key` on this request). Use `["client_credentials"]` to declare a client-credentials integration; `credentials` is likewise not required and client credentials are supplied per-tenant. + auth_methods: How accounts authenticate with the provider. Defaults to `[\"oauth\"]`. Use `[\"api_key\"]` to declare an API key integration; `credentials` is then not required and keys are supplied per-tenant (optionally via `api_key` on this request). Use `[\"client_credentials\"]` to declare a client-credentials integration; `credentials` is likewise not required and client credentials are supplied per-tenant. config: Provider-specific config values (e.g. a Snowflake `account`), keyed by the config field. Only fields the built-in provider declares are accepted. - credentials: The OAuth credentials to configure for the Data Integration. Required for OAuth integrations; omit when `auth_methods` is `["api_key"]`. + credentials: The OAuth credentials to configure for the Data Integration. Required for OAuth integrations; omit when `auth_methods` is `[\"api_key\"]`. api_key: An optional API key to install for the first tenant on an `api_key` integration. Omit to declare a keyless integration; tenants can be added later via the per-installation API key path. custom_provider: The OAuth definition for a custom provider. Supply this to define a custom provider; omit it to create an integration for a built-in provider. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. @@ -1341,6 +1353,9 @@ async def authorize_data_integration( *, user_id: str, organization_id: str | None = None, + connection_owner: DataIntegrationsGetDataIntegrationAuthorizeUrlRequestConnectionOwner + | str + | None = None, return_to: str | None = None, config: dict[str, str] | None = None, request_options: RequestOptions | None = None, @@ -1351,8 +1366,9 @@ async def authorize_data_integration( Args: slug: The slug identifier of the provider (e.g., `github`, `slack`, `notion`). - user_id: The ID of the user to authorize. - organization_id: An organization ID to scope the authorization to a specific organization. + user_id: The ID of the user to authorize. When `connection_owner` is `organization`, this is the user authorizing on behalf of the organization; they must be an active member of the organization and do not become the owner of the resulting connected account. + organization_id: An organization ID to scope the authorization to a specific organization. Required when `connection_owner` is `organization`. + connection_owner: Who will own the connected account. `user` (the default) connects the user's own account. `organization` connects the organization's shared account and requires `organization_id`. return_to: The URL to redirect the user to after authorization. config: Connect-time config values for the provider-declared `installation`-scope fields (e.g. a Zendesk `subdomain`), keyed by the config field. Only fields the provider declares may be supplied, and required fields must be provided unless already pinned on the integration. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. @@ -1373,6 +1389,9 @@ async def authorize_data_integration( for k, v in { "user_id": user_id, "organization_id": organization_id, + "connection_owner": enum_value(connection_owner) + if connection_owner is not None + else None, "return_to": return_to, "config": config, }.items() diff --git a/src/workos/pipes/models/__init__.py b/src/workos/pipes/models/__init__.py index 1a6cff7a..dd91230f 100644 --- a/src/workos/pipes/models/__init__.py +++ b/src/workos/pipes/models/__init__.py @@ -3,7 +3,7 @@ from workos.common.models.connected_account import ConnectedAccount as ConnectedAccount from .api_key_installation import ApiKeyInstallation as ApiKeyInstallation -from .connected_account_input import ConnectedAccountInput as ConnectedAccountInput +from .connected_account_input import * from .create_data_integration import CreateDataIntegration as CreateDataIntegration from .custom_provider_definition import ( CustomProviderDefinition as CustomProviderDefinition, @@ -42,15 +42,9 @@ from .data_integrations_get_user_token_request import ( DataIntegrationsGetUserTokenRequest as DataIntegrationsGetUserTokenRequest, ) -from .data_integrations_list_response import ( - DataIntegrationsListResponse as DataIntegrationsListResponse, -) -from .data_integrations_list_response_data import ( - DataIntegrationsListResponseData as DataIntegrationsListResponseData, -) -from .data_integrations_list_response_data_connected_account import ( - DataIntegrationsListResponseDataConnectedAccount as DataIntegrationsListResponseDataConnectedAccount, -) +from .data_integrations_list_response import * +from .data_integrations_list_response_data import * +from .data_integrations_list_response_data_connected_account import * from .data_integrations_upsert_api_key_request import ( DataIntegrationsUpsertApiKeyRequest as DataIntegrationsUpsertApiKeyRequest, ) diff --git a/src/workos/pipes/models/create_data_integration.py b/src/workos/pipes/models/create_data_integration.py index 36709675..3a259a14 100644 --- a/src/workos/pipes/models/create_data_integration.py +++ b/src/workos/pipes/models/create_data_integration.py @@ -34,11 +34,11 @@ class CreateDataIntegration: scopes: list[str] | None = None """The OAuth scopes to request for the Data Integration. Defaults to the provider's configured scopes when omitted.""" auth_methods: list[CreateDataIntegrationAuthMethods] | None = None - """How accounts authenticate with the provider. Defaults to `["oauth"]`. Use `["api_key"]` to declare an API key integration; `credentials` is then not required and keys are supplied per-tenant (optionally via `api_key` on this request). Use `["client_credentials"]` to declare a client-credentials integration; `credentials` is likewise not required and client credentials are supplied per-tenant.""" + """How accounts authenticate with the provider. Defaults to `[\"oauth\"]`. Use `[\"api_key\"]` to declare an API key integration; `credentials` is then not required and keys are supplied per-tenant (optionally via `api_key` on this request). Use `[\"client_credentials\"]` to declare a client-credentials integration; `credentials` is likewise not required and client credentials are supplied per-tenant.""" config: dict[str, str] | None = None """Provider-specific config values (e.g. a Snowflake `account`), keyed by the config field. Only fields the built-in provider declares are accepted.""" credentials: DataIntegrationCredentialsInput | None = None - """The OAuth credentials to configure for the Data Integration. Required for OAuth integrations; omit when `auth_methods` is `["api_key"]`.""" + """The OAuth credentials to configure for the Data Integration. Required for OAuth integrations; omit when `auth_methods` is `[\"api_key\"]`.""" api_key: ApiKeyInstallation | None = None """An optional API key to install for the first tenant on an `api_key` integration. Omit to declare a keyless integration; tenants can be added later via the per-installation API key path.""" custom_provider: CustomProviderDefinition | None = None 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 3d3caa4e..ab1bc53d 100644 --- a/src/workos/pipes/models/data_integration_access_token_response.py +++ b/src/workos/pipes/models/data_integration_access_token_response.py @@ -25,8 +25,8 @@ class DataIntegrationAccessTokenResponse: access_token: DataIntegrationAccessTokenResponseAccessToken | None = None """The [access token](https://workos.com/docs/reference/pipes/access-token) object, present when `active` is `true`.""" error: DataIntegrationAccessTokenResponseError | None = None - """- `"not_installed"`: The user does not have the integration installed. -- `"needs_reauthorization"`: The user needs to reauthorize the integration.""" + """- `\"not_installed\"`: The user does not have the integration installed. +- `\"needs_reauthorization\"`: The user needs to reauthorize the integration.""" @classmethod def from_dict(cls, data: dict[str, Any]) -> DataIntegrationAccessTokenResponse: diff --git a/src/workos/pipes/models/data_integration_credentials_response.py b/src/workos/pipes/models/data_integration_credentials_response.py index 6c499bba..54f33d1e 100644 --- a/src/workos/pipes/models/data_integration_credentials_response.py +++ b/src/workos/pipes/models/data_integration_credentials_response.py @@ -26,8 +26,8 @@ class DataIntegrationCredentialsResponse: """The credential object containing the vended secret.""" error: DataIntegrationCredentialsResponseError | None = None """The reason credentials are unavailable. Additional values may be added in the future; handle unknown values gracefully. -- `"not_installed"`: The user does not have the integration installed. -- `"needs_reauthorization"`: The user needs to reauthorize the integration.""" +- `\"not_installed\"`: The user does not have the integration installed. +- `\"needs_reauthorization\"`: The user needs to reauthorize the integration.""" @classmethod def from_dict(cls, data: dict[str, Any]) -> DataIntegrationCredentialsResponse: diff --git a/src/workos/pipes/models/data_integration_installation.py b/src/workos/pipes/models/data_integration_installation.py index 983f9036..d5a3e7ba 100644 --- a/src/workos/pipes/models/data_integration_installation.py +++ b/src/workos/pipes/models/data_integration_installation.py @@ -3,9 +3,13 @@ from __future__ import annotations from dataclasses import dataclass +from enum import Enum from typing import Any from workos._types import _raise_deserialize_error +from workos.common.models.data_integration_installation_connection_role import ( + DataIntegrationInstallationConnectionRole, +) @dataclass(slots=True) @@ -14,6 +18,12 @@ class DataIntegrationInstallation: id: str """Unique identifier of the installation.""" + connection_role: DataIntegrationInstallationConnectionRole + """Whether this is the compatibility connection visible to undeclared clients or a standard connection for plural-aware clients.""" + account_identifier: str | None + """A best-effort provider account identifier used for correlation, not connection selection.""" + account_display_name: str | None + """A mutable, non-unique display name for this connection.""" user_id: str | None """The User the API key was installed for. Null on an `organization`-owned integration, whose installations belong to the organization.""" organization_id: str | None @@ -27,6 +37,11 @@ def from_dict(cls, data: dict[str, Any]) -> DataIntegrationInstallation: try: return cls( id=data["id"], + connection_role=DataIntegrationInstallationConnectionRole( + data["connection_role"] + ), + account_identifier=data["account_identifier"], + account_display_name=data["account_display_name"], user_id=data["user_id"], organization_id=data["organization_id"], api_key_last_4=data["api_key_last_4"], @@ -38,6 +53,19 @@ def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" result: dict[str, Any] = {} result["id"] = self.id + result["connection_role"] = ( + self.connection_role.value + if isinstance(self.connection_role, Enum) + else self.connection_role + ) + if self.account_identifier is not None: + result["account_identifier"] = self.account_identifier + else: + result["account_identifier"] = None + if self.account_display_name is not None: + result["account_display_name"] = self.account_display_name + else: + result["account_display_name"] = None if self.user_id is not None: result["user_id"] = self.user_id else: diff --git a/src/workos/pipes/models/data_integrations_get_data_integration_authorize_url_request.py b/src/workos/pipes/models/data_integrations_get_data_integration_authorize_url_request.py index 6dca8f1e..1ca8b5d5 100644 --- a/src/workos/pipes/models/data_integrations_get_data_integration_authorize_url_request.py +++ b/src/workos/pipes/models/data_integrations_get_data_integration_authorize_url_request.py @@ -3,9 +3,13 @@ from __future__ import annotations from dataclasses import dataclass +from enum import Enum from typing import Any from workos._types import _raise_deserialize_error +from workos.common.models.data_integrations_get_data_integration_authorize_url_request_connection_owner import ( + DataIntegrationsGetDataIntegrationAuthorizeUrlRequestConnectionOwner, +) @dataclass(slots=True) @@ -13,9 +17,13 @@ class DataIntegrationsGetDataIntegrationAuthorizeUrlRequest: """Data Integrations Get Data Integration Authorize Url Request model.""" user_id: str - """The ID of the user to authorize.""" + """The ID of the user to authorize. When `connection_owner` is `organization`, this is the user authorizing on behalf of the organization; they must be an active member of the organization and do not become the owner of the resulting connected account.""" organization_id: str | None = None - """An organization ID to scope the authorization to a specific organization.""" + """An organization ID to scope the authorization to a specific organization. Required when `connection_owner` is `organization`.""" + connection_owner: ( + DataIntegrationsGetDataIntegrationAuthorizeUrlRequestConnectionOwner | None + ) = None + """Who will own the connected account. `user` (the default) connects the user's own account. `organization` connects the organization's shared account and requires `organization_id`.""" return_to: str | None = None """The URL to redirect the user to after authorization.""" config: dict[str, str] | None = None @@ -30,6 +38,11 @@ def from_dict( return cls( user_id=data["user_id"], organization_id=data.get("organization_id"), + connection_owner=DataIntegrationsGetDataIntegrationAuthorizeUrlRequestConnectionOwner( + _v_connection_owner + ) + if (_v_connection_owner := data.get("connection_owner")) is not None + else None, return_to=data.get("return_to"), config=data.get("config"), ) @@ -44,6 +57,12 @@ def to_dict(self) -> dict[str, Any]: result["user_id"] = self.user_id if self.organization_id is not None: result["organization_id"] = self.organization_id + if self.connection_owner is not None: + result["connection_owner"] = ( + self.connection_owner.value + if isinstance(self.connection_owner, Enum) + else self.connection_owner + ) if self.return_to is not None: result["return_to"] = self.return_to if self.config is not None: diff --git a/src/workos/radar/_resource.py b/src/workos/radar/_resource.py index e6227195..c244c45b 100644 --- a/src/workos/radar/_resource.py +++ b/src/workos/radar/_resource.py @@ -96,8 +96,8 @@ def update_attempt( Args: id: The unique identifier of the Radar attempt to update. - challenge_status: Set to `"success"` to mark the challenge as completed. - attempt_status: Set to `"success"` to mark the authentication attempt as successful. + challenge_status: Set to `\"success\"` to mark the challenge as completed. + attempt_status: Set to `\"success\"` to mark the authentication attempt as successful. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Raises: @@ -269,8 +269,8 @@ async def update_attempt( Args: id: The unique identifier of the Radar attempt to update. - challenge_status: Set to `"success"` to mark the challenge as completed. - attempt_status: Set to `"success"` to mark the authentication attempt as successful. + challenge_status: Set to `\"success\"` to mark the challenge as completed. + attempt_status: Set to `\"success\"` to mark the authentication attempt as successful. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Raises: diff --git a/src/workos/radar/models/radar_standalone_update_radar_attempt_request.py b/src/workos/radar/models/radar_standalone_update_radar_attempt_request.py index 9a403312..fc6aee15 100644 --- a/src/workos/radar/models/radar_standalone_update_radar_attempt_request.py +++ b/src/workos/radar/models/radar_standalone_update_radar_attempt_request.py @@ -13,9 +13,9 @@ class RadarStandaloneUpdateRadarAttemptRequest: """Radar Standalone Update Radar Attempt Request model.""" challenge_status: Literal["success"] | None = None - """Set to `"success"` to mark the challenge as completed.""" + """Set to `\"success\"` to mark the challenge as completed.""" attempt_status: Literal["success"] | None = None - """Set to `"success"` to mark the authentication attempt as successful.""" + """Set to `\"success\"` to mark the authentication attempt as successful.""" @classmethod def from_dict( diff --git a/src/workos/sso/_resource.py b/src/workos/sso/_resource.py index 224c3c02..accfa86e 100644 --- a/src/workos/sso/_resource.py +++ b/src/workos/sso/_resource.py @@ -656,7 +656,7 @@ def get_authorization_url( domain_hint: Can be used to pre-fill the domain field when initiating authentication with Microsoft OAuth or with a Google SAML connection type. login_hint: Can be used to pre-fill the username/email address field of the IdP sign-in page for the user, if you know their username ahead of time. Currently supported for OAuth, OpenID Connect, Okta, Entra ID, and custom SAML connections. nonce: A random string generated by the client that is used to mitigate replay attacks. - prompt: If set to `login`, forces re-authentication at the identity provider. For supported SAML providers this sets `ForceAuthn="true"` in the SAML request; providers that don't support it are unaffected. + prompt: If set to `login`, forces re-authentication at the identity provider. For supported SAML providers this sets `ForceAuthn=\"true\"` in the SAML request; providers that don't support it are unaffected. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: @@ -1524,7 +1524,7 @@ def get_authorization_url( domain_hint: Can be used to pre-fill the domain field when initiating authentication with Microsoft OAuth or with a Google SAML connection type. login_hint: Can be used to pre-fill the username/email address field of the IdP sign-in page for the user, if you know their username ahead of time. Currently supported for OAuth, OpenID Connect, Okta, Entra ID, and custom SAML connections. nonce: A random string generated by the client that is used to mitigate replay attacks. - prompt: If set to `login`, forces re-authentication at the identity provider. For supported SAML providers this sets `ForceAuthn="true"` in the SAML request; providers that don't support it are unaffected. + prompt: If set to `login`, forces re-authentication at the identity provider. For supported SAML providers this sets `ForceAuthn=\"true\"` in the SAML request; providers that don't support it are unaffected. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: diff --git a/src/workos/types/organizations_data_providers/__init__.py b/src/workos/types/organizations_data_providers/__init__.py new file mode 100644 index 00000000..cd43f694 --- /dev/null +++ b/src/workos/types/organizations_data_providers/__init__.py @@ -0,0 +1,3 @@ +# This file is auto-generated by oagen. Do not edit. + +from workos.organizations_data_providers.models import * diff --git a/src/workos/user_management/_resource.py b/src/workos/user_management/_resource.py index 9bb150c8..269df870 100644 --- a/src/workos/user_management/_resource.py +++ b/src/workos/user_management/_resource.py @@ -581,7 +581,7 @@ def get_authorization_url( Generates an OAuth 2.0 authorization URL to authenticate a user with AuthKit or SSO. Args: - code_challenge_method: The only valid PKCE code challenge method is `"S256"`. Required when specifying a `code_challenge`. + code_challenge_method: The only valid PKCE code challenge method is `\"S256\"`. Required when specifying a `code_challenge`. code_challenge: Code challenge derived from the code verifier used for the PKCE flow. domain_hint: A domain hint for SSO connection lookup. connection_id: The ID of an SSO connection to use for authentication. @@ -832,9 +832,9 @@ def list_authkit_oauth_resources( Args: 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`. + 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`. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: @@ -875,7 +875,7 @@ def create_authkit_oauth_resource( Adds an MCP resource indicator (RFC 8707) to an environment, leaving any others in place. Args: - uri: The resource URI. May be a wildcard pattern with a single `*` in the leftmost hostname label, where enabled for the environment. + uri: The resource URI. May be a wildcard pattern with a single `*`, either in the leftmost hostname label or as the final path segment, where enabled for the environment. default: Whether the resource being created becomes the environment default, clearing any previous default. Applies at creation only — this API has no update endpoint yet, so changing the default on an existing resource is done from the dashboard. A wildcard pattern cannot be the default. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. @@ -945,9 +945,9 @@ def list_cors_origins( Args: 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`. + 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`. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: @@ -1165,9 +1165,9 @@ def list_users( Args: 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`. + 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`. organization: (deprecated) Filter users by the organization they are a member of. Deprecated in favor of `organization_id`. organization_id: Filter users by the organization they are a member of. email: Filter users by their email address. @@ -1648,9 +1648,9 @@ def list_sessions( Args: id: The ID of the user. 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`. + 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`. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: @@ -1698,9 +1698,9 @@ def list_invitations( Args: 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`. + 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`. organization_id: The ID of the [organization](https://workos.com/docs/reference/organization) that the recipient will join. email: The email address of the recipient. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. @@ -2110,9 +2110,9 @@ def list_redirect_uris( Args: 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`. + 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`. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: @@ -2220,9 +2220,9 @@ def list_user_authorized_applications( Args: user_id: The ID of the user. 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`. + 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`. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: @@ -2474,9 +2474,9 @@ def list_waitlist_entries( Args: id: The unique ID of the waitlist, or the literal `default` for the environment's default waitlist. The default waitlist is created when its first entry is added, so read requests for `default` return a `404` until then. 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`. + 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`. state: Filter waitlist entries by their state. email: Filter waitlist entries by their exact email address. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. @@ -3333,7 +3333,7 @@ def get_authorization_url( Generates an OAuth 2.0 authorization URL to authenticate a user with AuthKit or SSO. Args: - code_challenge_method: The only valid PKCE code challenge method is `"S256"`. Required when specifying a `code_challenge`. + code_challenge_method: The only valid PKCE code challenge method is `\"S256\"`. Required when specifying a `code_challenge`. code_challenge: Code challenge derived from the code verifier used for the PKCE flow. domain_hint: A domain hint for SSO connection lookup. connection_id: The ID of an SSO connection to use for authentication. @@ -3584,9 +3584,9 @@ async def list_authkit_oauth_resources( Args: 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`. + 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`. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: @@ -3627,7 +3627,7 @@ async def create_authkit_oauth_resource( Adds an MCP resource indicator (RFC 8707) to an environment, leaving any others in place. Args: - uri: The resource URI. May be a wildcard pattern with a single `*` in the leftmost hostname label, where enabled for the environment. + uri: The resource URI. May be a wildcard pattern with a single `*`, either in the leftmost hostname label or as the final path segment, where enabled for the environment. default: Whether the resource being created becomes the environment default, clearing any previous default. Applies at creation only — this API has no update endpoint yet, so changing the default on an existing resource is done from the dashboard. A wildcard pattern cannot be the default. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. @@ -3697,9 +3697,9 @@ async def list_cors_origins( Args: 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`. + 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`. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: @@ -3917,9 +3917,9 @@ async def list_users( Args: 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`. + 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`. organization: (deprecated) Filter users by the organization they are a member of. Deprecated in favor of `organization_id`. organization_id: Filter users by the organization they are a member of. email: Filter users by their email address. @@ -4400,9 +4400,9 @@ async def list_sessions( Args: id: The ID of the user. 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`. + 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`. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: @@ -4450,9 +4450,9 @@ async def list_invitations( Args: 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`. + 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`. organization_id: The ID of the [organization](https://workos.com/docs/reference/organization) that the recipient will join. email: The email address of the recipient. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. @@ -4862,9 +4862,9 @@ async def list_redirect_uris( Args: 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`. + 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`. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: @@ -4972,9 +4972,9 @@ async def list_user_authorized_applications( Args: user_id: The ID of the user. 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`. + 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`. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: @@ -5226,9 +5226,9 @@ async def list_waitlist_entries( Args: id: The unique ID of the waitlist, or the literal `default` for the environment's default waitlist. The default waitlist is created when its first entry is added, so read requests for `default` return a `404` until then. 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`. + 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`. state: Filter waitlist entries by their state. email: Filter waitlist entries by their exact email address. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. diff --git a/src/workos/user_management/models/create_authkit_oauth_resource.py b/src/workos/user_management/models/create_authkit_oauth_resource.py index 2db9b4bc..e312b036 100644 --- a/src/workos/user_management/models/create_authkit_oauth_resource.py +++ b/src/workos/user_management/models/create_authkit_oauth_resource.py @@ -13,7 +13,7 @@ class CreateAuthkitOAuthResource: """Create Authkit O Auth Resource model.""" uri: str - """The resource URI. May be a wildcard pattern with a single `*` in the leftmost hostname label, where enabled for the environment.""" + """The resource URI. May be a wildcard pattern with a single `*`, either in the leftmost hostname label or as the final path segment, where enabled for the environment.""" default: bool | None = None """Whether the resource being created becomes the environment default, clearing any previous default. Applies at creation only — this API has no update endpoint yet, so changing the default on an existing resource is done from the dashboard. A wildcard pattern cannot be the default.""" diff --git a/src/workos/webhooks/_resource.py b/src/workos/webhooks/_resource.py index 9f31e50f..94d81397 100644 --- a/src/workos/webhooks/_resource.py +++ b/src/workos/webhooks/_resource.py @@ -54,9 +54,9 @@ def list_webhook_endpoints( Args: 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`. + 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`. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: @@ -311,9 +311,9 @@ async def list_webhook_endpoints( Args: 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`. + 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`. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: diff --git a/tests/fixtures/connected_account.json b/tests/fixtures/connected_account.json index a863395d..c98e4187 100644 --- a/tests/fixtures/connected_account.json +++ b/tests/fixtures/connected_account.json @@ -1,6 +1,9 @@ { "object": "connected_account", "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", "organization_id": null, "scopes": [ diff --git a/tests/fixtures/data_integration_installation.json b/tests/fixtures/data_integration_installation.json index 394d135d..820a9344 100644 --- a/tests/fixtures/data_integration_installation.json +++ b/tests/fixtures/data_integration_installation.json @@ -1,5 +1,8 @@ { "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", "organization_id": null, "api_key_last_4": "cdef" diff --git a/tests/fixtures/data_integrations_get_data_integration_authorize_url_request.json b/tests/fixtures/data_integrations_get_data_integration_authorize_url_request.json index 2d0e5bb2..4a7ea84c 100644 --- a/tests/fixtures/data_integrations_get_data_integration_authorize_url_request.json +++ b/tests/fixtures/data_integrations_get_data_integration_authorize_url_request.json @@ -1,6 +1,7 @@ { "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_owner": "user", "return_to": "https://example.com/callback", "config": { "subdomain": "acme" diff --git a/tests/fixtures/data_integrations_list_response.json b/tests/fixtures/data_integrations_list_response.json index 365f599f..6c46a818 100644 --- a/tests/fixtures/data_integrations_list_response.json +++ b/tests/fixtures/data_integrations_list_response.json @@ -16,12 +16,16 @@ "auth_methods": [ "oauth" ], + "connection_owner": "user", "ownership": "userland_user", "created_at": "2024-01-15T10:30:00.000Z", "updated_at": "2024-01-15T10:30:00.000Z", "connected_account": { "object": "connected_account", "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", "organization_id": null, "scopes": [ @@ -44,6 +48,9 @@ { "object": "connected_account", "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", "organization_id": null, "scopes": [ diff --git a/tests/fixtures/data_integrations_list_response_data.json b/tests/fixtures/data_integrations_list_response_data.json index f3997ed1..582a3a34 100644 --- a/tests/fixtures/data_integrations_list_response_data.json +++ b/tests/fixtures/data_integrations_list_response_data.json @@ -13,12 +13,16 @@ "auth_methods": [ "oauth" ], + "connection_owner": "user", "ownership": "userland_user", "created_at": "2024-01-15T10:30:00.000Z", "updated_at": "2024-01-15T10:30:00.000Z", "connected_account": { "object": "connected_account", "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", "organization_id": null, "scopes": [ @@ -41,6 +45,9 @@ { "object": "connected_account", "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", "organization_id": null, "scopes": [ diff --git a/tests/fixtures/data_integrations_list_response_data_connected_account.json b/tests/fixtures/data_integrations_list_response_data_connected_account.json index 467bb97e..a6a8baf4 100644 --- a/tests/fixtures/data_integrations_list_response_data_connected_account.json +++ b/tests/fixtures/data_integrations_list_response_data_connected_account.json @@ -1,6 +1,9 @@ { "object": "connected_account", "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", "organization_id": null, "scopes": [ diff --git a/tests/fixtures/pipe_connected_account.json b/tests/fixtures/pipe_connected_account.json index cb474498..0a016bda 100644 --- a/tests/fixtures/pipe_connected_account.json +++ b/tests/fixtures/pipe_connected_account.json @@ -1,6 +1,9 @@ { "object": "connected_account", "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", "provider_slug": "github", "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", @@ -9,6 +12,8 @@ "repo", "user:email" ], + "auth_method": "oauth", + "api_key_last_4": null, "state": "connected", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z" diff --git a/tests/fixtures/pipes_account_connection_add_failed.json b/tests/fixtures/pipes_account_connection_add_failed.json new file mode 100644 index 00000000..085d7228 --- /dev/null +++ b/tests/fixtures/pipes_account_connection_add_failed.json @@ -0,0 +1,39 @@ +{ + "object": "event", + "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", + "event": "pipes.account_connection.add_failed", + "data": { + "object": "connection_failed", + "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", + "provider_slug": "github", + "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", + "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", + "account_identifier": null, + "error_code": "authorization_code_exchange_error", + "error_reason": "The authorization code has expired.", + "provider_error": "access_denied", + "provider_error_description": "The user denied the authorization request.", + "created_at": "2026-01-15T12:00:00.000Z" + }, + "created_at": "2026-01-15T12:00:00.000Z", + "context": { + "google_analytics_client_id": "GA1.2.1234567890.1234567890", + "google_analytics_sessions": [ + { + "containerId": "GTM-ABCDEF", + "sessionId": "1234567890", + "sessionNumber": "1" + } + ], + "ajs_anonymous_id": "ajs_anon_01EHWNCE74X7JSDV0X3SZ3KJNY", + "client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY", + "actor": { + "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", + "source": "api", + "name": "Jane Doe" + }, + "previous_attributes": { + "key": {} + } + } +} diff --git a/tests/fixtures/pipes_account_connection_add_failed_data.json b/tests/fixtures/pipes_account_connection_add_failed_data.json new file mode 100644 index 00000000..5a44d8e2 --- /dev/null +++ b/tests/fixtures/pipes_account_connection_add_failed_data.json @@ -0,0 +1,13 @@ +{ + "object": "connection_failed", + "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", + "provider_slug": "github", + "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", + "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", + "account_identifier": null, + "error_code": "authorization_code_exchange_error", + "error_reason": "The authorization code has expired.", + "provider_error": "access_denied", + "provider_error_description": "The user denied the authorization request.", + "created_at": "2026-01-15T12:00:00.000Z" +} diff --git a/tests/fixtures/pipes_account_connection_connected.json b/tests/fixtures/pipes_account_connection_connected.json new file mode 100644 index 00000000..bd1caa7a --- /dev/null +++ b/tests/fixtures/pipes_account_connection_connected.json @@ -0,0 +1,46 @@ +{ + "object": "event", + "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", + "event": "pipes.account_connection.connected", + "data": { + "object": "connected_account", + "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", + "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", + "provider_slug": "github", + "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", + "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", + "scopes": [ + "repo", + "user:email" + ], + "auth_method": "oauth", + "api_key_last_4": null, + "state": "connected", + "created_at": "2026-01-15T12:00:00.000Z", + "updated_at": "2026-01-15T12:00:00.000Z" + }, + "created_at": "2026-01-15T12:00:00.000Z", + "context": { + "google_analytics_client_id": "GA1.2.1234567890.1234567890", + "google_analytics_sessions": [ + { + "containerId": "GTM-ABCDEF", + "sessionId": "1234567890", + "sessionNumber": "1" + } + ], + "ajs_anonymous_id": "ajs_anon_01EHWNCE74X7JSDV0X3SZ3KJNY", + "client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY", + "actor": { + "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", + "source": "api", + "name": "Jane Doe" + }, + "previous_attributes": { + "key": {} + } + } +} diff --git a/tests/fixtures/pipes_account_connection_connection_failed.json b/tests/fixtures/pipes_account_connection_connection_failed.json new file mode 100644 index 00000000..6551445c --- /dev/null +++ b/tests/fixtures/pipes_account_connection_connection_failed.json @@ -0,0 +1,39 @@ +{ + "object": "event", + "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", + "event": "pipes.account_connection.connection_failed", + "data": { + "object": "connection_failed", + "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", + "provider_slug": "github", + "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", + "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", + "account_identifier": null, + "error_code": "authorization_code_exchange_error", + "error_reason": "The authorization code has expired.", + "provider_error": "access_denied", + "provider_error_description": "The user denied the authorization request.", + "created_at": "2026-01-15T12:00:00.000Z" + }, + "created_at": "2026-01-15T12:00:00.000Z", + "context": { + "google_analytics_client_id": "GA1.2.1234567890.1234567890", + "google_analytics_sessions": [ + { + "containerId": "GTM-ABCDEF", + "sessionId": "1234567890", + "sessionNumber": "1" + } + ], + "ajs_anonymous_id": "ajs_anon_01EHWNCE74X7JSDV0X3SZ3KJNY", + "client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY", + "actor": { + "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", + "source": "api", + "name": "Jane Doe" + }, + "previous_attributes": { + "key": {} + } + } +} diff --git a/tests/fixtures/pipes_account_connection_connection_failed_data.json b/tests/fixtures/pipes_account_connection_connection_failed_data.json new file mode 100644 index 00000000..5a44d8e2 --- /dev/null +++ b/tests/fixtures/pipes_account_connection_connection_failed_data.json @@ -0,0 +1,13 @@ +{ + "object": "connection_failed", + "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", + "provider_slug": "github", + "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", + "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", + "account_identifier": null, + "error_code": "authorization_code_exchange_error", + "error_reason": "The authorization code has expired.", + "provider_error": "access_denied", + "provider_error_description": "The user denied the authorization request.", + "created_at": "2026-01-15T12:00:00.000Z" +} diff --git a/tests/fixtures/pipes_account_connection_disconnected.json b/tests/fixtures/pipes_account_connection_disconnected.json new file mode 100644 index 00000000..069add21 --- /dev/null +++ b/tests/fixtures/pipes_account_connection_disconnected.json @@ -0,0 +1,46 @@ +{ + "object": "event", + "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", + "event": "pipes.account_connection.disconnected", + "data": { + "object": "connected_account", + "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", + "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", + "provider_slug": "github", + "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", + "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", + "scopes": [ + "repo", + "user:email" + ], + "auth_method": "oauth", + "api_key_last_4": null, + "state": "connected", + "created_at": "2026-01-15T12:00:00.000Z", + "updated_at": "2026-01-15T12:00:00.000Z" + }, + "created_at": "2026-01-15T12:00:00.000Z", + "context": { + "google_analytics_client_id": "GA1.2.1234567890.1234567890", + "google_analytics_sessions": [ + { + "containerId": "GTM-ABCDEF", + "sessionId": "1234567890", + "sessionNumber": "1" + } + ], + "ajs_anonymous_id": "ajs_anon_01EHWNCE74X7JSDV0X3SZ3KJNY", + "client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY", + "actor": { + "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", + "source": "api", + "name": "Jane Doe" + }, + "previous_attributes": { + "key": {} + } + } +} diff --git a/tests/fixtures/pipes_account_connection_reauthorization_needed.json b/tests/fixtures/pipes_account_connection_reauthorization_needed.json new file mode 100644 index 00000000..909f7965 --- /dev/null +++ b/tests/fixtures/pipes_account_connection_reauthorization_needed.json @@ -0,0 +1,46 @@ +{ + "object": "event", + "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", + "event": "pipes.account_connection.reauthorization_needed", + "data": { + "object": "connected_account", + "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", + "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", + "provider_slug": "github", + "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", + "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", + "scopes": [ + "repo", + "user:email" + ], + "auth_method": "oauth", + "api_key_last_4": null, + "state": "connected", + "created_at": "2026-01-15T12:00:00.000Z", + "updated_at": "2026-01-15T12:00:00.000Z" + }, + "created_at": "2026-01-15T12:00:00.000Z", + "context": { + "google_analytics_client_id": "GA1.2.1234567890.1234567890", + "google_analytics_sessions": [ + { + "containerId": "GTM-ABCDEF", + "sessionId": "1234567890", + "sessionNumber": "1" + } + ], + "ajs_anonymous_id": "ajs_anon_01EHWNCE74X7JSDV0X3SZ3KJNY", + "client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY", + "actor": { + "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", + "source": "api", + "name": "Jane Doe" + }, + "previous_attributes": { + "key": {} + } + } +} diff --git a/tests/fixtures/pipes_connected_account_connected.json b/tests/fixtures/pipes_connected_account_connected.json index c72f06a2..a4f73740 100644 --- a/tests/fixtures/pipes_connected_account_connected.json +++ b/tests/fixtures/pipes_connected_account_connected.json @@ -5,6 +5,9 @@ "data": { "object": "connected_account", "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", "provider_slug": "github", "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", @@ -13,6 +16,8 @@ "repo", "user:email" ], + "auth_method": "oauth", + "api_key_last_4": null, "state": "connected", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z" diff --git a/tests/fixtures/pipes_connected_account_connection_failed.json b/tests/fixtures/pipes_connected_account_connection_failed.json index db36784b..41d77d1c 100644 --- a/tests/fixtures/pipes_connected_account_connection_failed.json +++ b/tests/fixtures/pipes_connected_account_connection_failed.json @@ -8,6 +8,7 @@ "provider_slug": "github", "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", + "account_identifier": null, "error_code": "authorization_code_exchange_error", "error_reason": "The authorization code has expired.", "provider_error": "access_denied", diff --git a/tests/fixtures/pipes_connected_account_connection_failed_data.json b/tests/fixtures/pipes_connected_account_connection_failed_data.json index cd5f1fc6..5a44d8e2 100644 --- a/tests/fixtures/pipes_connected_account_connection_failed_data.json +++ b/tests/fixtures/pipes_connected_account_connection_failed_data.json @@ -4,6 +4,7 @@ "provider_slug": "github", "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", + "account_identifier": null, "error_code": "authorization_code_exchange_error", "error_reason": "The authorization code has expired.", "provider_error": "access_denied", diff --git a/tests/fixtures/pipes_connected_account_disconnected.json b/tests/fixtures/pipes_connected_account_disconnected.json index e66fab99..46eb7279 100644 --- a/tests/fixtures/pipes_connected_account_disconnected.json +++ b/tests/fixtures/pipes_connected_account_disconnected.json @@ -5,6 +5,9 @@ "data": { "object": "connected_account", "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", "provider_slug": "github", "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", @@ -13,6 +16,8 @@ "repo", "user:email" ], + "auth_method": "oauth", + "api_key_last_4": null, "state": "connected", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z" diff --git a/tests/fixtures/pipes_connected_account_reauthorization_needed.json b/tests/fixtures/pipes_connected_account_reauthorization_needed.json index 2aa23471..1afd4a7a 100644 --- a/tests/fixtures/pipes_connected_account_reauthorization_needed.json +++ b/tests/fixtures/pipes_connected_account_reauthorization_needed.json @@ -5,6 +5,9 @@ "data": { "object": "connected_account", "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", "provider_slug": "github", "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", @@ -13,6 +16,8 @@ "repo", "user:email" ], + "auth_method": "oauth", + "api_key_last_4": null, "state": "connected", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z" diff --git a/tests/test_common_models_round_trip.py b/tests/test_common_models_round_trip.py index 8498f807..21438f6b 100644 --- a/tests/test_common_models_round_trip.py +++ b/tests/test_common_models_round_trip.py @@ -248,6 +248,13 @@ PermissionUpdated, PermissionUpdatedData, PipeConnectedAccount, + PipesAccountConnectionAddFailed, + PipesAccountConnectionAddFailedData, + PipesAccountConnectionConnected, + PipesAccountConnectionConnectionFailed, + PipesAccountConnectionConnectionFailedData, + PipesAccountConnectionDisconnected, + PipesAccountConnectionReauthorizationNeeded, PipesConnectedAccountConnected, PipesConnectedAccountConnectionFailed, PipesConnectedAccountConnectionFailedData, @@ -702,34 +709,68 @@ def test_pipe_connected_account_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["updated_at"] == data["updated_at"] + def test_pipe_connected_account_omits_absent_optional_non_nullable_fields(self): + data = { + "object": "connected_account", + "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", + "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", + "provider_slug": "github", + "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", + "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", + "scopes": ["repo", "user:email"], + "api_key_last_4": None, + "state": "connected", + "created_at": "2026-01-15T12:00:00.000Z", + "updated_at": "2026-01-15T12:00:00.000Z", + } + instance = PipeConnectedAccount.from_dict(data) + serialized = instance.to_dict() + assert "connection_role" not in serialized + assert "auth_method" not in serialized + def test_pipe_connected_account_preserves_nullable_fields(self): data = { "object": "connected_account", "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": None, + "account_display_name": None, "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", "provider_slug": "github", "user_id": None, "organization_id": None, "scopes": ["repo", "user:email"], + "auth_method": "oauth", + "api_key_last_4": None, "state": "connected", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", } instance = PipeConnectedAccount.from_dict(data) serialized = instance.to_dict() + assert serialized["account_identifier"] is None + assert serialized["account_display_name"] is None assert serialized["user_id"] is None assert serialized["organization_id"] is None + assert serialized["api_key_last_4"] is None def test_pipe_connected_account_round_trips_unknown_enum_values(self): data = { "object": "connected_account", "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "unexpected_pipe_connected_account_connection_role", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", "provider_slug": "github", "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "scopes": ["repo", "user:email"], - "state": "unexpected_pipe_connected_account_state", + "auth_method": "oauth", + "api_key_last_4": None, + "state": "connected", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", } @@ -12333,6 +12374,462 @@ def test_permission_updated_data_preserves_nullable_fields(self): serialized = instance.to_dict() assert serialized["description"] is None + def test_pipes_account_connection_add_failed_round_trip(self): + data = load_fixture("pipes_account_connection_add_failed.json") + instance = PipesAccountConnectionAddFailed.from_dict(data) + serialized = instance.to_dict() + assert serialized == data + restored = PipesAccountConnectionAddFailed.from_dict(serialized) + assert restored.to_dict() == serialized + + def test_pipes_account_connection_add_failed_minimal_payload(self): + data = { + "object": "event", + "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", + "event": "pipes.account_connection.add_failed", + "data": { + "object": "connection_failed", + "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", + "provider_slug": "github", + "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", + "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", + "account_identifier": None, + "error_code": "authorization_code_exchange_error", + "error_reason": "The authorization code has expired.", + "provider_error": "access_denied", + "provider_error_description": "The user denied the authorization request.", + "created_at": "2026-01-15T12:00:00.000Z", + }, + "created_at": "2026-01-15T12:00:00.000Z", + } + instance = PipesAccountConnectionAddFailed.from_dict(data) + serialized = instance.to_dict() + assert serialized["object"] == data["object"] + assert serialized["id"] == data["id"] + assert serialized["event"] == data["event"] + assert serialized["data"] == data["data"] + assert serialized["created_at"] == data["created_at"] + + def test_pipes_account_connection_add_failed_omits_absent_optional_non_nullable_fields( + self, + ): + data = { + "object": "event", + "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", + "event": "pipes.account_connection.add_failed", + "data": { + "object": "connection_failed", + "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", + "provider_slug": "github", + "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", + "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", + "account_identifier": None, + "error_code": "authorization_code_exchange_error", + "error_reason": "The authorization code has expired.", + "provider_error": "access_denied", + "provider_error_description": "The user denied the authorization request.", + "created_at": "2026-01-15T12:00:00.000Z", + }, + "created_at": "2026-01-15T12:00:00.000Z", + } + instance = PipesAccountConnectionAddFailed.from_dict(data) + serialized = instance.to_dict() + assert "context" not in serialized + + def test_pipes_account_connection_add_failed_data_round_trip(self): + data = load_fixture("pipes_account_connection_add_failed_data.json") + instance = PipesAccountConnectionAddFailedData.from_dict(data) + serialized = instance.to_dict() + assert serialized == data + restored = PipesAccountConnectionAddFailedData.from_dict(serialized) + assert restored.to_dict() == serialized + + def test_pipes_account_connection_add_failed_data_minimal_payload(self): + data = { + "object": "connection_failed", + "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", + "provider_slug": "github", + "user_id": None, + "organization_id": None, + "error_code": "authorization_code_exchange_error", + "error_reason": None, + "provider_error": None, + "provider_error_description": None, + "created_at": "2026-01-15T12:00:00.000Z", + } + instance = PipesAccountConnectionAddFailedData.from_dict(data) + serialized = instance.to_dict() + assert serialized["object"] == data["object"] + assert serialized["data_integration_id"] == data["data_integration_id"] + assert serialized["provider_slug"] == data["provider_slug"] + assert serialized["user_id"] == data["user_id"] + assert serialized["organization_id"] == data["organization_id"] + assert serialized["error_code"] == data["error_code"] + assert serialized["error_reason"] == data["error_reason"] + assert serialized["provider_error"] == data["provider_error"] + assert ( + serialized["provider_error_description"] + == data["provider_error_description"] + ) + assert serialized["created_at"] == data["created_at"] + + def test_pipes_account_connection_add_failed_data_preserves_nullable_fields(self): + data = { + "object": "connection_failed", + "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", + "provider_slug": "github", + "user_id": None, + "organization_id": None, + "account_identifier": None, + "error_code": "authorization_code_exchange_error", + "error_reason": None, + "provider_error": None, + "provider_error_description": None, + "created_at": "2026-01-15T12:00:00.000Z", + } + instance = PipesAccountConnectionAddFailedData.from_dict(data) + serialized = instance.to_dict() + assert serialized["user_id"] is None + assert serialized["organization_id"] is None + assert serialized["account_identifier"] is None + assert serialized["error_reason"] is None + assert serialized["provider_error"] is None + assert serialized["provider_error_description"] is None + + def test_pipes_account_connection_connected_round_trip(self): + data = load_fixture("pipes_account_connection_connected.json") + instance = PipesAccountConnectionConnected.from_dict(data) + serialized = instance.to_dict() + assert serialized == data + restored = PipesAccountConnectionConnected.from_dict(serialized) + assert restored.to_dict() == serialized + + def test_pipes_account_connection_connected_minimal_payload(self): + data = { + "object": "event", + "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", + "event": "pipes.account_connection.connected", + "data": { + "object": "connected_account", + "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", + "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", + "provider_slug": "github", + "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", + "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", + "scopes": ["repo", "user:email"], + "auth_method": "oauth", + "api_key_last_4": None, + "state": "connected", + "created_at": "2026-01-15T12:00:00.000Z", + "updated_at": "2026-01-15T12:00:00.000Z", + }, + "created_at": "2026-01-15T12:00:00.000Z", + } + instance = PipesAccountConnectionConnected.from_dict(data) + serialized = instance.to_dict() + assert serialized["object"] == data["object"] + assert serialized["id"] == data["id"] + assert serialized["event"] == data["event"] + assert serialized["data"] == data["data"] + assert serialized["created_at"] == data["created_at"] + + def test_pipes_account_connection_connected_omits_absent_optional_non_nullable_fields( + self, + ): + data = { + "object": "event", + "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", + "event": "pipes.account_connection.connected", + "data": { + "object": "connected_account", + "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", + "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", + "provider_slug": "github", + "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", + "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", + "scopes": ["repo", "user:email"], + "auth_method": "oauth", + "api_key_last_4": None, + "state": "connected", + "created_at": "2026-01-15T12:00:00.000Z", + "updated_at": "2026-01-15T12:00:00.000Z", + }, + "created_at": "2026-01-15T12:00:00.000Z", + } + instance = PipesAccountConnectionConnected.from_dict(data) + serialized = instance.to_dict() + assert "context" not in serialized + + def test_pipes_account_connection_connection_failed_round_trip(self): + data = load_fixture("pipes_account_connection_connection_failed.json") + instance = PipesAccountConnectionConnectionFailed.from_dict(data) + serialized = instance.to_dict() + assert serialized == data + restored = PipesAccountConnectionConnectionFailed.from_dict(serialized) + assert restored.to_dict() == serialized + + def test_pipes_account_connection_connection_failed_minimal_payload(self): + data = { + "object": "event", + "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", + "event": "pipes.account_connection.connection_failed", + "data": { + "object": "connection_failed", + "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", + "provider_slug": "github", + "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", + "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", + "account_identifier": None, + "error_code": "authorization_code_exchange_error", + "error_reason": "The authorization code has expired.", + "provider_error": "access_denied", + "provider_error_description": "The user denied the authorization request.", + "created_at": "2026-01-15T12:00:00.000Z", + }, + "created_at": "2026-01-15T12:00:00.000Z", + } + instance = PipesAccountConnectionConnectionFailed.from_dict(data) + serialized = instance.to_dict() + assert serialized["object"] == data["object"] + assert serialized["id"] == data["id"] + assert serialized["event"] == data["event"] + assert serialized["data"] == data["data"] + assert serialized["created_at"] == data["created_at"] + + def test_pipes_account_connection_connection_failed_omits_absent_optional_non_nullable_fields( + self, + ): + data = { + "object": "event", + "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", + "event": "pipes.account_connection.connection_failed", + "data": { + "object": "connection_failed", + "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", + "provider_slug": "github", + "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", + "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", + "account_identifier": None, + "error_code": "authorization_code_exchange_error", + "error_reason": "The authorization code has expired.", + "provider_error": "access_denied", + "provider_error_description": "The user denied the authorization request.", + "created_at": "2026-01-15T12:00:00.000Z", + }, + "created_at": "2026-01-15T12:00:00.000Z", + } + instance = PipesAccountConnectionConnectionFailed.from_dict(data) + serialized = instance.to_dict() + assert "context" not in serialized + + def test_pipes_account_connection_connection_failed_data_round_trip(self): + data = load_fixture("pipes_account_connection_connection_failed_data.json") + instance = PipesAccountConnectionConnectionFailedData.from_dict(data) + serialized = instance.to_dict() + assert serialized == data + restored = PipesAccountConnectionConnectionFailedData.from_dict(serialized) + assert restored.to_dict() == serialized + + def test_pipes_account_connection_connection_failed_data_minimal_payload(self): + data = { + "object": "connection_failed", + "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", + "provider_slug": "github", + "user_id": None, + "organization_id": None, + "error_code": "authorization_code_exchange_error", + "error_reason": None, + "provider_error": None, + "provider_error_description": None, + "created_at": "2026-01-15T12:00:00.000Z", + } + instance = PipesAccountConnectionConnectionFailedData.from_dict(data) + serialized = instance.to_dict() + assert serialized["object"] == data["object"] + assert serialized["data_integration_id"] == data["data_integration_id"] + assert serialized["provider_slug"] == data["provider_slug"] + assert serialized["user_id"] == data["user_id"] + assert serialized["organization_id"] == data["organization_id"] + assert serialized["error_code"] == data["error_code"] + assert serialized["error_reason"] == data["error_reason"] + assert serialized["provider_error"] == data["provider_error"] + assert ( + serialized["provider_error_description"] + == data["provider_error_description"] + ) + assert serialized["created_at"] == data["created_at"] + + def test_pipes_account_connection_connection_failed_data_preserves_nullable_fields( + self, + ): + data = { + "object": "connection_failed", + "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", + "provider_slug": "github", + "user_id": None, + "organization_id": None, + "account_identifier": None, + "error_code": "authorization_code_exchange_error", + "error_reason": None, + "provider_error": None, + "provider_error_description": None, + "created_at": "2026-01-15T12:00:00.000Z", + } + instance = PipesAccountConnectionConnectionFailedData.from_dict(data) + serialized = instance.to_dict() + assert serialized["user_id"] is None + assert serialized["organization_id"] is None + assert serialized["account_identifier"] is None + assert serialized["error_reason"] is None + assert serialized["provider_error"] is None + assert serialized["provider_error_description"] is None + + def test_pipes_account_connection_disconnected_round_trip(self): + data = load_fixture("pipes_account_connection_disconnected.json") + instance = PipesAccountConnectionDisconnected.from_dict(data) + serialized = instance.to_dict() + assert serialized == data + restored = PipesAccountConnectionDisconnected.from_dict(serialized) + assert restored.to_dict() == serialized + + def test_pipes_account_connection_disconnected_minimal_payload(self): + data = { + "object": "event", + "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", + "event": "pipes.account_connection.disconnected", + "data": { + "object": "connected_account", + "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", + "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", + "provider_slug": "github", + "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", + "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", + "scopes": ["repo", "user:email"], + "auth_method": "oauth", + "api_key_last_4": None, + "state": "connected", + "created_at": "2026-01-15T12:00:00.000Z", + "updated_at": "2026-01-15T12:00:00.000Z", + }, + "created_at": "2026-01-15T12:00:00.000Z", + } + instance = PipesAccountConnectionDisconnected.from_dict(data) + serialized = instance.to_dict() + assert serialized["object"] == data["object"] + assert serialized["id"] == data["id"] + assert serialized["event"] == data["event"] + assert serialized["data"] == data["data"] + assert serialized["created_at"] == data["created_at"] + + def test_pipes_account_connection_disconnected_omits_absent_optional_non_nullable_fields( + self, + ): + data = { + "object": "event", + "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", + "event": "pipes.account_connection.disconnected", + "data": { + "object": "connected_account", + "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", + "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", + "provider_slug": "github", + "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", + "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", + "scopes": ["repo", "user:email"], + "auth_method": "oauth", + "api_key_last_4": None, + "state": "connected", + "created_at": "2026-01-15T12:00:00.000Z", + "updated_at": "2026-01-15T12:00:00.000Z", + }, + "created_at": "2026-01-15T12:00:00.000Z", + } + instance = PipesAccountConnectionDisconnected.from_dict(data) + serialized = instance.to_dict() + assert "context" not in serialized + + def test_pipes_account_connection_reauthorization_needed_round_trip(self): + data = load_fixture("pipes_account_connection_reauthorization_needed.json") + instance = PipesAccountConnectionReauthorizationNeeded.from_dict(data) + serialized = instance.to_dict() + assert serialized == data + restored = PipesAccountConnectionReauthorizationNeeded.from_dict(serialized) + assert restored.to_dict() == serialized + + def test_pipes_account_connection_reauthorization_needed_minimal_payload(self): + data = { + "object": "event", + "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", + "event": "pipes.account_connection.reauthorization_needed", + "data": { + "object": "connected_account", + "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", + "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", + "provider_slug": "github", + "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", + "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", + "scopes": ["repo", "user:email"], + "auth_method": "oauth", + "api_key_last_4": None, + "state": "connected", + "created_at": "2026-01-15T12:00:00.000Z", + "updated_at": "2026-01-15T12:00:00.000Z", + }, + "created_at": "2026-01-15T12:00:00.000Z", + } + instance = PipesAccountConnectionReauthorizationNeeded.from_dict(data) + serialized = instance.to_dict() + assert serialized["object"] == data["object"] + assert serialized["id"] == data["id"] + assert serialized["event"] == data["event"] + assert serialized["data"] == data["data"] + assert serialized["created_at"] == data["created_at"] + + def test_pipes_account_connection_reauthorization_needed_omits_absent_optional_non_nullable_fields( + self, + ): + data = { + "object": "event", + "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", + "event": "pipes.account_connection.reauthorization_needed", + "data": { + "object": "connected_account", + "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", + "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", + "provider_slug": "github", + "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", + "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", + "scopes": ["repo", "user:email"], + "auth_method": "oauth", + "api_key_last_4": None, + "state": "connected", + "created_at": "2026-01-15T12:00:00.000Z", + "updated_at": "2026-01-15T12:00:00.000Z", + }, + "created_at": "2026-01-15T12:00:00.000Z", + } + instance = PipesAccountConnectionReauthorizationNeeded.from_dict(data) + serialized = instance.to_dict() + assert "context" not in serialized + def test_pipes_connected_account_connected_round_trip(self): data = load_fixture("pipes_connected_account_connected.json") instance = PipesConnectedAccountConnected.from_dict(data) @@ -12349,11 +12846,16 @@ def test_pipes_connected_account_connected_minimal_payload(self): "data": { "object": "connected_account", "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", "provider_slug": "github", "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "scopes": ["repo", "user:email"], + "auth_method": "oauth", + "api_key_last_4": None, "state": "connected", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", @@ -12378,11 +12880,16 @@ def test_pipes_connected_account_connected_omits_absent_optional_non_nullable_fi "data": { "object": "connected_account", "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", "provider_slug": "github", "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "scopes": ["repo", "user:email"], + "auth_method": "oauth", + "api_key_last_4": None, "state": "connected", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", @@ -12412,6 +12919,7 @@ def test_pipes_connected_account_connection_failed_minimal_payload(self): "provider_slug": "github", "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", + "account_identifier": None, "error_code": "authorization_code_exchange_error", "error_reason": "The authorization code has expired.", "provider_error": "access_denied", @@ -12441,6 +12949,7 @@ def test_pipes_connected_account_connection_failed_omits_absent_optional_non_nul "provider_slug": "github", "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", + "account_identifier": None, "error_code": "authorization_code_exchange_error", "error_reason": "The authorization code has expired.", "provider_error": "access_denied", @@ -12499,6 +13008,7 @@ def test_pipes_connected_account_connection_failed_data_preserves_nullable_field "provider_slug": "github", "user_id": None, "organization_id": None, + "account_identifier": None, "error_code": "authorization_code_exchange_error", "error_reason": None, "provider_error": None, @@ -12509,6 +13019,7 @@ def test_pipes_connected_account_connection_failed_data_preserves_nullable_field serialized = instance.to_dict() assert serialized["user_id"] is None assert serialized["organization_id"] is None + assert serialized["account_identifier"] is None assert serialized["error_reason"] is None assert serialized["provider_error"] is None assert serialized["provider_error_description"] is None @@ -12529,11 +13040,16 @@ def test_pipes_connected_account_disconnected_minimal_payload(self): "data": { "object": "connected_account", "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", "provider_slug": "github", "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "scopes": ["repo", "user:email"], + "auth_method": "oauth", + "api_key_last_4": None, "state": "connected", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", @@ -12558,11 +13074,16 @@ def test_pipes_connected_account_disconnected_omits_absent_optional_non_nullable "data": { "object": "connected_account", "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", "provider_slug": "github", "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "scopes": ["repo", "user:email"], + "auth_method": "oauth", + "api_key_last_4": None, "state": "connected", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", @@ -12589,11 +13110,16 @@ def test_pipes_connected_account_reauthorization_needed_minimal_payload(self): "data": { "object": "connected_account", "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", "provider_slug": "github", "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "scopes": ["repo", "user:email"], + "auth_method": "oauth", + "api_key_last_4": None, "state": "connected", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", @@ -12618,11 +13144,16 @@ def test_pipes_connected_account_reauthorization_needed_omits_absent_optional_no "data": { "object": "connected_account", "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", "provider_slug": "github", "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "scopes": ["repo", "user:email"], + "auth_method": "oauth", + "api_key_last_4": None, "state": "connected", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", diff --git a/tests/test_organizations_data_providers.py b/tests/test_organizations_data_providers.py new file mode 100644 index 00000000..062d01ef --- /dev/null +++ b/tests/test_organizations_data_providers.py @@ -0,0 +1,501 @@ +# This file is auto-generated by oagen. Do not edit. + + +import pytest + +from tests.generated_helpers import load_fixture +from workos import AsyncWorkOSClient, WorkOSClient +from workos._errors import ( + AuthenticationError, + BadRequestError, + NotFoundError, + RateLimitExceededError, + ServerError, + UnprocessableEntityError, +) +from workos.common.models import ConnectedAccount, DataIntegrationsListResponse + + +class TestOrganizationsDataProviders: + def test_get_organization_connected_account(self, workos, httpx_mock): + httpx_mock.add_response( + json=load_fixture("connected_account.json"), + ) + result = workos.organizations_data_providers.get_organization_connected_account( + "test_organization_id", "test_slug" + ) + assert isinstance(result, ConnectedAccount) + assert result.object == "connected_account" + assert result.id == "data_installation_01EHZNVPK3SFK441A1RGBFSHRT" + request = httpx_mock.get_request() + assert request.method == "GET" + assert request.url.path.endswith( + "/organizations/test_organization_id/connected_accounts/test_slug" + ) + + def test_get_organization_connected_account_encodes_query_params( + self, workos, httpx_mock + ): + httpx_mock.add_response(json=load_fixture("connected_account.json")) + workos.organizations_data_providers.get_organization_connected_account( + "test_organization_id", + "test_slug", + supports_multiple_connections=True, + connected_account_id="value connected_account_id/test", + ) + request = httpx_mock.get_request() + assert request.url.params["supports_multiple_connections"] == "true" + assert ( + request.url.params["connected_account_id"] + == "value connected_account_id/test" + ) + + def test_create_organization_connected_account(self, workos, httpx_mock): + httpx_mock.add_response( + json=load_fixture("connected_account.json"), + ) + result = ( + workos.organizations_data_providers.create_organization_connected_account( + "test_organization_id", "test_slug" + ) + ) + assert isinstance(result, ConnectedAccount) + assert result.object == "connected_account" + assert result.id == "data_installation_01EHZNVPK3SFK441A1RGBFSHRT" + request = httpx_mock.get_request() + assert request.method == "POST" + assert request.url.path.endswith( + "/organizations/test_organization_id/connected_accounts/test_slug" + ) + + def test_update_organization_connected_account(self, workos, httpx_mock): + httpx_mock.add_response( + json=load_fixture("connected_account.json"), + ) + result = ( + workos.organizations_data_providers.update_organization_connected_account( + "test_organization_id", "test_slug" + ) + ) + assert isinstance(result, ConnectedAccount) + assert result.object == "connected_account" + assert result.id == "data_installation_01EHZNVPK3SFK441A1RGBFSHRT" + request = httpx_mock.get_request() + assert request.method == "PUT" + assert request.url.path.endswith( + "/organizations/test_organization_id/connected_accounts/test_slug" + ) + + def test_update_organization_connected_account_encodes_query_params( + self, workos, httpx_mock + ): + httpx_mock.add_response(json=load_fixture("connected_account.json")) + workos.organizations_data_providers.update_organization_connected_account( + "test_organization_id", + "test_slug", + supports_multiple_connections=True, + connected_account_id="value connected_account_id/test", + ) + request = httpx_mock.get_request() + assert request.url.params["supports_multiple_connections"] == "true" + assert ( + request.url.params["connected_account_id"] + == "value connected_account_id/test" + ) + + def test_delete_organization_connected_account(self, workos, httpx_mock): + httpx_mock.add_response(status_code=204) + result = ( + workos.organizations_data_providers.delete_organization_connected_account( + "test_organization_id", "test_slug" + ) + ) + assert result is None + request = httpx_mock.get_request() + assert request.method == "DELETE" + assert request.url.path.endswith( + "/organizations/test_organization_id/connected_accounts/test_slug" + ) + + def test_delete_organization_connected_account_encodes_query_params( + self, workos, httpx_mock + ): + httpx_mock.add_response(status_code=204) + workos.organizations_data_providers.delete_organization_connected_account( + "test_organization_id", + "test_slug", + supports_multiple_connections=True, + connected_account_id="value connected_account_id/test", + ) + request = httpx_mock.get_request() + assert request.url.params["supports_multiple_connections"] == "true" + assert ( + request.url.params["connected_account_id"] + == "value connected_account_id/test" + ) + + def test_list_organization_data_providers(self, workos, httpx_mock): + httpx_mock.add_response( + json=load_fixture("data_integrations_list_response.json"), + ) + result = workos.organizations_data_providers.list_organization_data_providers( + "test_organization_id" + ) + assert isinstance(result, DataIntegrationsListResponse) + assert result.object == "list" + request = httpx_mock.get_request() + assert request.method == "GET" + assert request.url.path.endswith( + "/organizations/test_organization_id/data_providers" + ) + + def test_list_organization_data_providers_encodes_query_params( + self, workos, httpx_mock + ): + httpx_mock.add_response( + json=load_fixture("data_integrations_list_response.json") + ) + workos.organizations_data_providers.list_organization_data_providers( + "test_organization_id", supports_multiple_connections=True + ) + request = httpx_mock.get_request() + assert request.url.params["supports_multiple_connections"] == "true" + + def test_get_organization_connected_account_with_request_options( + self, workos, httpx_mock + ): + httpx_mock.add_response(json=load_fixture("connected_account.json")) + workos.organizations_data_providers.get_organization_connected_account( + "test_organization_id", + "test_slug", + request_options={"extra_headers": {"X-Custom": "value"}}, + ) + request = httpx_mock.get_request() + assert request.headers["X-Custom"] == "value" + + def test_get_organization_connected_account_unauthorized(self, workos, httpx_mock): + httpx_mock.add_response( + status_code=401, + json={"message": "Unauthorized"}, + ) + with pytest.raises(AuthenticationError): + workos.organizations_data_providers.get_organization_connected_account( + "test_organization_id", "test_slug" + ) + + def test_get_organization_connected_account_not_found(self, httpx_mock): + workos = WorkOSClient( + api_key="sk_test_123", client_id="client_test", max_retries=0 + ) + try: + httpx_mock.add_response(status_code=404, json={"message": "Not found"}) + with pytest.raises(NotFoundError): + workos.organizations_data_providers.get_organization_connected_account( + "test_organization_id", "test_slug" + ) + finally: + workos.close() + + def test_get_organization_connected_account_rate_limited(self, httpx_mock): + workos = WorkOSClient( + api_key="sk_test_123", client_id="client_test", max_retries=0 + ) + try: + httpx_mock.add_response( + status_code=429, + headers={"Retry-After": "0"}, + json={"message": "Slow down"}, + ) + with pytest.raises(RateLimitExceededError): + workos.organizations_data_providers.get_organization_connected_account( + "test_organization_id", "test_slug" + ) + finally: + workos.close() + + def test_get_organization_connected_account_server_error(self, httpx_mock): + workos = WorkOSClient( + api_key="sk_test_123", client_id="client_test", max_retries=0 + ) + try: + httpx_mock.add_response(status_code=500, json={"message": "Server error"}) + with pytest.raises(ServerError): + workos.organizations_data_providers.get_organization_connected_account( + "test_organization_id", "test_slug" + ) + finally: + workos.close() + + def test_get_organization_connected_account_bad_request(self, httpx_mock): + workos = WorkOSClient( + api_key="sk_test_123", client_id="client_test", max_retries=0 + ) + try: + httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) + with pytest.raises(BadRequestError): + workos.organizations_data_providers.get_organization_connected_account( + "test_organization_id", "test_slug" + ) + finally: + workos.close() + + def test_get_organization_connected_account_unprocessable(self, httpx_mock): + workos = WorkOSClient( + api_key="sk_test_123", client_id="client_test", max_retries=0 + ) + try: + httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) + with pytest.raises(UnprocessableEntityError): + workos.organizations_data_providers.get_organization_connected_account( + "test_organization_id", "test_slug" + ) + finally: + workos.close() + + +class TestAsyncOrganizationsDataProviders: + @pytest.mark.asyncio + async def test_get_organization_connected_account(self, async_workos, httpx_mock): + httpx_mock.add_response(json=load_fixture("connected_account.json")) + result = await async_workos.organizations_data_providers.get_organization_connected_account( + "test_organization_id", "test_slug" + ) + assert isinstance(result, ConnectedAccount) + assert result.object == "connected_account" + assert result.id == "data_installation_01EHZNVPK3SFK441A1RGBFSHRT" + request = httpx_mock.get_request() + assert request.method == "GET" + assert request.url.path.endswith( + "/organizations/test_organization_id/connected_accounts/test_slug" + ) + + @pytest.mark.asyncio + async def test_get_organization_connected_account_encodes_query_params( + self, async_workos, httpx_mock + ): + httpx_mock.add_response(json=load_fixture("connected_account.json")) + await async_workos.organizations_data_providers.get_organization_connected_account( + "test_organization_id", + "test_slug", + supports_multiple_connections=True, + connected_account_id="value connected_account_id/test", + ) + request = httpx_mock.get_request() + assert request.url.params["supports_multiple_connections"] == "true" + assert ( + request.url.params["connected_account_id"] + == "value connected_account_id/test" + ) + + @pytest.mark.asyncio + async def test_create_organization_connected_account( + self, async_workos, httpx_mock + ): + httpx_mock.add_response(json=load_fixture("connected_account.json")) + result = await async_workos.organizations_data_providers.create_organization_connected_account( + "test_organization_id", "test_slug" + ) + assert isinstance(result, ConnectedAccount) + assert result.object == "connected_account" + assert result.id == "data_installation_01EHZNVPK3SFK441A1RGBFSHRT" + request = httpx_mock.get_request() + assert request.method == "POST" + assert request.url.path.endswith( + "/organizations/test_organization_id/connected_accounts/test_slug" + ) + + @pytest.mark.asyncio + async def test_update_organization_connected_account( + self, async_workos, httpx_mock + ): + httpx_mock.add_response(json=load_fixture("connected_account.json")) + result = await async_workos.organizations_data_providers.update_organization_connected_account( + "test_organization_id", "test_slug" + ) + assert isinstance(result, ConnectedAccount) + assert result.object == "connected_account" + assert result.id == "data_installation_01EHZNVPK3SFK441A1RGBFSHRT" + request = httpx_mock.get_request() + assert request.method == "PUT" + assert request.url.path.endswith( + "/organizations/test_organization_id/connected_accounts/test_slug" + ) + + @pytest.mark.asyncio + async def test_update_organization_connected_account_encodes_query_params( + self, async_workos, httpx_mock + ): + httpx_mock.add_response(json=load_fixture("connected_account.json")) + await async_workos.organizations_data_providers.update_organization_connected_account( + "test_organization_id", + "test_slug", + supports_multiple_connections=True, + connected_account_id="value connected_account_id/test", + ) + request = httpx_mock.get_request() + assert request.url.params["supports_multiple_connections"] == "true" + assert ( + request.url.params["connected_account_id"] + == "value connected_account_id/test" + ) + + @pytest.mark.asyncio + async def test_delete_organization_connected_account( + self, async_workos, httpx_mock + ): + httpx_mock.add_response(status_code=204) + result = await async_workos.organizations_data_providers.delete_organization_connected_account( + "test_organization_id", "test_slug" + ) + assert result is None + request = httpx_mock.get_request() + assert request.method == "DELETE" + assert request.url.path.endswith( + "/organizations/test_organization_id/connected_accounts/test_slug" + ) + + @pytest.mark.asyncio + async def test_delete_organization_connected_account_encodes_query_params( + self, async_workos, httpx_mock + ): + httpx_mock.add_response(status_code=204) + await async_workos.organizations_data_providers.delete_organization_connected_account( + "test_organization_id", + "test_slug", + supports_multiple_connections=True, + connected_account_id="value connected_account_id/test", + ) + request = httpx_mock.get_request() + assert request.url.params["supports_multiple_connections"] == "true" + assert ( + request.url.params["connected_account_id"] + == "value connected_account_id/test" + ) + + @pytest.mark.asyncio + async def test_list_organization_data_providers(self, async_workos, httpx_mock): + httpx_mock.add_response( + json=load_fixture("data_integrations_list_response.json") + ) + result = await async_workos.organizations_data_providers.list_organization_data_providers( + "test_organization_id" + ) + assert isinstance(result, DataIntegrationsListResponse) + assert result.object == "list" + request = httpx_mock.get_request() + assert request.method == "GET" + assert request.url.path.endswith( + "/organizations/test_organization_id/data_providers" + ) + + @pytest.mark.asyncio + async def test_list_organization_data_providers_encodes_query_params( + self, async_workos, httpx_mock + ): + httpx_mock.add_response( + json=load_fixture("data_integrations_list_response.json") + ) + await ( + async_workos.organizations_data_providers.list_organization_data_providers( + "test_organization_id", supports_multiple_connections=True + ) + ) + request = httpx_mock.get_request() + assert request.url.params["supports_multiple_connections"] == "true" + + @pytest.mark.asyncio + async def test_get_organization_connected_account_with_request_options( + self, async_workos, httpx_mock + ): + httpx_mock.add_response(json=load_fixture("connected_account.json")) + await async_workos.organizations_data_providers.get_organization_connected_account( + "test_organization_id", + "test_slug", + request_options={"extra_headers": {"X-Custom": "value"}}, + ) + request = httpx_mock.get_request() + assert request.headers["X-Custom"] == "value" + + @pytest.mark.asyncio + async def test_get_organization_connected_account_unauthorized( + self, async_workos, httpx_mock + ): + httpx_mock.add_response(status_code=401, json={"message": "Unauthorized"}) + with pytest.raises(AuthenticationError): + await async_workos.organizations_data_providers.get_organization_connected_account( + "test_organization_id", "test_slug" + ) + + @pytest.mark.asyncio + async def test_get_organization_connected_account_not_found(self, httpx_mock): + workos = AsyncWorkOSClient( + api_key="sk_test_123", client_id="client_test", max_retries=0 + ) + try: + httpx_mock.add_response(status_code=404, json={"message": "Not found"}) + with pytest.raises(NotFoundError): + await workos.organizations_data_providers.get_organization_connected_account( + "test_organization_id", "test_slug" + ) + finally: + await workos.close() + + @pytest.mark.asyncio + async def test_get_organization_connected_account_rate_limited(self, httpx_mock): + workos = AsyncWorkOSClient( + api_key="sk_test_123", client_id="client_test", max_retries=0 + ) + try: + httpx_mock.add_response( + status_code=429, + headers={"Retry-After": "0"}, + json={"message": "Slow down"}, + ) + with pytest.raises(RateLimitExceededError): + await workos.organizations_data_providers.get_organization_connected_account( + "test_organization_id", "test_slug" + ) + finally: + await workos.close() + + @pytest.mark.asyncio + async def test_get_organization_connected_account_server_error(self, httpx_mock): + workos = AsyncWorkOSClient( + api_key="sk_test_123", client_id="client_test", max_retries=0 + ) + try: + httpx_mock.add_response(status_code=500, json={"message": "Server error"}) + with pytest.raises(ServerError): + await workos.organizations_data_providers.get_organization_connected_account( + "test_organization_id", "test_slug" + ) + finally: + await workos.close() + + @pytest.mark.asyncio + async def test_get_organization_connected_account_bad_request(self, httpx_mock): + workos = AsyncWorkOSClient( + api_key="sk_test_123", client_id="client_test", max_retries=0 + ) + try: + httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) + with pytest.raises(BadRequestError): + await workos.organizations_data_providers.get_organization_connected_account( + "test_organization_id", "test_slug" + ) + finally: + await workos.close() + + @pytest.mark.asyncio + async def test_get_organization_connected_account_unprocessable(self, httpx_mock): + workos = AsyncWorkOSClient( + api_key="sk_test_123", client_id="client_test", max_retries=0 + ) + try: + httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) + with pytest.raises(UnprocessableEntityError): + await workos.organizations_data_providers.get_organization_connected_account( + "test_organization_id", "test_slug" + ) + finally: + await workos.close() diff --git a/tests/test_organizations_data_providers_models_round_trip.py b/tests/test_organizations_data_providers_models_round_trip.py new file mode 100644 index 00000000..3d6733a9 --- /dev/null +++ b/tests/test_organizations_data_providers_models_round_trip.py @@ -0,0 +1,441 @@ +# This file is auto-generated by oagen. Do not edit. + +"""Model round-trip tests: from_dict(to_dict()) preserves data.""" + +from tests.generated_helpers import load_fixture +from workos.organizations_data_providers.models import ( + DataIntegrationsListResponse, + DataIntegrationsListResponseData, + DataIntegrationsListResponseDataConnectedAccount, +) + + +class TestModelRoundTrip: + def test_data_integrations_list_response_round_trip(self): + data = load_fixture("data_integrations_list_response.json") + instance = DataIntegrationsListResponse.from_dict(data) + serialized = instance.to_dict() + assert serialized == data + restored = DataIntegrationsListResponse.from_dict(serialized) + assert restored.to_dict() == serialized + + def test_data_integrations_list_response_minimal_payload(self): + data = { + "object": "list", + "data": [ + { + "object": "data_provider", + "id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", + "name": "GitHub", + "description": "Connect your GitHub account to access repositories.", + "slug": "github", + "integration_type": "github", + "credentials_type": "oauth2", + "scopes": ["repo", "user:email"], + "auth_methods": ["oauth"], + "connection_owner": "user", + "ownership": "userland_user", + "created_at": "2024-01-15T10:30:00.000Z", + "updated_at": "2024-01-15T10:30:00.000Z", + "connected_account": { + "object": "connected_account", + "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", + "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", + "organization_id": None, + "scopes": ["repo", "user:email"], + "auth_method": "oauth", + "api_key_last_4": None, + "client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc", + "client_secret_last_4": "cdef", + "config": {"instance_url": "https://example.my.salesforce.com"}, + "state": "connected", + "created_at": "2024-01-16T14:20:00.000Z", + "updated_at": "2024-01-16T14:20:00.000Z", + "userlandUserId": "test_userlandUserId", + }, + "connected_accounts": [ + { + "object": "connected_account", + "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", + "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", + "organization_id": None, + "scopes": ["repo", "user:email"], + "auth_method": "oauth", + "api_key_last_4": None, + "client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc", + "client_secret_last_4": "cdef", + "config": { + "instance_url": "https://example.my.salesforce.com" + }, + "state": "connected", + "created_at": "2024-01-16T14:20:00.000Z", + "updated_at": "2024-01-16T14:20:00.000Z", + "userlandUserId": "test_userlandUserId", + } + ], + } + ], + } + instance = DataIntegrationsListResponse.from_dict(data) + serialized = instance.to_dict() + assert serialized["object"] == data["object"] + assert serialized["data"] == data["data"] + + def test_data_integrations_list_response_data_round_trip(self): + data = load_fixture("data_integrations_list_response_data.json") + instance = DataIntegrationsListResponseData.from_dict(data) + serialized = instance.to_dict() + assert serialized == data + restored = DataIntegrationsListResponseData.from_dict(serialized) + assert restored.to_dict() == serialized + + def test_data_integrations_list_response_data_minimal_payload(self): + data = { + "object": "data_provider", + "id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", + "name": "GitHub", + "description": None, + "slug": "github", + "integration_type": "github", + "credentials_type": "oauth2", + "scopes": None, + "connection_owner": "user", + "ownership": "userland_user", + "created_at": "2024-01-15T10:30:00.000Z", + "updated_at": "2024-01-15T10:30:00.000Z", + "connected_account": None, + "connected_accounts": [ + { + "object": "connected_account", + "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", + "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", + "organization_id": None, + "scopes": ["repo", "user:email"], + "auth_method": "oauth", + "api_key_last_4": None, + "client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc", + "client_secret_last_4": "cdef", + "config": {"instance_url": "https://example.my.salesforce.com"}, + "state": "connected", + "created_at": "2024-01-16T14:20:00.000Z", + "updated_at": "2024-01-16T14:20:00.000Z", + "userlandUserId": "test_userlandUserId", + } + ], + } + instance = DataIntegrationsListResponseData.from_dict(data) + serialized = instance.to_dict() + assert serialized["object"] == data["object"] + assert serialized["id"] == data["id"] + assert serialized["name"] == data["name"] + assert serialized["description"] == data["description"] + assert serialized["slug"] == data["slug"] + assert serialized["integration_type"] == data["integration_type"] + assert serialized["credentials_type"] == data["credentials_type"] + assert serialized["scopes"] == data["scopes"] + assert serialized["connection_owner"] == data["connection_owner"] + assert serialized["ownership"] == data["ownership"] + assert serialized["created_at"] == data["created_at"] + assert serialized["updated_at"] == data["updated_at"] + assert serialized["connected_account"] == data["connected_account"] + assert serialized["connected_accounts"] == data["connected_accounts"] + + def test_data_integrations_list_response_data_omits_absent_optional_non_nullable_fields( + self, + ): + data = { + "object": "data_provider", + "id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", + "name": "GitHub", + "description": "Connect your GitHub account to access repositories.", + "slug": "github", + "integration_type": "github", + "credentials_type": "oauth2", + "scopes": ["repo", "user:email"], + "connection_owner": "user", + "ownership": "userland_user", + "created_at": "2024-01-15T10:30:00.000Z", + "updated_at": "2024-01-15T10:30:00.000Z", + "connected_account": { + "object": "connected_account", + "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", + "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", + "organization_id": None, + "scopes": ["repo", "user:email"], + "auth_method": "oauth", + "api_key_last_4": None, + "client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc", + "client_secret_last_4": "cdef", + "config": {"instance_url": "https://example.my.salesforce.com"}, + "state": "connected", + "created_at": "2024-01-16T14:20:00.000Z", + "updated_at": "2024-01-16T14:20:00.000Z", + "userlandUserId": "test_userlandUserId", + }, + "connected_accounts": [ + { + "object": "connected_account", + "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", + "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", + "organization_id": None, + "scopes": ["repo", "user:email"], + "auth_method": "oauth", + "api_key_last_4": None, + "client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc", + "client_secret_last_4": "cdef", + "config": {"instance_url": "https://example.my.salesforce.com"}, + "state": "connected", + "created_at": "2024-01-16T14:20:00.000Z", + "updated_at": "2024-01-16T14:20:00.000Z", + "userlandUserId": "test_userlandUserId", + } + ], + } + instance = DataIntegrationsListResponseData.from_dict(data) + serialized = instance.to_dict() + assert "auth_methods" not in serialized + + def test_data_integrations_list_response_data_preserves_nullable_fields(self): + data = { + "object": "data_provider", + "id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", + "name": "GitHub", + "description": None, + "slug": "github", + "integration_type": "github", + "credentials_type": "oauth2", + "scopes": None, + "auth_methods": ["oauth"], + "connection_owner": "user", + "ownership": "userland_user", + "created_at": "2024-01-15T10:30:00.000Z", + "updated_at": "2024-01-15T10:30:00.000Z", + "connected_account": None, + "connected_accounts": [ + { + "object": "connected_account", + "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", + "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", + "organization_id": None, + "scopes": ["repo", "user:email"], + "auth_method": "oauth", + "api_key_last_4": None, + "client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc", + "client_secret_last_4": "cdef", + "config": {"instance_url": "https://example.my.salesforce.com"}, + "state": "connected", + "created_at": "2024-01-16T14:20:00.000Z", + "updated_at": "2024-01-16T14:20:00.000Z", + "userlandUserId": "test_userlandUserId", + } + ], + } + instance = DataIntegrationsListResponseData.from_dict(data) + serialized = instance.to_dict() + assert serialized["description"] is None + assert serialized["scopes"] is None + assert serialized["connected_account"] is None + + def test_data_integrations_list_response_data_round_trips_unknown_enum_values(self): + data = { + "object": "data_provider", + "id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", + "name": "GitHub", + "description": "Connect your GitHub account to access repositories.", + "slug": "github", + "integration_type": "github", + "credentials_type": "oauth2", + "scopes": ["repo", "user:email"], + "auth_methods": ["oauth"], + "connection_owner": "unexpected_data_integrations_list_response_data_connection_owner", + "ownership": "userland_user", + "created_at": "2024-01-15T10:30:00.000Z", + "updated_at": "2024-01-15T10:30:00.000Z", + "connected_account": { + "object": "connected_account", + "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", + "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", + "organization_id": None, + "scopes": ["repo", "user:email"], + "auth_method": "oauth", + "api_key_last_4": None, + "client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc", + "client_secret_last_4": "cdef", + "config": {"instance_url": "https://example.my.salesforce.com"}, + "state": "connected", + "created_at": "2024-01-16T14:20:00.000Z", + "updated_at": "2024-01-16T14:20:00.000Z", + "userlandUserId": "test_userlandUserId", + }, + "connected_accounts": [ + { + "object": "connected_account", + "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", + "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", + "organization_id": None, + "scopes": ["repo", "user:email"], + "auth_method": "oauth", + "api_key_last_4": None, + "client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc", + "client_secret_last_4": "cdef", + "config": {"instance_url": "https://example.my.salesforce.com"}, + "state": "connected", + "created_at": "2024-01-16T14:20:00.000Z", + "updated_at": "2024-01-16T14:20:00.000Z", + "userlandUserId": "test_userlandUserId", + } + ], + } + instance = DataIntegrationsListResponseData.from_dict(data) + assert instance.to_dict() == data + + def test_data_integrations_list_response_data_connected_account_round_trip(self): + data = load_fixture( + "data_integrations_list_response_data_connected_account.json" + ) + instance = DataIntegrationsListResponseDataConnectedAccount.from_dict(data) + serialized = instance.to_dict() + assert serialized == data + restored = DataIntegrationsListResponseDataConnectedAccount.from_dict( + serialized + ) + assert restored.to_dict() == serialized + + def test_data_integrations_list_response_data_connected_account_minimal_payload( + self, + ): + data = { + "object": "connected_account", + "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": None, + "account_display_name": None, + "user_id": None, + "organization_id": None, + "scopes": ["repo", "user:email"], + "state": "connected", + "created_at": "2024-01-16T14:20:00.000Z", + "updated_at": "2024-01-16T14:20:00.000Z", + "userlandUserId": None, + } + instance = DataIntegrationsListResponseDataConnectedAccount.from_dict(data) + serialized = instance.to_dict() + assert serialized["object"] == data["object"] + assert serialized["id"] == data["id"] + assert serialized["connection_role"] == data["connection_role"] + assert serialized["account_identifier"] == data["account_identifier"] + assert serialized["account_display_name"] == data["account_display_name"] + assert serialized["user_id"] == data["user_id"] + assert serialized["organization_id"] == data["organization_id"] + assert serialized["scopes"] == data["scopes"] + assert serialized["state"] == data["state"] + assert serialized["created_at"] == data["created_at"] + assert serialized["updated_at"] == data["updated_at"] + assert serialized["userlandUserId"] == data["userlandUserId"] + + def test_data_integrations_list_response_data_connected_account_omits_absent_optional_non_nullable_fields( + self, + ): + data = { + "object": "connected_account", + "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", + "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", + "organization_id": None, + "scopes": ["repo", "user:email"], + "api_key_last_4": None, + "client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc", + "client_secret_last_4": "cdef", + "state": "connected", + "created_at": "2024-01-16T14:20:00.000Z", + "updated_at": "2024-01-16T14:20:00.000Z", + "userlandUserId": "test_userlandUserId", + } + instance = DataIntegrationsListResponseDataConnectedAccount.from_dict(data) + serialized = instance.to_dict() + assert "auth_method" not in serialized + assert "config" not in serialized + + def test_data_integrations_list_response_data_connected_account_preserves_nullable_fields( + self, + ): + data = { + "object": "connected_account", + "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": None, + "account_display_name": None, + "user_id": None, + "organization_id": None, + "scopes": ["repo", "user:email"], + "auth_method": "oauth", + "api_key_last_4": None, + "client_id": None, + "client_secret_last_4": None, + "config": {"instance_url": "https://example.my.salesforce.com"}, + "state": "connected", + "created_at": "2024-01-16T14:20:00.000Z", + "updated_at": "2024-01-16T14:20:00.000Z", + "userlandUserId": None, + } + instance = DataIntegrationsListResponseDataConnectedAccount.from_dict(data) + serialized = instance.to_dict() + assert serialized["account_identifier"] is None + assert serialized["account_display_name"] is None + assert serialized["user_id"] is None + assert serialized["organization_id"] is None + assert serialized["api_key_last_4"] is None + assert serialized["client_id"] is None + assert serialized["client_secret_last_4"] is None + assert serialized["userlandUserId"] is None + + def test_data_integrations_list_response_data_connected_account_round_trips_unknown_enum_values( + self, + ): + data = { + "object": "connected_account", + "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "unexpected_data_integrations_list_response_data_connected_account_connection_role", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", + "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", + "organization_id": None, + "scopes": ["repo", "user:email"], + "auth_method": "oauth", + "api_key_last_4": None, + "client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc", + "client_secret_last_4": "cdef", + "config": {"instance_url": "https://example.my.salesforce.com"}, + "state": "connected", + "created_at": "2024-01-16T14:20:00.000Z", + "updated_at": "2024-01-16T14:20:00.000Z", + "userlandUserId": "test_userlandUserId", + } + instance = DataIntegrationsListResponseDataConnectedAccount.from_dict(data) + assert instance.to_dict() == data diff --git a/tests/test_pipes.py b/tests/test_pipes.py index 9955f115..35f3cf8e 100644 --- a/tests/test_pipes.py +++ b/tests/test_pipes.py @@ -17,6 +17,7 @@ from workos._pagination import AsyncPage, SyncPage from workos.common.models import ( ConnectedAccount, + DataIntegrationsListResponse, PaginationOrder, ) from workos.pipes.models import ( @@ -24,7 +25,6 @@ DataIntegrationAccessTokenResponse, DataIntegrationAuthorizeUrlResponse, DataIntegrationCredentialsResponse, - DataIntegrationsListResponse, PipesOwnership, ) diff --git a/tests/test_pipes_models_round_trip.py b/tests/test_pipes_models_round_trip.py index cab9c812..2ee1f2f0 100644 --- a/tests/test_pipes_models_round_trip.py +++ b/tests/test_pipes_models_round_trip.py @@ -17,9 +17,6 @@ DataIntegrationCredentialsResponseCredential, DataIntegrationCustomProvider, DataIntegrationInstallation, - DataIntegrationsListResponse, - DataIntegrationsListResponseData, - DataIntegrationsListResponseDataConnectedAccount, UpdateCustomProviderDefinition, ) @@ -439,6 +436,9 @@ def test_connected_account_minimal_payload(self): data = { "object": "connected_account", "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": None, + "account_display_name": None, "user_id": None, "organization_id": None, "scopes": ["repo", "user:email"], @@ -450,6 +450,9 @@ def test_connected_account_minimal_payload(self): serialized = instance.to_dict() assert serialized["object"] == data["object"] assert serialized["id"] == data["id"] + assert serialized["connection_role"] == data["connection_role"] + assert serialized["account_identifier"] == data["account_identifier"] + assert serialized["account_display_name"] == data["account_display_name"] assert serialized["user_id"] == data["user_id"] assert serialized["organization_id"] == data["organization_id"] assert serialized["scopes"] == data["scopes"] @@ -461,6 +464,9 @@ def test_connected_account_omits_absent_optional_non_nullable_fields(self): data = { "object": "connected_account", "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", "organization_id": None, "scopes": ["repo", "user:email"], @@ -480,6 +486,9 @@ def test_connected_account_preserves_nullable_fields(self): data = { "object": "connected_account", "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": None, + "account_display_name": None, "user_id": None, "organization_id": None, "scopes": ["repo", "user:email"], @@ -494,6 +503,8 @@ def test_connected_account_preserves_nullable_fields(self): } instance = ConnectedAccount.from_dict(data) serialized = instance.to_dict() + assert serialized["account_identifier"] is None + assert serialized["account_display_name"] is None assert serialized["user_id"] is None assert serialized["organization_id"] is None assert serialized["api_key_last_4"] is None @@ -504,10 +515,13 @@ def test_connected_account_round_trips_unknown_enum_values(self): data = { "object": "connected_account", "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "unexpected_connected_account_connection_role", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", "organization_id": None, "scopes": ["repo", "user:email"], - "auth_method": "unexpected_connected_account_auth_method", + "auth_method": "oauth", "api_key_last_4": None, "client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc", "client_secret_last_4": "cdef", @@ -519,278 +533,6 @@ def test_connected_account_round_trips_unknown_enum_values(self): instance = ConnectedAccount.from_dict(data) assert instance.to_dict() == data - def test_data_integrations_list_response_round_trip(self): - data = load_fixture("data_integrations_list_response.json") - instance = DataIntegrationsListResponse.from_dict(data) - serialized = instance.to_dict() - assert serialized == data - restored = DataIntegrationsListResponse.from_dict(serialized) - assert restored.to_dict() == serialized - - def test_data_integrations_list_response_minimal_payload(self): - data = { - "object": "list", - "data": [ - { - "object": "data_provider", - "id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", - "name": "GitHub", - "description": "Connect your GitHub account to access repositories.", - "slug": "github", - "integration_type": "github", - "credentials_type": "oauth2", - "scopes": ["repo", "user:email"], - "auth_methods": ["oauth"], - "ownership": "userland_user", - "created_at": "2024-01-15T10:30:00.000Z", - "updated_at": "2024-01-15T10:30:00.000Z", - "connected_account": { - "object": "connected_account", - "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", - "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", - "organization_id": None, - "scopes": ["repo", "user:email"], - "auth_method": "oauth", - "api_key_last_4": None, - "client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc", - "client_secret_last_4": "cdef", - "config": {"instance_url": "https://example.my.salesforce.com"}, - "state": "connected", - "created_at": "2024-01-16T14:20:00.000Z", - "updated_at": "2024-01-16T14:20:00.000Z", - "userlandUserId": "test_userlandUserId", - }, - "connected_accounts": [ - { - "object": "connected_account", - "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", - "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", - "organization_id": None, - "scopes": ["repo", "user:email"], - "auth_method": "oauth", - "api_key_last_4": None, - "client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc", - "client_secret_last_4": "cdef", - "config": { - "instance_url": "https://example.my.salesforce.com" - }, - "state": "connected", - "created_at": "2024-01-16T14:20:00.000Z", - "updated_at": "2024-01-16T14:20:00.000Z", - "userlandUserId": "test_userlandUserId", - } - ], - } - ], - } - instance = DataIntegrationsListResponse.from_dict(data) - serialized = instance.to_dict() - assert serialized["object"] == data["object"] - assert serialized["data"] == data["data"] - - def test_data_integrations_list_response_data_round_trip(self): - data = load_fixture("data_integrations_list_response_data.json") - instance = DataIntegrationsListResponseData.from_dict(data) - serialized = instance.to_dict() - assert serialized == data - restored = DataIntegrationsListResponseData.from_dict(serialized) - assert restored.to_dict() == serialized - - def test_data_integrations_list_response_data_minimal_payload(self): - data = { - "object": "data_provider", - "id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", - "name": "GitHub", - "description": None, - "slug": "github", - "integration_type": "github", - "credentials_type": "oauth2", - "scopes": None, - "ownership": "userland_user", - "created_at": "2024-01-15T10:30:00.000Z", - "updated_at": "2024-01-15T10:30:00.000Z", - "connected_account": None, - "connected_accounts": [ - { - "object": "connected_account", - "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", - "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", - "organization_id": None, - "scopes": ["repo", "user:email"], - "auth_method": "oauth", - "api_key_last_4": None, - "client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc", - "client_secret_last_4": "cdef", - "config": {"instance_url": "https://example.my.salesforce.com"}, - "state": "connected", - "created_at": "2024-01-16T14:20:00.000Z", - "updated_at": "2024-01-16T14:20:00.000Z", - "userlandUserId": "test_userlandUserId", - } - ], - } - instance = DataIntegrationsListResponseData.from_dict(data) - serialized = instance.to_dict() - assert serialized["object"] == data["object"] - assert serialized["id"] == data["id"] - assert serialized["name"] == data["name"] - assert serialized["description"] == data["description"] - assert serialized["slug"] == data["slug"] - assert serialized["integration_type"] == data["integration_type"] - assert serialized["credentials_type"] == data["credentials_type"] - assert serialized["scopes"] == data["scopes"] - assert serialized["ownership"] == data["ownership"] - assert serialized["created_at"] == data["created_at"] - assert serialized["updated_at"] == data["updated_at"] - assert serialized["connected_account"] == data["connected_account"] - assert serialized["connected_accounts"] == data["connected_accounts"] - - def test_data_integrations_list_response_data_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "object": "data_provider", - "id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", - "name": "GitHub", - "description": "Connect your GitHub account to access repositories.", - "slug": "github", - "integration_type": "github", - "credentials_type": "oauth2", - "scopes": ["repo", "user:email"], - "ownership": "userland_user", - "created_at": "2024-01-15T10:30:00.000Z", - "updated_at": "2024-01-15T10:30:00.000Z", - "connected_account": { - "object": "connected_account", - "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", - "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", - "organization_id": None, - "scopes": ["repo", "user:email"], - "auth_method": "oauth", - "api_key_last_4": None, - "client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc", - "client_secret_last_4": "cdef", - "config": {"instance_url": "https://example.my.salesforce.com"}, - "state": "connected", - "created_at": "2024-01-16T14:20:00.000Z", - "updated_at": "2024-01-16T14:20:00.000Z", - "userlandUserId": "test_userlandUserId", - }, - "connected_accounts": [ - { - "object": "connected_account", - "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", - "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", - "organization_id": None, - "scopes": ["repo", "user:email"], - "auth_method": "oauth", - "api_key_last_4": None, - "client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc", - "client_secret_last_4": "cdef", - "config": {"instance_url": "https://example.my.salesforce.com"}, - "state": "connected", - "created_at": "2024-01-16T14:20:00.000Z", - "updated_at": "2024-01-16T14:20:00.000Z", - "userlandUserId": "test_userlandUserId", - } - ], - } - instance = DataIntegrationsListResponseData.from_dict(data) - serialized = instance.to_dict() - assert "auth_methods" not in serialized - - def test_data_integrations_list_response_data_preserves_nullable_fields(self): - data = { - "object": "data_provider", - "id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", - "name": "GitHub", - "description": None, - "slug": "github", - "integration_type": "github", - "credentials_type": "oauth2", - "scopes": None, - "auth_methods": ["oauth"], - "ownership": "userland_user", - "created_at": "2024-01-15T10:30:00.000Z", - "updated_at": "2024-01-15T10:30:00.000Z", - "connected_account": None, - "connected_accounts": [ - { - "object": "connected_account", - "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", - "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", - "organization_id": None, - "scopes": ["repo", "user:email"], - "auth_method": "oauth", - "api_key_last_4": None, - "client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc", - "client_secret_last_4": "cdef", - "config": {"instance_url": "https://example.my.salesforce.com"}, - "state": "connected", - "created_at": "2024-01-16T14:20:00.000Z", - "updated_at": "2024-01-16T14:20:00.000Z", - "userlandUserId": "test_userlandUserId", - } - ], - } - instance = DataIntegrationsListResponseData.from_dict(data) - serialized = instance.to_dict() - assert serialized["description"] is None - assert serialized["scopes"] is None - assert serialized["connected_account"] is None - - def test_data_integrations_list_response_data_round_trips_unknown_enum_values(self): - data = { - "object": "data_provider", - "id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", - "name": "GitHub", - "description": "Connect your GitHub account to access repositories.", - "slug": "github", - "integration_type": "github", - "credentials_type": "oauth2", - "scopes": ["repo", "user:email"], - "auth_methods": ["oauth"], - "ownership": "unexpected_data_integrations_list_response_data_ownership", - "created_at": "2024-01-15T10:30:00.000Z", - "updated_at": "2024-01-15T10:30:00.000Z", - "connected_account": { - "object": "connected_account", - "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", - "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", - "organization_id": None, - "scopes": ["repo", "user:email"], - "auth_method": "oauth", - "api_key_last_4": None, - "client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc", - "client_secret_last_4": "cdef", - "config": {"instance_url": "https://example.my.salesforce.com"}, - "state": "connected", - "created_at": "2024-01-16T14:20:00.000Z", - "updated_at": "2024-01-16T14:20:00.000Z", - "userlandUserId": "test_userlandUserId", - }, - "connected_accounts": [ - { - "object": "connected_account", - "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", - "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", - "organization_id": None, - "scopes": ["repo", "user:email"], - "auth_method": "oauth", - "api_key_last_4": None, - "client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc", - "client_secret_last_4": "cdef", - "config": {"instance_url": "https://example.my.salesforce.com"}, - "state": "connected", - "created_at": "2024-01-16T14:20:00.000Z", - "updated_at": "2024-01-16T14:20:00.000Z", - "userlandUserId": "test_userlandUserId", - } - ], - } - instance = DataIntegrationsListResponseData.from_dict(data) - assert instance.to_dict() == data - def test_data_integration_credentials_response_credential_round_trip(self): data = load_fixture("data_integration_credentials_response_credential.json") instance = DataIntegrationCredentialsResponseCredential.from_dict(data) @@ -913,6 +655,9 @@ def test_data_integration_installation_round_trip(self): def test_data_integration_installation_minimal_payload(self): data = { "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": None, + "account_display_name": None, "user_id": None, "organization_id": None, "api_key_last_4": None, @@ -920,6 +665,9 @@ def test_data_integration_installation_minimal_payload(self): instance = DataIntegrationInstallation.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] + assert serialized["connection_role"] == data["connection_role"] + assert serialized["account_identifier"] == data["account_identifier"] + assert serialized["account_display_name"] == data["account_display_name"] assert serialized["user_id"] == data["user_id"] assert serialized["organization_id"] == data["organization_id"] assert serialized["api_key_last_4"] == data["api_key_last_4"] @@ -927,16 +675,34 @@ def test_data_integration_installation_minimal_payload(self): def test_data_integration_installation_preserves_nullable_fields(self): data = { "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "compatibility", + "account_identifier": None, + "account_display_name": None, "user_id": None, "organization_id": None, "api_key_last_4": None, } instance = DataIntegrationInstallation.from_dict(data) serialized = instance.to_dict() + assert serialized["account_identifier"] is None + assert serialized["account_display_name"] is None assert serialized["user_id"] is None assert serialized["organization_id"] is None assert serialized["api_key_last_4"] is None + def test_data_integration_installation_round_trips_unknown_enum_values(self): + data = { + "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", + "connection_role": "unexpected_data_integration_installation_connection_role", + "account_identifier": "workspace_123", + "account_display_name": "Acme production", + "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", + "organization_id": None, + "api_key_last_4": "cdef", + } + instance = DataIntegrationInstallation.from_dict(data) + assert instance.to_dict() == data + def test_data_integration_custom_provider_round_trip(self): data = load_fixture("data_integration_custom_provider.json") instance = DataIntegrationCustomProvider.from_dict(data) @@ -1012,113 +778,3 @@ def test_data_integration_custom_provider_round_trips_unknown_enum_values(self): } instance = DataIntegrationCustomProvider.from_dict(data) assert instance.to_dict() == data - - def test_data_integrations_list_response_data_connected_account_round_trip(self): - data = load_fixture( - "data_integrations_list_response_data_connected_account.json" - ) - instance = DataIntegrationsListResponseDataConnectedAccount.from_dict(data) - serialized = instance.to_dict() - assert serialized == data - restored = DataIntegrationsListResponseDataConnectedAccount.from_dict( - serialized - ) - assert restored.to_dict() == serialized - - def test_data_integrations_list_response_data_connected_account_minimal_payload( - self, - ): - data = { - "object": "connected_account", - "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", - "user_id": None, - "organization_id": None, - "scopes": ["repo", "user:email"], - "state": "connected", - "created_at": "2024-01-16T14:20:00.000Z", - "updated_at": "2024-01-16T14:20:00.000Z", - "userlandUserId": None, - } - instance = DataIntegrationsListResponseDataConnectedAccount.from_dict(data) - serialized = instance.to_dict() - assert serialized["object"] == data["object"] - assert serialized["id"] == data["id"] - assert serialized["user_id"] == data["user_id"] - assert serialized["organization_id"] == data["organization_id"] - assert serialized["scopes"] == data["scopes"] - assert serialized["state"] == data["state"] - assert serialized["created_at"] == data["created_at"] - assert serialized["updated_at"] == data["updated_at"] - assert serialized["userlandUserId"] == data["userlandUserId"] - - def test_data_integrations_list_response_data_connected_account_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "object": "connected_account", - "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", - "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", - "organization_id": None, - "scopes": ["repo", "user:email"], - "api_key_last_4": None, - "client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc", - "client_secret_last_4": "cdef", - "state": "connected", - "created_at": "2024-01-16T14:20:00.000Z", - "updated_at": "2024-01-16T14:20:00.000Z", - "userlandUserId": "test_userlandUserId", - } - instance = DataIntegrationsListResponseDataConnectedAccount.from_dict(data) - serialized = instance.to_dict() - assert "auth_method" not in serialized - assert "config" not in serialized - - def test_data_integrations_list_response_data_connected_account_preserves_nullable_fields( - self, - ): - data = { - "object": "connected_account", - "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", - "user_id": None, - "organization_id": None, - "scopes": ["repo", "user:email"], - "auth_method": "oauth", - "api_key_last_4": None, - "client_id": None, - "client_secret_last_4": None, - "config": {"instance_url": "https://example.my.salesforce.com"}, - "state": "connected", - "created_at": "2024-01-16T14:20:00.000Z", - "updated_at": "2024-01-16T14:20:00.000Z", - "userlandUserId": None, - } - instance = DataIntegrationsListResponseDataConnectedAccount.from_dict(data) - serialized = instance.to_dict() - assert serialized["user_id"] is None - assert serialized["organization_id"] is None - assert serialized["api_key_last_4"] is None - assert serialized["client_id"] is None - assert serialized["client_secret_last_4"] is None - assert serialized["userlandUserId"] is None - - def test_data_integrations_list_response_data_connected_account_round_trips_unknown_enum_values( - self, - ): - data = { - "object": "connected_account", - "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", - "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", - "organization_id": None, - "scopes": ["repo", "user:email"], - "auth_method": "unexpected_data_integrations_list_response_data_connected_account_auth_method", - "api_key_last_4": None, - "client_id": "3MVG9dZJodJWxft2VoStSCVwPFsx0eDcpVc", - "client_secret_last_4": "cdef", - "config": {"instance_url": "https://example.my.salesforce.com"}, - "state": "connected", - "created_at": "2024-01-16T14:20:00.000Z", - "updated_at": "2024-01-16T14:20:00.000Z", - "userlandUserId": "test_userlandUserId", - } - instance = DataIntegrationsListResponseDataConnectedAccount.from_dict(data) - assert instance.to_dict() == data