diff --git a/.changelog-pending/2026-07-28T19-17-20-72f2c0b2792fb452e4b7e1a0555c2fe14b857631.md b/.changelog-pending/2026-07-28T19-17-20-72f2c0b2792fb452e4b7e1a0555c2fe14b857631.md new file mode 100644 index 00000000..73e4c78a --- /dev/null +++ b/.changelog-pending/2026-07-28T19-17-20-72f2c0b2792fb452e4b7e1a0555c2fe14b857631.md @@ -0,0 +1,18 @@ +* [#702](https://github.com/workos/workos-python/pull/702) feat(generated)!: regenerate from spec (2 changes) + + **Features** + * **[pipes](https://workos.com/docs/reference/pipes)**: + * Added `config` to `DataIntegrationsGetDataIntegrationAuthorizeUrlRequest` + * Added `client_credentials` to `DataIntegrationAuthMethods` + * Added `client_credentials` to `DataIntegrationsListResponseDataAuthMethods` + * Added `client_credentials` to `DataIntegrationsListResponseDataConnectedAccountAuthMethod` + * Added `config` to Pipes models + * **[connect](https://workos.com/docs/reference/workos-connect/standalone)**: + * Added `client_credentials` to `ConnectedAccountAuthMethod` + + **Fixes** + * **[user_management](https://workos.com/docs/reference/authkit/user)**: + * Changed errors for endpoint `POST /user_management/invitations` + * Changed errors for endpoint `POST /user_management/invitations/{id}/resend` + * Changed errors for endpoint `POST /user_management/magic_auth` + * Changed errors for endpoint `POST /user_management/authenticate` diff --git a/.last-synced-sha b/.last-synced-sha index 5d1fd6d4..dd187756 100644 --- a/.last-synced-sha +++ b/.last-synced-sha @@ -1 +1 @@ -f40851a620a1ba0badec95e80faac475382c8dd0 +904c5bccd2c6d0511ad2d0760e57d139143f1773 diff --git a/src/workos/authorization/__init__.py b/src/workos/authorization/__init__.py index 14985f50..3f624ae1 100644 --- a/src/workos/authorization/__init__.py +++ b/src/workos/authorization/__init__.py @@ -1,13 +1,11 @@ # This file is auto-generated by oagen. Do not edit. -from ._resource import ( - Authorization as Authorization, - AsyncAuthorization as AsyncAuthorization, - ResourceTargetById as ResourceTargetById, - ResourceTargetByExternalId as ResourceTargetByExternalId, - ParentResourceById as ParentResourceById, - ParentResourceByExternalId as ParentResourceByExternalId, - ParentById as ParentById, - ParentByExternalId as ParentByExternalId, -) +from ._resource import AsyncAuthorization as AsyncAuthorization +from ._resource import Authorization as Authorization +from ._resource import ParentByExternalId as ParentByExternalId +from ._resource import ParentById as ParentById +from ._resource import ParentResourceByExternalId as ParentResourceByExternalId +from ._resource import ParentResourceById as ParentResourceById +from ._resource import ResourceTargetByExternalId as ResourceTargetByExternalId +from ._resource import ResourceTargetById as ResourceTargetById from .models import * diff --git a/src/workos/authorization/models/__init__.py b/src/workos/authorization/models/__init__.py index 8b5df90f..5251b450 100644 --- a/src/workos/authorization/models/__init__.py +++ b/src/workos/authorization/models/__init__.py @@ -3,12 +3,16 @@ from workos.common.models.add_role_permission import ( AddRolePermission as AddRolePermission, ) -from .assign_role import AssignRole as AssignRole -from .authorization_assignment import AuthorizationAssignment as AuthorizationAssignment -from .authorization_check import AuthorizationCheck as AuthorizationCheck from workos.common.models.authorization_permission import ( AuthorizationPermission as AuthorizationPermission, ) +from workos.common.models.list_metadata import ListMetadata as ListMetadata +from workos.common.models.pagination_order import PaginationOrder as PaginationOrder +from workos.common.models.slim_role import SlimRole as SlimRole + +from .assign_role import AssignRole as AssignRole +from .authorization_assignment import AuthorizationAssignment as AuthorizationAssignment +from .authorization_check import AuthorizationCheck as AuthorizationCheck from .authorization_resource import AuthorizationResource as AuthorizationResource from .check_authorization import CheckAuthorization as CheckAuthorization from .create_authorization_permission import ( @@ -32,8 +36,6 @@ from .group_role_assignment_resource import ( GroupRoleAssignmentResource as GroupRoleAssignmentResource, ) -from workos.common.models.list_metadata import ListMetadata as ListMetadata -from workos.common.models.pagination_order import PaginationOrder as PaginationOrder from .permission import Permission as Permission from .remove_role import RemoveRole as RemoveRole from .replace_group_role_assignment_entry import ( @@ -45,7 +47,6 @@ from .role import Role as Role from .role_list import RoleList as RoleList from .set_role_permissions import SetRolePermissions as SetRolePermissions -from workos.common.models.slim_role import SlimRole as SlimRole from .update_authorization_permission import ( UpdateAuthorizationPermission as UpdateAuthorizationPermission, ) diff --git a/src/workos/common/__init__.py b/src/workos/common/__init__.py index 37bdfe8b..8fc6065d 100644 --- a/src/workos/common/__init__.py +++ b/src/workos/common/__init__.py @@ -1,5 +1,6 @@ # This file is auto-generated by oagen. Do not edit. +from .models import * from .models import ( AccessTokenAgentRegistrationCredentialIssuedDataDetail as AccessTokenAgentRegistrationCredentialIssuedDataDetail, ) diff --git a/src/workos/common/models/__init__.py b/src/workos/common/models/__init__.py index 660e193a..c822920e 100644 --- a/src/workos/common/models/__init__.py +++ b/src/workos/common/models/__init__.py @@ -44,6 +44,9 @@ from .agent_registration_created_data_agent_identity import ( AgentRegistrationCreatedDataAgentIdentity as AgentRegistrationCreatedDataAgentIdentity, ) +from .agent_registration_created_data_kind import * +from .agent_registration_created_data_method import * +from .agent_registration_created_data_status import * from .agent_registration_credential_issued import ( AgentRegistrationCredentialIssued as AgentRegistrationCredentialIssued, ) @@ -103,6 +106,9 @@ AuditLogConfigurationState as AuditLogConfigurationState, ) from .audit_log_export_state import AuditLogExportState as AuditLogExportState +from .auth_method_mismatch_error import ( + AuthMethodMismatchError as AuthMethodMismatchError, +) from .authenticate_response_authentication_method import ( AuthenticateResponseAuthenticationMethod as AuthenticateResponseAuthenticationMethod, ) @@ -138,9 +144,6 @@ from .authentication_factor_enrolled_type import ( AuthenticationFactorEnrolledType as AuthenticationFactorEnrolledType, ) -from .authentication_factors_create_request_type import ( - AuthenticationFactorsCreateRequestType as AuthenticationFactorsCreateRequestType, -) from .authentication_factor_sms import ( AuthenticationFactorSms as AuthenticationFactorSms, ) @@ -150,6 +153,9 @@ from .authentication_factor_type import ( AuthenticationFactorType as AuthenticationFactorType, ) +from .authentication_factors_create_request_type import ( + AuthenticationFactorsCreateRequestType as AuthenticationFactorsCreateRequestType, +) from .authentication_magic_auth_failed import ( AuthenticationMagicAuthFailed as AuthenticationMagicAuthFailed, ) @@ -231,6 +237,7 @@ from .authentication_radar_risk_detected_data import ( AuthenticationRadarRiskDetectedData as AuthenticationRadarRiskDetectedData, ) +from .authentication_radar_risk_detected_data_action import * from .authentication_reauthentication_succeeded import ( AuthenticationReauthenticationSucceeded as AuthenticationReauthenticationSucceeded, ) @@ -279,14 +286,13 @@ from .authentication_sso_timed_out_data_sso import ( AuthenticationSSOTimedOutDataSSO as AuthenticationSSOTimedOutDataSSO, ) -from .auth_method_mismatch_error import ( - AuthMethodMismatchError as AuthMethodMismatchError, -) from .authorization_permission import AuthorizationPermission as AuthorizationPermission from .claim_view_response_status import ( ClaimViewResponseStatus as ClaimViewResponseStatus, ) from .connect_application import ConnectApplication as ConnectApplication +from .connect_application import ConnectApplicationUnknown as ConnectApplicationUnknown +from .connect_application import ConnectApplicationVariant as ConnectApplicationVariant from .connect_application_m2m import ConnectApplicationM2M as ConnectApplicationM2M from .connect_application_oauth import ( ConnectApplicationOAuth as ConnectApplicationOAuth, @@ -294,8 +300,6 @@ from .connect_application_oauth_redirect_uris import ( ConnectApplicationOAuthRedirectUris as ConnectApplicationOAuthRedirectUris, ) -from .connect_application import ConnectApplicationUnknown as ConnectApplicationUnknown -from .connect_application import ConnectApplicationVariant as ConnectApplicationVariant from .connected_account import ConnectedAccount as ConnectedAccount from .connected_account_auth_method import ( ConnectedAccountAuthMethod as ConnectedAccountAuthMethod, @@ -308,18 +312,26 @@ from .connection_activated_data import ( ConnectionActivatedData as ConnectionActivatedData, ) +from .connection_activated_data_connection_type import * from .connection_activated_data_domain import ( ConnectionActivatedDataDomain as ConnectionActivatedDataDomain, ) +from .connection_activated_data_state import * +from .connection_activated_data_status import * from .connection_deactivated import ConnectionDeactivated as ConnectionDeactivated from .connection_deactivated_data import ( ConnectionDeactivatedData as ConnectionDeactivatedData, ) +from .connection_deactivated_data_connection_type import * from .connection_deactivated_data_domain import ( ConnectionDeactivatedDataDomain as ConnectionDeactivatedDataDomain, ) +from .connection_deactivated_data_state import * +from .connection_deactivated_data_status import * from .connection_deleted import ConnectionDeleted as ConnectionDeleted from .connection_deleted_data import ConnectionDeletedData as ConnectionDeletedData +from .connection_deleted_data_connection_type import * +from .connection_deleted_data_state import * from .connection_saml_certificate_renewal_required import ( ConnectionSAMLCertificateRenewalRequired as ConnectionSAMLCertificateRenewalRequired, ) @@ -329,6 +341,7 @@ from .connection_saml_certificate_renewal_required_data_certificate import ( ConnectionSAMLCertificateRenewalRequiredDataCertificate as ConnectionSAMLCertificateRenewalRequiredDataCertificate, ) +from .connection_saml_certificate_renewal_required_data_certificate_certificate_type import * from .connection_saml_certificate_renewal_required_data_connection import ( ConnectionSAMLCertificateRenewalRequiredDataConnection as ConnectionSAMLCertificateRenewalRequiredDataConnection, ) @@ -341,6 +354,7 @@ from .connection_saml_certificate_renewed_data_certificate import ( ConnectionSAMLCertificateRenewedDataCertificate as ConnectionSAMLCertificateRenewedDataCertificate, ) +from .connection_saml_certificate_renewed_data_certificate_certificate_type import * from .connection_saml_certificate_renewed_data_connection import ( ConnectionSAMLCertificateRenewedDataConnection as ConnectionSAMLCertificateRenewedDataConnection, ) @@ -368,6 +382,9 @@ from .data_integration_auth_methods import ( DataIntegrationAuthMethods as DataIntegrationAuthMethods, ) +from .data_integration_credential_type import ( + DataIntegrationCredentialType as DataIntegrationCredentialType, +) from .data_integration_credentials_credentials_type import ( DataIntegrationCredentialsCredentialsType as DataIntegrationCredentialsCredentialsType, ) @@ -377,12 +394,10 @@ from .data_integration_credentials_response_error import ( DataIntegrationCredentialsResponseError as DataIntegrationCredentialsResponseError, ) -from .data_integration_credential_type import ( - DataIntegrationCredentialType as DataIntegrationCredentialType, -) from .data_integration_custom_provider_authenticate_via import ( DataIntegrationCustomProviderAuthenticateVia as DataIntegrationCustomProviderAuthenticateVia, ) +from .data_integration_state import DataIntegrationState as DataIntegrationState from .data_integrations_list_response_data_auth_methods import ( DataIntegrationsListResponseDataAuthMethods as DataIntegrationsListResponseDataAuthMethods, ) @@ -395,12 +410,12 @@ from .data_integrations_list_response_data_ownership import ( DataIntegrationsListResponseDataOwnership as DataIntegrationsListResponseDataOwnership, ) -from .data_integration_state import DataIntegrationState as DataIntegrationState from .directory_group import DirectoryGroup as DirectoryGroup from .directory_state import DirectoryState as DirectoryState from .directory_type import DirectoryType as DirectoryType from .directory_user import DirectoryUser as DirectoryUser from .directory_user_email import DirectoryUserEmail as DirectoryUserEmail +from .directory_user_state import * from .directory_user_with_groups_state import ( DirectoryUserWithGroupsState as DirectoryUserWithGroupsState, ) @@ -409,8 +424,12 @@ from .dsync_activated_data_domain import ( DsyncActivatedDataDomain as DsyncActivatedDataDomain, ) +from .dsync_activated_data_state import * +from .dsync_activated_data_type import * from .dsync_deleted import DsyncDeleted as DsyncDeleted from .dsync_deleted_data import DsyncDeletedData as DsyncDeletedData +from .dsync_deleted_data_state import * +from .dsync_deleted_data_type import * from .dsync_group_created import DsyncGroupCreated as DsyncGroupCreated from .dsync_group_deleted import DsyncGroupDeleted as DsyncGroupDeleted from .dsync_group_updated import DsyncGroupUpdated as DsyncGroupUpdated @@ -434,6 +453,7 @@ from .dsync_user_updated_data_email import ( DsyncUserUpdatedDataEmail as DsyncUserUpdatedDataEmail, ) +from .dsync_user_updated_data_state import * from .email_verification_created import ( EmailVerificationCreated as EmailVerificationCreated, ) @@ -443,6 +463,7 @@ from .error_response import ErrorResponse as ErrorResponse from .event_context import EventContext as EventContext from .event_context_actor import EventContextActor as EventContextActor +from .event_context_actor_source import * from .event_context_google_analytics_session import ( EventContextGoogleAnalyticsSession as EventContextGoogleAnalyticsSession, ) @@ -454,6 +475,7 @@ from .flag_created_context_actor import ( FlagCreatedContextActor as FlagCreatedContextActor, ) +from .flag_created_context_actor_source import * from .flag_created_data import FlagCreatedData as FlagCreatedData from .flag_created_data_owner import FlagCreatedDataOwner as FlagCreatedDataOwner from .flag_deleted import FlagDeleted as FlagDeleted @@ -461,14 +483,17 @@ from .flag_deleted_context_actor import ( FlagDeletedContextActor as FlagDeletedContextActor, ) +from .flag_deleted_context_actor_source import * from .flag_deleted_data import FlagDeletedData as FlagDeletedData from .flag_deleted_data_owner import FlagDeletedDataOwner as FlagDeletedDataOwner from .flag_owner import FlagOwner as FlagOwner from .flag_rule_updated import FlagRuleUpdated as FlagRuleUpdated from .flag_rule_updated_context import FlagRuleUpdatedContext as FlagRuleUpdatedContext +from .flag_rule_updated_context_access_type import * from .flag_rule_updated_context_actor import ( FlagRuleUpdatedContextActor as FlagRuleUpdatedContextActor, ) +from .flag_rule_updated_context_actor_source import * from .flag_rule_updated_context_configured_target import ( FlagRuleUpdatedContextConfiguredTarget as FlagRuleUpdatedContextConfiguredTarget, ) @@ -484,6 +509,7 @@ from .flag_rule_updated_context_previous_attribute_context import ( FlagRuleUpdatedContextPreviousAttributeContext as FlagRuleUpdatedContextPreviousAttributeContext, ) +from .flag_rule_updated_context_previous_attribute_context_access_type import * from .flag_rule_updated_context_previous_attribute_context_configured_target import ( FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget as FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget, ) @@ -505,6 +531,7 @@ from .flag_updated_context_actor import ( FlagUpdatedContextActor as FlagUpdatedContextActor, ) +from .flag_updated_context_actor_source import * from .flag_updated_context_previous_attribute import ( FlagUpdatedContextPreviousAttribute as FlagUpdatedContextPreviousAttribute, ) @@ -524,12 +551,16 @@ from .group_updated import GroupUpdated as GroupUpdated from .invitation_accepted import InvitationAccepted as InvitationAccepted from .invitation_accepted_data import InvitationAcceptedData as InvitationAcceptedData +from .invitation_accepted_data_state import * from .invitation_created import InvitationCreated as InvitationCreated from .invitation_created_data import InvitationCreatedData as InvitationCreatedData +from .invitation_created_data_state import * from .invitation_resent import InvitationResent as InvitationResent from .invitation_resent_data import InvitationResentData as InvitationResentData +from .invitation_resent_data_state import * from .invitation_revoked import InvitationRevoked as InvitationRevoked from .invitation_revoked_data import InvitationRevokedData as InvitationRevokedData +from .invitation_revoked_data_state import * from .invitation_state import InvitationState as InvitationState from .list_metadata import ListMetadata as ListMetadata from .magic_auth_created import MagicAuthCreated as MagicAuthCreated @@ -541,6 +572,8 @@ from .organization_created_data_domain import ( OrganizationCreatedDataDomain as OrganizationCreatedDataDomain, ) +from .organization_created_data_domain_state import * +from .organization_created_data_domain_verification_strategy import * from .organization_deleted import OrganizationDeleted as OrganizationDeleted from .organization_deleted_data import ( OrganizationDeletedData as OrganizationDeletedData, @@ -548,6 +581,8 @@ from .organization_deleted_data_domain import ( OrganizationDeletedDataDomain as OrganizationDeletedDataDomain, ) +from .organization_deleted_data_domain_state import * +from .organization_deleted_data_domain_verification_strategy import * from .organization_domain import OrganizationDomain as OrganizationDomain from .organization_domain_created import ( OrganizationDomainCreated as OrganizationDomainCreated, @@ -555,6 +590,8 @@ from .organization_domain_created_data import ( OrganizationDomainCreatedData as OrganizationDomainCreatedData, ) +from .organization_domain_created_data_state import * +from .organization_domain_created_data_verification_strategy import * from .organization_domain_data_state import ( OrganizationDomainDataState as OrganizationDomainDataState, ) @@ -564,6 +601,8 @@ from .organization_domain_deleted_data import ( OrganizationDomainDeletedData as OrganizationDomainDeletedData, ) +from .organization_domain_deleted_data_state import * +from .organization_domain_deleted_data_verification_strategy import * from .organization_domain_state import ( OrganizationDomainState as OrganizationDomainState, ) @@ -573,6 +612,8 @@ from .organization_domain_updated_data import ( OrganizationDomainUpdatedData as OrganizationDomainUpdatedData, ) +from .organization_domain_updated_data_state import * +from .organization_domain_updated_data_verification_strategy import * from .organization_domain_verification_failed import ( OrganizationDomainVerificationFailed as OrganizationDomainVerificationFailed, ) @@ -582,6 +623,9 @@ from .organization_domain_verification_failed_data_organization_domain import ( OrganizationDomainVerificationFailedDataOrganizationDomain as OrganizationDomainVerificationFailedDataOrganizationDomain, ) +from .organization_domain_verification_failed_data_organization_domain_state import * +from .organization_domain_verification_failed_data_organization_domain_verification_strategy import * +from .organization_domain_verification_failed_data_reason import * from .organization_domain_verification_strategy import ( OrganizationDomainVerificationStrategy as OrganizationDomainVerificationStrategy, ) @@ -591,18 +635,22 @@ from .organization_domain_verified_data import ( OrganizationDomainVerifiedData as OrganizationDomainVerifiedData, ) +from .organization_domain_verified_data_state import * +from .organization_domain_verified_data_verification_strategy import * from .organization_membership_created import ( OrganizationMembershipCreated as OrganizationMembershipCreated, ) from .organization_membership_created_data import ( OrganizationMembershipCreatedData as OrganizationMembershipCreatedData, ) +from .organization_membership_created_data_status import * from .organization_membership_deleted import ( OrganizationMembershipDeleted as OrganizationMembershipDeleted, ) from .organization_membership_deleted_data import ( OrganizationMembershipDeletedData as OrganizationMembershipDeletedData, ) +from .organization_membership_deleted_data_status import * from .organization_membership_status import ( OrganizationMembershipStatus as OrganizationMembershipStatus, ) @@ -612,6 +660,7 @@ from .organization_membership_updated_data import ( OrganizationMembershipUpdatedData as OrganizationMembershipUpdatedData, ) +from .organization_membership_updated_data_status import * from .organization_role_created import ( OrganizationRoleCreated as OrganizationRoleCreated, ) @@ -637,6 +686,8 @@ from .organization_updated_data_domain import ( OrganizationUpdatedDataDomain as OrganizationUpdatedDataDomain, ) +from .organization_updated_data_domain_state import * +from .organization_updated_data_domain_verification_strategy import * from .pagination_order import PaginationOrder as PaginationOrder from .password_reset_created import PasswordResetCreated as PasswordResetCreated from .password_reset_created_data import ( @@ -653,6 +704,7 @@ from .permission_updated import PermissionUpdated as PermissionUpdated from .permission_updated_data import PermissionUpdatedData as PermissionUpdatedData from .pipe_connected_account import PipeConnectedAccount as PipeConnectedAccount +from .pipe_connected_account_state import * from .pipes_connected_account_connected import ( PipesConnectedAccountConnected as PipesConnectedAccountConnected, ) @@ -700,14 +752,18 @@ from .role_updated_data import RoleUpdatedData as RoleUpdatedData from .session_created import SessionCreated as SessionCreated from .session_created_data import SessionCreatedData as SessionCreatedData +from .session_created_data_auth_method import * from .session_created_data_impersonator import ( SessionCreatedDataImpersonator as SessionCreatedDataImpersonator, ) +from .session_created_data_status import * from .session_revoked import SessionRevoked as SessionRevoked from .session_revoked_data import SessionRevokedData as SessionRevokedData +from .session_revoked_data_auth_method import * from .session_revoked_data_impersonator import ( SessionRevokedDataImpersonator as SessionRevokedDataImpersonator, ) +from .session_revoked_data_status import * from .slim_role import SlimRole as SlimRole from .update_custom_provider_definition_authenticate_via import ( UpdateCustomProviderDefinitionAuthenticateVia as UpdateCustomProviderDefinitionAuthenticateVia, @@ -760,6 +816,7 @@ from .vault_byok_key_deleted_data import ( VaultByokKeyDeletedData as VaultByokKeyDeletedData, ) +from .vault_byok_key_provider import * from .vault_byok_key_verification_completed import ( VaultByokKeyVerificationCompleted as VaultByokKeyVerificationCompleted, ) @@ -768,28 +825,39 @@ ) from .vault_data_created import VaultDataCreated as VaultDataCreated from .vault_data_created_data import VaultDataCreatedData as VaultDataCreatedData +from .vault_data_created_data_actor_source import * from .vault_data_deleted import VaultDataDeleted as VaultDataDeleted from .vault_data_deleted_data import VaultDataDeletedData as VaultDataDeletedData +from .vault_data_deleted_data_actor_source import * from .vault_data_read import VaultDataRead as VaultDataRead from .vault_data_read_data import VaultDataReadData as VaultDataReadData +from .vault_data_read_data_actor_source import * from .vault_data_updated import VaultDataUpdated as VaultDataUpdated from .vault_data_updated_data import VaultDataUpdatedData as VaultDataUpdatedData +from .vault_data_updated_data_actor_source import * from .vault_dek_decrypted import VaultDekDecrypted as VaultDekDecrypted from .vault_dek_decrypted_data import VaultDekDecryptedData as VaultDekDecryptedData +from .vault_dek_decrypted_data_actor_source import * from .vault_dek_read import VaultDekRead as VaultDekRead from .vault_dek_read_data import VaultDekReadData as VaultDekReadData +from .vault_dek_read_data_actor_source import * from .vault_kek_created import VaultKekCreated as VaultKekCreated from .vault_kek_created_data import VaultKekCreatedData as VaultKekCreatedData +from .vault_kek_created_data_actor_source import * from .vault_kek_deleted import VaultKekDeleted as VaultKekDeleted from .vault_kek_deleted_data import VaultKekDeletedData as VaultKekDeletedData +from .vault_kek_deleted_data_actor_source import * from .vault_metadata_read import VaultMetadataRead as VaultMetadataRead from .vault_metadata_read_data import VaultMetadataReadData as VaultMetadataReadData +from .vault_metadata_read_data_actor_source import * from .vault_names_listed import VaultNamesListed as VaultNamesListed from .vault_names_listed_data import VaultNamesListedData as VaultNamesListedData +from .vault_names_listed_data_actor_source import * from .waitlist_user import WaitlistUser as WaitlistUser from .waitlist_user_approved import WaitlistUserApproved as WaitlistUserApproved from .waitlist_user_created import WaitlistUserCreated as WaitlistUserCreated from .waitlist_user_denied import WaitlistUserDenied as WaitlistUserDenied +from .waitlist_user_state import * from .webhook_endpoint_status import WebhookEndpointStatus as WebhookEndpointStatus from .widget_session_token_scopes import ( WidgetSessionTokenScopes as WidgetSessionTokenScopes, diff --git a/src/workos/common/models/auth_method_mismatch_error.py b/src/workos/common/models/auth_method_mismatch_error.py index 86a11ec5..3727f88c 100644 --- a/src/workos/common/models/auth_method_mismatch_error.py +++ b/src/workos/common/models/auth_method_mismatch_error.py @@ -3,7 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Dict, Literal +from typing import Any, Literal + from workos._types import _raise_deserialize_error @@ -17,7 +18,7 @@ class AuthMethodMismatchError: """A human-readable explanation of the mismatch.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "AuthMethodMismatchError": + def from_dict(cls, data: dict[str, Any]) -> AuthMethodMismatchError: """Deserialize from a dictionary.""" try: return cls( @@ -27,9 +28,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuthMethodMismatchError": except (KeyError, ValueError) as e: _raise_deserialize_error("AuthMethodMismatchError", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["code"] = self.code result["message"] = self.message return result diff --git a/src/workos/common/models/authenticate_response_authentication_method.py b/src/workos/common/models/authenticate_response_authentication_method.py index 28db4599..720cb48d 100644 --- a/src/workos/common/models/authenticate_response_authentication_method.py +++ b/src/workos/common/models/authenticate_response_authentication_method.py @@ -5,7 +5,6 @@ from __future__ import annotations from enum import Enum -from typing import Optional from typing import Literal, TypeAlias @@ -38,7 +37,7 @@ class AuthenticateResponseAuthenticationMethod(str, Enum): @classmethod def _missing_( cls, value: object - ) -> Optional["AuthenticateResponseAuthenticationMethod"]: + ) -> AuthenticateResponseAuthenticationMethod | None: if not isinstance(value, str): return None unknown = str.__new__(cls, value) diff --git a/src/workos/common/models/authenticate_response_impersonator.py b/src/workos/common/models/authenticate_response_impersonator.py index 7cf3bad4..da715143 100644 --- a/src/workos/common/models/authenticate_response_impersonator.py +++ b/src/workos/common/models/authenticate_response_impersonator.py @@ -3,7 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Dict, Optional +from typing import Any + from workos._types import _raise_deserialize_error @@ -13,11 +14,11 @@ class AuthenticateResponseImpersonator: email: str """The email address of the WorkOS Dashboard user who is impersonating the user.""" - reason: Optional[str] + reason: str | None """The justification the impersonator gave for impersonating the user.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "AuthenticateResponseImpersonator": + def from_dict(cls, data: dict[str, Any]) -> AuthenticateResponseImpersonator: """Deserialize from a dictionary.""" try: return cls( @@ -27,9 +28,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuthenticateResponseImpersonator": except (KeyError, ValueError) as e: _raise_deserialize_error("AuthenticateResponseImpersonator", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["email"] = self.email if self.reason is not None: result["reason"] = self.reason diff --git a/src/workos/common/models/connect_application.py b/src/workos/common/models/connect_application.py index 79aaa4c7..e676b56b 100644 --- a/src/workos/common/models/connect_application.py +++ b/src/workos/common/models/connect_application.py @@ -3,7 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, ClassVar, Dict, Union, cast +from typing import Any, ClassVar, Union, cast + from workos._types import _raise_deserialize_error from .connect_application_m2m import ConnectApplicationM2M @@ -14,15 +15,15 @@ class ConnectApplicationUnknown: """Unknown variant of ConnectApplication not yet recognized by this SDK version.""" - raw_data: Dict[str, Any] + raw_data: dict[str, Any] """The raw payload, preserved so callers can still inspect the data.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "ConnectApplicationUnknown": + def from_dict(cls, data: dict[str, Any]) -> ConnectApplicationUnknown: """Wrap raw data in an unknown variant.""" return cls(raw_data=data) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Return the original raw data.""" return dict(self.raw_data) @@ -37,13 +38,13 @@ def to_dict(self) -> Dict[str, Any]: class ConnectApplication: """Discriminated union dispatcher (discriminated by 'application_type').""" - _DISPATCH: ClassVar[Dict[str, type]] = { + _DISPATCH: ClassVar[dict[str, type]] = { "m2m": ConnectApplicationM2M, "oauth": ConnectApplicationOAuth, } @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "ConnectApplicationVariant": + def from_dict(cls, data: dict[str, Any]) -> ConnectApplicationVariant: """Deserialize from a dictionary, dispatching to the correct variant.""" if "application_type" not in data: _raise_deserialize_error( diff --git a/src/workos/common/models/connect_application_m2m.py b/src/workos/common/models/connect_application_m2m.py index e8bea8b3..51b32ab9 100644 --- a/src/workos/common/models/connect_application_m2m.py +++ b/src/workos/common/models/connect_application_m2m.py @@ -4,9 +4,9 @@ from dataclasses import dataclass from datetime import datetime -from typing import Any, Dict, List, Literal, Optional -from workos._types import _raise_deserialize_error -from workos._types import _format_datetime, _parse_datetime +from typing import Any, Literal + +from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error @dataclass(slots=True) @@ -19,11 +19,11 @@ class ConnectApplicationM2M: """The unique ID of the connect application.""" client_id: str """The client ID of the connect application.""" - description: Optional[str] + description: str | None """A description of the connect application.""" name: str """The name of the connect application.""" - scopes: List[str] + scopes: list[str] """The scopes available for this application.""" created_at: datetime """An ISO 8601 timestamp.""" @@ -35,7 +35,7 @@ class ConnectApplicationM2M: """The ID of the organization the application belongs to.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "ConnectApplicationM2M": + def from_dict(cls, data: dict[str, Any]) -> ConnectApplicationM2M: """Deserialize from a dictionary.""" try: return cls( @@ -53,9 +53,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "ConnectApplicationM2M": except (KeyError, ValueError) as e: _raise_deserialize_error("ConnectApplicationM2M", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["object"] = self.object result["id"] = self.id result["client_id"] = self.client_id diff --git a/src/workos/common/models/connect_application_oauth.py b/src/workos/common/models/connect_application_oauth.py index 85b54664..1a272329 100644 --- a/src/workos/common/models/connect_application_oauth.py +++ b/src/workos/common/models/connect_application_oauth.py @@ -4,10 +4,9 @@ from dataclasses import dataclass from datetime import datetime -from typing import cast -from typing import Any, Dict, List, Literal, Optional -from workos._types import _raise_deserialize_error -from workos._types import _format_datetime, _parse_datetime +from typing import Any, Literal, cast + +from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error from .connect_application_oauth_redirect_uris import ConnectApplicationOAuthRedirectUris @@ -22,11 +21,11 @@ class ConnectApplicationOAuth: """The unique ID of the connect application.""" client_id: str """The client ID of the connect application.""" - description: Optional[str] + description: str | None """A description of the connect application.""" name: str """The name of the connect application.""" - scopes: List[str] + scopes: list[str] """The scopes available for this application.""" created_at: datetime """An ISO 8601 timestamp.""" @@ -34,19 +33,19 @@ class ConnectApplicationOAuth: """An ISO 8601 timestamp.""" application_type: Literal["oauth"] """The type of the application.""" - redirect_uris: List["ConnectApplicationOAuthRedirectUris"] + redirect_uris: list[ConnectApplicationOAuthRedirectUris] """The redirect URIs configured for this application.""" uses_pkce: bool """Whether the application uses PKCE for authorization.""" is_first_party: bool """Whether the application is a first-party application.""" - was_dynamically_registered: Optional[bool] = None + was_dynamically_registered: bool | None = None """Whether the application was dynamically registered.""" - organization_id: Optional[str] = None + organization_id: str | None = None """The ID of the organization the application belongs to.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "ConnectApplicationOAuth": + def from_dict(cls, data: dict[str, Any]) -> ConnectApplicationOAuth: """Deserialize from a dictionary.""" try: return cls( @@ -61,7 +60,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "ConnectApplicationOAuth": application_type=data.get("application_type", "oauth"), redirect_uris=[ ConnectApplicationOAuthRedirectUris.from_dict( - cast(Dict[str, Any], item) + cast(dict[str, Any], item) ) for item in cast(list[Any], data["redirect_uris"]) ], @@ -73,9 +72,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "ConnectApplicationOAuth": except (KeyError, ValueError) as e: _raise_deserialize_error("ConnectApplicationOAuth", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["object"] = self.object result["id"] = self.id result["client_id"] = self.client_id diff --git a/src/workos/common/models/connect_application_oauth_redirect_uris.py b/src/workos/common/models/connect_application_oauth_redirect_uris.py index d1a4dd38..f02a7e59 100644 --- a/src/workos/common/models/connect_application_oauth_redirect_uris.py +++ b/src/workos/common/models/connect_application_oauth_redirect_uris.py @@ -3,7 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Dict +from typing import Any + from workos._types import _raise_deserialize_error @@ -17,7 +18,7 @@ class ConnectApplicationOAuthRedirectUris: """Whether this is the default redirect URI.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "ConnectApplicationOAuthRedirectUris": + def from_dict(cls, data: dict[str, Any]) -> ConnectApplicationOAuthRedirectUris: """Deserialize from a dictionary.""" try: return cls( @@ -27,9 +28,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "ConnectApplicationOAuthRedirectUris except (KeyError, ValueError) as e: _raise_deserialize_error("ConnectApplicationOAuthRedirectUris", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["uri"] = self.uri result["default"] = self.default return result diff --git a/src/workos/common/models/connected_account.py b/src/workos/common/models/connected_account.py index dae7e6ca..5bbb93d9 100644 --- a/src/workos/common/models/connected_account.py +++ b/src/workos/common/models/connected_account.py @@ -4,8 +4,10 @@ from dataclasses import dataclass from enum import Enum -from typing import Any, Dict, List, Literal, Optional +from typing import Any, Literal + from workos._types import _raise_deserialize_error + from .connected_account_auth_method import ConnectedAccountAuthMethod from .connected_account_state import ConnectedAccountState @@ -18,13 +20,13 @@ class ConnectedAccount: """Distinguishes the connected account object.""" id: str """The unique identifier of the connected account.""" - user_id: Optional[str] + user_id: str | None """The [User](https://workos.com/docs/reference/authkit/user) identifier associated with this connection.""" - organization_id: Optional[str] + 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] + scopes: list[str] """The OAuth scopes granted for this connection.""" - state: "ConnectedAccountState" + state: ConnectedAccountState """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. @@ -33,13 +35,13 @@ class ConnectedAccount: """The timestamp when the connection was created.""" updated_at: str """The timestamp when the connection was last updated.""" - auth_method: Optional["ConnectedAccountAuthMethod"] = None - """The authentication method used for this connection (`oauth` or `api_key`). Defaults to `oauth` if absent.""" - api_key_last_4: Optional[str] = None + auth_method: ConnectedAccountAuthMethod | 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.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "ConnectedAccount": + def from_dict(cls, data: dict[str, Any]) -> ConnectedAccount: """Deserialize from a dictionary.""" try: return cls( @@ -59,9 +61,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "ConnectedAccount": except (KeyError, ValueError) as e: _raise_deserialize_error("ConnectedAccount", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["object"] = self.object result["id"] = self.id if self.user_id is not None: diff --git a/src/workos/common/models/connected_account_auth_method.py b/src/workos/common/models/connected_account_auth_method.py index 2741c7e9..2369df51 100644 --- a/src/workos/common/models/connected_account_auth_method.py +++ b/src/workos/common/models/connected_account_auth_method.py @@ -5,7 +5,6 @@ from __future__ import annotations from enum import Enum -from typing import Optional from typing import Literal, TypeAlias @@ -14,9 +13,10 @@ class ConnectedAccountAuthMethod(str, Enum): OAUTH = "oauth" API_KEY = "api_key" + CLIENT_CREDENTIALS = "client_credentials" @classmethod - def _missing_(cls, value: object) -> Optional["ConnectedAccountAuthMethod"]: + def _missing_(cls, value: object) -> ConnectedAccountAuthMethod | None: if not isinstance(value, str): return None unknown = str.__new__(cls, value) @@ -25,4 +25,6 @@ def _missing_(cls, value: object) -> Optional["ConnectedAccountAuthMethod"]: return unknown -ConnectedAccountAuthMethodLiteral: TypeAlias = Literal["oauth", "api_key"] +ConnectedAccountAuthMethodLiteral: TypeAlias = Literal[ + "oauth", "api_key", "client_credentials" +] diff --git a/src/workos/common/models/connected_account_input_state.py b/src/workos/common/models/connected_account_input_state.py index 362be4e0..50ac9df6 100644 --- a/src/workos/common/models/connected_account_input_state.py +++ b/src/workos/common/models/connected_account_input_state.py @@ -5,7 +5,6 @@ from __future__ import annotations from enum import Enum -from typing import Optional from typing import Literal, TypeAlias @@ -16,7 +15,7 @@ class ConnectedAccountInputState(str, Enum): NEEDS_REAUTHORIZATION = "needs_reauthorization" @classmethod - def _missing_(cls, value: object) -> Optional["ConnectedAccountInputState"]: + def _missing_(cls, value: object) -> ConnectedAccountInputState | None: if not isinstance(value, str): return None unknown = str.__new__(cls, value) diff --git a/src/workos/common/models/connected_account_state.py b/src/workos/common/models/connected_account_state.py index 743b7d0b..d0e747fe 100644 --- a/src/workos/common/models/connected_account_state.py +++ b/src/workos/common/models/connected_account_state.py @@ -5,7 +5,6 @@ from __future__ import annotations from enum import Enum -from typing import Optional from typing import Literal, TypeAlias @@ -17,7 +16,7 @@ class ConnectedAccountState(str, Enum): DISCONNECTED = "disconnected" @classmethod - def _missing_(cls, value: object) -> Optional["ConnectedAccountState"]: + def _missing_(cls, value: object) -> ConnectedAccountState | None: if not isinstance(value, str): return None unknown = str.__new__(cls, value) diff --git a/src/workos/common/models/create_data_integration_auth_methods.py b/src/workos/common/models/create_data_integration_auth_methods.py index 045091aa..acfd3197 100644 --- a/src/workos/common/models/create_data_integration_auth_methods.py +++ b/src/workos/common/models/create_data_integration_auth_methods.py @@ -1,7 +1,27 @@ # This file is auto-generated by oagen. Do not edit. -from typing import TypeAlias -from .connected_account_auth_method import ConnectedAccountAuthMethod +"""Enumeration of create data integration auth methods values.""" -CreateDataIntegrationAuthMethods: TypeAlias = ConnectedAccountAuthMethod -__all__ = ["CreateDataIntegrationAuthMethods"] +from __future__ import annotations + +from enum import Enum +from typing import Literal, TypeAlias + + +class CreateDataIntegrationAuthMethods(str, Enum): + """Known values for CreateDataIntegrationAuthMethods.""" + + OAUTH = "oauth" + API_KEY = "api_key" + + @classmethod + def _missing_(cls, value: object) -> CreateDataIntegrationAuthMethods | None: + if not isinstance(value, str): + return None + unknown = str.__new__(cls, value) + unknown._name_ = value.upper() + unknown._value_ = value + return unknown + + +CreateDataIntegrationAuthMethodsLiteral: TypeAlias = Literal["oauth", "api_key"] diff --git a/src/workos/common/models/create_user_invite_options_locale.py b/src/workos/common/models/create_user_invite_options_locale.py index 4b9ab4fc..5c12dcdb 100644 --- a/src/workos/common/models/create_user_invite_options_locale.py +++ b/src/workos/common/models/create_user_invite_options_locale.py @@ -5,7 +5,6 @@ from __future__ import annotations from enum import Enum -from typing import Optional from typing import Literal, TypeAlias @@ -104,7 +103,7 @@ class CreateUserInviteOptionsLocale(str, Enum): ZU = "zu" @classmethod - def _missing_(cls, value: object) -> Optional["CreateUserInviteOptionsLocale"]: + def _missing_(cls, value: object) -> CreateUserInviteOptionsLocale | None: if not isinstance(value, str): return None unknown = str.__new__(cls, value) diff --git a/src/workos/common/models/create_user_password_hash_type.py b/src/workos/common/models/create_user_password_hash_type.py index a36abbce..ba8fa3ee 100644 --- a/src/workos/common/models/create_user_password_hash_type.py +++ b/src/workos/common/models/create_user_password_hash_type.py @@ -5,7 +5,6 @@ from __future__ import annotations from enum import Enum -from typing import Optional from typing import Literal, TypeAlias @@ -21,7 +20,7 @@ class CreateUserPasswordHashType(str, Enum): ARGON_2 = "argon2" @classmethod - def _missing_(cls, value: object) -> Optional["CreateUserPasswordHashType"]: + def _missing_(cls, value: object) -> CreateUserPasswordHashType | None: if not isinstance(value, str): return None unknown = str.__new__(cls, value) diff --git a/src/workos/common/models/custom_provider_definition_authenticate_via.py b/src/workos/common/models/custom_provider_definition_authenticate_via.py index 593d57db..c817cf2d 100644 --- a/src/workos/common/models/custom_provider_definition_authenticate_via.py +++ b/src/workos/common/models/custom_provider_definition_authenticate_via.py @@ -5,7 +5,6 @@ from __future__ import annotations from enum import Enum -from typing import Optional from typing import Literal, TypeAlias @@ -16,9 +15,7 @@ class CustomProviderDefinitionAuthenticateVia(str, Enum): BASIC_AUTH_HEADER = "basic_auth_header" @classmethod - def _missing_( - cls, value: object - ) -> Optional["CustomProviderDefinitionAuthenticateVia"]: + def _missing_(cls, value: object) -> CustomProviderDefinitionAuthenticateVia | None: if not isinstance(value, str): return None unknown = str.__new__(cls, value) diff --git a/src/workos/common/models/data_integration_access_token_response_error.py b/src/workos/common/models/data_integration_access_token_response_error.py index e535bfa1..f9e64fa3 100644 --- a/src/workos/common/models/data_integration_access_token_response_error.py +++ b/src/workos/common/models/data_integration_access_token_response_error.py @@ -5,7 +5,6 @@ from __future__ import annotations from enum import Enum -from typing import Optional from typing import Literal, TypeAlias @@ -16,9 +15,7 @@ class DataIntegrationAccessTokenResponseError(str, Enum): NEEDS_REAUTHORIZATION = "needs_reauthorization" @classmethod - def _missing_( - cls, value: object - ) -> Optional["DataIntegrationAccessTokenResponseError"]: + def _missing_(cls, value: object) -> DataIntegrationAccessTokenResponseError | None: if not isinstance(value, str): return None unknown = str.__new__(cls, value) diff --git a/src/workos/common/models/data_integration_credential_type.py b/src/workos/common/models/data_integration_credential_type.py index 30d4834c..8c5ff930 100644 --- a/src/workos/common/models/data_integration_credential_type.py +++ b/src/workos/common/models/data_integration_credential_type.py @@ -5,7 +5,6 @@ from __future__ import annotations from enum import Enum -from typing import Optional from typing import Literal, TypeAlias @@ -16,7 +15,7 @@ class DataIntegrationCredentialType(str, Enum): ORGANIZATION = "organization" @classmethod - def _missing_(cls, value: object) -> Optional["DataIntegrationCredentialType"]: + def _missing_(cls, value: object) -> DataIntegrationCredentialType | None: if not isinstance(value, str): return None unknown = str.__new__(cls, value) diff --git a/src/workos/common/models/data_integration_credentials_credentials_type.py b/src/workos/common/models/data_integration_credentials_credentials_type.py index 4a8750aa..65cdecd2 100644 --- a/src/workos/common/models/data_integration_credentials_credentials_type.py +++ b/src/workos/common/models/data_integration_credentials_credentials_type.py @@ -5,7 +5,6 @@ from __future__ import annotations from enum import Enum -from typing import Optional from typing import Literal, TypeAlias @@ -19,7 +18,7 @@ class DataIntegrationCredentialsCredentialsType(str, Enum): @classmethod def _missing_( cls, value: object - ) -> Optional["DataIntegrationCredentialsCredentialsType"]: + ) -> DataIntegrationCredentialsCredentialsType | None: if not isinstance(value, str): return None unknown = str.__new__(cls, value) diff --git a/src/workos/common/models/data_integration_credentials_response_error.py b/src/workos/common/models/data_integration_credentials_response_error.py index ba4291f9..3fca91ef 100644 --- a/src/workos/common/models/data_integration_credentials_response_error.py +++ b/src/workos/common/models/data_integration_credentials_response_error.py @@ -1,6 +1,7 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias + from .data_integration_access_token_response_error import ( DataIntegrationAccessTokenResponseError, ) diff --git a/src/workos/common/models/data_integration_custom_provider_authenticate_via.py b/src/workos/common/models/data_integration_custom_provider_authenticate_via.py index bb8289a2..17b7634a 100644 --- a/src/workos/common/models/data_integration_custom_provider_authenticate_via.py +++ b/src/workos/common/models/data_integration_custom_provider_authenticate_via.py @@ -1,6 +1,7 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias + from .custom_provider_definition_authenticate_via import ( CustomProviderDefinitionAuthenticateVia, ) diff --git a/src/workos/common/models/data_integration_state.py b/src/workos/common/models/data_integration_state.py index ffdd7bf4..61135211 100644 --- a/src/workos/common/models/data_integration_state.py +++ b/src/workos/common/models/data_integration_state.py @@ -5,7 +5,6 @@ from __future__ import annotations from enum import Enum -from typing import Optional from typing import Literal, TypeAlias @@ -17,7 +16,7 @@ class DataIntegrationState(str, Enum): REQUESTED = "requested" @classmethod - def _missing_(cls, value: object) -> Optional["DataIntegrationState"]: + def _missing_(cls, value: object) -> DataIntegrationState | None: if not isinstance(value, str): return None unknown = str.__new__(cls, value) diff --git a/src/workos/common/models/data_integrations_list_response_data_connected_account_auth_method.py b/src/workos/common/models/data_integrations_list_response_data_connected_account_auth_method.py index fc9a8cbd..0df11054 100644 --- a/src/workos/common/models/data_integrations_list_response_data_connected_account_auth_method.py +++ b/src/workos/common/models/data_integrations_list_response_data_connected_account_auth_method.py @@ -1,6 +1,7 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias + from .connected_account_auth_method import ConnectedAccountAuthMethod DataIntegrationsListResponseDataConnectedAccountAuthMethod: TypeAlias = ( diff --git a/src/workos/common/models/data_integrations_list_response_data_ownership.py b/src/workos/common/models/data_integrations_list_response_data_ownership.py index 6ea847d9..58b827bd 100644 --- a/src/workos/common/models/data_integrations_list_response_data_ownership.py +++ b/src/workos/common/models/data_integrations_list_response_data_ownership.py @@ -5,7 +5,6 @@ from __future__ import annotations from enum import Enum -from typing import Optional from typing import Literal, TypeAlias @@ -18,7 +17,7 @@ class DataIntegrationsListResponseDataOwnership(str, Enum): @classmethod def _missing_( cls, value: object - ) -> Optional["DataIntegrationsListResponseDataOwnership"]: + ) -> DataIntegrationsListResponseDataOwnership | None: if not isinstance(value, str): return None unknown = str.__new__(cls, value) diff --git a/src/workos/common/models/pagination_order.py b/src/workos/common/models/pagination_order.py index 29099d54..9c0a5476 100644 --- a/src/workos/common/models/pagination_order.py +++ b/src/workos/common/models/pagination_order.py @@ -5,7 +5,6 @@ from __future__ import annotations from enum import Enum -from typing import Optional from typing import Literal, TypeAlias @@ -17,7 +16,7 @@ class PaginationOrder(str, Enum): ASC = "asc" @classmethod - def _missing_(cls, value: object) -> Optional["PaginationOrder"]: + def _missing_(cls, value: object) -> PaginationOrder | None: if not isinstance(value, str): return None unknown = str.__new__(cls, value) diff --git a/src/workos/common/models/update_custom_provider_definition_authenticate_via.py b/src/workos/common/models/update_custom_provider_definition_authenticate_via.py index 25f88fc8..3066a3d4 100644 --- a/src/workos/common/models/update_custom_provider_definition_authenticate_via.py +++ b/src/workos/common/models/update_custom_provider_definition_authenticate_via.py @@ -1,6 +1,7 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias + from .custom_provider_definition_authenticate_via import ( CustomProviderDefinitionAuthenticateVia, ) diff --git a/src/workos/common/models/user.py b/src/workos/common/models/user.py index e343fda5..e6bc057a 100644 --- a/src/workos/common/models/user.py +++ b/src/workos/common/models/user.py @@ -4,9 +4,9 @@ from dataclasses import dataclass from datetime import datetime -from typing import Any, Dict, Literal, Optional -from workos._types import _raise_deserialize_error -from workos._types import _format_datetime, _parse_datetime +from typing import Any, Literal + +from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error @dataclass(slots=True) @@ -17,33 +17,33 @@ class User: """Distinguishes the user object.""" id: str """The unique ID of the user.""" - first_name: Optional[str] + first_name: str | None """The first name of the user.""" - last_name: Optional[str] + last_name: str | None """The last name of the user.""" - profile_picture_url: Optional[str] + profile_picture_url: str | None """A URL reference to an image representing the user.""" email: str """The email address of the user.""" email_verified: bool """Whether the user's email has been verified.""" - external_id: Optional[str] + external_id: str | None """The external ID of the user.""" - last_sign_in_at: Optional[datetime] + last_sign_in_at: datetime | None """The timestamp when the user last signed in.""" created_at: datetime """An ISO 8601 timestamp.""" updated_at: datetime """An ISO 8601 timestamp.""" - name: Optional[str] = None + name: str | None = None """The user's full name.""" - metadata: Optional[Dict[str, str]] = None + metadata: dict[str, str] | None = None """Object containing metadata key/value pairs associated with the user.""" - locale: Optional[str] = None + locale: str | None = None """The user's preferred locale.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "User": + def from_dict(cls, data: dict[str, Any]) -> User: """Deserialize from a dictionary.""" try: return cls( @@ -67,9 +67,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "User": except (KeyError, ValueError) as e: _raise_deserialize_error("User", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["object"] = self.object result["id"] = self.id if self.first_name is not None: diff --git a/src/workos/common/models/user_identities_get_item_provider.py b/src/workos/common/models/user_identities_get_item_provider.py index 39b088e1..7c38a9ff 100644 --- a/src/workos/common/models/user_identities_get_item_provider.py +++ b/src/workos/common/models/user_identities_get_item_provider.py @@ -5,7 +5,6 @@ from __future__ import annotations from enum import Enum -from typing import Optional from typing import Literal, TypeAlias @@ -28,7 +27,7 @@ class UserIdentitiesGetItemProvider(str, Enum): XERO_OAUTH = "XeroOAuth" @classmethod - def _missing_(cls, value: object) -> Optional["UserIdentitiesGetItemProvider"]: + def _missing_(cls, value: object) -> UserIdentitiesGetItemProvider | None: if not isinstance(value, str): return None unknown = str.__new__(cls, value) diff --git a/src/workos/common/models/user_sessions_list_item.py b/src/workos/common/models/user_sessions_list_item.py index c9d90f6a..c4d79a8c 100644 --- a/src/workos/common/models/user_sessions_list_item.py +++ b/src/workos/common/models/user_sessions_list_item.py @@ -5,13 +5,12 @@ from dataclasses import dataclass from datetime import datetime from enum import Enum -from typing import cast -from typing import Any, Dict, Literal, Optional -from workos._types import _raise_deserialize_error -from workos._types import _format_datetime, _parse_datetime +from typing import Any, Literal, cast + +from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error -from .user_sessions_impersonator import UserSessionsImpersonator from .user_sessions_auth_method import UserSessionsAuthMethod +from .user_sessions_impersonator import UserSessionsImpersonator from .user_sessions_status import UserSessionsStatus @@ -23,31 +22,31 @@ class UserSessionsListItem: """Distinguishes the session object.""" id: str """The unique ID of the session.""" - ip_address: Optional[str] + ip_address: str | None """The IP address from which the session was created.""" - user_agent: Optional[str] + user_agent: str | None """The user agent string from the device that created the session.""" user_id: str """The ID of the user this session belongs to.""" - auth_method: "UserSessionsAuthMethod" + auth_method: UserSessionsAuthMethod """The authentication method used to create this session.""" - status: "UserSessionsStatus" + status: UserSessionsStatus """The current status of the session.""" expires_at: datetime """The timestamp when the session expires.""" - ended_at: Optional[datetime] + ended_at: datetime | None """The timestamp when the session ended.""" created_at: datetime """An ISO 8601 timestamp.""" updated_at: datetime """An ISO 8601 timestamp.""" - impersonator: Optional["UserSessionsImpersonator"] = None + impersonator: UserSessionsImpersonator | None = None """Information about the impersonator if this session was created via impersonation.""" - organization_id: Optional[str] = None + organization_id: str | None = None """The ID of the organization this session is associated with.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "UserSessionsListItem": + def from_dict(cls, data: dict[str, Any]) -> UserSessionsListItem: """Deserialize from a dictionary.""" try: return cls( @@ -65,7 +64,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "UserSessionsListItem": created_at=_parse_datetime(data["created_at"]), updated_at=_parse_datetime(data["updated_at"]), impersonator=UserSessionsImpersonator.from_dict( - cast(Dict[str, Any], _v_impersonator) + cast(dict[str, Any], _v_impersonator) ) if (_v_impersonator := data.get("impersonator")) is not None else None, @@ -74,9 +73,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "UserSessionsListItem": except (KeyError, ValueError) as e: _raise_deserialize_error("UserSessionsListItem", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["object"] = self.object result["id"] = self.id if self.ip_address is not None: diff --git a/src/workos/connect/models/__init__.py b/src/workos/connect/models/__init__.py index 7aa852b4..03c0a0cb 100644 --- a/src/workos/connect/models/__init__.py +++ b/src/workos/connect/models/__init__.py @@ -1,11 +1,5 @@ # This file is auto-generated by oagen. Do not edit. -from .application_credentials_list_item import ( - ApplicationCredentialsListItem as ApplicationCredentialsListItem, -) -from .applications_registration_types import ( - ApplicationsRegistrationTypes as ApplicationsRegistrationTypes, -) from workos.common.models.connect_application import ( ConnectApplication as ConnectApplication, ) @@ -15,6 +9,13 @@ from workos.common.models.connect_application import ( ConnectApplicationVariant as ConnectApplicationVariant, ) + +from .application_credentials_list_item import ( + ApplicationCredentialsListItem as ApplicationCredentialsListItem, +) +from .applications_registration_types import ( + ApplicationsRegistrationTypes as ApplicationsRegistrationTypes, +) from .create_application_secret import ( CreateApplicationSecret as CreateApplicationSecret, ) diff --git a/src/workos/directory_sync/__init__.py b/src/workos/directory_sync/__init__.py index 1592ca1c..f11ab82d 100644 --- a/src/workos/directory_sync/__init__.py +++ b/src/workos/directory_sync/__init__.py @@ -1,7 +1,5 @@ # This file is auto-generated by oagen. Do not edit. -from ._resource import ( - DirectorySync as DirectorySync, - AsyncDirectorySync as AsyncDirectorySync, -) +from ._resource import AsyncDirectorySync as AsyncDirectorySync +from ._resource import DirectorySync as DirectorySync from .models import * diff --git a/src/workos/directory_sync/models/__init__.py b/src/workos/directory_sync/models/__init__.py index 3677f9a9..f315d1b1 100644 --- a/src/workos/directory_sync/models/__init__.py +++ b/src/workos/directory_sync/models/__init__.py @@ -1,7 +1,8 @@ # This file is auto-generated by oagen. Do not edit. -from .directory import Directory as Directory from workos.common.models.directory_group import DirectoryGroup as DirectoryGroup + +from .directory import Directory as Directory from .directory_metadata import DirectoryMetadata as DirectoryMetadata from .directory_metadata_user import DirectoryMetadataUser as DirectoryMetadataUser from .directory_user_with_groups import ( diff --git a/src/workos/feature_flags/__init__.py b/src/workos/feature_flags/__init__.py index cf8610a0..c9ad35b8 100644 --- a/src/workos/feature_flags/__init__.py +++ b/src/workos/feature_flags/__init__.py @@ -1,7 +1,5 @@ # This file is auto-generated by oagen. Do not edit. -from ._resource import ( - FeatureFlags as FeatureFlags, - AsyncFeatureFlags as AsyncFeatureFlags, -) +from ._resource import AsyncFeatureFlags as AsyncFeatureFlags +from ._resource import FeatureFlags as FeatureFlags from .models import * diff --git a/src/workos/groups/models/__init__.py b/src/workos/groups/models/__init__.py index 170c69e7..3d75d17a 100644 --- a/src/workos/groups/models/__init__.py +++ b/src/workos/groups/models/__init__.py @@ -1,9 +1,10 @@ # This file is auto-generated by oagen. Do not edit. -from .create_group import CreateGroup as CreateGroup -from .create_group_membership import CreateGroupMembership as CreateGroupMembership from workos.common.models.group import Group as Group -from .update_group import UpdateGroup as UpdateGroup from workos.common.models.user_organization_membership_base_list_data import ( UserOrganizationMembershipBaseListData as UserOrganizationMembershipBaseListData, ) + +from .create_group import CreateGroup as CreateGroup +from .create_group_membership import CreateGroupMembership as CreateGroupMembership +from .update_group import UpdateGroup as UpdateGroup diff --git a/src/workos/multi_factor_auth/__init__.py b/src/workos/multi_factor_auth/__init__.py index ed36881b..64775249 100644 --- a/src/workos/multi_factor_auth/__init__.py +++ b/src/workos/multi_factor_auth/__init__.py @@ -1,7 +1,5 @@ # This file is auto-generated by oagen. Do not edit. -from ._resource import ( - MultiFactorAuth as MultiFactorAuth, - AsyncMultiFactorAuth as AsyncMultiFactorAuth, -) +from ._resource import AsyncMultiFactorAuth as AsyncMultiFactorAuth +from ._resource import MultiFactorAuth as MultiFactorAuth from .models import * diff --git a/src/workos/multi_factor_auth/models/__init__.py b/src/workos/multi_factor_auth/models/__init__.py index a6d1f9bf..5e101bac 100644 --- a/src/workos/multi_factor_auth/models/__init__.py +++ b/src/workos/multi_factor_auth/models/__init__.py @@ -3,12 +3,6 @@ from workos.common.models.authentication_challenge import ( AuthenticationChallenge as AuthenticationChallenge, ) -from .authentication_challenges_verify_request import ( - AuthenticationChallengesVerifyRequest as AuthenticationChallengesVerifyRequest, -) -from .authentication_challenge_verify_response import ( - AuthenticationChallengeVerifyResponse as AuthenticationChallengeVerifyResponse, -) from workos.common.models.authentication_factor import ( AuthenticationFactor as AuthenticationFactor, ) @@ -21,15 +15,22 @@ from workos.common.models.authentication_factor_enrolled_totp import ( AuthenticationFactorEnrolledTotp as AuthenticationFactorEnrolledTotp, ) -from .authentication_factors_create_request import ( - AuthenticationFactorsCreateRequest as AuthenticationFactorsCreateRequest, -) from workos.common.models.authentication_factor_sms import ( AuthenticationFactorSms as AuthenticationFactorSms, ) from workos.common.models.authentication_factor_totp import ( AuthenticationFactorTotp as AuthenticationFactorTotp, ) + +from .authentication_challenge_verify_response import ( + AuthenticationChallengeVerifyResponse as AuthenticationChallengeVerifyResponse, +) +from .authentication_challenges_verify_request import ( + AuthenticationChallengesVerifyRequest as AuthenticationChallengesVerifyRequest, +) +from .authentication_factors_create_request import ( + AuthenticationFactorsCreateRequest as AuthenticationFactorsCreateRequest, +) from .challenge_authentication_factor import ( ChallengeAuthenticationFactor as ChallengeAuthenticationFactor, ) diff --git a/src/workos/organization_domains/__init__.py b/src/workos/organization_domains/__init__.py index 700ff607..d586b2cf 100644 --- a/src/workos/organization_domains/__init__.py +++ b/src/workos/organization_domains/__init__.py @@ -1,7 +1,5 @@ # This file is auto-generated by oagen. Do not edit. -from ._resource import ( - OrganizationDomains as OrganizationDomains, - AsyncOrganizationDomains as AsyncOrganizationDomains, -) +from ._resource import AsyncOrganizationDomains as AsyncOrganizationDomains +from ._resource import OrganizationDomains as OrganizationDomains from .models import * diff --git a/src/workos/organization_domains/models/__init__.py b/src/workos/organization_domains/models/__init__.py index 29011846..fa410ee8 100644 --- a/src/workos/organization_domains/models/__init__.py +++ b/src/workos/organization_domains/models/__init__.py @@ -1,8 +1,9 @@ # This file is auto-generated by oagen. Do not edit. -from .create_organization_domain import ( - CreateOrganizationDomain as CreateOrganizationDomain, -) from workos.common.models.organization_domain import ( OrganizationDomain as OrganizationDomain, ) + +from .create_organization_domain import ( + CreateOrganizationDomain as CreateOrganizationDomain, +) diff --git a/src/workos/organization_membership/__init__.py b/src/workos/organization_membership/__init__.py index 92ec1ac9..3d3aa163 100644 --- a/src/workos/organization_membership/__init__.py +++ b/src/workos/organization_membership/__init__.py @@ -1,9 +1,9 @@ # This file is auto-generated by oagen. Do not edit. from ._resource import ( - OrganizationMembershipService as OrganizationMembershipService, AsyncOrganizationMembershipService as AsyncOrganizationMembershipService, - RoleSingle as RoleSingle, - RoleMultiple as RoleMultiple, ) +from ._resource import OrganizationMembershipService as OrganizationMembershipService +from ._resource import RoleMultiple as RoleMultiple +from ._resource import RoleSingle as RoleSingle from .models import * diff --git a/src/workos/organizations/__init__.py b/src/workos/organizations/__init__.py index 72b20a3c..956a0b5a 100644 --- a/src/workos/organizations/__init__.py +++ b/src/workos/organizations/__init__.py @@ -1,7 +1,5 @@ # This file is auto-generated by oagen. Do not edit. -from ._resource import ( - Organizations as Organizations, - AsyncOrganizations as AsyncOrganizations, -) +from ._resource import AsyncOrganizations as AsyncOrganizations +from ._resource import Organizations as Organizations from .models import * diff --git a/src/workos/pipes/_resource.py b/src/workos/pipes/_resource.py index 49733025..c5e69434 100644 --- a/src/workos/pipes/_resource.py +++ b/src/workos/pipes/_resource.py @@ -2,12 +2,22 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union +from typing import TYPE_CHECKING, Any if TYPE_CHECKING: from .._client import AsyncWorkOSClient, WorkOSClient -from .._types import RequestOptions, enum_value, NOT_GIVEN, NotGiven +from workos.common.models.connected_account import ConnectedAccount +from workos.common.models.connected_account_input_state import ( + ConnectedAccountInputState, +) +from workos.common.models.create_data_integration_auth_methods import ( + CreateDataIntegrationAuthMethods, +) +from workos.common.models.pagination_order import PaginationOrder + +from .._pagination import AsyncPage, SyncPage +from .._types import NOT_GIVEN, NotGiven, RequestOptions, enum_value from .models import ( ApiKeyInstallation, CustomProviderDefinition, @@ -19,31 +29,22 @@ DataIntegrationsListResponse, UpdateCustomProviderDefinition, ) -from workos.common.models.connected_account import ConnectedAccount -from workos.common.models.connected_account_input_state import ( - ConnectedAccountInputState, -) -from workos.common.models.create_data_integration_auth_methods import ( - CreateDataIntegrationAuthMethods, -) -from workos.common.models.pagination_order import PaginationOrder -from .._pagination import AsyncPage, SyncPage class Pipes: """Pipes API resources.""" - def __init__(self, client: "WorkOSClient") -> None: + def __init__(self, client: WorkOSClient) -> None: self._client = client def list_data_integrations( self, *, - limit: Optional[int] = None, - before: Optional[str] = None, - after: Optional[str] = None, - order: Optional[Union[PaginationOrder, str]] = "desc", - request_options: Optional[RequestOptions] = None, + limit: int | None = None, + before: str | None = None, + after: str | None = None, + order: PaginationOrder | str | None = "desc", + request_options: RequestOptions | None = None, ) -> SyncPage[DataIntegration]: """List data integrations @@ -86,16 +87,15 @@ def create_data_integration( self, *, provider: str, - description: Union[str, None, NotGiven] = NOT_GIVEN, - enabled: Optional[bool] = None, - scopes: Union[List[str], None, NotGiven] = NOT_GIVEN, - auth_methods: Optional[ - List[Union[CreateDataIntegrationAuthMethods, str]] - ] = None, - credentials: Optional[DataIntegrationCredentialsInput] = None, - api_key: Optional[ApiKeyInstallation] = None, - custom_provider: Optional[CustomProviderDefinition] = None, - request_options: Optional[RequestOptions] = None, + description: str | None | NotGiven = NOT_GIVEN, + enabled: bool | None = None, + scopes: list[str] | None | NotGiven = NOT_GIVEN, + auth_methods: list[CreateDataIntegrationAuthMethods | str] | None = None, + config: dict[str, str] | None = None, + credentials: DataIntegrationCredentialsInput | None = None, + api_key: ApiKeyInstallation | None = None, + custom_provider: CustomProviderDefinition | None = None, + request_options: RequestOptions | None = None, ) -> DataIntegration: """Create a data integration @@ -107,6 +107,7 @@ def create_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). + config: Provider-specific config values (e.g. a Snowflake `account_identifier`), 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"]`. 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. @@ -125,12 +126,13 @@ def create_data_integration( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { k: v for k, v in { "provider": provider, "enabled": enabled, "auth_methods": auth_methods, + "config": config, "credentials": credentials.to_dict() if credentials is not None else None, @@ -157,7 +159,7 @@ def get_data_integration( self, slug: str, *, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> DataIntegration: """Get a data integration @@ -187,13 +189,13 @@ def update_data_integration( self, slug: str, *, - description: Union[str, None, NotGiven] = NOT_GIVEN, - enabled: Optional[bool] = None, - scopes: Union[List[str], None, NotGiven] = NOT_GIVEN, - credentials: Optional[DataIntegrationCredentialsInput] = None, - api_key: Optional[ApiKeyInstallation] = None, - custom_provider: Optional[UpdateCustomProviderDefinition] = None, - request_options: Optional[RequestOptions] = None, + description: str | None | NotGiven = NOT_GIVEN, + enabled: bool | None = None, + scopes: list[str] | None | NotGiven = NOT_GIVEN, + credentials: DataIntegrationCredentialsInput | None = None, + api_key: ApiKeyInstallation | None = None, + custom_provider: UpdateCustomProviderDefinition | None = None, + request_options: RequestOptions | None = None, ) -> DataIntegration: """Update a data integration @@ -221,7 +223,7 @@ def update_data_integration( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { k: v for k, v in { "enabled": enabled, @@ -251,7 +253,7 @@ def delete_data_integration( self, slug: str, *, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> None: """Delete a data integration @@ -279,8 +281,8 @@ def update_data_integration_api_key( *, user_id: str, secret: str, - organization_id: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + organization_id: str | None = None, + request_options: RequestOptions | None = None, ) -> ConnectedAccount: """Upsert an API key for a connected account @@ -305,7 +307,7 @@ def update_data_integration_api_key( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { k: v for k, v in { "user_id": user_id, @@ -327,9 +329,10 @@ def authorize_data_integration( slug: str, *, user_id: str, - organization_id: Optional[str] = None, - return_to: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + organization_id: str | None = None, + return_to: str | None = None, + config: dict[str, str] | None = None, + request_options: RequestOptions | None = None, ) -> DataIntegrationAuthorizeUrlResponse: """Get authorization URL @@ -340,6 +343,7 @@ def authorize_data_integration( user_id: The ID of the user to authorize. organization_id: An organization ID to scope the authorization to a specific organization. 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. Returns: @@ -353,12 +357,13 @@ def authorize_data_integration( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { k: v for k, v in { "user_id": user_id, "organization_id": organization_id, "return_to": return_to, + "config": config, }.items() if v is not None } @@ -375,8 +380,8 @@ def create_data_integration_credential( slug: str, *, user_id: str, - organization_id: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + organization_id: str | None = None, + request_options: RequestOptions | None = None, ) -> DataIntegrationCredentialsResponse: """Vend credentials for a connected account @@ -398,7 +403,7 @@ def create_data_integration_credential( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { k: v for k, v in { "user_id": user_id, @@ -419,8 +424,8 @@ def get_access_token( provider: str, *, user_id: str, - organization_id: Union[str, None, NotGiven] = NOT_GIVEN, - request_options: Optional[RequestOptions] = None, + organization_id: str | None | NotGiven = NOT_GIVEN, + request_options: RequestOptions | None = None, ) -> DataIntegrationAccessTokenResponse: """Get an access token for a connected account @@ -443,7 +448,7 @@ def get_access_token( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { "user_id": user_id, } if not isinstance(organization_id, NotGiven): @@ -461,8 +466,8 @@ def get_user_connected_account( user_id: str, slug: str, *, - organization_id: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + organization_id: str | None = None, + request_options: RequestOptions | None = None, ) -> ConnectedAccount: """Get a connected account @@ -483,7 +488,7 @@ def get_user_connected_account( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params: Dict[str, Any] = { + params: dict[str, Any] = { k: v for k, v in { "organization_id": organization_id, @@ -509,13 +514,13 @@ def create_user_connected_account( user_id: str, slug: str, *, - access_token: Optional[str] = None, - refresh_token: Optional[str] = None, - expires_at: Optional[str] = None, - scopes: Optional[List[str]] = None, - state: Optional[Union[ConnectedAccountInputState, str]] = None, - organization_id: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + 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, + organization_id: str | None = None, + request_options: RequestOptions | None = None, ) -> ConnectedAccount: """Import a connected account @@ -543,7 +548,7 @@ def create_user_connected_account( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { k: v for k, v in { "access_token": access_token, @@ -554,7 +559,7 @@ def create_user_connected_account( }.items() if v is not None } - params: Dict[str, Any] = { + params: dict[str, Any] = { k: v for k, v in { "organization_id": organization_id, @@ -581,13 +586,13 @@ def update_user_connected_account( user_id: str, slug: str, *, - access_token: Optional[str] = None, - refresh_token: Optional[str] = None, - expires_at: Optional[str] = None, - scopes: Optional[List[str]] = None, - state: Optional[Union[ConnectedAccountInputState, str]] = None, - organization_id: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + 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, + organization_id: str | None = None, + request_options: RequestOptions | None = None, ) -> ConnectedAccount: """Update a connected account @@ -613,7 +618,7 @@ def update_user_connected_account( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { k: v for k, v in { "access_token": access_token, @@ -624,7 +629,7 @@ def update_user_connected_account( }.items() if v is not None } - params: Dict[str, Any] = { + params: dict[str, Any] = { k: v for k, v in { "organization_id": organization_id, @@ -651,8 +656,8 @@ def delete_user_connected_account( user_id: str, slug: str, *, - organization_id: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + organization_id: str | None = None, + request_options: RequestOptions | None = None, ) -> None: """Delete a connected account @@ -670,7 +675,7 @@ def delete_user_connected_account( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params: Dict[str, Any] = { + params: dict[str, Any] = { k: v for k, v in { "organization_id": organization_id, @@ -694,8 +699,8 @@ def list_user_data_providers( self, user_id: str, *, - organization_id: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + organization_id: str | None = None, + request_options: RequestOptions | None = None, ) -> DataIntegrationsListResponse: """List providers for a user @@ -715,7 +720,7 @@ def list_user_data_providers( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params: Dict[str, Any] = { + params: dict[str, Any] = { k: v for k, v in { "organization_id": organization_id, @@ -734,17 +739,17 @@ def list_user_data_providers( class AsyncPipes: """Pipes API resources (async).""" - def __init__(self, client: "AsyncWorkOSClient") -> None: + def __init__(self, client: AsyncWorkOSClient) -> None: self._client = client async def list_data_integrations( self, *, - limit: Optional[int] = None, - before: Optional[str] = None, - after: Optional[str] = None, - order: Optional[Union[PaginationOrder, str]] = "desc", - request_options: Optional[RequestOptions] = None, + limit: int | None = None, + before: str | None = None, + after: str | None = None, + order: PaginationOrder | str | None = "desc", + request_options: RequestOptions | None = None, ) -> AsyncPage[DataIntegration]: """List data integrations @@ -787,16 +792,15 @@ async def create_data_integration( self, *, provider: str, - description: Union[str, None, NotGiven] = NOT_GIVEN, - enabled: Optional[bool] = None, - scopes: Union[List[str], None, NotGiven] = NOT_GIVEN, - auth_methods: Optional[ - List[Union[CreateDataIntegrationAuthMethods, str]] - ] = None, - credentials: Optional[DataIntegrationCredentialsInput] = None, - api_key: Optional[ApiKeyInstallation] = None, - custom_provider: Optional[CustomProviderDefinition] = None, - request_options: Optional[RequestOptions] = None, + description: str | None | NotGiven = NOT_GIVEN, + enabled: bool | None = None, + scopes: list[str] | None | NotGiven = NOT_GIVEN, + auth_methods: list[CreateDataIntegrationAuthMethods | str] | None = None, + config: dict[str, str] | None = None, + credentials: DataIntegrationCredentialsInput | None = None, + api_key: ApiKeyInstallation | None = None, + custom_provider: CustomProviderDefinition | None = None, + request_options: RequestOptions | None = None, ) -> DataIntegration: """Create a data integration @@ -808,6 +812,7 @@ async def create_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). + config: Provider-specific config values (e.g. a Snowflake `account_identifier`), 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"]`. 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. @@ -826,12 +831,13 @@ async def create_data_integration( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { k: v for k, v in { "provider": provider, "enabled": enabled, "auth_methods": auth_methods, + "config": config, "credentials": credentials.to_dict() if credentials is not None else None, @@ -858,7 +864,7 @@ async def get_data_integration( self, slug: str, *, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> DataIntegration: """Get a data integration @@ -888,13 +894,13 @@ async def update_data_integration( self, slug: str, *, - description: Union[str, None, NotGiven] = NOT_GIVEN, - enabled: Optional[bool] = None, - scopes: Union[List[str], None, NotGiven] = NOT_GIVEN, - credentials: Optional[DataIntegrationCredentialsInput] = None, - api_key: Optional[ApiKeyInstallation] = None, - custom_provider: Optional[UpdateCustomProviderDefinition] = None, - request_options: Optional[RequestOptions] = None, + description: str | None | NotGiven = NOT_GIVEN, + enabled: bool | None = None, + scopes: list[str] | None | NotGiven = NOT_GIVEN, + credentials: DataIntegrationCredentialsInput | None = None, + api_key: ApiKeyInstallation | None = None, + custom_provider: UpdateCustomProviderDefinition | None = None, + request_options: RequestOptions | None = None, ) -> DataIntegration: """Update a data integration @@ -922,7 +928,7 @@ async def update_data_integration( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { k: v for k, v in { "enabled": enabled, @@ -952,7 +958,7 @@ async def delete_data_integration( self, slug: str, *, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> None: """Delete a data integration @@ -980,8 +986,8 @@ async def update_data_integration_api_key( *, user_id: str, secret: str, - organization_id: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + organization_id: str | None = None, + request_options: RequestOptions | None = None, ) -> ConnectedAccount: """Upsert an API key for a connected account @@ -1006,7 +1012,7 @@ async def update_data_integration_api_key( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { k: v for k, v in { "user_id": user_id, @@ -1028,9 +1034,10 @@ async def authorize_data_integration( slug: str, *, user_id: str, - organization_id: Optional[str] = None, - return_to: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + organization_id: str | None = None, + return_to: str | None = None, + config: dict[str, str] | None = None, + request_options: RequestOptions | None = None, ) -> DataIntegrationAuthorizeUrlResponse: """Get authorization URL @@ -1041,6 +1048,7 @@ async def authorize_data_integration( user_id: The ID of the user to authorize. organization_id: An organization ID to scope the authorization to a specific organization. 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. Returns: @@ -1054,12 +1062,13 @@ async def authorize_data_integration( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { k: v for k, v in { "user_id": user_id, "organization_id": organization_id, "return_to": return_to, + "config": config, }.items() if v is not None } @@ -1076,8 +1085,8 @@ async def create_data_integration_credential( slug: str, *, user_id: str, - organization_id: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + organization_id: str | None = None, + request_options: RequestOptions | None = None, ) -> DataIntegrationCredentialsResponse: """Vend credentials for a connected account @@ -1099,7 +1108,7 @@ async def create_data_integration_credential( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { k: v for k, v in { "user_id": user_id, @@ -1120,8 +1129,8 @@ async def get_access_token( provider: str, *, user_id: str, - organization_id: Union[str, None, NotGiven] = NOT_GIVEN, - request_options: Optional[RequestOptions] = None, + organization_id: str | None | NotGiven = NOT_GIVEN, + request_options: RequestOptions | None = None, ) -> DataIntegrationAccessTokenResponse: """Get an access token for a connected account @@ -1144,7 +1153,7 @@ async def get_access_token( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { "user_id": user_id, } if not isinstance(organization_id, NotGiven): @@ -1162,8 +1171,8 @@ async def get_user_connected_account( user_id: str, slug: str, *, - organization_id: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + organization_id: str | None = None, + request_options: RequestOptions | None = None, ) -> ConnectedAccount: """Get a connected account @@ -1184,7 +1193,7 @@ async def get_user_connected_account( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params: Dict[str, Any] = { + params: dict[str, Any] = { k: v for k, v in { "organization_id": organization_id, @@ -1210,13 +1219,13 @@ async def create_user_connected_account( user_id: str, slug: str, *, - access_token: Optional[str] = None, - refresh_token: Optional[str] = None, - expires_at: Optional[str] = None, - scopes: Optional[List[str]] = None, - state: Optional[Union[ConnectedAccountInputState, str]] = None, - organization_id: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + 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, + organization_id: str | None = None, + request_options: RequestOptions | None = None, ) -> ConnectedAccount: """Import a connected account @@ -1244,7 +1253,7 @@ async def create_user_connected_account( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { k: v for k, v in { "access_token": access_token, @@ -1255,7 +1264,7 @@ async def create_user_connected_account( }.items() if v is not None } - params: Dict[str, Any] = { + params: dict[str, Any] = { k: v for k, v in { "organization_id": organization_id, @@ -1282,13 +1291,13 @@ async def update_user_connected_account( user_id: str, slug: str, *, - access_token: Optional[str] = None, - refresh_token: Optional[str] = None, - expires_at: Optional[str] = None, - scopes: Optional[List[str]] = None, - state: Optional[Union[ConnectedAccountInputState, str]] = None, - organization_id: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + 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, + organization_id: str | None = None, + request_options: RequestOptions | None = None, ) -> ConnectedAccount: """Update a connected account @@ -1314,7 +1323,7 @@ async def update_user_connected_account( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { k: v for k, v in { "access_token": access_token, @@ -1325,7 +1334,7 @@ async def update_user_connected_account( }.items() if v is not None } - params: Dict[str, Any] = { + params: dict[str, Any] = { k: v for k, v in { "organization_id": organization_id, @@ -1352,8 +1361,8 @@ async def delete_user_connected_account( user_id: str, slug: str, *, - organization_id: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + organization_id: str | None = None, + request_options: RequestOptions | None = None, ) -> None: """Delete a connected account @@ -1371,7 +1380,7 @@ async def delete_user_connected_account( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params: Dict[str, Any] = { + params: dict[str, Any] = { k: v for k, v in { "organization_id": organization_id, @@ -1395,8 +1404,8 @@ async def list_user_data_providers( self, user_id: str, *, - organization_id: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + organization_id: str | None = None, + request_options: RequestOptions | None = None, ) -> DataIntegrationsListResponse: """List providers for a user @@ -1416,7 +1425,7 @@ async def list_user_data_providers( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params: Dict[str, Any] = { + params: dict[str, Any] = { k: v for k, v in { "organization_id": organization_id, diff --git a/src/workos/pipes/models/__init__.py b/src/workos/pipes/models/__init__.py index 340aba26..03383068 100644 --- a/src/workos/pipes/models/__init__.py +++ b/src/workos/pipes/models/__init__.py @@ -1,7 +1,8 @@ # This file is auto-generated by oagen. Do not edit. -from .api_key_installation import ApiKeyInstallation as ApiKeyInstallation 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 .create_data_integration import CreateDataIntegration as CreateDataIntegration from .custom_provider_definition import ( diff --git a/src/workos/pipes/models/api_key_installation.py b/src/workos/pipes/models/api_key_installation.py index 05b9c32e..65219f4f 100644 --- a/src/workos/pipes/models/api_key_installation.py +++ b/src/workos/pipes/models/api_key_installation.py @@ -1,6 +1,7 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias + from .data_integrations_upsert_api_key_request import ( DataIntegrationsUpsertApiKeyRequest, ) diff --git a/src/workos/pipes/models/connected_account_input.py b/src/workos/pipes/models/connected_account_input.py index b33d8239..2bd2eb1d 100644 --- a/src/workos/pipes/models/connected_account_input.py +++ b/src/workos/pipes/models/connected_account_input.py @@ -5,9 +5,9 @@ from dataclasses import dataclass from datetime import datetime from enum import Enum -from typing import Any, Dict, List, Optional -from workos._types import _raise_deserialize_error -from workos._types import _format_datetime, _parse_datetime +from typing import Any + +from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error from workos.common.models.connected_account_input_state import ( ConnectedAccountInputState, ) @@ -17,19 +17,19 @@ class ConnectedAccountInput: """Connected Account Input model.""" - access_token: Optional[str] = None + access_token: str | None = None """The OAuth access token for the connected account.""" - refresh_token: Optional[str] = None + refresh_token: str | None = None """The OAuth refresh token for the connected account.""" - expires_at: Optional[datetime] = None + 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: Optional[List[str]] = None + scopes: list[str] | None = None """The OAuth scopes granted for this connection.""" - state: Optional["ConnectedAccountInputState"] = None + 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": + def from_dict(cls, data: dict[str, Any]) -> ConnectedAccountInput: """Deserialize from a dictionary.""" try: return cls( @@ -46,9 +46,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "ConnectedAccountInput": except (KeyError, ValueError) as e: _raise_deserialize_error("ConnectedAccountInput", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} if self.access_token is not None: result["access_token"] = self.access_token if self.refresh_token is not None: diff --git a/src/workos/pipes/models/create_data_integration.py b/src/workos/pipes/models/create_data_integration.py index 5c3736d4..5ab67ac0 100644 --- a/src/workos/pipes/models/create_data_integration.py +++ b/src/workos/pipes/models/create_data_integration.py @@ -4,16 +4,16 @@ from dataclasses import dataclass from enum import Enum -from typing import cast -from typing import Any, Dict, List, Optional +from typing import Any, cast + from workos._types import _raise_deserialize_error +from workos.common.models.create_data_integration_auth_methods import ( + CreateDataIntegrationAuthMethods, +) from .api_key_installation import ApiKeyInstallation from .custom_provider_definition import CustomProviderDefinition from .data_integration_credentials_input import DataIntegrationCredentialsInput -from workos.common.models.create_data_integration_auth_methods import ( - CreateDataIntegrationAuthMethods, -) @dataclass(slots=True) @@ -22,23 +22,25 @@ class CreateDataIntegration: provider: str """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.""" - description: Optional[str] = None + description: str | None = None """An optional description of the Data Integration.""" - enabled: Optional[bool] = None + enabled: bool | None = None """Whether the Data Integration is enabled. Defaults to `false`.""" - scopes: Optional[List[str]] = None + 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: Optional[List["CreateDataIntegrationAuthMethods"]] = None + 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).""" - credentials: Optional["DataIntegrationCredentialsInput"] = None + config: dict[str, str] | None = None + """Provider-specific config values (e.g. a Snowflake `account_identifier`), 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"]`.""" - api_key: Optional["ApiKeyInstallation"] = None + 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: Optional["CustomProviderDefinition"] = None + custom_provider: CustomProviderDefinition | None = None """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.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "CreateDataIntegration": + def from_dict(cls, data: dict[str, Any]) -> CreateDataIntegration: """Deserialize from a dictionary.""" try: return cls( @@ -52,16 +54,17 @@ def from_dict(cls, data: Dict[str, Any]) -> "CreateDataIntegration": ] if (_v_auth_methods := data.get("auth_methods")) is not None else None, + config=data.get("config"), credentials=DataIntegrationCredentialsInput.from_dict( - cast(Dict[str, Any], _v_credentials) + cast(dict[str, Any], _v_credentials) ) if (_v_credentials := data.get("credentials")) is not None else None, - api_key=ApiKeyInstallation.from_dict(cast(Dict[str, Any], _v_api_key)) + api_key=ApiKeyInstallation.from_dict(cast(dict[str, Any], _v_api_key)) if (_v_api_key := data.get("api_key")) is not None else None, custom_provider=CustomProviderDefinition.from_dict( - cast(Dict[str, Any], _v_custom_provider) + cast(dict[str, Any], _v_custom_provider) ) if (_v_custom_provider := data.get("custom_provider")) is not None else None, @@ -69,9 +72,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "CreateDataIntegration": except (KeyError, ValueError) as e: _raise_deserialize_error("CreateDataIntegration", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["provider"] = self.provider if self.description is not None: result["description"] = self.description @@ -88,6 +91,8 @@ def to_dict(self) -> Dict[str, Any]: item.value if isinstance(item, Enum) else item for item in self.auth_methods ] + if self.config is not None: + result["config"] = self.config if self.credentials is not None: result["credentials"] = self.credentials.to_dict() if self.api_key is not None: diff --git a/src/workos/pipes/models/custom_provider_definition.py b/src/workos/pipes/models/custom_provider_definition.py index 494a71ce..44b246e3 100644 --- a/src/workos/pipes/models/custom_provider_definition.py +++ b/src/workos/pipes/models/custom_provider_definition.py @@ -4,7 +4,8 @@ from dataclasses import dataclass from enum import Enum -from typing import Any, Dict, Optional +from typing import Any + from workos._types import _raise_deserialize_error from workos.common.models.custom_provider_definition_authenticate_via import ( CustomProviderDefinitionAuthenticateVia, @@ -21,25 +22,25 @@ class CustomProviderDefinition: """The provider's OAuth authorization endpoint.""" token_url: str """The provider's OAuth token endpoint.""" - refresh_token_url: Optional[str] = None + refresh_token_url: str | None = None """The endpoint used to refresh tokens, if different from the token endpoint.""" - pkce_enabled: Optional[bool] = None + pkce_enabled: bool | None = None """Whether PKCE is used during the authorization code flow. Defaults to `true`.""" - request_scope_separator: Optional[str] = None + request_scope_separator: str | None = None """The separator used to join requested scopes. Defaults to a space.""" - scopes_required: Optional[bool] = None + scopes_required: bool | None = None """Whether at least one scope must be selected when connecting an account. Defaults to `false`.""" - client_secret_required: Optional[bool] = None + client_secret_required: bool | None = None """Whether a client secret is required for this provider. Defaults to `true`.""" - additional_authorization_parameters: Optional[Dict[str, str]] = None + additional_authorization_parameters: dict[str, str] | None = None """Additional static query parameters appended to the authorization request.""" - token_body_content_type: Optional[str] = None + token_body_content_type: str | None = None """The Content-Type used when exchanging the token request.""" - authenticate_via: Optional["CustomProviderDefinitionAuthenticateVia"] = None + authenticate_via: CustomProviderDefinitionAuthenticateVia | None = None """How client credentials are sent when exchanging authorization codes and refreshing tokens.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "CustomProviderDefinition": + def from_dict(cls, data: dict[str, Any]) -> CustomProviderDefinition: """Deserialize from a dictionary.""" try: return cls( @@ -64,9 +65,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "CustomProviderDefinition": except (KeyError, ValueError) as e: _raise_deserialize_error("CustomProviderDefinition", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["name"] = self.name result["authorization_url"] = self.authorization_url result["token_url"] = self.token_url diff --git a/src/workos/pipes/models/data_integration.py b/src/workos/pipes/models/data_integration.py index 7f4514f4..49e607de 100644 --- a/src/workos/pipes/models/data_integration.py +++ b/src/workos/pipes/models/data_integration.py @@ -5,19 +5,18 @@ from dataclasses import dataclass from datetime import datetime from enum import Enum -from typing import cast -from typing import Any, Dict, List, Literal, Optional -from workos._types import _raise_deserialize_error -from workos._types import _format_datetime, _parse_datetime +from typing import Any, Literal, cast -from .data_integration_credential import DataIntegrationCredential -from .data_integration_custom_provider import DataIntegrationCustomProvider -from .data_integration_installation import DataIntegrationInstallation +from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error from workos.common.models.data_integration_auth_methods import ( DataIntegrationAuthMethods, ) from workos.common.models.data_integration_state import DataIntegrationState +from .data_integration_credential import DataIntegrationCredential +from .data_integration_custom_provider import DataIntegrationCustomProvider +from .data_integration_installation import DataIntegrationInstallation + @dataclass(slots=True) class DataIntegration: @@ -31,23 +30,25 @@ class DataIntegration: """The provider slug for this Data Integration.""" integration_type: str """The integration type derived from the provider.""" - description: Optional[str] + description: str | None """An optional description of the Data Integration.""" enabled: bool """Whether the Data Integration is enabled.""" - state: "DataIntegrationState" + state: DataIntegrationState """The state of the Data Integration.""" - scopes: Optional[List[str]] + scopes: list[str] | None """The OAuth scopes configured for the Data Integration. `null` when the provider's configured scopes are used.""" redirect_uri: str """The OAuth redirect URI to register with the provider when configuring the custom application.""" - auth_methods: List["DataIntegrationAuthMethods"] + auth_methods: list[DataIntegrationAuthMethods] """How accounts authenticate with the provider for this Data Integration.""" - credentials: "DataIntegrationCredential" + credentials: DataIntegrationCredential """The credentials configured for the Data Integration.""" - installation: Optional["DataIntegrationInstallation"] + installation: DataIntegrationInstallation | None """The tenant installation created when an API key was supplied at creation time; `null` otherwise. Not populated on list/get responses.""" - custom_provider: Optional["DataIntegrationCustomProvider"] + config: dict[str, str] + """Provider-specific config values set on the Data Integration (e.g. a Snowflake `account_identifier`), keyed by config field. Only fields the provider declares are accepted.""" + custom_provider: DataIntegrationCustomProvider | None """The OAuth definition when this is a custom provider; `null` for built-in providers.""" created_at: datetime """An ISO 8601 timestamp.""" @@ -55,7 +56,7 @@ class DataIntegration: """An ISO 8601 timestamp.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "DataIntegration": + def from_dict(cls, data: dict[str, Any]) -> DataIntegration: """Deserialize from a dictionary.""" try: return cls( @@ -73,15 +74,16 @@ def from_dict(cls, data: Dict[str, Any]) -> "DataIntegration": for item in cast(list[Any], data["auth_methods"]) ], credentials=DataIntegrationCredential.from_dict( - cast(Dict[str, Any], data["credentials"]) + cast(dict[str, Any], data["credentials"]) ), installation=DataIntegrationInstallation.from_dict( - cast(Dict[str, Any], _v_installation) + cast(dict[str, Any], _v_installation) ) if (_v_installation := data["installation"]) is not None else None, + config=data["config"], custom_provider=DataIntegrationCustomProvider.from_dict( - cast(Dict[str, Any], _v_custom_provider) + cast(dict[str, Any], _v_custom_provider) ) if (_v_custom_provider := data["custom_provider"]) is not None else None, @@ -91,9 +93,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "DataIntegration": except (KeyError, ValueError) as e: _raise_deserialize_error("DataIntegration", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["object"] = self.object result["id"] = self.id result["slug"] = self.slug @@ -119,6 +121,7 @@ def to_dict(self) -> Dict[str, Any]: result["installation"] = self.installation.to_dict() else: result["installation"] = None + result["config"] = self.config if self.custom_provider is not None: result["custom_provider"] = self.custom_provider.to_dict() else: 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 eab9acf4..3d3caa4e 100644 --- a/src/workos/pipes/models/data_integration_access_token_response.py +++ b/src/workos/pipes/models/data_integration_access_token_response.py @@ -4,38 +4,38 @@ from dataclasses import dataclass from enum import Enum -from typing import cast -from typing import Any, Dict, Literal, Optional +from typing import Any, Literal, cast + from workos._types import _raise_deserialize_error +from workos.common.models.data_integration_access_token_response_error import ( + DataIntegrationAccessTokenResponseError, +) from .data_integration_access_token_response_access_token import ( DataIntegrationAccessTokenResponseAccessToken, ) -from workos.common.models.data_integration_access_token_response_error import ( - DataIntegrationAccessTokenResponseError, -) @dataclass(slots=True) class DataIntegrationAccessTokenResponse: """Data Integration Access Token Response model.""" - active: Optional[Literal[True]] = None + active: Literal[True] | None = None """Indicates whether the access token is valid and ready for use, or if reauthorization is required.""" - access_token: Optional["DataIntegrationAccessTokenResponseAccessToken"] = None + access_token: DataIntegrationAccessTokenResponseAccessToken | None = None """The [access token](https://workos.com/docs/reference/pipes/access-token) object, present when `active` is `true`.""" - error: Optional["DataIntegrationAccessTokenResponseError"] = None + error: DataIntegrationAccessTokenResponseError | None = None """- `"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": + def from_dict(cls, data: dict[str, Any]) -> DataIntegrationAccessTokenResponse: """Deserialize from a dictionary.""" try: return cls( active=data.get("active"), access_token=DataIntegrationAccessTokenResponseAccessToken.from_dict( - cast(Dict[str, Any], _v_access_token) + cast(dict[str, Any], _v_access_token) ) if (_v_access_token := data.get("access_token")) is not None else None, @@ -46,9 +46,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "DataIntegrationAccessTokenResponse" except (KeyError, ValueError) as e: _raise_deserialize_error("DataIntegrationAccessTokenResponse", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} if self.active is not None: result["active"] = self.active if self.access_token is not None: diff --git a/src/workos/pipes/models/data_integration_access_token_response_access_token.py b/src/workos/pipes/models/data_integration_access_token_response_access_token.py index 6de3fd4f..22cbcb3a 100644 --- a/src/workos/pipes/models/data_integration_access_token_response_access_token.py +++ b/src/workos/pipes/models/data_integration_access_token_response_access_token.py @@ -4,9 +4,9 @@ from dataclasses import dataclass from datetime import datetime -from typing import Any, Dict, List, Literal, Optional -from workos._types import _raise_deserialize_error -from workos._types import _format_datetime, _parse_datetime +from typing import Any, Literal + +from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error @dataclass(slots=True) @@ -17,17 +17,17 @@ class DataIntegrationAccessTokenResponseAccessToken: """Distinguishes the access token object.""" access_token: str """The OAuth access token for the connected integration.""" - expires_at: Optional[datetime] + expires_at: datetime | None """The ISO-8601 formatted timestamp indicating when the access token expires.""" - scopes: List[str] + scopes: list[str] """The scopes granted to the access token.""" - missing_scopes: List[str] + missing_scopes: list[str] """If the integration has requested scopes that aren't present on the access token, they're listed here.""" @classmethod def from_dict( - cls, data: Dict[str, Any] - ) -> "DataIntegrationAccessTokenResponseAccessToken": + cls, data: dict[str, Any] + ) -> DataIntegrationAccessTokenResponseAccessToken: """Deserialize from a dictionary.""" try: return cls( @@ -42,9 +42,9 @@ def from_dict( except (KeyError, ValueError) as e: _raise_deserialize_error("DataIntegrationAccessTokenResponseAccessToken", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["object"] = self.object result["access_token"] = self.access_token if self.expires_at is not None: diff --git a/src/workos/pipes/models/data_integration_authorize_url_response.py b/src/workos/pipes/models/data_integration_authorize_url_response.py index 1f811225..30250339 100644 --- a/src/workos/pipes/models/data_integration_authorize_url_response.py +++ b/src/workos/pipes/models/data_integration_authorize_url_response.py @@ -3,7 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Dict +from typing import Any + from workos._types import _raise_deserialize_error @@ -15,7 +16,7 @@ class DataIntegrationAuthorizeUrlResponse: """The OAuth authorization URL to redirect the user to.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "DataIntegrationAuthorizeUrlResponse": + def from_dict(cls, data: dict[str, Any]) -> DataIntegrationAuthorizeUrlResponse: """Deserialize from a dictionary.""" try: return cls( @@ -24,8 +25,8 @@ def from_dict(cls, data: Dict[str, Any]) -> "DataIntegrationAuthorizeUrlResponse except (KeyError, ValueError) as e: _raise_deserialize_error("DataIntegrationAuthorizeUrlResponse", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["url"] = self.url return result diff --git a/src/workos/pipes/models/data_integration_credential.py b/src/workos/pipes/models/data_integration_credential.py index e33e3153..7a2086a6 100644 --- a/src/workos/pipes/models/data_integration_credential.py +++ b/src/workos/pipes/models/data_integration_credential.py @@ -4,7 +4,8 @@ from dataclasses import dataclass from enum import Enum -from typing import Any, Dict, Optional +from typing import Any + from workos._types import _raise_deserialize_error from workos.common.models.data_integration_credential_type import ( DataIntegrationCredentialType, @@ -15,15 +16,15 @@ class DataIntegrationCredential: """The credentials configured for the Data Integration.""" - type: "DataIntegrationCredentialType" + type: DataIntegrationCredentialType """The credentials type. `custom` uses your own OAuth app credentials; `organization` has each organization supply its own credentials (so `client_id`/`redacted_client_secret` are null on the integration itself).""" - client_id: Optional[str] + client_id: str | None """The OAuth client ID configured for the provider app. Null for `organization` credentials.""" - redacted_client_secret: Optional[str] + redacted_client_secret: str | None """The last four characters of the OAuth client secret. The full secret is never returned. Null for `organization` credentials.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "DataIntegrationCredential": + def from_dict(cls, data: dict[str, Any]) -> DataIntegrationCredential: """Deserialize from a dictionary.""" try: return cls( @@ -34,9 +35,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "DataIntegrationCredential": except (KeyError, ValueError) as e: _raise_deserialize_error("DataIntegrationCredential", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["type"] = self.type.value if isinstance(self.type, Enum) else self.type if self.client_id is not None: result["client_id"] = self.client_id diff --git a/src/workos/pipes/models/data_integration_credentials_input.py b/src/workos/pipes/models/data_integration_credentials_input.py index c926c97f..304c21d5 100644 --- a/src/workos/pipes/models/data_integration_credentials_input.py +++ b/src/workos/pipes/models/data_integration_credentials_input.py @@ -4,7 +4,8 @@ from dataclasses import dataclass from enum import Enum -from typing import Any, Dict, Optional +from typing import Any + from workos._types import _raise_deserialize_error from workos.common.models.data_integration_credentials_input_type import ( DataIntegrationCredentialsInputType, @@ -15,15 +16,15 @@ class DataIntegrationCredentialsInput: """Data Integration Credentials Input model.""" - type: "DataIntegrationCredentialsInputType" + type: DataIntegrationCredentialsInputType """The credentials type. `custom` uses your own OAuth app credentials; `organization` has each organization supply its own credentials (configured per-organization).""" - client_id: Optional[str] = None + client_id: str | None = None """OAuth client ID for the provider app. Required when `type` is `custom`; omit for `organization`.""" - client_secret: Optional[str] = None + client_secret: str | None = None """OAuth client secret for the provider app. Required when `type` is `custom`; omit for `organization`.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "DataIntegrationCredentialsInput": + def from_dict(cls, data: dict[str, Any]) -> DataIntegrationCredentialsInput: """Deserialize from a dictionary.""" try: return cls( @@ -34,9 +35,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "DataIntegrationCredentialsInput": except (KeyError, ValueError) as e: _raise_deserialize_error("DataIntegrationCredentialsInput", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["type"] = self.type.value if isinstance(self.type, Enum) else self.type if self.client_id is not None: result["client_id"] = self.client_id diff --git a/src/workos/pipes/models/data_integration_credentials_response.py b/src/workos/pipes/models/data_integration_credentials_response.py index 59c29a4d..6c499bba 100644 --- a/src/workos/pipes/models/data_integration_credentials_response.py +++ b/src/workos/pipes/models/data_integration_credentials_response.py @@ -4,39 +4,39 @@ from dataclasses import dataclass from enum import Enum -from typing import cast -from typing import Any, Dict, Literal, Optional +from typing import Any, Literal, cast + from workos._types import _raise_deserialize_error +from workos.common.models.data_integration_credentials_response_error import ( + DataIntegrationCredentialsResponseError, +) from .data_integration_credentials_response_credential import ( DataIntegrationCredentialsResponseCredential, ) -from workos.common.models.data_integration_credentials_response_error import ( - DataIntegrationCredentialsResponseError, -) @dataclass(slots=True) class DataIntegrationCredentialsResponse: """Data Integration Credentials Response model.""" - active: Optional[Literal[True]] = None + active: Literal[True] | None = None """Indicates credentials are available.""" - credential: Optional["DataIntegrationCredentialsResponseCredential"] = None + credential: DataIntegrationCredentialsResponseCredential | None = None """The credential object containing the vended secret.""" - error: Optional["DataIntegrationCredentialsResponseError"] = None + 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.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "DataIntegrationCredentialsResponse": + def from_dict(cls, data: dict[str, Any]) -> DataIntegrationCredentialsResponse: """Deserialize from a dictionary.""" try: return cls( active=data.get("active"), credential=DataIntegrationCredentialsResponseCredential.from_dict( - cast(Dict[str, Any], _v_credential) + cast(dict[str, Any], _v_credential) ) if (_v_credential := data.get("credential")) is not None else None, @@ -47,9 +47,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "DataIntegrationCredentialsResponse" except (KeyError, ValueError) as e: _raise_deserialize_error("DataIntegrationCredentialsResponse", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} if self.active is not None: result["active"] = self.active if self.credential is not None: diff --git a/src/workos/pipes/models/data_integration_credentials_response_credential.py b/src/workos/pipes/models/data_integration_credentials_response_credential.py index 0c5c6bff..539d3b72 100644 --- a/src/workos/pipes/models/data_integration_credentials_response_credential.py +++ b/src/workos/pipes/models/data_integration_credentials_response_credential.py @@ -3,7 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Dict, List, Literal, Optional +from typing import Any, Literal + from workos._types import _raise_deserialize_error @@ -17,17 +18,17 @@ class DataIntegrationCredentialsResponseCredential: """The authentication method for this credential. Additional values may be added in the future; handle unknown values gracefully.""" value: str """The OAuth access token.""" - expires_at: Optional[str] + expires_at: str | None """The ISO-8601 formatted timestamp indicating when the credential expires.""" - scopes: List[str] + scopes: list[str] """The scopes granted to the access token.""" - missing_scopes: List[str] + missing_scopes: list[str] """If the integration has requested scopes that aren't present on the access token, they're listed here.""" @classmethod def from_dict( - cls, data: Dict[str, Any] - ) -> "DataIntegrationCredentialsResponseCredential": + cls, data: dict[str, Any] + ) -> DataIntegrationCredentialsResponseCredential: """Deserialize from a dictionary.""" try: return cls( @@ -41,9 +42,9 @@ def from_dict( except (KeyError, ValueError) as e: _raise_deserialize_error("DataIntegrationCredentialsResponseCredential", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["object"] = self.object result["auth_method"] = self.auth_method result["value"] = self.value diff --git a/src/workos/pipes/models/data_integration_custom_provider.py b/src/workos/pipes/models/data_integration_custom_provider.py index a7557990..45145371 100644 --- a/src/workos/pipes/models/data_integration_custom_provider.py +++ b/src/workos/pipes/models/data_integration_custom_provider.py @@ -4,7 +4,8 @@ from dataclasses import dataclass from enum import Enum -from typing import Any, Dict, Optional +from typing import Any + from workos._types import _raise_deserialize_error from workos.common.models.data_integration_custom_provider_authenticate_via import ( DataIntegrationCustomProviderAuthenticateVia, @@ -17,11 +18,11 @@ class DataIntegrationCustomProvider: name: str """A descriptive name for the custom provider.""" - authorization_url: Optional[str] + authorization_url: str | None """The provider's OAuth authorization endpoint.""" - token_url: Optional[str] + token_url: str | None """The provider's OAuth token endpoint.""" - refresh_token_url: Optional[str] + refresh_token_url: str | None """The endpoint used to refresh tokens, if different from the token endpoint.""" pkce_enabled: bool """Whether PKCE is used during the authorization code flow.""" @@ -31,15 +32,15 @@ class DataIntegrationCustomProvider: """Whether at least one scope must be selected when connecting an account.""" client_secret_required: bool """Whether a client secret is required for this provider.""" - additional_authorization_parameters: Dict[str, str] + additional_authorization_parameters: dict[str, str] """Additional static query parameters appended to the authorization request.""" token_body_content_type: str """The Content-Type used when exchanging the token request.""" - authenticate_via: "DataIntegrationCustomProviderAuthenticateVia" + authenticate_via: DataIntegrationCustomProviderAuthenticateVia """How client credentials are sent when exchanging authorization codes and refreshing tokens.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "DataIntegrationCustomProvider": + def from_dict(cls, data: dict[str, Any]) -> DataIntegrationCustomProvider: """Deserialize from a dictionary.""" try: return cls( @@ -62,9 +63,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "DataIntegrationCustomProvider": except (KeyError, ValueError) as e: _raise_deserialize_error("DataIntegrationCustomProvider", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["name"] = self.name if self.authorization_url is not None: result["authorization_url"] = self.authorization_url diff --git a/src/workos/pipes/models/data_integration_installation.py b/src/workos/pipes/models/data_integration_installation.py index 4a81cf39..544b385f 100644 --- a/src/workos/pipes/models/data_integration_installation.py +++ b/src/workos/pipes/models/data_integration_installation.py @@ -3,7 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Dict, Optional +from typing import Any + from workos._types import _raise_deserialize_error @@ -15,13 +16,13 @@ class DataIntegrationInstallation: """Unique identifier of the installation.""" user_id: str """The User the API key was installed for.""" - organization_id: Optional[str] + organization_id: str | None """The Organization the installation is scoped to, or null when unscoped.""" - api_key_last_4: Optional[str] + api_key_last_4: str | None """The last four characters of the stored API key. The full key is never returned.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "DataIntegrationInstallation": + def from_dict(cls, data: dict[str, Any]) -> DataIntegrationInstallation: """Deserialize from a dictionary.""" try: return cls( @@ -33,9 +34,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "DataIntegrationInstallation": except (KeyError, ValueError) as e: _raise_deserialize_error("DataIntegrationInstallation", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["id"] = self.id result["user_id"] = self.user_id if self.organization_id is not None: 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 fb8f3f71..6dca8f1e 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,7 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Dict, Optional +from typing import Any + from workos._types import _raise_deserialize_error @@ -13,33 +14,38 @@ class DataIntegrationsGetDataIntegrationAuthorizeUrlRequest: user_id: str """The ID of the user to authorize.""" - organization_id: Optional[str] = None + organization_id: str | None = None """An organization ID to scope the authorization to a specific organization.""" - return_to: Optional[str] = None + return_to: str | None = None """The URL to redirect the user to after authorization.""" + config: dict[str, str] | None = None + """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.""" @classmethod def from_dict( - cls, data: Dict[str, Any] - ) -> "DataIntegrationsGetDataIntegrationAuthorizeUrlRequest": + cls, data: dict[str, Any] + ) -> DataIntegrationsGetDataIntegrationAuthorizeUrlRequest: """Deserialize from a dictionary.""" try: return cls( user_id=data["user_id"], organization_id=data.get("organization_id"), return_to=data.get("return_to"), + config=data.get("config"), ) except (KeyError, ValueError) as e: _raise_deserialize_error( "DataIntegrationsGetDataIntegrationAuthorizeUrlRequest", e ) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["user_id"] = self.user_id if self.organization_id is not None: result["organization_id"] = self.organization_id if self.return_to is not None: result["return_to"] = self.return_to + if self.config is not None: + result["config"] = self.config return result diff --git a/src/workos/pipes/models/data_integrations_get_user_token_request.py b/src/workos/pipes/models/data_integrations_get_user_token_request.py index 7be703ff..1fc0ef92 100644 --- a/src/workos/pipes/models/data_integrations_get_user_token_request.py +++ b/src/workos/pipes/models/data_integrations_get_user_token_request.py @@ -3,7 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Dict, Optional +from typing import Any + from workos._types import _raise_deserialize_error @@ -13,11 +14,11 @@ class DataIntegrationsGetUserTokenRequest: user_id: str """A [User](https://workos.com/docs/reference/authkit/user) identifier.""" - organization_id: Optional[str] = None + organization_id: str | None = None """An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "DataIntegrationsGetUserTokenRequest": + def from_dict(cls, data: dict[str, Any]) -> DataIntegrationsGetUserTokenRequest: """Deserialize from a dictionary.""" try: return cls( @@ -27,9 +28,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "DataIntegrationsGetUserTokenRequest except (KeyError, ValueError) as e: _raise_deserialize_error("DataIntegrationsGetUserTokenRequest", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["user_id"] = self.user_id if self.organization_id is not None: result["organization_id"] = self.organization_id diff --git a/src/workos/pipes/models/data_integrations_list_response.py b/src/workos/pipes/models/data_integrations_list_response.py index c728d9e5..4aa62cb7 100644 --- a/src/workos/pipes/models/data_integrations_list_response.py +++ b/src/workos/pipes/models/data_integrations_list_response.py @@ -3,8 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import cast -from typing import Any, Dict, List, Literal +from typing import Any, Literal, cast + from workos._types import _raise_deserialize_error from .data_integrations_list_response_data import DataIntegrationsListResponseData @@ -16,18 +16,18 @@ class DataIntegrationsListResponse: object: Literal["list"] """Indicates this is a list response.""" - data: List["DataIntegrationsListResponseData"] + data: list[DataIntegrationsListResponseData] """A list of [providers](https://workos.com/docs/reference/pipes/provider), each including a [`connected_account`](https://workos.com/docs/reference/pipes/connected-account) field with the user's connection status.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "DataIntegrationsListResponse": + 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) + cast(dict[str, Any], item) ) for item in cast(list[Any], data["data"]) ], @@ -35,9 +35,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "DataIntegrationsListResponse": except (KeyError, ValueError) as e: _raise_deserialize_error("DataIntegrationsListResponse", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + 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/pipes/models/data_integrations_list_response_data.py b/src/workos/pipes/models/data_integrations_list_response_data.py index 4eaf6ce7..a4f173e0 100644 --- a/src/workos/pipes/models/data_integrations_list_response_data.py +++ b/src/workos/pipes/models/data_integrations_list_response_data.py @@ -4,13 +4,9 @@ from dataclasses import dataclass from enum import Enum -from typing import cast -from typing import Any, Dict, List, Literal, Optional -from workos._types import _raise_deserialize_error +from typing import Any, Literal, cast -from .data_integrations_list_response_data_connected_account import ( - DataIntegrationsListResponseDataConnectedAccount, -) +from workos._types import _raise_deserialize_error from workos.common.models.data_integrations_list_response_data_auth_methods import ( DataIntegrationsListResponseDataAuthMethods, ) @@ -18,6 +14,10 @@ DataIntegrationsListResponseDataOwnership, ) +from .data_integrations_list_response_data_connected_account import ( + DataIntegrationsListResponseDataConnectedAccount, +) + @dataclass(slots=True) class DataIntegrationsListResponseData: @@ -29,7 +29,7 @@ class DataIntegrationsListResponseData: """The unique identifier of the provider.""" name: str """The display name of the provider (e.g., "GitHub", "Slack").""" - description: Optional[str] + 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`).""" @@ -37,21 +37,21 @@ class DataIntegrationsListResponseData: """The type of integration (e.g., `github`, `slack`).""" credentials_type: str """The type of credentials used by the provider (e.g., `oauth2`).""" - scopes: Optional[List[str]] + scopes: list[str] | None """The OAuth scopes configured for this provider, or `null` if none are configured.""" - ownership: "DataIntegrationsListResponseDataOwnership" + ownership: DataIntegrationsListResponseDataOwnership """Whether the provider is owned by a user or organization.""" created_at: str """The timestamp when the provider was created.""" updated_at: str """The timestamp when the provider was last updated.""" - connected_account: Optional["DataIntegrationsListResponseDataConnectedAccount"] + connected_account: DataIntegrationsListResponseDataConnectedAccount | None """The user's [connected account](https://workos.com/docs/reference/pipes/connected-account) for this provider, or `null` if the user has not connected.""" - auth_methods: Optional[List["DataIntegrationsListResponseDataAuthMethods"]] = None - """The authentication methods supported by this provider (`oauth`, `api_key`, or both). Defaults to `["oauth"]` if absent.""" + 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.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "DataIntegrationsListResponseData": + def from_dict(cls, data: dict[str, Any]) -> DataIntegrationsListResponseData: """Deserialize from a dictionary.""" try: return cls( @@ -67,7 +67,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "DataIntegrationsListResponseData": created_at=data["created_at"], updated_at=data["updated_at"], connected_account=DataIntegrationsListResponseDataConnectedAccount.from_dict( - cast(Dict[str, Any], _v_connected_account) + cast(dict[str, Any], _v_connected_account) ) if (_v_connected_account := data["connected_account"]) is not None else None, @@ -81,9 +81,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "DataIntegrationsListResponseData": except (KeyError, ValueError) as e: _raise_deserialize_error("DataIntegrationsListResponseData", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["object"] = self.object result["id"] = self.id result["name"] = self.name diff --git a/src/workos/pipes/models/data_integrations_list_response_data_connected_account.py b/src/workos/pipes/models/data_integrations_list_response_data_connected_account.py index c6204418..3df37718 100644 --- a/src/workos/pipes/models/data_integrations_list_response_data_connected_account.py +++ b/src/workos/pipes/models/data_integrations_list_response_data_connected_account.py @@ -4,7 +4,8 @@ from dataclasses import dataclass from enum import Enum -from typing import Any, Dict, List, Literal, Optional +from typing import Any, Literal + from workos._types import _raise_deserialize_error from workos.common.models.data_integrations_list_response_data_connected_account_auth_method import ( DataIntegrationsListResponseDataConnectedAccountAuthMethod, @@ -22,13 +23,13 @@ class DataIntegrationsListResponseDataConnectedAccount: """Distinguishes the connected account object.""" id: str """The unique identifier of the connected account.""" - user_id: Optional[str] + user_id: str | None """The [User](https://workos.com/docs/reference/authkit/user) identifier associated with this connection.""" - organization_id: Optional[str] + 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] + scopes: list[str] """The OAuth scopes granted for this connection.""" - state: "DataIntegrationsListResponseDataConnectedAccountState" + 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. @@ -37,21 +38,21 @@ class DataIntegrationsListResponseDataConnectedAccount: """The timestamp when the connection was created.""" updated_at: str """The timestamp when the connection was last updated.""" - auth_method: Optional[ - "DataIntegrationsListResponseDataConnectedAccountAuthMethod" - ] = None - """The authentication method used for this connection (`oauth` or `api_key`). Defaults to `oauth` if absent.""" - api_key_last_4: Optional[str] = None + 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.""" - userland_user_id: Optional[str] = None + 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": + cls, data: dict[str, Any] + ) -> DataIntegrationsListResponseDataConnectedAccount: """Deserialize from a dictionary.""" try: return cls( @@ -78,9 +79,9 @@ def from_dict( "DataIntegrationsListResponseDataConnectedAccount", e ) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["object"] = self.object result["id"] = self.id if self.user_id is not None: diff --git a/src/workos/pipes/models/data_integrations_upsert_api_key_request.py b/src/workos/pipes/models/data_integrations_upsert_api_key_request.py index 72bec1f6..3172e394 100644 --- a/src/workos/pipes/models/data_integrations_upsert_api_key_request.py +++ b/src/workos/pipes/models/data_integrations_upsert_api_key_request.py @@ -3,7 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Dict, Optional +from typing import Any + from workos._types import _raise_deserialize_error @@ -15,11 +16,11 @@ class DataIntegrationsUpsertApiKeyRequest: """A [User](https://workos.com/docs/reference/authkit/user) identifier.""" secret: str """The API key secret to store for this integration.""" - organization_id: Optional[str] = None + organization_id: str | None = None """An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "DataIntegrationsUpsertApiKeyRequest": + def from_dict(cls, data: dict[str, Any]) -> DataIntegrationsUpsertApiKeyRequest: """Deserialize from a dictionary.""" try: return cls( @@ -30,9 +31,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "DataIntegrationsUpsertApiKeyRequest except (KeyError, ValueError) as e: _raise_deserialize_error("DataIntegrationsUpsertApiKeyRequest", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["user_id"] = self.user_id result["secret"] = self.secret if self.organization_id is not None: diff --git a/src/workos/pipes/models/data_integrations_vend_credentials_request.py b/src/workos/pipes/models/data_integrations_vend_credentials_request.py index 35ec5eb0..703af7f1 100644 --- a/src/workos/pipes/models/data_integrations_vend_credentials_request.py +++ b/src/workos/pipes/models/data_integrations_vend_credentials_request.py @@ -3,7 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Dict, Optional +from typing import Any + from workos._types import _raise_deserialize_error @@ -13,13 +14,11 @@ class DataIntegrationsVendCredentialsRequest: user_id: str """A [User](https://workos.com/docs/reference/authkit/user) identifier.""" - organization_id: Optional[str] = None + organization_id: str | None = None """An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization.""" @classmethod - def from_dict( - cls, data: Dict[str, Any] - ) -> "DataIntegrationsVendCredentialsRequest": + def from_dict(cls, data: dict[str, Any]) -> DataIntegrationsVendCredentialsRequest: """Deserialize from a dictionary.""" try: return cls( @@ -29,9 +28,9 @@ def from_dict( except (KeyError, ValueError) as e: _raise_deserialize_error("DataIntegrationsVendCredentialsRequest", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["user_id"] = self.user_id if self.organization_id is not None: result["organization_id"] = self.organization_id diff --git a/src/workos/pipes/models/update_custom_provider_definition.py b/src/workos/pipes/models/update_custom_provider_definition.py index ec40248c..6e2f9999 100644 --- a/src/workos/pipes/models/update_custom_provider_definition.py +++ b/src/workos/pipes/models/update_custom_provider_definition.py @@ -4,7 +4,8 @@ from dataclasses import dataclass from enum import Enum -from typing import Any, Dict, Optional +from typing import Any + from workos._types import _raise_deserialize_error from workos.common.models.update_custom_provider_definition_authenticate_via import ( UpdateCustomProviderDefinitionAuthenticateVia, @@ -15,31 +16,31 @@ class UpdateCustomProviderDefinition: """Update Custom Provider Definition model.""" - name: Optional[str] = None + name: str | None = None """A descriptive name for the custom provider.""" - authorization_url: Optional[str] = None + authorization_url: str | None = None """The provider's OAuth authorization endpoint.""" - token_url: Optional[str] = None + token_url: str | None = None """The provider's OAuth token endpoint.""" - refresh_token_url: Optional[str] = None + refresh_token_url: str | None = None """The endpoint used to refresh tokens, if different from the token endpoint.""" - pkce_enabled: Optional[bool] = None + pkce_enabled: bool | None = None """Whether PKCE is used during the authorization code flow.""" - request_scope_separator: Optional[str] = None + request_scope_separator: str | None = None """The separator used to join requested scopes.""" - scopes_required: Optional[bool] = None + scopes_required: bool | None = None """Whether at least one scope must be selected when connecting an account.""" - client_secret_required: Optional[bool] = None + client_secret_required: bool | None = None """Whether a client secret is required for this provider.""" - additional_authorization_parameters: Optional[Dict[str, str]] = None + additional_authorization_parameters: dict[str, str] | None = None """Additional static query parameters appended to the authorization request.""" - token_body_content_type: Optional[str] = None + token_body_content_type: str | None = None """The Content-Type used when exchanging the token request.""" - authenticate_via: Optional["UpdateCustomProviderDefinitionAuthenticateVia"] = None + authenticate_via: UpdateCustomProviderDefinitionAuthenticateVia | None = None """How client credentials are sent when exchanging authorization codes and refreshing tokens.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "UpdateCustomProviderDefinition": + def from_dict(cls, data: dict[str, Any]) -> UpdateCustomProviderDefinition: """Deserialize from a dictionary.""" try: return cls( @@ -64,9 +65,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "UpdateCustomProviderDefinition": except (KeyError, ValueError) as e: _raise_deserialize_error("UpdateCustomProviderDefinition", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} if self.name is not None: result["name"] = self.name if self.authorization_url is not None: diff --git a/src/workos/pipes/models/update_data_integration.py b/src/workos/pipes/models/update_data_integration.py index 0591ac8f..83f3dd8e 100644 --- a/src/workos/pipes/models/update_data_integration.py +++ b/src/workos/pipes/models/update_data_integration.py @@ -3,8 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import cast -from typing import Any, Dict, List, Optional +from typing import Any, cast + from workos._types import _raise_deserialize_error from .api_key_installation import ApiKeyInstallation @@ -16,21 +16,21 @@ class UpdateDataIntegration: """Update Data Integration model.""" - description: Optional[str] = None + description: str | None = None """An optional description of the Data Integration.""" - enabled: Optional[bool] = None + enabled: bool | None = None """Whether the Data Integration is enabled.""" - scopes: Optional[List[str]] = None + scopes: list[str] | None = None """The OAuth scopes to request for the Data Integration. Pass `null` to reset to the provider's configured scopes.""" - credentials: Optional["DataIntegrationCredentialsInput"] = None + credentials: DataIntegrationCredentialsInput | None = None """New OAuth credentials for the Data Integration. When provided, rotates the stored client secret. Mutually exclusive with `api_key`.""" - api_key: Optional["ApiKeyInstallation"] = None + api_key: ApiKeyInstallation | None = None """An API key to install or rotate for a tenant on an `api_key` integration. Upserts the tenant installation identified by `user_id` (and optional `organization_id`).""" - custom_provider: Optional["UpdateCustomProviderDefinition"] = None + custom_provider: UpdateCustomProviderDefinition | None = None """Updates to a custom provider's OAuth definition. Only valid for custom-provider integrations.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "UpdateDataIntegration": + def from_dict(cls, data: dict[str, Any]) -> UpdateDataIntegration: """Deserialize from a dictionary.""" try: return cls( @@ -38,15 +38,15 @@ def from_dict(cls, data: Dict[str, Any]) -> "UpdateDataIntegration": enabled=data.get("enabled"), scopes=data.get("scopes"), credentials=DataIntegrationCredentialsInput.from_dict( - cast(Dict[str, Any], _v_credentials) + cast(dict[str, Any], _v_credentials) ) if (_v_credentials := data.get("credentials")) is not None else None, - api_key=ApiKeyInstallation.from_dict(cast(Dict[str, Any], _v_api_key)) + api_key=ApiKeyInstallation.from_dict(cast(dict[str, Any], _v_api_key)) if (_v_api_key := data.get("api_key")) is not None else None, custom_provider=UpdateCustomProviderDefinition.from_dict( - cast(Dict[str, Any], _v_custom_provider) + cast(dict[str, Any], _v_custom_provider) ) if (_v_custom_provider := data.get("custom_provider")) is not None else None, @@ -54,9 +54,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "UpdateDataIntegration": except (KeyError, ValueError) as e: _raise_deserialize_error("UpdateDataIntegration", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} if self.description is not None: result["description"] = self.description else: diff --git a/src/workos/pipes_provider/__init__.py b/src/workos/pipes_provider/__init__.py index 9d9215d8..a02bb33d 100644 --- a/src/workos/pipes_provider/__init__.py +++ b/src/workos/pipes_provider/__init__.py @@ -1,7 +1,5 @@ # This file is auto-generated by oagen. Do not edit. -from ._resource import ( - PipesProvider as PipesProvider, - AsyncPipesProvider as AsyncPipesProvider, -) +from ._resource import AsyncPipesProvider as AsyncPipesProvider +from ._resource import PipesProvider as PipesProvider from .models import * diff --git a/src/workos/pipes_provider/_resource.py b/src/workos/pipes_provider/_resource.py index 04e96389..55d2e09b 100644 --- a/src/workos/pipes_provider/_resource.py +++ b/src/workos/pipes_provider/_resource.py @@ -2,12 +2,12 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union +from typing import TYPE_CHECKING, Any if TYPE_CHECKING: from .._client import AsyncWorkOSClient, WorkOSClient -from .._types import RequestOptions, NOT_GIVEN, NotGiven +from .._types import NOT_GIVEN, NotGiven, RequestOptions from .models import ( DataIntegrationConfigurationListResponse, DataIntegrationConfigurationResponse, @@ -17,14 +17,14 @@ class PipesProvider: """Pipes Provider API resources.""" - def __init__(self, client: "WorkOSClient") -> None: + def __init__(self, client: WorkOSClient) -> None: self._client = client def list_organization_data_integration_configurations( self, organization_id: str, *, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> DataIntegrationConfigurationListResponse: """List providers for an organization @@ -59,11 +59,12 @@ def update_organization_data_integration_configuration( organization_id: str, slug: str, *, - enabled: Optional[bool] = None, - scopes: Union[List[str], None, NotGiven] = NOT_GIVEN, - client_id: Optional[str] = None, - client_secret: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + enabled: bool | None = None, + scopes: list[str] | None | NotGiven = NOT_GIVEN, + client_id: str | None = None, + client_secret: str | None = None, + config: dict[str, str] | None = None, + request_options: RequestOptions | None = None, ) -> DataIntegrationConfigurationResponse: """Configure a provider for an organization @@ -76,6 +77,7 @@ def update_organization_data_integration_configuration( scopes: The OAuth scopes to request for the organization. Pass `null` to inherit the provider scopes. client_id: The OAuth client ID of the organization's own application. Must be provided together with `client_secret`, and only for providers whose credentials are supplied by the organization. client_secret: The OAuth client secret of the organization's own application. Must be provided together with `client_id`. + config: Provider-specific config values to set for the organization, keyed by config field. Only fields the provider declares are accepted, and each value must match that field's pattern. Accepted only for providers whose credentials are organization-managed; for shared or custom credential providers, config belongs on the integration itself (via the data-integrations API) and supplying it here is rejected. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: @@ -89,12 +91,13 @@ def update_organization_data_integration_configuration( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { k: v for k, v in { "enabled": enabled, "client_id": client_id, "client_secret": client_secret, + "config": config, }.items() if v is not None } @@ -117,14 +120,14 @@ def update_organization_data_integration_configuration( class AsyncPipesProvider: """Pipes Provider API resources (async).""" - def __init__(self, client: "AsyncWorkOSClient") -> None: + def __init__(self, client: AsyncWorkOSClient) -> None: self._client = client async def list_organization_data_integration_configurations( self, organization_id: str, *, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> DataIntegrationConfigurationListResponse: """List providers for an organization @@ -159,11 +162,12 @@ async def update_organization_data_integration_configuration( organization_id: str, slug: str, *, - enabled: Optional[bool] = None, - scopes: Union[List[str], None, NotGiven] = NOT_GIVEN, - client_id: Optional[str] = None, - client_secret: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + enabled: bool | None = None, + scopes: list[str] | None | NotGiven = NOT_GIVEN, + client_id: str | None = None, + client_secret: str | None = None, + config: dict[str, str] | None = None, + request_options: RequestOptions | None = None, ) -> DataIntegrationConfigurationResponse: """Configure a provider for an organization @@ -176,6 +180,7 @@ async def update_organization_data_integration_configuration( scopes: The OAuth scopes to request for the organization. Pass `null` to inherit the provider scopes. client_id: The OAuth client ID of the organization's own application. Must be provided together with `client_secret`, and only for providers whose credentials are supplied by the organization. client_secret: The OAuth client secret of the organization's own application. Must be provided together with `client_id`. + config: Provider-specific config values to set for the organization, keyed by config field. Only fields the provider declares are accepted, and each value must match that field's pattern. Accepted only for providers whose credentials are organization-managed; for shared or custom credential providers, config belongs on the integration itself (via the data-integrations API) and supplying it here is rejected. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: @@ -189,12 +194,13 @@ async def update_organization_data_integration_configuration( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { k: v for k, v in { "enabled": enabled, "client_id": client_id, "client_secret": client_secret, + "config": config, }.items() if v is not None } diff --git a/src/workos/pipes_provider/models/configure_data_integration_body.py b/src/workos/pipes_provider/models/configure_data_integration_body.py index 800f263a..9502cb1f 100644 --- a/src/workos/pipes_provider/models/configure_data_integration_body.py +++ b/src/workos/pipes_provider/models/configure_data_integration_body.py @@ -3,7 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Dict, List, Optional +from typing import Any + from workos._types import _raise_deserialize_error @@ -11,17 +12,19 @@ class ConfigureDataIntegrationBody: """Configure Data Integration Body model.""" - enabled: Optional[bool] = None + enabled: bool | None = None """Whether the provider is enabled for the organization.""" - scopes: Optional[List[str]] = None + scopes: list[str] | None = None """The OAuth scopes to request for the organization. Pass `null` to inherit the provider scopes.""" - client_id: Optional[str] = None + client_id: str | None = None """The OAuth client ID of the organization's own application. Must be provided together with `client_secret`, and only for providers whose credentials are supplied by the organization.""" - client_secret: Optional[str] = None + client_secret: str | None = None """The OAuth client secret of the organization's own application. Must be provided together with `client_id`.""" + config: dict[str, str] | None = None + """Provider-specific config values to set for the organization, keyed by config field. Only fields the provider declares are accepted, and each value must match that field's pattern. Accepted only for providers whose credentials are organization-managed; for shared or custom credential providers, config belongs on the integration itself (via the data-integrations API) and supplying it here is rejected.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "ConfigureDataIntegrationBody": + def from_dict(cls, data: dict[str, Any]) -> ConfigureDataIntegrationBody: """Deserialize from a dictionary.""" try: return cls( @@ -29,13 +32,14 @@ def from_dict(cls, data: Dict[str, Any]) -> "ConfigureDataIntegrationBody": scopes=data.get("scopes"), client_id=data.get("client_id"), client_secret=data.get("client_secret"), + config=data.get("config"), ) except (KeyError, ValueError) as e: _raise_deserialize_error("ConfigureDataIntegrationBody", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} if self.enabled is not None: result["enabled"] = self.enabled if self.scopes is not None: @@ -46,4 +50,6 @@ def to_dict(self) -> Dict[str, Any]: result["client_id"] = self.client_id if self.client_secret is not None: result["client_secret"] = self.client_secret + if self.config is not None: + result["config"] = self.config return result diff --git a/src/workos/pipes_provider/models/data_integration_configuration_list_response.py b/src/workos/pipes_provider/models/data_integration_configuration_list_response.py index e254584d..7f900e73 100644 --- a/src/workos/pipes_provider/models/data_integration_configuration_list_response.py +++ b/src/workos/pipes_provider/models/data_integration_configuration_list_response.py @@ -3,8 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import cast -from typing import Any, Dict, List, Literal +from typing import Any, Literal, cast + from workos._types import _raise_deserialize_error from .data_integration_configuration_response import ( @@ -18,20 +18,20 @@ class DataIntegrationConfigurationListResponse: object: Literal["list"] """Indicates this is a list response.""" - data: List["DataIntegrationConfigurationResponse"] + data: list[DataIntegrationConfigurationResponse] """A list of data integration configurations for the organization.""" @classmethod def from_dict( - cls, data: Dict[str, Any] - ) -> "DataIntegrationConfigurationListResponse": + cls, data: dict[str, Any] + ) -> DataIntegrationConfigurationListResponse: """Deserialize from a dictionary.""" try: return cls( object=data.get("object", "list"), data=[ DataIntegrationConfigurationResponse.from_dict( - cast(Dict[str, Any], item) + cast(dict[str, Any], item) ) for item in cast(list[Any], data["data"]) ], @@ -39,9 +39,9 @@ def from_dict( except (KeyError, ValueError) as e: _raise_deserialize_error("DataIntegrationConfigurationListResponse", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + 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/pipes_provider/models/data_integration_configuration_response.py b/src/workos/pipes_provider/models/data_integration_configuration_response.py index 43dd819e..079420d8 100644 --- a/src/workos/pipes_provider/models/data_integration_configuration_response.py +++ b/src/workos/pipes_provider/models/data_integration_configuration_response.py @@ -3,8 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import cast -from typing import Any, Dict, List, Literal, Optional +from typing import Any, Literal, cast + from workos._types import _raise_deserialize_error from .data_integration_credentials import DataIntegrationCredentials @@ -26,16 +26,18 @@ class DataIntegrationConfigurationResponse: """The display name of the data integration.""" enabled: bool """Whether the integration is enabled for this organization. Reflects the organization override when one exists, otherwise the provider default.""" - scopes: Optional[List[str]] + scopes: list[str] | None """The OAuth scopes in effect for this organization. Reflects the organization override when one is set, otherwise the provider scopes, or `null` when none are configured.""" + config: dict[str, str] + """The provider-specific config values in effect for this organization, keyed by config field. Reflects the organization override for organization-credential providers, otherwise the provider root. Empty when none are configured.""" created_at: str """The timestamp when the configuration was created.""" updated_at: str """The timestamp when the configuration was last updated.""" - credentials: Optional["DataIntegrationCredentials"] = None + credentials: DataIntegrationCredentials | None = None @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "DataIntegrationConfigurationResponse": + def from_dict(cls, data: dict[str, Any]) -> DataIntegrationConfigurationResponse: """Deserialize from a dictionary.""" try: return cls( @@ -46,10 +48,11 @@ def from_dict(cls, data: Dict[str, Any]) -> "DataIntegrationConfigurationRespons name=data["name"], enabled=data["enabled"], scopes=data["scopes"], + config=data["config"], created_at=data["created_at"], updated_at=data["updated_at"], credentials=DataIntegrationCredentials.from_dict( - cast(Dict[str, Any], _v_credentials) + cast(dict[str, Any], _v_credentials) ) if (_v_credentials := data.get("credentials")) is not None else None, @@ -57,9 +60,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "DataIntegrationConfigurationRespons except (KeyError, ValueError) as e: _raise_deserialize_error("DataIntegrationConfigurationResponse", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["object"] = self.object result["id"] = self.id result["organization_id"] = self.organization_id @@ -70,6 +73,7 @@ def to_dict(self) -> Dict[str, Any]: result["scopes"] = self.scopes else: result["scopes"] = None + result["config"] = self.config result["created_at"] = self.created_at result["updated_at"] = self.updated_at if self.credentials is not None: diff --git a/src/workos/pipes_provider/models/data_integration_credentials.py b/src/workos/pipes_provider/models/data_integration_credentials.py index 79943b47..0a0370d0 100644 --- a/src/workos/pipes_provider/models/data_integration_credentials.py +++ b/src/workos/pipes_provider/models/data_integration_credentials.py @@ -4,7 +4,8 @@ from dataclasses import dataclass from enum import Enum -from typing import Any, Dict, Optional +from typing import Any + from workos._types import _raise_deserialize_error from workos.common.models.data_integration_credentials_credentials_type import ( DataIntegrationCredentialsCredentialsType, @@ -15,19 +16,19 @@ class DataIntegrationCredentials: """Organization-managed OAuth credential configuration. Present only for integrations whose credentials are supplied by the organization; absent otherwise.""" - credentials_type: "DataIntegrationCredentialsCredentialsType" + credentials_type: DataIntegrationCredentialsCredentialsType """The credentials type for this integration (e.g., `shared`, `custom`, or `organization`).""" has_credentials: bool """Whether the organization has supplied OAuth credentials for this integration.""" - client_id: Optional[str] + client_id: str | None """The OAuth client ID supplied by the organization, or `null` when none is configured.""" - client_secret_last_four: Optional[str] + client_secret_last_four: str | None """The last four characters of the organization-supplied OAuth client secret, or `null` when none is configured.""" redirect_uri: str """The redirect URI to register with the provider when configuring the organization-managed OAuth application.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "DataIntegrationCredentials": + def from_dict(cls, data: dict[str, Any]) -> DataIntegrationCredentials: """Deserialize from a dictionary.""" try: return cls( @@ -42,9 +43,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "DataIntegrationCredentials": except (KeyError, ValueError) as e: _raise_deserialize_error("DataIntegrationCredentials", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["credentials_type"] = ( self.credentials_type.value if isinstance(self.credentials_type, Enum) diff --git a/src/workos/user_management/__init__.py b/src/workos/user_management/__init__.py index c90dd5a2..048d1a35 100644 --- a/src/workos/user_management/__init__.py +++ b/src/workos/user_management/__init__.py @@ -1,9 +1,7 @@ # This file is auto-generated by oagen. Do not edit. -from ._resource import ( - UserManagement as UserManagement, - AsyncUserManagement as AsyncUserManagement, - PasswordPlaintext as PasswordPlaintext, - PasswordHashed as PasswordHashed, -) +from ._resource import AsyncUserManagement as AsyncUserManagement +from ._resource import PasswordHashed as PasswordHashed +from ._resource import PasswordPlaintext as PasswordPlaintext +from ._resource import UserManagement as UserManagement from .models import * diff --git a/src/workos/user_management/_resource.py b/src/workos/user_management/_resource.py index 2403b12b..976eba7a 100644 --- a/src/workos/user_management/_resource.py +++ b/src/workos/user_management/_resource.py @@ -2,12 +2,34 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Union, cast +from typing import TYPE_CHECKING, Any, Literal, cast if TYPE_CHECKING: from .._client import AsyncWorkOSClient, WorkOSClient -from .._types import RequestOptions, enum_value, NOT_GIVEN, NotGiven +from dataclasses import dataclass + +from workos.common.models.create_user_invite_options_locale import ( + CreateUserInviteOptionsLocale, +) +from workos.common.models.create_user_password_hash_type import ( + CreateUserPasswordHashType, +) +from workos.common.models.pagination_order import PaginationOrder +from workos.common.models.resend_user_invite_options_locale import ( + ResendUserInviteOptionsLocale, +) +from workos.common.models.user import User +from workos.common.models.user_sessions_list_item import UserSessionsListItem + +from .._pagination import AsyncPage, SyncPage +from .._types import NOT_GIVEN, NotGiven, RequestOptions, enum_value +from ..session import ( + AsyncSession, + AuthenticateWithSessionCookieErrorResponse, + AuthenticateWithSessionCookieSuccessResponse, + Session, +) from .models import ( AuthenticateResponse, AuthorizationCodeSessionAuthenticateRequest, @@ -20,8 +42,8 @@ EmailVerification, EmailVerificationCodeSessionAuthenticateRequest, Invitation, - JWTTemplateResponse, JwksResponse, + JWTTemplateResponse, MagicAuth, MagicAuthCodeSessionAuthenticateRequest, MagicAuthSendMagicAuthCodeAndReturnResponse, @@ -42,31 +64,9 @@ UserCreateResponse, UserIdentitiesGetItem, UserInvite, - VerifyEmailResponse, -) -from workos.common.models.user import User -from workos.common.models.user_sessions_list_item import UserSessionsListItem -from .models import ( UserManagementAuthenticationProvider, UserManagementAuthenticationScreenHint, -) -from workos.common.models.create_user_invite_options_locale import ( - CreateUserInviteOptionsLocale, -) -from workos.common.models.pagination_order import PaginationOrder -from workos.common.models.resend_user_invite_options_locale import ( - ResendUserInviteOptionsLocale, -) -from .._pagination import AsyncPage, SyncPage -from dataclasses import dataclass -from workos.common.models.create_user_password_hash_type import ( - CreateUserPasswordHashType, -) -from ..session import ( - AsyncSession, - AuthenticateWithSessionCookieErrorResponse, - AuthenticateWithSessionCookieSuccessResponse, - Session, + VerifyEmailResponse, ) @@ -74,7 +74,7 @@ class PasswordPlaintext: """Identify password plaintext.""" - password: Optional[str] + password: str | None @dataclass @@ -82,20 +82,20 @@ class PasswordHashed: """Identify password hashed.""" password_hash: str - password_hash_type: Union[CreateUserPasswordHashType, str] + password_hash_type: CreateUserPasswordHashType | str class UserManagement: """User Management API resources.""" - def __init__(self, client: "WorkOSClient") -> None: + def __init__(self, client: WorkOSClient) -> None: self._client = client def get_jwks( self, client_id: str, *, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> JwksResponse: """Get JWKS @@ -124,20 +124,18 @@ def get_jwks( def create_authenticate( self, *, - body: Union[ - AuthorizationCodeSessionAuthenticateRequest, - PasswordSessionAuthenticateRequest, - RefreshTokenSessionAuthenticateRequest, - MagicAuthCodeSessionAuthenticateRequest, - EmailVerificationCodeSessionAuthenticateRequest, - MFATotpSessionAuthenticateRequest, - OrganizationSelectionSessionAuthenticateRequest, - RadarEmailChallengeCodeSessionAuthenticateRequest, - RadarSmsChallengeCodeSessionAuthenticateRequest, - DeviceCodeSessionAuthenticateRequest, - Dict[str, Any], - ], - request_options: Optional[RequestOptions] = None, + body: AuthorizationCodeSessionAuthenticateRequest + | PasswordSessionAuthenticateRequest + | RefreshTokenSessionAuthenticateRequest + | MagicAuthCodeSessionAuthenticateRequest + | EmailVerificationCodeSessionAuthenticateRequest + | MFATotpSessionAuthenticateRequest + | OrganizationSelectionSessionAuthenticateRequest + | RadarEmailChallengeCodeSessionAuthenticateRequest + | RadarSmsChallengeCodeSessionAuthenticateRequest + | DeviceCodeSessionAuthenticateRequest + | dict[str, Any], + request_options: RequestOptions | None = None, ) -> AuthenticateResponse: """Authenticate @@ -159,7 +157,7 @@ def create_authenticate( AuthenticationError: If the API key is invalid (401). ServerError: If the server returns a 5xx error. """ - _body: Dict[str, Any] = body if isinstance(body, dict) else body.to_dict() + _body: dict[str, Any] = body if isinstance(body, dict) else body.to_dict() return self._client.request( method="post", path=("user_management", "authenticate"), @@ -173,16 +171,16 @@ def authenticate_with_password( *, email: str, password: str, - invitation_token: Optional[str] = None, - ip_address: Optional[str] = None, - device_id: Optional[str] = None, - user_agent: Optional[str] = None, - signals_id: Optional[str] = None, - radar_auth_attempt_id: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + invitation_token: str | None = None, + ip_address: str | None = None, + device_id: str | None = None, + user_agent: str | None = None, + signals_id: str | None = None, + radar_auth_attempt_id: str | None = None, + request_options: RequestOptions | None = None, ) -> AuthenticateResponse: """Authenticate with password.""" - body: Dict[str, Any] = { + body: dict[str, Any] = { "grant_type": "password", "email": email, "password": password, @@ -216,16 +214,16 @@ def authenticate_with_code( self, *, code: str, - code_verifier: Optional[str] = None, - invitation_token: Optional[str] = None, - ip_address: Optional[str] = None, - device_id: Optional[str] = None, - user_agent: Optional[str] = None, - signals_id: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + code_verifier: str | None = None, + invitation_token: str | None = None, + ip_address: str | None = None, + device_id: str | None = None, + user_agent: str | None = None, + signals_id: str | None = None, + request_options: RequestOptions | None = None, ) -> AuthenticateResponse: """Authenticate with code.""" - body: Dict[str, Any] = { + body: dict[str, Any] = { "grant_type": "authorization_code", "code": code, } @@ -258,14 +256,14 @@ def authenticate_with_refresh_token( self, *, refresh_token: str, - organization_id: Optional[str] = None, - ip_address: Optional[str] = None, - device_id: Optional[str] = None, - user_agent: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + organization_id: str | None = None, + ip_address: str | None = None, + device_id: str | None = None, + user_agent: str | None = None, + request_options: RequestOptions | None = None, ) -> AuthenticateResponse: """Authenticate with refresh token.""" - body: Dict[str, Any] = { + body: dict[str, Any] = { "grant_type": "refresh_token", "refresh_token": refresh_token, } @@ -295,15 +293,15 @@ def authenticate_with_magic_auth( *, code: str, email: str, - invitation_token: Optional[str] = None, - ip_address: Optional[str] = None, - device_id: Optional[str] = None, - user_agent: Optional[str] = None, - radar_auth_attempt_id: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + invitation_token: str | None = None, + ip_address: str | None = None, + device_id: str | None = None, + user_agent: str | None = None, + radar_auth_attempt_id: str | None = None, + request_options: RequestOptions | None = None, ) -> AuthenticateResponse: """Authenticate with magic auth.""" - body: Dict[str, Any] = { + body: dict[str, Any] = { "grant_type": "urn:workos:oauth:grant-type:magic-auth:code", "code": code, "email": email, @@ -336,13 +334,13 @@ def authenticate_with_email_verification( *, code: str, pending_authentication_token: str, - ip_address: Optional[str] = None, - device_id: Optional[str] = None, - user_agent: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + ip_address: str | None = None, + device_id: str | None = None, + user_agent: str | None = None, + request_options: RequestOptions | None = None, ) -> AuthenticateResponse: """Authenticate with email verification.""" - body: Dict[str, Any] = { + body: dict[str, Any] = { "grant_type": "urn:workos:oauth:grant-type:email-verification:code", "code": code, "pending_authentication_token": pending_authentication_token, @@ -372,13 +370,13 @@ def authenticate_with_totp( code: str, pending_authentication_token: str, authentication_challenge_id: str, - ip_address: Optional[str] = None, - device_id: Optional[str] = None, - user_agent: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + ip_address: str | None = None, + device_id: str | None = None, + user_agent: str | None = None, + request_options: RequestOptions | None = None, ) -> AuthenticateResponse: """Authenticate with totp.""" - body: Dict[str, Any] = { + body: dict[str, Any] = { "grant_type": "urn:workos:oauth:grant-type:mfa-totp", "code": code, "pending_authentication_token": pending_authentication_token, @@ -408,13 +406,13 @@ def authenticate_with_organization_selection( *, pending_authentication_token: str, organization_id: str, - ip_address: Optional[str] = None, - device_id: Optional[str] = None, - user_agent: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + ip_address: str | None = None, + device_id: str | None = None, + user_agent: str | None = None, + request_options: RequestOptions | None = None, ) -> AuthenticateResponse: """Authenticate with organization selection.""" - body: Dict[str, Any] = { + body: dict[str, Any] = { "grant_type": "urn:workos:oauth:grant-type:organization-selection", "pending_authentication_token": pending_authentication_token, "organization_id": organization_id, @@ -442,13 +440,13 @@ def authenticate_with_device_code( self, *, device_code: str, - ip_address: Optional[str] = None, - device_id: Optional[str] = None, - user_agent: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + ip_address: str | None = None, + device_id: str | None = None, + user_agent: str | None = None, + request_options: RequestOptions | None = None, ) -> AuthenticateResponse: """Authenticate with device code.""" - body: Dict[str, Any] = { + body: dict[str, Any] = { "grant_type": "urn:ietf:params:oauth:grant-type:device_code", "device_code": device_code, } @@ -475,13 +473,13 @@ def authenticate_with_radar_email_challenge( code: str, radar_challenge_id: str, pending_authentication_token: str, - ip_address: Optional[str] = None, - device_id: Optional[str] = None, - user_agent: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + ip_address: str | None = None, + device_id: str | None = None, + user_agent: str | None = None, + request_options: RequestOptions | None = None, ) -> AuthenticateResponse: """Authenticate with radar email challenge.""" - body: Dict[str, Any] = { + body: dict[str, Any] = { "grant_type": "urn:workos:oauth:grant-type:radar-email-challenge:code", "code": code, "radar_challenge_id": radar_challenge_id, @@ -513,13 +511,13 @@ def authenticate_with_radar_sms_challenge( verification_id: str, phone_number: str, pending_authentication_token: str, - ip_address: Optional[str] = None, - device_id: Optional[str] = None, - user_agent: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + ip_address: str | None = None, + device_id: str | None = None, + user_agent: str | None = None, + request_options: RequestOptions | None = None, ) -> AuthenticateResponse: """Authenticate with radar sms challenge.""" - body: Dict[str, Any] = { + body: dict[str, Any] = { "grant_type": "urn:workos:oauth:grant-type:radar-sms-challenge:code", "code": code, "verification_id": verification_id, @@ -548,25 +546,23 @@ def authenticate_with_radar_sms_challenge( def get_authorization_url( self, *, - code_challenge_method: Optional[Literal["S256"]] = None, - code_challenge: Optional[str] = None, - domain_hint: Optional[str] = None, - connection_id: Optional[str] = None, - provider_query_params: Optional[Dict[str, str]] = None, - provider_scopes: Optional[List[str]] = None, - invitation_token: Optional[str] = None, - max_age: Optional[int] = None, - screen_hint: Optional[ - Union[UserManagementAuthenticationScreenHint, str] - ] = None, - login_hint: Optional[str] = None, - provider: Optional[Union[UserManagementAuthenticationProvider, str]] = None, - prompt: Optional[str] = None, - state: Optional[str] = None, - organization_id: Optional[str] = None, + code_challenge_method: Literal["S256"] | None = None, + code_challenge: str | None = None, + domain_hint: str | None = None, + connection_id: str | None = None, + provider_query_params: dict[str, str] | None = None, + provider_scopes: list[str] | None = None, + invitation_token: str | None = None, + max_age: int | None = None, + screen_hint: UserManagementAuthenticationScreenHint | str | None = None, + login_hint: str | None = None, + provider: UserManagementAuthenticationProvider | str | None = None, + prompt: str | None = None, + state: str | None = None, + organization_id: str | None = None, redirect_uri: str, - client_id: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + client_id: str | None = None, + request_options: RequestOptions | None = None, ) -> str: """Get an authorization URL @@ -634,7 +630,7 @@ def create_device( self, *, client_id: str, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> DeviceAuthorizationResponse: """Get device authorization URL @@ -654,7 +650,7 @@ def create_device( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { "client_id": client_id, } return self._client.request( @@ -671,9 +667,9 @@ def create_radar_challenge( user_id: str, pending_authentication_token: str, phone_number: str, - ip_address: Optional[str] = None, - user_agent: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + ip_address: str | None = None, + user_agent: str | None = None, + request_options: RequestOptions | None = None, ) -> SendRadarSmsChallengeResponse: """Send a Radar SMS challenge @@ -695,7 +691,7 @@ def create_radar_challenge( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { k: v for k, v in { "user_id": user_id, @@ -718,7 +714,7 @@ def get_radar_challenge( self, id: str, *, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> RadarChallenge: """Get Radar Challenge details @@ -748,8 +744,8 @@ def get_logout_url( self, *, session_id: str, - return_to: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + return_to: str | None = None, + request_options: RequestOptions | None = None, ) -> str: """Logout @@ -783,7 +779,7 @@ def revoke_session( self, *, session_id: str, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> None: """Revoke Session @@ -799,7 +795,7 @@ def revoke_session( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { "session_id": session_id, } self._client.request( @@ -812,11 +808,11 @@ def revoke_session( def list_cors_origins( self, *, - limit: Optional[int] = None, - before: Optional[str] = None, - after: Optional[str] = None, - order: Optional[Union[PaginationOrder, str]] = "desc", - request_options: Optional[RequestOptions] = None, + limit: int | None = None, + before: str | None = None, + after: str | None = None, + order: PaginationOrder | str | None = "desc", + request_options: RequestOptions | None = None, ) -> SyncPage[CORSOriginResponse]: """List CORS origins @@ -859,7 +855,7 @@ def create_cors_origin( self, *, origin: str, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> CORSOriginResponse: """Create a CORS origin @@ -879,7 +875,7 @@ def create_cors_origin( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { "origin": origin, } return self._client.request( @@ -894,7 +890,7 @@ def get_email_verification( self, id: str, *, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> EmailVerification: """Get an email verification code @@ -924,7 +920,7 @@ def reset_password( self, *, email: str, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> PasswordReset: """Create a password reset token @@ -945,7 +941,7 @@ def reset_password( AuthenticationError: If the API key is invalid (401). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { "email": email, } return self._client.request( @@ -961,7 +957,7 @@ def confirm_password_reset( *, token: str, new_password: str, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> ResetPasswordResponse: """Reset the password @@ -984,7 +980,7 @@ def confirm_password_reset( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { "token": token, "new_password": new_password, } @@ -1000,7 +996,7 @@ def get_password_reset( self, id: str, *, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> PasswordReset: """Get a password reset token @@ -1029,14 +1025,14 @@ def get_password_reset( def list_users( self, *, - limit: Optional[int] = None, - before: Optional[str] = None, - after: Optional[str] = None, - order: Optional[Union[PaginationOrder, str]] = "desc", - organization: Optional[str] = None, - organization_id: Optional[str] = None, - email: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + limit: int | None = None, + before: str | None = None, + after: str | None = None, + order: PaginationOrder | str | None = "desc", + organization: str | None = None, + organization_id: str | None = None, + email: str | None = None, + request_options: RequestOptions | None = None, ) -> SyncPage[User]: """List users @@ -1086,17 +1082,17 @@ def create_user( self, *, email: str, - first_name: Union[str, None, NotGiven] = NOT_GIVEN, - last_name: Union[str, None, NotGiven] = NOT_GIVEN, - name: Union[str, None, NotGiven] = NOT_GIVEN, - email_verified: Union[bool, None, NotGiven] = NOT_GIVEN, - metadata: Union[Dict[str, str], None, NotGiven] = NOT_GIVEN, - external_id: Union[str, None, NotGiven] = NOT_GIVEN, - ip_address: Union[str, None, NotGiven] = NOT_GIVEN, - user_agent: Union[str, None, NotGiven] = NOT_GIVEN, - signals_id: Optional[str] = None, - password: Optional[Union[PasswordPlaintext, PasswordHashed]] = None, - request_options: Optional[RequestOptions] = None, + first_name: str | None | NotGiven = NOT_GIVEN, + last_name: str | None | NotGiven = NOT_GIVEN, + name: str | None | NotGiven = NOT_GIVEN, + email_verified: bool | None | NotGiven = NOT_GIVEN, + metadata: dict[str, str] | None | NotGiven = NOT_GIVEN, + external_id: str | None | NotGiven = NOT_GIVEN, + ip_address: str | None | NotGiven = NOT_GIVEN, + user_agent: str | None | NotGiven = NOT_GIVEN, + signals_id: str | None = None, + password: PasswordPlaintext | PasswordHashed | None = None, + request_options: RequestOptions | None = None, ) -> UserCreateResponse: """Create a user @@ -1127,7 +1123,7 @@ def create_user( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { k: v for k, v in { "email": email, @@ -1169,7 +1165,7 @@ def get_user_by_external_id( self, external_id: str, *, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> User: """Get a user by external ID @@ -1199,7 +1195,7 @@ def get_user( self, id: str, *, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> User: """Get a user @@ -1229,16 +1225,16 @@ def update_user( self, id: str, *, - email: Optional[str] = None, - first_name: Optional[str] = None, - last_name: Optional[str] = None, - name: Optional[str] = None, - email_verified: Optional[bool] = None, - metadata: Union[Dict[str, str], None, NotGiven] = NOT_GIVEN, - external_id: Union[str, None, NotGiven] = NOT_GIVEN, - locale: Union[str, None, NotGiven] = NOT_GIVEN, - password: Optional[Union[PasswordPlaintext, PasswordHashed]] = None, - request_options: Optional[RequestOptions] = None, + email: str | None = None, + first_name: str | None = None, + last_name: str | None = None, + name: str | None = None, + email_verified: bool | None = None, + metadata: dict[str, str] | None | NotGiven = NOT_GIVEN, + external_id: str | None | NotGiven = NOT_GIVEN, + locale: str | None | NotGiven = NOT_GIVEN, + password: PasswordPlaintext | PasswordHashed | None = None, + request_options: RequestOptions | None = None, ) -> User: """Update a user @@ -1267,7 +1263,7 @@ def update_user( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { k: v for k, v in { "email": email, @@ -1302,7 +1298,7 @@ def delete_user( self, id: str, *, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> None: """Delete a user @@ -1329,7 +1325,7 @@ def confirm_email_change( id: str, *, code: str, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> EmailChangeConfirmation: """Confirm email change @@ -1352,7 +1348,7 @@ def confirm_email_change( AuthenticationError: If the API key is invalid (401). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { "code": code, } return self._client.request( @@ -1368,7 +1364,7 @@ def send_email_change( id: str, *, new_email: str, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> EmailChange: """Send email change code @@ -1390,7 +1386,7 @@ def send_email_change( AuthenticationError: If the API key is invalid (401). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { "new_email": new_email, } return self._client.request( @@ -1406,7 +1402,7 @@ def verify_email( id: str, *, code: str, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> VerifyEmailResponse: """Verify email @@ -1428,7 +1424,7 @@ def verify_email( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { "code": code, } return self._client.request( @@ -1443,7 +1439,7 @@ def send_verification_email( self, id: str, *, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> SendVerificationEmailResponse: """Send verification email @@ -1474,8 +1470,8 @@ def get_user_identities( self, id: str, *, - request_options: Optional[RequestOptions] = None, - ) -> List[UserIdentitiesGetItem]: + request_options: RequestOptions | None = None, + ) -> list[UserIdentitiesGetItem]: """Get user identities Get a list of identities associated with the user. A user can have multiple associated identities after going through [identity linking](https://workos.com/docs/authkit/identity-linking). Currently only OAuth identities are supported. More provider types may be added in the future. @@ -1499,18 +1495,18 @@ def get_user_identities( request_options=request_options, ) return [ - UserIdentitiesGetItem.from_dict(cast(Dict[str, Any], item)) for item in raw + UserIdentitiesGetItem.from_dict(cast(dict[str, Any], item)) for item in raw ] def list_sessions( self, id: str, *, - limit: Optional[int] = None, - before: Optional[str] = None, - after: Optional[str] = None, - order: Optional[Union[PaginationOrder, str]] = "desc", - request_options: Optional[RequestOptions] = None, + limit: int | None = None, + before: str | None = None, + after: str | None = None, + order: PaginationOrder | str | None = "desc", + request_options: RequestOptions | None = None, ) -> SyncPage[UserSessionsListItem]: """List sessions @@ -1555,13 +1551,13 @@ def list_sessions( def list_invitations( self, *, - limit: Optional[int] = None, - before: Optional[str] = None, - after: Optional[str] = None, - order: Optional[Union[PaginationOrder, str]] = "desc", - organization_id: Optional[str] = None, - email: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + limit: int | None = None, + before: str | None = None, + after: str | None = None, + order: PaginationOrder | str | None = "desc", + organization_id: str | None = None, + email: str | None = None, + request_options: RequestOptions | None = None, ) -> SyncPage[UserInvite]: """List invitations @@ -1609,12 +1605,12 @@ def send_invitation( self, *, email: str, - organization_id: Optional[str] = None, - role_slug: Optional[str] = None, - expires_in_days: Optional[int] = None, - inviter_user_id: Optional[str] = None, - locale: Optional[Union[CreateUserInviteOptionsLocale, str]] = None, - request_options: Optional[RequestOptions] = None, + organization_id: str | None = None, + role_slug: str | None = None, + expires_in_days: int | None = None, + inviter_user_id: str | None = None, + locale: CreateUserInviteOptionsLocale | str | None = None, + request_options: RequestOptions | None = None, ) -> UserInvite: """Send an invitation @@ -1640,7 +1636,7 @@ def send_invitation( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { k: v for k, v in { "email": email, @@ -1664,7 +1660,7 @@ def find_invitation_by_token( self, token: str, *, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> UserInvite: """Find an invitation by token @@ -1694,7 +1690,7 @@ def get_invitation( self, id: str, *, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> UserInvite: """Get an invitation @@ -1724,7 +1720,7 @@ def accept_invitation( self, id: str, *, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> Invitation: """Accept an invitation @@ -1755,8 +1751,8 @@ def resend_invitation( self, id: str, *, - locale: Optional[Union[ResendUserInviteOptionsLocale, str]] = None, - request_options: Optional[RequestOptions] = None, + locale: ResendUserInviteOptionsLocale | str | None = None, + request_options: RequestOptions | None = None, ) -> UserInvite: """Resend an invitation @@ -1778,7 +1774,7 @@ def resend_invitation( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { k: v for k, v in { "locale": enum_value(locale) if locale is not None else None, @@ -1797,7 +1793,7 @@ def revoke_invitation( self, id: str, *, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> Invitation: """Revoke an invitation @@ -1826,7 +1822,7 @@ def revoke_invitation( def list_jwt_template( self, *, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> JWTTemplateResponse: """Get JWT template @@ -1852,7 +1848,7 @@ def update_jwt_template( self, *, content: str, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> JWTTemplateResponse: """Update JWT template @@ -1871,7 +1867,7 @@ def update_jwt_template( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { "content": content, } return self._client.request( @@ -1886,12 +1882,12 @@ def create_magic_auth( self, *, email: str, - invitation_token: Optional[str] = None, - ip_address: Optional[str] = None, - user_agent: Optional[str] = None, - radar_auth_attempt_id: Optional[str] = None, - signals_id: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + invitation_token: str | None = None, + ip_address: str | None = None, + user_agent: str | None = None, + radar_auth_attempt_id: str | None = None, + signals_id: str | None = None, + request_options: RequestOptions | None = None, ) -> MagicAuthSendMagicAuthCodeAndReturnResponse: """Create a Magic Auth code @@ -1916,7 +1912,7 @@ def create_magic_auth( AuthenticationError: If the API key is invalid (401). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { k: v for k, v in { "email": email, @@ -1940,7 +1936,7 @@ def get_magic_auth( self, id: str, *, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> MagicAuth: """Get Magic Auth code details @@ -1969,11 +1965,11 @@ def get_magic_auth( def list_redirect_uris( self, *, - limit: Optional[int] = None, - before: Optional[str] = None, - after: Optional[str] = None, - order: Optional[Union[PaginationOrder, str]] = "desc", - request_options: Optional[RequestOptions] = None, + limit: int | None = None, + before: str | None = None, + after: str | None = None, + order: PaginationOrder | str | None = "desc", + request_options: RequestOptions | None = None, ) -> SyncPage[RedirectUri]: """List redirect URIs @@ -2016,7 +2012,7 @@ def create_redirect_uri( self, *, uri: str, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> RedirectUri: """Create a redirect URI @@ -2036,7 +2032,7 @@ def create_redirect_uri( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { "uri": uri, } return self._client.request( @@ -2051,7 +2047,7 @@ def delete_redirect_uris( self, id: str, *, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> None: """Delete a redirect URI @@ -2078,11 +2074,11 @@ def list_user_authorized_applications( self, user_id: str, *, - limit: Optional[int] = None, - before: Optional[str] = None, - after: Optional[str] = None, - order: Optional[Union[PaginationOrder, str]] = "desc", - request_options: Optional[RequestOptions] = None, + limit: int | None = None, + before: str | None = None, + after: str | None = None, + order: PaginationOrder | str | None = "desc", + request_options: RequestOptions | None = None, ) -> SyncPage[AuthorizedConnectApplicationListData]: """List authorized applications @@ -2129,7 +2125,7 @@ def delete_user_authorized_application( application_id: str, user_id: str, *, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> None: """Delete an authorized application @@ -2162,12 +2158,12 @@ def list_user_api_keys( self, user_id: str, *, - limit: Optional[int] = None, - before: Optional[str] = None, - after: Optional[str] = None, - order: Optional[Union[PaginationOrder, str]] = "desc", - organization_id: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + limit: int | None = None, + before: str | None = None, + after: str | None = None, + order: PaginationOrder | str | None = "desc", + organization_id: str | None = None, + request_options: RequestOptions | None = None, ) -> SyncPage[UserApiKey]: """List API keys for a user @@ -2216,9 +2212,9 @@ def create_user_api_key( *, name: str, organization_id: str, - permissions: Optional[List[str]] = None, - expires_at: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + permissions: list[str] | None = None, + expires_at: str | None = None, + request_options: RequestOptions | None = None, ) -> UserApiKeyWithValue: """Create an API key for a user @@ -2243,7 +2239,7 @@ def create_user_api_key( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { k: v for k, v in { "name": name, @@ -2263,7 +2259,7 @@ def create_user_api_key( # @oagen-ignore-start - def get_jwks_url(self, client_id: Optional[str] = None) -> str: + def get_jwks_url(self, client_id: str | None = None) -> str: """Get the JWKS URL used to verify access tokens. Use this when integrating with a JWT library that fetches and caches @@ -2285,7 +2281,7 @@ def load_sealed_session( *, session_data: str, cookie_password: str, - ) -> "Session": + ) -> Session: """Create a Session object from sealed session data. Args: @@ -2308,10 +2304,10 @@ def authenticate_with_session_cookie( *, session_data: str, cookie_password: str, - ) -> Union[ - "AuthenticateWithSessionCookieSuccessResponse", - "AuthenticateWithSessionCookieErrorResponse", - ]: + ) -> ( + AuthenticateWithSessionCookieSuccessResponse + | AuthenticateWithSessionCookieErrorResponse + ): """One-shot authenticate a sealed session cookie. Args: @@ -2335,20 +2331,18 @@ def get_authorization_url_with_pkce( self, *, redirect_uri: str, - client_id: Optional[str] = None, - provider: Optional[Union[UserManagementAuthenticationProvider, str]] = None, - connection_id: Optional[str] = None, - organization_id: Optional[str] = None, - domain_hint: Optional[str] = None, - login_hint: Optional[str] = None, - screen_hint: Optional[ - Union[UserManagementAuthenticationScreenHint, str] - ] = None, - prompt: Optional[str] = None, - provider_scopes: Optional[List[str]] = None, - provider_query_params: Optional[Dict[str, str]] = None, - invitation_token: Optional[str] = None, - ) -> Dict[str, str]: + client_id: str | None = None, + provider: UserManagementAuthenticationProvider | str | None = None, + connection_id: str | None = None, + organization_id: str | None = None, + domain_hint: str | None = None, + login_hint: str | None = None, + screen_hint: UserManagementAuthenticationScreenHint | str | None = None, + prompt: str | None = None, + provider_scopes: list[str] | None = None, + provider_query_params: dict[str, str] | None = None, + invitation_token: str | None = None, + ) -> dict[str, str]: """Generate an AuthKit authorization URL with auto-generated PKCE parameters. Args: @@ -2398,11 +2392,11 @@ def authenticate_with_code_pkce( *, code: str, code_verifier: str, - client_id: Optional[str] = None, - ip_address: Optional[str] = None, - device_id: Optional[str] = None, - user_agent: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + client_id: str | None = None, + ip_address: str | None = None, + device_id: str | None = None, + user_agent: str | None = None, + request_options: RequestOptions | None = None, ) -> AuthenticateResponse: """Exchange an authorization code using a PKCE code_verifier. @@ -2419,7 +2413,7 @@ def authenticate_with_code_pkce( AuthenticateResponse: The authentication result with user and tokens. """ resolved_client_id = client_id or (self._client.client_id or "") - body: Dict[str, Any] = { + body: dict[str, Any] = { "grant_type": "authorization_code", "client_id": resolved_client_id, "code": code, @@ -2451,14 +2445,14 @@ def authenticate_with_code_pkce( class AsyncUserManagement: """User Management API resources (async).""" - def __init__(self, client: "AsyncWorkOSClient") -> None: + def __init__(self, client: AsyncWorkOSClient) -> None: self._client = client async def get_jwks( self, client_id: str, *, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> JwksResponse: """Get JWKS @@ -2487,20 +2481,18 @@ async def get_jwks( async def create_authenticate( self, *, - body: Union[ - AuthorizationCodeSessionAuthenticateRequest, - PasswordSessionAuthenticateRequest, - RefreshTokenSessionAuthenticateRequest, - MagicAuthCodeSessionAuthenticateRequest, - EmailVerificationCodeSessionAuthenticateRequest, - MFATotpSessionAuthenticateRequest, - OrganizationSelectionSessionAuthenticateRequest, - RadarEmailChallengeCodeSessionAuthenticateRequest, - RadarSmsChallengeCodeSessionAuthenticateRequest, - DeviceCodeSessionAuthenticateRequest, - Dict[str, Any], - ], - request_options: Optional[RequestOptions] = None, + body: AuthorizationCodeSessionAuthenticateRequest + | PasswordSessionAuthenticateRequest + | RefreshTokenSessionAuthenticateRequest + | MagicAuthCodeSessionAuthenticateRequest + | EmailVerificationCodeSessionAuthenticateRequest + | MFATotpSessionAuthenticateRequest + | OrganizationSelectionSessionAuthenticateRequest + | RadarEmailChallengeCodeSessionAuthenticateRequest + | RadarSmsChallengeCodeSessionAuthenticateRequest + | DeviceCodeSessionAuthenticateRequest + | dict[str, Any], + request_options: RequestOptions | None = None, ) -> AuthenticateResponse: """Authenticate @@ -2522,7 +2514,7 @@ async def create_authenticate( AuthenticationError: If the API key is invalid (401). ServerError: If the server returns a 5xx error. """ - _body: Dict[str, Any] = body if isinstance(body, dict) else body.to_dict() + _body: dict[str, Any] = body if isinstance(body, dict) else body.to_dict() return await self._client.request( method="post", path=("user_management", "authenticate"), @@ -2536,16 +2528,16 @@ async def authenticate_with_password( *, email: str, password: str, - invitation_token: Optional[str] = None, - ip_address: Optional[str] = None, - device_id: Optional[str] = None, - user_agent: Optional[str] = None, - signals_id: Optional[str] = None, - radar_auth_attempt_id: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + invitation_token: str | None = None, + ip_address: str | None = None, + device_id: str | None = None, + user_agent: str | None = None, + signals_id: str | None = None, + radar_auth_attempt_id: str | None = None, + request_options: RequestOptions | None = None, ) -> AuthenticateResponse: """Authenticate with password.""" - body: Dict[str, Any] = { + body: dict[str, Any] = { "grant_type": "password", "email": email, "password": password, @@ -2579,16 +2571,16 @@ async def authenticate_with_code( self, *, code: str, - code_verifier: Optional[str] = None, - invitation_token: Optional[str] = None, - ip_address: Optional[str] = None, - device_id: Optional[str] = None, - user_agent: Optional[str] = None, - signals_id: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + code_verifier: str | None = None, + invitation_token: str | None = None, + ip_address: str | None = None, + device_id: str | None = None, + user_agent: str | None = None, + signals_id: str | None = None, + request_options: RequestOptions | None = None, ) -> AuthenticateResponse: """Authenticate with code.""" - body: Dict[str, Any] = { + body: dict[str, Any] = { "grant_type": "authorization_code", "code": code, } @@ -2621,14 +2613,14 @@ async def authenticate_with_refresh_token( self, *, refresh_token: str, - organization_id: Optional[str] = None, - ip_address: Optional[str] = None, - device_id: Optional[str] = None, - user_agent: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + organization_id: str | None = None, + ip_address: str | None = None, + device_id: str | None = None, + user_agent: str | None = None, + request_options: RequestOptions | None = None, ) -> AuthenticateResponse: """Authenticate with refresh token.""" - body: Dict[str, Any] = { + body: dict[str, Any] = { "grant_type": "refresh_token", "refresh_token": refresh_token, } @@ -2658,15 +2650,15 @@ async def authenticate_with_magic_auth( *, code: str, email: str, - invitation_token: Optional[str] = None, - ip_address: Optional[str] = None, - device_id: Optional[str] = None, - user_agent: Optional[str] = None, - radar_auth_attempt_id: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + invitation_token: str | None = None, + ip_address: str | None = None, + device_id: str | None = None, + user_agent: str | None = None, + radar_auth_attempt_id: str | None = None, + request_options: RequestOptions | None = None, ) -> AuthenticateResponse: """Authenticate with magic auth.""" - body: Dict[str, Any] = { + body: dict[str, Any] = { "grant_type": "urn:workos:oauth:grant-type:magic-auth:code", "code": code, "email": email, @@ -2699,13 +2691,13 @@ async def authenticate_with_email_verification( *, code: str, pending_authentication_token: str, - ip_address: Optional[str] = None, - device_id: Optional[str] = None, - user_agent: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + ip_address: str | None = None, + device_id: str | None = None, + user_agent: str | None = None, + request_options: RequestOptions | None = None, ) -> AuthenticateResponse: """Authenticate with email verification.""" - body: Dict[str, Any] = { + body: dict[str, Any] = { "grant_type": "urn:workos:oauth:grant-type:email-verification:code", "code": code, "pending_authentication_token": pending_authentication_token, @@ -2735,13 +2727,13 @@ async def authenticate_with_totp( code: str, pending_authentication_token: str, authentication_challenge_id: str, - ip_address: Optional[str] = None, - device_id: Optional[str] = None, - user_agent: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + ip_address: str | None = None, + device_id: str | None = None, + user_agent: str | None = None, + request_options: RequestOptions | None = None, ) -> AuthenticateResponse: """Authenticate with totp.""" - body: Dict[str, Any] = { + body: dict[str, Any] = { "grant_type": "urn:workos:oauth:grant-type:mfa-totp", "code": code, "pending_authentication_token": pending_authentication_token, @@ -2771,13 +2763,13 @@ async def authenticate_with_organization_selection( *, pending_authentication_token: str, organization_id: str, - ip_address: Optional[str] = None, - device_id: Optional[str] = None, - user_agent: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + ip_address: str | None = None, + device_id: str | None = None, + user_agent: str | None = None, + request_options: RequestOptions | None = None, ) -> AuthenticateResponse: """Authenticate with organization selection.""" - body: Dict[str, Any] = { + body: dict[str, Any] = { "grant_type": "urn:workos:oauth:grant-type:organization-selection", "pending_authentication_token": pending_authentication_token, "organization_id": organization_id, @@ -2805,13 +2797,13 @@ async def authenticate_with_device_code( self, *, device_code: str, - ip_address: Optional[str] = None, - device_id: Optional[str] = None, - user_agent: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + ip_address: str | None = None, + device_id: str | None = None, + user_agent: str | None = None, + request_options: RequestOptions | None = None, ) -> AuthenticateResponse: """Authenticate with device code.""" - body: Dict[str, Any] = { + body: dict[str, Any] = { "grant_type": "urn:ietf:params:oauth:grant-type:device_code", "device_code": device_code, } @@ -2838,13 +2830,13 @@ async def authenticate_with_radar_email_challenge( code: str, radar_challenge_id: str, pending_authentication_token: str, - ip_address: Optional[str] = None, - device_id: Optional[str] = None, - user_agent: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + ip_address: str | None = None, + device_id: str | None = None, + user_agent: str | None = None, + request_options: RequestOptions | None = None, ) -> AuthenticateResponse: """Authenticate with radar email challenge.""" - body: Dict[str, Any] = { + body: dict[str, Any] = { "grant_type": "urn:workos:oauth:grant-type:radar-email-challenge:code", "code": code, "radar_challenge_id": radar_challenge_id, @@ -2876,13 +2868,13 @@ async def authenticate_with_radar_sms_challenge( verification_id: str, phone_number: str, pending_authentication_token: str, - ip_address: Optional[str] = None, - device_id: Optional[str] = None, - user_agent: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + ip_address: str | None = None, + device_id: str | None = None, + user_agent: str | None = None, + request_options: RequestOptions | None = None, ) -> AuthenticateResponse: """Authenticate with radar sms challenge.""" - body: Dict[str, Any] = { + body: dict[str, Any] = { "grant_type": "urn:workos:oauth:grant-type:radar-sms-challenge:code", "code": code, "verification_id": verification_id, @@ -2911,25 +2903,23 @@ async def authenticate_with_radar_sms_challenge( def get_authorization_url( self, *, - code_challenge_method: Optional[Literal["S256"]] = None, - code_challenge: Optional[str] = None, - domain_hint: Optional[str] = None, - connection_id: Optional[str] = None, - provider_query_params: Optional[Dict[str, str]] = None, - provider_scopes: Optional[List[str]] = None, - invitation_token: Optional[str] = None, - max_age: Optional[int] = None, - screen_hint: Optional[ - Union[UserManagementAuthenticationScreenHint, str] - ] = None, - login_hint: Optional[str] = None, - provider: Optional[Union[UserManagementAuthenticationProvider, str]] = None, - prompt: Optional[str] = None, - state: Optional[str] = None, - organization_id: Optional[str] = None, + code_challenge_method: Literal["S256"] | None = None, + code_challenge: str | None = None, + domain_hint: str | None = None, + connection_id: str | None = None, + provider_query_params: dict[str, str] | None = None, + provider_scopes: list[str] | None = None, + invitation_token: str | None = None, + max_age: int | None = None, + screen_hint: UserManagementAuthenticationScreenHint | str | None = None, + login_hint: str | None = None, + provider: UserManagementAuthenticationProvider | str | None = None, + prompt: str | None = None, + state: str | None = None, + organization_id: str | None = None, redirect_uri: str, - client_id: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + client_id: str | None = None, + request_options: RequestOptions | None = None, ) -> str: """Get an authorization URL @@ -2997,7 +2987,7 @@ async def create_device( self, *, client_id: str, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> DeviceAuthorizationResponse: """Get device authorization URL @@ -3017,7 +3007,7 @@ async def create_device( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { "client_id": client_id, } return await self._client.request( @@ -3034,9 +3024,9 @@ async def create_radar_challenge( user_id: str, pending_authentication_token: str, phone_number: str, - ip_address: Optional[str] = None, - user_agent: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + ip_address: str | None = None, + user_agent: str | None = None, + request_options: RequestOptions | None = None, ) -> SendRadarSmsChallengeResponse: """Send a Radar SMS challenge @@ -3058,7 +3048,7 @@ async def create_radar_challenge( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { k: v for k, v in { "user_id": user_id, @@ -3081,7 +3071,7 @@ async def get_radar_challenge( self, id: str, *, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> RadarChallenge: """Get Radar Challenge details @@ -3111,8 +3101,8 @@ def get_logout_url( self, *, session_id: str, - return_to: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + return_to: str | None = None, + request_options: RequestOptions | None = None, ) -> str: """Logout @@ -3146,7 +3136,7 @@ async def revoke_session( self, *, session_id: str, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> None: """Revoke Session @@ -3162,7 +3152,7 @@ async def revoke_session( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { "session_id": session_id, } await self._client.request( @@ -3175,11 +3165,11 @@ async def revoke_session( async def list_cors_origins( self, *, - limit: Optional[int] = None, - before: Optional[str] = None, - after: Optional[str] = None, - order: Optional[Union[PaginationOrder, str]] = "desc", - request_options: Optional[RequestOptions] = None, + limit: int | None = None, + before: str | None = None, + after: str | None = None, + order: PaginationOrder | str | None = "desc", + request_options: RequestOptions | None = None, ) -> AsyncPage[CORSOriginResponse]: """List CORS origins @@ -3222,7 +3212,7 @@ async def create_cors_origin( self, *, origin: str, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> CORSOriginResponse: """Create a CORS origin @@ -3242,7 +3232,7 @@ async def create_cors_origin( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { "origin": origin, } return await self._client.request( @@ -3257,7 +3247,7 @@ async def get_email_verification( self, id: str, *, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> EmailVerification: """Get an email verification code @@ -3287,7 +3277,7 @@ async def reset_password( self, *, email: str, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> PasswordReset: """Create a password reset token @@ -3308,7 +3298,7 @@ async def reset_password( AuthenticationError: If the API key is invalid (401). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { "email": email, } return await self._client.request( @@ -3324,7 +3314,7 @@ async def confirm_password_reset( *, token: str, new_password: str, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> ResetPasswordResponse: """Reset the password @@ -3347,7 +3337,7 @@ async def confirm_password_reset( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { "token": token, "new_password": new_password, } @@ -3363,7 +3353,7 @@ async def get_password_reset( self, id: str, *, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> PasswordReset: """Get a password reset token @@ -3392,14 +3382,14 @@ async def get_password_reset( async def list_users( self, *, - limit: Optional[int] = None, - before: Optional[str] = None, - after: Optional[str] = None, - order: Optional[Union[PaginationOrder, str]] = "desc", - organization: Optional[str] = None, - organization_id: Optional[str] = None, - email: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + limit: int | None = None, + before: str | None = None, + after: str | None = None, + order: PaginationOrder | str | None = "desc", + organization: str | None = None, + organization_id: str | None = None, + email: str | None = None, + request_options: RequestOptions | None = None, ) -> AsyncPage[User]: """List users @@ -3449,17 +3439,17 @@ async def create_user( self, *, email: str, - first_name: Union[str, None, NotGiven] = NOT_GIVEN, - last_name: Union[str, None, NotGiven] = NOT_GIVEN, - name: Union[str, None, NotGiven] = NOT_GIVEN, - email_verified: Union[bool, None, NotGiven] = NOT_GIVEN, - metadata: Union[Dict[str, str], None, NotGiven] = NOT_GIVEN, - external_id: Union[str, None, NotGiven] = NOT_GIVEN, - ip_address: Union[str, None, NotGiven] = NOT_GIVEN, - user_agent: Union[str, None, NotGiven] = NOT_GIVEN, - signals_id: Optional[str] = None, - password: Optional[Union[PasswordPlaintext, PasswordHashed]] = None, - request_options: Optional[RequestOptions] = None, + first_name: str | None | NotGiven = NOT_GIVEN, + last_name: str | None | NotGiven = NOT_GIVEN, + name: str | None | NotGiven = NOT_GIVEN, + email_verified: bool | None | NotGiven = NOT_GIVEN, + metadata: dict[str, str] | None | NotGiven = NOT_GIVEN, + external_id: str | None | NotGiven = NOT_GIVEN, + ip_address: str | None | NotGiven = NOT_GIVEN, + user_agent: str | None | NotGiven = NOT_GIVEN, + signals_id: str | None = None, + password: PasswordPlaintext | PasswordHashed | None = None, + request_options: RequestOptions | None = None, ) -> UserCreateResponse: """Create a user @@ -3490,7 +3480,7 @@ async def create_user( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { k: v for k, v in { "email": email, @@ -3532,7 +3522,7 @@ async def get_user_by_external_id( self, external_id: str, *, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> User: """Get a user by external ID @@ -3562,7 +3552,7 @@ async def get_user( self, id: str, *, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> User: """Get a user @@ -3592,16 +3582,16 @@ async def update_user( self, id: str, *, - email: Optional[str] = None, - first_name: Optional[str] = None, - last_name: Optional[str] = None, - name: Optional[str] = None, - email_verified: Optional[bool] = None, - metadata: Union[Dict[str, str], None, NotGiven] = NOT_GIVEN, - external_id: Union[str, None, NotGiven] = NOT_GIVEN, - locale: Union[str, None, NotGiven] = NOT_GIVEN, - password: Optional[Union[PasswordPlaintext, PasswordHashed]] = None, - request_options: Optional[RequestOptions] = None, + email: str | None = None, + first_name: str | None = None, + last_name: str | None = None, + name: str | None = None, + email_verified: bool | None = None, + metadata: dict[str, str] | None | NotGiven = NOT_GIVEN, + external_id: str | None | NotGiven = NOT_GIVEN, + locale: str | None | NotGiven = NOT_GIVEN, + password: PasswordPlaintext | PasswordHashed | None = None, + request_options: RequestOptions | None = None, ) -> User: """Update a user @@ -3630,7 +3620,7 @@ async def update_user( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { k: v for k, v in { "email": email, @@ -3665,7 +3655,7 @@ async def delete_user( self, id: str, *, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> None: """Delete a user @@ -3692,7 +3682,7 @@ async def confirm_email_change( id: str, *, code: str, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> EmailChangeConfirmation: """Confirm email change @@ -3715,7 +3705,7 @@ async def confirm_email_change( AuthenticationError: If the API key is invalid (401). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { "code": code, } return await self._client.request( @@ -3731,7 +3721,7 @@ async def send_email_change( id: str, *, new_email: str, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> EmailChange: """Send email change code @@ -3753,7 +3743,7 @@ async def send_email_change( AuthenticationError: If the API key is invalid (401). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { "new_email": new_email, } return await self._client.request( @@ -3769,7 +3759,7 @@ async def verify_email( id: str, *, code: str, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> VerifyEmailResponse: """Verify email @@ -3791,7 +3781,7 @@ async def verify_email( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { "code": code, } return await self._client.request( @@ -3806,7 +3796,7 @@ async def send_verification_email( self, id: str, *, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> SendVerificationEmailResponse: """Send verification email @@ -3837,8 +3827,8 @@ async def get_user_identities( self, id: str, *, - request_options: Optional[RequestOptions] = None, - ) -> List[UserIdentitiesGetItem]: + request_options: RequestOptions | None = None, + ) -> list[UserIdentitiesGetItem]: """Get user identities Get a list of identities associated with the user. A user can have multiple associated identities after going through [identity linking](https://workos.com/docs/authkit/identity-linking). Currently only OAuth identities are supported. More provider types may be added in the future. @@ -3862,18 +3852,18 @@ async def get_user_identities( request_options=request_options, ) return [ - UserIdentitiesGetItem.from_dict(cast(Dict[str, Any], item)) for item in raw + UserIdentitiesGetItem.from_dict(cast(dict[str, Any], item)) for item in raw ] async def list_sessions( self, id: str, *, - limit: Optional[int] = None, - before: Optional[str] = None, - after: Optional[str] = None, - order: Optional[Union[PaginationOrder, str]] = "desc", - request_options: Optional[RequestOptions] = None, + limit: int | None = None, + before: str | None = None, + after: str | None = None, + order: PaginationOrder | str | None = "desc", + request_options: RequestOptions | None = None, ) -> AsyncPage[UserSessionsListItem]: """List sessions @@ -3918,13 +3908,13 @@ async def list_sessions( async def list_invitations( self, *, - limit: Optional[int] = None, - before: Optional[str] = None, - after: Optional[str] = None, - order: Optional[Union[PaginationOrder, str]] = "desc", - organization_id: Optional[str] = None, - email: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + limit: int | None = None, + before: str | None = None, + after: str | None = None, + order: PaginationOrder | str | None = "desc", + organization_id: str | None = None, + email: str | None = None, + request_options: RequestOptions | None = None, ) -> AsyncPage[UserInvite]: """List invitations @@ -3972,12 +3962,12 @@ async def send_invitation( self, *, email: str, - organization_id: Optional[str] = None, - role_slug: Optional[str] = None, - expires_in_days: Optional[int] = None, - inviter_user_id: Optional[str] = None, - locale: Optional[Union[CreateUserInviteOptionsLocale, str]] = None, - request_options: Optional[RequestOptions] = None, + organization_id: str | None = None, + role_slug: str | None = None, + expires_in_days: int | None = None, + inviter_user_id: str | None = None, + locale: CreateUserInviteOptionsLocale | str | None = None, + request_options: RequestOptions | None = None, ) -> UserInvite: """Send an invitation @@ -4003,7 +3993,7 @@ async def send_invitation( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { k: v for k, v in { "email": email, @@ -4027,7 +4017,7 @@ async def find_invitation_by_token( self, token: str, *, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> UserInvite: """Find an invitation by token @@ -4057,7 +4047,7 @@ async def get_invitation( self, id: str, *, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> UserInvite: """Get an invitation @@ -4087,7 +4077,7 @@ async def accept_invitation( self, id: str, *, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> Invitation: """Accept an invitation @@ -4118,8 +4108,8 @@ async def resend_invitation( self, id: str, *, - locale: Optional[Union[ResendUserInviteOptionsLocale, str]] = None, - request_options: Optional[RequestOptions] = None, + locale: ResendUserInviteOptionsLocale | str | None = None, + request_options: RequestOptions | None = None, ) -> UserInvite: """Resend an invitation @@ -4141,7 +4131,7 @@ async def resend_invitation( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { k: v for k, v in { "locale": enum_value(locale) if locale is not None else None, @@ -4160,7 +4150,7 @@ async def revoke_invitation( self, id: str, *, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> Invitation: """Revoke an invitation @@ -4189,7 +4179,7 @@ async def revoke_invitation( async def list_jwt_template( self, *, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> JWTTemplateResponse: """Get JWT template @@ -4215,7 +4205,7 @@ async def update_jwt_template( self, *, content: str, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> JWTTemplateResponse: """Update JWT template @@ -4234,7 +4224,7 @@ async def update_jwt_template( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { "content": content, } return await self._client.request( @@ -4249,12 +4239,12 @@ async def create_magic_auth( self, *, email: str, - invitation_token: Optional[str] = None, - ip_address: Optional[str] = None, - user_agent: Optional[str] = None, - radar_auth_attempt_id: Optional[str] = None, - signals_id: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + invitation_token: str | None = None, + ip_address: str | None = None, + user_agent: str | None = None, + radar_auth_attempt_id: str | None = None, + signals_id: str | None = None, + request_options: RequestOptions | None = None, ) -> MagicAuthSendMagicAuthCodeAndReturnResponse: """Create a Magic Auth code @@ -4279,7 +4269,7 @@ async def create_magic_auth( AuthenticationError: If the API key is invalid (401). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { k: v for k, v in { "email": email, @@ -4303,7 +4293,7 @@ async def get_magic_auth( self, id: str, *, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> MagicAuth: """Get Magic Auth code details @@ -4332,11 +4322,11 @@ async def get_magic_auth( async def list_redirect_uris( self, *, - limit: Optional[int] = None, - before: Optional[str] = None, - after: Optional[str] = None, - order: Optional[Union[PaginationOrder, str]] = "desc", - request_options: Optional[RequestOptions] = None, + limit: int | None = None, + before: str | None = None, + after: str | None = None, + order: PaginationOrder | str | None = "desc", + request_options: RequestOptions | None = None, ) -> AsyncPage[RedirectUri]: """List redirect URIs @@ -4379,7 +4369,7 @@ async def create_redirect_uri( self, *, uri: str, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> RedirectUri: """Create a redirect URI @@ -4399,7 +4389,7 @@ async def create_redirect_uri( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { "uri": uri, } return await self._client.request( @@ -4414,7 +4404,7 @@ async def delete_redirect_uris( self, id: str, *, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> None: """Delete a redirect URI @@ -4441,11 +4431,11 @@ async def list_user_authorized_applications( self, user_id: str, *, - limit: Optional[int] = None, - before: Optional[str] = None, - after: Optional[str] = None, - order: Optional[Union[PaginationOrder, str]] = "desc", - request_options: Optional[RequestOptions] = None, + limit: int | None = None, + before: str | None = None, + after: str | None = None, + order: PaginationOrder | str | None = "desc", + request_options: RequestOptions | None = None, ) -> AsyncPage[AuthorizedConnectApplicationListData]: """List authorized applications @@ -4492,7 +4482,7 @@ async def delete_user_authorized_application( application_id: str, user_id: str, *, - request_options: Optional[RequestOptions] = None, + request_options: RequestOptions | None = None, ) -> None: """Delete an authorized application @@ -4525,12 +4515,12 @@ async def list_user_api_keys( self, user_id: str, *, - limit: Optional[int] = None, - before: Optional[str] = None, - after: Optional[str] = None, - order: Optional[Union[PaginationOrder, str]] = "desc", - organization_id: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + limit: int | None = None, + before: str | None = None, + after: str | None = None, + order: PaginationOrder | str | None = "desc", + organization_id: str | None = None, + request_options: RequestOptions | None = None, ) -> AsyncPage[UserApiKey]: """List API keys for a user @@ -4579,9 +4569,9 @@ async def create_user_api_key( *, name: str, organization_id: str, - permissions: Optional[List[str]] = None, - expires_at: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + permissions: list[str] | None = None, + expires_at: str | None = None, + request_options: RequestOptions | None = None, ) -> UserApiKeyWithValue: """Create an API key for a user @@ -4606,7 +4596,7 @@ async def create_user_api_key( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { + body: dict[str, Any] = { k: v for k, v in { "name": name, @@ -4626,7 +4616,7 @@ async def create_user_api_key( # @oagen-ignore-start - def get_jwks_url(self, client_id: Optional[str] = None) -> str: + def get_jwks_url(self, client_id: str | None = None) -> str: """Get the JWKS URL used to verify access tokens. Use this when integrating with a JWT library that fetches and caches @@ -4648,7 +4638,7 @@ def load_sealed_session( *, session_data: str, cookie_password: str, - ) -> "AsyncSession": + ) -> AsyncSession: """Create an AsyncSession object from sealed session data. Args: @@ -4671,10 +4661,10 @@ def authenticate_with_session_cookie( *, session_data: str, cookie_password: str, - ) -> Union[ - "AuthenticateWithSessionCookieSuccessResponse", - "AuthenticateWithSessionCookieErrorResponse", - ]: + ) -> ( + AuthenticateWithSessionCookieSuccessResponse + | AuthenticateWithSessionCookieErrorResponse + ): """One-shot authenticate a sealed session cookie. Args: @@ -4698,20 +4688,18 @@ async def get_authorization_url_with_pkce( self, *, redirect_uri: str, - client_id: Optional[str] = None, - provider: Optional[Union[UserManagementAuthenticationProvider, str]] = None, - connection_id: Optional[str] = None, - organization_id: Optional[str] = None, - domain_hint: Optional[str] = None, - login_hint: Optional[str] = None, - screen_hint: Optional[ - Union[UserManagementAuthenticationScreenHint, str] - ] = None, - prompt: Optional[str] = None, - provider_scopes: Optional[List[str]] = None, - provider_query_params: Optional[Dict[str, str]] = None, - invitation_token: Optional[str] = None, - ) -> Dict[str, str]: + client_id: str | None = None, + provider: UserManagementAuthenticationProvider | str | None = None, + connection_id: str | None = None, + organization_id: str | None = None, + domain_hint: str | None = None, + login_hint: str | None = None, + screen_hint: UserManagementAuthenticationScreenHint | str | None = None, + prompt: str | None = None, + provider_scopes: list[str] | None = None, + provider_query_params: dict[str, str] | None = None, + invitation_token: str | None = None, + ) -> dict[str, str]: """Generate an AuthKit authorization URL with auto-generated PKCE parameters. Args: @@ -4761,11 +4749,11 @@ async def authenticate_with_code_pkce( *, code: str, code_verifier: str, - client_id: Optional[str] = None, - ip_address: Optional[str] = None, - device_id: Optional[str] = None, - user_agent: Optional[str] = None, - request_options: Optional[RequestOptions] = None, + client_id: str | None = None, + ip_address: str | None = None, + device_id: str | None = None, + user_agent: str | None = None, + request_options: RequestOptions | None = None, ) -> AuthenticateResponse: """Exchange an authorization code using a PKCE code_verifier. @@ -4782,7 +4770,7 @@ async def authenticate_with_code_pkce( AuthenticateResponse: The authentication result with user and tokens. """ resolved_client_id = client_id or (self._client.client_id or "") - body: Dict[str, Any] = { + body: dict[str, Any] = { "grant_type": "authorization_code", "client_id": resolved_client_id, "code": code, diff --git a/src/workos/user_management/models/__init__.py b/src/workos/user_management/models/__init__.py index 8a8759d8..141601d9 100644 --- a/src/workos/user_management/models/__init__.py +++ b/src/workos/user_management/models/__init__.py @@ -1,9 +1,17 @@ # This file is auto-generated by oagen. Do not edit. -from .authenticate_response import AuthenticateResponse as AuthenticateResponse from workos.common.models.authenticate_response_impersonator import ( AuthenticateResponseImpersonator as AuthenticateResponseImpersonator, ) +from workos.common.models.user import User as User +from workos.common.models.user_sessions_impersonator import ( + UserSessionsImpersonator as UserSessionsImpersonator, +) +from workos.common.models.user_sessions_list_item import ( + UserSessionsListItem as UserSessionsListItem, +) + +from .authenticate_response import AuthenticateResponse as AuthenticateResponse from .authenticate_response_oauth_token import ( AuthenticateResponseOAuthToken as AuthenticateResponseOAuthToken, ) @@ -96,7 +104,6 @@ ) from .update_jwt_template import UpdateJWTTemplate as UpdateJWTTemplate from .update_user import UpdateUser as UpdateUser -from workos.common.models.user import User as User from .user_api_key import UserApiKey as UserApiKey from .user_api_key_owner import UserApiKeyOwner as UserApiKeyOwner from .user_api_key_with_value import UserApiKeyWithValue as UserApiKeyWithValue @@ -112,11 +119,5 @@ from .user_management_authentication_screen_hint import ( UserManagementAuthenticationScreenHint as UserManagementAuthenticationScreenHint, ) -from workos.common.models.user_sessions_impersonator import ( - UserSessionsImpersonator as UserSessionsImpersonator, -) -from workos.common.models.user_sessions_list_item import ( - UserSessionsListItem as UserSessionsListItem, -) from .verify_email_address import VerifyEmailAddress as VerifyEmailAddress from .verify_email_response import VerifyEmailResponse as VerifyEmailResponse diff --git a/src/workos/user_management/models/authenticate_response.py b/src/workos/user_management/models/authenticate_response.py index 5f2b6284..321d9db5 100644 --- a/src/workos/user_management/models/authenticate_response.py +++ b/src/workos/user_management/models/authenticate_response.py @@ -4,47 +4,47 @@ from dataclasses import dataclass from enum import Enum -from typing import cast -from typing import Any, Dict, Optional -from workos._types import _raise_deserialize_error +from typing import Any, cast +from workos._types import _raise_deserialize_error +from workos.common.models.authenticate_response_authentication_method import ( + AuthenticateResponseAuthenticationMethod, +) from workos.common.models.authenticate_response_impersonator import ( AuthenticateResponseImpersonator, ) -from .authenticate_response_oauth_token import AuthenticateResponseOAuthToken from workos.common.models.user import User -from workos.common.models.authenticate_response_authentication_method import ( - AuthenticateResponseAuthenticationMethod, -) + +from .authenticate_response_oauth_token import AuthenticateResponseOAuthToken @dataclass(slots=True) class AuthenticateResponse: """Authenticate Response model.""" - user: "User" + user: User """The corresponding [user](https://workos.com/docs/reference/authkit/user) object.""" access_token: str """A JWT containing information about the current session.""" refresh_token: str """[Exchange this token](https://workos.com/docs/reference/authkit/authentication/refresh-token) for a new access token.""" - organization_id: Optional[str] = None + organization_id: str | None = None """The ID of the organization the user selected to sign in to.""" - authkit_authorization_code: Optional[str] = None + authkit_authorization_code: str | None = None """An authorization code that can be exchanged for tokens by a different application.""" - authentication_method: Optional["AuthenticateResponseAuthenticationMethod"] = None + authentication_method: AuthenticateResponseAuthenticationMethod | None = None """The authentication method used to initiate the session.""" - impersonator: Optional["AuthenticateResponseImpersonator"] = None + impersonator: AuthenticateResponseImpersonator | None = None """Information about the impersonator if this session was created via impersonation.""" - oauth_tokens: Optional["AuthenticateResponseOAuthToken"] = None + oauth_tokens: AuthenticateResponseOAuthToken | None = None """The OAuth tokens from the identity provider, if applicable.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "AuthenticateResponse": + def from_dict(cls, data: dict[str, Any]) -> AuthenticateResponse: """Deserialize from a dictionary.""" try: return cls( - user=User.from_dict(cast(Dict[str, Any], data["user"])), + user=User.from_dict(cast(dict[str, Any], data["user"])), access_token=data["access_token"], refresh_token=data["refresh_token"], organization_id=data.get("organization_id"), @@ -56,12 +56,12 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuthenticateResponse": is not None else None, impersonator=AuthenticateResponseImpersonator.from_dict( - cast(Dict[str, Any], _v_impersonator) + cast(dict[str, Any], _v_impersonator) ) if (_v_impersonator := data.get("impersonator")) is not None else None, oauth_tokens=AuthenticateResponseOAuthToken.from_dict( - cast(Dict[str, Any], _v_oauth_tokens) + cast(dict[str, Any], _v_oauth_tokens) ) if (_v_oauth_tokens := data.get("oauth_tokens")) is not None else None, @@ -69,9 +69,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuthenticateResponse": except (KeyError, ValueError) as e: _raise_deserialize_error("AuthenticateResponse", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["user"] = self.user.to_dict() result["access_token"] = self.access_token result["refresh_token"] = self.refresh_token diff --git a/src/workos/user_management/models/authenticate_response_oauth_token.py b/src/workos/user_management/models/authenticate_response_oauth_token.py index 7cb9add6..c21e6fa0 100644 --- a/src/workos/user_management/models/authenticate_response_oauth_token.py +++ b/src/workos/user_management/models/authenticate_response_oauth_token.py @@ -3,7 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Dict, List +from typing import Any + from workos._types import _raise_deserialize_error @@ -19,11 +20,11 @@ class AuthenticateResponseOAuthToken: """The access token from the OAuth provider.""" expires_at: int """The timestamp at which the access token expires.""" - scopes: List[str] + scopes: list[str] """A list of OAuth scopes for which the access token is authorized.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "AuthenticateResponseOAuthToken": + def from_dict(cls, data: dict[str, Any]) -> AuthenticateResponseOAuthToken: """Deserialize from a dictionary.""" try: return cls( @@ -36,9 +37,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuthenticateResponseOAuthToken": except (KeyError, ValueError) as e: _raise_deserialize_error("AuthenticateResponseOAuthToken", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["provider"] = self.provider result["refresh_token"] = self.refresh_token result["access_token"] = self.access_token diff --git a/src/workos/user_management/models/authorization_code_session_authenticate_request.py b/src/workos/user_management/models/authorization_code_session_authenticate_request.py index 954eb45a..74fad2c5 100644 --- a/src/workos/user_management/models/authorization_code_session_authenticate_request.py +++ b/src/workos/user_management/models/authorization_code_session_authenticate_request.py @@ -3,7 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Dict, Literal, Optional +from typing import Any, Literal + from workos._types import _raise_deserialize_error @@ -16,25 +17,25 @@ class AuthorizationCodeSessionAuthenticateRequest: grant_type: Literal["authorization_code"] code: str """The authorization code received from the redirect.""" - client_secret: Optional[str] = None + client_secret: str | None = None """The client secret of the application. May be omitted by public clients that authenticate through other means, such as a PKCE `code_verifier`.""" - code_verifier: Optional[str] = None + code_verifier: str | None = None """The PKCE code verifier used to derive the code challenge passed to the authorization URL.""" - invitation_token: Optional[str] = None + invitation_token: str | None = None """An invitation token to accept during authentication.""" - ip_address: Optional[str] = None + ip_address: str | None = None """The IP address of the user's request.""" - device_id: Optional[str] = None + device_id: str | None = None """A unique identifier for the device.""" - user_agent: Optional[str] = None + user_agent: str | None = None """The user agent string from the user's browser.""" - signals_id: Optional[str] = None + signals_id: str | None = None """An optional Radar signals ID to correlate client-side signals with this authentication attempt.""" @classmethod def from_dict( - cls, data: Dict[str, Any] - ) -> "AuthorizationCodeSessionAuthenticateRequest": + cls, data: dict[str, Any] + ) -> AuthorizationCodeSessionAuthenticateRequest: """Deserialize from a dictionary.""" try: return cls( @@ -52,9 +53,9 @@ def from_dict( except (KeyError, ValueError) as e: _raise_deserialize_error("AuthorizationCodeSessionAuthenticateRequest", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["client_id"] = self.client_id result["grant_type"] = self.grant_type result["code"] = self.code diff --git a/src/workos/user_management/models/authorized_connect_application_list_data.py b/src/workos/user_management/models/authorized_connect_application_list_data.py index bfb44d31..afa8576d 100644 --- a/src/workos/user_management/models/authorized_connect_application_list_data.py +++ b/src/workos/user_management/models/authorized_connect_application_list_data.py @@ -3,10 +3,9 @@ from __future__ import annotations from dataclasses import dataclass -from typing import cast -from typing import Any, Dict, List, Literal, Optional -from workos._types import _raise_deserialize_error +from typing import Any, Literal, cast +from workos._types import _raise_deserialize_error from workos.common.models.connect_application import ( ConnectApplication, ConnectApplicationVariant, @@ -21,14 +20,14 @@ class AuthorizedConnectApplicationListData: """Distinguishes the authorized connect application object.""" id: str """The unique ID of the authorized connect application.""" - granted_scopes: List[str] + granted_scopes: list[str] """The scopes granted by the user to the application.""" - application: "ConnectApplicationVariant" - oauth_resource: Optional[str] = None + application: ConnectApplicationVariant + oauth_resource: str | None = None """The OAuth resource associated with the authorized connect application, if one was requested.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "AuthorizedConnectApplicationListData": + def from_dict(cls, data: dict[str, Any]) -> AuthorizedConnectApplicationListData: """Deserialize from a dictionary.""" try: return cls( @@ -36,16 +35,16 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuthorizedConnectApplicationListDat id=data["id"], granted_scopes=data["granted_scopes"], application=ConnectApplication.from_dict( - cast(Dict[str, Any], data["application"]) + cast(dict[str, Any], data["application"]) ), oauth_resource=data.get("oauth_resource"), ) except (KeyError, ValueError) as e: _raise_deserialize_error("AuthorizedConnectApplicationListData", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["object"] = self.object result["id"] = self.id result["granted_scopes"] = self.granted_scopes diff --git a/src/workos/user_management/models/confirm_email_change.py b/src/workos/user_management/models/confirm_email_change.py index de692cb5..24f4643d 100644 --- a/src/workos/user_management/models/confirm_email_change.py +++ b/src/workos/user_management/models/confirm_email_change.py @@ -1,6 +1,7 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias + from workos.multi_factor_auth.models.authentication_challenges_verify_request import ( AuthenticationChallengesVerifyRequest, ) diff --git a/src/workos/user_management/models/cors_origin_response.py b/src/workos/user_management/models/cors_origin_response.py index 9a7fc9e3..b148cbb1 100644 --- a/src/workos/user_management/models/cors_origin_response.py +++ b/src/workos/user_management/models/cors_origin_response.py @@ -4,9 +4,9 @@ from dataclasses import dataclass from datetime import datetime -from typing import Any, Dict, Literal -from workos._types import _raise_deserialize_error -from workos._types import _format_datetime, _parse_datetime +from typing import Any, Literal + +from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error @dataclass(slots=True) @@ -25,7 +25,7 @@ class CORSOriginResponse: """Timestamp when the CORS origin was last updated.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "CORSOriginResponse": + def from_dict(cls, data: dict[str, Any]) -> CORSOriginResponse: """Deserialize from a dictionary.""" try: return cls( @@ -38,9 +38,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "CORSOriginResponse": except (KeyError, ValueError) as e: _raise_deserialize_error("CORSOriginResponse", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["object"] = self.object result["id"] = self.id result["origin"] = self.origin diff --git a/src/workos/user_management/models/create_cors_origin.py b/src/workos/user_management/models/create_cors_origin.py index bf68cd6a..4d241ae6 100644 --- a/src/workos/user_management/models/create_cors_origin.py +++ b/src/workos/user_management/models/create_cors_origin.py @@ -3,7 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Dict +from typing import Any + from workos._types import _raise_deserialize_error @@ -15,7 +16,7 @@ class CreateCORSOrigin: """The origin URL to allow for CORS requests.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "CreateCORSOrigin": + def from_dict(cls, data: dict[str, Any]) -> CreateCORSOrigin: """Deserialize from a dictionary.""" try: return cls( @@ -24,8 +25,8 @@ def from_dict(cls, data: Dict[str, Any]) -> "CreateCORSOrigin": except (KeyError, ValueError) as e: _raise_deserialize_error("CreateCORSOrigin", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["origin"] = self.origin return result diff --git a/src/workos/user_management/models/create_magic_code_and_return.py b/src/workos/user_management/models/create_magic_code_and_return.py index 6a9db8fe..eccf846f 100644 --- a/src/workos/user_management/models/create_magic_code_and_return.py +++ b/src/workos/user_management/models/create_magic_code_and_return.py @@ -3,7 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Dict, Optional +from typing import Any + from workos._types import _raise_deserialize_error @@ -13,19 +14,19 @@ class CreateMagicCodeAndReturn: email: str """The email address to send the magic code to.""" - invitation_token: Optional[str] = None + invitation_token: str | None = None """The invitation token to associate with this magic code.""" - ip_address: Optional[str] = None + ip_address: str | None = None """The IP address of the user's request.""" - user_agent: Optional[str] = None + user_agent: str | None = None """The user agent string from the user's request.""" - radar_auth_attempt_id: Optional[str] = None + radar_auth_attempt_id: str | None = None """The ID of an existing Radar authentication attempt to associate with this request.""" - signals_id: Optional[str] = None + signals_id: str | None = None """An optional Radar signals ID to correlate client-side signals with this request.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "CreateMagicCodeAndReturn": + def from_dict(cls, data: dict[str, Any]) -> CreateMagicCodeAndReturn: """Deserialize from a dictionary.""" try: return cls( @@ -39,9 +40,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "CreateMagicCodeAndReturn": except (KeyError, ValueError) as e: _raise_deserialize_error("CreateMagicCodeAndReturn", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["email"] = self.email if self.invitation_token is not None: result["invitation_token"] = self.invitation_token diff --git a/src/workos/user_management/models/create_password_reset.py b/src/workos/user_management/models/create_password_reset.py index d1151d0f..3abbd6b7 100644 --- a/src/workos/user_management/models/create_password_reset.py +++ b/src/workos/user_management/models/create_password_reset.py @@ -3,7 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Dict +from typing import Any + from workos._types import _raise_deserialize_error @@ -17,7 +18,7 @@ class CreatePasswordReset: """The new password to set for the user.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "CreatePasswordReset": + def from_dict(cls, data: dict[str, Any]) -> CreatePasswordReset: """Deserialize from a dictionary.""" try: return cls( @@ -27,9 +28,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "CreatePasswordReset": except (KeyError, ValueError) as e: _raise_deserialize_error("CreatePasswordReset", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["token"] = self.token result["new_password"] = self.new_password return result diff --git a/src/workos/user_management/models/create_password_reset_token.py b/src/workos/user_management/models/create_password_reset_token.py index 20529f1a..2a49b972 100644 --- a/src/workos/user_management/models/create_password_reset_token.py +++ b/src/workos/user_management/models/create_password_reset_token.py @@ -3,7 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Dict +from typing import Any + from workos._types import _raise_deserialize_error @@ -15,7 +16,7 @@ class CreatePasswordResetToken: """The email address of the user requesting a password reset.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "CreatePasswordResetToken": + def from_dict(cls, data: dict[str, Any]) -> CreatePasswordResetToken: """Deserialize from a dictionary.""" try: return cls( @@ -24,8 +25,8 @@ def from_dict(cls, data: Dict[str, Any]) -> "CreatePasswordResetToken": except (KeyError, ValueError) as e: _raise_deserialize_error("CreatePasswordResetToken", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["email"] = self.email return result diff --git a/src/workos/user_management/models/create_redirect_uri.py b/src/workos/user_management/models/create_redirect_uri.py index f838eab8..c3816403 100644 --- a/src/workos/user_management/models/create_redirect_uri.py +++ b/src/workos/user_management/models/create_redirect_uri.py @@ -3,7 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Dict +from typing import Any + from workos._types import _raise_deserialize_error @@ -15,7 +16,7 @@ class CreateRedirectUri: """The redirect URI to create.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "CreateRedirectUri": + def from_dict(cls, data: dict[str, Any]) -> CreateRedirectUri: """Deserialize from a dictionary.""" try: return cls( @@ -24,8 +25,8 @@ def from_dict(cls, data: Dict[str, Any]) -> "CreateRedirectUri": except (KeyError, ValueError) as e: _raise_deserialize_error("CreateRedirectUri", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["uri"] = self.uri return result diff --git a/src/workos/user_management/models/create_user.py b/src/workos/user_management/models/create_user.py index d67a6c95..2d12323a 100644 --- a/src/workos/user_management/models/create_user.py +++ b/src/workos/user_management/models/create_user.py @@ -4,7 +4,8 @@ from dataclasses import dataclass from enum import Enum -from typing import Any, Dict, Optional +from typing import Any + from workos._types import _raise_deserialize_error from workos.common.models.create_user_password_hash_type import ( CreateUserPasswordHashType, @@ -17,33 +18,33 @@ class CreateUser: email: str """The email address of the user.""" - first_name: Optional[str] = None + first_name: str | None = None """The first name of the user.""" - last_name: Optional[str] = None + last_name: str | None = None """The last name of the user.""" - name: Optional[str] = None + name: str | None = None """The user's full name.""" - email_verified: Optional[bool] = None + email_verified: bool | None = None """Whether the user's email has been verified.""" - metadata: Optional[Dict[str, str]] = None + metadata: dict[str, str] | None = None """Object containing metadata key/value pairs associated with the user.""" - external_id: Optional[str] = None + external_id: str | None = None """The external ID of the user.""" - ip_address: Optional[str] = None + ip_address: str | None = None """The IP address of the user's request.""" - user_agent: Optional[str] = None + user_agent: str | None = None """The user agent string from the user's request.""" - signals_id: Optional[str] = None + signals_id: str | None = None """An optional Radar signals ID to correlate client-side signals with this request.""" - password: Optional[str] = None + password: str | None = None """The password to set for the user. Mutually exclusive with `password_hash` and `password_hash_type`.""" - password_hash: Optional[str] = None + password_hash: str | None = None """The hashed password to set for the user. Required with `password_hash_type`. Mutually exclusive with `password`.""" - password_hash_type: Optional["CreateUserPasswordHashType"] = None + password_hash_type: CreateUserPasswordHashType | None = None """The algorithm originally used to hash the password, used when providing a `password_hash`. Required with `password_hash`. Mutually exclusive with `password`.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "CreateUser": + def from_dict(cls, data: dict[str, Any]) -> CreateUser: """Deserialize from a dictionary.""" try: return cls( @@ -66,9 +67,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "CreateUser": except (KeyError, ValueError) as e: _raise_deserialize_error("CreateUser", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["email"] = self.email if self.first_name is not None: result["first_name"] = self.first_name diff --git a/src/workos/user_management/models/create_user_api_key.py b/src/workos/user_management/models/create_user_api_key.py index 6cecf59a..5ba44079 100644 --- a/src/workos/user_management/models/create_user_api_key.py +++ b/src/workos/user_management/models/create_user_api_key.py @@ -4,9 +4,9 @@ from dataclasses import dataclass from datetime import datetime -from typing import Any, Dict, List, Optional -from workos._types import _raise_deserialize_error -from workos._types import _format_datetime, _parse_datetime +from typing import Any + +from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error @dataclass(slots=True) @@ -17,13 +17,13 @@ class CreateUserApiKey: """A descriptive name for the API key.""" organization_id: str """The ID of the organization the user API key is associated with. The user must have an active membership in this organization.""" - permissions: Optional[List[str]] = None + permissions: list[str] | None = None """The permission slugs to assign to the API key. Each permission must be enabled for user API keys.""" - expires_at: Optional[datetime] = None + expires_at: datetime | None = None """The timestamp when the API key should expire. Must be a future timestamp. If omitted, the key does not expire.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "CreateUserApiKey": + def from_dict(cls, data: dict[str, Any]) -> CreateUserApiKey: """Deserialize from a dictionary.""" try: return cls( @@ -37,9 +37,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "CreateUserApiKey": except (KeyError, ValueError) as e: _raise_deserialize_error("CreateUserApiKey", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["name"] = self.name result["organization_id"] = self.organization_id if self.permissions is not None: diff --git a/src/workos/user_management/models/create_user_invite_options.py b/src/workos/user_management/models/create_user_invite_options.py index 49bc6e28..809be466 100644 --- a/src/workos/user_management/models/create_user_invite_options.py +++ b/src/workos/user_management/models/create_user_invite_options.py @@ -4,7 +4,8 @@ from dataclasses import dataclass from enum import Enum -from typing import Any, Dict, Optional +from typing import Any + from workos._types import _raise_deserialize_error from workos.common.models.create_user_invite_options_locale import ( CreateUserInviteOptionsLocale, @@ -17,19 +18,19 @@ class CreateUserInviteOptions: email: str """The email address of the recipient.""" - organization_id: Optional[str] = None + organization_id: str | None = None """The ID of the [organization](https://workos.com/docs/reference/organization) that the recipient will join.""" - role_slug: Optional[str] = None + role_slug: str | None = None """The [role](https://workos.com/docs/authkit/roles) that the recipient will receive when they join the organization in the invitation.""" - expires_in_days: Optional[int] = None + expires_in_days: int | None = None """How many days the invitations will be valid for. Must be between 1 and 30 days. Defaults to 7 days if not specified.""" - inviter_user_id: Optional[str] = None + inviter_user_id: str | None = None """The ID of the [user](https://workos.com/docs/reference/authkit/user) who invites the recipient. The invitation email will mention the name of this user.""" - locale: Optional["CreateUserInviteOptionsLocale"] = None + locale: CreateUserInviteOptionsLocale | None = None """The locale to use when rendering the invitation email. See [supported locales](https://workos.com/docs/authkit/hosted-ui/localization).""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "CreateUserInviteOptions": + def from_dict(cls, data: dict[str, Any]) -> CreateUserInviteOptions: """Deserialize from a dictionary.""" try: return cls( @@ -45,9 +46,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "CreateUserInviteOptions": except (KeyError, ValueError) as e: _raise_deserialize_error("CreateUserInviteOptions", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["email"] = self.email if self.organization_id is not None: result["organization_id"] = self.organization_id diff --git a/src/workos/user_management/models/device_authorization_response.py b/src/workos/user_management/models/device_authorization_response.py index 2ef7eb88..1bea3aca 100644 --- a/src/workos/user_management/models/device_authorization_response.py +++ b/src/workos/user_management/models/device_authorization_response.py @@ -3,7 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Dict, Optional +from typing import Any + from workos._types import _raise_deserialize_error @@ -19,13 +20,13 @@ class DeviceAuthorizationResponse: """The end-user verification URI.""" expires_in: float """Lifetime in seconds of the codes.""" - verification_uri_complete: Optional[str] = None + verification_uri_complete: str | None = None """Verification URI that includes the user code.""" - interval: Optional[float] = None + interval: float | None = None """Minimum polling interval in seconds.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "DeviceAuthorizationResponse": + def from_dict(cls, data: dict[str, Any]) -> DeviceAuthorizationResponse: """Deserialize from a dictionary.""" try: return cls( @@ -39,9 +40,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "DeviceAuthorizationResponse": except (KeyError, ValueError) as e: _raise_deserialize_error("DeviceAuthorizationResponse", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["device_code"] = self.device_code result["user_code"] = self.user_code result["verification_uri"] = self.verification_uri diff --git a/src/workos/user_management/models/device_code_session_authenticate_request.py b/src/workos/user_management/models/device_code_session_authenticate_request.py index f37ff5ab..19a13f98 100644 --- a/src/workos/user_management/models/device_code_session_authenticate_request.py +++ b/src/workos/user_management/models/device_code_session_authenticate_request.py @@ -3,7 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Dict, Literal, Optional +from typing import Any, Literal + from workos._types import _raise_deserialize_error @@ -16,15 +17,15 @@ class DeviceCodeSessionAuthenticateRequest: grant_type: Literal["urn:ietf:params:oauth:grant-type:device_code"] device_code: str """The device verification code.""" - ip_address: Optional[str] = None + ip_address: str | None = None """The IP address of the user's request.""" - device_id: Optional[str] = None + device_id: str | None = None """A unique identifier for the device.""" - user_agent: Optional[str] = None + user_agent: str | None = None """The user agent string from the user's browser.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "DeviceCodeSessionAuthenticateRequest": + def from_dict(cls, data: dict[str, Any]) -> DeviceCodeSessionAuthenticateRequest: """Deserialize from a dictionary.""" try: return cls( @@ -40,9 +41,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "DeviceCodeSessionAuthenticateReques except (KeyError, ValueError) as e: _raise_deserialize_error("DeviceCodeSessionAuthenticateRequest", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["client_id"] = self.client_id result["grant_type"] = self.grant_type result["device_code"] = self.device_code diff --git a/src/workos/user_management/models/email_change_confirmation.py b/src/workos/user_management/models/email_change_confirmation.py index 9f82c4b3..bafb36e9 100644 --- a/src/workos/user_management/models/email_change_confirmation.py +++ b/src/workos/user_management/models/email_change_confirmation.py @@ -3,8 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import cast -from typing import Any, Dict, Literal +from typing import Any, Literal, cast + from workos._types import _raise_deserialize_error from .email_change_confirmation_user import EmailChangeConfirmationUser @@ -16,25 +16,25 @@ class EmailChangeConfirmation: object: Literal["email_change_confirmation"] """Distinguishes the email change confirmation object.""" - user: "EmailChangeConfirmationUser" + user: EmailChangeConfirmationUser """The user object.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "EmailChangeConfirmation": + def from_dict(cls, data: dict[str, Any]) -> EmailChangeConfirmation: """Deserialize from a dictionary.""" try: return cls( object=data.get("object", "email_change_confirmation"), user=EmailChangeConfirmationUser.from_dict( - cast(Dict[str, Any], data["user"]) + cast(dict[str, Any], data["user"]) ), ) except (KeyError, ValueError) as e: _raise_deserialize_error("EmailChangeConfirmation", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["object"] = self.object result["user"] = self.user.to_dict() return result diff --git a/src/workos/user_management/models/email_verification.py b/src/workos/user_management/models/email_verification.py index 1a95c8ae..8f54c166 100644 --- a/src/workos/user_management/models/email_verification.py +++ b/src/workos/user_management/models/email_verification.py @@ -4,9 +4,9 @@ from dataclasses import dataclass from datetime import datetime -from typing import Any, Dict, Literal -from workos._types import _raise_deserialize_error -from workos._types import _format_datetime, _parse_datetime +from typing import Any, Literal + +from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error @dataclass(slots=True) @@ -31,7 +31,7 @@ class EmailVerification: """The code used to verify the email.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "EmailVerification": + def from_dict(cls, data: dict[str, Any]) -> EmailVerification: """Deserialize from a dictionary.""" try: return cls( @@ -47,9 +47,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "EmailVerification": except (KeyError, ValueError) as e: _raise_deserialize_error("EmailVerification", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["object"] = self.object result["id"] = self.id result["user_id"] = self.user_id diff --git a/src/workos/user_management/models/email_verification_code_session_authenticate_request.py b/src/workos/user_management/models/email_verification_code_session_authenticate_request.py index ca121c01..2f758f3b 100644 --- a/src/workos/user_management/models/email_verification_code_session_authenticate_request.py +++ b/src/workos/user_management/models/email_verification_code_session_authenticate_request.py @@ -3,7 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Dict, Literal, Optional +from typing import Any, Literal + from workos._types import _raise_deserialize_error @@ -20,17 +21,17 @@ class EmailVerificationCodeSessionAuthenticateRequest: """The email verification code.""" pending_authentication_token: str """The pending authentication token from a previous authentication attempt.""" - ip_address: Optional[str] = None + ip_address: str | None = None """The IP address of the user's request.""" - device_id: Optional[str] = None + device_id: str | None = None """A unique identifier for the device.""" - user_agent: Optional[str] = None + user_agent: str | None = None """The user agent string from the user's browser.""" @classmethod def from_dict( - cls, data: Dict[str, Any] - ) -> "EmailVerificationCodeSessionAuthenticateRequest": + cls, data: dict[str, Any] + ) -> EmailVerificationCodeSessionAuthenticateRequest: """Deserialize from a dictionary.""" try: return cls( @@ -50,9 +51,9 @@ def from_dict( "EmailVerificationCodeSessionAuthenticateRequest", e ) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["client_id"] = self.client_id result["client_secret"] = self.client_secret result["grant_type"] = self.grant_type diff --git a/src/workos/user_management/models/invitation.py b/src/workos/user_management/models/invitation.py index b5090b5a..05aed65f 100644 --- a/src/workos/user_management/models/invitation.py +++ b/src/workos/user_management/models/invitation.py @@ -5,9 +5,9 @@ from dataclasses import dataclass from datetime import datetime from enum import Enum -from typing import Any, Dict, Literal, Optional -from workos._types import _raise_deserialize_error -from workos._types import _format_datetime, _parse_datetime +from typing import Any, Literal + +from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error from workos.common.models.invitation_state import InvitationState @@ -21,21 +21,21 @@ class Invitation: """The unique ID of the invitation.""" email: str """The email address of the recipient.""" - state: "InvitationState" + state: InvitationState """The state of the invitation.""" - accepted_at: Optional[datetime] + accepted_at: datetime | None """The timestamp when the invitation was accepted, or null if not yet accepted.""" - revoked_at: Optional[datetime] + revoked_at: datetime | None """The timestamp when the invitation was revoked, or null if not revoked.""" expires_at: datetime """The timestamp when the invitation expires.""" - organization_id: Optional[str] + organization_id: str | None """The ID of the [organization](https://workos.com/docs/reference/organization) that the recipient will join.""" - inviter_user_id: Optional[str] + inviter_user_id: str | None """The ID of the user who invited the recipient, if provided.""" - accepted_user_id: Optional[str] + accepted_user_id: str | None """The ID of the user who accepted the invitation, once accepted.""" - role_slug: Optional[str] + role_slug: str | None """Slug of the role the invitee will be assigned on acceptance. Reflects the current role on the invitee's organization membership. null when the invitation has no associated organization.""" created_at: datetime """An ISO 8601 timestamp.""" @@ -47,7 +47,7 @@ class Invitation: """The URL where the recipient can accept the invitation.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "Invitation": + def from_dict(cls, data: dict[str, Any]) -> Invitation: """Deserialize from a dictionary.""" try: return cls( @@ -74,9 +74,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "Invitation": except (KeyError, ValueError) as e: _raise_deserialize_error("Invitation", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["object"] = self.object result["id"] = self.id result["email"] = self.email diff --git a/src/workos/user_management/models/jwks_response.py b/src/workos/user_management/models/jwks_response.py index b0e7f14d..20e5816c 100644 --- a/src/workos/user_management/models/jwks_response.py +++ b/src/workos/user_management/models/jwks_response.py @@ -3,8 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import cast -from typing import Any, Dict, List +from typing import Any, cast + from workos._types import _raise_deserialize_error from .jwks_response_keys import JwksResponseKeys @@ -14,24 +14,24 @@ class JwksResponse: """Jwks Response model.""" - keys: List["JwksResponseKeys"] + keys: list[JwksResponseKeys] """The public keys used for verifying access tokens.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "JwksResponse": + def from_dict(cls, data: dict[str, Any]) -> JwksResponse: """Deserialize from a dictionary.""" try: return cls( keys=[ - JwksResponseKeys.from_dict(cast(Dict[str, Any], item)) + JwksResponseKeys.from_dict(cast(dict[str, Any], item)) for item in cast(list[Any], data["keys"]) ], ) except (KeyError, ValueError) as e: _raise_deserialize_error("JwksResponse", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["keys"] = [item.to_dict() for item in self.keys] return result diff --git a/src/workos/user_management/models/jwks_response_keys.py b/src/workos/user_management/models/jwks_response_keys.py index bfddcf59..a97581c2 100644 --- a/src/workos/user_management/models/jwks_response_keys.py +++ b/src/workos/user_management/models/jwks_response_keys.py @@ -3,7 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Dict, List, Literal +from typing import Any, Literal + from workos._types import _raise_deserialize_error @@ -17,7 +18,7 @@ class JwksResponseKeys: """Key type.""" use: Literal["sig"] """Key use (signature).""" - x_5_c: List[str] + x_5_c: list[str] """X.509 certificate chain.""" n: str """RSA modulus.""" @@ -29,7 +30,7 @@ class JwksResponseKeys: """X.509 certificate SHA-256 thumbprint.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "JwksResponseKeys": + def from_dict(cls, data: dict[str, Any]) -> JwksResponseKeys: """Deserialize from a dictionary.""" try: return cls( @@ -45,9 +46,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "JwksResponseKeys": except (KeyError, ValueError) as e: _raise_deserialize_error("JwksResponseKeys", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["alg"] = self.alg result["kty"] = self.kty result["use"] = self.use diff --git a/src/workos/user_management/models/jwt_template_response.py b/src/workos/user_management/models/jwt_template_response.py index 69a8104f..fc451e4a 100644 --- a/src/workos/user_management/models/jwt_template_response.py +++ b/src/workos/user_management/models/jwt_template_response.py @@ -3,7 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Dict, Literal +from typing import Any, Literal + from workos._types import _raise_deserialize_error @@ -21,7 +22,7 @@ class JWTTemplateResponse: """The timestamp when the JWT template was last updated.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "JWTTemplateResponse": + def from_dict(cls, data: dict[str, Any]) -> JWTTemplateResponse: """Deserialize from a dictionary.""" try: return cls( @@ -33,9 +34,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "JWTTemplateResponse": except (KeyError, ValueError) as e: _raise_deserialize_error("JWTTemplateResponse", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["object"] = self.object result["content"] = self.content result["created_at"] = self.created_at diff --git a/src/workos/user_management/models/magic_auth.py b/src/workos/user_management/models/magic_auth.py index 44bf6d91..61e27df9 100644 --- a/src/workos/user_management/models/magic_auth.py +++ b/src/workos/user_management/models/magic_auth.py @@ -4,9 +4,9 @@ from dataclasses import dataclass from datetime import datetime -from typing import Any, Dict, Literal -from workos._types import _raise_deserialize_error -from workos._types import _format_datetime, _parse_datetime +from typing import Any, Literal + +from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error @dataclass(slots=True) @@ -31,7 +31,7 @@ class MagicAuth: """The code used to verify the Magic Auth code.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "MagicAuth": + def from_dict(cls, data: dict[str, Any]) -> MagicAuth: """Deserialize from a dictionary.""" try: return cls( @@ -47,9 +47,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "MagicAuth": except (KeyError, ValueError) as e: _raise_deserialize_error("MagicAuth", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["object"] = self.object result["id"] = self.id result["user_id"] = self.user_id diff --git a/src/workos/user_management/models/magic_auth_code_session_authenticate_request.py b/src/workos/user_management/models/magic_auth_code_session_authenticate_request.py index b5ae2669..6537769e 100644 --- a/src/workos/user_management/models/magic_auth_code_session_authenticate_request.py +++ b/src/workos/user_management/models/magic_auth_code_session_authenticate_request.py @@ -3,7 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Dict, Literal, Optional +from typing import Any, Literal + from workos._types import _raise_deserialize_error @@ -20,21 +21,19 @@ class MagicAuthCodeSessionAuthenticateRequest: """The one-time code for Magic Auth authentication.""" email: str """The user's email address.""" - invitation_token: Optional[str] = None + invitation_token: str | None = None """An invitation token to accept during authentication.""" - ip_address: Optional[str] = None + ip_address: str | None = None """The IP address of the user's request.""" - device_id: Optional[str] = None + device_id: str | None = None """A unique identifier for the device.""" - user_agent: Optional[str] = None + user_agent: str | None = None """The user agent string from the user's browser.""" - radar_auth_attempt_id: Optional[str] = None + radar_auth_attempt_id: str | None = None """The ID of an existing Radar authentication attempt to associate with this authentication.""" @classmethod - def from_dict( - cls, data: Dict[str, Any] - ) -> "MagicAuthCodeSessionAuthenticateRequest": + def from_dict(cls, data: dict[str, Any]) -> MagicAuthCodeSessionAuthenticateRequest: """Deserialize from a dictionary.""" try: return cls( @@ -54,9 +53,9 @@ def from_dict( except (KeyError, ValueError) as e: _raise_deserialize_error("MagicAuthCodeSessionAuthenticateRequest", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["client_id"] = self.client_id result["client_secret"] = self.client_secret result["grant_type"] = self.grant_type diff --git a/src/workos/user_management/models/magic_auth_send_magic_auth_code_and_return_response.py b/src/workos/user_management/models/magic_auth_send_magic_auth_code_and_return_response.py index 23eeba40..de3a4329 100644 --- a/src/workos/user_management/models/magic_auth_send_magic_auth_code_and_return_response.py +++ b/src/workos/user_management/models/magic_auth_send_magic_auth_code_and_return_response.py @@ -4,9 +4,9 @@ from dataclasses import dataclass from datetime import datetime -from typing import Any, Dict, Literal, Optional -from workos._types import _raise_deserialize_error -from workos._types import _format_datetime, _parse_datetime +from typing import Any, Literal + +from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error @dataclass(slots=True) @@ -29,13 +29,13 @@ class MagicAuthSendMagicAuthCodeAndReturnResponse: """An ISO 8601 timestamp.""" code: str """The code used to verify the Magic Auth code.""" - radar_auth_attempt_id: Optional[str] = None + radar_auth_attempt_id: str | None = None """The ID of the Radar authentication attempt created for this request when Radar is enabled. Pass this value to the authenticate endpoint to associate the subsequent authentication with this Radar attempt.""" @classmethod def from_dict( - cls, data: Dict[str, Any] - ) -> "MagicAuthSendMagicAuthCodeAndReturnResponse": + cls, data: dict[str, Any] + ) -> MagicAuthSendMagicAuthCodeAndReturnResponse: """Deserialize from a dictionary.""" try: return cls( @@ -52,9 +52,9 @@ def from_dict( except (KeyError, ValueError) as e: _raise_deserialize_error("MagicAuthSendMagicAuthCodeAndReturnResponse", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["object"] = self.object result["id"] = self.id result["user_id"] = self.user_id diff --git a/src/workos/user_management/models/mfa_totp_session_authenticate_request.py b/src/workos/user_management/models/mfa_totp_session_authenticate_request.py index c8c67644..8290c638 100644 --- a/src/workos/user_management/models/mfa_totp_session_authenticate_request.py +++ b/src/workos/user_management/models/mfa_totp_session_authenticate_request.py @@ -3,7 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Dict, Literal, Optional +from typing import Any, Literal + from workos._types import _raise_deserialize_error @@ -22,15 +23,15 @@ class MFATotpSessionAuthenticateRequest: """The pending authentication token from a previous authentication attempt.""" authentication_challenge_id: str """The ID of the MFA authentication challenge.""" - ip_address: Optional[str] = None + ip_address: str | None = None """The IP address of the user's request.""" - device_id: Optional[str] = None + device_id: str | None = None """A unique identifier for the device.""" - user_agent: Optional[str] = None + user_agent: str | None = None """The user agent string from the user's browser.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "MFATotpSessionAuthenticateRequest": + def from_dict(cls, data: dict[str, Any]) -> MFATotpSessionAuthenticateRequest: """Deserialize from a dictionary.""" try: return cls( @@ -49,9 +50,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "MFATotpSessionAuthenticateRequest": except (KeyError, ValueError) as e: _raise_deserialize_error("MFATotpSessionAuthenticateRequest", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["client_id"] = self.client_id result["client_secret"] = self.client_secret result["grant_type"] = self.grant_type diff --git a/src/workos/user_management/models/organization_selection_session_authenticate_request.py b/src/workos/user_management/models/organization_selection_session_authenticate_request.py index 74f8ab42..8f268b2e 100644 --- a/src/workos/user_management/models/organization_selection_session_authenticate_request.py +++ b/src/workos/user_management/models/organization_selection_session_authenticate_request.py @@ -3,7 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Dict, Literal, Optional +from typing import Any, Literal + from workos._types import _raise_deserialize_error @@ -20,17 +21,17 @@ class OrganizationSelectionSessionAuthenticateRequest: """The pending authentication token from a previous authentication attempt.""" organization_id: str """The ID of the organization the user selected.""" - ip_address: Optional[str] = None + ip_address: str | None = None """The IP address of the user's request.""" - device_id: Optional[str] = None + device_id: str | None = None """A unique identifier for the device.""" - user_agent: Optional[str] = None + user_agent: str | None = None """The user agent string from the user's browser.""" @classmethod def from_dict( - cls, data: Dict[str, Any] - ) -> "OrganizationSelectionSessionAuthenticateRequest": + cls, data: dict[str, Any] + ) -> OrganizationSelectionSessionAuthenticateRequest: """Deserialize from a dictionary.""" try: return cls( @@ -50,9 +51,9 @@ def from_dict( "OrganizationSelectionSessionAuthenticateRequest", e ) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["client_id"] = self.client_id result["client_secret"] = self.client_secret result["grant_type"] = self.grant_type diff --git a/src/workos/user_management/models/password_reset.py b/src/workos/user_management/models/password_reset.py index bd8c5898..714b272e 100644 --- a/src/workos/user_management/models/password_reset.py +++ b/src/workos/user_management/models/password_reset.py @@ -4,9 +4,9 @@ from dataclasses import dataclass from datetime import datetime -from typing import Any, Dict, Literal -from workos._types import _raise_deserialize_error -from workos._types import _format_datetime, _parse_datetime +from typing import Any, Literal + +from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error @dataclass(slots=True) @@ -31,7 +31,7 @@ class PasswordReset: """The URL where the user can reset their password.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "PasswordReset": + def from_dict(cls, data: dict[str, Any]) -> PasswordReset: """Deserialize from a dictionary.""" try: return cls( @@ -47,9 +47,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "PasswordReset": except (KeyError, ValueError) as e: _raise_deserialize_error("PasswordReset", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["object"] = self.object result["id"] = self.id result["user_id"] = self.user_id diff --git a/src/workos/user_management/models/password_session_authenticate_request.py b/src/workos/user_management/models/password_session_authenticate_request.py index 2b56323c..0b06c925 100644 --- a/src/workos/user_management/models/password_session_authenticate_request.py +++ b/src/workos/user_management/models/password_session_authenticate_request.py @@ -3,7 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Dict, Literal, Optional +from typing import Any, Literal + from workos._types import _raise_deserialize_error @@ -20,21 +21,21 @@ class PasswordSessionAuthenticateRequest: """The user's email address.""" password: str """The user's password.""" - invitation_token: Optional[str] = None + invitation_token: str | None = None """An invitation token to accept during authentication.""" - ip_address: Optional[str] = None + ip_address: str | None = None """The IP address of the user's request.""" - device_id: Optional[str] = None + device_id: str | None = None """A unique identifier for the device.""" - user_agent: Optional[str] = None + user_agent: str | None = None """The user agent string from the user's browser.""" - signals_id: Optional[str] = None + signals_id: str | None = None """An optional Radar signals ID to correlate client-side signals with this authentication attempt.""" - radar_auth_attempt_id: Optional[str] = None + radar_auth_attempt_id: str | None = None """The ID of an existing Radar authentication attempt to associate with this authentication.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "PasswordSessionAuthenticateRequest": + def from_dict(cls, data: dict[str, Any]) -> PasswordSessionAuthenticateRequest: """Deserialize from a dictionary.""" try: return cls( @@ -53,9 +54,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "PasswordSessionAuthenticateRequest" except (KeyError, ValueError) as e: _raise_deserialize_error("PasswordSessionAuthenticateRequest", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["client_id"] = self.client_id result["client_secret"] = self.client_secret result["grant_type"] = self.grant_type diff --git a/src/workos/user_management/models/radar_challenge.py b/src/workos/user_management/models/radar_challenge.py index eed29c21..b6ca4714 100644 --- a/src/workos/user_management/models/radar_challenge.py +++ b/src/workos/user_management/models/radar_challenge.py @@ -4,9 +4,9 @@ from dataclasses import dataclass from datetime import datetime -from typing import Any, Dict, Literal -from workos._types import _raise_deserialize_error -from workos._types import _format_datetime, _parse_datetime +from typing import Any, Literal + +from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error @dataclass(slots=True) @@ -33,7 +33,7 @@ class RadarChallenge: """The code used to verify the Radar Challenge.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "RadarChallenge": + def from_dict(cls, data: dict[str, Any]) -> RadarChallenge: """Deserialize from a dictionary.""" try: return cls( @@ -50,9 +50,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "RadarChallenge": except (KeyError, ValueError) as e: _raise_deserialize_error("RadarChallenge", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["object"] = self.object result["id"] = self.id result["type"] = self.type diff --git a/src/workos/user_management/models/radar_email_challenge_code_session_authenticate_request.py b/src/workos/user_management/models/radar_email_challenge_code_session_authenticate_request.py index 8d241207..3d14cc32 100644 --- a/src/workos/user_management/models/radar_email_challenge_code_session_authenticate_request.py +++ b/src/workos/user_management/models/radar_email_challenge_code_session_authenticate_request.py @@ -3,7 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Dict, Literal, Optional +from typing import Any, Literal + from workos._types import _raise_deserialize_error @@ -22,17 +23,17 @@ class RadarEmailChallengeCodeSessionAuthenticateRequest: """The ID of the Radar email challenge being verified.""" pending_authentication_token: str """The pending authentication token from a previous authentication attempt.""" - ip_address: Optional[str] = None + ip_address: str | None = None """The IP address of the user's request.""" - device_id: Optional[str] = None + device_id: str | None = None """A unique identifier for the device.""" - user_agent: Optional[str] = None + user_agent: str | None = None """The user agent string from the user's browser.""" @classmethod def from_dict( - cls, data: Dict[str, Any] - ) -> "RadarEmailChallengeCodeSessionAuthenticateRequest": + cls, data: dict[str, Any] + ) -> RadarEmailChallengeCodeSessionAuthenticateRequest: """Deserialize from a dictionary.""" try: return cls( @@ -54,9 +55,9 @@ def from_dict( "RadarEmailChallengeCodeSessionAuthenticateRequest", e ) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["client_id"] = self.client_id result["client_secret"] = self.client_secret result["grant_type"] = self.grant_type diff --git a/src/workos/user_management/models/radar_sms_challenge_code_session_authenticate_request.py b/src/workos/user_management/models/radar_sms_challenge_code_session_authenticate_request.py index ee8f18cd..4b516fca 100644 --- a/src/workos/user_management/models/radar_sms_challenge_code_session_authenticate_request.py +++ b/src/workos/user_management/models/radar_sms_challenge_code_session_authenticate_request.py @@ -3,7 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Dict, Literal, Optional +from typing import Any, Literal + from workos._types import _raise_deserialize_error @@ -24,17 +25,17 @@ class RadarSmsChallengeCodeSessionAuthenticateRequest: """The phone number the Radar SMS challenge was sent to.""" pending_authentication_token: str """The pending authentication token from a previous authentication attempt.""" - ip_address: Optional[str] = None + ip_address: str | None = None """The IP address of the user's request.""" - device_id: Optional[str] = None + device_id: str | None = None """A unique identifier for the device.""" - user_agent: Optional[str] = None + user_agent: str | None = None """The user agent string from the user's browser.""" @classmethod def from_dict( - cls, data: Dict[str, Any] - ) -> "RadarSmsChallengeCodeSessionAuthenticateRequest": + cls, data: dict[str, Any] + ) -> RadarSmsChallengeCodeSessionAuthenticateRequest: """Deserialize from a dictionary.""" try: return cls( @@ -56,9 +57,9 @@ def from_dict( "RadarSmsChallengeCodeSessionAuthenticateRequest", e ) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["client_id"] = self.client_id result["client_secret"] = self.client_secret result["grant_type"] = self.grant_type diff --git a/src/workos/user_management/models/redirect_uri.py b/src/workos/user_management/models/redirect_uri.py index 0bdccdeb..7aaef89a 100644 --- a/src/workos/user_management/models/redirect_uri.py +++ b/src/workos/user_management/models/redirect_uri.py @@ -3,7 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Dict, Literal +from typing import Any, Literal + from workos._types import _raise_deserialize_error @@ -25,7 +26,7 @@ class RedirectUri: """The timestamp when the redirect URI was last updated.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "RedirectUri": + def from_dict(cls, data: dict[str, Any]) -> RedirectUri: """Deserialize from a dictionary.""" try: return cls( @@ -39,9 +40,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "RedirectUri": except (KeyError, ValueError) as e: _raise_deserialize_error("RedirectUri", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["object"] = self.object result["id"] = self.id result["uri"] = self.uri diff --git a/src/workos/user_management/models/refresh_token_session_authenticate_request.py b/src/workos/user_management/models/refresh_token_session_authenticate_request.py index c8b204d1..38e2eb77 100644 --- a/src/workos/user_management/models/refresh_token_session_authenticate_request.py +++ b/src/workos/user_management/models/refresh_token_session_authenticate_request.py @@ -3,7 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Dict, Literal, Optional +from typing import Any, Literal + from workos._types import _raise_deserialize_error @@ -16,21 +17,19 @@ class RefreshTokenSessionAuthenticateRequest: grant_type: Literal["refresh_token"] refresh_token: str """The refresh token to exchange for new tokens.""" - client_secret: Optional[str] = None + client_secret: str | None = None """The client secret of the application. May be omitted by public clients that authenticate through other means, such as a PKCE `code_verifier`.""" - organization_id: Optional[str] = None + organization_id: str | None = None """The ID of the organization to scope the session to.""" - ip_address: Optional[str] = None + ip_address: str | None = None """The IP address of the user's request.""" - device_id: Optional[str] = None + device_id: str | None = None """A unique identifier for the device.""" - user_agent: Optional[str] = None + user_agent: str | None = None """The user agent string from the user's browser.""" @classmethod - def from_dict( - cls, data: Dict[str, Any] - ) -> "RefreshTokenSessionAuthenticateRequest": + def from_dict(cls, data: dict[str, Any]) -> RefreshTokenSessionAuthenticateRequest: """Deserialize from a dictionary.""" try: return cls( @@ -46,9 +45,9 @@ def from_dict( except (KeyError, ValueError) as e: _raise_deserialize_error("RefreshTokenSessionAuthenticateRequest", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["client_id"] = self.client_id result["grant_type"] = self.grant_type result["refresh_token"] = self.refresh_token diff --git a/src/workos/user_management/models/resend_user_invite_options.py b/src/workos/user_management/models/resend_user_invite_options.py index 7a9fe36a..47a3467e 100644 --- a/src/workos/user_management/models/resend_user_invite_options.py +++ b/src/workos/user_management/models/resend_user_invite_options.py @@ -4,7 +4,8 @@ from dataclasses import dataclass from enum import Enum -from typing import Any, Dict, Optional +from typing import Any + from workos._types import _raise_deserialize_error from workos.common.models.resend_user_invite_options_locale import ( ResendUserInviteOptionsLocale, @@ -15,11 +16,11 @@ class ResendUserInviteOptions: """Resend User Invite Options model.""" - locale: Optional["ResendUserInviteOptionsLocale"] = None + locale: ResendUserInviteOptionsLocale | None = None """The locale to use when rendering the invitation email. See [supported locales](https://workos.com/docs/authkit/hosted-ui/localization).""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "ResendUserInviteOptions": + def from_dict(cls, data: dict[str, Any]) -> ResendUserInviteOptions: """Deserialize from a dictionary.""" try: return cls( @@ -30,9 +31,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "ResendUserInviteOptions": except (KeyError, ValueError) as e: _raise_deserialize_error("ResendUserInviteOptions", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} if self.locale is not None: result["locale"] = ( self.locale.value if isinstance(self.locale, Enum) else self.locale diff --git a/src/workos/user_management/models/revoke_session.py b/src/workos/user_management/models/revoke_session.py index 6adb5c6d..1dc52a02 100644 --- a/src/workos/user_management/models/revoke_session.py +++ b/src/workos/user_management/models/revoke_session.py @@ -3,7 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Dict +from typing import Any + from workos._types import _raise_deserialize_error @@ -15,7 +16,7 @@ class RevokeSession: """The ID of the session to revoke. This can be extracted from the `sid` claim of the access token.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "RevokeSession": + def from_dict(cls, data: dict[str, Any]) -> RevokeSession: """Deserialize from a dictionary.""" try: return cls( @@ -24,8 +25,8 @@ def from_dict(cls, data: Dict[str, Any]) -> "RevokeSession": except (KeyError, ValueError) as e: _raise_deserialize_error("RevokeSession", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["session_id"] = self.session_id return result diff --git a/src/workos/user_management/models/send_email_change.py b/src/workos/user_management/models/send_email_change.py index 4ed98d36..52ecfde6 100644 --- a/src/workos/user_management/models/send_email_change.py +++ b/src/workos/user_management/models/send_email_change.py @@ -3,7 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Dict +from typing import Any + from workos._types import _raise_deserialize_error @@ -15,7 +16,7 @@ class SendEmailChange: """The new email address to change to.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "SendEmailChange": + def from_dict(cls, data: dict[str, Any]) -> SendEmailChange: """Deserialize from a dictionary.""" try: return cls( @@ -24,8 +25,8 @@ def from_dict(cls, data: Dict[str, Any]) -> "SendEmailChange": except (KeyError, ValueError) as e: _raise_deserialize_error("SendEmailChange", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["new_email"] = self.new_email return result diff --git a/src/workos/user_management/models/send_radar_sms_challenge.py b/src/workos/user_management/models/send_radar_sms_challenge.py index 06aa140b..41acccb8 100644 --- a/src/workos/user_management/models/send_radar_sms_challenge.py +++ b/src/workos/user_management/models/send_radar_sms_challenge.py @@ -3,7 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Dict, Optional +from typing import Any + from workos._types import _raise_deserialize_error @@ -17,13 +18,13 @@ class SendRadarSmsChallenge: """The pending authentication token from a previous authentication attempt that triggered the Radar challenge.""" phone_number: str """The phone number to send the SMS verification code to.""" - ip_address: Optional[str] = None + ip_address: str | None = None """The IP address of the user's request.""" - user_agent: Optional[str] = None + user_agent: str | None = None """The user agent string from the user's request.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "SendRadarSmsChallenge": + def from_dict(cls, data: dict[str, Any]) -> SendRadarSmsChallenge: """Deserialize from a dictionary.""" try: return cls( @@ -36,9 +37,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "SendRadarSmsChallenge": except (KeyError, ValueError) as e: _raise_deserialize_error("SendRadarSmsChallenge", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["user_id"] = self.user_id result["pending_authentication_token"] = self.pending_authentication_token result["phone_number"] = self.phone_number diff --git a/src/workos/user_management/models/send_radar_sms_challenge_response.py b/src/workos/user_management/models/send_radar_sms_challenge_response.py index 9dd51197..a65bf027 100644 --- a/src/workos/user_management/models/send_radar_sms_challenge_response.py +++ b/src/workos/user_management/models/send_radar_sms_challenge_response.py @@ -3,7 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Dict +from typing import Any + from workos._types import _raise_deserialize_error @@ -17,7 +18,7 @@ class SendRadarSmsChallengeResponse: """The phone number the verification code was sent to.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "SendRadarSmsChallengeResponse": + def from_dict(cls, data: dict[str, Any]) -> SendRadarSmsChallengeResponse: """Deserialize from a dictionary.""" try: return cls( @@ -27,9 +28,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "SendRadarSmsChallengeResponse": except (KeyError, ValueError) as e: _raise_deserialize_error("SendRadarSmsChallengeResponse", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["verification_id"] = self.verification_id result["phone_number"] = self.phone_number return result diff --git a/src/workos/user_management/models/sso_device_authorization_request.py b/src/workos/user_management/models/sso_device_authorization_request.py index 8cafe885..9f2ded6f 100644 --- a/src/workos/user_management/models/sso_device_authorization_request.py +++ b/src/workos/user_management/models/sso_device_authorization_request.py @@ -3,7 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Dict +from typing import Any + from workos._types import _raise_deserialize_error @@ -15,7 +16,7 @@ class SSODeviceAuthorizationRequest: """The WorkOS client ID for your application.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "SSODeviceAuthorizationRequest": + def from_dict(cls, data: dict[str, Any]) -> SSODeviceAuthorizationRequest: """Deserialize from a dictionary.""" try: return cls( @@ -24,8 +25,8 @@ def from_dict(cls, data: Dict[str, Any]) -> "SSODeviceAuthorizationRequest": except (KeyError, ValueError) as e: _raise_deserialize_error("SSODeviceAuthorizationRequest", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["client_id"] = self.client_id return result diff --git a/src/workos/user_management/models/update_jwt_template.py b/src/workos/user_management/models/update_jwt_template.py index b29da54e..f249f80a 100644 --- a/src/workos/user_management/models/update_jwt_template.py +++ b/src/workos/user_management/models/update_jwt_template.py @@ -3,7 +3,8 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Dict +from typing import Any + from workos._types import _raise_deserialize_error @@ -15,7 +16,7 @@ class UpdateJWTTemplate: """The JWT template content as a Liquid template string.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "UpdateJWTTemplate": + def from_dict(cls, data: dict[str, Any]) -> UpdateJWTTemplate: """Deserialize from a dictionary.""" try: return cls( @@ -24,8 +25,8 @@ def from_dict(cls, data: Dict[str, Any]) -> "UpdateJWTTemplate": except (KeyError, ValueError) as e: _raise_deserialize_error("UpdateJWTTemplate", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["content"] = self.content return result diff --git a/src/workos/user_management/models/update_user.py b/src/workos/user_management/models/update_user.py index aecc240f..763dd792 100644 --- a/src/workos/user_management/models/update_user.py +++ b/src/workos/user_management/models/update_user.py @@ -4,7 +4,8 @@ from dataclasses import dataclass from enum import Enum -from typing import Any, Dict, Optional +from typing import Any + from workos._types import _raise_deserialize_error from workos.common.models.update_user_password_hash_type import ( UpdateUserPasswordHashType, @@ -15,31 +16,31 @@ class UpdateUser: """Update User model.""" - email: Optional[str] = None + email: str | None = None """The email address of the user.""" - first_name: Optional[str] = None + first_name: str | None = None """The first name of the user.""" - last_name: Optional[str] = None + last_name: str | None = None """The last name of the user.""" - name: Optional[str] = None + name: str | None = None """The user's full name.""" - email_verified: Optional[bool] = None + email_verified: bool | None = None """Whether the user's email has been verified.""" - metadata: Optional[Dict[str, str]] = None + metadata: dict[str, str] | None = None """Object containing metadata key/value pairs associated with the user.""" - external_id: Optional[str] = None + external_id: str | None = None """The external ID of the user.""" - locale: Optional[str] = None + locale: str | None = None """The user's preferred locale.""" - password: Optional[str] = None + password: str | None = None """The password to set for the user. Mutually exclusive with `password_hash` and `password_hash_type`.""" - password_hash: Optional[str] = None + password_hash: str | None = None """The hashed password to set for the user. Required with `password_hash_type`. Mutually exclusive with `password`.""" - password_hash_type: Optional["UpdateUserPasswordHashType"] = None + password_hash_type: UpdateUserPasswordHashType | None = None """The algorithm originally used to hash the password, used when providing a `password_hash`. Required with `password_hash`. Mutually exclusive with `password`.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "UpdateUser": + def from_dict(cls, data: dict[str, Any]) -> UpdateUser: """Deserialize from a dictionary.""" try: return cls( @@ -60,9 +61,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "UpdateUser": except (KeyError, ValueError) as e: _raise_deserialize_error("UpdateUser", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} if self.email is not None: result["email"] = self.email if self.first_name is not None: diff --git a/src/workos/user_management/models/user_api_key.py b/src/workos/user_management/models/user_api_key.py index 39308148..01e4888e 100644 --- a/src/workos/user_management/models/user_api_key.py +++ b/src/workos/user_management/models/user_api_key.py @@ -4,10 +4,9 @@ from dataclasses import dataclass from datetime import datetime -from typing import cast -from typing import Any, Dict, List, Literal, Optional -from workos._types import _raise_deserialize_error -from workos._types import _format_datetime, _parse_datetime +from typing import Any, Literal, cast + +from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error from .user_api_key_owner import UserApiKeyOwner @@ -20,17 +19,17 @@ class UserApiKey: """Distinguishes the API Key object.""" id: str """Unique identifier of the API Key.""" - owner: "UserApiKeyOwner" + owner: UserApiKeyOwner """The entity that owns the API Key.""" name: str """A descriptive name for the API Key.""" obfuscated_value: str """An obfuscated representation of the API Key value.""" - last_used_at: Optional[datetime] + last_used_at: datetime | None """Timestamp of when the API Key was last used.""" - expires_at: Optional[datetime] + expires_at: datetime | None """Timestamp when the API Key expires. Null means the key does not expire.""" - permissions: List[str] + permissions: list[str] """The permission slugs assigned to the API Key.""" created_at: datetime """An ISO 8601 timestamp.""" @@ -38,13 +37,13 @@ class UserApiKey: """An ISO 8601 timestamp.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "UserApiKey": + def from_dict(cls, data: dict[str, Any]) -> UserApiKey: """Deserialize from a dictionary.""" try: return cls( object=data.get("object", "api_key"), id=data["id"], - owner=UserApiKeyOwner.from_dict(cast(Dict[str, Any], data["owner"])), + owner=UserApiKeyOwner.from_dict(cast(dict[str, Any], data["owner"])), name=data["name"], obfuscated_value=data["obfuscated_value"], last_used_at=_parse_datetime(_v_last_used_at) @@ -60,9 +59,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "UserApiKey": except (KeyError, ValueError) as e: _raise_deserialize_error("UserApiKey", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["object"] = self.object result["id"] = self.id result["owner"] = self.owner.to_dict() diff --git a/src/workos/user_management/models/user_api_key_owner.py b/src/workos/user_management/models/user_api_key_owner.py index 9b7b4af6..b87c5b8e 100644 --- a/src/workos/user_management/models/user_api_key_owner.py +++ b/src/workos/user_management/models/user_api_key_owner.py @@ -1,6 +1,7 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias + from workos.common.models.user_api_key_created_data_owner import ( UserApiKeyCreatedDataOwner, ) diff --git a/src/workos/user_management/models/user_api_key_with_value.py b/src/workos/user_management/models/user_api_key_with_value.py index f565bfda..8b828fa2 100644 --- a/src/workos/user_management/models/user_api_key_with_value.py +++ b/src/workos/user_management/models/user_api_key_with_value.py @@ -4,10 +4,9 @@ from dataclasses import dataclass from datetime import datetime -from typing import cast -from typing import Any, Dict, List, Literal, Optional -from workos._types import _raise_deserialize_error -from workos._types import _format_datetime, _parse_datetime +from typing import Any, Literal, cast + +from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error from .user_api_key_with_value_owner import UserApiKeyWithValueOwner @@ -20,17 +19,17 @@ class UserApiKeyWithValue: """Distinguishes the API Key object.""" id: str """Unique identifier of the API Key.""" - owner: "UserApiKeyWithValueOwner" + owner: UserApiKeyWithValueOwner """The entity that owns the API Key.""" name: str """A descriptive name for the API Key.""" obfuscated_value: str """An obfuscated representation of the API Key value.""" - last_used_at: Optional[datetime] + last_used_at: datetime | None """Timestamp of when the API Key was last used.""" - expires_at: Optional[datetime] + expires_at: datetime | None """Timestamp when the API Key expires. Null means the key does not expire.""" - permissions: List[str] + permissions: list[str] """The permission slugs assigned to the API Key.""" created_at: datetime """An ISO 8601 timestamp.""" @@ -40,14 +39,14 @@ class UserApiKeyWithValue: """The full API Key value. Only returned once at creation time.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "UserApiKeyWithValue": + def from_dict(cls, data: dict[str, Any]) -> UserApiKeyWithValue: """Deserialize from a dictionary.""" try: return cls( object=data.get("object", "api_key"), id=data["id"], owner=UserApiKeyWithValueOwner.from_dict( - cast(Dict[str, Any], data["owner"]) + cast(dict[str, Any], data["owner"]) ), name=data["name"], obfuscated_value=data["obfuscated_value"], @@ -65,9 +64,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "UserApiKeyWithValue": except (KeyError, ValueError) as e: _raise_deserialize_error("UserApiKeyWithValue", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["object"] = self.object result["id"] = self.id result["owner"] = self.owner.to_dict() diff --git a/src/workos/user_management/models/user_api_key_with_value_owner.py b/src/workos/user_management/models/user_api_key_with_value_owner.py index 4178ebcb..59f8518f 100644 --- a/src/workos/user_management/models/user_api_key_with_value_owner.py +++ b/src/workos/user_management/models/user_api_key_with_value_owner.py @@ -1,6 +1,7 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias + from workos.common.models.user_api_key_created_data_owner import ( UserApiKeyCreatedDataOwner, ) diff --git a/src/workos/user_management/models/user_create_response.py b/src/workos/user_management/models/user_create_response.py index 3d9f2c65..20d4e84a 100644 --- a/src/workos/user_management/models/user_create_response.py +++ b/src/workos/user_management/models/user_create_response.py @@ -4,9 +4,9 @@ from dataclasses import dataclass from datetime import datetime -from typing import Any, Dict, Literal, Optional -from workos._types import _raise_deserialize_error -from workos._types import _format_datetime, _parse_datetime +from typing import Any, Literal + +from workos._types import _format_datetime, _parse_datetime, _raise_deserialize_error @dataclass(slots=True) @@ -17,35 +17,35 @@ class UserCreateResponse: """Distinguishes the user object.""" id: str """The unique ID of the user.""" - first_name: Optional[str] + first_name: str | None """The first name of the user.""" - last_name: Optional[str] + last_name: str | None """The last name of the user.""" - profile_picture_url: Optional[str] + profile_picture_url: str | None """A URL reference to an image representing the user.""" email: str """The email address of the user.""" email_verified: bool """Whether the user's email has been verified.""" - external_id: Optional[str] + external_id: str | None """The external ID of the user.""" - last_sign_in_at: Optional[datetime] + last_sign_in_at: datetime | None """The timestamp when the user last signed in.""" created_at: datetime """An ISO 8601 timestamp.""" updated_at: datetime """An ISO 8601 timestamp.""" - name: Optional[str] = None + name: str | None = None """The user's full name.""" - metadata: Optional[Dict[str, str]] = None + metadata: dict[str, str] | None = None """Object containing metadata key/value pairs associated with the user.""" - locale: Optional[str] = None + locale: str | None = None """The user's preferred locale.""" - radar_auth_attempt_id: Optional[str] = None + radar_auth_attempt_id: str | None = None """The ID of the Radar authentication attempt created for this request when Radar is enabled. Pass this value to the authenticate endpoint to associate the subsequent authentication with this Radar attempt.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "UserCreateResponse": + def from_dict(cls, data: dict[str, Any]) -> UserCreateResponse: """Deserialize from a dictionary.""" try: return cls( @@ -70,9 +70,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "UserCreateResponse": except (KeyError, ValueError) as e: _raise_deserialize_error("UserCreateResponse", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["object"] = self.object result["id"] = self.id if self.first_name is not None: diff --git a/src/workos/user_management/models/user_identities_get_item.py b/src/workos/user_management/models/user_identities_get_item.py index 89de6d02..9e05e5ab 100644 --- a/src/workos/user_management/models/user_identities_get_item.py +++ b/src/workos/user_management/models/user_identities_get_item.py @@ -4,7 +4,8 @@ from dataclasses import dataclass from enum import Enum -from typing import Any, Dict, Literal +from typing import Any, Literal + from workos._types import _raise_deserialize_error from workos.common.models.user_identities_get_item_provider import ( UserIdentitiesGetItemProvider, @@ -19,11 +20,11 @@ class UserIdentitiesGetItem: """The unique ID of the user in the external identity provider.""" type: Literal["OAuth"] """The type of the identity.""" - provider: "UserIdentitiesGetItemProvider" + provider: UserIdentitiesGetItemProvider """The type of OAuth provider for the identity.""" @classmethod - def from_dict(cls, data: Dict[str, Any]) -> "UserIdentitiesGetItem": + def from_dict(cls, data: dict[str, Any]) -> UserIdentitiesGetItem: """Deserialize from a dictionary.""" try: return cls( @@ -34,9 +35,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "UserIdentitiesGetItem": except (KeyError, ValueError) as e: _raise_deserialize_error("UserIdentitiesGetItem", e) - def to_dict(self) -> Dict[str, Any]: + def to_dict(self) -> dict[str, Any]: """Serialize to a dictionary.""" - result: Dict[str, Any] = {} + result: dict[str, Any] = {} result["idp_id"] = self.idp_id result["type"] = self.type result["provider"] = ( diff --git a/src/workos/user_management/models/user_management_authentication_provider.py b/src/workos/user_management/models/user_management_authentication_provider.py index 368363eb..3df96955 100644 --- a/src/workos/user_management/models/user_management_authentication_provider.py +++ b/src/workos/user_management/models/user_management_authentication_provider.py @@ -5,7 +5,6 @@ from __future__ import annotations from enum import Enum -from typing import Optional from typing import Literal, TypeAlias @@ -28,9 +27,7 @@ class UserManagementAuthenticationProvider(str, Enum): XERO_OAUTH = "XeroOAuth" @classmethod - def _missing_( - cls, value: object - ) -> Optional["UserManagementAuthenticationProvider"]: + def _missing_(cls, value: object) -> UserManagementAuthenticationProvider | None: if not isinstance(value, str): return None unknown = str.__new__(cls, value) diff --git a/src/workos/user_management/models/verify_email_address.py b/src/workos/user_management/models/verify_email_address.py index 773b38e7..2acbbd3a 100644 --- a/src/workos/user_management/models/verify_email_address.py +++ b/src/workos/user_management/models/verify_email_address.py @@ -1,6 +1,7 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias + from workos.multi_factor_auth.models.authentication_challenges_verify_request import ( AuthenticationChallengesVerifyRequest, ) diff --git a/tests/fixtures/configure_data_integration_body.json b/tests/fixtures/configure_data_integration_body.json index 081379da..e84badb1 100644 --- a/tests/fixtures/configure_data_integration_body.json +++ b/tests/fixtures/configure_data_integration_body.json @@ -5,5 +5,8 @@ "user:email" ], "client_id": "client_01EHZNVPK3SFK441A1RGBFSHRT", - "client_secret": "••••••••" + "client_secret": "••••••••", + "config": { + "account_identifier": "acme-prod" + } } diff --git a/tests/fixtures/create_data_integration.json b/tests/fixtures/create_data_integration.json index 2a37e387..57aea096 100644 --- a/tests/fixtures/create_data_integration.json +++ b/tests/fixtures/create_data_integration.json @@ -9,6 +9,9 @@ "auth_methods": [ "oauth" ], + "config": { + "account_identifier": "acme-prod" + }, "credentials": { "type": "custom", "client_id": "Iv1.abc123", diff --git a/tests/fixtures/data_integration.json b/tests/fixtures/data_integration.json index afb71c86..83c8eac4 100644 --- a/tests/fixtures/data_integration.json +++ b/tests/fixtures/data_integration.json @@ -20,6 +20,9 @@ "redacted_client_secret": "6789" }, "installation": null, + "config": { + "account_identifier": "acme-prod" + }, "custom_provider": { "name": "My OAuth App", "authorization_url": "https://provider.example.com/oauth/authorize", diff --git a/tests/fixtures/data_integration_configuration_list_response.json b/tests/fixtures/data_integration_configuration_list_response.json index c5b0efa4..714d7863 100644 --- a/tests/fixtures/data_integration_configuration_list_response.json +++ b/tests/fixtures/data_integration_configuration_list_response.json @@ -12,6 +12,9 @@ "repo", "user:email" ], + "config": { + "account_identifier": "acme-prod" + }, "created_at": "2024-01-15T10:30:00.000Z", "updated_at": "2024-01-15T10:30:00.000Z", "credentials": { diff --git a/tests/fixtures/data_integration_configuration_response.json b/tests/fixtures/data_integration_configuration_response.json index e9df017d..cb3e7abe 100644 --- a/tests/fixtures/data_integration_configuration_response.json +++ b/tests/fixtures/data_integration_configuration_response.json @@ -9,6 +9,9 @@ "repo", "user:email" ], + "config": { + "account_identifier": "acme-prod" + }, "created_at": "2024-01-15T10:30:00.000Z", "updated_at": "2024-01-15T10:30:00.000Z", "credentials": { 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 b38a7cd5..2d0e5bb2 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,5 +1,8 @@ { "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT", - "return_to": "https://example.com/callback" + "return_to": "https://example.com/callback", + "config": { + "subdomain": "acme" + } } diff --git a/tests/fixtures/list_data_integration.json b/tests/fixtures/list_data_integration.json index f5e15218..9f094cb3 100644 --- a/tests/fixtures/list_data_integration.json +++ b/tests/fixtures/list_data_integration.json @@ -22,6 +22,9 @@ "redacted_client_secret": "6789" }, "installation": null, + "config": { + "account_identifier": "acme-prod" + }, "custom_provider": { "name": "My OAuth App", "authorization_url": "https://provider.example.com/oauth/authorize", diff --git a/tests/test_common_models_round_trip.py b/tests/test_common_models_round_trip.py index 851378db..adea4874 100644 --- a/tests/test_common_models_round_trip.py +++ b/tests/test_common_models_round_trip.py @@ -3,7 +3,6 @@ """Model round-trip tests: from_dict(to_dict()) preserves data.""" from tests.generated_helpers import load_fixture - from workos.common.models import ( AccessTokenAgentRegistrationCredentialIssuedDataDetail, ActionAuthenticationDenied, @@ -39,22 +38,21 @@ ApiKeyUpdatedData, ApiKeyUpdatedDataOwner, ApiKeyUpdatedDataPreviousAttribute, - AuthMethodMismatchError, AuthenticationEmailVerificationFailed, AuthenticationEmailVerificationFailedData, AuthenticationEmailVerificationFailedDataError, AuthenticationEmailVerificationSucceeded, AuthenticationEmailVerificationSucceededData, - AuthenticationMFAFailed, - AuthenticationMFAFailedData, - AuthenticationMFAFailedDataError, - AuthenticationMFASucceeded, - AuthenticationMFASucceededData, AuthenticationMagicAuthFailed, AuthenticationMagicAuthFailedData, AuthenticationMagicAuthFailedDataError, AuthenticationMagicAuthSucceeded, AuthenticationMagicAuthSucceededData, + AuthenticationMFAFailed, + AuthenticationMFAFailedData, + AuthenticationMFAFailedDataError, + AuthenticationMFASucceeded, + AuthenticationMFASucceededData, AuthenticationOAuthFailed, AuthenticationOAuthFailedData, AuthenticationOAuthFailedDataError, @@ -88,6 +86,7 @@ AuthenticationSSOTimedOutData, AuthenticationSSOTimedOutDataError, AuthenticationSSOTimedOutDataSSO, + AuthMethodMismatchError, ConnectApplicationM2M, ConnectApplicationOAuth, ConnectApplicationOAuthRedirectUris, diff --git a/tests/test_connect_models_round_trip.py b/tests/test_connect_models_round_trip.py index c83aa773..1d892270 100644 --- a/tests/test_connect_models_round_trip.py +++ b/tests/test_connect_models_round_trip.py @@ -5,7 +5,6 @@ import pytest from tests.generated_helpers import load_fixture - from workos.common.models import ConnectApplicationM2M from workos.connect.models import ( ApplicationCredentialsListItem, diff --git a/tests/test_pipes.py b/tests/test_pipes.py index e27dff80..d0582e6f 100644 --- a/tests/test_pipes.py +++ b/tests/test_pipes.py @@ -3,18 +3,9 @@ import json import pytest -from workos import WorkOSClient, AsyncWorkOSClient -from tests.generated_helpers import load_fixture -from workos.common.models import ConnectedAccount, PaginationOrder -from workos.pipes.models import ( - DataIntegration, - DataIntegrationAccessTokenResponse, - DataIntegrationAuthorizeUrlResponse, - DataIntegrationCredentialsResponse, - DataIntegrationsListResponse, -) -from workos._pagination import AsyncPage, SyncPage +from tests.generated_helpers import load_fixture +from workos import AsyncWorkOSClient, WorkOSClient from workos._errors import ( AuthenticationError, BadRequestError, @@ -23,6 +14,18 @@ ServerError, UnprocessableEntityError, ) +from workos._pagination import AsyncPage, SyncPage +from workos.common.models import ( + ConnectedAccount, + PaginationOrder, +) +from workos.pipes.models import ( + DataIntegration, + DataIntegrationAccessTokenResponse, + DataIntegrationAuthorizeUrlResponse, + DataIntegrationCredentialsResponse, + DataIntegrationsListResponse, +) class TestPipes: diff --git a/tests/test_pipes_models_round_trip.py b/tests/test_pipes_models_round_trip.py index 6ca2ea12..47d0765a 100644 --- a/tests/test_pipes_models_round_trip.py +++ b/tests/test_pipes_models_round_trip.py @@ -3,7 +3,6 @@ """Model round-trip tests: from_dict(to_dict()) preserves data.""" from tests.generated_helpers import load_fixture - from workos.pipes.models import ( ApiKeyInstallation, ConnectedAccount, @@ -248,6 +247,7 @@ def test_data_integration_minimal_payload(self): "redacted_client_secret": "6789", }, "installation": None, + "config": {"account_identifier": "acme-prod"}, "custom_provider": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", @@ -266,6 +266,7 @@ def test_data_integration_minimal_payload(self): assert serialized["auth_methods"] == data["auth_methods"] assert serialized["credentials"] == data["credentials"] assert serialized["installation"] == data["installation"] + assert serialized["config"] == data["config"] assert serialized["custom_provider"] == data["custom_provider"] assert serialized["created_at"] == data["created_at"] assert serialized["updated_at"] == data["updated_at"] @@ -288,6 +289,7 @@ def test_data_integration_preserves_nullable_fields(self): "redacted_client_secret": "6789", }, "installation": None, + "config": {"account_identifier": "acme-prod"}, "custom_provider": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", @@ -317,6 +319,7 @@ def test_data_integration_round_trips_unknown_enum_values(self): "redacted_client_secret": "6789", }, "installation": None, + "config": {"account_identifier": "acme-prod"}, "custom_provider": { "name": "My OAuth App", "authorization_url": "https://provider.example.com/oauth/authorize", diff --git a/tests/test_pipes_provider.py b/tests/test_pipes_provider.py index 68e5877d..63de2bdc 100644 --- a/tests/test_pipes_provider.py +++ b/tests/test_pipes_provider.py @@ -2,13 +2,9 @@ import pytest -from workos import WorkOSClient, AsyncWorkOSClient -from tests.generated_helpers import load_fixture -from workos.pipes_provider.models import ( - DataIntegrationConfigurationListResponse, - DataIntegrationConfigurationResponse, -) +from tests.generated_helpers import load_fixture +from workos import AsyncWorkOSClient, WorkOSClient from workos._errors import ( AuthenticationError, BadRequestError, @@ -17,6 +13,10 @@ ServerError, UnprocessableEntityError, ) +from workos.pipes_provider.models import ( + DataIntegrationConfigurationListResponse, + DataIntegrationConfigurationResponse, +) class TestPipesProvider: diff --git a/tests/test_pipes_provider_models_round_trip.py b/tests/test_pipes_provider_models_round_trip.py index 485b13af..941437d4 100644 --- a/tests/test_pipes_provider_models_round_trip.py +++ b/tests/test_pipes_provider_models_round_trip.py @@ -3,7 +3,6 @@ """Model round-trip tests: from_dict(to_dict()) preserves data.""" from tests.generated_helpers import load_fixture - from workos.pipes_provider.models import ( DataIntegrationConfigurationListResponse, DataIntegrationConfigurationResponse, @@ -77,6 +76,7 @@ def test_data_integration_configuration_response_minimal_payload(self): "name": "GitHub", "enabled": True, "scopes": None, + "config": {"account_identifier": "acme-prod"}, "created_at": "2024-01-15T10:30:00.000Z", "updated_at": "2024-01-15T10:30:00.000Z", } @@ -89,6 +89,7 @@ def test_data_integration_configuration_response_minimal_payload(self): assert serialized["name"] == data["name"] assert serialized["enabled"] == data["enabled"] assert serialized["scopes"] == data["scopes"] + assert serialized["config"] == data["config"] assert serialized["created_at"] == data["created_at"] assert serialized["updated_at"] == data["updated_at"] @@ -103,6 +104,7 @@ def test_data_integration_configuration_response_omits_absent_optional_non_nulla "name": "GitHub", "enabled": True, "scopes": ["repo", "user:email"], + "config": {"account_identifier": "acme-prod"}, "created_at": "2024-01-15T10:30:00.000Z", "updated_at": "2024-01-15T10:30:00.000Z", } @@ -119,6 +121,7 @@ def test_data_integration_configuration_response_preserves_nullable_fields(self) "name": "GitHub", "enabled": True, "scopes": None, + "config": {"account_identifier": "acme-prod"}, "created_at": "2024-01-15T10:30:00.000Z", "updated_at": "2024-01-15T10:30:00.000Z", "credentials": { @@ -153,6 +156,7 @@ def test_data_integration_configuration_list_response_minimal_payload(self): "name": "GitHub", "enabled": True, "scopes": ["repo", "user:email"], + "config": {"account_identifier": "acme-prod"}, "created_at": "2024-01-15T10:30:00.000Z", "updated_at": "2024-01-15T10:30:00.000Z", "credentials": { diff --git a/tests/test_user_management.py b/tests/test_user_management.py index 5c70a95c..5417db30 100644 --- a/tests/test_user_management.py +++ b/tests/test_user_management.py @@ -3,10 +3,24 @@ import json import pytest -from workos import WorkOSClient, AsyncWorkOSClient -from tests.generated_helpers import load_fixture -from workos.common.models import User, UserSessionsListItem, PaginationOrder +from tests.generated_helpers import load_fixture +from workos import AsyncWorkOSClient, WorkOSClient +from workos._errors import ( + AuthenticationError, + BadRequestError, + NotFoundError, + RateLimitExceededError, + ServerError, + UnprocessableEntityError, +) +from workos._pagination import AsyncPage, SyncPage +from workos.common.models import ( + PaginationOrder, + User, + UserSessionsListItem, +) +from workos.user_management._resource import PasswordPlaintext from workos.user_management.models import ( AuthenticateResponse, AuthorizedConnectApplicationListData, @@ -16,8 +30,8 @@ EmailChangeConfirmation, EmailVerification, Invitation, - JWTTemplateResponse, JwksResponse, + JWTTemplateResponse, MagicAuth, MagicAuthSendMagicAuthCodeAndReturnResponse, PasswordReset, @@ -33,16 +47,6 @@ UserInvite, VerifyEmailResponse, ) -from workos._pagination import AsyncPage, SyncPage -from workos._errors import ( - AuthenticationError, - BadRequestError, - NotFoundError, - RateLimitExceededError, - ServerError, - UnprocessableEntityError, -) -from workos.user_management._resource import PasswordPlaintext class TestUserManagement: diff --git a/tests/test_user_management_models_round_trip.py b/tests/test_user_management_models_round_trip.py index 9fa36f6e..518299b7 100644 --- a/tests/test_user_management_models_round_trip.py +++ b/tests/test_user_management_models_round_trip.py @@ -3,7 +3,6 @@ """Model round-trip tests: from_dict(to_dict()) preserves data.""" from tests.generated_helpers import load_fixture - from workos.user_management.models import ( AuthenticateResponse, AuthenticateResponseImpersonator, @@ -16,9 +15,9 @@ EmailChangeConfirmationUser, EmailVerification, Invitation, - JWTTemplateResponse, JwksResponse, JwksResponseKeys, + JWTTemplateResponse, MagicAuth, MagicAuthSendMagicAuthCodeAndReturnResponse, PasswordReset, diff --git a/uv.lock b/uv.lock index 149463b4..9ceff163 100644 --- a/uv.lock +++ b/uv.lock @@ -591,7 +591,7 @@ name = "exceptiongroup" version = "1.3.1" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "typing-extensions" }, + { name = "typing-extensions", marker = "python_full_version < '3.13'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/50/79/66800aadf48771f6b62f7eb014e352e5d06856655206165d775e675a02c9/exceptiongroup-1.3.1.tar.gz", hash = "sha256:8b412432c6055b0b7d14c310000ae93352ed6754f70fa8f7c34141f91c4e3219", size = 30371, upload-time = "2025-11-21T23:01:54.787Z" } wheels = [ @@ -1324,7 +1324,7 @@ wheels = [ [[package]] name = "workos" -version = "10.0.0" +version = "10.0.1" source = { editable = "." } dependencies = [ { name = "cryptography" },