diff --git a/.last-synced-sha b/.last-synced-sha new file mode 100644 index 00000000..f72eb0e2 --- /dev/null +++ b/.last-synced-sha @@ -0,0 +1 @@ +92db0495807c86fbbc4d45bd266a6c1f5bcbb59c diff --git a/.oagen-manifest.json b/.oagen-manifest.json index 1b3ee0e7..82c918f1 100644 --- a/.oagen-manifest.json +++ b/.oagen-manifest.json @@ -1,12 +1,13 @@ { "version": 2, "language": "python", - "generatedAt": "2026-04-23T15:27:42.321Z", + "generatedAt": "2026-04-27T20:06:13.060Z", "files": [ "src/workos/_client.py", "src/workos/admin_portal/__init__.py", "src/workos/admin_portal/_resource.py", "src/workos/admin_portal/models/__init__.py", + "src/workos/admin_portal/models/domain_verification_intent_options.py", "src/workos/admin_portal/models/generate_link.py", "src/workos/admin_portal/models/intent_options.py", "src/workos/admin_portal/models/portal_link_response.py", @@ -251,7 +252,6 @@ "src/workos/common/models/flag_updated_data.py", "src/workos/common/models/flag_updated_data_owner.py", "src/workos/common/models/generate_link_intent.py", - "src/workos/common/models/group.py", "src/workos/common/models/group_created.py", "src/workos/common/models/group_deleted.py", "src/workos/common/models/group_member_added.py", @@ -408,6 +408,11 @@ "src/workos/common/models/vault_names_listed.py", "src/workos/common/models/vault_names_listed_data.py", "src/workos/common/models/vault_names_listed_data_actor_source.py", + "src/workos/common/models/waitlist_user.py", + "src/workos/common/models/waitlist_user_approved.py", + "src/workos/common/models/waitlist_user_created.py", + "src/workos/common/models/waitlist_user_denied.py", + "src/workos/common/models/waitlist_user_state.py", "src/workos/common/models/webhook_endpoint_json_status.py", "src/workos/common/models/widget_session_token_scopes.py", "src/workos/connect/__init__.py", @@ -455,6 +460,14 @@ "src/workos/feature_flags/models/flag_owner.py", "src/workos/feature_flags/models/organizations_feature_flags_order.py", "src/workos/feature_flags/models/user_management_users_feature_flags_order.py", + "src/workos/groups/__init__.py", + "src/workos/groups/_resource.py", + "src/workos/groups/models/__init__.py", + "src/workos/groups/models/create_group.py", + "src/workos/groups/models/create_group_membership.py", + "src/workos/groups/models/group.py", + "src/workos/groups/models/groups_order.py", + "src/workos/groups/models/update_group.py", "src/workos/multi_factor_auth/__init__.py", "src/workos/multi_factor_auth/_resource.py", "src/workos/multi_factor_auth/models/__init__.py", @@ -538,6 +551,7 @@ "src/workos/types/directory_sync/__init__.py", "src/workos/types/events/__init__.py", "src/workos/types/feature_flags/__init__.py", + "src/workos/types/groups/__init__.py", "src/workos/types/multi_factor_auth/__init__.py", "src/workos/types/organization_domains/__init__.py", "src/workos/types/organizations/__init__.py", @@ -545,6 +559,7 @@ "src/workos/types/radar/__init__.py", "src/workos/types/sso/__init__.py", "src/workos/types/user_management/__init__.py", + "src/workos/types/user_management_organization_membership_groups/__init__.py", "src/workos/types/webhooks/__init__.py", "src/workos/types/widgets/__init__.py", "src/workos/user_management/__init__.py", @@ -609,6 +624,10 @@ "src/workos/user_management/models/user_sessions_list_item.py", "src/workos/user_management/models/verify_email_address.py", "src/workos/user_management/models/verify_email_response.py", + "src/workos/user_management_organization_membership_groups/__init__.py", + "src/workos/user_management_organization_membership_groups/_resource.py", + "src/workos/user_management_organization_membership_groups/models/__init__.py", + "src/workos/user_management_organization_membership_groups/models/user_management_organization_membership_groups_order.py", "src/workos/webhooks/__init__.py", "src/workos/webhooks/_resource.py", "src/workos/webhooks/models/__init__.py", @@ -749,6 +768,8 @@ "tests/fixtures/create_authorization_permission.json", "tests/fixtures/create_authorization_resource.json", "tests/fixtures/create_cors_origin.json", + "tests/fixtures/create_group.json", + "tests/fixtures/create_group_membership.json", "tests/fixtures/create_m2m_application.json", "tests/fixtures/create_magic_code_and_return.json", "tests/fixtures/create_oauth_application.json", @@ -781,6 +802,7 @@ "tests/fixtures/directory_user_email.json", "tests/fixtures/directory_user_with_groups.json", "tests/fixtures/directory_user_with_groups_email.json", + "tests/fixtures/domain_verification_intent_options.json", "tests/fixtures/dsync_activated.json", "tests/fixtures/dsync_activated_data.json", "tests/fixtures/dsync_activated_data_domain.json", @@ -887,6 +909,7 @@ "tests/fixtures/list_directory_user_with_groups.json", "tests/fixtures/list_event_schema.json", "tests/fixtures/list_flag.json", + "tests/fixtures/list_group.json", "tests/fixtures/list_organization.json", "tests/fixtures/list_role_assignment.json", "tests/fixtures/list_user.json", @@ -999,6 +1022,7 @@ "tests/fixtures/update_audit_logs_retention.json", "tests/fixtures/update_authorization_permission.json", "tests/fixtures/update_authorization_resource.json", + "tests/fixtures/update_group.json", "tests/fixtures/update_jwt_template.json", "tests/fixtures/update_oauth_application.json", "tests/fixtures/update_organization.json", @@ -1045,6 +1069,10 @@ "tests/fixtures/vault_names_listed_data.json", "tests/fixtures/verify_email_address.json", "tests/fixtures/verify_email_response.json", + "tests/fixtures/waitlist_user.json", + "tests/fixtures/waitlist_user_approved.json", + "tests/fixtures/waitlist_user_created.json", + "tests/fixtures/waitlist_user_denied.json", "tests/fixtures/webhook_endpoint_json.json", "tests/fixtures/widget_session_token.json", "tests/fixtures/widget_session_token_response.json", @@ -1056,6 +1084,7 @@ "tests/test_directory_sync.py", "tests/test_events.py", "tests/test_feature_flags.py", + "tests/test_groups.py", "tests/test_models_round_trip.py", "tests/test_multi_factor_auth.py", "tests/test_organization_domains.py", @@ -1064,7 +1093,678 @@ "tests/test_radar.py", "tests/test_sso.py", "tests/test_user_management.py", + "tests/test_user_management_organization_membership_groups.py", "tests/test_webhooks.py", "tests/test_widgets.py" - ] + ], + "operations": { + "POST /api_keys/validations": { + "sdkMethod": "create_validation", + "service": "api_keys" + }, + "DELETE /api_keys/{id}": { + "sdkMethod": "delete_api_key", + "service": "api_keys" + }, + "POST /auth/challenges/{id}/verify": { + "sdkMethod": "verify_challenge", + "service": "multi_factor_auth" + }, + "POST /auth/factors/enroll": { + "sdkMethod": "enroll_factor", + "service": "multi_factor_auth" + }, + "GET /auth/factors/{id}": { + "sdkMethod": "get_factor", + "service": "multi_factor_auth" + }, + "DELETE /auth/factors/{id}": { + "sdkMethod": "delete_factor", + "service": "multi_factor_auth" + }, + "POST /auth/factors/{id}/challenge": { + "sdkMethod": "challenge_factor", + "service": "multi_factor_auth" + }, + "POST /authkit/oauth2/complete": { + "sdkMethod": "complete_oauth2", + "service": "connect" + }, + "POST /authorization/organization_memberships/{organization_membership_id}/check": { + "sdkMethod": "check", + "service": "authorization" + }, + "GET /authorization/organization_memberships/{organization_membership_id}/resources": { + "sdkMethod": "list_resources_for_membership", + "service": "authorization" + }, + "GET /authorization/organization_memberships/{organization_membership_id}/resources/{resource_id}/permissions": { + "sdkMethod": "list_effective_permissions", + "service": "authorization" + }, + "GET /authorization/organization_memberships/{organization_membership_id}/resources/{resource_type_slug}/{external_id}/permissions": { + "sdkMethod": "list_effective_permissions_by_external_id", + "service": "authorization" + }, + "GET /authorization/organization_memberships/{organization_membership_id}/role_assignments": { + "sdkMethod": "list_role_assignments", + "service": "authorization" + }, + "POST /authorization/organization_memberships/{organization_membership_id}/role_assignments": { + "sdkMethod": "assign_role", + "service": "authorization" + }, + "DELETE /authorization/organization_memberships/{organization_membership_id}/role_assignments": { + "sdkMethod": "remove_role", + "service": "authorization" + }, + "DELETE /authorization/organization_memberships/{organization_membership_id}/role_assignments/{role_assignment_id}": { + "sdkMethod": "remove_role_assignment", + "service": "authorization" + }, + "GET /authorization/organizations/{organizationId}/roles": { + "sdkMethod": "list_organization_roles", + "service": "authorization" + }, + "POST /authorization/organizations/{organizationId}/roles": { + "sdkMethod": "create_organization_role", + "service": "authorization" + }, + "GET /authorization/organizations/{organizationId}/roles/{slug}": { + "sdkMethod": "get_organization_role", + "service": "authorization" + }, + "PATCH /authorization/organizations/{organizationId}/roles/{slug}": { + "sdkMethod": "update_organization_role", + "service": "authorization" + }, + "DELETE /authorization/organizations/{organizationId}/roles/{slug}": { + "sdkMethod": "delete_organization_role", + "service": "authorization" + }, + "POST /authorization/organizations/{organizationId}/roles/{slug}/permissions": { + "sdkMethod": "add_organization_role_permission", + "service": "authorization" + }, + "PUT /authorization/organizations/{organizationId}/roles/{slug}/permissions": { + "sdkMethod": "set_organization_role_permissions", + "service": "authorization" + }, + "DELETE /authorization/organizations/{organizationId}/roles/{slug}/permissions/{permissionSlug}": { + "sdkMethod": "remove_organization_role_permission", + "service": "authorization" + }, + "GET /authorization/organizations/{organization_id}/resources/{resource_type_slug}/{external_id}": { + "sdkMethod": "get_resource_by_external_id", + "service": "authorization" + }, + "PATCH /authorization/organizations/{organization_id}/resources/{resource_type_slug}/{external_id}": { + "sdkMethod": "update_resource_by_external_id", + "service": "authorization" + }, + "DELETE /authorization/organizations/{organization_id}/resources/{resource_type_slug}/{external_id}": { + "sdkMethod": "delete_resource_by_external_id", + "service": "authorization" + }, + "GET /authorization/organizations/{organization_id}/resources/{resource_type_slug}/{external_id}/organization_memberships": { + "sdkMethod": "list_memberships_for_resource_by_external_id", + "service": "authorization" + }, + "GET /authorization/resources": { + "sdkMethod": "list_resources", + "service": "authorization" + }, + "POST /authorization/resources": { + "sdkMethod": "create_resource", + "service": "authorization" + }, + "GET /authorization/resources/{resource_id}": { + "sdkMethod": "get_resource", + "service": "authorization" + }, + "PATCH /authorization/resources/{resource_id}": { + "sdkMethod": "update_resource", + "service": "authorization" + }, + "DELETE /authorization/resources/{resource_id}": { + "sdkMethod": "delete_resource", + "service": "authorization" + }, + "GET /authorization/resources/{resource_id}/organization_memberships": { + "sdkMethod": "list_memberships_for_resource", + "service": "authorization" + }, + "GET /authorization/roles": { + "sdkMethod": "list_environment_roles", + "service": "authorization" + }, + "POST /authorization/roles": { + "sdkMethod": "create_environment_role", + "service": "authorization" + }, + "GET /authorization/roles/{slug}": { + "sdkMethod": "get_environment_role", + "service": "authorization" + }, + "PATCH /authorization/roles/{slug}": { + "sdkMethod": "update_environment_role", + "service": "authorization" + }, + "POST /authorization/roles/{slug}/permissions": { + "sdkMethod": "add_environment_role_permission", + "service": "authorization" + }, + "PUT /authorization/roles/{slug}/permissions": { + "sdkMethod": "set_environment_role_permissions", + "service": "authorization" + }, + "GET /authorization/permissions": { + "sdkMethod": "list_permissions", + "service": "authorization" + }, + "POST /authorization/permissions": { + "sdkMethod": "create_permission", + "service": "authorization" + }, + "GET /authorization/permissions/{slug}": { + "sdkMethod": "get_permission", + "service": "authorization" + }, + "PATCH /authorization/permissions/{slug}": { + "sdkMethod": "update_permission", + "service": "authorization" + }, + "DELETE /authorization/permissions/{slug}": { + "sdkMethod": "delete_permission", + "service": "authorization" + }, + "GET /connect/applications": { + "sdkMethod": "list_applications", + "service": "connect" + }, + "POST /connect/applications": { + "sdkMethod": "create_application", + "service": "connect" + }, + "GET /connect/applications/{id}": { + "sdkMethod": "get_application", + "service": "connect" + }, + "PUT /connect/applications/{id}": { + "sdkMethod": "update_application", + "service": "connect" + }, + "DELETE /connect/applications/{id}": { + "sdkMethod": "delete_application", + "service": "connect" + }, + "GET /connect/applications/{id}/client_secrets": { + "sdkMethod": "list_application_client_secrets", + "service": "connect" + }, + "POST /connect/applications/{id}/client_secrets": { + "sdkMethod": "create_application_client_secret", + "service": "connect" + }, + "DELETE /connect/client_secrets/{id}": { + "sdkMethod": "delete_client_secret", + "service": "connect" + }, + "GET /connections": { + "sdkMethod": "list_connections", + "service": "sso" + }, + "GET /connections/{id}": { + "sdkMethod": "get_connection", + "service": "sso" + }, + "DELETE /connections/{id}": { + "sdkMethod": "delete_connection", + "service": "sso" + }, + "POST /data-integrations/{slug}/authorize": { + "sdkMethod": "authorize_data_integration", + "service": "pipes" + }, + "POST /data-integrations/{slug}/token": { + "sdkMethod": "create_data_integration_token", + "service": "pipes" + }, + "GET /directories": { + "sdkMethod": "list_directories", + "service": "directory_sync" + }, + "GET /directories/{id}": { + "sdkMethod": "get_directory", + "service": "directory_sync" + }, + "DELETE /directories/{id}": { + "sdkMethod": "delete_directory", + "service": "directory_sync" + }, + "GET /directory_groups": { + "sdkMethod": "list_groups", + "service": "directory_sync" + }, + "GET /directory_groups/{id}": { + "sdkMethod": "get_group", + "service": "directory_sync" + }, + "GET /directory_users": { + "sdkMethod": "list_users", + "service": "directory_sync" + }, + "GET /directory_users/{id}": { + "sdkMethod": "get_user", + "service": "directory_sync" + }, + "GET /events": { + "sdkMethod": "list_events", + "service": "events" + }, + "GET /feature-flags": { + "sdkMethod": "list_feature_flags", + "service": "feature_flags" + }, + "GET /feature-flags/{slug}": { + "sdkMethod": "get_feature_flag", + "service": "feature_flags" + }, + "PUT /feature-flags/{slug}/disable": { + "sdkMethod": "disable_feature_flag", + "service": "feature_flags" + }, + "PUT /feature-flags/{slug}/enable": { + "sdkMethod": "enable_feature_flag", + "service": "feature_flags" + }, + "POST /feature-flags/{slug}/targets/{resourceId}": { + "sdkMethod": "add_flag_target", + "service": "feature_flags" + }, + "DELETE /feature-flags/{slug}/targets/{resourceId}": { + "sdkMethod": "remove_flag_target", + "service": "feature_flags" + }, + "POST /organization_domains": { + "sdkMethod": "create_organization_domain", + "service": "organization_domains" + }, + "GET /organization_domains/{id}": { + "sdkMethod": "get_organization_domain", + "service": "organization_domains" + }, + "DELETE /organization_domains/{id}": { + "sdkMethod": "delete_organization_domain", + "service": "organization_domains" + }, + "POST /organization_domains/{id}/verify": { + "sdkMethod": "verify_organization_domain", + "service": "organization_domains" + }, + "GET /organizations": { + "sdkMethod": "list_organizations", + "service": "organizations" + }, + "POST /organizations": { + "sdkMethod": "create_organization", + "service": "organizations" + }, + "GET /organizations/external_id/{external_id}": { + "sdkMethod": "get_organization_by_external_id", + "service": "organizations" + }, + "GET /organizations/{id}": { + "sdkMethod": "get_organization", + "service": "organizations" + }, + "PUT /organizations/{id}": { + "sdkMethod": "update_organization", + "service": "organizations" + }, + "DELETE /organizations/{id}": { + "sdkMethod": "delete_organization", + "service": "organizations" + }, + "GET /organizations/{id}/audit_log_configuration": { + "sdkMethod": "get_audit_log_configuration", + "service": "organizations" + }, + "GET /organizations/{id}/audit_logs_retention": { + "sdkMethod": "get_organization_audit_logs_retention", + "service": "audit_logs" + }, + "PUT /organizations/{id}/audit_logs_retention": { + "sdkMethod": "update_organization_audit_logs_retention", + "service": "audit_logs" + }, + "GET /organizations/{organizationId}/api_keys": { + "sdkMethod": "list_organization_api_keys", + "service": "api_keys" + }, + "POST /organizations/{organizationId}/api_keys": { + "sdkMethod": "create_organization_api_key", + "service": "api_keys" + }, + "GET /organizations/{organizationId}/feature-flags": { + "sdkMethod": "list_organization_feature_flags", + "service": "feature_flags" + }, + "GET /organizations/{organizationId}/groups": { + "sdkMethod": "list_organization_groups", + "service": "groups" + }, + "POST /organizations/{organizationId}/groups": { + "sdkMethod": "create_organization_group", + "service": "groups" + }, + "GET /organizations/{organizationId}/groups/{groupId}": { + "sdkMethod": "get_organization_group", + "service": "groups" + }, + "PATCH /organizations/{organizationId}/groups/{groupId}": { + "sdkMethod": "update_organization_group", + "service": "groups" + }, + "DELETE /organizations/{organizationId}/groups/{groupId}": { + "sdkMethod": "delete_organization_group", + "service": "groups" + }, + "GET /organizations/{organizationId}/groups/{groupId}/organization-memberships": { + "sdkMethod": "list_group_organization_memberships", + "service": "groups" + }, + "POST /organizations/{organizationId}/groups/{groupId}/organization-memberships": { + "sdkMethod": "create_group_organization_membership", + "service": "groups" + }, + "DELETE /organizations/{organizationId}/groups/{groupId}/organization-memberships/{omId}": { + "sdkMethod": "delete_group_organization_membership", + "service": "groups" + }, + "POST /portal/generate_link": { + "sdkMethod": "generate_link", + "service": "admin_portal" + }, + "POST /radar/attempts": { + "sdkMethod": "create_attempt", + "service": "radar" + }, + "PUT /radar/attempts/{id}": { + "sdkMethod": "update_attempt", + "service": "radar" + }, + "POST /radar/lists/{type}/{action}": { + "sdkMethod": "add_list_entry", + "service": "radar" + }, + "DELETE /radar/lists/{type}/{action}": { + "sdkMethod": "remove_list_entry", + "service": "radar" + }, + "GET /sso/authorize": { + "sdkMethod": "get_authorization_url", + "service": "sso" + }, + "GET /sso/logout": { + "sdkMethod": "get_logout_url", + "service": "sso" + }, + "POST /sso/logout/authorize": { + "sdkMethod": "authorize_logout", + "service": "sso" + }, + "GET /sso/profile": { + "sdkMethod": "get_profile", + "service": "sso" + }, + "POST /sso/token": { + "sdkMethod": "get_profile_and_token", + "service": "sso" + }, + "GET /sso/jwks/{clientId}": { + "sdkMethod": "get_jwks", + "service": "user_management" + }, + "POST /user_management/authenticate": { + "sdkMethod": "create_authenticate", + "service": "user_management" + }, + "GET /user_management/authorize": { + "sdkMethod": "get_authorization_url", + "service": "user_management" + }, + "POST /user_management/authorize/device": { + "sdkMethod": "create_device", + "service": "user_management" + }, + "GET /user_management/sessions/logout": { + "sdkMethod": "get_logout_url", + "service": "user_management" + }, + "POST /user_management/sessions/revoke": { + "sdkMethod": "revoke_session", + "service": "user_management" + }, + "POST /user_management/cors_origins": { + "sdkMethod": "create_cors_origin", + "service": "user_management" + }, + "GET /user_management/email_verification/{id}": { + "sdkMethod": "get_email_verification", + "service": "user_management" + }, + "POST /user_management/password_reset": { + "sdkMethod": "reset_password", + "service": "user_management" + }, + "POST /user_management/password_reset/confirm": { + "sdkMethod": "confirm_password_reset", + "service": "user_management" + }, + "GET /user_management/password_reset/{id}": { + "sdkMethod": "get_password_reset", + "service": "user_management" + }, + "GET /user_management/users": { + "sdkMethod": "list_users", + "service": "user_management" + }, + "POST /user_management/users": { + "sdkMethod": "create_user", + "service": "user_management" + }, + "GET /user_management/users/external_id/{external_id}": { + "sdkMethod": "get_user_by_external_id", + "service": "user_management" + }, + "GET /user_management/users/{id}": { + "sdkMethod": "get_user", + "service": "user_management" + }, + "PUT /user_management/users/{id}": { + "sdkMethod": "update_user", + "service": "user_management" + }, + "DELETE /user_management/users/{id}": { + "sdkMethod": "delete_user", + "service": "user_management" + }, + "POST /user_management/users/{id}/email_change/confirm": { + "sdkMethod": "confirm_email_change", + "service": "user_management" + }, + "POST /user_management/users/{id}/email_change/send": { + "sdkMethod": "send_email_change", + "service": "user_management" + }, + "POST /user_management/users/{id}/email_verification/confirm": { + "sdkMethod": "verify_email", + "service": "user_management" + }, + "POST /user_management/users/{id}/email_verification/send": { + "sdkMethod": "send_verification_email", + "service": "user_management" + }, + "GET /user_management/users/{id}/identities": { + "sdkMethod": "get_user_identities", + "service": "user_management" + }, + "GET /user_management/users/{id}/sessions": { + "sdkMethod": "list_sessions", + "service": "user_management" + }, + "GET /user_management/invitations": { + "sdkMethod": "list_invitations", + "service": "user_management" + }, + "POST /user_management/invitations": { + "sdkMethod": "send_invitation", + "service": "user_management" + }, + "GET /user_management/invitations/by_token/{token}": { + "sdkMethod": "find_invitation_by_token", + "service": "user_management" + }, + "GET /user_management/invitations/{id}": { + "sdkMethod": "get_invitation", + "service": "user_management" + }, + "POST /user_management/invitations/{id}/accept": { + "sdkMethod": "accept_invitation", + "service": "user_management" + }, + "POST /user_management/invitations/{id}/resend": { + "sdkMethod": "resend_invitation", + "service": "user_management" + }, + "POST /user_management/invitations/{id}/revoke": { + "sdkMethod": "revoke_invitation", + "service": "user_management" + }, + "PUT /user_management/jwt_template": { + "sdkMethod": "update_jwt_template", + "service": "user_management" + }, + "POST /user_management/magic_auth": { + "sdkMethod": "create_magic_auth", + "service": "user_management" + }, + "GET /user_management/magic_auth/{id}": { + "sdkMethod": "get_magic_auth", + "service": "user_management" + }, + "GET /user_management/organization_memberships": { + "sdkMethod": "list_organization_memberships", + "service": "user_management" + }, + "POST /user_management/organization_memberships": { + "sdkMethod": "create_organization_membership", + "service": "user_management" + }, + "GET /user_management/organization_memberships/{id}": { + "sdkMethod": "get_organization_membership", + "service": "user_management" + }, + "PUT /user_management/organization_memberships/{id}": { + "sdkMethod": "update_organization_membership", + "service": "user_management" + }, + "DELETE /user_management/organization_memberships/{id}": { + "sdkMethod": "delete_organization_membership", + "service": "user_management" + }, + "PUT /user_management/organization_memberships/{id}/deactivate": { + "sdkMethod": "deactivate_organization_membership", + "service": "user_management" + }, + "PUT /user_management/organization_memberships/{id}/reactivate": { + "sdkMethod": "reactivate_organization_membership", + "service": "user_management" + }, + "GET /user_management/organization_memberships/{omId}/groups": { + "sdkMethod": "list_organization_membership_groups", + "service": "user_management_organization_membership_groups" + }, + "POST /user_management/redirect_uris": { + "sdkMethod": "create_redirect_uri", + "service": "user_management" + }, + "GET /user_management/users/{userId}/feature-flags": { + "sdkMethod": "list_user_feature_flags", + "service": "feature_flags" + }, + "GET /user_management/users/{user_id}/authorized_applications": { + "sdkMethod": "list_user_authorized_applications", + "service": "user_management" + }, + "DELETE /user_management/users/{user_id}/authorized_applications/{application_id}": { + "sdkMethod": "delete_user_authorized_application", + "service": "user_management" + }, + "GET /user_management/users/{user_id}/connected_accounts/{slug}": { + "sdkMethod": "get_user_connected_account", + "service": "pipes" + }, + "DELETE /user_management/users/{user_id}/connected_accounts/{slug}": { + "sdkMethod": "delete_user_connected_account", + "service": "pipes" + }, + "GET /user_management/users/{user_id}/data_providers": { + "sdkMethod": "list_user_data_providers", + "service": "pipes" + }, + "GET /user_management/users/{userlandUserId}/auth_factors": { + "sdkMethod": "list_user_auth_factors", + "service": "multi_factor_auth" + }, + "POST /user_management/users/{userlandUserId}/auth_factors": { + "sdkMethod": "create_user_auth_factor", + "service": "multi_factor_auth" + }, + "GET /webhook_endpoints": { + "sdkMethod": "list_webhook_endpoints", + "service": "webhooks" + }, + "POST /webhook_endpoints": { + "sdkMethod": "create_webhook_endpoint", + "service": "webhooks" + }, + "PATCH /webhook_endpoints/{id}": { + "sdkMethod": "update_webhook_endpoint", + "service": "webhooks" + }, + "DELETE /webhook_endpoints/{id}": { + "sdkMethod": "delete_webhook_endpoint", + "service": "webhooks" + }, + "POST /widgets/token": { + "sdkMethod": "create_token", + "service": "widgets" + }, + "GET /audit_logs/actions": { + "sdkMethod": "list_actions", + "service": "audit_logs" + }, + "GET /audit_logs/actions/{actionName}/schemas": { + "sdkMethod": "list_action_schemas", + "service": "audit_logs" + }, + "POST /audit_logs/actions/{actionName}/schemas": { + "sdkMethod": "create_schema", + "service": "audit_logs" + }, + "POST /audit_logs/events": { + "sdkMethod": "create_event", + "service": "audit_logs" + }, + "POST /audit_logs/exports": { + "sdkMethod": "create_export", + "service": "audit_logs" + }, + "GET /audit_logs/exports/{auditLogExportId}": { + "sdkMethod": "get_export", + "service": "audit_logs" + } + } } diff --git a/src/workos/_client.py b/src/workos/_client.py index df199e59..ecf9e9bc 100644 --- a/src/workos/_client.py +++ b/src/workos/_client.py @@ -22,19 +22,21 @@ AsyncOrganizationDomains, ) from .organizations._resource import Organizations, AsyncOrganizations +from .groups._resource import Groups, AsyncGroups from .admin_portal._resource import AdminPortal, AsyncAdminPortal from .radar._resource import Radar, AsyncRadar from .user_management._resource import UserManagement, AsyncUserManagement +from .user_management_organization_membership_groups._resource import ( + UserManagementOrganizationMembershipGroups, + AsyncUserManagementOrganizationMembershipGroups, +) from .webhooks._resource import Webhooks, AsyncWebhooks from .widgets._resource import Widgets, AsyncWidgets from .audit_logs._resource import AuditLogs, AsyncAuditLogs - -# @oagen-ignore-start — non-spec service imports (hand-maintained) from .passwordless import AsyncPasswordless, Passwordless from .vault import AsyncVault, Vault from .actions import Actions, AsyncActions from .pkce import PKCE -# @oagen-ignore-end class WorkOSClient(_SyncBase): @@ -95,6 +97,11 @@ def organizations(self) -> Organizations: """Organizations API resources.""" return Organizations(self) + @functools.cached_property + def groups(self) -> Groups: + """Groups API resources.""" + return Groups(self) + @functools.cached_property def admin_portal(self) -> AdminPortal: """Admin Portal API resources.""" @@ -110,6 +117,11 @@ def user_management(self) -> UserManagement: """User Management API resources.""" return UserManagement(self) + @functools.cached_property + def user_management_organization_membership_groups(self) -> UserManagementOrganizationMembershipGroups: + """User Management Organization Membership Groups API resources.""" + return UserManagementOrganizationMembershipGroups(self) + @functools.cached_property def webhooks(self) -> Webhooks: """Webhooks API resources.""" @@ -213,6 +225,11 @@ def organizations(self) -> AsyncOrganizations: """Organizations API resources.""" return AsyncOrganizations(self) + @functools.cached_property + def groups(self) -> AsyncGroups: + """Groups API resources.""" + return AsyncGroups(self) + @functools.cached_property def admin_portal(self) -> AsyncAdminPortal: """Admin Portal API resources.""" @@ -228,6 +245,11 @@ def user_management(self) -> AsyncUserManagement: """User Management API resources.""" return AsyncUserManagement(self) + @functools.cached_property + def user_management_organization_membership_groups(self) -> AsyncUserManagementOrganizationMembershipGroups: + """User Management Organization Membership Groups API resources.""" + return AsyncUserManagementOrganizationMembershipGroups(self) + @functools.cached_property def webhooks(self) -> AsyncWebhooks: """Webhooks API resources.""" @@ -271,3 +293,11 @@ def pkce(self) -> PKCE: return PKCE() # @oagen-ignore-end + + +# @oagen-ignore-start — non-spec service imports (hand-maintained) +from .passwordless import AsyncPasswordless, Passwordless +from .vault import AsyncVault, Vault +from .actions import Actions, AsyncActions +from .pkce import PKCE +# @oagen-ignore-end \ No newline at end of file diff --git a/src/workos/admin_portal/_resource.py b/src/workos/admin_portal/_resource.py index 65250ace..56ad70f9 100644 --- a/src/workos/admin_portal/_resource.py +++ b/src/workos/admin_portal/_resource.py @@ -2,16 +2,15 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union +from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Type, Union, cast if TYPE_CHECKING: from .._client import AsyncWorkOSClient, WorkOSClient from .._types import RequestOptions, enum_value -from .models import IntentOptions, PortalLinkResponse +from .models import GenerateLink, IntentOptions, PortalLinkResponse from workos.common.models.generate_link_intent import GenerateLinkIntent - class AdminPortal: """Admin Portal API resources.""" @@ -26,7 +25,7 @@ def generate_link( success_url: Optional[str] = None, intent: Optional[Union[GenerateLinkIntent, str]] = None, intent_options: Optional[IntentOptions] = None, - admin_emails: Optional[List[str]] = None, + it_contact_emails: Optional[List[str]] = None, request_options: Optional[RequestOptions] = None, ) -> PortalLinkResponse: """Generate a Portal Link @@ -46,7 +45,7 @@ def generate_link( - `certificate_renewal` - Launch Admin Portal for renewing SAML Certificates - `bring_your_own_key` - Launch Admin Portal for configuring Bring Your Own Key intent_options: Options to configure the Admin Portal based on the intent. - admin_emails: The email addresses of the IT admins to grant access to the Admin Portal for the given organization. Accepts up to 20 emails. + it_contact_emails: The email addresses of the IT contacts to grant access to the Admin Portal for the given organization. Accepts up to 20 emails. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: @@ -61,20 +60,14 @@ def generate_link( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "return_url": return_url, - "success_url": success_url, - "organization": organization, - "intent": enum_value(intent) if intent is not None else None, - "intent_options": intent_options.to_dict() - if intent_options is not None - else None, - "admin_emails": admin_emails, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "return_url": return_url, + "success_url": success_url, + "organization": organization, + "intent": enum_value(intent) if intent is not None else None, + "intent_options": intent_options.to_dict() if intent_options is not None else None, + "it_contact_emails": it_contact_emails, + }.items() if v is not None} return self._client.request( method="post", path="portal/generate_link", @@ -98,7 +91,7 @@ async def generate_link( success_url: Optional[str] = None, intent: Optional[Union[GenerateLinkIntent, str]] = None, intent_options: Optional[IntentOptions] = None, - admin_emails: Optional[List[str]] = None, + it_contact_emails: Optional[List[str]] = None, request_options: Optional[RequestOptions] = None, ) -> PortalLinkResponse: """Generate a Portal Link @@ -118,7 +111,7 @@ async def generate_link( - `certificate_renewal` - Launch Admin Portal for renewing SAML Certificates - `bring_your_own_key` - Launch Admin Portal for configuring Bring Your Own Key intent_options: Options to configure the Admin Portal based on the intent. - admin_emails: The email addresses of the IT admins to grant access to the Admin Portal for the given organization. Accepts up to 20 emails. + it_contact_emails: The email addresses of the IT contacts to grant access to the Admin Portal for the given organization. Accepts up to 20 emails. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. Returns: @@ -133,20 +126,14 @@ async def generate_link( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "return_url": return_url, - "success_url": success_url, - "organization": organization, - "intent": enum_value(intent) if intent is not None else None, - "intent_options": intent_options.to_dict() - if intent_options is not None - else None, - "admin_emails": admin_emails, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "return_url": return_url, + "success_url": success_url, + "organization": organization, + "intent": enum_value(intent) if intent is not None else None, + "intent_options": intent_options.to_dict() if intent_options is not None else None, + "it_contact_emails": it_contact_emails, + }.items() if v is not None} return await self._client.request( method="post", path="portal/generate_link", diff --git a/src/workos/admin_portal/models/__init__.py b/src/workos/admin_portal/models/__init__.py index 1eaede20..3178cdeb 100644 --- a/src/workos/admin_portal/models/__init__.py +++ b/src/workos/admin_portal/models/__init__.py @@ -1,5 +1,6 @@ # This file is auto-generated by oagen. Do not edit. +from .domain_verification_intent_options import DomainVerificationIntentOptions as DomainVerificationIntentOptions from .generate_link import GenerateLink as GenerateLink from .intent_options import IntentOptions as IntentOptions from .portal_link_response import PortalLinkResponse as PortalLinkResponse diff --git a/src/workos/admin_portal/models/domain_verification_intent_options.py b/src/workos/admin_portal/models/domain_verification_intent_options.py new file mode 100644 index 00000000..3e002bea --- /dev/null +++ b/src/workos/admin_portal/models/domain_verification_intent_options.py @@ -0,0 +1,33 @@ +# This file is auto-generated by oagen. Do not edit. + +from __future__ import annotations + +from dataclasses import dataclass +from typing import cast +from typing import Any, Dict, Optional +from workos._types import _raise_deserialize_error + + +@dataclass(slots=True) +class DomainVerificationIntentOptions: + """Domain Verification Intent Options model.""" + + domain_name: Optional[str] = None + """The domain name to verify. When provided, the domain verification flow will skip the domain entry form and go directly to the verification step.""" + + @classmethod + def from_dict(cls, data: Dict[str, Any]) -> "DomainVerificationIntentOptions": + """Deserialize from a dictionary.""" + try: + return cls( + domain_name=data.get("domain_name"), + ) + except (KeyError, ValueError) as e: + _raise_deserialize_error("DomainVerificationIntentOptions", e) + + def to_dict(self) -> Dict[str, Any]: + """Serialize to a dictionary.""" + result: Dict[str, Any] = {} + if self.domain_name is not None: + result["domain_name"] = self.domain_name + return result diff --git a/src/workos/admin_portal/models/generate_link.py b/src/workos/admin_portal/models/generate_link.py index e5e39d67..837fee61 100644 --- a/src/workos/admin_portal/models/generate_link.py +++ b/src/workos/admin_portal/models/generate_link.py @@ -34,8 +34,8 @@ class GenerateLink: - `bring_your_own_key` - Launch Admin Portal for configuring Bring Your Own Key""" intent_options: Optional["IntentOptions"] = None """Options to configure the Admin Portal based on the intent.""" - admin_emails: Optional[List[str]] = None - """The email addresses of the IT admins to grant access to the Admin Portal for the given organization. Accepts up to 20 emails.""" + it_contact_emails: Optional[List[str]] = None + """The email addresses of the IT contacts to grant access to the Admin Portal for the given organization. Accepts up to 20 emails.""" @classmethod def from_dict(cls, data: Dict[str, Any]) -> "GenerateLink": @@ -45,15 +45,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "GenerateLink": organization=data["organization"], return_url=data.get("return_url"), success_url=data.get("success_url"), - intent=GenerateLinkIntent(_v_intent) - if (_v_intent := data.get("intent")) is not None - else None, - intent_options=IntentOptions.from_dict( - cast(Dict[str, Any], _v_intent_options) - ) - if (_v_intent_options := data.get("intent_options")) is not None - else None, - admin_emails=data.get("admin_emails"), + intent=GenerateLinkIntent(_v_intent) if (_v_intent := data.get("intent")) is not None else None, + intent_options=IntentOptions.from_dict(cast(Dict[str, Any], _v_intent_options)) if (_v_intent_options := data.get("intent_options")) is not None else None, + it_contact_emails=data.get("it_contact_emails"), ) except (KeyError, ValueError) as e: _raise_deserialize_error("GenerateLink", e) @@ -67,11 +61,9 @@ def to_dict(self) -> Dict[str, Any]: if self.success_url is not None: result["success_url"] = self.success_url if self.intent is not None: - result["intent"] = ( - self.intent.value if isinstance(self.intent, Enum) else self.intent - ) + result["intent"] = self.intent.value if isinstance(self.intent, Enum) else self.intent if self.intent_options is not None: result["intent_options"] = self.intent_options.to_dict() - if self.admin_emails is not None: - result["admin_emails"] = self.admin_emails + if self.it_contact_emails is not None: + result["it_contact_emails"] = self.it_contact_emails return result diff --git a/src/workos/admin_portal/models/intent_options.py b/src/workos/admin_portal/models/intent_options.py index e38af492..73312f9a 100644 --- a/src/workos/admin_portal/models/intent_options.py +++ b/src/workos/admin_portal/models/intent_options.py @@ -4,9 +4,10 @@ from dataclasses import dataclass from typing import cast -from typing import Any, Dict +from typing import Any, Dict, Optional from workos._types import _raise_deserialize_error +from .domain_verification_intent_options import DomainVerificationIntentOptions from .sso_intent_options import SSOIntentOptions @@ -14,15 +15,18 @@ class IntentOptions: """Intent Options model.""" - sso: "SSOIntentOptions" + sso: Optional["SSOIntentOptions"] = None """SSO-specific options for the Admin Portal.""" + domain_verification: Optional["DomainVerificationIntentOptions"] = None + """Domain verification-specific options for the Admin Portal.""" @classmethod def from_dict(cls, data: Dict[str, Any]) -> "IntentOptions": """Deserialize from a dictionary.""" try: return cls( - sso=SSOIntentOptions.from_dict(cast(Dict[str, Any], data["sso"])), + sso=SSOIntentOptions.from_dict(cast(Dict[str, Any], _v_sso)) if (_v_sso := data.get("sso")) is not None else None, + domain_verification=DomainVerificationIntentOptions.from_dict(cast(Dict[str, Any], _v_domain_verification)) if (_v_domain_verification := data.get("domain_verification")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("IntentOptions", e) @@ -30,5 +34,8 @@ def from_dict(cls, data: Dict[str, Any]) -> "IntentOptions": def to_dict(self) -> Dict[str, Any]: """Serialize to a dictionary.""" result: Dict[str, Any] = {} - result["sso"] = self.sso.to_dict() + if self.sso is not None: + result["sso"] = self.sso.to_dict() + if self.domain_verification is not None: + result["domain_verification"] = self.domain_verification.to_dict() return result diff --git a/src/workos/admin_portal/models/portal_link_response.py b/src/workos/admin_portal/models/portal_link_response.py index 6785f1e1..0f2b3e6b 100644 --- a/src/workos/admin_portal/models/portal_link_response.py +++ b/src/workos/admin_portal/models/portal_link_response.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error diff --git a/src/workos/admin_portal/models/sso_intent_options.py b/src/workos/admin_portal/models/sso_intent_options.py index d0c8c589..ca1624a9 100644 --- a/src/workos/admin_portal/models/sso_intent_options.py +++ b/src/workos/admin_portal/models/sso_intent_options.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Literal, Optional from workos._types import _raise_deserialize_error diff --git a/src/workos/api_keys/_resource.py b/src/workos/api_keys/_resource.py index 982c12f3..eb24b0df 100644 --- a/src/workos/api_keys/_resource.py +++ b/src/workos/api_keys/_resource.py @@ -2,17 +2,16 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union +from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Type, Union, cast if TYPE_CHECKING: from .._client import AsyncWorkOSClient, WorkOSClient from .._types import RequestOptions, enum_value -from .models import ApiKey, ApiKeyValidationResponse, ApiKeyWithValue +from .models import ApiKey, ApiKeyValidationResponse, ApiKeyWithValue, CreateOrganizationApiKey, ValidateApiKey from .models import OrganizationsApiKeysOrder from .._pagination import AsyncPage, SyncPage - class ApiKeys: """Api Keys API resources.""" @@ -110,16 +109,12 @@ def list_organization_api_keys( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + }.items() if v is not None} return self._client.request_page( method="get", path=f"organizations/{organization_id}/api_keys", @@ -156,14 +151,10 @@ def create_organization_api_key( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "name": name, - "permissions": permissions, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "name": name, + "permissions": permissions, + }.items() if v is not None} return self._client.request( method="post", path=f"organizations/{organization_id}/api_keys", @@ -270,16 +261,12 @@ async def list_organization_api_keys( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + }.items() if v is not None} return await self._client.request_page( method="get", path=f"organizations/{organization_id}/api_keys", @@ -316,14 +303,10 @@ async def create_organization_api_key( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "name": name, - "permissions": permissions, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "name": name, + "permissions": permissions, + }.items() if v is not None} return await self._client.request( method="post", path=f"organizations/{organization_id}/api_keys", diff --git a/src/workos/api_keys/models/__init__.py b/src/workos/api_keys/models/__init__.py index 86ecd07b..78a472a1 100644 --- a/src/workos/api_keys/models/__init__.py +++ b/src/workos/api_keys/models/__init__.py @@ -2,15 +2,9 @@ from .api_key import ApiKey as ApiKey from .api_key_owner import ApiKeyOwner as ApiKeyOwner -from .api_key_validation_response import ( - ApiKeyValidationResponse as ApiKeyValidationResponse, -) +from .api_key_validation_response import ApiKeyValidationResponse as ApiKeyValidationResponse from .api_key_with_value import ApiKeyWithValue as ApiKeyWithValue from .api_key_with_value_owner import ApiKeyWithValueOwner as ApiKeyWithValueOwner -from .create_organization_api_key import ( - CreateOrganizationApiKey as CreateOrganizationApiKey, -) -from .organizations_api_keys_order import ( - OrganizationsApiKeysOrder as OrganizationsApiKeysOrder, -) +from .create_organization_api_key import CreateOrganizationApiKey as CreateOrganizationApiKey +from .organizations_api_keys_order import OrganizationsApiKeysOrder as OrganizationsApiKeysOrder from .validate_api_key import ValidateApiKey as ValidateApiKey diff --git a/src/workos/api_keys/models/api_key.py b/src/workos/api_keys/models/api_key.py index 0b949d8d..5a81a26a 100644 --- a/src/workos/api_keys/models/api_key.py +++ b/src/workos/api_keys/models/api_key.py @@ -45,9 +45,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "ApiKey": owner=ApiKeyOwner.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) - if (_v_last_used_at := data["last_used_at"]) is not None - else None, + last_used_at=_parse_datetime(_v_last_used_at) if (_v_last_used_at := data["last_used_at"]) is not None else None, permissions=data["permissions"], created_at=_parse_datetime(data["created_at"]), updated_at=_parse_datetime(data["updated_at"]), diff --git a/src/workos/api_keys/models/api_key_validation_response.py b/src/workos/api_keys/models/api_key_validation_response.py index 0dc28eb2..b9aedf78 100644 --- a/src/workos/api_keys/models/api_key_validation_response.py +++ b/src/workos/api_keys/models/api_key_validation_response.py @@ -21,9 +21,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "ApiKeyValidationResponse": """Deserialize from a dictionary.""" try: return cls( - api_key=ApiKey.from_dict(cast(Dict[str, Any], _v_api_key)) - if (_v_api_key := data["api_key"]) is not None - else None, + api_key=ApiKey.from_dict(cast(Dict[str, Any], _v_api_key)) if (_v_api_key := data["api_key"]) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("ApiKeyValidationResponse", e) diff --git a/src/workos/api_keys/models/api_key_with_value.py b/src/workos/api_keys/models/api_key_with_value.py index 87be490a..fe9bd8b7 100644 --- a/src/workos/api_keys/models/api_key_with_value.py +++ b/src/workos/api_keys/models/api_key_with_value.py @@ -44,14 +44,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "ApiKeyWithValue": return cls( object=data["object"], id=data["id"], - owner=ApiKeyWithValueOwner.from_dict( - cast(Dict[str, Any], data["owner"]) - ), + owner=ApiKeyWithValueOwner.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) - if (_v_last_used_at := data["last_used_at"]) is not None - else None, + last_used_at=_parse_datetime(_v_last_used_at) if (_v_last_used_at := data["last_used_at"]) is not None else None, permissions=data["permissions"], created_at=_parse_datetime(data["created_at"]), updated_at=_parse_datetime(data["updated_at"]), diff --git a/src/workos/api_keys/models/create_organization_api_key.py b/src/workos/api_keys/models/create_organization_api_key.py index 9e39ef6a..dda0bc54 100644 --- a/src/workos/api_keys/models/create_organization_api_key.py +++ b/src/workos/api_keys/models/create_organization_api_key.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, List, Optional from workos._types import _raise_deserialize_error diff --git a/src/workos/api_keys/models/validate_api_key.py b/src/workos/api_keys/models/validate_api_key.py index 513b31ed..700c87a6 100644 --- a/src/workos/api_keys/models/validate_api_key.py +++ b/src/workos/api_keys/models/validate_api_key.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error diff --git a/src/workos/audit_logs/_resource.py b/src/workos/audit_logs/_resource.py index e70ccd18..c764cb89 100644 --- a/src/workos/audit_logs/_resource.py +++ b/src/workos/audit_logs/_resource.py @@ -2,26 +2,18 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union +from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Type, Union, cast if TYPE_CHECKING: from .._client import AsyncWorkOSClient, WorkOSClient from .._types import RequestOptions, enum_value -from .models import ( - AuditLogActionJson, - AuditLogEvent, - AuditLogEventCreateResponse, - AuditLogExportJson, - AuditLogSchemaActor, - AuditLogSchemaJson, - AuditLogSchemaTarget, -) +from .models import AuditLogActionJson, AuditLogEvent, AuditLogEventCreateResponse, AuditLogEventIngestion, AuditLogExportCreation, AuditLogExportJson, AuditLogSchema, AuditLogSchemaActor, AuditLogSchemaJson, AuditLogSchemaTarget from workos.organizations.models.audit_logs_retention_json import AuditLogsRetentionJson +from workos.organizations.models.update_audit_logs_retention import UpdateAuditLogsRetention from .models import AuditLogsOrder from .._pagination import AsyncPage, SyncPage - class AuditLogs: """Audit Logs API resources.""" @@ -125,16 +117,12 @@ def list_actions( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + }.items() if v is not None} return self._client.request_page( method="get", path="audit_logs/actions", @@ -175,16 +163,12 @@ def list_action_schemas( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + }.items() if v is not None} return self._client.request_page( method="get", path=f"audit_logs/actions/{action_name}/schemas", @@ -222,15 +206,11 @@ def create_schema( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "actor": actor.to_dict() if actor is not None else None, - "targets": [item.to_dict() for item in targets], - "metadata": metadata, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "actor": actor.to_dict() if actor is not None else None, + "targets": [item.to_dict() for item in targets], + "metadata": metadata, + }.items() if v is not None} return self._client.request( method="post", path=f"audit_logs/actions/{action_name}/schemas", @@ -324,20 +304,16 @@ def create_export( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "organization_id": organization_id, - "range_start": range_start, - "range_end": range_end, - "actions": actions, - "actors": actors, - "actor_names": actor_names, - "actor_ids": actor_ids, - "targets": targets, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "organization_id": organization_id, + "range_start": range_start, + "range_end": range_end, + "actions": actions, + "actors": actors, + "actor_names": actor_names, + "actor_ids": actor_ids, + "targets": targets, + }.items() if v is not None} return self._client.request( method="post", path="audit_logs/exports", @@ -480,16 +456,12 @@ async def list_actions( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + }.items() if v is not None} return await self._client.request_page( method="get", path="audit_logs/actions", @@ -530,16 +502,12 @@ async def list_action_schemas( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + }.items() if v is not None} return await self._client.request_page( method="get", path=f"audit_logs/actions/{action_name}/schemas", @@ -577,15 +545,11 @@ async def create_schema( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "actor": actor.to_dict() if actor is not None else None, - "targets": [item.to_dict() for item in targets], - "metadata": metadata, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "actor": actor.to_dict() if actor is not None else None, + "targets": [item.to_dict() for item in targets], + "metadata": metadata, + }.items() if v is not None} return await self._client.request( method="post", path=f"audit_logs/actions/{action_name}/schemas", @@ -679,20 +643,16 @@ async def create_export( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "organization_id": organization_id, - "range_start": range_start, - "range_end": range_end, - "actions": actions, - "actors": actors, - "actor_names": actor_names, - "actor_ids": actor_ids, - "targets": targets, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "organization_id": organization_id, + "range_start": range_start, + "range_end": range_end, + "actions": actions, + "actors": actors, + "actor_names": actor_names, + "actor_ids": actor_ids, + "targets": targets, + }.items() if v is not None} return await self._client.request( method="post", path="audit_logs/exports", diff --git a/src/workos/audit_logs/models/__init__.py b/src/workos/audit_logs/models/__init__.py index 77cfcb41..201813c2 100644 --- a/src/workos/audit_logs/models/__init__.py +++ b/src/workos/audit_logs/models/__init__.py @@ -4,9 +4,7 @@ from .audit_log_event import AuditLogEvent as AuditLogEvent from .audit_log_event_actor import AuditLogEventActor as AuditLogEventActor from .audit_log_event_context import AuditLogEventContext as AuditLogEventContext -from .audit_log_event_create_response import ( - AuditLogEventCreateResponse as AuditLogEventCreateResponse, -) +from .audit_log_event_create_response import AuditLogEventCreateResponse as AuditLogEventCreateResponse from .audit_log_event_ingestion import AuditLogEventIngestion as AuditLogEventIngestion from .audit_log_event_target import AuditLogEventTarget as AuditLogEventTarget from .audit_log_export_creation import AuditLogExportCreation as AuditLogExportCreation @@ -14,11 +12,7 @@ from .audit_log_schema import AuditLogSchema as AuditLogSchema from .audit_log_schema_actor import AuditLogSchemaActor as AuditLogSchemaActor from .audit_log_schema_json import AuditLogSchemaJson as AuditLogSchemaJson -from .audit_log_schema_json_actor import ( - AuditLogSchemaJsonActor as AuditLogSchemaJsonActor, -) -from .audit_log_schema_json_target import ( - AuditLogSchemaJsonTarget as AuditLogSchemaJsonTarget, -) +from .audit_log_schema_json_actor import AuditLogSchemaJsonActor as AuditLogSchemaJsonActor +from .audit_log_schema_json_target import AuditLogSchemaJsonTarget as AuditLogSchemaJsonTarget from .audit_log_schema_target import AuditLogSchemaTarget as AuditLogSchemaTarget from .audit_logs_order import AuditLogsOrder as AuditLogsOrder diff --git a/src/workos/audit_logs/models/audit_log_action_json.py b/src/workos/audit_logs/models/audit_log_action_json.py index 52bc3ce6..d096fc76 100644 --- a/src/workos/audit_logs/models/audit_log_action_json.py +++ b/src/workos/audit_logs/models/audit_log_action_json.py @@ -34,9 +34,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuditLogActionJson": return cls( object=data["object"], name=data["name"], - schema=AuditLogSchemaJson.from_dict( - cast(Dict[str, Any], data["schema"]) - ), + schema=AuditLogSchemaJson.from_dict(cast(Dict[str, Any], data["schema"])), created_at=_parse_datetime(data["created_at"]), updated_at=_parse_datetime(data["updated_at"]), ) diff --git a/src/workos/audit_logs/models/audit_log_event.py b/src/workos/audit_logs/models/audit_log_event.py index 9826e6c7..35b2d42b 100644 --- a/src/workos/audit_logs/models/audit_log_event.py +++ b/src/workos/audit_logs/models/audit_log_event.py @@ -41,13 +41,8 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuditLogEvent": action=data["action"], occurred_at=_parse_datetime(data["occurred_at"]), actor=AuditLogEventActor.from_dict(cast(Dict[str, Any], data["actor"])), - targets=[ - AuditLogEventTarget.from_dict(cast(Dict[str, Any], item)) - for item in cast(list[Any], data["targets"]) - ], - context=AuditLogEventContext.from_dict( - cast(Dict[str, Any], data["context"]) - ), + targets=[AuditLogEventTarget.from_dict(cast(Dict[str, Any], item)) for item in cast(list[Any], data["targets"])], + context=AuditLogEventContext.from_dict(cast(Dict[str, Any], data["context"])), metadata=data.get("metadata"), version=data.get("version"), ) diff --git a/src/workos/audit_logs/models/audit_log_event_actor.py b/src/workos/audit_logs/models/audit_log_event_actor.py index bf2cd249..dfd28903 100644 --- a/src/workos/audit_logs/models/audit_log_event_actor.py +++ b/src/workos/audit_logs/models/audit_log_event_actor.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Optional, Union from workos._types import _raise_deserialize_error diff --git a/src/workos/audit_logs/models/audit_log_event_context.py b/src/workos/audit_logs/models/audit_log_event_context.py index 5a54bd7c..727a9a8e 100644 --- a/src/workos/audit_logs/models/audit_log_event_context.py +++ b/src/workos/audit_logs/models/audit_log_event_context.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Optional from workos._types import _raise_deserialize_error diff --git a/src/workos/audit_logs/models/audit_log_event_create_response.py b/src/workos/audit_logs/models/audit_log_event_create_response.py index 14353c2d..4f139c15 100644 --- a/src/workos/audit_logs/models/audit_log_event_create_response.py +++ b/src/workos/audit_logs/models/audit_log_event_create_response.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error diff --git a/src/workos/audit_logs/models/audit_log_export_creation.py b/src/workos/audit_logs/models/audit_log_export_creation.py index fb414440..29435ba3 100644 --- a/src/workos/audit_logs/models/audit_log_export_creation.py +++ b/src/workos/audit_logs/models/audit_log_export_creation.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, List, Optional from workos._types import _raise_deserialize_error diff --git a/src/workos/audit_logs/models/audit_log_export_json.py b/src/workos/audit_logs/models/audit_log_export_json.py index 58dbdee6..56f6967d 100644 --- a/src/workos/audit_logs/models/audit_log_export_json.py +++ b/src/workos/audit_logs/models/audit_log_export_json.py @@ -5,6 +5,7 @@ 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 @@ -48,9 +49,7 @@ def to_dict(self) -> Dict[str, Any]: result: Dict[str, Any] = {} result["object"] = self.object result["id"] = self.id - result["state"] = ( - self.state.value if isinstance(self.state, Enum) else self.state - ) + result["state"] = self.state.value if isinstance(self.state, Enum) else self.state result["created_at"] = _format_datetime(self.created_at) result["updated_at"] = _format_datetime(self.updated_at) if self.url is not None: diff --git a/src/workos/audit_logs/models/audit_log_schema.py b/src/workos/audit_logs/models/audit_log_schema.py index 564f43e1..367d729c 100644 --- a/src/workos/audit_logs/models/audit_log_schema.py +++ b/src/workos/audit_logs/models/audit_log_schema.py @@ -27,13 +27,8 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuditLogSchema": """Deserialize from a dictionary.""" try: return cls( - targets=[ - AuditLogSchemaTarget.from_dict(cast(Dict[str, Any], item)) - for item in cast(list[Any], data["targets"]) - ], - actor=AuditLogSchemaActor.from_dict(cast(Dict[str, Any], _v_actor)) - if (_v_actor := data.get("actor")) is not None - else None, + targets=[AuditLogSchemaTarget.from_dict(cast(Dict[str, Any], item)) for item in cast(list[Any], data["targets"])], + actor=AuditLogSchemaActor.from_dict(cast(Dict[str, Any], _v_actor)) if (_v_actor := data.get("actor")) is not None else None, metadata=data.get("metadata"), ) except (KeyError, ValueError) as e: diff --git a/src/workos/audit_logs/models/audit_log_schema_actor.py b/src/workos/audit_logs/models/audit_log_schema_actor.py index b6896963..83d4b195 100644 --- a/src/workos/audit_logs/models/audit_log_schema_actor.py +++ b/src/workos/audit_logs/models/audit_log_schema_actor.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error diff --git a/src/workos/audit_logs/models/audit_log_schema_json.py b/src/workos/audit_logs/models/audit_log_schema_json.py index 6a9d4bea..c655ff6e 100644 --- a/src/workos/audit_logs/models/audit_log_schema_json.py +++ b/src/workos/audit_logs/models/audit_log_schema_json.py @@ -37,14 +37,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuditLogSchemaJson": return cls( object=data["object"], version=data["version"], - targets=[ - AuditLogSchemaJsonTarget.from_dict(cast(Dict[str, Any], item)) - for item in cast(list[Any], data["targets"]) - ], + targets=[AuditLogSchemaJsonTarget.from_dict(cast(Dict[str, Any], item)) for item in cast(list[Any], data["targets"])], created_at=_parse_datetime(data["created_at"]), - actor=AuditLogSchemaJsonActor.from_dict(cast(Dict[str, Any], _v_actor)) - if (_v_actor := data.get("actor")) is not None - else None, + actor=AuditLogSchemaJsonActor.from_dict(cast(Dict[str, Any], _v_actor)) if (_v_actor := data.get("actor")) is not None else None, metadata=data.get("metadata"), ) except (KeyError, ValueError) as e: diff --git a/src/workos/audit_logs/models/audit_log_schema_json_target.py b/src/workos/audit_logs/models/audit_log_schema_json_target.py index cccca9e0..0902599e 100644 --- a/src/workos/audit_logs/models/audit_log_schema_json_target.py +++ b/src/workos/audit_logs/models/audit_log_schema_json_target.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Optional from workos._types import _raise_deserialize_error diff --git a/src/workos/authorization/__init__.py b/src/workos/authorization/__init__.py index 25484043..27e24064 100644 --- a/src/workos/authorization/__init__.py +++ b/src/workos/authorization/__init__.py @@ -1,13 +1,4 @@ # This file is auto-generated by oagen. Do not edit. -from ._resource import ( - Authorization, - AsyncAuthorization, - ResourceTargetById, - ResourceTargetByExternalId, - ParentResourceById, - ParentResourceByExternalId, - ParentById, - ParentByExternalId, -) +from ._resource import Authorization, AsyncAuthorization, ResourceTargetById, ResourceTargetByExternalId, ParentResourceById, ParentResourceByExternalId, ParentById, ParentByExternalId from .models import * diff --git a/src/workos/authorization/_resource.py b/src/workos/authorization/_resource.py index 7f4b5a9e..9ae18dcd 100644 --- a/src/workos/authorization/_resource.py +++ b/src/workos/authorization/_resource.py @@ -2,72 +2,50 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union +from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Type, Union, cast if TYPE_CHECKING: from .._client import AsyncWorkOSClient, WorkOSClient from .._types import RequestOptions, enum_value -from .models import ( - AuthorizationCheck, - AuthorizationPermission, - AuthorizationResource, - Permission, - Role, - RoleAssignment, - RoleList, - UserOrganizationMembershipBaseListData, -) +from .models import AddRolePermission, AssignRole, AuthorizationCheck, AuthorizationPermission, AuthorizationResource, CheckAuthorization, CreateAuthorizationPermission, CreateAuthorizationResource, CreateOrganizationRole, CreateRole, Permission, RemoveRole, Role, RoleAssignment, RoleList, SetRolePermissions, UpdateAuthorizationPermission, UpdateAuthorizationResource, UpdateOrganizationRole, UpdateRole, UserOrganizationMembershipBaseListData from .models import AuthorizationAssignment, AuthorizationOrder, PermissionsOrder from .._pagination import AsyncPage, SyncPage from dataclasses import dataclass - @dataclass class ResourceTargetById: """Identify resource target by id.""" - resource_id: str - @dataclass class ResourceTargetByExternalId: """Identify resource target by external id.""" - resource_external_id: str resource_type_slug: str - @dataclass class ParentResourceById: """Identify parent resource by id.""" - parent_resource_id: str - @dataclass class ParentResourceByExternalId: """Identify parent resource by external id.""" - parent_resource_type_slug: str parent_resource_external_id: str - @dataclass class ParentById: """Identify parent by id.""" - parent_resource_id: str - @dataclass class ParentByExternalId: """Identify parent by external id.""" - parent_resource_type_slug: str parent_external_id: str - class Authorization: """Authorization API resources.""" @@ -119,7 +97,7 @@ def check( request_options=request_options, ) - def list_organization_membership_resources( + def list_resources_for_membership( self, organization_membership_id: str, *, @@ -159,26 +137,18 @@ def list_organization_membership_resources( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - "permission_slug": permission_slug, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + "permission_slug": permission_slug, + }.items() if v is not None} if isinstance(parent_resource, ParentResourceById): params["parent_resource_id"] = parent_resource.parent_resource_id elif isinstance(parent_resource, ParentResourceByExternalId): - params["parent_resource_type_slug"] = ( - parent_resource.parent_resource_type_slug - ) - params["parent_resource_external_id"] = ( - parent_resource.parent_resource_external_id - ) + params["parent_resource_type_slug"] = parent_resource.parent_resource_type_slug + params["parent_resource_external_id"] = parent_resource.parent_resource_external_id return self._client.request_page( method="get", path=f"authorization/organization_memberships/{organization_membership_id}/resources", @@ -187,7 +157,7 @@ def list_organization_membership_resources( request_options=request_options, ) - def list_resource_permissions( + def list_effective_permissions( self, organization_membership_id: str, resource_id: str, @@ -222,16 +192,12 @@ def list_resource_permissions( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + }.items() if v is not None} return self._client.request_page( method="get", path=f"authorization/organization_memberships/{organization_membership_id}/resources/{resource_id}/permissions", @@ -277,16 +243,12 @@ def list_effective_permissions_by_external_id( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + }.items() if v is not None} return self._client.request_page( method="get", path=f"authorization/organization_memberships/{organization_membership_id}/resources/{resource_type_slug}/{external_id}/permissions", @@ -295,7 +257,7 @@ def list_effective_permissions_by_external_id( request_options=request_options, ) - def list_organization_membership_role_assignments( + def list_role_assignments( self, organization_membership_id: str, *, @@ -327,16 +289,12 @@ def list_organization_membership_role_assignments( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + }.items() if v is not None} return self._client.request_page( method="get", path=f"authorization/organization_memberships/{organization_membership_id}/role_assignments", @@ -431,7 +389,7 @@ def remove_role( request_options=request_options, ) - def delete_organization_membership_role_assignment( + def remove_role_assignment( self, organization_membership_id: str, role_assignment_id: str, @@ -526,16 +484,12 @@ def create_organization_role( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "slug": slug, - "name": name, - "description": description, - "resource_type_slug": resource_type_slug, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "slug": slug, + "name": name, + "description": description, + "resource_type_slug": resource_type_slug, + }.items() if v is not None} return self._client.request( method="post", path=f"authorization/organizations/{organization_id}/roles", @@ -609,14 +563,10 @@ def update_organization_role( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "name": name, - "description": description, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "name": name, + "description": description, + }.items() if v is not None} return self._client.request( method="patch", path=f"authorization/organizations/{organization_id}/roles/{slug}", @@ -656,7 +606,7 @@ def delete_organization_role( request_options=request_options, ) - def create_role_permission( + def add_organization_role_permission( self, organization_id: str, slug: str, @@ -697,7 +647,7 @@ def create_role_permission( request_options=request_options, ) - def update_role_permissions( + def set_organization_role_permissions( self, organization_id: str, slug: str, @@ -737,7 +687,7 @@ def update_role_permissions( request_options=request_options, ) - def delete_role_permission( + def remove_organization_role_permission( self, organization_id: str, slug: str, @@ -768,7 +718,7 @@ def delete_role_permission( request_options=request_options, ) - def get_organization_resource( + def get_resource_by_external_id( self, organization_id: str, resource_type_slug: str, @@ -803,7 +753,7 @@ def get_organization_resource( request_options=request_options, ) - def update_organization_resource( + def update_resource_by_external_id( self, organization_id: str, resource_type_slug: str, @@ -811,9 +761,7 @@ def update_organization_resource( *, name: Optional[str] = None, description: Optional[str] = None, - parent_resource: Optional[ - Union[ParentResourceById, ParentResourceByExternalId] - ] = None, + parent_resource: Optional[Union[ParentResourceById, ParentResourceByExternalId]] = None, request_options: Optional[RequestOptions] = None, ) -> AuthorizationResource: """Update a resource by external ID @@ -842,24 +790,16 @@ def update_organization_resource( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "name": name, - "description": description, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "name": name, + "description": description, + }.items() if v is not None} if parent_resource is not None: if isinstance(parent_resource, ParentResourceById): body["parent_resource_id"] = parent_resource.parent_resource_id elif isinstance(parent_resource, ParentResourceByExternalId): - body["parent_resource_external_id"] = ( - parent_resource.parent_resource_external_id - ) - body["parent_resource_type_slug"] = ( - parent_resource.parent_resource_type_slug - ) + body["parent_resource_external_id"] = parent_resource.parent_resource_external_id + body["parent_resource_type_slug"] = parent_resource.parent_resource_type_slug return self._client.request( method="patch", path=f"authorization/organizations/{organization_id}/resources/{resource_type_slug}/{external_id}", @@ -868,7 +808,7 @@ def update_organization_resource( request_options=request_options, ) - def delete_organization_resource( + def delete_resource_by_external_id( self, organization_id: str, resource_type_slug: str, @@ -897,13 +837,9 @@ def delete_organization_resource( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params: Dict[str, Any] = { - k: v - for k, v in { - "cascade_delete": cascade_delete, - }.items() - if v is not None - } + params: Dict[str, Any] = {k: v for k, v in { + "cascade_delete": cascade_delete, + }.items() if v is not None} self._client.request( method="delete", path=f"authorization/organizations/{organization_id}/resources/{resource_type_slug}/{external_id}", @@ -911,7 +847,7 @@ def delete_organization_resource( request_options=request_options, ) - def list_resource_organization_memberships( + def list_memberships_for_resource_by_external_id( self, organization_id: str, resource_type_slug: str, @@ -953,20 +889,14 @@ def list_resource_organization_memberships( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - "permission_slug": permission_slug, - "assignment": enum_value(assignment) - if assignment is not None - else None, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + "permission_slug": permission_slug, + "assignment": enum_value(assignment) if assignment is not None else None, + }.items() if v is not None} return self._client.request_page( method="get", path=f"authorization/organizations/{organization_id}/resources/{resource_type_slug}/{external_id}/organization_memberships", @@ -984,6 +914,7 @@ def list_resources( order: Optional[Union[AuthorizationOrder, str]] = "desc", organization_id: Optional[str] = None, resource_type_slug: Optional[str] = None, + resource_external_id: Optional[str] = None, search: Optional[str] = None, parent: Optional[Union[ParentById, ParentByExternalId]] = None, request_options: Optional[RequestOptions] = None, @@ -999,6 +930,7 @@ def list_resources( order: Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. Defaults to `desc`. organization_id: Filter resources by organization ID. resource_type_slug: Filter resources by resource type slug. + resource_external_id: Filter resources by external ID. search: Search resources by name. parent: Identifies the parent. One of: ParentById, ParentByExternalId. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. @@ -1013,19 +945,16 @@ def list_resources( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - "organization_id": organization_id, - "resource_type_slug": resource_type_slug, - "search": search, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + "organization_id": organization_id, + "resource_type_slug": resource_type_slug, + "resource_external_id": resource_external_id, + "search": search, + }.items() if v is not None} if parent is not None: if isinstance(parent, ParentById): params["parent_resource_id"] = parent.parent_resource_id @@ -1048,9 +977,7 @@ def create_resource( resource_type_slug: str, organization_id: str, description: Optional[str] = None, - parent_resource: Optional[ - Union[ParentResourceById, ParentResourceByExternalId] - ] = None, + parent_resource: Optional[Union[ParentResourceById, ParentResourceByExternalId]] = None, request_options: Optional[RequestOptions] = None, ) -> AuthorizationResource: """Create an authorization resource @@ -1079,27 +1006,19 @@ def create_resource( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "external_id": external_id, - "name": name, - "description": description, - "resource_type_slug": resource_type_slug, - "organization_id": organization_id, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "external_id": external_id, + "name": name, + "description": description, + "resource_type_slug": resource_type_slug, + "organization_id": organization_id, + }.items() if v is not None} if parent_resource is not None: if isinstance(parent_resource, ParentResourceById): body["parent_resource_id"] = parent_resource.parent_resource_id elif isinstance(parent_resource, ParentResourceByExternalId): - body["parent_resource_external_id"] = ( - parent_resource.parent_resource_external_id - ) - body["parent_resource_type_slug"] = ( - parent_resource.parent_resource_type_slug - ) + body["parent_resource_external_id"] = parent_resource.parent_resource_external_id + body["parent_resource_type_slug"] = parent_resource.parent_resource_type_slug return self._client.request( method="post", path="authorization/resources", @@ -1146,9 +1065,7 @@ def update_resource( *, name: Optional[str] = None, description: Optional[str] = None, - parent_resource: Optional[ - Union[ParentResourceById, ParentResourceByExternalId] - ] = None, + parent_resource: Optional[Union[ParentResourceById, ParentResourceByExternalId]] = None, request_options: Optional[RequestOptions] = None, ) -> AuthorizationResource: """Update a resource @@ -1175,24 +1092,16 @@ def update_resource( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "name": name, - "description": description, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "name": name, + "description": description, + }.items() if v is not None} if parent_resource is not None: if isinstance(parent_resource, ParentResourceById): body["parent_resource_id"] = parent_resource.parent_resource_id elif isinstance(parent_resource, ParentResourceByExternalId): - body["parent_resource_external_id"] = ( - parent_resource.parent_resource_external_id - ) - body["parent_resource_type_slug"] = ( - parent_resource.parent_resource_type_slug - ) + body["parent_resource_external_id"] = parent_resource.parent_resource_external_id + body["parent_resource_type_slug"] = parent_resource.parent_resource_type_slug return self._client.request( method="patch", path=f"authorization/resources/{resource_id}", @@ -1226,13 +1135,9 @@ def delete_resource( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params: Dict[str, Any] = { - k: v - for k, v in { - "cascade_delete": cascade_delete, - }.items() - if v is not None - } + params: Dict[str, Any] = {k: v for k, v in { + "cascade_delete": cascade_delete, + }.items() if v is not None} self._client.request( method="delete", path=f"authorization/resources/{resource_id}", @@ -1278,20 +1183,14 @@ def list_memberships_for_resource( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - "permission_slug": permission_slug, - "assignment": enum_value(assignment) - if assignment is not None - else None, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + "permission_slug": permission_slug, + "assignment": enum_value(assignment) if assignment is not None else None, + }.items() if v is not None} return self._client.request_page( method="get", path=f"authorization/resources/{resource_id}/organization_memberships", @@ -1358,16 +1257,12 @@ def create_environment_role( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "slug": slug, - "name": name, - "description": description, - "resource_type_slug": resource_type_slug, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "slug": slug, + "name": name, + "description": description, + "resource_type_slug": resource_type_slug, + }.items() if v is not None} return self._client.request( method="post", path="authorization/roles", @@ -1437,14 +1332,10 @@ def update_environment_role( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "name": name, - "description": description, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "name": name, + "description": description, + }.items() if v is not None} return self._client.request( method="patch", path=f"authorization/roles/{slug}", @@ -1560,16 +1451,12 @@ def list_permissions( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + }.items() if v is not None} return self._client.request_page( method="get", path="authorization/permissions", @@ -1610,16 +1497,12 @@ def create_permission( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "slug": slug, - "name": name, - "description": description, - "resource_type_slug": resource_type_slug, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "slug": slug, + "name": name, + "description": description, + "resource_type_slug": resource_type_slug, + }.items() if v is not None} return self._client.request( method="post", path="authorization/permissions", @@ -1687,14 +1570,10 @@ def update_permission( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "name": name, - "description": description, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "name": name, + "description": description, + }.items() if v is not None} return self._client.request( method="patch", path=f"authorization/permissions/{slug}", @@ -1782,7 +1661,7 @@ async def check( request_options=request_options, ) - async def list_organization_membership_resources( + async def list_resources_for_membership( self, organization_membership_id: str, *, @@ -1822,26 +1701,18 @@ async def list_organization_membership_resources( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - "permission_slug": permission_slug, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + "permission_slug": permission_slug, + }.items() if v is not None} if isinstance(parent_resource, ParentResourceById): params["parent_resource_id"] = parent_resource.parent_resource_id elif isinstance(parent_resource, ParentResourceByExternalId): - params["parent_resource_type_slug"] = ( - parent_resource.parent_resource_type_slug - ) - params["parent_resource_external_id"] = ( - parent_resource.parent_resource_external_id - ) + params["parent_resource_type_slug"] = parent_resource.parent_resource_type_slug + params["parent_resource_external_id"] = parent_resource.parent_resource_external_id return await self._client.request_page( method="get", path=f"authorization/organization_memberships/{organization_membership_id}/resources", @@ -1850,7 +1721,7 @@ async def list_organization_membership_resources( request_options=request_options, ) - async def list_resource_permissions( + async def list_effective_permissions( self, organization_membership_id: str, resource_id: str, @@ -1885,16 +1756,12 @@ async def list_resource_permissions( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + }.items() if v is not None} return await self._client.request_page( method="get", path=f"authorization/organization_memberships/{organization_membership_id}/resources/{resource_id}/permissions", @@ -1940,16 +1807,12 @@ async def list_effective_permissions_by_external_id( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + }.items() if v is not None} return await self._client.request_page( method="get", path=f"authorization/organization_memberships/{organization_membership_id}/resources/{resource_type_slug}/{external_id}/permissions", @@ -1958,7 +1821,7 @@ async def list_effective_permissions_by_external_id( request_options=request_options, ) - async def list_organization_membership_role_assignments( + async def list_role_assignments( self, organization_membership_id: str, *, @@ -1990,16 +1853,12 @@ async def list_organization_membership_role_assignments( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + }.items() if v is not None} return await self._client.request_page( method="get", path=f"authorization/organization_memberships/{organization_membership_id}/role_assignments", @@ -2094,7 +1953,7 @@ async def remove_role( request_options=request_options, ) - async def delete_organization_membership_role_assignment( + async def remove_role_assignment( self, organization_membership_id: str, role_assignment_id: str, @@ -2189,16 +2048,12 @@ async def create_organization_role( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "slug": slug, - "name": name, - "description": description, - "resource_type_slug": resource_type_slug, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "slug": slug, + "name": name, + "description": description, + "resource_type_slug": resource_type_slug, + }.items() if v is not None} return await self._client.request( method="post", path=f"authorization/organizations/{organization_id}/roles", @@ -2272,14 +2127,10 @@ async def update_organization_role( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "name": name, - "description": description, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "name": name, + "description": description, + }.items() if v is not None} return await self._client.request( method="patch", path=f"authorization/organizations/{organization_id}/roles/{slug}", @@ -2319,7 +2170,7 @@ async def delete_organization_role( request_options=request_options, ) - async def create_role_permission( + async def add_organization_role_permission( self, organization_id: str, slug: str, @@ -2360,7 +2211,7 @@ async def create_role_permission( request_options=request_options, ) - async def update_role_permissions( + async def set_organization_role_permissions( self, organization_id: str, slug: str, @@ -2400,7 +2251,7 @@ async def update_role_permissions( request_options=request_options, ) - async def delete_role_permission( + async def remove_organization_role_permission( self, organization_id: str, slug: str, @@ -2431,7 +2282,7 @@ async def delete_role_permission( request_options=request_options, ) - async def get_organization_resource( + async def get_resource_by_external_id( self, organization_id: str, resource_type_slug: str, @@ -2466,7 +2317,7 @@ async def get_organization_resource( request_options=request_options, ) - async def update_organization_resource( + async def update_resource_by_external_id( self, organization_id: str, resource_type_slug: str, @@ -2474,9 +2325,7 @@ async def update_organization_resource( *, name: Optional[str] = None, description: Optional[str] = None, - parent_resource: Optional[ - Union[ParentResourceById, ParentResourceByExternalId] - ] = None, + parent_resource: Optional[Union[ParentResourceById, ParentResourceByExternalId]] = None, request_options: Optional[RequestOptions] = None, ) -> AuthorizationResource: """Update a resource by external ID @@ -2505,24 +2354,16 @@ async def update_organization_resource( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "name": name, - "description": description, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "name": name, + "description": description, + }.items() if v is not None} if parent_resource is not None: if isinstance(parent_resource, ParentResourceById): body["parent_resource_id"] = parent_resource.parent_resource_id elif isinstance(parent_resource, ParentResourceByExternalId): - body["parent_resource_external_id"] = ( - parent_resource.parent_resource_external_id - ) - body["parent_resource_type_slug"] = ( - parent_resource.parent_resource_type_slug - ) + body["parent_resource_external_id"] = parent_resource.parent_resource_external_id + body["parent_resource_type_slug"] = parent_resource.parent_resource_type_slug return await self._client.request( method="patch", path=f"authorization/organizations/{organization_id}/resources/{resource_type_slug}/{external_id}", @@ -2531,7 +2372,7 @@ async def update_organization_resource( request_options=request_options, ) - async def delete_organization_resource( + async def delete_resource_by_external_id( self, organization_id: str, resource_type_slug: str, @@ -2560,13 +2401,9 @@ async def delete_organization_resource( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params: Dict[str, Any] = { - k: v - for k, v in { - "cascade_delete": cascade_delete, - }.items() - if v is not None - } + params: Dict[str, Any] = {k: v for k, v in { + "cascade_delete": cascade_delete, + }.items() if v is not None} await self._client.request( method="delete", path=f"authorization/organizations/{organization_id}/resources/{resource_type_slug}/{external_id}", @@ -2574,7 +2411,7 @@ async def delete_organization_resource( request_options=request_options, ) - async def list_resource_organization_memberships( + async def list_memberships_for_resource_by_external_id( self, organization_id: str, resource_type_slug: str, @@ -2616,20 +2453,14 @@ async def list_resource_organization_memberships( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - "permission_slug": permission_slug, - "assignment": enum_value(assignment) - if assignment is not None - else None, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + "permission_slug": permission_slug, + "assignment": enum_value(assignment) if assignment is not None else None, + }.items() if v is not None} return await self._client.request_page( method="get", path=f"authorization/organizations/{organization_id}/resources/{resource_type_slug}/{external_id}/organization_memberships", @@ -2647,6 +2478,7 @@ async def list_resources( order: Optional[Union[AuthorizationOrder, str]] = "desc", organization_id: Optional[str] = None, resource_type_slug: Optional[str] = None, + resource_external_id: Optional[str] = None, search: Optional[str] = None, parent: Optional[Union[ParentById, ParentByExternalId]] = None, request_options: Optional[RequestOptions] = None, @@ -2662,6 +2494,7 @@ async def list_resources( order: Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. Defaults to `desc`. organization_id: Filter resources by organization ID. resource_type_slug: Filter resources by resource type slug. + resource_external_id: Filter resources by external ID. search: Search resources by name. parent: Identifies the parent. One of: ParentById, ParentByExternalId. request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. @@ -2676,19 +2509,16 @@ async def list_resources( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - "organization_id": organization_id, - "resource_type_slug": resource_type_slug, - "search": search, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + "organization_id": organization_id, + "resource_type_slug": resource_type_slug, + "resource_external_id": resource_external_id, + "search": search, + }.items() if v is not None} if parent is not None: if isinstance(parent, ParentById): params["parent_resource_id"] = parent.parent_resource_id @@ -2711,9 +2541,7 @@ async def create_resource( resource_type_slug: str, organization_id: str, description: Optional[str] = None, - parent_resource: Optional[ - Union[ParentResourceById, ParentResourceByExternalId] - ] = None, + parent_resource: Optional[Union[ParentResourceById, ParentResourceByExternalId]] = None, request_options: Optional[RequestOptions] = None, ) -> AuthorizationResource: """Create an authorization resource @@ -2742,27 +2570,19 @@ async def create_resource( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "external_id": external_id, - "name": name, - "description": description, - "resource_type_slug": resource_type_slug, - "organization_id": organization_id, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "external_id": external_id, + "name": name, + "description": description, + "resource_type_slug": resource_type_slug, + "organization_id": organization_id, + }.items() if v is not None} if parent_resource is not None: if isinstance(parent_resource, ParentResourceById): body["parent_resource_id"] = parent_resource.parent_resource_id elif isinstance(parent_resource, ParentResourceByExternalId): - body["parent_resource_external_id"] = ( - parent_resource.parent_resource_external_id - ) - body["parent_resource_type_slug"] = ( - parent_resource.parent_resource_type_slug - ) + body["parent_resource_external_id"] = parent_resource.parent_resource_external_id + body["parent_resource_type_slug"] = parent_resource.parent_resource_type_slug return await self._client.request( method="post", path="authorization/resources", @@ -2809,9 +2629,7 @@ async def update_resource( *, name: Optional[str] = None, description: Optional[str] = None, - parent_resource: Optional[ - Union[ParentResourceById, ParentResourceByExternalId] - ] = None, + parent_resource: Optional[Union[ParentResourceById, ParentResourceByExternalId]] = None, request_options: Optional[RequestOptions] = None, ) -> AuthorizationResource: """Update a resource @@ -2838,24 +2656,16 @@ async def update_resource( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "name": name, - "description": description, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "name": name, + "description": description, + }.items() if v is not None} if parent_resource is not None: if isinstance(parent_resource, ParentResourceById): body["parent_resource_id"] = parent_resource.parent_resource_id elif isinstance(parent_resource, ParentResourceByExternalId): - body["parent_resource_external_id"] = ( - parent_resource.parent_resource_external_id - ) - body["parent_resource_type_slug"] = ( - parent_resource.parent_resource_type_slug - ) + body["parent_resource_external_id"] = parent_resource.parent_resource_external_id + body["parent_resource_type_slug"] = parent_resource.parent_resource_type_slug return await self._client.request( method="patch", path=f"authorization/resources/{resource_id}", @@ -2889,13 +2699,9 @@ async def delete_resource( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params: Dict[str, Any] = { - k: v - for k, v in { - "cascade_delete": cascade_delete, - }.items() - if v is not None - } + params: Dict[str, Any] = {k: v for k, v in { + "cascade_delete": cascade_delete, + }.items() if v is not None} await self._client.request( method="delete", path=f"authorization/resources/{resource_id}", @@ -2941,20 +2747,14 @@ async def list_memberships_for_resource( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - "permission_slug": permission_slug, - "assignment": enum_value(assignment) - if assignment is not None - else None, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + "permission_slug": permission_slug, + "assignment": enum_value(assignment) if assignment is not None else None, + }.items() if v is not None} return await self._client.request_page( method="get", path=f"authorization/resources/{resource_id}/organization_memberships", @@ -3021,16 +2821,12 @@ async def create_environment_role( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "slug": slug, - "name": name, - "description": description, - "resource_type_slug": resource_type_slug, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "slug": slug, + "name": name, + "description": description, + "resource_type_slug": resource_type_slug, + }.items() if v is not None} return await self._client.request( method="post", path="authorization/roles", @@ -3100,14 +2896,10 @@ async def update_environment_role( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "name": name, - "description": description, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "name": name, + "description": description, + }.items() if v is not None} return await self._client.request( method="patch", path=f"authorization/roles/{slug}", @@ -3223,16 +3015,12 @@ async def list_permissions( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + }.items() if v is not None} return await self._client.request_page( method="get", path="authorization/permissions", @@ -3273,16 +3061,12 @@ async def create_permission( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "slug": slug, - "name": name, - "description": description, - "resource_type_slug": resource_type_slug, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "slug": slug, + "name": name, + "description": description, + "resource_type_slug": resource_type_slug, + }.items() if v is not None} return await self._client.request( method="post", path="authorization/permissions", @@ -3350,14 +3134,10 @@ async def update_permission( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "name": name, - "description": description, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "name": name, + "description": description, + }.items() if v is not None} return await self._client.request( method="patch", path=f"authorization/permissions/{slug}", diff --git a/src/workos/authorization/models/__init__.py b/src/workos/authorization/models/__init__.py index 6e303bff..b8aef240 100644 --- a/src/workos/authorization/models/__init__.py +++ b/src/workos/authorization/models/__init__.py @@ -8,12 +8,8 @@ from .authorization_permission import AuthorizationPermission as AuthorizationPermission from .authorization_resource import AuthorizationResource as AuthorizationResource from .check_authorization import CheckAuthorization as CheckAuthorization -from .create_authorization_permission import ( - CreateAuthorizationPermission as CreateAuthorizationPermission, -) -from .create_authorization_resource import ( - CreateAuthorizationResource as CreateAuthorizationResource, -) +from .create_authorization_permission import CreateAuthorizationPermission as CreateAuthorizationPermission +from .create_authorization_resource import CreateAuthorizationResource as CreateAuthorizationResource from .create_organization_role import CreateOrganizationRole as CreateOrganizationRole from .create_role import CreateRole as CreateRole from .permission import Permission as Permission @@ -25,14 +21,8 @@ from .role_list import RoleList as RoleList from .set_role_permissions import SetRolePermissions as SetRolePermissions from .slim_role import SlimRole as SlimRole -from .update_authorization_permission import ( - UpdateAuthorizationPermission as UpdateAuthorizationPermission, -) -from .update_authorization_resource import ( - UpdateAuthorizationResource as UpdateAuthorizationResource, -) +from .update_authorization_permission import UpdateAuthorizationPermission as UpdateAuthorizationPermission +from .update_authorization_resource import UpdateAuthorizationResource as UpdateAuthorizationResource from .update_organization_role import UpdateOrganizationRole as UpdateOrganizationRole from .update_role import UpdateRole as UpdateRole -from .user_organization_membership_base_list_data import ( - UserOrganizationMembershipBaseListData as UserOrganizationMembershipBaseListData, -) +from .user_organization_membership_base_list_data import UserOrganizationMembershipBaseListData as UserOrganizationMembershipBaseListData diff --git a/src/workos/authorization/models/add_role_permission.py b/src/workos/authorization/models/add_role_permission.py index 76bbf030..75236495 100644 --- a/src/workos/authorization/models/add_role_permission.py +++ b/src/workos/authorization/models/add_role_permission.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error diff --git a/src/workos/authorization/models/assign_role.py b/src/workos/authorization/models/assign_role.py index 15701aad..092fef4d 100644 --- a/src/workos/authorization/models/assign_role.py +++ b/src/workos/authorization/models/assign_role.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Optional from workos._types import _raise_deserialize_error diff --git a/src/workos/authorization/models/authorization_assignment.py b/src/workos/authorization/models/authorization_assignment.py index b24c8bd3..055aa303 100644 --- a/src/workos/authorization/models/authorization_assignment.py +++ b/src/workos/authorization/models/authorization_assignment.py @@ -24,5 +24,4 @@ def _missing_(cls, value: object) -> Optional["AuthorizationAssignment"]: unknown._value_ = value return unknown - AuthorizationAssignmentLiteral: TypeAlias = Literal["direct", "indirect"] diff --git a/src/workos/authorization/models/authorization_check.py b/src/workos/authorization/models/authorization_check.py index 20159339..f5500163 100644 --- a/src/workos/authorization/models/authorization_check.py +++ b/src/workos/authorization/models/authorization_check.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error diff --git a/src/workos/authorization/models/authorization_permission.py b/src/workos/authorization/models/authorization_permission.py index 0bf6db07..2bb4577c 100644 --- a/src/workos/authorization/models/authorization_permission.py +++ b/src/workos/authorization/models/authorization_permission.py @@ -4,6 +4,7 @@ from dataclasses import dataclass from datetime import datetime +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 diff --git a/src/workos/authorization/models/authorization_resource.py b/src/workos/authorization/models/authorization_resource.py index 7cd77d1a..08deebe3 100644 --- a/src/workos/authorization/models/authorization_resource.py +++ b/src/workos/authorization/models/authorization_resource.py @@ -4,6 +4,7 @@ from dataclasses import dataclass from datetime import datetime +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 diff --git a/src/workos/authorization/models/check_authorization.py b/src/workos/authorization/models/check_authorization.py index 7ca3ac69..dd557515 100644 --- a/src/workos/authorization/models/check_authorization.py +++ b/src/workos/authorization/models/check_authorization.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Optional from workos._types import _raise_deserialize_error diff --git a/src/workos/authorization/models/create_authorization_permission.py b/src/workos/authorization/models/create_authorization_permission.py index af789d69..25f4b6cb 100644 --- a/src/workos/authorization/models/create_authorization_permission.py +++ b/src/workos/authorization/models/create_authorization_permission.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Optional from workos._types import _raise_deserialize_error diff --git a/src/workos/authorization/models/create_authorization_resource.py b/src/workos/authorization/models/create_authorization_resource.py index 8fd685aa..5a8c58c4 100644 --- a/src/workos/authorization/models/create_authorization_resource.py +++ b/src/workos/authorization/models/create_authorization_resource.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Optional from workos._types import _raise_deserialize_error diff --git a/src/workos/authorization/models/create_organization_role.py b/src/workos/authorization/models/create_organization_role.py index 2b04ff51..20fd650a 100644 --- a/src/workos/authorization/models/create_organization_role.py +++ b/src/workos/authorization/models/create_organization_role.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Optional from workos._types import _raise_deserialize_error diff --git a/src/workos/authorization/models/role.py b/src/workos/authorization/models/role.py index 736e948e..8ee6eae3 100644 --- a/src/workos/authorization/models/role.py +++ b/src/workos/authorization/models/role.py @@ -5,6 +5,7 @@ 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 diff --git a/src/workos/authorization/models/role_assignment.py b/src/workos/authorization/models/role_assignment.py index cf915b6f..54bcc834 100644 --- a/src/workos/authorization/models/role_assignment.py +++ b/src/workos/authorization/models/role_assignment.py @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "RoleAssignment": object=data["object"], id=data["id"], role=SlimRole.from_dict(cast(Dict[str, Any], data["role"])), - resource=RoleAssignmentResource.from_dict( - cast(Dict[str, Any], data["resource"]) - ), + resource=RoleAssignmentResource.from_dict(cast(Dict[str, Any], data["resource"])), created_at=_parse_datetime(data["created_at"]), updated_at=_parse_datetime(data["updated_at"]), ) diff --git a/src/workos/authorization/models/role_assignment_resource.py b/src/workos/authorization/models/role_assignment_resource.py index 3d57016c..551556fb 100644 --- a/src/workos/authorization/models/role_assignment_resource.py +++ b/src/workos/authorization/models/role_assignment_resource.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error diff --git a/src/workos/authorization/models/role_list.py b/src/workos/authorization/models/role_list.py index 23c7952e..ebf40a49 100644 --- a/src/workos/authorization/models/role_list.py +++ b/src/workos/authorization/models/role_list.py @@ -24,10 +24,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "RoleList": try: return cls( object=data["object"], - data=[ - Role.from_dict(cast(Dict[str, Any], item)) - for item in cast(list[Any], data["data"]) - ], + data=[Role.from_dict(cast(Dict[str, Any], item)) for item in cast(list[Any], data["data"])], ) except (KeyError, ValueError) as e: _raise_deserialize_error("RoleList", e) diff --git a/src/workos/authorization/models/set_role_permissions.py b/src/workos/authorization/models/set_role_permissions.py index 453971ab..f96be3d1 100644 --- a/src/workos/authorization/models/set_role_permissions.py +++ b/src/workos/authorization/models/set_role_permissions.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, List from workos._types import _raise_deserialize_error diff --git a/src/workos/authorization/models/update_authorization_permission.py b/src/workos/authorization/models/update_authorization_permission.py index 7481ac1e..6770174b 100644 --- a/src/workos/authorization/models/update_authorization_permission.py +++ b/src/workos/authorization/models/update_authorization_permission.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Optional from workos._types import _raise_deserialize_error diff --git a/src/workos/authorization/models/update_authorization_resource.py b/src/workos/authorization/models/update_authorization_resource.py index 268acc43..7411c608 100644 --- a/src/workos/authorization/models/update_authorization_resource.py +++ b/src/workos/authorization/models/update_authorization_resource.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Optional from workos._types import _raise_deserialize_error diff --git a/src/workos/authorization/models/user_organization_membership_base_list_data.py b/src/workos/authorization/models/user_organization_membership_base_list_data.py index 1ea1b9f1..1a7f2fb1 100644 --- a/src/workos/authorization/models/user_organization_membership_base_list_data.py +++ b/src/workos/authorization/models/user_organization_membership_base_list_data.py @@ -5,12 +5,11 @@ 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 workos.common.models.user_organization_membership_base_list_data_status import ( - UserOrganizationMembershipBaseListDataStatus, -) +from workos.common.models.user_organization_membership_base_list_data_status import UserOrganizationMembershipBaseListDataStatus @dataclass(slots=True) @@ -39,9 +38,7 @@ class UserOrganizationMembershipBaseListData: """An object containing IdP-sourced attributes from the linked [Directory User](https://workos.com/docs/reference/directory-sync/directory-user) or [SSO Profile](https://workos.com/docs/reference/sso/profile). Directory User attributes take precedence when both are linked.""" @classmethod - def from_dict( - cls, data: Dict[str, Any] - ) -> "UserOrganizationMembershipBaseListData": + def from_dict(cls, data: Dict[str, Any]) -> "UserOrganizationMembershipBaseListData": """Deserialize from a dictionary.""" try: return cls( @@ -66,9 +63,7 @@ def to_dict(self) -> Dict[str, Any]: result["id"] = self.id result["user_id"] = self.user_id result["organization_id"] = self.organization_id - result["status"] = ( - self.status.value if isinstance(self.status, Enum) else self.status - ) + result["status"] = self.status.value if isinstance(self.status, Enum) else self.status result["directory_managed"] = self.directory_managed result["created_at"] = _format_datetime(self.created_at) result["updated_at"] = _format_datetime(self.updated_at) diff --git a/src/workos/common/__init__.py b/src/workos/common/__init__.py index babfb718..c50cbb78 100644 --- a/src/workos/common/__init__.py +++ b/src/workos/common/__init__.py @@ -10,48 +10,24 @@ from .models import ApiKeyRevoked as ApiKeyRevoked from .models import ApiKeyRevokedData as ApiKeyRevokedData from .models import ApiKeyRevokedDataOwner as ApiKeyRevokedDataOwner -from .models import ( - AuditLogConfigurationLogStreamState as AuditLogConfigurationLogStreamState, -) -from .models import ( - AuditLogConfigurationLogStreamType as AuditLogConfigurationLogStreamType, -) +from .models import AuditLogConfigurationLogStreamState as AuditLogConfigurationLogStreamState +from .models import AuditLogConfigurationLogStreamType as AuditLogConfigurationLogStreamType from .models import AuditLogConfigurationState as AuditLogConfigurationState from .models import AuditLogExportJsonState as AuditLogExportJsonState -from .models import ( - AuthenticateResponseAuthenticationMethod as AuthenticateResponseAuthenticationMethod, -) -from .models import ( - AuthenticationEmailVerificationFailed as AuthenticationEmailVerificationFailed, -) -from .models import ( - AuthenticationEmailVerificationFailedData as AuthenticationEmailVerificationFailedData, -) -from .models import ( - AuthenticationEmailVerificationFailedDataError as AuthenticationEmailVerificationFailedDataError, -) -from .models import ( - AuthenticationEmailVerificationSucceeded as AuthenticationEmailVerificationSucceeded, -) -from .models import ( - AuthenticationEmailVerificationSucceededData as AuthenticationEmailVerificationSucceededData, -) +from .models import AuthenticateResponseAuthenticationMethod as AuthenticateResponseAuthenticationMethod +from .models import AuthenticationEmailVerificationFailed as AuthenticationEmailVerificationFailed +from .models import AuthenticationEmailVerificationFailedData as AuthenticationEmailVerificationFailedData +from .models import AuthenticationEmailVerificationFailedDataError as AuthenticationEmailVerificationFailedDataError +from .models import AuthenticationEmailVerificationSucceeded as AuthenticationEmailVerificationSucceeded +from .models import AuthenticationEmailVerificationSucceededData as AuthenticationEmailVerificationSucceededData from .models import AuthenticationFactorEnrolledType as AuthenticationFactorEnrolledType from .models import AuthenticationFactorType as AuthenticationFactorType -from .models import ( - AuthenticationFactorsCreateRequestType as AuthenticationFactorsCreateRequestType, -) +from .models import AuthenticationFactorsCreateRequestType as AuthenticationFactorsCreateRequestType from .models import AuthenticationMagicAuthFailed as AuthenticationMagicAuthFailed -from .models import ( - AuthenticationMagicAuthFailedData as AuthenticationMagicAuthFailedData, -) -from .models import ( - AuthenticationMagicAuthFailedDataError as AuthenticationMagicAuthFailedDataError, -) +from .models import AuthenticationMagicAuthFailedData as AuthenticationMagicAuthFailedData +from .models import AuthenticationMagicAuthFailedDataError as AuthenticationMagicAuthFailedDataError from .models import AuthenticationMagicAuthSucceeded as AuthenticationMagicAuthSucceeded -from .models import ( - AuthenticationMagicAuthSucceededData as AuthenticationMagicAuthSucceededData, -) +from .models import AuthenticationMagicAuthSucceededData as AuthenticationMagicAuthSucceededData from .models import AuthenticationMFAFailed as AuthenticationMFAFailed from .models import AuthenticationMFAFailedData as AuthenticationMFAFailedData from .models import AuthenticationMFAFailedDataError as AuthenticationMFAFailedDataError @@ -59,33 +35,21 @@ from .models import AuthenticationMFASucceededData as AuthenticationMFASucceededData from .models import AuthenticationOAuthFailed as AuthenticationOAuthFailed from .models import AuthenticationOAuthFailedData as AuthenticationOAuthFailedData -from .models import ( - AuthenticationOAuthFailedDataError as AuthenticationOAuthFailedDataError, -) +from .models import AuthenticationOAuthFailedDataError as AuthenticationOAuthFailedDataError from .models import AuthenticationOAuthSucceeded as AuthenticationOAuthSucceeded from .models import AuthenticationOAuthSucceededData as AuthenticationOAuthSucceededData from .models import AuthenticationPasskeyFailed as AuthenticationPasskeyFailed from .models import AuthenticationPasskeyFailedData as AuthenticationPasskeyFailedData -from .models import ( - AuthenticationPasskeyFailedDataError as AuthenticationPasskeyFailedDataError, -) +from .models import AuthenticationPasskeyFailedDataError as AuthenticationPasskeyFailedDataError from .models import AuthenticationPasskeySucceeded as AuthenticationPasskeySucceeded -from .models import ( - AuthenticationPasskeySucceededData as AuthenticationPasskeySucceededData, -) +from .models import AuthenticationPasskeySucceededData as AuthenticationPasskeySucceededData from .models import AuthenticationPasswordFailed as AuthenticationPasswordFailed from .models import AuthenticationPasswordFailedData as AuthenticationPasswordFailedData -from .models import ( - AuthenticationPasswordFailedDataError as AuthenticationPasswordFailedDataError, -) +from .models import AuthenticationPasswordFailedDataError as AuthenticationPasswordFailedDataError from .models import AuthenticationPasswordSucceeded as AuthenticationPasswordSucceeded -from .models import ( - AuthenticationPasswordSucceededData as AuthenticationPasswordSucceededData, -) +from .models import AuthenticationPasswordSucceededData as AuthenticationPasswordSucceededData from .models import AuthenticationRadarRiskDetected as AuthenticationRadarRiskDetected -from .models import ( - AuthenticationRadarRiskDetectedData as AuthenticationRadarRiskDetectedData, -) +from .models import AuthenticationRadarRiskDetectedData as AuthenticationRadarRiskDetectedData from .models import AuthenticationSSOFailed as AuthenticationSSOFailed from .models import AuthenticationSSOFailedData as AuthenticationSSOFailedData from .models import AuthenticationSSOFailedDataError as AuthenticationSSOFailedDataError @@ -95,14 +59,10 @@ from .models import AuthenticationSSOStartedDataSSO as AuthenticationSSOStartedDataSSO from .models import AuthenticationSSOSucceeded as AuthenticationSSOSucceeded from .models import AuthenticationSSOSucceededData as AuthenticationSSOSucceededData -from .models import ( - AuthenticationSSOSucceededDataSSO as AuthenticationSSOSucceededDataSSO, -) +from .models import AuthenticationSSOSucceededDataSSO as AuthenticationSSOSucceededDataSSO from .models import AuthenticationSSOTimedOut as AuthenticationSSOTimedOut from .models import AuthenticationSSOTimedOutData as AuthenticationSSOTimedOutData -from .models import ( - AuthenticationSSOTimedOutDataError as AuthenticationSSOTimedOutDataError, -) +from .models import AuthenticationSSOTimedOutDataError as AuthenticationSSOTimedOutDataError from .models import AuthenticationSSOTimedOutDataSSO as AuthenticationSSOTimedOutDataSSO from .models import ConnectedAccountState as ConnectedAccountState from .models import ConnectionActivated as ConnectionActivated @@ -113,43 +73,23 @@ from .models import ConnectionDeactivatedDataDomain as ConnectionDeactivatedDataDomain from .models import ConnectionDeleted as ConnectionDeleted from .models import ConnectionDeletedData as ConnectionDeletedData -from .models import ( - ConnectionSAMLCertificateRenewalRequired as ConnectionSAMLCertificateRenewalRequired, -) -from .models import ( - ConnectionSAMLCertificateRenewalRequiredData as ConnectionSAMLCertificateRenewalRequiredData, -) -from .models import ( - ConnectionSAMLCertificateRenewalRequiredDataCertificate as ConnectionSAMLCertificateRenewalRequiredDataCertificate, -) -from .models import ( - ConnectionSAMLCertificateRenewalRequiredDataConnection as ConnectionSAMLCertificateRenewalRequiredDataConnection, -) +from .models import ConnectionSAMLCertificateRenewalRequired as ConnectionSAMLCertificateRenewalRequired +from .models import ConnectionSAMLCertificateRenewalRequiredData as ConnectionSAMLCertificateRenewalRequiredData +from .models import ConnectionSAMLCertificateRenewalRequiredDataCertificate as ConnectionSAMLCertificateRenewalRequiredDataCertificate +from .models import ConnectionSAMLCertificateRenewalRequiredDataConnection as ConnectionSAMLCertificateRenewalRequiredDataConnection from .models import ConnectionSAMLCertificateRenewed as ConnectionSAMLCertificateRenewed -from .models import ( - ConnectionSAMLCertificateRenewedData as ConnectionSAMLCertificateRenewedData, -) -from .models import ( - ConnectionSAMLCertificateRenewedDataCertificate as ConnectionSAMLCertificateRenewedDataCertificate, -) -from .models import ( - ConnectionSAMLCertificateRenewedDataConnection as ConnectionSAMLCertificateRenewedDataConnection, -) +from .models import ConnectionSAMLCertificateRenewedData as ConnectionSAMLCertificateRenewedData +from .models import ConnectionSAMLCertificateRenewedDataCertificate as ConnectionSAMLCertificateRenewedDataCertificate +from .models import ConnectionSAMLCertificateRenewedDataConnection as ConnectionSAMLCertificateRenewedDataConnection from .models import ConnectionState as ConnectionState from .models import ConnectionStatus as ConnectionStatus from .models import ConnectionType as ConnectionType from .models import CreateUserInviteOptionsLocale as CreateUserInviteOptionsLocale from .models import CreateUserPasswordHashType as CreateUserPasswordHashType from .models import CreateWebhookEndpointEvents as CreateWebhookEndpointEvents -from .models import ( - DataIntegrationAccessTokenResponseError as DataIntegrationAccessTokenResponseError, -) -from .models import ( - DataIntegrationsListResponseDataConnectedAccountState as DataIntegrationsListResponseDataConnectedAccountState, -) -from .models import ( - DataIntegrationsListResponseDataOwnership as DataIntegrationsListResponseDataOwnership, -) +from .models import DataIntegrationAccessTokenResponseError as DataIntegrationAccessTokenResponseError +from .models import DataIntegrationsListResponseDataConnectedAccountState as DataIntegrationsListResponseDataConnectedAccountState +from .models import DataIntegrationsListResponseDataOwnership as DataIntegrationsListResponseDataOwnership from .models import DirectoryState as DirectoryState from .models import DirectoryType as DirectoryType from .models import DirectoryUser as DirectoryUser @@ -180,9 +120,7 @@ from .models import EmailVerificationCreatedData as EmailVerificationCreatedData from .models import EventContext as EventContext from .models import EventContextActor as EventContextActor -from .models import ( - EventContextGoogleAnalyticsSession as EventContextGoogleAnalyticsSession, -) +from .models import EventContextGoogleAnalyticsSession as EventContextGoogleAnalyticsSession from .models import FlagCreated as FlagCreated from .models import FlagCreatedContext as FlagCreatedContext from .models import FlagCreatedContextActor as FlagCreatedContextActor @@ -196,48 +134,25 @@ from .models import FlagRuleUpdated as FlagRuleUpdated from .models import FlagRuleUpdatedContext as FlagRuleUpdatedContext from .models import FlagRuleUpdatedContextActor as FlagRuleUpdatedContextActor -from .models import ( - FlagRuleUpdatedContextConfiguredTarget as FlagRuleUpdatedContextConfiguredTarget, -) -from .models import ( - FlagRuleUpdatedContextConfiguredTargetOrganization as FlagRuleUpdatedContextConfiguredTargetOrganization, -) -from .models import ( - FlagRuleUpdatedContextConfiguredTargetUser as FlagRuleUpdatedContextConfiguredTargetUser, -) -from .models import ( - FlagRuleUpdatedContextPreviousAttribute as FlagRuleUpdatedContextPreviousAttribute, -) -from .models import ( - FlagRuleUpdatedContextPreviousAttributeContext as FlagRuleUpdatedContextPreviousAttributeContext, -) -from .models import ( - FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget as FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget, -) -from .models import ( - FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetOrganization as FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetOrganization, -) -from .models import ( - FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetUser as FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetUser, -) -from .models import ( - FlagRuleUpdatedContextPreviousAttributeData as FlagRuleUpdatedContextPreviousAttributeData, -) +from .models import FlagRuleUpdatedContextConfiguredTarget as FlagRuleUpdatedContextConfiguredTarget +from .models import FlagRuleUpdatedContextConfiguredTargetOrganization as FlagRuleUpdatedContextConfiguredTargetOrganization +from .models import FlagRuleUpdatedContextConfiguredTargetUser as FlagRuleUpdatedContextConfiguredTargetUser +from .models import FlagRuleUpdatedContextPreviousAttribute as FlagRuleUpdatedContextPreviousAttribute +from .models import FlagRuleUpdatedContextPreviousAttributeContext as FlagRuleUpdatedContextPreviousAttributeContext +from .models import FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget as FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget +from .models import FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetOrganization as FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetOrganization +from .models import FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetUser as FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetUser +from .models import FlagRuleUpdatedContextPreviousAttributeData as FlagRuleUpdatedContextPreviousAttributeData from .models import FlagRuleUpdatedData as FlagRuleUpdatedData from .models import FlagRuleUpdatedDataOwner as FlagRuleUpdatedDataOwner from .models import FlagUpdated as FlagUpdated from .models import FlagUpdatedContext as FlagUpdatedContext from .models import FlagUpdatedContextActor as FlagUpdatedContextActor -from .models import ( - FlagUpdatedContextPreviousAttribute as FlagUpdatedContextPreviousAttribute, -) -from .models import ( - FlagUpdatedContextPreviousAttributeData as FlagUpdatedContextPreviousAttributeData, -) +from .models import FlagUpdatedContextPreviousAttribute as FlagUpdatedContextPreviousAttribute +from .models import FlagUpdatedContextPreviousAttributeData as FlagUpdatedContextPreviousAttributeData from .models import FlagUpdatedData as FlagUpdatedData from .models import FlagUpdatedDataOwner as FlagUpdatedDataOwner from .models import GenerateLinkIntent as GenerateLinkIntent -from .models import Group as Group from .models import GroupCreated as GroupCreated from .models import GroupDeleted as GroupDeleted from .models import GroupMemberAdded as GroupMemberAdded @@ -267,42 +182,24 @@ from .models import OrganizationDomainDataState as OrganizationDomainDataState from .models import OrganizationDomainDeleted as OrganizationDomainDeleted from .models import OrganizationDomainDeletedData as OrganizationDomainDeletedData -from .models import ( - OrganizationDomainStandAloneState as OrganizationDomainStandAloneState, -) -from .models import ( - OrganizationDomainStandAloneVerificationStrategy as OrganizationDomainStandAloneVerificationStrategy, -) +from .models import OrganizationDomainStandAloneState as OrganizationDomainStandAloneState +from .models import OrganizationDomainStandAloneVerificationStrategy as OrganizationDomainStandAloneVerificationStrategy from .models import OrganizationDomainState as OrganizationDomainState from .models import OrganizationDomainUpdated as OrganizationDomainUpdated from .models import OrganizationDomainUpdatedData as OrganizationDomainUpdatedData -from .models import ( - OrganizationDomainVerificationFailed as OrganizationDomainVerificationFailed, -) -from .models import ( - OrganizationDomainVerificationFailedData as OrganizationDomainVerificationFailedData, -) -from .models import ( - OrganizationDomainVerificationFailedDataOrganizationDomain as OrganizationDomainVerificationFailedDataOrganizationDomain, -) -from .models import ( - OrganizationDomainVerificationStrategy as OrganizationDomainVerificationStrategy, -) +from .models import OrganizationDomainVerificationFailed as OrganizationDomainVerificationFailed +from .models import OrganizationDomainVerificationFailedData as OrganizationDomainVerificationFailedData +from .models import OrganizationDomainVerificationFailedDataOrganizationDomain as OrganizationDomainVerificationFailedDataOrganizationDomain +from .models import OrganizationDomainVerificationStrategy as OrganizationDomainVerificationStrategy from .models import OrganizationDomainVerified as OrganizationDomainVerified from .models import OrganizationDomainVerifiedData as OrganizationDomainVerifiedData from .models import OrganizationMembershipCreated as OrganizationMembershipCreated -from .models import ( - OrganizationMembershipCreatedData as OrganizationMembershipCreatedData, -) +from .models import OrganizationMembershipCreatedData as OrganizationMembershipCreatedData from .models import OrganizationMembershipDeleted as OrganizationMembershipDeleted -from .models import ( - OrganizationMembershipDeletedData as OrganizationMembershipDeletedData, -) +from .models import OrganizationMembershipDeletedData as OrganizationMembershipDeletedData from .models import OrganizationMembershipStatus as OrganizationMembershipStatus from .models import OrganizationMembershipUpdated as OrganizationMembershipUpdated -from .models import ( - OrganizationMembershipUpdatedData as OrganizationMembershipUpdatedData, -) +from .models import OrganizationMembershipUpdatedData as OrganizationMembershipUpdatedData from .models import OrganizationRoleCreated as OrganizationRoleCreated from .models import OrganizationRoleCreatedData as OrganizationRoleCreatedData from .models import OrganizationRoleDeleted as OrganizationRoleDeleted @@ -323,15 +220,9 @@ from .models import PermissionUpdated as PermissionUpdated from .models import PermissionUpdatedData as PermissionUpdatedData from .models import ProfileConnectionType as ProfileConnectionType -from .models import ( - RadarStandaloneAssessRequestAction as RadarStandaloneAssessRequestAction, -) -from .models import ( - RadarStandaloneAssessRequestAuthMethod as RadarStandaloneAssessRequestAuthMethod, -) -from .models import ( - RadarStandaloneResponseBlocklistType as RadarStandaloneResponseBlocklistType, -) +from .models import RadarStandaloneAssessRequestAction as RadarStandaloneAssessRequestAction +from .models import RadarStandaloneAssessRequestAuthMethod as RadarStandaloneAssessRequestAuthMethod +from .models import RadarStandaloneResponseBlocklistType as RadarStandaloneResponseBlocklistType from .models import RadarStandaloneResponseControl as RadarStandaloneResponseControl from .models import RadarStandaloneResponseVerdict as RadarStandaloneResponseVerdict from .models import ResendUserInviteOptionsLocale as ResendUserInviteOptionsLocale @@ -355,19 +246,13 @@ from .models import UserDeleted as UserDeleted from .models import UserIdentitiesGetItemProvider as UserIdentitiesGetItemProvider from .models import UserInviteState as UserInviteState -from .models import ( - UserOrganizationMembershipBaseListDataStatus as UserOrganizationMembershipBaseListDataStatus, -) +from .models import UserOrganizationMembershipBaseListDataStatus as UserOrganizationMembershipBaseListDataStatus from .models import UserOrganizationMembershipStatus as UserOrganizationMembershipStatus from .models import UserSessionsAuthMethod as UserSessionsAuthMethod from .models import UserSessionsStatus as UserSessionsStatus from .models import UserUpdated as UserUpdated -from .models import ( - VaultByokKeyVerificationCompleted as VaultByokKeyVerificationCompleted, -) -from .models import ( - VaultByokKeyVerificationCompletedData as VaultByokKeyVerificationCompletedData, -) +from .models import VaultByokKeyVerificationCompleted as VaultByokKeyVerificationCompleted +from .models import VaultByokKeyVerificationCompletedData as VaultByokKeyVerificationCompletedData from .models import VaultDataCreated as VaultDataCreated from .models import VaultDataCreatedData as VaultDataCreatedData from .models import VaultDataDeleted as VaultDataDeleted @@ -386,5 +271,9 @@ from .models import VaultMetadataReadData as VaultMetadataReadData from .models import VaultNamesListed as VaultNamesListed from .models import VaultNamesListedData as VaultNamesListedData +from .models import WaitlistUser as WaitlistUser +from .models import WaitlistUserApproved as WaitlistUserApproved +from .models import WaitlistUserCreated as WaitlistUserCreated +from .models import WaitlistUserDenied as WaitlistUserDenied from .models import WebhookEndpointJsonStatus as WebhookEndpointJsonStatus from .models import WidgetSessionTokenScopes as WidgetSessionTokenScopes diff --git a/src/workos/common/models/__init__.py b/src/workos/common/models/__init__.py index 0e0e9b4b..ebdf03a6 100644 --- a/src/workos/common/models/__init__.py +++ b/src/workos/common/models/__init__.py @@ -1,264 +1,106 @@ # This file is auto-generated by oagen. Do not edit. -from .action_authentication_denied import ( - ActionAuthenticationDenied as ActionAuthenticationDenied, -) -from .action_authentication_denied_data import ( - ActionAuthenticationDeniedData as ActionAuthenticationDeniedData, -) -from .action_user_registration_denied import ( - ActionUserRegistrationDenied as ActionUserRegistrationDenied, -) -from .action_user_registration_denied_data import ( - ActionUserRegistrationDeniedData as ActionUserRegistrationDeniedData, -) +from .action_authentication_denied import ActionAuthenticationDenied as ActionAuthenticationDenied +from .action_authentication_denied_data import ActionAuthenticationDeniedData as ActionAuthenticationDeniedData +from .action_user_registration_denied import ActionUserRegistrationDenied as ActionUserRegistrationDenied +from .action_user_registration_denied_data import ActionUserRegistrationDeniedData as ActionUserRegistrationDeniedData from .api_key_created import ApiKeyCreated as ApiKeyCreated from .api_key_created_data import ApiKeyCreatedData as ApiKeyCreatedData from .api_key_created_data_owner import ApiKeyCreatedDataOwner as ApiKeyCreatedDataOwner from .api_key_revoked import ApiKeyRevoked as ApiKeyRevoked from .api_key_revoked_data import ApiKeyRevokedData as ApiKeyRevokedData from .api_key_revoked_data_owner import ApiKeyRevokedDataOwner as ApiKeyRevokedDataOwner -from .audit_log_configuration_log_stream_state import ( - AuditLogConfigurationLogStreamState as AuditLogConfigurationLogStreamState, -) -from .audit_log_configuration_log_stream_type import ( - AuditLogConfigurationLogStreamType as AuditLogConfigurationLogStreamType, -) -from .audit_log_configuration_state import ( - AuditLogConfigurationState as AuditLogConfigurationState, -) -from .audit_log_export_json_state import ( - AuditLogExportJsonState as AuditLogExportJsonState, -) -from .authenticate_response_authentication_method import ( - AuthenticateResponseAuthenticationMethod as AuthenticateResponseAuthenticationMethod, -) -from .authentication_email_verification_failed import ( - AuthenticationEmailVerificationFailed as AuthenticationEmailVerificationFailed, -) -from .authentication_email_verification_failed_data import ( - AuthenticationEmailVerificationFailedData as AuthenticationEmailVerificationFailedData, -) -from .authentication_email_verification_failed_data_error import ( - AuthenticationEmailVerificationFailedDataError as AuthenticationEmailVerificationFailedDataError, -) -from .authentication_email_verification_succeeded import ( - AuthenticationEmailVerificationSucceeded as AuthenticationEmailVerificationSucceeded, -) -from .authentication_email_verification_succeeded_data import ( - AuthenticationEmailVerificationSucceededData as AuthenticationEmailVerificationSucceededData, -) -from .authentication_factor_enrolled_type import ( - AuthenticationFactorEnrolledType as AuthenticationFactorEnrolledType, -) -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, -) -from .authentication_magic_auth_failed_data import ( - AuthenticationMagicAuthFailedData as AuthenticationMagicAuthFailedData, -) -from .authentication_magic_auth_failed_data_error import ( - AuthenticationMagicAuthFailedDataError as AuthenticationMagicAuthFailedDataError, -) -from .authentication_magic_auth_succeeded import ( - AuthenticationMagicAuthSucceeded as AuthenticationMagicAuthSucceeded, -) -from .authentication_magic_auth_succeeded_data import ( - AuthenticationMagicAuthSucceededData as AuthenticationMagicAuthSucceededData, -) -from .authentication_mfa_failed import ( - AuthenticationMFAFailed as AuthenticationMFAFailed, -) -from .authentication_mfa_failed_data import ( - AuthenticationMFAFailedData as AuthenticationMFAFailedData, -) -from .authentication_mfa_failed_data_error import ( - AuthenticationMFAFailedDataError as AuthenticationMFAFailedDataError, -) -from .authentication_mfa_succeeded import ( - AuthenticationMFASucceeded as AuthenticationMFASucceeded, -) -from .authentication_mfa_succeeded_data import ( - AuthenticationMFASucceededData as AuthenticationMFASucceededData, -) -from .authentication_oauth_failed import ( - AuthenticationOAuthFailed as AuthenticationOAuthFailed, -) -from .authentication_oauth_failed_data import ( - AuthenticationOAuthFailedData as AuthenticationOAuthFailedData, -) -from .authentication_oauth_failed_data_error import ( - AuthenticationOAuthFailedDataError as AuthenticationOAuthFailedDataError, -) -from .authentication_oauth_succeeded import ( - AuthenticationOAuthSucceeded as AuthenticationOAuthSucceeded, -) -from .authentication_oauth_succeeded_data import ( - AuthenticationOAuthSucceededData as AuthenticationOAuthSucceededData, -) -from .authentication_passkey_failed import ( - AuthenticationPasskeyFailed as AuthenticationPasskeyFailed, -) -from .authentication_passkey_failed_data import ( - AuthenticationPasskeyFailedData as AuthenticationPasskeyFailedData, -) -from .authentication_passkey_failed_data_error import ( - AuthenticationPasskeyFailedDataError as AuthenticationPasskeyFailedDataError, -) -from .authentication_passkey_succeeded import ( - AuthenticationPasskeySucceeded as AuthenticationPasskeySucceeded, -) -from .authentication_passkey_succeeded_data import ( - AuthenticationPasskeySucceededData as AuthenticationPasskeySucceededData, -) -from .authentication_password_failed import ( - AuthenticationPasswordFailed as AuthenticationPasswordFailed, -) -from .authentication_password_failed_data import ( - AuthenticationPasswordFailedData as AuthenticationPasswordFailedData, -) -from .authentication_password_failed_data_error import ( - AuthenticationPasswordFailedDataError as AuthenticationPasswordFailedDataError, -) -from .authentication_password_succeeded import ( - AuthenticationPasswordSucceeded as AuthenticationPasswordSucceeded, -) -from .authentication_password_succeeded_data import ( - AuthenticationPasswordSucceededData as AuthenticationPasswordSucceededData, -) -from .authentication_radar_risk_detected import ( - AuthenticationRadarRiskDetected as AuthenticationRadarRiskDetected, -) -from .authentication_radar_risk_detected_data import ( - AuthenticationRadarRiskDetectedData as AuthenticationRadarRiskDetectedData, -) -from .authentication_sso_failed import ( - AuthenticationSSOFailed as AuthenticationSSOFailed, -) -from .authentication_sso_failed_data import ( - AuthenticationSSOFailedData as AuthenticationSSOFailedData, -) -from .authentication_sso_failed_data_error import ( - AuthenticationSSOFailedDataError as AuthenticationSSOFailedDataError, -) -from .authentication_sso_failed_data_sso import ( - AuthenticationSSOFailedDataSSO as AuthenticationSSOFailedDataSSO, -) -from .authentication_sso_started import ( - AuthenticationSSOStarted as AuthenticationSSOStarted, -) -from .authentication_sso_started_data import ( - AuthenticationSSOStartedData as AuthenticationSSOStartedData, -) -from .authentication_sso_started_data_sso import ( - AuthenticationSSOStartedDataSSO as AuthenticationSSOStartedDataSSO, -) -from .authentication_sso_succeeded import ( - AuthenticationSSOSucceeded as AuthenticationSSOSucceeded, -) -from .authentication_sso_succeeded_data import ( - AuthenticationSSOSucceededData as AuthenticationSSOSucceededData, -) -from .authentication_sso_succeeded_data_sso import ( - AuthenticationSSOSucceededDataSSO as AuthenticationSSOSucceededDataSSO, -) -from .authentication_sso_timed_out import ( - AuthenticationSSOTimedOut as AuthenticationSSOTimedOut, -) -from .authentication_sso_timed_out_data import ( - AuthenticationSSOTimedOutData as AuthenticationSSOTimedOutData, -) -from .authentication_sso_timed_out_data_error import ( - AuthenticationSSOTimedOutDataError as AuthenticationSSOTimedOutDataError, -) -from .authentication_sso_timed_out_data_sso import ( - AuthenticationSSOTimedOutDataSSO as AuthenticationSSOTimedOutDataSSO, -) +from .audit_log_configuration_log_stream_state import AuditLogConfigurationLogStreamState as AuditLogConfigurationLogStreamState +from .audit_log_configuration_log_stream_type import AuditLogConfigurationLogStreamType as AuditLogConfigurationLogStreamType +from .audit_log_configuration_state import AuditLogConfigurationState as AuditLogConfigurationState +from .audit_log_export_json_state import AuditLogExportJsonState as AuditLogExportJsonState +from .authenticate_response_authentication_method import AuthenticateResponseAuthenticationMethod as AuthenticateResponseAuthenticationMethod +from .authentication_email_verification_failed import AuthenticationEmailVerificationFailed as AuthenticationEmailVerificationFailed +from .authentication_email_verification_failed_data import AuthenticationEmailVerificationFailedData as AuthenticationEmailVerificationFailedData +from .authentication_email_verification_failed_data_error import AuthenticationEmailVerificationFailedDataError as AuthenticationEmailVerificationFailedDataError +from .authentication_email_verification_succeeded import AuthenticationEmailVerificationSucceeded as AuthenticationEmailVerificationSucceeded +from .authentication_email_verification_succeeded_data import AuthenticationEmailVerificationSucceededData as AuthenticationEmailVerificationSucceededData +from .authentication_factor_enrolled_type import AuthenticationFactorEnrolledType as AuthenticationFactorEnrolledType +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 +from .authentication_magic_auth_failed_data import AuthenticationMagicAuthFailedData as AuthenticationMagicAuthFailedData +from .authentication_magic_auth_failed_data_error import AuthenticationMagicAuthFailedDataError as AuthenticationMagicAuthFailedDataError +from .authentication_magic_auth_succeeded import AuthenticationMagicAuthSucceeded as AuthenticationMagicAuthSucceeded +from .authentication_magic_auth_succeeded_data import AuthenticationMagicAuthSucceededData as AuthenticationMagicAuthSucceededData +from .authentication_mfa_failed import AuthenticationMFAFailed as AuthenticationMFAFailed +from .authentication_mfa_failed_data import AuthenticationMFAFailedData as AuthenticationMFAFailedData +from .authentication_mfa_failed_data_error import AuthenticationMFAFailedDataError as AuthenticationMFAFailedDataError +from .authentication_mfa_succeeded import AuthenticationMFASucceeded as AuthenticationMFASucceeded +from .authentication_mfa_succeeded_data import AuthenticationMFASucceededData as AuthenticationMFASucceededData +from .authentication_oauth_failed import AuthenticationOAuthFailed as AuthenticationOAuthFailed +from .authentication_oauth_failed_data import AuthenticationOAuthFailedData as AuthenticationOAuthFailedData +from .authentication_oauth_failed_data_error import AuthenticationOAuthFailedDataError as AuthenticationOAuthFailedDataError +from .authentication_oauth_succeeded import AuthenticationOAuthSucceeded as AuthenticationOAuthSucceeded +from .authentication_oauth_succeeded_data import AuthenticationOAuthSucceededData as AuthenticationOAuthSucceededData +from .authentication_passkey_failed import AuthenticationPasskeyFailed as AuthenticationPasskeyFailed +from .authentication_passkey_failed_data import AuthenticationPasskeyFailedData as AuthenticationPasskeyFailedData +from .authentication_passkey_failed_data_error import AuthenticationPasskeyFailedDataError as AuthenticationPasskeyFailedDataError +from .authentication_passkey_succeeded import AuthenticationPasskeySucceeded as AuthenticationPasskeySucceeded +from .authentication_passkey_succeeded_data import AuthenticationPasskeySucceededData as AuthenticationPasskeySucceededData +from .authentication_password_failed import AuthenticationPasswordFailed as AuthenticationPasswordFailed +from .authentication_password_failed_data import AuthenticationPasswordFailedData as AuthenticationPasswordFailedData +from .authentication_password_failed_data_error import AuthenticationPasswordFailedDataError as AuthenticationPasswordFailedDataError +from .authentication_password_succeeded import AuthenticationPasswordSucceeded as AuthenticationPasswordSucceeded +from .authentication_password_succeeded_data import AuthenticationPasswordSucceededData as AuthenticationPasswordSucceededData +from .authentication_radar_risk_detected import AuthenticationRadarRiskDetected as AuthenticationRadarRiskDetected +from .authentication_radar_risk_detected_data import AuthenticationRadarRiskDetectedData as AuthenticationRadarRiskDetectedData +from .authentication_sso_failed import AuthenticationSSOFailed as AuthenticationSSOFailed +from .authentication_sso_failed_data import AuthenticationSSOFailedData as AuthenticationSSOFailedData +from .authentication_sso_failed_data_error import AuthenticationSSOFailedDataError as AuthenticationSSOFailedDataError +from .authentication_sso_failed_data_sso import AuthenticationSSOFailedDataSSO as AuthenticationSSOFailedDataSSO +from .authentication_sso_started import AuthenticationSSOStarted as AuthenticationSSOStarted +from .authentication_sso_started_data import AuthenticationSSOStartedData as AuthenticationSSOStartedData +from .authentication_sso_started_data_sso import AuthenticationSSOStartedDataSSO as AuthenticationSSOStartedDataSSO +from .authentication_sso_succeeded import AuthenticationSSOSucceeded as AuthenticationSSOSucceeded +from .authentication_sso_succeeded_data import AuthenticationSSOSucceededData as AuthenticationSSOSucceededData +from .authentication_sso_succeeded_data_sso import AuthenticationSSOSucceededDataSSO as AuthenticationSSOSucceededDataSSO +from .authentication_sso_timed_out import AuthenticationSSOTimedOut as AuthenticationSSOTimedOut +from .authentication_sso_timed_out_data import AuthenticationSSOTimedOutData as AuthenticationSSOTimedOutData +from .authentication_sso_timed_out_data_error import AuthenticationSSOTimedOutDataError as AuthenticationSSOTimedOutDataError +from .authentication_sso_timed_out_data_sso import AuthenticationSSOTimedOutDataSSO as AuthenticationSSOTimedOutDataSSO from .connected_account_state import ConnectedAccountState as ConnectedAccountState from .connection_activated import ConnectionActivated as ConnectionActivated -from .connection_activated_data import ( - ConnectionActivatedData as ConnectionActivatedData, -) -from .connection_activated_data_domain import ( - ConnectionActivatedDataDomain as ConnectionActivatedDataDomain, -) +from .connection_activated_data import ConnectionActivatedData as ConnectionActivatedData +from .connection_activated_data_domain import ConnectionActivatedDataDomain as ConnectionActivatedDataDomain from .connection_deactivated import ConnectionDeactivated as ConnectionDeactivated -from .connection_deactivated_data import ( - ConnectionDeactivatedData as ConnectionDeactivatedData, -) -from .connection_deactivated_data_domain import ( - ConnectionDeactivatedDataDomain as ConnectionDeactivatedDataDomain, -) +from .connection_deactivated_data import ConnectionDeactivatedData as ConnectionDeactivatedData +from .connection_deactivated_data_domain import ConnectionDeactivatedDataDomain as ConnectionDeactivatedDataDomain from .connection_deleted import ConnectionDeleted as ConnectionDeleted from .connection_deleted_data import ConnectionDeletedData as ConnectionDeletedData -from .connection_saml_certificate_renewal_required import ( - ConnectionSAMLCertificateRenewalRequired as ConnectionSAMLCertificateRenewalRequired, -) -from .connection_saml_certificate_renewal_required_data import ( - ConnectionSAMLCertificateRenewalRequiredData as ConnectionSAMLCertificateRenewalRequiredData, -) -from .connection_saml_certificate_renewal_required_data_certificate import ( - ConnectionSAMLCertificateRenewalRequiredDataCertificate as ConnectionSAMLCertificateRenewalRequiredDataCertificate, -) -from .connection_saml_certificate_renewal_required_data_connection import ( - ConnectionSAMLCertificateRenewalRequiredDataConnection as ConnectionSAMLCertificateRenewalRequiredDataConnection, -) -from .connection_saml_certificate_renewed import ( - ConnectionSAMLCertificateRenewed as ConnectionSAMLCertificateRenewed, -) -from .connection_saml_certificate_renewed_data import ( - ConnectionSAMLCertificateRenewedData as ConnectionSAMLCertificateRenewedData, -) -from .connection_saml_certificate_renewed_data_certificate import ( - ConnectionSAMLCertificateRenewedDataCertificate as ConnectionSAMLCertificateRenewedDataCertificate, -) -from .connection_saml_certificate_renewed_data_connection import ( - ConnectionSAMLCertificateRenewedDataConnection as ConnectionSAMLCertificateRenewedDataConnection, -) +from .connection_saml_certificate_renewal_required import ConnectionSAMLCertificateRenewalRequired as ConnectionSAMLCertificateRenewalRequired +from .connection_saml_certificate_renewal_required_data import ConnectionSAMLCertificateRenewalRequiredData as ConnectionSAMLCertificateRenewalRequiredData +from .connection_saml_certificate_renewal_required_data_certificate import ConnectionSAMLCertificateRenewalRequiredDataCertificate as ConnectionSAMLCertificateRenewalRequiredDataCertificate +from .connection_saml_certificate_renewal_required_data_connection import ConnectionSAMLCertificateRenewalRequiredDataConnection as ConnectionSAMLCertificateRenewalRequiredDataConnection +from .connection_saml_certificate_renewed import ConnectionSAMLCertificateRenewed as ConnectionSAMLCertificateRenewed +from .connection_saml_certificate_renewed_data import ConnectionSAMLCertificateRenewedData as ConnectionSAMLCertificateRenewedData +from .connection_saml_certificate_renewed_data_certificate import ConnectionSAMLCertificateRenewedDataCertificate as ConnectionSAMLCertificateRenewedDataCertificate +from .connection_saml_certificate_renewed_data_connection import ConnectionSAMLCertificateRenewedDataConnection as ConnectionSAMLCertificateRenewedDataConnection from .connection_state import ConnectionState as ConnectionState from .connection_status import ConnectionStatus as ConnectionStatus from .connection_type import ConnectionType as ConnectionType -from .create_user_invite_options_locale import ( - CreateUserInviteOptionsLocale as CreateUserInviteOptionsLocale, -) -from .create_user_password_hash_type import ( - CreateUserPasswordHashType as CreateUserPasswordHashType, -) -from .create_webhook_endpoint_events import ( - CreateWebhookEndpointEvents as CreateWebhookEndpointEvents, -) -from .data_integration_access_token_response_error import ( - DataIntegrationAccessTokenResponseError as DataIntegrationAccessTokenResponseError, -) -from .data_integrations_list_response_data_connected_account_state import ( - DataIntegrationsListResponseDataConnectedAccountState as DataIntegrationsListResponseDataConnectedAccountState, -) -from .data_integrations_list_response_data_ownership import ( - DataIntegrationsListResponseDataOwnership as DataIntegrationsListResponseDataOwnership, -) +from .create_user_invite_options_locale import CreateUserInviteOptionsLocale as CreateUserInviteOptionsLocale +from .create_user_password_hash_type import CreateUserPasswordHashType as CreateUserPasswordHashType +from .create_webhook_endpoint_events import CreateWebhookEndpointEvents as CreateWebhookEndpointEvents +from .data_integration_access_token_response_error import DataIntegrationAccessTokenResponseError as DataIntegrationAccessTokenResponseError +from .data_integrations_list_response_data_connected_account_state import DataIntegrationsListResponseDataConnectedAccountState as DataIntegrationsListResponseDataConnectedAccountState +from .data_integrations_list_response_data_ownership import DataIntegrationsListResponseDataOwnership as DataIntegrationsListResponseDataOwnership 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_with_groups_state import ( - DirectoryUserWithGroupsState as DirectoryUserWithGroupsState, -) +from .directory_user_with_groups_state import DirectoryUserWithGroupsState as DirectoryUserWithGroupsState from .dsync_activated import DsyncActivated as DsyncActivated from .dsync_activated_data import DsyncActivatedData as DsyncActivatedData -from .dsync_activated_data_domain import ( - DsyncActivatedDataDomain as DsyncActivatedDataDomain, -) +from .dsync_activated_data_domain import DsyncActivatedDataDomain as DsyncActivatedDataDomain from .dsync_deactivated import DsyncDeactivated as DsyncDeactivated from .dsync_deactivated_data import DsyncDeactivatedData as DsyncDeactivatedData -from .dsync_deactivated_data_domain import ( - DsyncDeactivatedDataDomain as DsyncDeactivatedDataDomain, -) +from .dsync_deactivated_data_domain import DsyncDeactivatedDataDomain as DsyncDeactivatedDataDomain from .dsync_deleted import DsyncDeleted as DsyncDeleted from .dsync_deleted_data import DsyncDeletedData as DsyncDeletedData from .dsync_group_created import DsyncGroupCreated as DsyncGroupCreated @@ -266,96 +108,51 @@ from .dsync_group_updated import DsyncGroupUpdated as DsyncGroupUpdated from .dsync_group_updated_data import DsyncGroupUpdatedData as DsyncGroupUpdatedData from .dsync_group_user_added import DsyncGroupUserAdded as DsyncGroupUserAdded -from .dsync_group_user_added_data import ( - DsyncGroupUserAddedData as DsyncGroupUserAddedData, -) +from .dsync_group_user_added_data import DsyncGroupUserAddedData as DsyncGroupUserAddedData from .dsync_group_user_removed import DsyncGroupUserRemoved as DsyncGroupUserRemoved -from .dsync_group_user_removed_data import ( - DsyncGroupUserRemovedData as DsyncGroupUserRemovedData, -) +from .dsync_group_user_removed_data import DsyncGroupUserRemovedData as DsyncGroupUserRemovedData from .dsync_user_created import DsyncUserCreated as DsyncUserCreated from .dsync_user_deleted import DsyncUserDeleted as DsyncUserDeleted from .dsync_user_updated import DsyncUserUpdated as DsyncUserUpdated from .dsync_user_updated_data import DsyncUserUpdatedData as DsyncUserUpdatedData -from .dsync_user_updated_data_email import ( - DsyncUserUpdatedDataEmail as DsyncUserUpdatedDataEmail, -) -from .email_verification_created import ( - EmailVerificationCreated as EmailVerificationCreated, -) -from .email_verification_created_data import ( - EmailVerificationCreatedData as EmailVerificationCreatedData, -) +from .dsync_user_updated_data_email import DsyncUserUpdatedDataEmail as DsyncUserUpdatedDataEmail +from .email_verification_created import EmailVerificationCreated as EmailVerificationCreated +from .email_verification_created_data import EmailVerificationCreatedData as EmailVerificationCreatedData from .event_context import EventContext as EventContext from .event_context_actor import EventContextActor as EventContextActor -from .event_context_google_analytics_session import ( - EventContextGoogleAnalyticsSession as EventContextGoogleAnalyticsSession, -) +from .event_context_google_analytics_session import EventContextGoogleAnalyticsSession as EventContextGoogleAnalyticsSession from .flag_created import FlagCreated as FlagCreated from .flag_created_context import FlagCreatedContext as FlagCreatedContext -from .flag_created_context_actor import ( - FlagCreatedContextActor as FlagCreatedContextActor, -) +from .flag_created_context_actor import FlagCreatedContextActor as FlagCreatedContextActor from .flag_created_data import FlagCreatedData as FlagCreatedData from .flag_created_data_owner import FlagCreatedDataOwner as FlagCreatedDataOwner from .flag_deleted import FlagDeleted as FlagDeleted from .flag_deleted_context import FlagDeletedContext as FlagDeletedContext -from .flag_deleted_context_actor import ( - FlagDeletedContextActor as FlagDeletedContextActor, -) +from .flag_deleted_context_actor import FlagDeletedContextActor as FlagDeletedContextActor from .flag_deleted_data import FlagDeletedData as FlagDeletedData from .flag_deleted_data_owner import FlagDeletedDataOwner as FlagDeletedDataOwner from .flag_rule_updated import FlagRuleUpdated as FlagRuleUpdated from .flag_rule_updated_context import FlagRuleUpdatedContext as FlagRuleUpdatedContext -from .flag_rule_updated_context_actor import ( - FlagRuleUpdatedContextActor as FlagRuleUpdatedContextActor, -) -from .flag_rule_updated_context_configured_target import ( - FlagRuleUpdatedContextConfiguredTarget as FlagRuleUpdatedContextConfiguredTarget, -) -from .flag_rule_updated_context_configured_target_organization import ( - FlagRuleUpdatedContextConfiguredTargetOrganization as FlagRuleUpdatedContextConfiguredTargetOrganization, -) -from .flag_rule_updated_context_configured_target_user import ( - FlagRuleUpdatedContextConfiguredTargetUser as FlagRuleUpdatedContextConfiguredTargetUser, -) -from .flag_rule_updated_context_previous_attribute import ( - FlagRuleUpdatedContextPreviousAttribute as FlagRuleUpdatedContextPreviousAttribute, -) -from .flag_rule_updated_context_previous_attribute_context import ( - FlagRuleUpdatedContextPreviousAttributeContext as FlagRuleUpdatedContextPreviousAttributeContext, -) -from .flag_rule_updated_context_previous_attribute_context_configured_target import ( - FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget as FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget, -) -from .flag_rule_updated_context_previous_attribute_context_configured_target_organization import ( - FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetOrganization as FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetOrganization, -) -from .flag_rule_updated_context_previous_attribute_context_configured_target_user import ( - FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetUser as FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetUser, -) -from .flag_rule_updated_context_previous_attribute_data import ( - FlagRuleUpdatedContextPreviousAttributeData as FlagRuleUpdatedContextPreviousAttributeData, -) +from .flag_rule_updated_context_actor import FlagRuleUpdatedContextActor as FlagRuleUpdatedContextActor +from .flag_rule_updated_context_configured_target import FlagRuleUpdatedContextConfiguredTarget as FlagRuleUpdatedContextConfiguredTarget +from .flag_rule_updated_context_configured_target_organization import FlagRuleUpdatedContextConfiguredTargetOrganization as FlagRuleUpdatedContextConfiguredTargetOrganization +from .flag_rule_updated_context_configured_target_user import FlagRuleUpdatedContextConfiguredTargetUser as FlagRuleUpdatedContextConfiguredTargetUser +from .flag_rule_updated_context_previous_attribute import FlagRuleUpdatedContextPreviousAttribute as FlagRuleUpdatedContextPreviousAttribute +from .flag_rule_updated_context_previous_attribute_context import FlagRuleUpdatedContextPreviousAttributeContext as FlagRuleUpdatedContextPreviousAttributeContext +from .flag_rule_updated_context_previous_attribute_context_configured_target import FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget as FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget +from .flag_rule_updated_context_previous_attribute_context_configured_target_organization import FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetOrganization as FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetOrganization +from .flag_rule_updated_context_previous_attribute_context_configured_target_user import FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetUser as FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetUser +from .flag_rule_updated_context_previous_attribute_data import FlagRuleUpdatedContextPreviousAttributeData as FlagRuleUpdatedContextPreviousAttributeData from .flag_rule_updated_data import FlagRuleUpdatedData as FlagRuleUpdatedData -from .flag_rule_updated_data_owner import ( - FlagRuleUpdatedDataOwner as FlagRuleUpdatedDataOwner, -) +from .flag_rule_updated_data_owner import FlagRuleUpdatedDataOwner as FlagRuleUpdatedDataOwner from .flag_updated import FlagUpdated as FlagUpdated from .flag_updated_context import FlagUpdatedContext as FlagUpdatedContext -from .flag_updated_context_actor import ( - FlagUpdatedContextActor as FlagUpdatedContextActor, -) -from .flag_updated_context_previous_attribute import ( - FlagUpdatedContextPreviousAttribute as FlagUpdatedContextPreviousAttribute, -) -from .flag_updated_context_previous_attribute_data import ( - FlagUpdatedContextPreviousAttributeData as FlagUpdatedContextPreviousAttributeData, -) +from .flag_updated_context_actor import FlagUpdatedContextActor as FlagUpdatedContextActor +from .flag_updated_context_previous_attribute import FlagUpdatedContextPreviousAttribute as FlagUpdatedContextPreviousAttribute +from .flag_updated_context_previous_attribute_data import FlagUpdatedContextPreviousAttributeData as FlagUpdatedContextPreviousAttributeData from .flag_updated_data import FlagUpdatedData as FlagUpdatedData from .flag_updated_data_owner import FlagUpdatedDataOwner as FlagUpdatedDataOwner from .generate_link_intent import GenerateLinkIntent as GenerateLinkIntent -from .group import Group as Group from .group_created import GroupCreated as GroupCreated from .group_deleted import GroupDeleted as GroupDeleted from .group_member_added import GroupMemberAdded as GroupMemberAdded @@ -375,121 +172,47 @@ from .magic_auth_created import MagicAuthCreated as MagicAuthCreated from .magic_auth_created_data import MagicAuthCreatedData as MagicAuthCreatedData from .organization_created import OrganizationCreated as OrganizationCreated -from .organization_created_data import ( - OrganizationCreatedData as OrganizationCreatedData, -) -from .organization_created_data_domain import ( - OrganizationCreatedDataDomain as OrganizationCreatedDataDomain, -) +from .organization_created_data import OrganizationCreatedData as OrganizationCreatedData +from .organization_created_data_domain import OrganizationCreatedDataDomain as OrganizationCreatedDataDomain from .organization_deleted import OrganizationDeleted as OrganizationDeleted -from .organization_deleted_data import ( - OrganizationDeletedData as OrganizationDeletedData, -) -from .organization_deleted_data_domain import ( - OrganizationDeletedDataDomain as OrganizationDeletedDataDomain, -) -from .organization_domain_created import ( - OrganizationDomainCreated as OrganizationDomainCreated, -) -from .organization_domain_created_data import ( - OrganizationDomainCreatedData as OrganizationDomainCreatedData, -) -from .organization_domain_data_state import ( - OrganizationDomainDataState as OrganizationDomainDataState, -) -from .organization_domain_deleted import ( - OrganizationDomainDeleted as OrganizationDomainDeleted, -) -from .organization_domain_deleted_data import ( - OrganizationDomainDeletedData as OrganizationDomainDeletedData, -) -from .organization_domain_stand_alone_state import ( - OrganizationDomainStandAloneState as OrganizationDomainStandAloneState, -) -from .organization_domain_stand_alone_verification_strategy import ( - OrganizationDomainStandAloneVerificationStrategy as OrganizationDomainStandAloneVerificationStrategy, -) -from .organization_domain_state import ( - OrganizationDomainState as OrganizationDomainState, -) -from .organization_domain_updated import ( - OrganizationDomainUpdated as OrganizationDomainUpdated, -) -from .organization_domain_updated_data import ( - OrganizationDomainUpdatedData as OrganizationDomainUpdatedData, -) -from .organization_domain_verification_failed import ( - OrganizationDomainVerificationFailed as OrganizationDomainVerificationFailed, -) -from .organization_domain_verification_failed_data import ( - OrganizationDomainVerificationFailedData as OrganizationDomainVerificationFailedData, -) -from .organization_domain_verification_failed_data_organization_domain import ( - OrganizationDomainVerificationFailedDataOrganizationDomain as OrganizationDomainVerificationFailedDataOrganizationDomain, -) -from .organization_domain_verification_strategy import ( - OrganizationDomainVerificationStrategy as OrganizationDomainVerificationStrategy, -) -from .organization_domain_verified import ( - OrganizationDomainVerified as OrganizationDomainVerified, -) -from .organization_domain_verified_data import ( - OrganizationDomainVerifiedData as OrganizationDomainVerifiedData, -) -from .organization_membership_created import ( - OrganizationMembershipCreated as OrganizationMembershipCreated, -) -from .organization_membership_created_data import ( - OrganizationMembershipCreatedData as OrganizationMembershipCreatedData, -) -from .organization_membership_deleted import ( - OrganizationMembershipDeleted as OrganizationMembershipDeleted, -) -from .organization_membership_deleted_data import ( - OrganizationMembershipDeletedData as OrganizationMembershipDeletedData, -) -from .organization_membership_status import ( - OrganizationMembershipStatus as OrganizationMembershipStatus, -) -from .organization_membership_updated import ( - OrganizationMembershipUpdated as OrganizationMembershipUpdated, -) -from .organization_membership_updated_data import ( - OrganizationMembershipUpdatedData as OrganizationMembershipUpdatedData, -) -from .organization_role_created import ( - OrganizationRoleCreated as OrganizationRoleCreated, -) -from .organization_role_created_data import ( - OrganizationRoleCreatedData as OrganizationRoleCreatedData, -) -from .organization_role_deleted import ( - OrganizationRoleDeleted as OrganizationRoleDeleted, -) -from .organization_role_deleted_data import ( - OrganizationRoleDeletedData as OrganizationRoleDeletedData, -) -from .organization_role_updated import ( - OrganizationRoleUpdated as OrganizationRoleUpdated, -) -from .organization_role_updated_data import ( - OrganizationRoleUpdatedData as OrganizationRoleUpdatedData, -) +from .organization_deleted_data import OrganizationDeletedData as OrganizationDeletedData +from .organization_deleted_data_domain import OrganizationDeletedDataDomain as OrganizationDeletedDataDomain +from .organization_domain_created import OrganizationDomainCreated as OrganizationDomainCreated +from .organization_domain_created_data import OrganizationDomainCreatedData as OrganizationDomainCreatedData +from .organization_domain_data_state import OrganizationDomainDataState as OrganizationDomainDataState +from .organization_domain_deleted import OrganizationDomainDeleted as OrganizationDomainDeleted +from .organization_domain_deleted_data import OrganizationDomainDeletedData as OrganizationDomainDeletedData +from .organization_domain_stand_alone_state import OrganizationDomainStandAloneState as OrganizationDomainStandAloneState +from .organization_domain_stand_alone_verification_strategy import OrganizationDomainStandAloneVerificationStrategy as OrganizationDomainStandAloneVerificationStrategy +from .organization_domain_state import OrganizationDomainState as OrganizationDomainState +from .organization_domain_updated import OrganizationDomainUpdated as OrganizationDomainUpdated +from .organization_domain_updated_data import OrganizationDomainUpdatedData as OrganizationDomainUpdatedData +from .organization_domain_verification_failed import OrganizationDomainVerificationFailed as OrganizationDomainVerificationFailed +from .organization_domain_verification_failed_data import OrganizationDomainVerificationFailedData as OrganizationDomainVerificationFailedData +from .organization_domain_verification_failed_data_organization_domain import OrganizationDomainVerificationFailedDataOrganizationDomain as OrganizationDomainVerificationFailedDataOrganizationDomain +from .organization_domain_verification_strategy import OrganizationDomainVerificationStrategy as OrganizationDomainVerificationStrategy +from .organization_domain_verified import OrganizationDomainVerified as OrganizationDomainVerified +from .organization_domain_verified_data import OrganizationDomainVerifiedData as OrganizationDomainVerifiedData +from .organization_membership_created import OrganizationMembershipCreated as OrganizationMembershipCreated +from .organization_membership_created_data import OrganizationMembershipCreatedData as OrganizationMembershipCreatedData +from .organization_membership_deleted import OrganizationMembershipDeleted as OrganizationMembershipDeleted +from .organization_membership_deleted_data import OrganizationMembershipDeletedData as OrganizationMembershipDeletedData +from .organization_membership_status import OrganizationMembershipStatus as OrganizationMembershipStatus +from .organization_membership_updated import OrganizationMembershipUpdated as OrganizationMembershipUpdated +from .organization_membership_updated_data import OrganizationMembershipUpdatedData as OrganizationMembershipUpdatedData +from .organization_role_created import OrganizationRoleCreated as OrganizationRoleCreated +from .organization_role_created_data import OrganizationRoleCreatedData as OrganizationRoleCreatedData +from .organization_role_deleted import OrganizationRoleDeleted as OrganizationRoleDeleted +from .organization_role_deleted_data import OrganizationRoleDeletedData as OrganizationRoleDeletedData +from .organization_role_updated import OrganizationRoleUpdated as OrganizationRoleUpdated +from .organization_role_updated_data import OrganizationRoleUpdatedData as OrganizationRoleUpdatedData from .organization_updated import OrganizationUpdated as OrganizationUpdated -from .organization_updated_data import ( - OrganizationUpdatedData as OrganizationUpdatedData, -) -from .organization_updated_data_domain import ( - OrganizationUpdatedDataDomain as OrganizationUpdatedDataDomain, -) +from .organization_updated_data import OrganizationUpdatedData as OrganizationUpdatedData +from .organization_updated_data_domain import OrganizationUpdatedDataDomain as OrganizationUpdatedDataDomain from .password_reset_created import PasswordResetCreated as PasswordResetCreated -from .password_reset_created_data import ( - PasswordResetCreatedData as PasswordResetCreatedData, -) +from .password_reset_created_data import PasswordResetCreatedData as PasswordResetCreatedData from .password_reset_succeeded import PasswordResetSucceeded as PasswordResetSucceeded -from .password_reset_succeeded_data import ( - PasswordResetSucceededData as PasswordResetSucceededData, -) +from .password_reset_succeeded_data import PasswordResetSucceededData as PasswordResetSucceededData from .permission_created import PermissionCreated as PermissionCreated from .permission_created_data import PermissionCreatedData as PermissionCreatedData from .permission_deleted import PermissionDeleted as PermissionDeleted @@ -497,24 +220,12 @@ from .permission_updated import PermissionUpdated as PermissionUpdated from .permission_updated_data import PermissionUpdatedData as PermissionUpdatedData from .profile_connection_type import ProfileConnectionType as ProfileConnectionType -from .radar_standalone_assess_request_action import ( - RadarStandaloneAssessRequestAction as RadarStandaloneAssessRequestAction, -) -from .radar_standalone_assess_request_auth_method import ( - RadarStandaloneAssessRequestAuthMethod as RadarStandaloneAssessRequestAuthMethod, -) -from .radar_standalone_response_blocklist_type import ( - RadarStandaloneResponseBlocklistType as RadarStandaloneResponseBlocklistType, -) -from .radar_standalone_response_control import ( - RadarStandaloneResponseControl as RadarStandaloneResponseControl, -) -from .radar_standalone_response_verdict import ( - RadarStandaloneResponseVerdict as RadarStandaloneResponseVerdict, -) -from .resend_user_invite_options_locale import ( - ResendUserInviteOptionsLocale as ResendUserInviteOptionsLocale, -) +from .radar_standalone_assess_request_action import RadarStandaloneAssessRequestAction as RadarStandaloneAssessRequestAction +from .radar_standalone_assess_request_auth_method import RadarStandaloneAssessRequestAuthMethod as RadarStandaloneAssessRequestAuthMethod +from .radar_standalone_response_blocklist_type import RadarStandaloneResponseBlocklistType as RadarStandaloneResponseBlocklistType +from .radar_standalone_response_control import RadarStandaloneResponseControl as RadarStandaloneResponseControl +from .radar_standalone_response_verdict import RadarStandaloneResponseVerdict as RadarStandaloneResponseVerdict +from .resend_user_invite_options_locale import ResendUserInviteOptionsLocale as ResendUserInviteOptionsLocale from .role_created import RoleCreated as RoleCreated from .role_created_data import RoleCreatedData as RoleCreatedData from .role_deleted import RoleDeleted as RoleDeleted @@ -524,44 +235,24 @@ 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_impersonator import ( - SessionCreatedDataImpersonator as SessionCreatedDataImpersonator, -) +from .session_created_data_impersonator import SessionCreatedDataImpersonator as SessionCreatedDataImpersonator from .session_revoked import SessionRevoked as SessionRevoked from .session_revoked_data import SessionRevokedData as SessionRevokedData -from .session_revoked_data_impersonator import ( - SessionRevokedDataImpersonator as SessionRevokedDataImpersonator, -) -from .update_user_password_hash_type import ( - UpdateUserPasswordHashType as UpdateUserPasswordHashType, -) -from .update_webhook_endpoint_events import ( - UpdateWebhookEndpointEvents as UpdateWebhookEndpointEvents, -) -from .update_webhook_endpoint_status import ( - UpdateWebhookEndpointStatus as UpdateWebhookEndpointStatus, -) +from .session_revoked_data_impersonator import SessionRevokedDataImpersonator as SessionRevokedDataImpersonator +from .update_user_password_hash_type import UpdateUserPasswordHashType as UpdateUserPasswordHashType +from .update_webhook_endpoint_events import UpdateWebhookEndpointEvents as UpdateWebhookEndpointEvents +from .update_webhook_endpoint_status import UpdateWebhookEndpointStatus as UpdateWebhookEndpointStatus from .user_created import UserCreated as UserCreated from .user_deleted import UserDeleted as UserDeleted -from .user_identities_get_item_provider import ( - UserIdentitiesGetItemProvider as UserIdentitiesGetItemProvider, -) +from .user_identities_get_item_provider import UserIdentitiesGetItemProvider as UserIdentitiesGetItemProvider from .user_invite_state import UserInviteState as UserInviteState -from .user_organization_membership_base_list_data_status import ( - UserOrganizationMembershipBaseListDataStatus as UserOrganizationMembershipBaseListDataStatus, -) -from .user_organization_membership_status import ( - UserOrganizationMembershipStatus as UserOrganizationMembershipStatus, -) +from .user_organization_membership_base_list_data_status import UserOrganizationMembershipBaseListDataStatus as UserOrganizationMembershipBaseListDataStatus +from .user_organization_membership_status import UserOrganizationMembershipStatus as UserOrganizationMembershipStatus from .user_sessions_auth_method import UserSessionsAuthMethod as UserSessionsAuthMethod from .user_sessions_status import UserSessionsStatus as UserSessionsStatus from .user_updated import UserUpdated as UserUpdated -from .vault_byok_key_verification_completed import ( - VaultByokKeyVerificationCompleted as VaultByokKeyVerificationCompleted, -) -from .vault_byok_key_verification_completed_data import ( - VaultByokKeyVerificationCompletedData as VaultByokKeyVerificationCompletedData, -) +from .vault_byok_key_verification_completed import VaultByokKeyVerificationCompleted as VaultByokKeyVerificationCompleted +from .vault_byok_key_verification_completed_data import VaultByokKeyVerificationCompletedData as VaultByokKeyVerificationCompletedData from .vault_data_created import VaultDataCreated as VaultDataCreated from .vault_data_created_data import VaultDataCreatedData as VaultDataCreatedData from .vault_data_deleted import VaultDataDeleted as VaultDataDeleted @@ -580,9 +271,9 @@ from .vault_metadata_read_data import VaultMetadataReadData as VaultMetadataReadData from .vault_names_listed import VaultNamesListed as VaultNamesListed from .vault_names_listed_data import VaultNamesListedData as VaultNamesListedData -from .webhook_endpoint_json_status import ( - WebhookEndpointJsonStatus as WebhookEndpointJsonStatus, -) -from .widget_session_token_scopes import ( - WidgetSessionTokenScopes as WidgetSessionTokenScopes, -) +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 .webhook_endpoint_json_status import WebhookEndpointJsonStatus as WebhookEndpointJsonStatus +from .widget_session_token_scopes import WidgetSessionTokenScopes as WidgetSessionTokenScopes diff --git a/src/workos/common/models/action_authentication_denied.py b/src/workos/common/models/action_authentication_denied.py index f558cf71..b8db664e 100644 --- a/src/workos/common/models/action_authentication_denied.py +++ b/src/workos/common/models/action_authentication_denied.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "ActionAuthenticationDenied": return cls( id=data["id"], event=data["event"], - data=ActionAuthenticationDeniedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=ActionAuthenticationDeniedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("ActionAuthenticationDenied", e) diff --git a/src/workos/common/models/action_authentication_denied_data.py b/src/workos/common/models/action_authentication_denied_data.py index 74b698b2..7ac506a2 100644 --- a/src/workos/common/models/action_authentication_denied_data.py +++ b/src/workos/common/models/action_authentication_denied_data.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Literal, Optional from workos._types import _raise_deserialize_error diff --git a/src/workos/common/models/action_user_registration_denied.py b/src/workos/common/models/action_user_registration_denied.py index 8bcee090..7fd0251c 100644 --- a/src/workos/common/models/action_user_registration_denied.py +++ b/src/workos/common/models/action_user_registration_denied.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "ActionUserRegistrationDenied": return cls( id=data["id"], event=data["event"], - data=ActionUserRegistrationDeniedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=ActionUserRegistrationDeniedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("ActionUserRegistrationDenied", e) diff --git a/src/workos/common/models/action_user_registration_denied_data.py b/src/workos/common/models/action_user_registration_denied_data.py index a3e7a458..a26f57cd 100644 --- a/src/workos/common/models/action_user_registration_denied_data.py +++ b/src/workos/common/models/action_user_registration_denied_data.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Literal, Optional from workos._types import _raise_deserialize_error diff --git a/src/workos/common/models/api_key_created.py b/src/workos/common/models/api_key_created.py index a6ecb461..a166aec0 100644 --- a/src/workos/common/models/api_key_created.py +++ b/src/workos/common/models/api_key_created.py @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "ApiKeyCreated": data=ApiKeyCreatedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("ApiKeyCreated", e) diff --git a/src/workos/common/models/api_key_created_data.py b/src/workos/common/models/api_key_created_data.py index 429ea126..e12602df 100644 --- a/src/workos/common/models/api_key_created_data.py +++ b/src/workos/common/models/api_key_created_data.py @@ -40,9 +40,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "ApiKeyCreatedData": return cls( object=data["object"], id=data["id"], - owner=ApiKeyCreatedDataOwner.from_dict( - cast(Dict[str, Any], data["owner"]) - ), + owner=ApiKeyCreatedDataOwner.from_dict(cast(Dict[str, Any], data["owner"])), name=data["name"], obfuscated_value=data["obfuscated_value"], last_used_at=data["last_used_at"], diff --git a/src/workos/common/models/api_key_created_data_owner.py b/src/workos/common/models/api_key_created_data_owner.py index 5fd1f9b8..f1ff3579 100644 --- a/src/workos/common/models/api_key_created_data_owner.py +++ b/src/workos/common/models/api_key_created_data_owner.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Literal from workos._types import _raise_deserialize_error diff --git a/src/workos/common/models/api_key_revoked.py b/src/workos/common/models/api_key_revoked.py index 2d46c469..1e014d27 100644 --- a/src/workos/common/models/api_key_revoked.py +++ b/src/workos/common/models/api_key_revoked.py @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "ApiKeyRevoked": data=ApiKeyRevokedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("ApiKeyRevoked", e) diff --git a/src/workos/common/models/audit_log_configuration_log_stream_state.py b/src/workos/common/models/audit_log_configuration_log_stream_state.py index 155db1a0..79daf711 100644 --- a/src/workos/common/models/audit_log_configuration_log_stream_state.py +++ b/src/workos/common/models/audit_log_configuration_log_stream_state.py @@ -18,9 +18,7 @@ class AuditLogConfigurationLogStreamState(str, Enum): INVALID = "invalid" @classmethod - def _missing_( - cls, value: object - ) -> Optional["AuditLogConfigurationLogStreamState"]: + def _missing_(cls, value: object) -> Optional["AuditLogConfigurationLogStreamState"]: if not isinstance(value, str): return None unknown = str.__new__(cls, value) @@ -28,7 +26,4 @@ def _missing_( unknown._value_ = value return unknown - -AuditLogConfigurationLogStreamStateLiteral: TypeAlias = Literal[ - "active", "inactive", "error", "invalid" -] +AuditLogConfigurationLogStreamStateLiteral: TypeAlias = Literal["active", "inactive", "error", "invalid"] diff --git a/src/workos/common/models/audit_log_configuration_log_stream_type.py b/src/workos/common/models/audit_log_configuration_log_stream_type.py index 46eef4ba..a4903170 100644 --- a/src/workos/common/models/audit_log_configuration_log_stream_type.py +++ b/src/workos/common/models/audit_log_configuration_log_stream_type.py @@ -28,7 +28,4 @@ def _missing_(cls, value: object) -> Optional["AuditLogConfigurationLogStreamTyp unknown._value_ = value return unknown - -AuditLogConfigurationLogStreamTypeLiteral: TypeAlias = Literal[ - "AzureSentinel", "Datadog", "GenericHttps", "GoogleCloudStorage", "S3", "Splunk" -] +AuditLogConfigurationLogStreamTypeLiteral: TypeAlias = Literal["AzureSentinel", "Datadog", "GenericHttps", "GoogleCloudStorage", "S3", "Splunk"] diff --git a/src/workos/common/models/audit_log_configuration_state.py b/src/workos/common/models/audit_log_configuration_state.py index d1021747..2e451210 100644 --- a/src/workos/common/models/audit_log_configuration_state.py +++ b/src/workos/common/models/audit_log_configuration_state.py @@ -25,5 +25,4 @@ def _missing_(cls, value: object) -> Optional["AuditLogConfigurationState"]: unknown._value_ = value return unknown - AuditLogConfigurationStateLiteral: TypeAlias = Literal["active", "inactive", "disabled"] diff --git a/src/workos/common/models/audit_log_export_json_state.py b/src/workos/common/models/audit_log_export_json_state.py index 07e1b027..fcaad116 100644 --- a/src/workos/common/models/audit_log_export_json_state.py +++ b/src/workos/common/models/audit_log_export_json_state.py @@ -25,5 +25,4 @@ def _missing_(cls, value: object) -> Optional["AuditLogExportJsonState"]: unknown._value_ = value return unknown - AuditLogExportJsonStateLiteral: TypeAlias = Literal["pending", "ready", "error"] diff --git a/src/workos/common/models/authenticate_response_authentication_method.py b/src/workos/common/models/authenticate_response_authentication_method.py index 28db4599..7eab2245 100644 --- a/src/workos/common/models/authenticate_response_authentication_method.py +++ b/src/workos/common/models/authenticate_response_authentication_method.py @@ -36,9 +36,7 @@ class AuthenticateResponseAuthenticationMethod(str, Enum): MIGRATED_SESSION = "MigratedSession" @classmethod - def _missing_( - cls, value: object - ) -> Optional["AuthenticateResponseAuthenticationMethod"]: + def _missing_(cls, value: object) -> Optional["AuthenticateResponseAuthenticationMethod"]: if not isinstance(value, str): return None unknown = str.__new__(cls, value) @@ -46,28 +44,4 @@ def _missing_( unknown._value_ = value return unknown - -AuthenticateResponseAuthenticationMethodLiteral: TypeAlias = Literal[ - "SSO", - "Password", - "Passkey", - "AppleOAuth", - "BitbucketOAuth", - "CrossAppAuth", - "DiscordOAuth", - "ExternalAuth", - "GitHubOAuth", - "GitLabOAuth", - "GoogleOAuth", - "IntuitOAuth", - "LinkedInOAuth", - "MicrosoftOAuth", - "SalesforceOAuth", - "SlackOAuth", - "VercelMarketplaceOAuth", - "VercelOAuth", - "XeroOAuth", - "MagicAuth", - "Impersonation", - "MigratedSession", -] +AuthenticateResponseAuthenticationMethodLiteral: TypeAlias = Literal["SSO", "Password", "Passkey", "AppleOAuth", "BitbucketOAuth", "CrossAppAuth", "DiscordOAuth", "ExternalAuth", "GitHubOAuth", "GitLabOAuth", "GoogleOAuth", "IntuitOAuth", "LinkedInOAuth", "MicrosoftOAuth", "SalesforceOAuth", "SlackOAuth", "VercelMarketplaceOAuth", "VercelOAuth", "XeroOAuth", "MagicAuth", "Impersonation", "MigratedSession"] diff --git a/src/workos/common/models/authentication_email_verification_failed.py b/src/workos/common/models/authentication_email_verification_failed.py index f99ed214..3ae9cd84 100644 --- a/src/workos/common/models/authentication_email_verification_failed.py +++ b/src/workos/common/models/authentication_email_verification_failed.py @@ -9,9 +9,7 @@ from workos._types import _raise_deserialize_error from workos._types import _format_datetime, _parse_datetime -from .authentication_email_verification_failed_data import ( - AuthenticationEmailVerificationFailedData, -) +from .authentication_email_verification_failed_data import AuthenticationEmailVerificationFailedData from .event_context import EventContext @@ -37,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuthenticationEmailVerificationFail return cls( id=data["id"], event=data["event"], - data=AuthenticationEmailVerificationFailedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=AuthenticationEmailVerificationFailedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("AuthenticationEmailVerificationFailed", e) diff --git a/src/workos/common/models/authentication_email_verification_failed_data.py b/src/workos/common/models/authentication_email_verification_failed_data.py index 6116256c..cea383c4 100644 --- a/src/workos/common/models/authentication_email_verification_failed_data.py +++ b/src/workos/common/models/authentication_email_verification_failed_data.py @@ -7,9 +7,7 @@ from typing import Any, Dict, Literal, Optional from workos._types import _raise_deserialize_error -from .authentication_email_verification_failed_data_error import ( - AuthenticationEmailVerificationFailedDataError, -) +from .authentication_email_verification_failed_data_error import AuthenticationEmailVerificationFailedDataError @dataclass(slots=True) @@ -30,9 +28,7 @@ class AuthenticationEmailVerificationFailedData: """Details about the authentication error.""" @classmethod - def from_dict( - cls, data: Dict[str, Any] - ) -> "AuthenticationEmailVerificationFailedData": + def from_dict(cls, data: Dict[str, Any]) -> "AuthenticationEmailVerificationFailedData": """Deserialize from a dictionary.""" try: return cls( @@ -42,9 +38,7 @@ def from_dict( user_agent=data["user_agent"], user_id=data["user_id"], email=data["email"], - error=AuthenticationEmailVerificationFailedDataError.from_dict( - cast(Dict[str, Any], data["error"]) - ), + error=AuthenticationEmailVerificationFailedDataError.from_dict(cast(Dict[str, Any], data["error"])), ) except (KeyError, ValueError) as e: _raise_deserialize_error("AuthenticationEmailVerificationFailedData", e) diff --git a/src/workos/common/models/authentication_email_verification_failed_data_error.py b/src/workos/common/models/authentication_email_verification_failed_data_error.py index aeeaed5e..a103efce 100644 --- a/src/workos/common/models/authentication_email_verification_failed_data_error.py +++ b/src/workos/common/models/authentication_email_verification_failed_data_error.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error @@ -17,9 +18,7 @@ class AuthenticationEmailVerificationFailedDataError: """A human-readable error message.""" @classmethod - def from_dict( - cls, data: Dict[str, Any] - ) -> "AuthenticationEmailVerificationFailedDataError": + def from_dict(cls, data: Dict[str, Any]) -> "AuthenticationEmailVerificationFailedDataError": """Deserialize from a dictionary.""" try: return cls( @@ -27,9 +26,7 @@ def from_dict( message=data["message"], ) except (KeyError, ValueError) as e: - _raise_deserialize_error( - "AuthenticationEmailVerificationFailedDataError", e - ) + _raise_deserialize_error("AuthenticationEmailVerificationFailedDataError", e) def to_dict(self) -> Dict[str, Any]: """Serialize to a dictionary.""" diff --git a/src/workos/common/models/authentication_email_verification_succeeded.py b/src/workos/common/models/authentication_email_verification_succeeded.py index 37761502..a466f938 100644 --- a/src/workos/common/models/authentication_email_verification_succeeded.py +++ b/src/workos/common/models/authentication_email_verification_succeeded.py @@ -9,9 +9,7 @@ from workos._types import _raise_deserialize_error from workos._types import _format_datetime, _parse_datetime -from .authentication_email_verification_succeeded_data import ( - AuthenticationEmailVerificationSucceededData, -) +from .authentication_email_verification_succeeded_data import AuthenticationEmailVerificationSucceededData from .event_context import EventContext @@ -31,22 +29,16 @@ class AuthenticationEmailVerificationSucceeded: context: Optional["EventContext"] = None @classmethod - def from_dict( - cls, data: Dict[str, Any] - ) -> "AuthenticationEmailVerificationSucceeded": + def from_dict(cls, data: Dict[str, Any]) -> "AuthenticationEmailVerificationSucceeded": """Deserialize from a dictionary.""" try: return cls( id=data["id"], event=data["event"], - data=AuthenticationEmailVerificationSucceededData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=AuthenticationEmailVerificationSucceededData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("AuthenticationEmailVerificationSucceeded", e) diff --git a/src/workos/common/models/authentication_email_verification_succeeded_data.py b/src/workos/common/models/authentication_email_verification_succeeded_data.py index 973dac12..71d0ddf6 100644 --- a/src/workos/common/models/authentication_email_verification_succeeded_data.py +++ b/src/workos/common/models/authentication_email_verification_succeeded_data.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Literal, Optional from workos._types import _raise_deserialize_error @@ -23,9 +24,7 @@ class AuthenticationEmailVerificationSucceededData: """The email address of the user.""" @classmethod - def from_dict( - cls, data: Dict[str, Any] - ) -> "AuthenticationEmailVerificationSucceededData": + def from_dict(cls, data: Dict[str, Any]) -> "AuthenticationEmailVerificationSucceededData": """Deserialize from a dictionary.""" try: return cls( diff --git a/src/workos/common/models/authentication_factor_enrolled_type.py b/src/workos/common/models/authentication_factor_enrolled_type.py index cf0a75b8..d186a74f 100644 --- a/src/workos/common/models/authentication_factor_enrolled_type.py +++ b/src/workos/common/models/authentication_factor_enrolled_type.py @@ -26,7 +26,4 @@ def _missing_(cls, value: object) -> Optional["AuthenticationFactorEnrolledType" unknown._value_ = value return unknown - -AuthenticationFactorEnrolledTypeLiteral: TypeAlias = Literal[ - "generic_otp", "sms", "totp", "webauthn" -] +AuthenticationFactorEnrolledTypeLiteral: TypeAlias = Literal["generic_otp", "sms", "totp", "webauthn"] diff --git a/src/workos/common/models/authentication_factors_create_request_type.py b/src/workos/common/models/authentication_factors_create_request_type.py index 09c88b52..164be280 100644 --- a/src/workos/common/models/authentication_factors_create_request_type.py +++ b/src/workos/common/models/authentication_factors_create_request_type.py @@ -17,9 +17,7 @@ class AuthenticationFactorsCreateRequestType(str, Enum): TOTP = "totp" @classmethod - def _missing_( - cls, value: object - ) -> Optional["AuthenticationFactorsCreateRequestType"]: + def _missing_(cls, value: object) -> Optional["AuthenticationFactorsCreateRequestType"]: if not isinstance(value, str): return None unknown = str.__new__(cls, value) @@ -27,7 +25,4 @@ def _missing_( unknown._value_ = value return unknown - -AuthenticationFactorsCreateRequestTypeLiteral: TypeAlias = Literal[ - "generic_otp", "sms", "totp" -] +AuthenticationFactorsCreateRequestTypeLiteral: TypeAlias = Literal["generic_otp", "sms", "totp"] diff --git a/src/workos/common/models/authentication_magic_auth_failed.py b/src/workos/common/models/authentication_magic_auth_failed.py index 4c6584e3..a94e21ea 100644 --- a/src/workos/common/models/authentication_magic_auth_failed.py +++ b/src/workos/common/models/authentication_magic_auth_failed.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuthenticationMagicAuthFailed": return cls( id=data["id"], event=data["event"], - data=AuthenticationMagicAuthFailedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=AuthenticationMagicAuthFailedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("AuthenticationMagicAuthFailed", e) diff --git a/src/workos/common/models/authentication_magic_auth_failed_data.py b/src/workos/common/models/authentication_magic_auth_failed_data.py index 74426dcd..3f7c805c 100644 --- a/src/workos/common/models/authentication_magic_auth_failed_data.py +++ b/src/workos/common/models/authentication_magic_auth_failed_data.py @@ -7,9 +7,7 @@ from typing import Any, Dict, Literal, Optional from workos._types import _raise_deserialize_error -from .authentication_magic_auth_failed_data_error import ( - AuthenticationMagicAuthFailedDataError, -) +from .authentication_magic_auth_failed_data_error import AuthenticationMagicAuthFailedDataError @dataclass(slots=True) @@ -40,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuthenticationMagicAuthFailedData": user_agent=data["user_agent"], user_id=data["user_id"], email=data["email"], - error=AuthenticationMagicAuthFailedDataError.from_dict( - cast(Dict[str, Any], data["error"]) - ), + error=AuthenticationMagicAuthFailedDataError.from_dict(cast(Dict[str, Any], data["error"])), ) except (KeyError, ValueError) as e: _raise_deserialize_error("AuthenticationMagicAuthFailedData", e) diff --git a/src/workos/common/models/authentication_magic_auth_failed_data_error.py b/src/workos/common/models/authentication_magic_auth_failed_data_error.py index a0eb0649..0ba64c13 100644 --- a/src/workos/common/models/authentication_magic_auth_failed_data_error.py +++ b/src/workos/common/models/authentication_magic_auth_failed_data_error.py @@ -1,10 +1,6 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias -from .authentication_email_verification_failed_data_error import ( - AuthenticationEmailVerificationFailedDataError, -) +from .authentication_email_verification_failed_data_error import AuthenticationEmailVerificationFailedDataError -AuthenticationMagicAuthFailedDataError: TypeAlias = ( - AuthenticationEmailVerificationFailedDataError -) +AuthenticationMagicAuthFailedDataError: TypeAlias = AuthenticationEmailVerificationFailedDataError diff --git a/src/workos/common/models/authentication_magic_auth_succeeded.py b/src/workos/common/models/authentication_magic_auth_succeeded.py index 93930964..6741b1e3 100644 --- a/src/workos/common/models/authentication_magic_auth_succeeded.py +++ b/src/workos/common/models/authentication_magic_auth_succeeded.py @@ -9,9 +9,7 @@ from workos._types import _raise_deserialize_error from workos._types import _format_datetime, _parse_datetime -from .authentication_magic_auth_succeeded_data import ( - AuthenticationMagicAuthSucceededData, -) +from .authentication_magic_auth_succeeded_data import AuthenticationMagicAuthSucceededData from .event_context import EventContext @@ -37,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuthenticationMagicAuthSucceeded": return cls( id=data["id"], event=data["event"], - data=AuthenticationMagicAuthSucceededData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=AuthenticationMagicAuthSucceededData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("AuthenticationMagicAuthSucceeded", e) diff --git a/src/workos/common/models/authentication_magic_auth_succeeded_data.py b/src/workos/common/models/authentication_magic_auth_succeeded_data.py index 46d92ab3..37b2fef1 100644 --- a/src/workos/common/models/authentication_magic_auth_succeeded_data.py +++ b/src/workos/common/models/authentication_magic_auth_succeeded_data.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Literal, Optional from workos._types import _raise_deserialize_error diff --git a/src/workos/common/models/authentication_mfa_failed.py b/src/workos/common/models/authentication_mfa_failed.py index 116a2799..e90187de 100644 --- a/src/workos/common/models/authentication_mfa_failed.py +++ b/src/workos/common/models/authentication_mfa_failed.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuthenticationMFAFailed": return cls( id=data["id"], event=data["event"], - data=AuthenticationMFAFailedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=AuthenticationMFAFailedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("AuthenticationMFAFailed", e) diff --git a/src/workos/common/models/authentication_mfa_failed_data.py b/src/workos/common/models/authentication_mfa_failed_data.py index 84788e87..bfd18514 100644 --- a/src/workos/common/models/authentication_mfa_failed_data.py +++ b/src/workos/common/models/authentication_mfa_failed_data.py @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuthenticationMFAFailedData": user_agent=data["user_agent"], user_id=data["user_id"], email=data["email"], - error=AuthenticationMFAFailedDataError.from_dict( - cast(Dict[str, Any], data["error"]) - ), + error=AuthenticationMFAFailedDataError.from_dict(cast(Dict[str, Any], data["error"])), ) except (KeyError, ValueError) as e: _raise_deserialize_error("AuthenticationMFAFailedData", e) diff --git a/src/workos/common/models/authentication_mfa_failed_data_error.py b/src/workos/common/models/authentication_mfa_failed_data_error.py index 27838fd6..31122dac 100644 --- a/src/workos/common/models/authentication_mfa_failed_data_error.py +++ b/src/workos/common/models/authentication_mfa_failed_data_error.py @@ -1,10 +1,6 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias -from .authentication_email_verification_failed_data_error import ( - AuthenticationEmailVerificationFailedDataError, -) +from .authentication_email_verification_failed_data_error import AuthenticationEmailVerificationFailedDataError -AuthenticationMFAFailedDataError: TypeAlias = ( - AuthenticationEmailVerificationFailedDataError -) +AuthenticationMFAFailedDataError: TypeAlias = AuthenticationEmailVerificationFailedDataError diff --git a/src/workos/common/models/authentication_mfa_succeeded.py b/src/workos/common/models/authentication_mfa_succeeded.py index 3a56a526..f760ac99 100644 --- a/src/workos/common/models/authentication_mfa_succeeded.py +++ b/src/workos/common/models/authentication_mfa_succeeded.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuthenticationMFASucceeded": return cls( id=data["id"], event=data["event"], - data=AuthenticationMFASucceededData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=AuthenticationMFASucceededData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("AuthenticationMFASucceeded", e) diff --git a/src/workos/common/models/authentication_mfa_succeeded_data.py b/src/workos/common/models/authentication_mfa_succeeded_data.py index c61bf7c1..4956e62e 100644 --- a/src/workos/common/models/authentication_mfa_succeeded_data.py +++ b/src/workos/common/models/authentication_mfa_succeeded_data.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Literal, Optional from workos._types import _raise_deserialize_error diff --git a/src/workos/common/models/authentication_oauth_failed.py b/src/workos/common/models/authentication_oauth_failed.py index a88b53d8..5597da5a 100644 --- a/src/workos/common/models/authentication_oauth_failed.py +++ b/src/workos/common/models/authentication_oauth_failed.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuthenticationOAuthFailed": return cls( id=data["id"], event=data["event"], - data=AuthenticationOAuthFailedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=AuthenticationOAuthFailedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("AuthenticationOAuthFailed", e) diff --git a/src/workos/common/models/authentication_oauth_failed_data.py b/src/workos/common/models/authentication_oauth_failed_data.py index 53192a5b..5846d57a 100644 --- a/src/workos/common/models/authentication_oauth_failed_data.py +++ b/src/workos/common/models/authentication_oauth_failed_data.py @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuthenticationOAuthFailedData": user_agent=data["user_agent"], user_id=data["user_id"], email=data["email"], - error=AuthenticationOAuthFailedDataError.from_dict( - cast(Dict[str, Any], data["error"]) - ), + error=AuthenticationOAuthFailedDataError.from_dict(cast(Dict[str, Any], data["error"])), ) except (KeyError, ValueError) as e: _raise_deserialize_error("AuthenticationOAuthFailedData", e) diff --git a/src/workos/common/models/authentication_oauth_failed_data_error.py b/src/workos/common/models/authentication_oauth_failed_data_error.py index f5e4931d..36548faa 100644 --- a/src/workos/common/models/authentication_oauth_failed_data_error.py +++ b/src/workos/common/models/authentication_oauth_failed_data_error.py @@ -1,10 +1,6 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias -from .authentication_email_verification_failed_data_error import ( - AuthenticationEmailVerificationFailedDataError, -) +from .authentication_email_verification_failed_data_error import AuthenticationEmailVerificationFailedDataError -AuthenticationOAuthFailedDataError: TypeAlias = ( - AuthenticationEmailVerificationFailedDataError -) +AuthenticationOAuthFailedDataError: TypeAlias = AuthenticationEmailVerificationFailedDataError diff --git a/src/workos/common/models/authentication_oauth_succeeded.py b/src/workos/common/models/authentication_oauth_succeeded.py index c4ac02b8..b5533daa 100644 --- a/src/workos/common/models/authentication_oauth_succeeded.py +++ b/src/workos/common/models/authentication_oauth_succeeded.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuthenticationOAuthSucceeded": return cls( id=data["id"], event=data["event"], - data=AuthenticationOAuthSucceededData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=AuthenticationOAuthSucceededData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("AuthenticationOAuthSucceeded", e) diff --git a/src/workos/common/models/authentication_oauth_succeeded_data.py b/src/workos/common/models/authentication_oauth_succeeded_data.py index a731e050..af82c925 100644 --- a/src/workos/common/models/authentication_oauth_succeeded_data.py +++ b/src/workos/common/models/authentication_oauth_succeeded_data.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Literal, Optional from workos._types import _raise_deserialize_error diff --git a/src/workos/common/models/authentication_passkey_failed.py b/src/workos/common/models/authentication_passkey_failed.py index 07d7cbdf..f0afb8b9 100644 --- a/src/workos/common/models/authentication_passkey_failed.py +++ b/src/workos/common/models/authentication_passkey_failed.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuthenticationPasskeyFailed": return cls( id=data["id"], event=data["event"], - data=AuthenticationPasskeyFailedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=AuthenticationPasskeyFailedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("AuthenticationPasskeyFailed", e) diff --git a/src/workos/common/models/authentication_passkey_failed_data.py b/src/workos/common/models/authentication_passkey_failed_data.py index 649db0bf..48623bd2 100644 --- a/src/workos/common/models/authentication_passkey_failed_data.py +++ b/src/workos/common/models/authentication_passkey_failed_data.py @@ -7,9 +7,7 @@ from typing import Any, Dict, Literal, Optional from workos._types import _raise_deserialize_error -from .authentication_passkey_failed_data_error import ( - AuthenticationPasskeyFailedDataError, -) +from .authentication_passkey_failed_data_error import AuthenticationPasskeyFailedDataError @dataclass(slots=True) @@ -40,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuthenticationPasskeyFailedData": user_agent=data["user_agent"], user_id=data["user_id"], email=data["email"], - error=AuthenticationPasskeyFailedDataError.from_dict( - cast(Dict[str, Any], data["error"]) - ), + error=AuthenticationPasskeyFailedDataError.from_dict(cast(Dict[str, Any], data["error"])), ) except (KeyError, ValueError) as e: _raise_deserialize_error("AuthenticationPasskeyFailedData", e) diff --git a/src/workos/common/models/authentication_passkey_failed_data_error.py b/src/workos/common/models/authentication_passkey_failed_data_error.py index f366c8a7..a31330a9 100644 --- a/src/workos/common/models/authentication_passkey_failed_data_error.py +++ b/src/workos/common/models/authentication_passkey_failed_data_error.py @@ -1,10 +1,6 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias -from .authentication_email_verification_failed_data_error import ( - AuthenticationEmailVerificationFailedDataError, -) +from .authentication_email_verification_failed_data_error import AuthenticationEmailVerificationFailedDataError -AuthenticationPasskeyFailedDataError: TypeAlias = ( - AuthenticationEmailVerificationFailedDataError -) +AuthenticationPasskeyFailedDataError: TypeAlias = AuthenticationEmailVerificationFailedDataError diff --git a/src/workos/common/models/authentication_passkey_succeeded.py b/src/workos/common/models/authentication_passkey_succeeded.py index 4655b4dc..472bb363 100644 --- a/src/workos/common/models/authentication_passkey_succeeded.py +++ b/src/workos/common/models/authentication_passkey_succeeded.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuthenticationPasskeySucceeded": return cls( id=data["id"], event=data["event"], - data=AuthenticationPasskeySucceededData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=AuthenticationPasskeySucceededData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("AuthenticationPasskeySucceeded", e) diff --git a/src/workos/common/models/authentication_passkey_succeeded_data.py b/src/workos/common/models/authentication_passkey_succeeded_data.py index 494a69a1..f836376e 100644 --- a/src/workos/common/models/authentication_passkey_succeeded_data.py +++ b/src/workos/common/models/authentication_passkey_succeeded_data.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Literal, Optional from workos._types import _raise_deserialize_error diff --git a/src/workos/common/models/authentication_password_failed.py b/src/workos/common/models/authentication_password_failed.py index 5918abac..3eb6515d 100644 --- a/src/workos/common/models/authentication_password_failed.py +++ b/src/workos/common/models/authentication_password_failed.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuthenticationPasswordFailed": return cls( id=data["id"], event=data["event"], - data=AuthenticationPasswordFailedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=AuthenticationPasswordFailedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("AuthenticationPasswordFailed", e) diff --git a/src/workos/common/models/authentication_password_failed_data.py b/src/workos/common/models/authentication_password_failed_data.py index cc4940e6..f48fa5e4 100644 --- a/src/workos/common/models/authentication_password_failed_data.py +++ b/src/workos/common/models/authentication_password_failed_data.py @@ -7,9 +7,7 @@ from typing import Any, Dict, Literal, Optional from workos._types import _raise_deserialize_error -from .authentication_password_failed_data_error import ( - AuthenticationPasswordFailedDataError, -) +from .authentication_password_failed_data_error import AuthenticationPasswordFailedDataError @dataclass(slots=True) @@ -40,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuthenticationPasswordFailedData": user_agent=data["user_agent"], user_id=data["user_id"], email=data["email"], - error=AuthenticationPasswordFailedDataError.from_dict( - cast(Dict[str, Any], data["error"]) - ), + error=AuthenticationPasswordFailedDataError.from_dict(cast(Dict[str, Any], data["error"])), ) except (KeyError, ValueError) as e: _raise_deserialize_error("AuthenticationPasswordFailedData", e) diff --git a/src/workos/common/models/authentication_password_failed_data_error.py b/src/workos/common/models/authentication_password_failed_data_error.py index 3c88bef9..37398a9b 100644 --- a/src/workos/common/models/authentication_password_failed_data_error.py +++ b/src/workos/common/models/authentication_password_failed_data_error.py @@ -1,10 +1,6 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias -from .authentication_email_verification_failed_data_error import ( - AuthenticationEmailVerificationFailedDataError, -) +from .authentication_email_verification_failed_data_error import AuthenticationEmailVerificationFailedDataError -AuthenticationPasswordFailedDataError: TypeAlias = ( - AuthenticationEmailVerificationFailedDataError -) +AuthenticationPasswordFailedDataError: TypeAlias = AuthenticationEmailVerificationFailedDataError diff --git a/src/workos/common/models/authentication_password_succeeded.py b/src/workos/common/models/authentication_password_succeeded.py index a6bedc78..aa9ec060 100644 --- a/src/workos/common/models/authentication_password_succeeded.py +++ b/src/workos/common/models/authentication_password_succeeded.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuthenticationPasswordSucceeded": return cls( id=data["id"], event=data["event"], - data=AuthenticationPasswordSucceededData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=AuthenticationPasswordSucceededData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("AuthenticationPasswordSucceeded", e) diff --git a/src/workos/common/models/authentication_password_succeeded_data.py b/src/workos/common/models/authentication_password_succeeded_data.py index 6bcd2537..b6a32817 100644 --- a/src/workos/common/models/authentication_password_succeeded_data.py +++ b/src/workos/common/models/authentication_password_succeeded_data.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Literal, Optional from workos._types import _raise_deserialize_error diff --git a/src/workos/common/models/authentication_radar_risk_detected.py b/src/workos/common/models/authentication_radar_risk_detected.py index 7af05b80..3bbda11a 100644 --- a/src/workos/common/models/authentication_radar_risk_detected.py +++ b/src/workos/common/models/authentication_radar_risk_detected.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuthenticationRadarRiskDetected": return cls( id=data["id"], event=data["event"], - data=AuthenticationRadarRiskDetectedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=AuthenticationRadarRiskDetectedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("AuthenticationRadarRiskDetected", e) diff --git a/src/workos/common/models/authentication_radar_risk_detected_data.py b/src/workos/common/models/authentication_radar_risk_detected_data.py index 50fb8877..75e4c940 100644 --- a/src/workos/common/models/authentication_radar_risk_detected_data.py +++ b/src/workos/common/models/authentication_radar_risk_detected_data.py @@ -4,11 +4,10 @@ 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 .authentication_radar_risk_detected_data_action import ( - AuthenticationRadarRiskDetectedDataAction, -) +from .authentication_radar_risk_detected_data_action import AuthenticationRadarRiskDetectedDataAction @dataclass(slots=True) @@ -52,9 +51,7 @@ def to_dict(self) -> Dict[str, Any]: """Serialize to a dictionary.""" result: Dict[str, Any] = {} result["auth_method"] = self.auth_method - result["action"] = ( - self.action.value if isinstance(self.action, Enum) else self.action - ) + result["action"] = self.action.value if isinstance(self.action, Enum) else self.action if self.control is not None: result["control"] = self.control else: diff --git a/src/workos/common/models/authentication_radar_risk_detected_data_action.py b/src/workos/common/models/authentication_radar_risk_detected_data_action.py index ea413746..6137fb43 100644 --- a/src/workos/common/models/authentication_radar_risk_detected_data_action.py +++ b/src/workos/common/models/authentication_radar_risk_detected_data_action.py @@ -16,9 +16,7 @@ class AuthenticationRadarRiskDetectedDataAction(str, Enum): LOGIN = "login" @classmethod - def _missing_( - cls, value: object - ) -> Optional["AuthenticationRadarRiskDetectedDataAction"]: + def _missing_(cls, value: object) -> Optional["AuthenticationRadarRiskDetectedDataAction"]: if not isinstance(value, str): return None unknown = str.__new__(cls, value) @@ -26,5 +24,4 @@ def _missing_( unknown._value_ = value return unknown - AuthenticationRadarRiskDetectedDataActionLiteral: TypeAlias = Literal["signup", "login"] diff --git a/src/workos/common/models/authentication_sso_failed.py b/src/workos/common/models/authentication_sso_failed.py index 17cd79e0..4792f25f 100644 --- a/src/workos/common/models/authentication_sso_failed.py +++ b/src/workos/common/models/authentication_sso_failed.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuthenticationSSOFailed": return cls( id=data["id"], event=data["event"], - data=AuthenticationSSOFailedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=AuthenticationSSOFailedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("AuthenticationSSOFailed", e) diff --git a/src/workos/common/models/authentication_sso_failed_data.py b/src/workos/common/models/authentication_sso_failed_data.py index 115c25f3..413f2aae 100644 --- a/src/workos/common/models/authentication_sso_failed_data.py +++ b/src/workos/common/models/authentication_sso_failed_data.py @@ -41,12 +41,8 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuthenticationSSOFailedData": user_agent=data["user_agent"], user_id=data["user_id"], email=data["email"], - sso=AuthenticationSSOFailedDataSSO.from_dict( - cast(Dict[str, Any], data["sso"]) - ), - error=AuthenticationSSOFailedDataError.from_dict( - cast(Dict[str, Any], data["error"]) - ), + sso=AuthenticationSSOFailedDataSSO.from_dict(cast(Dict[str, Any], data["sso"])), + error=AuthenticationSSOFailedDataError.from_dict(cast(Dict[str, Any], data["error"])), ) except (KeyError, ValueError) as e: _raise_deserialize_error("AuthenticationSSOFailedData", e) diff --git a/src/workos/common/models/authentication_sso_failed_data_error.py b/src/workos/common/models/authentication_sso_failed_data_error.py index 965ebbe6..8e41e7bd 100644 --- a/src/workos/common/models/authentication_sso_failed_data_error.py +++ b/src/workos/common/models/authentication_sso_failed_data_error.py @@ -1,10 +1,6 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias -from .authentication_email_verification_failed_data_error import ( - AuthenticationEmailVerificationFailedDataError, -) +from .authentication_email_verification_failed_data_error import AuthenticationEmailVerificationFailedDataError -AuthenticationSSOFailedDataError: TypeAlias = ( - AuthenticationEmailVerificationFailedDataError -) +AuthenticationSSOFailedDataError: TypeAlias = AuthenticationEmailVerificationFailedDataError diff --git a/src/workos/common/models/authentication_sso_failed_data_sso.py b/src/workos/common/models/authentication_sso_failed_data_sso.py index 493d4dcc..36055e0a 100644 --- a/src/workos/common/models/authentication_sso_failed_data_sso.py +++ b/src/workos/common/models/authentication_sso_failed_data_sso.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Optional from workos._types import _raise_deserialize_error diff --git a/src/workos/common/models/authentication_sso_started.py b/src/workos/common/models/authentication_sso_started.py index da622259..4748cdf6 100644 --- a/src/workos/common/models/authentication_sso_started.py +++ b/src/workos/common/models/authentication_sso_started.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuthenticationSSOStarted": return cls( id=data["id"], event=data["event"], - data=AuthenticationSSOStartedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=AuthenticationSSOStartedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("AuthenticationSSOStarted", e) diff --git a/src/workos/common/models/authentication_sso_started_data.py b/src/workos/common/models/authentication_sso_started_data.py index d3293e76..d2128927 100644 --- a/src/workos/common/models/authentication_sso_started_data.py +++ b/src/workos/common/models/authentication_sso_started_data.py @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuthenticationSSOStartedData": user_agent=data["user_agent"], user_id=data["user_id"], email=data["email"], - sso=AuthenticationSSOStartedDataSSO.from_dict( - cast(Dict[str, Any], data["sso"]) - ), + sso=AuthenticationSSOStartedDataSSO.from_dict(cast(Dict[str, Any], data["sso"])), ) except (KeyError, ValueError) as e: _raise_deserialize_error("AuthenticationSSOStartedData", e) diff --git a/src/workos/common/models/authentication_sso_succeeded.py b/src/workos/common/models/authentication_sso_succeeded.py index dff67b1d..b53333e8 100644 --- a/src/workos/common/models/authentication_sso_succeeded.py +++ b/src/workos/common/models/authentication_sso_succeeded.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuthenticationSSOSucceeded": return cls( id=data["id"], event=data["event"], - data=AuthenticationSSOSucceededData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=AuthenticationSSOSucceededData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("AuthenticationSSOSucceeded", e) diff --git a/src/workos/common/models/authentication_sso_succeeded_data.py b/src/workos/common/models/authentication_sso_succeeded_data.py index 46f2ba48..23a00c2d 100644 --- a/src/workos/common/models/authentication_sso_succeeded_data.py +++ b/src/workos/common/models/authentication_sso_succeeded_data.py @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuthenticationSSOSucceededData": user_agent=data["user_agent"], user_id=data["user_id"], email=data["email"], - sso=AuthenticationSSOSucceededDataSSO.from_dict( - cast(Dict[str, Any], data["sso"]) - ), + sso=AuthenticationSSOSucceededDataSSO.from_dict(cast(Dict[str, Any], data["sso"])), ) except (KeyError, ValueError) as e: _raise_deserialize_error("AuthenticationSSOSucceededData", e) diff --git a/src/workos/common/models/authentication_sso_timed_out.py b/src/workos/common/models/authentication_sso_timed_out.py index e469bf86..bbf1c912 100644 --- a/src/workos/common/models/authentication_sso_timed_out.py +++ b/src/workos/common/models/authentication_sso_timed_out.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuthenticationSSOTimedOut": return cls( id=data["id"], event=data["event"], - data=AuthenticationSSOTimedOutData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=AuthenticationSSOTimedOutData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("AuthenticationSSOTimedOut", e) diff --git a/src/workos/common/models/authentication_sso_timed_out_data.py b/src/workos/common/models/authentication_sso_timed_out_data.py index 6e59eb97..68c8caa5 100644 --- a/src/workos/common/models/authentication_sso_timed_out_data.py +++ b/src/workos/common/models/authentication_sso_timed_out_data.py @@ -41,12 +41,8 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuthenticationSSOTimedOutData": user_agent=data["user_agent"], user_id=data["user_id"], email=data["email"], - sso=AuthenticationSSOTimedOutDataSSO.from_dict( - cast(Dict[str, Any], data["sso"]) - ), - error=AuthenticationSSOTimedOutDataError.from_dict( - cast(Dict[str, Any], data["error"]) - ), + sso=AuthenticationSSOTimedOutDataSSO.from_dict(cast(Dict[str, Any], data["sso"])), + error=AuthenticationSSOTimedOutDataError.from_dict(cast(Dict[str, Any], data["error"])), ) except (KeyError, ValueError) as e: _raise_deserialize_error("AuthenticationSSOTimedOutData", e) diff --git a/src/workos/common/models/authentication_sso_timed_out_data_error.py b/src/workos/common/models/authentication_sso_timed_out_data_error.py index ec3190ee..c63571f3 100644 --- a/src/workos/common/models/authentication_sso_timed_out_data_error.py +++ b/src/workos/common/models/authentication_sso_timed_out_data_error.py @@ -1,10 +1,6 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias -from .authentication_email_verification_failed_data_error import ( - AuthenticationEmailVerificationFailedDataError, -) +from .authentication_email_verification_failed_data_error import AuthenticationEmailVerificationFailedDataError -AuthenticationSSOTimedOutDataError: TypeAlias = ( - AuthenticationEmailVerificationFailedDataError -) +AuthenticationSSOTimedOutDataError: TypeAlias = AuthenticationEmailVerificationFailedDataError diff --git a/src/workos/common/models/connected_account_state.py b/src/workos/common/models/connected_account_state.py index 743b7d0b..8a24634a 100644 --- a/src/workos/common/models/connected_account_state.py +++ b/src/workos/common/models/connected_account_state.py @@ -25,7 +25,4 @@ def _missing_(cls, value: object) -> Optional["ConnectedAccountState"]: unknown._value_ = value return unknown - -ConnectedAccountStateLiteral: TypeAlias = Literal[ - "connected", "needs_reauthorization", "disconnected" -] +ConnectedAccountStateLiteral: TypeAlias = Literal["connected", "needs_reauthorization", "disconnected"] diff --git a/src/workos/common/models/connection_activated.py b/src/workos/common/models/connection_activated.py index 6ec5cbb9..4d7f48f2 100644 --- a/src/workos/common/models/connection_activated.py +++ b/src/workos/common/models/connection_activated.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "ConnectionActivated": return cls( id=data["id"], event=data["event"], - data=ConnectionActivatedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=ConnectionActivatedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("ConnectionActivated", e) diff --git a/src/workos/common/models/connection_activated_data.py b/src/workos/common/models/connection_activated_data.py index 151bc2c9..c1eed584 100644 --- a/src/workos/common/models/connection_activated_data.py +++ b/src/workos/common/models/connection_activated_data.py @@ -11,9 +11,7 @@ from workos._types import _format_datetime, _parse_datetime from .connection_activated_data_domain import ConnectionActivatedDataDomain -from .connection_activated_data_connection_type import ( - ConnectionActivatedDataConnectionType, -) +from .connection_activated_data_connection_type import ConnectionActivatedDataConnectionType from .connection_activated_data_state import ConnectionActivatedDataState from .connection_activated_data_status import ConnectionActivatedDataStatus @@ -54,17 +52,12 @@ def from_dict(cls, data: Dict[str, Any]) -> "ConnectionActivatedData": id=data["id"], state=ConnectionActivatedDataState(data["state"]), name=data["name"], - connection_type=ConnectionActivatedDataConnectionType( - data["connection_type"] - ), + connection_type=ConnectionActivatedDataConnectionType(data["connection_type"]), created_at=_parse_datetime(data["created_at"]), updated_at=_parse_datetime(data["updated_at"]), external_key=data["external_key"], status=ConnectionActivatedDataStatus(data["status"]), - domains=[ - ConnectionActivatedDataDomain.from_dict(cast(Dict[str, Any], item)) - for item in cast(list[Any], data["domains"]) - ], + domains=[ConnectionActivatedDataDomain.from_dict(cast(Dict[str, Any], item)) for item in cast(list[Any], data["domains"])], organization_id=data.get("organization_id"), ) except (KeyError, ValueError) as e: @@ -75,21 +68,13 @@ def to_dict(self) -> Dict[str, Any]: result: Dict[str, Any] = {} result["object"] = self.object result["id"] = self.id - result["state"] = ( - self.state.value if isinstance(self.state, Enum) else self.state - ) + result["state"] = self.state.value if isinstance(self.state, Enum) else self.state result["name"] = self.name - result["connection_type"] = ( - self.connection_type.value - if isinstance(self.connection_type, Enum) - else self.connection_type - ) + result["connection_type"] = self.connection_type.value if isinstance(self.connection_type, Enum) else self.connection_type result["created_at"] = _format_datetime(self.created_at) result["updated_at"] = _format_datetime(self.updated_at) result["external_key"] = self.external_key - result["status"] = ( - self.status.value if isinstance(self.status, Enum) else self.status - ) + result["status"] = self.status.value if isinstance(self.status, Enum) else self.status result["domains"] = [item.to_dict() for item in self.domains] if self.organization_id is not None: result["organization_id"] = self.organization_id diff --git a/src/workos/common/models/connection_activated_data_connection_type.py b/src/workos/common/models/connection_activated_data_connection_type.py index e1a03153..94637f51 100644 --- a/src/workos/common/models/connection_activated_data_connection_type.py +++ b/src/workos/common/models/connection_activated_data_connection_type.py @@ -64,9 +64,7 @@ class ConnectionActivatedDataConnectionType(str, Enum): XERO_OAUTH = "XeroOAuth" @classmethod - def _missing_( - cls, value: object - ) -> Optional["ConnectionActivatedDataConnectionType"]: + def _missing_(cls, value: object) -> Optional["ConnectionActivatedDataConnectionType"]: if not isinstance(value, str): return None unknown = str.__new__(cls, value) @@ -74,56 +72,4 @@ def _missing_( unknown._value_ = value return unknown - -ConnectionActivatedDataConnectionTypeLiteral: TypeAlias = Literal[ - "ADFSSAML", - "AdpOidc", - "AppleOAuth", - "Auth0Migration", - "Auth0SAML", - "AzureSAML", - "BitbucketOAuth", - "CasSAML", - "ClassLinkSAML", - "CleverOIDC", - "CloudflareSAML", - "CyberArkSAML", - "DiscordOAuth", - "DuoSAML", - "EntraIdOIDC", - "GenericOIDC", - "GenericSAML", - "GitHubOAuth", - "GitLabOAuth", - "GoogleOAuth", - "GoogleOIDC", - "GoogleSAML", - "IntuitOAuth", - "JumpCloudSAML", - "KeycloakSAML", - "LastPassSAML", - "LinkedInOAuth", - "LoginGovOidc", - "MagicLink", - "MicrosoftOAuth", - "MiniOrangeSAML", - "NetIqSAML", - "OktaOIDC", - "OktaSAML", - "OneLoginSAML", - "OracleSAML", - "PingFederateSAML", - "PingOneSAML", - "RipplingSAML", - "SalesforceSAML", - "ShibbolethGenericSAML", - "ShibbolethSAML", - "SimpleSamlPhpSAML", - "SalesforceOAuth", - "SlackOAuth", - "TestIdp", - "VercelMarketplaceOAuth", - "VercelOAuth", - "VMwareSAML", - "XeroOAuth", -] +ConnectionActivatedDataConnectionTypeLiteral: TypeAlias = Literal["ADFSSAML", "AdpOidc", "AppleOAuth", "Auth0Migration", "Auth0SAML", "AzureSAML", "BitbucketOAuth", "CasSAML", "ClassLinkSAML", "CleverOIDC", "CloudflareSAML", "CyberArkSAML", "DiscordOAuth", "DuoSAML", "EntraIdOIDC", "GenericOIDC", "GenericSAML", "GitHubOAuth", "GitLabOAuth", "GoogleOAuth", "GoogleOIDC", "GoogleSAML", "IntuitOAuth", "JumpCloudSAML", "KeycloakSAML", "LastPassSAML", "LinkedInOAuth", "LoginGovOidc", "MagicLink", "MicrosoftOAuth", "MiniOrangeSAML", "NetIqSAML", "OktaOIDC", "OktaSAML", "OneLoginSAML", "OracleSAML", "PingFederateSAML", "PingOneSAML", "RipplingSAML", "SalesforceSAML", "ShibbolethGenericSAML", "ShibbolethSAML", "SimpleSamlPhpSAML", "SalesforceOAuth", "SlackOAuth", "TestIdp", "VercelMarketplaceOAuth", "VercelOAuth", "VMwareSAML", "XeroOAuth"] diff --git a/src/workos/common/models/connection_activated_data_domain.py b/src/workos/common/models/connection_activated_data_domain.py index 02ad383b..8602ff85 100644 --- a/src/workos/common/models/connection_activated_data_domain.py +++ b/src/workos/common/models/connection_activated_data_domain.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Literal from workos._types import _raise_deserialize_error diff --git a/src/workos/common/models/connection_activated_data_state.py b/src/workos/common/models/connection_activated_data_state.py index f16b8a07..4decf29c 100644 --- a/src/workos/common/models/connection_activated_data_state.py +++ b/src/workos/common/models/connection_activated_data_state.py @@ -27,7 +27,4 @@ def _missing_(cls, value: object) -> Optional["ConnectionActivatedDataState"]: unknown._value_ = value return unknown - -ConnectionActivatedDataStateLiteral: TypeAlias = Literal[ - "draft", "active", "validating", "inactive", "deleting" -] +ConnectionActivatedDataStateLiteral: TypeAlias = Literal["draft", "active", "validating", "inactive", "deleting"] diff --git a/src/workos/common/models/connection_activated_data_status.py b/src/workos/common/models/connection_activated_data_status.py index 73628492..58b990b8 100644 --- a/src/workos/common/models/connection_activated_data_status.py +++ b/src/workos/common/models/connection_activated_data_status.py @@ -24,5 +24,4 @@ def _missing_(cls, value: object) -> Optional["ConnectionActivatedDataStatus"]: unknown._value_ = value return unknown - ConnectionActivatedDataStatusLiteral: TypeAlias = Literal["linked", "unlinked"] diff --git a/src/workos/common/models/connection_deactivated.py b/src/workos/common/models/connection_deactivated.py index 26699f24..b658349e 100644 --- a/src/workos/common/models/connection_deactivated.py +++ b/src/workos/common/models/connection_deactivated.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "ConnectionDeactivated": return cls( id=data["id"], event=data["event"], - data=ConnectionDeactivatedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=ConnectionDeactivatedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("ConnectionDeactivated", e) diff --git a/src/workos/common/models/connection_deactivated_data_connection_type.py b/src/workos/common/models/connection_deactivated_data_connection_type.py index 93b70864..fae8c7ab 100644 --- a/src/workos/common/models/connection_deactivated_data_connection_type.py +++ b/src/workos/common/models/connection_deactivated_data_connection_type.py @@ -1,11 +1,7 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias -from .connection_activated_data_connection_type import ( - ConnectionActivatedDataConnectionType, -) +from .connection_activated_data_connection_type import ConnectionActivatedDataConnectionType -ConnectionDeactivatedDataConnectionType: TypeAlias = ( - ConnectionActivatedDataConnectionType -) +ConnectionDeactivatedDataConnectionType: TypeAlias = ConnectionActivatedDataConnectionType __all__ = ["ConnectionDeactivatedDataConnectionType"] diff --git a/src/workos/common/models/connection_deleted.py b/src/workos/common/models/connection_deleted.py index 75985c54..4eb8a454 100644 --- a/src/workos/common/models/connection_deleted.py +++ b/src/workos/common/models/connection_deleted.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "ConnectionDeleted": return cls( id=data["id"], event=data["event"], - data=ConnectionDeletedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=ConnectionDeletedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("ConnectionDeleted", e) diff --git a/src/workos/common/models/connection_deleted_data.py b/src/workos/common/models/connection_deleted_data.py index 6ddf2560..a139d4eb 100644 --- a/src/workos/common/models/connection_deleted_data.py +++ b/src/workos/common/models/connection_deleted_data.py @@ -5,6 +5,7 @@ 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 @@ -42,9 +43,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "ConnectionDeletedData": id=data["id"], state=ConnectionDeletedDataState(data["state"]), name=data["name"], - connection_type=ConnectionDeletedDataConnectionType( - data["connection_type"] - ), + connection_type=ConnectionDeletedDataConnectionType(data["connection_type"]), created_at=_parse_datetime(data["created_at"]), updated_at=_parse_datetime(data["updated_at"]), organization_id=data.get("organization_id"), @@ -57,15 +56,9 @@ def to_dict(self) -> Dict[str, Any]: result: Dict[str, Any] = {} result["object"] = self.object result["id"] = self.id - result["state"] = ( - self.state.value if isinstance(self.state, Enum) else self.state - ) + result["state"] = self.state.value if isinstance(self.state, Enum) else self.state result["name"] = self.name - result["connection_type"] = ( - self.connection_type.value - if isinstance(self.connection_type, Enum) - else self.connection_type - ) + result["connection_type"] = self.connection_type.value if isinstance(self.connection_type, Enum) else self.connection_type result["created_at"] = _format_datetime(self.created_at) result["updated_at"] = _format_datetime(self.updated_at) if self.organization_id is not None: diff --git a/src/workos/common/models/connection_deleted_data_connection_type.py b/src/workos/common/models/connection_deleted_data_connection_type.py index 0a807ad6..47ff879d 100644 --- a/src/workos/common/models/connection_deleted_data_connection_type.py +++ b/src/workos/common/models/connection_deleted_data_connection_type.py @@ -1,9 +1,7 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias -from .connection_activated_data_connection_type import ( - ConnectionActivatedDataConnectionType, -) +from .connection_activated_data_connection_type import ConnectionActivatedDataConnectionType ConnectionDeletedDataConnectionType: TypeAlias = ConnectionActivatedDataConnectionType __all__ = ["ConnectionDeletedDataConnectionType"] diff --git a/src/workos/common/models/connection_saml_certificate_renewal_required.py b/src/workos/common/models/connection_saml_certificate_renewal_required.py index 7f96d8ca..ca9869f2 100644 --- a/src/workos/common/models/connection_saml_certificate_renewal_required.py +++ b/src/workos/common/models/connection_saml_certificate_renewal_required.py @@ -9,9 +9,7 @@ from workos._types import _raise_deserialize_error from workos._types import _format_datetime, _parse_datetime -from .connection_saml_certificate_renewal_required_data import ( - ConnectionSAMLCertificateRenewalRequiredData, -) +from .connection_saml_certificate_renewal_required_data import ConnectionSAMLCertificateRenewalRequiredData from .event_context import EventContext @@ -31,22 +29,16 @@ class ConnectionSAMLCertificateRenewalRequired: context: Optional["EventContext"] = None @classmethod - def from_dict( - cls, data: Dict[str, Any] - ) -> "ConnectionSAMLCertificateRenewalRequired": + def from_dict(cls, data: Dict[str, Any]) -> "ConnectionSAMLCertificateRenewalRequired": """Deserialize from a dictionary.""" try: return cls( id=data["id"], event=data["event"], - data=ConnectionSAMLCertificateRenewalRequiredData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=ConnectionSAMLCertificateRenewalRequiredData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("ConnectionSAMLCertificateRenewalRequired", e) diff --git a/src/workos/common/models/connection_saml_certificate_renewal_required_data.py b/src/workos/common/models/connection_saml_certificate_renewal_required_data.py index ae5a1e46..2fbc3389 100644 --- a/src/workos/common/models/connection_saml_certificate_renewal_required_data.py +++ b/src/workos/common/models/connection_saml_certificate_renewal_required_data.py @@ -7,12 +7,8 @@ from typing import Any, Dict from workos._types import _raise_deserialize_error -from .connection_saml_certificate_renewal_required_data_certificate import ( - ConnectionSAMLCertificateRenewalRequiredDataCertificate, -) -from .connection_saml_certificate_renewal_required_data_connection import ( - ConnectionSAMLCertificateRenewalRequiredDataConnection, -) +from .connection_saml_certificate_renewal_required_data_certificate import ConnectionSAMLCertificateRenewalRequiredDataCertificate +from .connection_saml_certificate_renewal_required_data_connection import ConnectionSAMLCertificateRenewalRequiredDataConnection @dataclass(slots=True) @@ -27,18 +23,12 @@ class ConnectionSAMLCertificateRenewalRequiredData: """The number of days until the certificate expires.""" @classmethod - def from_dict( - cls, data: Dict[str, Any] - ) -> "ConnectionSAMLCertificateRenewalRequiredData": + def from_dict(cls, data: Dict[str, Any]) -> "ConnectionSAMLCertificateRenewalRequiredData": """Deserialize from a dictionary.""" try: return cls( - connection=ConnectionSAMLCertificateRenewalRequiredDataConnection.from_dict( - cast(Dict[str, Any], data["connection"]) - ), - certificate=ConnectionSAMLCertificateRenewalRequiredDataCertificate.from_dict( - cast(Dict[str, Any], data["certificate"]) - ), + connection=ConnectionSAMLCertificateRenewalRequiredDataConnection.from_dict(cast(Dict[str, Any], data["connection"])), + certificate=ConnectionSAMLCertificateRenewalRequiredDataCertificate.from_dict(cast(Dict[str, Any], data["certificate"])), days_until_expiry=data["days_until_expiry"], ) except (KeyError, ValueError) as e: diff --git a/src/workos/common/models/connection_saml_certificate_renewal_required_data_certificate.py b/src/workos/common/models/connection_saml_certificate_renewal_required_data_certificate.py index 7234f392..d944856e 100644 --- a/src/workos/common/models/connection_saml_certificate_renewal_required_data_certificate.py +++ b/src/workos/common/models/connection_saml_certificate_renewal_required_data_certificate.py @@ -5,21 +5,18 @@ from dataclasses import dataclass from datetime import datetime from enum import Enum +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error from workos._types import _format_datetime, _parse_datetime -from .connection_saml_certificate_renewal_required_data_certificate_certificate_type import ( - ConnectionSAMLCertificateRenewalRequiredDataCertificateCertificateType, -) +from .connection_saml_certificate_renewal_required_data_certificate_certificate_type import ConnectionSAMLCertificateRenewalRequiredDataCertificateCertificateType @dataclass(slots=True) class ConnectionSAMLCertificateRenewalRequiredDataCertificate: """The SAML certificate details.""" - certificate_type: ( - "ConnectionSAMLCertificateRenewalRequiredDataCertificateCertificateType" - ) + certificate_type: "ConnectionSAMLCertificateRenewalRequiredDataCertificateCertificateType" """The type of the SAML certificate.""" expiry_date: datetime """An ISO 8601 timestamp.""" @@ -27,31 +24,21 @@ class ConnectionSAMLCertificateRenewalRequiredDataCertificate: """Whether the certificate has already expired.""" @classmethod - def from_dict( - cls, data: Dict[str, Any] - ) -> "ConnectionSAMLCertificateRenewalRequiredDataCertificate": + def from_dict(cls, data: Dict[str, Any]) -> "ConnectionSAMLCertificateRenewalRequiredDataCertificate": """Deserialize from a dictionary.""" try: return cls( - certificate_type=ConnectionSAMLCertificateRenewalRequiredDataCertificateCertificateType( - data["certificate_type"] - ), + certificate_type=ConnectionSAMLCertificateRenewalRequiredDataCertificateCertificateType(data["certificate_type"]), expiry_date=_parse_datetime(data["expiry_date"]), is_expired=data["is_expired"], ) except (KeyError, ValueError) as e: - _raise_deserialize_error( - "ConnectionSAMLCertificateRenewalRequiredDataCertificate", e - ) + _raise_deserialize_error("ConnectionSAMLCertificateRenewalRequiredDataCertificate", e) def to_dict(self) -> Dict[str, Any]: """Serialize to a dictionary.""" result: Dict[str, Any] = {} - result["certificate_type"] = ( - self.certificate_type.value - if isinstance(self.certificate_type, Enum) - else self.certificate_type - ) + result["certificate_type"] = self.certificate_type.value if isinstance(self.certificate_type, Enum) else self.certificate_type result["expiry_date"] = _format_datetime(self.expiry_date) result["is_expired"] = self.is_expired return result diff --git a/src/workos/common/models/connection_saml_certificate_renewal_required_data_certificate_certificate_type.py b/src/workos/common/models/connection_saml_certificate_renewal_required_data_certificate_certificate_type.py index 14a72d4f..dd0f262b 100644 --- a/src/workos/common/models/connection_saml_certificate_renewal_required_data_certificate_certificate_type.py +++ b/src/workos/common/models/connection_saml_certificate_renewal_required_data_certificate_certificate_type.py @@ -17,11 +17,7 @@ class ConnectionSAMLCertificateRenewalRequiredDataCertificateCertificateType(str RESPONSE_ENCRYPTION = "ResponseEncryption" @classmethod - def _missing_( - cls, value: object - ) -> Optional[ - "ConnectionSAMLCertificateRenewalRequiredDataCertificateCertificateType" - ]: + def _missing_(cls, value: object) -> Optional["ConnectionSAMLCertificateRenewalRequiredDataCertificateCertificateType"]: if not isinstance(value, str): return None unknown = str.__new__(cls, value) @@ -29,7 +25,4 @@ def _missing_( unknown._value_ = value return unknown - -ConnectionSAMLCertificateRenewalRequiredDataCertificateCertificateTypeLiteral: TypeAlias = Literal[ - "ResponseSigning", "RequestSigning", "ResponseEncryption" -] +ConnectionSAMLCertificateRenewalRequiredDataCertificateCertificateTypeLiteral: TypeAlias = Literal["ResponseSigning", "RequestSigning", "ResponseEncryption"] diff --git a/src/workos/common/models/connection_saml_certificate_renewal_required_data_connection.py b/src/workos/common/models/connection_saml_certificate_renewal_required_data_connection.py index ed7008ed..ae923b38 100644 --- a/src/workos/common/models/connection_saml_certificate_renewal_required_data_connection.py +++ b/src/workos/common/models/connection_saml_certificate_renewal_required_data_connection.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Optional from workos._types import _raise_deserialize_error @@ -17,9 +18,7 @@ class ConnectionSAMLCertificateRenewalRequiredDataConnection: """The ID of the organization the connection belongs to.""" @classmethod - def from_dict( - cls, data: Dict[str, Any] - ) -> "ConnectionSAMLCertificateRenewalRequiredDataConnection": + def from_dict(cls, data: Dict[str, Any]) -> "ConnectionSAMLCertificateRenewalRequiredDataConnection": """Deserialize from a dictionary.""" try: return cls( @@ -27,9 +26,7 @@ def from_dict( organization_id=data.get("organization_id"), ) except (KeyError, ValueError) as e: - _raise_deserialize_error( - "ConnectionSAMLCertificateRenewalRequiredDataConnection", e - ) + _raise_deserialize_error("ConnectionSAMLCertificateRenewalRequiredDataConnection", e) def to_dict(self) -> Dict[str, Any]: """Serialize to a dictionary.""" diff --git a/src/workos/common/models/connection_saml_certificate_renewed.py b/src/workos/common/models/connection_saml_certificate_renewed.py index 6f6f7f17..9d79bffb 100644 --- a/src/workos/common/models/connection_saml_certificate_renewed.py +++ b/src/workos/common/models/connection_saml_certificate_renewed.py @@ -9,9 +9,7 @@ from workos._types import _raise_deserialize_error from workos._types import _format_datetime, _parse_datetime -from .connection_saml_certificate_renewed_data import ( - ConnectionSAMLCertificateRenewedData, -) +from .connection_saml_certificate_renewed_data import ConnectionSAMLCertificateRenewedData from .event_context import EventContext @@ -37,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "ConnectionSAMLCertificateRenewed": return cls( id=data["id"], event=data["event"], - data=ConnectionSAMLCertificateRenewedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=ConnectionSAMLCertificateRenewedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("ConnectionSAMLCertificateRenewed", e) diff --git a/src/workos/common/models/connection_saml_certificate_renewed_data.py b/src/workos/common/models/connection_saml_certificate_renewed_data.py index 169bfe0b..f84dc064 100644 --- a/src/workos/common/models/connection_saml_certificate_renewed_data.py +++ b/src/workos/common/models/connection_saml_certificate_renewed_data.py @@ -9,12 +9,8 @@ from workos._types import _raise_deserialize_error from workos._types import _format_datetime, _parse_datetime -from .connection_saml_certificate_renewed_data_certificate import ( - ConnectionSAMLCertificateRenewedDataCertificate, -) -from .connection_saml_certificate_renewed_data_connection import ( - ConnectionSAMLCertificateRenewedDataConnection, -) +from .connection_saml_certificate_renewed_data_certificate import ConnectionSAMLCertificateRenewedDataCertificate +from .connection_saml_certificate_renewed_data_connection import ConnectionSAMLCertificateRenewedDataConnection @dataclass(slots=True) @@ -33,12 +29,8 @@ def from_dict(cls, data: Dict[str, Any]) -> "ConnectionSAMLCertificateRenewedDat """Deserialize from a dictionary.""" try: return cls( - connection=ConnectionSAMLCertificateRenewedDataConnection.from_dict( - cast(Dict[str, Any], data["connection"]) - ), - certificate=ConnectionSAMLCertificateRenewedDataCertificate.from_dict( - cast(Dict[str, Any], data["certificate"]) - ), + connection=ConnectionSAMLCertificateRenewedDataConnection.from_dict(cast(Dict[str, Any], data["connection"])), + certificate=ConnectionSAMLCertificateRenewedDataCertificate.from_dict(cast(Dict[str, Any], data["certificate"])), renewed_at=_parse_datetime(data["renewed_at"]), ) except (KeyError, ValueError) as e: diff --git a/src/workos/common/models/connection_saml_certificate_renewed_data_certificate.py b/src/workos/common/models/connection_saml_certificate_renewed_data_certificate.py index 6f107f4a..39a99b80 100644 --- a/src/workos/common/models/connection_saml_certificate_renewed_data_certificate.py +++ b/src/workos/common/models/connection_saml_certificate_renewed_data_certificate.py @@ -5,12 +5,11 @@ from dataclasses import dataclass from datetime import datetime from enum import Enum +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error from workos._types import _format_datetime, _parse_datetime -from .connection_saml_certificate_renewed_data_certificate_certificate_type import ( - ConnectionSAMLCertificateRenewedDataCertificateCertificateType, -) +from .connection_saml_certificate_renewed_data_certificate_certificate_type import ConnectionSAMLCertificateRenewedDataCertificateCertificateType @dataclass(slots=True) @@ -23,29 +22,19 @@ class ConnectionSAMLCertificateRenewedDataCertificate: """An ISO 8601 timestamp.""" @classmethod - def from_dict( - cls, data: Dict[str, Any] - ) -> "ConnectionSAMLCertificateRenewedDataCertificate": + def from_dict(cls, data: Dict[str, Any]) -> "ConnectionSAMLCertificateRenewedDataCertificate": """Deserialize from a dictionary.""" try: return cls( - certificate_type=ConnectionSAMLCertificateRenewedDataCertificateCertificateType( - data["certificate_type"] - ), + certificate_type=ConnectionSAMLCertificateRenewedDataCertificateCertificateType(data["certificate_type"]), expiry_date=_parse_datetime(data["expiry_date"]), ) except (KeyError, ValueError) as e: - _raise_deserialize_error( - "ConnectionSAMLCertificateRenewedDataCertificate", e - ) + _raise_deserialize_error("ConnectionSAMLCertificateRenewedDataCertificate", e) def to_dict(self) -> Dict[str, Any]: """Serialize to a dictionary.""" result: Dict[str, Any] = {} - result["certificate_type"] = ( - self.certificate_type.value - if isinstance(self.certificate_type, Enum) - else self.certificate_type - ) + result["certificate_type"] = self.certificate_type.value if isinstance(self.certificate_type, Enum) else self.certificate_type result["expiry_date"] = _format_datetime(self.expiry_date) return result diff --git a/src/workos/common/models/connection_saml_certificate_renewed_data_certificate_certificate_type.py b/src/workos/common/models/connection_saml_certificate_renewed_data_certificate_certificate_type.py index 1d1274ea..c5dbc292 100644 --- a/src/workos/common/models/connection_saml_certificate_renewed_data_certificate_certificate_type.py +++ b/src/workos/common/models/connection_saml_certificate_renewed_data_certificate_certificate_type.py @@ -1,11 +1,7 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias -from .connection_saml_certificate_renewal_required_data_certificate_certificate_type import ( - ConnectionSAMLCertificateRenewalRequiredDataCertificateCertificateType, -) +from .connection_saml_certificate_renewal_required_data_certificate_certificate_type import ConnectionSAMLCertificateRenewalRequiredDataCertificateCertificateType -ConnectionSAMLCertificateRenewedDataCertificateCertificateType: TypeAlias = ( - ConnectionSAMLCertificateRenewalRequiredDataCertificateCertificateType -) +ConnectionSAMLCertificateRenewedDataCertificateCertificateType: TypeAlias = ConnectionSAMLCertificateRenewalRequiredDataCertificateCertificateType __all__ = ["ConnectionSAMLCertificateRenewedDataCertificateCertificateType"] diff --git a/src/workos/common/models/connection_saml_certificate_renewed_data_connection.py b/src/workos/common/models/connection_saml_certificate_renewed_data_connection.py index 2eef2fed..802719a0 100644 --- a/src/workos/common/models/connection_saml_certificate_renewed_data_connection.py +++ b/src/workos/common/models/connection_saml_certificate_renewed_data_connection.py @@ -1,10 +1,6 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias -from .connection_saml_certificate_renewal_required_data_connection import ( - ConnectionSAMLCertificateRenewalRequiredDataConnection, -) +from .connection_saml_certificate_renewal_required_data_connection import ConnectionSAMLCertificateRenewalRequiredDataConnection -ConnectionSAMLCertificateRenewedDataConnection: TypeAlias = ( - ConnectionSAMLCertificateRenewalRequiredDataConnection -) +ConnectionSAMLCertificateRenewedDataConnection: TypeAlias = ConnectionSAMLCertificateRenewalRequiredDataConnection diff --git a/src/workos/common/models/connection_state.py b/src/workos/common/models/connection_state.py index c519ac06..448e8d91 100644 --- a/src/workos/common/models/connection_state.py +++ b/src/workos/common/models/connection_state.py @@ -28,7 +28,4 @@ def _missing_(cls, value: object) -> Optional["ConnectionState"]: unknown._value_ = value return unknown - -ConnectionStateLiteral: TypeAlias = Literal[ - "requires_type", "draft", "active", "validating", "inactive", "deleting" -] +ConnectionStateLiteral: TypeAlias = Literal["requires_type", "draft", "active", "validating", "inactive", "deleting"] diff --git a/src/workos/common/models/connection_type.py b/src/workos/common/models/connection_type.py index cd67feea..03d96ec3 100644 --- a/src/workos/common/models/connection_type.py +++ b/src/workos/common/models/connection_type.py @@ -73,57 +73,4 @@ def _missing_(cls, value: object) -> Optional["ConnectionType"]: unknown._value_ = value return unknown - -ConnectionTypeLiteral: TypeAlias = Literal[ - "Pending", - "ADFSSAML", - "AdpOidc", - "AppleOAuth", - "Auth0Migration", - "Auth0SAML", - "AzureSAML", - "BitbucketOAuth", - "CasSAML", - "ClassLinkSAML", - "CleverOIDC", - "CloudflareSAML", - "CyberArkSAML", - "DiscordOAuth", - "DuoSAML", - "EntraIdOIDC", - "GenericOIDC", - "GenericSAML", - "GitHubOAuth", - "GitLabOAuth", - "GoogleOAuth", - "GoogleOIDC", - "GoogleSAML", - "IntuitOAuth", - "JumpCloudSAML", - "KeycloakSAML", - "LastPassSAML", - "LinkedInOAuth", - "LoginGovOidc", - "MagicLink", - "MicrosoftOAuth", - "MiniOrangeSAML", - "NetIqSAML", - "OktaOIDC", - "OktaSAML", - "OneLoginSAML", - "OracleSAML", - "PingFederateSAML", - "PingOneSAML", - "RipplingSAML", - "SalesforceSAML", - "ShibbolethGenericSAML", - "ShibbolethSAML", - "SimpleSamlPhpSAML", - "SalesforceOAuth", - "SlackOAuth", - "TestIdp", - "VercelMarketplaceOAuth", - "VercelOAuth", - "VMwareSAML", - "XeroOAuth", -] +ConnectionTypeLiteral: TypeAlias = Literal["Pending", "ADFSSAML", "AdpOidc", "AppleOAuth", "Auth0Migration", "Auth0SAML", "AzureSAML", "BitbucketOAuth", "CasSAML", "ClassLinkSAML", "CleverOIDC", "CloudflareSAML", "CyberArkSAML", "DiscordOAuth", "DuoSAML", "EntraIdOIDC", "GenericOIDC", "GenericSAML", "GitHubOAuth", "GitLabOAuth", "GoogleOAuth", "GoogleOIDC", "GoogleSAML", "IntuitOAuth", "JumpCloudSAML", "KeycloakSAML", "LastPassSAML", "LinkedInOAuth", "LoginGovOidc", "MagicLink", "MicrosoftOAuth", "MiniOrangeSAML", "NetIqSAML", "OktaOIDC", "OktaSAML", "OneLoginSAML", "OracleSAML", "PingFederateSAML", "PingOneSAML", "RipplingSAML", "SalesforceSAML", "ShibbolethGenericSAML", "ShibbolethSAML", "SimpleSamlPhpSAML", "SalesforceOAuth", "SlackOAuth", "TestIdp", "VercelMarketplaceOAuth", "VercelOAuth", "VMwareSAML", "XeroOAuth"] 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..5539b5ba 100644 --- a/src/workos/common/models/create_user_invite_options_locale.py +++ b/src/workos/common/models/create_user_invite_options_locale.py @@ -112,96 +112,4 @@ def _missing_(cls, value: object) -> Optional["CreateUserInviteOptionsLocale"]: unknown._value_ = value return unknown - -CreateUserInviteOptionsLocaleLiteral: TypeAlias = Literal[ - "af", - "am", - "ar", - "bg", - "bn", - "bs", - "ca", - "cs", - "da", - "de", - "de-DE", - "el", - "en", - "en-AU", - "en-CA", - "en-GB", - "en-US", - "es", - "es-419", - "es-ES", - "es-US", - "et", - "fa", - "fi", - "fil", - "fr", - "fr-BE", - "fr-CA", - "fr-FR", - "fy", - "gl", - "gu", - "ha", - "he", - "hi", - "hr", - "hu", - "hy", - "id", - "is", - "it", - "it-IT", - "ja", - "jv", - "ka", - "kk", - "km", - "kn", - "ko", - "lt", - "lv", - "mk", - "ml", - "mn", - "mr", - "ms", - "my", - "nb", - "ne", - "nl", - "nl-BE", - "nl-NL", - "nn", - "no", - "pa", - "pl", - "pt", - "pt-BR", - "pt-PT", - "ro", - "ru", - "sk", - "sl", - "sq", - "sr", - "sv", - "sw", - "ta", - "te", - "th", - "tr", - "uk", - "ur", - "uz", - "vi", - "zh", - "zh-CN", - "zh-HK", - "zh-TW", - "zu", -] +CreateUserInviteOptionsLocaleLiteral: TypeAlias = Literal["af", "am", "ar", "bg", "bn", "bs", "ca", "cs", "da", "de", "de-DE", "el", "en", "en-AU", "en-CA", "en-GB", "en-US", "es", "es-419", "es-ES", "es-US", "et", "fa", "fi", "fil", "fr", "fr-BE", "fr-CA", "fr-FR", "fy", "gl", "gu", "ha", "he", "hi", "hr", "hu", "hy", "id", "is", "it", "it-IT", "ja", "jv", "ka", "kk", "km", "kn", "ko", "lt", "lv", "mk", "ml", "mn", "mr", "ms", "my", "nb", "ne", "nl", "nl-BE", "nl-NL", "nn", "no", "pa", "pl", "pt", "pt-BR", "pt-PT", "ro", "ru", "sk", "sl", "sq", "sr", "sv", "sw", "ta", "te", "th", "tr", "uk", "ur", "uz", "vi", "zh", "zh-CN", "zh-HK", "zh-TW", "zu"] 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 3d0643fc..92a5f783 100644 --- a/src/workos/common/models/create_user_password_hash_type.py +++ b/src/workos/common/models/create_user_password_hash_type.py @@ -28,7 +28,4 @@ def _missing_(cls, value: object) -> Optional["CreateUserPasswordHashType"]: unknown._value_ = value return unknown - -CreateUserPasswordHashTypeLiteral: TypeAlias = Literal[ - "bcrypt", "firebase-scrypt", "ssha", "scrypt", "pbkdf2", "argon2" -] +CreateUserPasswordHashTypeLiteral: TypeAlias = Literal["bcrypt", "firebase-scrypt", "ssha", "scrypt", "pbkdf2", "argon2"] diff --git a/src/workos/common/models/create_webhook_endpoint_events.py b/src/workos/common/models/create_webhook_endpoint_events.py index f9fab5e5..f0e77608 100644 --- a/src/workos/common/models/create_webhook_endpoint_events.py +++ b/src/workos/common/models/create_webhook_endpoint_events.py @@ -12,9 +12,7 @@ class CreateWebhookEndpointEvents(str, Enum): """Known values for CreateWebhookEndpointEvents.""" - AUTHENTICATION_EMAIL_VERIFICATION_SUCCEEDED = ( - "authentication.email_verification_succeeded" - ) + AUTHENTICATION_EMAIL_VERIFICATION_SUCCEEDED = "authentication.email_verification_succeeded" AUTHENTICATION_MAGIC_AUTH_FAILED = "authentication.magic_auth_failed" AUTHENTICATION_MAGIC_AUTH_SUCCEEDED = "authentication.magic_auth_succeeded" AUTHENTICATION_MFA_SUCCEEDED = "authentication.mfa_succeeded" @@ -33,9 +31,7 @@ class CreateWebhookEndpointEvents(str, Enum): API_KEY_REVOKED = "api_key.revoked" CONNECTION_ACTIVATED = "connection.activated" CONNECTION_DEACTIVATED = "connection.deactivated" - CONNECTION_SAML_CERTIFICATE_RENEWAL_REQUIRED = ( - "connection.saml_certificate_renewal_required" - ) + CONNECTION_SAML_CERTIFICATE_RENEWAL_REQUIRED = "connection.saml_certificate_renewal_required" CONNECTION_SAML_CERTIFICATE_RENEWED = "connection.saml_certificate_renewed" CONNECTION_DELETED = "connection.deleted" DSYNC_ACTIVATED = "dsync.activated" @@ -90,6 +86,9 @@ class CreateWebhookEndpointEvents(str, Enum): PERMISSION_UPDATED = "permission.updated" SESSION_CREATED = "session.created" SESSION_REVOKED = "session.revoked" + WAITLIST_USER_APPROVED = "waitlist_user.approved" + WAITLIST_USER_CREATED = "waitlist_user.created" + WAITLIST_USER_DENIED = "waitlist_user.denied" @classmethod def _missing_(cls, value: object) -> Optional["CreateWebhookEndpointEvents"]: @@ -100,80 +99,4 @@ def _missing_(cls, value: object) -> Optional["CreateWebhookEndpointEvents"]: unknown._value_ = value return unknown - -CreateWebhookEndpointEventsLiteral: TypeAlias = Literal[ - "authentication.email_verification_succeeded", - "authentication.magic_auth_failed", - "authentication.magic_auth_succeeded", - "authentication.mfa_succeeded", - "authentication.oauth_failed", - "authentication.oauth_succeeded", - "authentication.password_failed", - "authentication.password_succeeded", - "authentication.passkey_failed", - "authentication.passkey_succeeded", - "authentication.sso_failed", - "authentication.sso_started", - "authentication.sso_succeeded", - "authentication.sso_timed_out", - "authentication.radar_risk_detected", - "api_key.created", - "api_key.revoked", - "connection.activated", - "connection.deactivated", - "connection.saml_certificate_renewal_required", - "connection.saml_certificate_renewed", - "connection.deleted", - "dsync.activated", - "dsync.deleted", - "dsync.group.created", - "dsync.group.deleted", - "dsync.group.updated", - "dsync.group.user_added", - "dsync.group.user_removed", - "dsync.user.created", - "dsync.user.deleted", - "dsync.user.updated", - "email_verification.created", - "group.created", - "group.deleted", - "group.member_added", - "group.member_removed", - "group.updated", - "flag.created", - "flag.deleted", - "flag.updated", - "flag.rule_updated", - "invitation.accepted", - "invitation.created", - "invitation.resent", - "invitation.revoked", - "magic_auth.created", - "organization.created", - "organization.deleted", - "organization.updated", - "organization_domain.created", - "organization_domain.deleted", - "organization_domain.updated", - "organization_domain.verified", - "organization_domain.verification_failed", - "password_reset.created", - "password_reset.succeeded", - "user.created", - "user.updated", - "user.deleted", - "organization_membership.created", - "organization_membership.deleted", - "organization_membership.updated", - "role.created", - "role.deleted", - "role.updated", - "organization_role.created", - "organization_role.deleted", - "organization_role.updated", - "permission.created", - "permission.deleted", - "permission.updated", - "session.created", - "session.revoked", -] +CreateWebhookEndpointEventsLiteral: TypeAlias = Literal["authentication.email_verification_succeeded", "authentication.magic_auth_failed", "authentication.magic_auth_succeeded", "authentication.mfa_succeeded", "authentication.oauth_failed", "authentication.oauth_succeeded", "authentication.password_failed", "authentication.password_succeeded", "authentication.passkey_failed", "authentication.passkey_succeeded", "authentication.sso_failed", "authentication.sso_started", "authentication.sso_succeeded", "authentication.sso_timed_out", "authentication.radar_risk_detected", "api_key.created", "api_key.revoked", "connection.activated", "connection.deactivated", "connection.saml_certificate_renewal_required", "connection.saml_certificate_renewed", "connection.deleted", "dsync.activated", "dsync.deleted", "dsync.group.created", "dsync.group.deleted", "dsync.group.updated", "dsync.group.user_added", "dsync.group.user_removed", "dsync.user.created", "dsync.user.deleted", "dsync.user.updated", "email_verification.created", "group.created", "group.deleted", "group.member_added", "group.member_removed", "group.updated", "flag.created", "flag.deleted", "flag.updated", "flag.rule_updated", "invitation.accepted", "invitation.created", "invitation.resent", "invitation.revoked", "magic_auth.created", "organization.created", "organization.deleted", "organization.updated", "organization_domain.created", "organization_domain.deleted", "organization_domain.updated", "organization_domain.verified", "organization_domain.verification_failed", "password_reset.created", "password_reset.succeeded", "user.created", "user.updated", "user.deleted", "organization_membership.created", "organization_membership.deleted", "organization_membership.updated", "role.created", "role.deleted", "role.updated", "organization_role.created", "organization_role.deleted", "organization_role.updated", "permission.created", "permission.deleted", "permission.updated", "session.created", "session.revoked", "waitlist_user.approved", "waitlist_user.created", "waitlist_user.denied"] 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 99d9590a..1cd77aec 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 @@ -16,9 +16,7 @@ class DataIntegrationAccessTokenResponseError(str, Enum): NOT_INSTALLED = "not_installed" @classmethod - def _missing_( - cls, value: object - ) -> Optional["DataIntegrationAccessTokenResponseError"]: + def _missing_(cls, value: object) -> Optional["DataIntegrationAccessTokenResponseError"]: if not isinstance(value, str): return None unknown = str.__new__(cls, value) @@ -26,7 +24,4 @@ def _missing_( unknown._value_ = value return unknown - -DataIntegrationAccessTokenResponseErrorLiteral: TypeAlias = Literal[ - "needs_reauthorization", "not_installed" -] +DataIntegrationAccessTokenResponseErrorLiteral: TypeAlias = Literal["needs_reauthorization", "not_installed"] 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..37061594 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 @@ -16,9 +16,7 @@ class DataIntegrationsListResponseDataOwnership(str, Enum): ORGANIZATION = "organization" @classmethod - def _missing_( - cls, value: object - ) -> Optional["DataIntegrationsListResponseDataOwnership"]: + def _missing_(cls, value: object) -> Optional["DataIntegrationsListResponseDataOwnership"]: if not isinstance(value, str): return None unknown = str.__new__(cls, value) @@ -26,7 +24,4 @@ def _missing_( unknown._value_ = value return unknown - -DataIntegrationsListResponseDataOwnershipLiteral: TypeAlias = Literal[ - "userland_user", "organization" -] +DataIntegrationsListResponseDataOwnershipLiteral: TypeAlias = Literal["userland_user", "organization"] diff --git a/src/workos/common/models/directory_state.py b/src/workos/common/models/directory_state.py index 848c71fe..1cc7f7e3 100644 --- a/src/workos/common/models/directory_state.py +++ b/src/workos/common/models/directory_state.py @@ -27,7 +27,4 @@ def _missing_(cls, value: object) -> Optional["DirectoryState"]: unknown._value_ = value return unknown - -DirectoryStateLiteral: TypeAlias = Literal[ - "linked", "validating", "invalid_credentials", "unlinked", "deleting" -] +DirectoryStateLiteral: TypeAlias = Literal["linked", "validating", "invalid_credentials", "unlinked", "deleting"] diff --git a/src/workos/common/models/directory_type.py b/src/workos/common/models/directory_type.py index 83d42a09..f7000102 100644 --- a/src/workos/common/models/directory_type.py +++ b/src/workos/common/models/directory_type.py @@ -43,27 +43,4 @@ def _missing_(cls, value: object) -> Optional["DirectoryType"]: unknown._value_ = value return unknown - -DirectoryTypeLiteral: TypeAlias = Literal[ - "azure scim v2.0", - "bamboohr", - "breathe hr", - "cezanne hr", - "cyberark scim v2.0", - "fourth hr", - "generic scim v2.0", - "gsuite directory", - "hibob", - "sailpoint scim v2.0", - "jump cloud scim v2.0", - "okta scim v2.0", - "onelogin scim v2.0", - "people hr", - "personio", - "pingfederate scim v2.0", - "rippling scim v2.0", - "s3", - "sftp", - "sftp workday", - "workday", -] +DirectoryTypeLiteral: TypeAlias = Literal["azure scim v2.0", "bamboohr", "breathe hr", "cezanne hr", "cyberark scim v2.0", "fourth hr", "generic scim v2.0", "gsuite directory", "hibob", "sailpoint scim v2.0", "jump cloud scim v2.0", "okta scim v2.0", "onelogin scim v2.0", "people hr", "personio", "pingfederate scim v2.0", "rippling scim v2.0", "s3", "sftp", "sftp workday", "workday"] diff --git a/src/workos/common/models/directory_user.py b/src/workos/common/models/directory_user.py index 69319903..cf4eaaf8 100644 --- a/src/workos/common/models/directory_user.py +++ b/src/workos/common/models/directory_user.py @@ -80,24 +80,12 @@ def from_dict(cls, data: Dict[str, Any]) -> "DirectoryUser": updated_at=_parse_datetime(data["updated_at"]), first_name=data.get("first_name"), last_name=data.get("last_name"), - emails=[ - DirectoryUserEmail.from_dict(cast(Dict[str, Any], item)) - for item in cast(list[Any], _v_emails) - ] - if (_v_emails := data.get("emails")) is not None - else None, + emails=[DirectoryUserEmail.from_dict(cast(Dict[str, Any], item)) for item in cast(list[Any], _v_emails)] if (_v_emails := data.get("emails")) is not None else None, job_title=data.get("job_title"), username=data.get("username"), raw_attributes=data.get("raw_attributes"), - role=SlimRole.from_dict(cast(Dict[str, Any], _v_role)) - if (_v_role := data.get("role")) is not None - else None, - roles=[ - SlimRole.from_dict(cast(Dict[str, Any], item)) - for item in cast(list[Any], _v_roles) - ] - if (_v_roles := data.get("roles")) is not None - else None, + role=SlimRole.from_dict(cast(Dict[str, Any], _v_role)) if (_v_role := data.get("role")) is not None else None, + roles=[SlimRole.from_dict(cast(Dict[str, Any], item)) for item in cast(list[Any], _v_roles)] if (_v_roles := data.get("roles")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("DirectoryUser", e) @@ -114,9 +102,7 @@ def to_dict(self) -> Dict[str, Any]: result["email"] = self.email else: result["email"] = None - result["state"] = ( - self.state.value if isinstance(self.state, Enum) else self.state - ) + result["state"] = self.state.value if isinstance(self.state, Enum) else self.state result["custom_attributes"] = self.custom_attributes result["created_at"] = _format_datetime(self.created_at) result["updated_at"] = _format_datetime(self.updated_at) diff --git a/src/workos/common/models/directory_user_email.py b/src/workos/common/models/directory_user_email.py index 63308bbe..6bb1c8cb 100644 --- a/src/workos/common/models/directory_user_email.py +++ b/src/workos/common/models/directory_user_email.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Optional from workos._types import _raise_deserialize_error diff --git a/src/workos/common/models/directory_user_state.py b/src/workos/common/models/directory_user_state.py index 7e6f8f0e..b34053c7 100644 --- a/src/workos/common/models/directory_user_state.py +++ b/src/workos/common/models/directory_user_state.py @@ -25,5 +25,4 @@ def _missing_(cls, value: object) -> Optional["DirectoryUserState"]: unknown._value_ = value return unknown - DirectoryUserStateLiteral: TypeAlias = Literal["active", "suspended", "inactive"] diff --git a/src/workos/common/models/dsync_activated.py b/src/workos/common/models/dsync_activated.py index fdb34854..c879ea3b 100644 --- a/src/workos/common/models/dsync_activated.py +++ b/src/workos/common/models/dsync_activated.py @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "DsyncActivated": data=DsyncActivatedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("DsyncActivated", e) diff --git a/src/workos/common/models/dsync_activated_data.py b/src/workos/common/models/dsync_activated_data.py index 478e9ee6..1427f8e4 100644 --- a/src/workos/common/models/dsync_activated_data.py +++ b/src/workos/common/models/dsync_activated_data.py @@ -53,10 +53,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "DsyncActivatedData": created_at=_parse_datetime(data["created_at"]), updated_at=_parse_datetime(data["updated_at"]), external_key=data["external_key"], - domains=[ - DsyncActivatedDataDomain.from_dict(cast(Dict[str, Any], item)) - for item in cast(list[Any], data["domains"]) - ], + domains=[DsyncActivatedDataDomain.from_dict(cast(Dict[str, Any], item)) for item in cast(list[Any], data["domains"])], organization_id=data.get("organization_id"), ) except (KeyError, ValueError) as e: @@ -68,9 +65,7 @@ def to_dict(self) -> Dict[str, Any]: result["object"] = self.object result["id"] = self.id result["type"] = self.type.value if isinstance(self.type, Enum) else self.type - result["state"] = ( - self.state.value if isinstance(self.state, Enum) else self.state - ) + result["state"] = self.state.value if isinstance(self.state, Enum) else self.state result["name"] = self.name result["created_at"] = _format_datetime(self.created_at) result["updated_at"] = _format_datetime(self.updated_at) diff --git a/src/workos/common/models/dsync_activated_data_domain.py b/src/workos/common/models/dsync_activated_data_domain.py index eb397b07..21a4bf31 100644 --- a/src/workos/common/models/dsync_activated_data_domain.py +++ b/src/workos/common/models/dsync_activated_data_domain.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Literal from workos._types import _raise_deserialize_error diff --git a/src/workos/common/models/dsync_activated_data_state.py b/src/workos/common/models/dsync_activated_data_state.py index 3608f8f4..c3a592c0 100644 --- a/src/workos/common/models/dsync_activated_data_state.py +++ b/src/workos/common/models/dsync_activated_data_state.py @@ -27,7 +27,4 @@ def _missing_(cls, value: object) -> Optional["DsyncActivatedDataState"]: unknown._value_ = value return unknown - -DsyncActivatedDataStateLiteral: TypeAlias = Literal[ - "active", "validating", "invalid_credentials", "inactive", "deleting" -] +DsyncActivatedDataStateLiteral: TypeAlias = Literal["active", "validating", "invalid_credentials", "inactive", "deleting"] diff --git a/src/workos/common/models/dsync_activated_data_type.py b/src/workos/common/models/dsync_activated_data_type.py index 8e38c7f8..4b3c521e 100644 --- a/src/workos/common/models/dsync_activated_data_type.py +++ b/src/workos/common/models/dsync_activated_data_type.py @@ -45,29 +45,4 @@ def _missing_(cls, value: object) -> Optional["DsyncActivatedDataType"]: unknown._value_ = value return unknown - -DsyncActivatedDataTypeLiteral: TypeAlias = Literal[ - "azure scim v2.0", - "bamboohr", - "breathe hr", - "cezanne hr", - "cyberark scim v2.0", - "fourth hr", - "generic scim v2.0", - "gsuite directory", - "gusto", - "hibob", - "jump cloud scim v2.0", - "okta scim v2.0", - "onelogin scim v2.0", - "people hr", - "personio", - "pingfederate scim v2.0", - "rippling scim v2.0", - "rippling", - "sailpoint scim v2.0", - "s3", - "sftp", - "sftp workday", - "workday", -] +DsyncActivatedDataTypeLiteral: TypeAlias = Literal["azure scim v2.0", "bamboohr", "breathe hr", "cezanne hr", "cyberark scim v2.0", "fourth hr", "generic scim v2.0", "gsuite directory", "gusto", "hibob", "jump cloud scim v2.0", "okta scim v2.0", "onelogin scim v2.0", "people hr", "personio", "pingfederate scim v2.0", "rippling scim v2.0", "rippling", "sailpoint scim v2.0", "s3", "sftp", "sftp workday", "workday"] diff --git a/src/workos/common/models/dsync_deactivated.py b/src/workos/common/models/dsync_deactivated.py index 3c89c04a..9228bbaa 100644 --- a/src/workos/common/models/dsync_deactivated.py +++ b/src/workos/common/models/dsync_deactivated.py @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "DsyncDeactivated": data=DsyncDeactivatedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("DsyncDeactivated", e) diff --git a/src/workos/common/models/dsync_deleted.py b/src/workos/common/models/dsync_deleted.py index dd07708c..0f28c95c 100644 --- a/src/workos/common/models/dsync_deleted.py +++ b/src/workos/common/models/dsync_deleted.py @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "DsyncDeleted": data=DsyncDeletedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("DsyncDeleted", e) diff --git a/src/workos/common/models/dsync_deleted_data.py b/src/workos/common/models/dsync_deleted_data.py index 6d97aa1f..e1c07c3b 100644 --- a/src/workos/common/models/dsync_deleted_data.py +++ b/src/workos/common/models/dsync_deleted_data.py @@ -5,6 +5,7 @@ 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 @@ -56,9 +57,7 @@ def to_dict(self) -> Dict[str, Any]: result["object"] = self.object result["id"] = self.id result["type"] = self.type.value if isinstance(self.type, Enum) else self.type - result["state"] = ( - self.state.value if isinstance(self.state, Enum) else self.state - ) + result["state"] = self.state.value if isinstance(self.state, Enum) else self.state result["name"] = self.name result["created_at"] = _format_datetime(self.created_at) result["updated_at"] = _format_datetime(self.updated_at) diff --git a/src/workos/common/models/dsync_group_created.py b/src/workos/common/models/dsync_group_created.py index 7f8d5e49..7f6a23f0 100644 --- a/src/workos/common/models/dsync_group_created.py +++ b/src/workos/common/models/dsync_group_created.py @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "DsyncGroupCreated": data=DirectoryGroup.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("DsyncGroupCreated", e) diff --git a/src/workos/common/models/dsync_group_deleted.py b/src/workos/common/models/dsync_group_deleted.py index 4fe9de0e..175a00ed 100644 --- a/src/workos/common/models/dsync_group_deleted.py +++ b/src/workos/common/models/dsync_group_deleted.py @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "DsyncGroupDeleted": data=DirectoryGroup.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("DsyncGroupDeleted", e) diff --git a/src/workos/common/models/dsync_group_updated.py b/src/workos/common/models/dsync_group_updated.py index 5ab3f1b3..4786d27b 100644 --- a/src/workos/common/models/dsync_group_updated.py +++ b/src/workos/common/models/dsync_group_updated.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "DsyncGroupUpdated": return cls( id=data["id"], event=data["event"], - data=DsyncGroupUpdatedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=DsyncGroupUpdatedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("DsyncGroupUpdated", e) diff --git a/src/workos/common/models/dsync_group_updated_data.py b/src/workos/common/models/dsync_group_updated_data.py index a16a5877..a04fabf8 100644 --- a/src/workos/common/models/dsync_group_updated_data.py +++ b/src/workos/common/models/dsync_group_updated_data.py @@ -4,6 +4,7 @@ from dataclasses import dataclass from datetime import datetime +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 diff --git a/src/workos/common/models/dsync_group_user_added.py b/src/workos/common/models/dsync_group_user_added.py index f14df9cc..297a91e8 100644 --- a/src/workos/common/models/dsync_group_user_added.py +++ b/src/workos/common/models/dsync_group_user_added.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "DsyncGroupUserAdded": return cls( id=data["id"], event=data["event"], - data=DsyncGroupUserAddedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=DsyncGroupUserAddedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("DsyncGroupUserAdded", e) diff --git a/src/workos/common/models/dsync_group_user_removed.py b/src/workos/common/models/dsync_group_user_removed.py index d3c8b0de..6cbeb858 100644 --- a/src/workos/common/models/dsync_group_user_removed.py +++ b/src/workos/common/models/dsync_group_user_removed.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "DsyncGroupUserRemoved": return cls( id=data["id"], event=data["event"], - data=DsyncGroupUserRemovedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=DsyncGroupUserRemovedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("DsyncGroupUserRemoved", e) diff --git a/src/workos/common/models/dsync_user_created.py b/src/workos/common/models/dsync_user_created.py index 6b5d0c33..bbdbc281 100644 --- a/src/workos/common/models/dsync_user_created.py +++ b/src/workos/common/models/dsync_user_created.py @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "DsyncUserCreated": data=DirectoryUser.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("DsyncUserCreated", e) diff --git a/src/workos/common/models/dsync_user_deleted.py b/src/workos/common/models/dsync_user_deleted.py index 9cd96329..75b0d08c 100644 --- a/src/workos/common/models/dsync_user_deleted.py +++ b/src/workos/common/models/dsync_user_deleted.py @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "DsyncUserDeleted": data=DirectoryUser.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("DsyncUserDeleted", e) diff --git a/src/workos/common/models/dsync_user_updated.py b/src/workos/common/models/dsync_user_updated.py index 08a14f37..53a5ec61 100644 --- a/src/workos/common/models/dsync_user_updated.py +++ b/src/workos/common/models/dsync_user_updated.py @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "DsyncUserUpdated": data=DsyncUserUpdatedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("DsyncUserUpdated", e) diff --git a/src/workos/common/models/dsync_user_updated_data.py b/src/workos/common/models/dsync_user_updated_data.py index 102e4a90..1922c60a 100644 --- a/src/workos/common/models/dsync_user_updated_data.py +++ b/src/workos/common/models/dsync_user_updated_data.py @@ -81,24 +81,12 @@ def from_dict(cls, data: Dict[str, Any]) -> "DsyncUserUpdatedData": updated_at=_parse_datetime(data["updated_at"]), first_name=data.get("first_name"), last_name=data.get("last_name"), - emails=[ - DsyncUserUpdatedDataEmail.from_dict(cast(Dict[str, Any], item)) - for item in cast(list[Any], _v_emails) - ] - if (_v_emails := data.get("emails")) is not None - else None, + emails=[DsyncUserUpdatedDataEmail.from_dict(cast(Dict[str, Any], item)) for item in cast(list[Any], _v_emails)] if (_v_emails := data.get("emails")) is not None else None, job_title=data.get("job_title"), username=data.get("username"), raw_attributes=data.get("raw_attributes"), - role=SlimRole.from_dict(cast(Dict[str, Any], _v_role)) - if (_v_role := data.get("role")) is not None - else None, - roles=[ - SlimRole.from_dict(cast(Dict[str, Any], item)) - for item in cast(list[Any], _v_roles) - ] - if (_v_roles := data.get("roles")) is not None - else None, + role=SlimRole.from_dict(cast(Dict[str, Any], _v_role)) if (_v_role := data.get("role")) is not None else None, + roles=[SlimRole.from_dict(cast(Dict[str, Any], item)) for item in cast(list[Any], _v_roles)] if (_v_roles := data.get("roles")) is not None else None, previous_attributes=data.get("previous_attributes"), ) except (KeyError, ValueError) as e: @@ -116,9 +104,7 @@ def to_dict(self) -> Dict[str, Any]: result["email"] = self.email else: result["email"] = None - result["state"] = ( - self.state.value if isinstance(self.state, Enum) else self.state - ) + result["state"] = self.state.value if isinstance(self.state, Enum) else self.state result["custom_attributes"] = self.custom_attributes result["created_at"] = _format_datetime(self.created_at) result["updated_at"] = _format_datetime(self.updated_at) diff --git a/src/workos/common/models/email_verification_created.py b/src/workos/common/models/email_verification_created.py index e4249388..abad0c97 100644 --- a/src/workos/common/models/email_verification_created.py +++ b/src/workos/common/models/email_verification_created.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "EmailVerificationCreated": return cls( id=data["id"], event=data["event"], - data=EmailVerificationCreatedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=EmailVerificationCreatedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("EmailVerificationCreated", e) diff --git a/src/workos/common/models/email_verification_created_data.py b/src/workos/common/models/email_verification_created_data.py index 66b50148..e35630cc 100644 --- a/src/workos/common/models/email_verification_created_data.py +++ b/src/workos/common/models/email_verification_created_data.py @@ -4,6 +4,7 @@ from dataclasses import dataclass from datetime import datetime +from typing import cast from typing import Any, Dict, Literal from workos._types import _raise_deserialize_error from workos._types import _format_datetime, _parse_datetime diff --git a/src/workos/common/models/event_context.py b/src/workos/common/models/event_context.py index d2f785be..6972e8d9 100644 --- a/src/workos/common/models/event_context.py +++ b/src/workos/common/models/event_context.py @@ -17,9 +17,7 @@ class EventContext: google_analytics_client_id: Optional[str] = None """The Google Analytics client ID.""" - google_analytics_sessions: Optional[List["EventContextGoogleAnalyticsSession"]] = ( - None - ) + google_analytics_sessions: Optional[List["EventContextGoogleAnalyticsSession"]] = None """The Google Analytics sessions associated with the event.""" ajs_anonymous_id: Optional[str] = None """The anonymous ID from analytics.""" @@ -35,24 +33,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "EventContext": try: return cls( google_analytics_client_id=data.get("google_analytics_client_id"), - google_analytics_sessions=[ - EventContextGoogleAnalyticsSession.from_dict( - cast(Dict[str, Any], item) - ) - for item in cast(list[Any], _v_google_analytics_sessions) - ] - if ( - _v_google_analytics_sessions := data.get( - "google_analytics_sessions" - ) - ) - is not None - else None, + google_analytics_sessions=[EventContextGoogleAnalyticsSession.from_dict(cast(Dict[str, Any], item)) for item in cast(list[Any], _v_google_analytics_sessions)] if (_v_google_analytics_sessions := data.get("google_analytics_sessions")) is not None else None, ajs_anonymous_id=data.get("ajs_anonymous_id"), client_id=data.get("client_id"), - actor=EventContextActor.from_dict(cast(Dict[str, Any], _v_actor)) - if (_v_actor := data.get("actor")) is not None - else None, + actor=EventContextActor.from_dict(cast(Dict[str, Any], _v_actor)) if (_v_actor := data.get("actor")) is not None else None, previous_attributes=data.get("previous_attributes"), ) except (KeyError, ValueError) as e: @@ -64,9 +48,7 @@ def to_dict(self) -> Dict[str, Any]: if self.google_analytics_client_id is not None: result["google_analytics_client_id"] = self.google_analytics_client_id if self.google_analytics_sessions is not None: - result["google_analytics_sessions"] = [ - item.to_dict() for item in self.google_analytics_sessions - ] + result["google_analytics_sessions"] = [item.to_dict() for item in self.google_analytics_sessions] if self.ajs_anonymous_id is not None: result["ajs_anonymous_id"] = self.ajs_anonymous_id if self.client_id is not None: diff --git a/src/workos/common/models/event_context_actor.py b/src/workos/common/models/event_context_actor.py index e9a4945e..78c5e897 100644 --- a/src/workos/common/models/event_context_actor.py +++ b/src/workos/common/models/event_context_actor.py @@ -4,6 +4,7 @@ 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 .event_context_actor_source import EventContextActorSource @@ -36,9 +37,7 @@ def to_dict(self) -> Dict[str, Any]: """Serialize to a dictionary.""" result: Dict[str, Any] = {} result["id"] = self.id - result["source"] = ( - self.source.value if isinstance(self.source, Enum) else self.source - ) + result["source"] = self.source.value if isinstance(self.source, Enum) else self.source if self.name is not None: result["name"] = self.name else: diff --git a/src/workos/common/models/event_context_actor_source.py b/src/workos/common/models/event_context_actor_source.py index f270625e..97f6a4fe 100644 --- a/src/workos/common/models/event_context_actor_source.py +++ b/src/workos/common/models/event_context_actor_source.py @@ -25,5 +25,4 @@ def _missing_(cls, value: object) -> Optional["EventContextActorSource"]: unknown._value_ = value return unknown - EventContextActorSourceLiteral: TypeAlias = Literal["api", "dashboard", "system"] diff --git a/src/workos/common/models/event_context_google_analytics_session.py b/src/workos/common/models/event_context_google_analytics_session.py index ab04069b..d2b98523 100644 --- a/src/workos/common/models/event_context_google_analytics_session.py +++ b/src/workos/common/models/event_context_google_analytics_session.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Optional from workos._types import _raise_deserialize_error diff --git a/src/workos/common/models/flag_created.py b/src/workos/common/models/flag_created.py index 6e9a96c6..9c2abda1 100644 --- a/src/workos/common/models/flag_created.py +++ b/src/workos/common/models/flag_created.py @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "FlagCreated": event=data["event"], data=FlagCreatedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), - context=FlagCreatedContext.from_dict( - cast(Dict[str, Any], data["context"]) - ), + context=FlagCreatedContext.from_dict(cast(Dict[str, Any], data["context"])), object=data["object"], ) except (KeyError, ValueError) as e: diff --git a/src/workos/common/models/flag_created_context.py b/src/workos/common/models/flag_created_context.py index 55c1af15..5c4b8d16 100644 --- a/src/workos/common/models/flag_created_context.py +++ b/src/workos/common/models/flag_created_context.py @@ -25,9 +25,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "FlagCreatedContext": try: return cls( client_id=data["client_id"], - actor=FlagCreatedContextActor.from_dict( - cast(Dict[str, Any], data["actor"]) - ), + actor=FlagCreatedContextActor.from_dict(cast(Dict[str, Any], data["actor"])), ) except (KeyError, ValueError) as e: _raise_deserialize_error("FlagCreatedContext", e) diff --git a/src/workos/common/models/flag_created_data.py b/src/workos/common/models/flag_created_data.py index 6513814b..96f5816d 100644 --- a/src/workos/common/models/flag_created_data.py +++ b/src/workos/common/models/flag_created_data.py @@ -51,9 +51,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "FlagCreatedData": slug=data["slug"], name=data["name"], description=data["description"], - owner=FlagCreatedDataOwner.from_dict(cast(Dict[str, Any], _v_owner)) - if (_v_owner := data["owner"]) is not None - else None, + owner=FlagCreatedDataOwner.from_dict(cast(Dict[str, Any], _v_owner)) if (_v_owner := data["owner"]) is not None else None, tags=data["tags"], enabled=data["enabled"], default_value=data["default_value"], diff --git a/src/workos/common/models/flag_deleted.py b/src/workos/common/models/flag_deleted.py index 87283716..7a37e4b1 100644 --- a/src/workos/common/models/flag_deleted.py +++ b/src/workos/common/models/flag_deleted.py @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "FlagDeleted": event=data["event"], data=FlagDeletedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), - context=FlagDeletedContext.from_dict( - cast(Dict[str, Any], data["context"]) - ), + context=FlagDeletedContext.from_dict(cast(Dict[str, Any], data["context"])), object=data["object"], ) except (KeyError, ValueError) as e: diff --git a/src/workos/common/models/flag_rule_updated.py b/src/workos/common/models/flag_rule_updated.py index ebd997de..af28a793 100644 --- a/src/workos/common/models/flag_rule_updated.py +++ b/src/workos/common/models/flag_rule_updated.py @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "FlagRuleUpdated": event=data["event"], data=FlagRuleUpdatedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), - context=FlagRuleUpdatedContext.from_dict( - cast(Dict[str, Any], data["context"]) - ), + context=FlagRuleUpdatedContext.from_dict(cast(Dict[str, Any], data["context"])), object=data["object"], ) except (KeyError, ValueError) as e: diff --git a/src/workos/common/models/flag_rule_updated_context.py b/src/workos/common/models/flag_rule_updated_context.py index ae068f45..70d77cfd 100644 --- a/src/workos/common/models/flag_rule_updated_context.py +++ b/src/workos/common/models/flag_rule_updated_context.py @@ -9,12 +9,8 @@ from workos._types import _raise_deserialize_error from .flag_rule_updated_context_actor import FlagRuleUpdatedContextActor -from .flag_rule_updated_context_configured_target import ( - FlagRuleUpdatedContextConfiguredTarget, -) -from .flag_rule_updated_context_previous_attribute import ( - FlagRuleUpdatedContextPreviousAttribute, -) +from .flag_rule_updated_context_configured_target import FlagRuleUpdatedContextConfiguredTarget +from .flag_rule_updated_context_previous_attribute import FlagRuleUpdatedContextPreviousAttribute from .flag_rule_updated_context_access_type import FlagRuleUpdatedContextAccessType @@ -39,16 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "FlagRuleUpdatedContext": try: return cls( client_id=data["client_id"], - actor=FlagRuleUpdatedContextActor.from_dict( - cast(Dict[str, Any], data["actor"]) - ), + actor=FlagRuleUpdatedContextActor.from_dict(cast(Dict[str, Any], data["actor"])), access_type=FlagRuleUpdatedContextAccessType(data["access_type"]), - configured_targets=FlagRuleUpdatedContextConfiguredTarget.from_dict( - cast(Dict[str, Any], data["configured_targets"]) - ), - previous_attributes=FlagRuleUpdatedContextPreviousAttribute.from_dict( - cast(Dict[str, Any], data["previous_attributes"]) - ), + configured_targets=FlagRuleUpdatedContextConfiguredTarget.from_dict(cast(Dict[str, Any], data["configured_targets"])), + previous_attributes=FlagRuleUpdatedContextPreviousAttribute.from_dict(cast(Dict[str, Any], data["previous_attributes"])), ) except (KeyError, ValueError) as e: _raise_deserialize_error("FlagRuleUpdatedContext", e) @@ -58,11 +48,7 @@ def to_dict(self) -> Dict[str, Any]: result: Dict[str, Any] = {} result["client_id"] = self.client_id result["actor"] = self.actor.to_dict() - result["access_type"] = ( - self.access_type.value - if isinstance(self.access_type, Enum) - else self.access_type - ) + result["access_type"] = self.access_type.value if isinstance(self.access_type, Enum) else self.access_type result["configured_targets"] = self.configured_targets.to_dict() result["previous_attributes"] = self.previous_attributes.to_dict() return result diff --git a/src/workos/common/models/flag_rule_updated_context_access_type.py b/src/workos/common/models/flag_rule_updated_context_access_type.py index 3a7ed2a0..d0e78cad 100644 --- a/src/workos/common/models/flag_rule_updated_context_access_type.py +++ b/src/workos/common/models/flag_rule_updated_context_access_type.py @@ -25,5 +25,4 @@ def _missing_(cls, value: object) -> Optional["FlagRuleUpdatedContextAccessType" unknown._value_ = value return unknown - FlagRuleUpdatedContextAccessTypeLiteral: TypeAlias = Literal["none", "some", "all"] diff --git a/src/workos/common/models/flag_rule_updated_context_configured_target.py b/src/workos/common/models/flag_rule_updated_context_configured_target.py index df29f009..9eb16303 100644 --- a/src/workos/common/models/flag_rule_updated_context_configured_target.py +++ b/src/workos/common/models/flag_rule_updated_context_configured_target.py @@ -7,12 +7,8 @@ from typing import Any, Dict, List from workos._types import _raise_deserialize_error -from .flag_rule_updated_context_configured_target_organization import ( - FlagRuleUpdatedContextConfiguredTargetOrganization, -) -from .flag_rule_updated_context_configured_target_user import ( - FlagRuleUpdatedContextConfiguredTargetUser, -) +from .flag_rule_updated_context_configured_target_organization import FlagRuleUpdatedContextConfiguredTargetOrganization +from .flag_rule_updated_context_configured_target_user import FlagRuleUpdatedContextConfiguredTargetUser @dataclass(slots=True) @@ -25,24 +21,12 @@ class FlagRuleUpdatedContextConfiguredTarget: """The users targeted by the flag rule.""" @classmethod - def from_dict( - cls, data: Dict[str, Any] - ) -> "FlagRuleUpdatedContextConfiguredTarget": + def from_dict(cls, data: Dict[str, Any]) -> "FlagRuleUpdatedContextConfiguredTarget": """Deserialize from a dictionary.""" try: return cls( - organizations=[ - FlagRuleUpdatedContextConfiguredTargetOrganization.from_dict( - cast(Dict[str, Any], item) - ) - for item in cast(list[Any], data["organizations"]) - ], - users=[ - FlagRuleUpdatedContextConfiguredTargetUser.from_dict( - cast(Dict[str, Any], item) - ) - for item in cast(list[Any], data["users"]) - ], + organizations=[FlagRuleUpdatedContextConfiguredTargetOrganization.from_dict(cast(Dict[str, Any], item)) for item in cast(list[Any], data["organizations"])], + users=[FlagRuleUpdatedContextConfiguredTargetUser.from_dict(cast(Dict[str, Any], item)) for item in cast(list[Any], data["users"])], ) except (KeyError, ValueError) as e: _raise_deserialize_error("FlagRuleUpdatedContextConfiguredTarget", e) diff --git a/src/workos/common/models/flag_rule_updated_context_configured_target_organization.py b/src/workos/common/models/flag_rule_updated_context_configured_target_organization.py index 00bfe656..b7b660a0 100644 --- a/src/workos/common/models/flag_rule_updated_context_configured_target_organization.py +++ b/src/workos/common/models/flag_rule_updated_context_configured_target_organization.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error @@ -17,9 +18,7 @@ class FlagRuleUpdatedContextConfiguredTargetOrganization: """The name of the organization.""" @classmethod - def from_dict( - cls, data: Dict[str, Any] - ) -> "FlagRuleUpdatedContextConfiguredTargetOrganization": + def from_dict(cls, data: Dict[str, Any]) -> "FlagRuleUpdatedContextConfiguredTargetOrganization": """Deserialize from a dictionary.""" try: return cls( @@ -27,9 +26,7 @@ def from_dict( name=data["name"], ) except (KeyError, ValueError) as e: - _raise_deserialize_error( - "FlagRuleUpdatedContextConfiguredTargetOrganization", e - ) + _raise_deserialize_error("FlagRuleUpdatedContextConfiguredTargetOrganization", e) def to_dict(self) -> Dict[str, Any]: """Serialize to a dictionary.""" diff --git a/src/workos/common/models/flag_rule_updated_context_configured_target_user.py b/src/workos/common/models/flag_rule_updated_context_configured_target_user.py index 7019377a..a9abb205 100644 --- a/src/workos/common/models/flag_rule_updated_context_configured_target_user.py +++ b/src/workos/common/models/flag_rule_updated_context_configured_target_user.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error @@ -17,9 +18,7 @@ class FlagRuleUpdatedContextConfiguredTargetUser: """The email of the user.""" @classmethod - def from_dict( - cls, data: Dict[str, Any] - ) -> "FlagRuleUpdatedContextConfiguredTargetUser": + def from_dict(cls, data: Dict[str, Any]) -> "FlagRuleUpdatedContextConfiguredTargetUser": """Deserialize from a dictionary.""" try: return cls( diff --git a/src/workos/common/models/flag_rule_updated_context_previous_attribute.py b/src/workos/common/models/flag_rule_updated_context_previous_attribute.py index 08713dec..9e15c8bf 100644 --- a/src/workos/common/models/flag_rule_updated_context_previous_attribute.py +++ b/src/workos/common/models/flag_rule_updated_context_previous_attribute.py @@ -7,12 +7,8 @@ from typing import Any, Dict, Optional from workos._types import _raise_deserialize_error -from .flag_rule_updated_context_previous_attribute_context import ( - FlagRuleUpdatedContextPreviousAttributeContext, -) -from .flag_rule_updated_context_previous_attribute_data import ( - FlagRuleUpdatedContextPreviousAttributeData, -) +from .flag_rule_updated_context_previous_attribute_context import FlagRuleUpdatedContextPreviousAttributeContext +from .flag_rule_updated_context_previous_attribute_data import FlagRuleUpdatedContextPreviousAttributeData @dataclass(slots=True) @@ -25,22 +21,12 @@ class FlagRuleUpdatedContextPreviousAttribute: """The previous context attributes of the flag rule.""" @classmethod - def from_dict( - cls, data: Dict[str, Any] - ) -> "FlagRuleUpdatedContextPreviousAttribute": + def from_dict(cls, data: Dict[str, Any]) -> "FlagRuleUpdatedContextPreviousAttribute": """Deserialize from a dictionary.""" try: return cls( - data=FlagRuleUpdatedContextPreviousAttributeData.from_dict( - cast(Dict[str, Any], _v_data) - ) - if (_v_data := data.get("data")) is not None - else None, - context=FlagRuleUpdatedContextPreviousAttributeContext.from_dict( - cast(Dict[str, Any], _v_context) - ) - if (_v_context := data.get("context")) is not None - else None, + data=FlagRuleUpdatedContextPreviousAttributeData.from_dict(cast(Dict[str, Any], _v_data)) if (_v_data := data.get("data")) is not None else None, + context=FlagRuleUpdatedContextPreviousAttributeContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("FlagRuleUpdatedContextPreviousAttribute", e) diff --git a/src/workos/common/models/flag_rule_updated_context_previous_attribute_context.py b/src/workos/common/models/flag_rule_updated_context_previous_attribute_context.py index bc1edef1..9ed92c8a 100644 --- a/src/workos/common/models/flag_rule_updated_context_previous_attribute_context.py +++ b/src/workos/common/models/flag_rule_updated_context_previous_attribute_context.py @@ -8,59 +8,35 @@ from typing import Any, Dict, Optional from workos._types import _raise_deserialize_error -from .flag_rule_updated_context_previous_attribute_context_configured_target import ( - FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget, -) -from .flag_rule_updated_context_previous_attribute_context_access_type import ( - FlagRuleUpdatedContextPreviousAttributeContextAccessType, -) +from .flag_rule_updated_context_previous_attribute_context_configured_target import FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget +from .flag_rule_updated_context_previous_attribute_context_access_type import FlagRuleUpdatedContextPreviousAttributeContextAccessType @dataclass(slots=True) class FlagRuleUpdatedContextPreviousAttributeContext: """The previous context attributes of the flag rule.""" - access_type: Optional[ - "FlagRuleUpdatedContextPreviousAttributeContextAccessType" - ] = None + access_type: Optional["FlagRuleUpdatedContextPreviousAttributeContextAccessType"] = None """The previous access type of the flag rule.""" - configured_targets: Optional[ - "FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget" - ] = None + configured_targets: Optional["FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget"] = None """The previous configured targets for the flag rule.""" @classmethod - def from_dict( - cls, data: Dict[str, Any] - ) -> "FlagRuleUpdatedContextPreviousAttributeContext": + def from_dict(cls, data: Dict[str, Any]) -> "FlagRuleUpdatedContextPreviousAttributeContext": """Deserialize from a dictionary.""" try: return cls( - access_type=FlagRuleUpdatedContextPreviousAttributeContextAccessType( - _v_access_type - ) - if (_v_access_type := data.get("access_type")) is not None - else None, - configured_targets=FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget.from_dict( - cast(Dict[str, Any], _v_configured_targets) - ) - if (_v_configured_targets := data.get("configured_targets")) is not None - else None, + access_type=FlagRuleUpdatedContextPreviousAttributeContextAccessType(_v_access_type) if (_v_access_type := data.get("access_type")) is not None else None, + configured_targets=FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget.from_dict(cast(Dict[str, Any], _v_configured_targets)) if (_v_configured_targets := data.get("configured_targets")) is not None else None, ) except (KeyError, ValueError) as e: - _raise_deserialize_error( - "FlagRuleUpdatedContextPreviousAttributeContext", e - ) + _raise_deserialize_error("FlagRuleUpdatedContextPreviousAttributeContext", e) def to_dict(self) -> Dict[str, Any]: """Serialize to a dictionary.""" result: Dict[str, Any] = {} if self.access_type is not None: - result["access_type"] = ( - self.access_type.value - if isinstance(self.access_type, Enum) - else self.access_type - ) + result["access_type"] = self.access_type.value if isinstance(self.access_type, Enum) else self.access_type if self.configured_targets is not None: result["configured_targets"] = self.configured_targets.to_dict() return result diff --git a/src/workos/common/models/flag_rule_updated_context_previous_attribute_context_access_type.py b/src/workos/common/models/flag_rule_updated_context_previous_attribute_context_access_type.py index 0ec0f9ba..62e27172 100644 --- a/src/workos/common/models/flag_rule_updated_context_previous_attribute_context_access_type.py +++ b/src/workos/common/models/flag_rule_updated_context_previous_attribute_context_access_type.py @@ -3,7 +3,5 @@ from typing import TypeAlias from .flag_rule_updated_context_access_type import FlagRuleUpdatedContextAccessType -FlagRuleUpdatedContextPreviousAttributeContextAccessType: TypeAlias = ( - FlagRuleUpdatedContextAccessType -) +FlagRuleUpdatedContextPreviousAttributeContextAccessType: TypeAlias = FlagRuleUpdatedContextAccessType __all__ = ["FlagRuleUpdatedContextPreviousAttributeContextAccessType"] diff --git a/src/workos/common/models/flag_rule_updated_context_previous_attribute_context_configured_target.py b/src/workos/common/models/flag_rule_updated_context_previous_attribute_context_configured_target.py index 28f3c66b..0ae0ec86 100644 --- a/src/workos/common/models/flag_rule_updated_context_previous_attribute_context_configured_target.py +++ b/src/workos/common/models/flag_rule_updated_context_previous_attribute_context_configured_target.py @@ -1,10 +1,6 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias -from .flag_rule_updated_context_configured_target import ( - FlagRuleUpdatedContextConfiguredTarget, -) +from .flag_rule_updated_context_configured_target import FlagRuleUpdatedContextConfiguredTarget -FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget: TypeAlias = ( - FlagRuleUpdatedContextConfiguredTarget -) +FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget: TypeAlias = FlagRuleUpdatedContextConfiguredTarget diff --git a/src/workos/common/models/flag_rule_updated_context_previous_attribute_context_configured_target_organization.py b/src/workos/common/models/flag_rule_updated_context_previous_attribute_context_configured_target_organization.py index 8161553b..896edca7 100644 --- a/src/workos/common/models/flag_rule_updated_context_previous_attribute_context_configured_target_organization.py +++ b/src/workos/common/models/flag_rule_updated_context_previous_attribute_context_configured_target_organization.py @@ -1,8 +1,6 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias -from .flag_rule_updated_context_configured_target_organization import ( - FlagRuleUpdatedContextConfiguredTargetOrganization, -) +from .flag_rule_updated_context_configured_target_organization import FlagRuleUpdatedContextConfiguredTargetOrganization FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetOrganization: TypeAlias = FlagRuleUpdatedContextConfiguredTargetOrganization diff --git a/src/workos/common/models/flag_rule_updated_context_previous_attribute_context_configured_target_user.py b/src/workos/common/models/flag_rule_updated_context_previous_attribute_context_configured_target_user.py index 2bd46f17..2d3357a0 100644 --- a/src/workos/common/models/flag_rule_updated_context_previous_attribute_context_configured_target_user.py +++ b/src/workos/common/models/flag_rule_updated_context_previous_attribute_context_configured_target_user.py @@ -1,10 +1,6 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias -from .flag_rule_updated_context_configured_target_user import ( - FlagRuleUpdatedContextConfiguredTargetUser, -) +from .flag_rule_updated_context_configured_target_user import FlagRuleUpdatedContextConfiguredTargetUser -FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetUser: TypeAlias = ( - FlagRuleUpdatedContextConfiguredTargetUser -) +FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetUser: TypeAlias = FlagRuleUpdatedContextConfiguredTargetUser diff --git a/src/workos/common/models/flag_rule_updated_context_previous_attribute_data.py b/src/workos/common/models/flag_rule_updated_context_previous_attribute_data.py index 1c4692f1..ee985115 100644 --- a/src/workos/common/models/flag_rule_updated_context_previous_attribute_data.py +++ b/src/workos/common/models/flag_rule_updated_context_previous_attribute_data.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Optional from workos._types import _raise_deserialize_error @@ -17,9 +18,7 @@ class FlagRuleUpdatedContextPreviousAttributeData: """The previous default value of the flag.""" @classmethod - def from_dict( - cls, data: Dict[str, Any] - ) -> "FlagRuleUpdatedContextPreviousAttributeData": + def from_dict(cls, data: Dict[str, Any]) -> "FlagRuleUpdatedContextPreviousAttributeData": """Deserialize from a dictionary.""" try: return cls( diff --git a/src/workos/common/models/flag_updated.py b/src/workos/common/models/flag_updated.py index cdc61b29..db45fa2c 100644 --- a/src/workos/common/models/flag_updated.py +++ b/src/workos/common/models/flag_updated.py @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "FlagUpdated": event=data["event"], data=FlagUpdatedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), - context=FlagUpdatedContext.from_dict( - cast(Dict[str, Any], data["context"]) - ), + context=FlagUpdatedContext.from_dict(cast(Dict[str, Any], data["context"])), object=data["object"], ) except (KeyError, ValueError) as e: diff --git a/src/workos/common/models/flag_updated_context.py b/src/workos/common/models/flag_updated_context.py index a14a4f91..b2ed7b00 100644 --- a/src/workos/common/models/flag_updated_context.py +++ b/src/workos/common/models/flag_updated_context.py @@ -28,15 +28,8 @@ def from_dict(cls, data: Dict[str, Any]) -> "FlagUpdatedContext": try: return cls( client_id=data["client_id"], - actor=FlagUpdatedContextActor.from_dict( - cast(Dict[str, Any], data["actor"]) - ), - previous_attributes=FlagUpdatedContextPreviousAttribute.from_dict( - cast(Dict[str, Any], _v_previous_attributes) - ) - if (_v_previous_attributes := data.get("previous_attributes")) - is not None - else None, + actor=FlagUpdatedContextActor.from_dict(cast(Dict[str, Any], data["actor"])), + previous_attributes=FlagUpdatedContextPreviousAttribute.from_dict(cast(Dict[str, Any], _v_previous_attributes)) if (_v_previous_attributes := data.get("previous_attributes")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("FlagUpdatedContext", e) diff --git a/src/workos/common/models/flag_updated_context_previous_attribute.py b/src/workos/common/models/flag_updated_context_previous_attribute.py index 9a0ed3c3..305f328a 100644 --- a/src/workos/common/models/flag_updated_context_previous_attribute.py +++ b/src/workos/common/models/flag_updated_context_previous_attribute.py @@ -7,9 +7,7 @@ from typing import Any, Dict, Optional from workos._types import _raise_deserialize_error -from .flag_updated_context_previous_attribute_data import ( - FlagUpdatedContextPreviousAttributeData, -) +from .flag_updated_context_previous_attribute_data import FlagUpdatedContextPreviousAttributeData @dataclass(slots=True) @@ -24,11 +22,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "FlagUpdatedContextPreviousAttribute """Deserialize from a dictionary.""" try: return cls( - data=FlagUpdatedContextPreviousAttributeData.from_dict( - cast(Dict[str, Any], _v_data) - ) - if (_v_data := data.get("data")) is not None - else None, + data=FlagUpdatedContextPreviousAttributeData.from_dict(cast(Dict[str, Any], _v_data)) if (_v_data := data.get("data")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("FlagUpdatedContextPreviousAttribute", e) diff --git a/src/workos/common/models/flag_updated_context_previous_attribute_data.py b/src/workos/common/models/flag_updated_context_previous_attribute_data.py index 6e22b19d..0c039f1b 100644 --- a/src/workos/common/models/flag_updated_context_previous_attribute_data.py +++ b/src/workos/common/models/flag_updated_context_previous_attribute_data.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, List, Optional from workos._types import _raise_deserialize_error @@ -23,9 +24,7 @@ class FlagUpdatedContextPreviousAttributeData: """The previous default value of the flag.""" @classmethod - def from_dict( - cls, data: Dict[str, Any] - ) -> "FlagUpdatedContextPreviousAttributeData": + def from_dict(cls, data: Dict[str, Any]) -> "FlagUpdatedContextPreviousAttributeData": """Deserialize from a dictionary.""" try: return cls( diff --git a/src/workos/common/models/generate_link_intent.py b/src/workos/common/models/generate_link_intent.py index fac8bea4..d913c5c8 100644 --- a/src/workos/common/models/generate_link_intent.py +++ b/src/workos/common/models/generate_link_intent.py @@ -29,13 +29,4 @@ def _missing_(cls, value: object) -> Optional["GenerateLinkIntent"]: unknown._value_ = value return unknown - -GenerateLinkIntentLiteral: TypeAlias = Literal[ - "sso", - "dsync", - "audit_logs", - "log_streams", - "domain_verification", - "certificate_renewal", - "bring_your_own_key", -] +GenerateLinkIntentLiteral: TypeAlias = Literal["sso", "dsync", "audit_logs", "log_streams", "domain_verification", "certificate_renewal", "bring_your_own_key"] diff --git a/src/workos/common/models/group_created.py b/src/workos/common/models/group_created.py index e3ccb528..3f0a44fd 100644 --- a/src/workos/common/models/group_created.py +++ b/src/workos/common/models/group_created.py @@ -10,7 +10,7 @@ from workos._types import _format_datetime, _parse_datetime from .event_context import EventContext -from .group import Group +from workos.groups.models.group import Group @dataclass(slots=True) @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "GroupCreated": data=Group.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("GroupCreated", e) diff --git a/src/workos/common/models/group_deleted.py b/src/workos/common/models/group_deleted.py index 5c588ccd..677f149f 100644 --- a/src/workos/common/models/group_deleted.py +++ b/src/workos/common/models/group_deleted.py @@ -10,7 +10,7 @@ from workos._types import _format_datetime, _parse_datetime from .event_context import EventContext -from .group import Group +from workos.groups.models.group import Group @dataclass(slots=True) @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "GroupDeleted": data=Group.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("GroupDeleted", e) diff --git a/src/workos/common/models/group_member_added.py b/src/workos/common/models/group_member_added.py index 5fde2c7c..e6910711 100644 --- a/src/workos/common/models/group_member_added.py +++ b/src/workos/common/models/group_member_added.py @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "GroupMemberAdded": data=GroupMemberAddedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("GroupMemberAdded", e) diff --git a/src/workos/common/models/group_member_added_data.py b/src/workos/common/models/group_member_added_data.py index 9027b704..e6a777fe 100644 --- a/src/workos/common/models/group_member_added_data.py +++ b/src/workos/common/models/group_member_added_data.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error diff --git a/src/workos/common/models/group_member_removed.py b/src/workos/common/models/group_member_removed.py index 149d9386..d8298c5f 100644 --- a/src/workos/common/models/group_member_removed.py +++ b/src/workos/common/models/group_member_removed.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "GroupMemberRemoved": return cls( id=data["id"], event=data["event"], - data=GroupMemberRemovedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=GroupMemberRemovedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("GroupMemberRemoved", e) diff --git a/src/workos/common/models/group_updated.py b/src/workos/common/models/group_updated.py index 62f4afe4..9f21f2e5 100644 --- a/src/workos/common/models/group_updated.py +++ b/src/workos/common/models/group_updated.py @@ -10,7 +10,7 @@ from workos._types import _format_datetime, _parse_datetime from .event_context import EventContext -from .group import Group +from workos.groups.models.group import Group @dataclass(slots=True) @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "GroupUpdated": data=Group.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("GroupUpdated", e) diff --git a/src/workos/common/models/invitation_accepted.py b/src/workos/common/models/invitation_accepted.py index da930a9f..16d2ac24 100644 --- a/src/workos/common/models/invitation_accepted.py +++ b/src/workos/common/models/invitation_accepted.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "InvitationAccepted": return cls( id=data["id"], event=data["event"], - data=InvitationAcceptedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=InvitationAcceptedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("InvitationAccepted", e) diff --git a/src/workos/common/models/invitation_accepted_data.py b/src/workos/common/models/invitation_accepted_data.py index 8c1faa21..ff22b599 100644 --- a/src/workos/common/models/invitation_accepted_data.py +++ b/src/workos/common/models/invitation_accepted_data.py @@ -5,6 +5,7 @@ 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 @@ -35,6 +36,8 @@ class InvitationAcceptedData: """The ID of the user who invited the recipient, if provided.""" accepted_user_id: Optional[str] """The ID of the user who accepted the invitation, once accepted.""" + role_slug: Optional[str] + """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.""" updated_at: datetime @@ -49,16 +52,13 @@ def from_dict(cls, data: Dict[str, Any]) -> "InvitationAcceptedData": id=data["id"], email=data["email"], state=InvitationAcceptedDataState(data["state"]), - accepted_at=_parse_datetime(_v_accepted_at) - if (_v_accepted_at := data["accepted_at"]) is not None - else None, - revoked_at=_parse_datetime(_v_revoked_at) - if (_v_revoked_at := data["revoked_at"]) is not None - else None, + accepted_at=_parse_datetime(_v_accepted_at) if (_v_accepted_at := data["accepted_at"]) is not None else None, + revoked_at=_parse_datetime(_v_revoked_at) if (_v_revoked_at := data["revoked_at"]) is not None else None, expires_at=_parse_datetime(data["expires_at"]), organization_id=data["organization_id"], inviter_user_id=data["inviter_user_id"], accepted_user_id=data["accepted_user_id"], + role_slug=data["role_slug"], created_at=_parse_datetime(data["created_at"]), updated_at=_parse_datetime(data["updated_at"]), ) @@ -71,9 +71,7 @@ def to_dict(self) -> Dict[str, Any]: result["object"] = self.object result["id"] = self.id result["email"] = self.email - result["state"] = ( - self.state.value if isinstance(self.state, Enum) else self.state - ) + result["state"] = self.state.value if isinstance(self.state, Enum) else self.state if self.accepted_at is not None: result["accepted_at"] = _format_datetime(self.accepted_at) else: @@ -95,6 +93,10 @@ def to_dict(self) -> Dict[str, Any]: result["accepted_user_id"] = self.accepted_user_id else: result["accepted_user_id"] = None + if self.role_slug is not None: + result["role_slug"] = self.role_slug + else: + result["role_slug"] = None result["created_at"] = _format_datetime(self.created_at) result["updated_at"] = _format_datetime(self.updated_at) return result diff --git a/src/workos/common/models/invitation_accepted_data_state.py b/src/workos/common/models/invitation_accepted_data_state.py index cc9cd3be..279af6af 100644 --- a/src/workos/common/models/invitation_accepted_data_state.py +++ b/src/workos/common/models/invitation_accepted_data_state.py @@ -26,7 +26,4 @@ def _missing_(cls, value: object) -> Optional["InvitationAcceptedDataState"]: unknown._value_ = value return unknown - -InvitationAcceptedDataStateLiteral: TypeAlias = Literal[ - "pending", "accepted", "expired", "revoked" -] +InvitationAcceptedDataStateLiteral: TypeAlias = Literal["pending", "accepted", "expired", "revoked"] diff --git a/src/workos/common/models/invitation_created.py b/src/workos/common/models/invitation_created.py index 6859e4a9..2c34612b 100644 --- a/src/workos/common/models/invitation_created.py +++ b/src/workos/common/models/invitation_created.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "InvitationCreated": return cls( id=data["id"], event=data["event"], - data=InvitationCreatedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=InvitationCreatedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("InvitationCreated", e) diff --git a/src/workos/common/models/invitation_resent.py b/src/workos/common/models/invitation_resent.py index 08cdc2e4..78a70181 100644 --- a/src/workos/common/models/invitation_resent.py +++ b/src/workos/common/models/invitation_resent.py @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "InvitationResent": data=InvitationResentData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("InvitationResent", e) diff --git a/src/workos/common/models/invitation_revoked.py b/src/workos/common/models/invitation_revoked.py index d55c9eab..6f4d168f 100644 --- a/src/workos/common/models/invitation_revoked.py +++ b/src/workos/common/models/invitation_revoked.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "InvitationRevoked": return cls( id=data["id"], event=data["event"], - data=InvitationRevokedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=InvitationRevokedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("InvitationRevoked", e) diff --git a/src/workos/common/models/magic_auth_created.py b/src/workos/common/models/magic_auth_created.py index a39885f8..49d87c39 100644 --- a/src/workos/common/models/magic_auth_created.py +++ b/src/workos/common/models/magic_auth_created.py @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "MagicAuthCreated": data=MagicAuthCreatedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("MagicAuthCreated", e) diff --git a/src/workos/common/models/magic_auth_created_data.py b/src/workos/common/models/magic_auth_created_data.py index 1af4c2b5..890644a7 100644 --- a/src/workos/common/models/magic_auth_created_data.py +++ b/src/workos/common/models/magic_auth_created_data.py @@ -4,6 +4,7 @@ from dataclasses import dataclass from datetime import datetime +from typing import cast from typing import Any, Dict, Literal from workos._types import _raise_deserialize_error from workos._types import _format_datetime, _parse_datetime diff --git a/src/workos/common/models/organization_created.py b/src/workos/common/models/organization_created.py index 5a76e929..b79f1608 100644 --- a/src/workos/common/models/organization_created.py +++ b/src/workos/common/models/organization_created.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "OrganizationCreated": return cls( id=data["id"], event=data["event"], - data=OrganizationCreatedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=OrganizationCreatedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("OrganizationCreated", e) diff --git a/src/workos/common/models/organization_created_data.py b/src/workos/common/models/organization_created_data.py index 9471c8ee..ee224c34 100644 --- a/src/workos/common/models/organization_created_data.py +++ b/src/workos/common/models/organization_created_data.py @@ -43,10 +43,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "OrganizationCreatedData": object=data["object"], id=data["id"], name=data["name"], - domains=[ - OrganizationCreatedDataDomain.from_dict(cast(Dict[str, Any], item)) - for item in cast(list[Any], data["domains"]) - ], + domains=[OrganizationCreatedDataDomain.from_dict(cast(Dict[str, Any], item)) for item in cast(list[Any], data["domains"])], metadata=data["metadata"], external_id=data["external_id"], created_at=_parse_datetime(data["created_at"]), diff --git a/src/workos/common/models/organization_created_data_domain_state.py b/src/workos/common/models/organization_created_data_domain_state.py index 2d30b29e..1d34a77f 100644 --- a/src/workos/common/models/organization_created_data_domain_state.py +++ b/src/workos/common/models/organization_created_data_domain_state.py @@ -27,7 +27,4 @@ def _missing_(cls, value: object) -> Optional["OrganizationCreatedDataDomainStat unknown._value_ = value return unknown - -OrganizationCreatedDataDomainStateLiteral: TypeAlias = Literal[ - "failed", "legacy_verified", "pending", "unverified", "verified" -] +OrganizationCreatedDataDomainStateLiteral: TypeAlias = Literal["failed", "legacy_verified", "pending", "unverified", "verified"] diff --git a/src/workos/common/models/organization_created_data_domain_verification_strategy.py b/src/workos/common/models/organization_created_data_domain_verification_strategy.py index d2f4ccda..e4a49631 100644 --- a/src/workos/common/models/organization_created_data_domain_verification_strategy.py +++ b/src/workos/common/models/organization_created_data_domain_verification_strategy.py @@ -16,9 +16,7 @@ class OrganizationCreatedDataDomainVerificationStrategy(str, Enum): MANUAL = "manual" @classmethod - def _missing_( - cls, value: object - ) -> Optional["OrganizationCreatedDataDomainVerificationStrategy"]: + def _missing_(cls, value: object) -> Optional["OrganizationCreatedDataDomainVerificationStrategy"]: if not isinstance(value, str): return None unknown = str.__new__(cls, value) @@ -26,7 +24,4 @@ def _missing_( unknown._value_ = value return unknown - -OrganizationCreatedDataDomainVerificationStrategyLiteral: TypeAlias = Literal[ - "dns", "manual" -] +OrganizationCreatedDataDomainVerificationStrategyLiteral: TypeAlias = Literal["dns", "manual"] diff --git a/src/workos/common/models/organization_deleted.py b/src/workos/common/models/organization_deleted.py index e9fb878d..f8120fe6 100644 --- a/src/workos/common/models/organization_deleted.py +++ b/src/workos/common/models/organization_deleted.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "OrganizationDeleted": return cls( id=data["id"], event=data["event"], - data=OrganizationDeletedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=OrganizationDeletedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("OrganizationDeleted", e) diff --git a/src/workos/common/models/organization_deleted_data_domain_verification_strategy.py b/src/workos/common/models/organization_deleted_data_domain_verification_strategy.py index 90807929..cdb9be8c 100644 --- a/src/workos/common/models/organization_deleted_data_domain_verification_strategy.py +++ b/src/workos/common/models/organization_deleted_data_domain_verification_strategy.py @@ -1,11 +1,7 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias -from .organization_created_data_domain_verification_strategy import ( - OrganizationCreatedDataDomainVerificationStrategy, -) +from .organization_created_data_domain_verification_strategy import OrganizationCreatedDataDomainVerificationStrategy -OrganizationDeletedDataDomainVerificationStrategy: TypeAlias = ( - OrganizationCreatedDataDomainVerificationStrategy -) +OrganizationDeletedDataDomainVerificationStrategy: TypeAlias = OrganizationCreatedDataDomainVerificationStrategy __all__ = ["OrganizationDeletedDataDomainVerificationStrategy"] diff --git a/src/workos/common/models/organization_domain_created.py b/src/workos/common/models/organization_domain_created.py index 1958244b..8cef0100 100644 --- a/src/workos/common/models/organization_domain_created.py +++ b/src/workos/common/models/organization_domain_created.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "OrganizationDomainCreated": return cls( id=data["id"], event=data["event"], - data=OrganizationDomainCreatedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=OrganizationDomainCreatedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("OrganizationDomainCreated", e) diff --git a/src/workos/common/models/organization_domain_created_data_verification_strategy.py b/src/workos/common/models/organization_domain_created_data_verification_strategy.py index a169f23a..7f0badaa 100644 --- a/src/workos/common/models/organization_domain_created_data_verification_strategy.py +++ b/src/workos/common/models/organization_domain_created_data_verification_strategy.py @@ -1,11 +1,7 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias -from .organization_created_data_domain_verification_strategy import ( - OrganizationCreatedDataDomainVerificationStrategy, -) +from .organization_created_data_domain_verification_strategy import OrganizationCreatedDataDomainVerificationStrategy -OrganizationDomainCreatedDataVerificationStrategy: TypeAlias = ( - OrganizationCreatedDataDomainVerificationStrategy -) +OrganizationDomainCreatedDataVerificationStrategy: TypeAlias = OrganizationCreatedDataDomainVerificationStrategy __all__ = ["OrganizationDomainCreatedDataVerificationStrategy"] diff --git a/src/workos/common/models/organization_domain_data_state.py b/src/workos/common/models/organization_domain_data_state.py index b2a2df0c..2567ebe0 100644 --- a/src/workos/common/models/organization_domain_data_state.py +++ b/src/workos/common/models/organization_domain_data_state.py @@ -24,5 +24,4 @@ def _missing_(cls, value: object) -> Optional["OrganizationDomainDataState"]: unknown._value_ = value return unknown - OrganizationDomainDataStateLiteral: TypeAlias = Literal["pending", "verified"] diff --git a/src/workos/common/models/organization_domain_deleted.py b/src/workos/common/models/organization_domain_deleted.py index b3060a57..ba34f1c2 100644 --- a/src/workos/common/models/organization_domain_deleted.py +++ b/src/workos/common/models/organization_domain_deleted.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "OrganizationDomainDeleted": return cls( id=data["id"], event=data["event"], - data=OrganizationDomainDeletedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=OrganizationDomainDeletedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("OrganizationDomainDeleted", e) diff --git a/src/workos/common/models/organization_domain_deleted_data_verification_strategy.py b/src/workos/common/models/organization_domain_deleted_data_verification_strategy.py index 507cb57a..cd958b01 100644 --- a/src/workos/common/models/organization_domain_deleted_data_verification_strategy.py +++ b/src/workos/common/models/organization_domain_deleted_data_verification_strategy.py @@ -1,11 +1,7 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias -from .organization_created_data_domain_verification_strategy import ( - OrganizationCreatedDataDomainVerificationStrategy, -) +from .organization_created_data_domain_verification_strategy import OrganizationCreatedDataDomainVerificationStrategy -OrganizationDomainDeletedDataVerificationStrategy: TypeAlias = ( - OrganizationCreatedDataDomainVerificationStrategy -) +OrganizationDomainDeletedDataVerificationStrategy: TypeAlias = OrganizationCreatedDataDomainVerificationStrategy __all__ = ["OrganizationDomainDeletedDataVerificationStrategy"] diff --git a/src/workos/common/models/organization_domain_stand_alone_verification_strategy.py b/src/workos/common/models/organization_domain_stand_alone_verification_strategy.py index 4bb04be0..5057ae51 100644 --- a/src/workos/common/models/organization_domain_stand_alone_verification_strategy.py +++ b/src/workos/common/models/organization_domain_stand_alone_verification_strategy.py @@ -1,11 +1,7 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias -from .organization_created_data_domain_verification_strategy import ( - OrganizationCreatedDataDomainVerificationStrategy, -) +from .organization_created_data_domain_verification_strategy import OrganizationCreatedDataDomainVerificationStrategy -OrganizationDomainStandAloneVerificationStrategy: TypeAlias = ( - OrganizationCreatedDataDomainVerificationStrategy -) +OrganizationDomainStandAloneVerificationStrategy: TypeAlias = OrganizationCreatedDataDomainVerificationStrategy __all__ = ["OrganizationDomainStandAloneVerificationStrategy"] diff --git a/src/workos/common/models/organization_domain_updated.py b/src/workos/common/models/organization_domain_updated.py index 16314d18..1406bbda 100644 --- a/src/workos/common/models/organization_domain_updated.py +++ b/src/workos/common/models/organization_domain_updated.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "OrganizationDomainUpdated": return cls( id=data["id"], event=data["event"], - data=OrganizationDomainUpdatedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=OrganizationDomainUpdatedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("OrganizationDomainUpdated", e) diff --git a/src/workos/common/models/organization_domain_updated_data_verification_strategy.py b/src/workos/common/models/organization_domain_updated_data_verification_strategy.py index 2191981a..a9824560 100644 --- a/src/workos/common/models/organization_domain_updated_data_verification_strategy.py +++ b/src/workos/common/models/organization_domain_updated_data_verification_strategy.py @@ -1,11 +1,7 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias -from .organization_created_data_domain_verification_strategy import ( - OrganizationCreatedDataDomainVerificationStrategy, -) +from .organization_created_data_domain_verification_strategy import OrganizationCreatedDataDomainVerificationStrategy -OrganizationDomainUpdatedDataVerificationStrategy: TypeAlias = ( - OrganizationCreatedDataDomainVerificationStrategy -) +OrganizationDomainUpdatedDataVerificationStrategy: TypeAlias = OrganizationCreatedDataDomainVerificationStrategy __all__ = ["OrganizationDomainUpdatedDataVerificationStrategy"] diff --git a/src/workos/common/models/organization_domain_verification_failed.py b/src/workos/common/models/organization_domain_verification_failed.py index 293f083a..22cab333 100644 --- a/src/workos/common/models/organization_domain_verification_failed.py +++ b/src/workos/common/models/organization_domain_verification_failed.py @@ -10,9 +10,7 @@ from workos._types import _format_datetime, _parse_datetime from .event_context import EventContext -from .organization_domain_verification_failed_data import ( - OrganizationDomainVerificationFailedData, -) +from .organization_domain_verification_failed_data import OrganizationDomainVerificationFailedData @dataclass(slots=True) @@ -37,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "OrganizationDomainVerificationFaile return cls( id=data["id"], event=data["event"], - data=OrganizationDomainVerificationFailedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=OrganizationDomainVerificationFailedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("OrganizationDomainVerificationFailed", e) diff --git a/src/workos/common/models/organization_domain_verification_failed_data.py b/src/workos/common/models/organization_domain_verification_failed_data.py index f62a4f63..68617590 100644 --- a/src/workos/common/models/organization_domain_verification_failed_data.py +++ b/src/workos/common/models/organization_domain_verification_failed_data.py @@ -8,12 +8,8 @@ from typing import Any, Dict from workos._types import _raise_deserialize_error -from .organization_domain_verification_failed_data_organization_domain import ( - OrganizationDomainVerificationFailedDataOrganizationDomain, -) -from .organization_domain_verification_failed_data_reason import ( - OrganizationDomainVerificationFailedDataReason, -) +from .organization_domain_verification_failed_data_organization_domain import OrganizationDomainVerificationFailedDataOrganizationDomain +from .organization_domain_verification_failed_data_reason import OrganizationDomainVerificationFailedDataReason @dataclass(slots=True) @@ -26,16 +22,12 @@ class OrganizationDomainVerificationFailedData: """The organization domain that failed verification.""" @classmethod - def from_dict( - cls, data: Dict[str, Any] - ) -> "OrganizationDomainVerificationFailedData": + def from_dict(cls, data: Dict[str, Any]) -> "OrganizationDomainVerificationFailedData": """Deserialize from a dictionary.""" try: return cls( reason=OrganizationDomainVerificationFailedDataReason(data["reason"]), - organization_domain=OrganizationDomainVerificationFailedDataOrganizationDomain.from_dict( - cast(Dict[str, Any], data["organization_domain"]) - ), + organization_domain=OrganizationDomainVerificationFailedDataOrganizationDomain.from_dict(cast(Dict[str, Any], data["organization_domain"])), ) except (KeyError, ValueError) as e: _raise_deserialize_error("OrganizationDomainVerificationFailedData", e) @@ -43,8 +35,6 @@ def from_dict( def to_dict(self) -> Dict[str, Any]: """Serialize to a dictionary.""" result: Dict[str, Any] = {} - result["reason"] = ( - self.reason.value if isinstance(self.reason, Enum) else self.reason - ) + result["reason"] = self.reason.value if isinstance(self.reason, Enum) else self.reason result["organization_domain"] = self.organization_domain.to_dict() return result diff --git a/src/workos/common/models/organization_domain_verification_failed_data_organization_domain.py b/src/workos/common/models/organization_domain_verification_failed_data_organization_domain.py index ec057f65..8d21678d 100644 --- a/src/workos/common/models/organization_domain_verification_failed_data_organization_domain.py +++ b/src/workos/common/models/organization_domain_verification_failed_data_organization_domain.py @@ -3,6 +3,4 @@ from typing import TypeAlias from workos.organization_domains.models.organization_domain import OrganizationDomain -OrganizationDomainVerificationFailedDataOrganizationDomain: TypeAlias = ( - OrganizationDomain -) +OrganizationDomainVerificationFailedDataOrganizationDomain: TypeAlias = OrganizationDomain diff --git a/src/workos/common/models/organization_domain_verification_failed_data_organization_domain_state.py b/src/workos/common/models/organization_domain_verification_failed_data_organization_domain_state.py index a603bcce..c36dddb4 100644 --- a/src/workos/common/models/organization_domain_verification_failed_data_organization_domain_state.py +++ b/src/workos/common/models/organization_domain_verification_failed_data_organization_domain_state.py @@ -3,7 +3,5 @@ from typing import TypeAlias from .organization_created_data_domain_state import OrganizationCreatedDataDomainState -OrganizationDomainVerificationFailedDataOrganizationDomainState: TypeAlias = ( - OrganizationCreatedDataDomainState -) +OrganizationDomainVerificationFailedDataOrganizationDomainState: TypeAlias = OrganizationCreatedDataDomainState __all__ = ["OrganizationDomainVerificationFailedDataOrganizationDomainState"] diff --git a/src/workos/common/models/organization_domain_verification_failed_data_organization_domain_verification_strategy.py b/src/workos/common/models/organization_domain_verification_failed_data_organization_domain_verification_strategy.py index 63b4cc64..62b335f9 100644 --- a/src/workos/common/models/organization_domain_verification_failed_data_organization_domain_verification_strategy.py +++ b/src/workos/common/models/organization_domain_verification_failed_data_organization_domain_verification_strategy.py @@ -1,11 +1,7 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias -from .organization_created_data_domain_verification_strategy import ( - OrganizationCreatedDataDomainVerificationStrategy, -) +from .organization_created_data_domain_verification_strategy import OrganizationCreatedDataDomainVerificationStrategy OrganizationDomainVerificationFailedDataOrganizationDomainVerificationStrategy: TypeAlias = OrganizationCreatedDataDomainVerificationStrategy -__all__ = [ - "OrganizationDomainVerificationFailedDataOrganizationDomainVerificationStrategy" -] +__all__ = ["OrganizationDomainVerificationFailedDataOrganizationDomainVerificationStrategy"] diff --git a/src/workos/common/models/organization_domain_verification_failed_data_reason.py b/src/workos/common/models/organization_domain_verification_failed_data_reason.py index a36af374..aa2c188c 100644 --- a/src/workos/common/models/organization_domain_verification_failed_data_reason.py +++ b/src/workos/common/models/organization_domain_verification_failed_data_reason.py @@ -16,9 +16,7 @@ class OrganizationDomainVerificationFailedDataReason(str, Enum): DOMAIN_VERIFIED_BY_OTHER_ORGANIZATION = "domain_verified_by_other_organization" @classmethod - def _missing_( - cls, value: object - ) -> Optional["OrganizationDomainVerificationFailedDataReason"]: + def _missing_(cls, value: object) -> Optional["OrganizationDomainVerificationFailedDataReason"]: if not isinstance(value, str): return None unknown = str.__new__(cls, value) @@ -26,7 +24,4 @@ def _missing_( unknown._value_ = value return unknown - -OrganizationDomainVerificationFailedDataReasonLiteral: TypeAlias = Literal[ - "domain_verification_period_expired", "domain_verified_by_other_organization" -] +OrganizationDomainVerificationFailedDataReasonLiteral: TypeAlias = Literal["domain_verification_period_expired", "domain_verified_by_other_organization"] diff --git a/src/workos/common/models/organization_domain_verification_strategy.py b/src/workos/common/models/organization_domain_verification_strategy.py index 440bcd6b..9232f497 100644 --- a/src/workos/common/models/organization_domain_verification_strategy.py +++ b/src/workos/common/models/organization_domain_verification_strategy.py @@ -1,11 +1,7 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias -from .organization_created_data_domain_verification_strategy import ( - OrganizationCreatedDataDomainVerificationStrategy, -) +from .organization_created_data_domain_verification_strategy import OrganizationCreatedDataDomainVerificationStrategy -OrganizationDomainVerificationStrategy: TypeAlias = ( - OrganizationCreatedDataDomainVerificationStrategy -) +OrganizationDomainVerificationStrategy: TypeAlias = OrganizationCreatedDataDomainVerificationStrategy __all__ = ["OrganizationDomainVerificationStrategy"] diff --git a/src/workos/common/models/organization_domain_verified.py b/src/workos/common/models/organization_domain_verified.py index 7a130ff6..a11c0253 100644 --- a/src/workos/common/models/organization_domain_verified.py +++ b/src/workos/common/models/organization_domain_verified.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "OrganizationDomainVerified": return cls( id=data["id"], event=data["event"], - data=OrganizationDomainVerifiedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=OrganizationDomainVerifiedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("OrganizationDomainVerified", e) diff --git a/src/workos/common/models/organization_domain_verified_data_verification_strategy.py b/src/workos/common/models/organization_domain_verified_data_verification_strategy.py index 4d141125..a13ab745 100644 --- a/src/workos/common/models/organization_domain_verified_data_verification_strategy.py +++ b/src/workos/common/models/organization_domain_verified_data_verification_strategy.py @@ -1,11 +1,7 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias -from .organization_created_data_domain_verification_strategy import ( - OrganizationCreatedDataDomainVerificationStrategy, -) +from .organization_created_data_domain_verification_strategy import OrganizationCreatedDataDomainVerificationStrategy -OrganizationDomainVerifiedDataVerificationStrategy: TypeAlias = ( - OrganizationCreatedDataDomainVerificationStrategy -) +OrganizationDomainVerifiedDataVerificationStrategy: TypeAlias = OrganizationCreatedDataDomainVerificationStrategy __all__ = ["OrganizationDomainVerifiedDataVerificationStrategy"] diff --git a/src/workos/common/models/organization_membership_created.py b/src/workos/common/models/organization_membership_created.py index a39d36a1..96ac57f1 100644 --- a/src/workos/common/models/organization_membership_created.py +++ b/src/workos/common/models/organization_membership_created.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "OrganizationMembershipCreated": return cls( id=data["id"], event=data["event"], - data=OrganizationMembershipCreatedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=OrganizationMembershipCreatedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("OrganizationMembershipCreated", e) diff --git a/src/workos/common/models/organization_membership_created_data.py b/src/workos/common/models/organization_membership_created_data.py index 0e775852..2b9469c3 100644 --- a/src/workos/common/models/organization_membership_created_data.py +++ b/src/workos/common/models/organization_membership_created_data.py @@ -11,9 +11,7 @@ from workos._types import _format_datetime, _parse_datetime from workos.authorization.models.slim_role import SlimRole -from .organization_membership_created_data_status import ( - OrganizationMembershipCreatedDataStatus, -) +from .organization_membership_created_data_status import OrganizationMembershipCreatedDataStatus @dataclass(slots=True) @@ -58,12 +56,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "OrganizationMembershipCreatedData": directory_managed=data["directory_managed"], created_at=_parse_datetime(data["created_at"]), updated_at=_parse_datetime(data["updated_at"]), - roles=[ - SlimRole.from_dict(cast(Dict[str, Any], item)) - for item in cast(list[Any], _v_roles) - ] - if (_v_roles := data.get("roles")) is not None - else None, + roles=[SlimRole.from_dict(cast(Dict[str, Any], item)) for item in cast(list[Any], _v_roles)] if (_v_roles := data.get("roles")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("OrganizationMembershipCreatedData", e) @@ -75,9 +68,7 @@ def to_dict(self) -> Dict[str, Any]: result["id"] = self.id result["user_id"] = self.user_id result["organization_id"] = self.organization_id - result["status"] = ( - self.status.value if isinstance(self.status, Enum) else self.status - ) + result["status"] = self.status.value if isinstance(self.status, Enum) else self.status result["role"] = self.role.to_dict() result["custom_attributes"] = self.custom_attributes result["directory_managed"] = self.directory_managed diff --git a/src/workos/common/models/organization_membership_created_data_status.py b/src/workos/common/models/organization_membership_created_data_status.py index 297fee7a..8f29c964 100644 --- a/src/workos/common/models/organization_membership_created_data_status.py +++ b/src/workos/common/models/organization_membership_created_data_status.py @@ -17,9 +17,7 @@ class OrganizationMembershipCreatedDataStatus(str, Enum): PENDING = "pending" @classmethod - def _missing_( - cls, value: object - ) -> Optional["OrganizationMembershipCreatedDataStatus"]: + def _missing_(cls, value: object) -> Optional["OrganizationMembershipCreatedDataStatus"]: if not isinstance(value, str): return None unknown = str.__new__(cls, value) @@ -27,7 +25,4 @@ def _missing_( unknown._value_ = value return unknown - -OrganizationMembershipCreatedDataStatusLiteral: TypeAlias = Literal[ - "active", "inactive", "pending" -] +OrganizationMembershipCreatedDataStatusLiteral: TypeAlias = Literal["active", "inactive", "pending"] diff --git a/src/workos/common/models/organization_membership_deleted.py b/src/workos/common/models/organization_membership_deleted.py index c962bdfe..e89080ac 100644 --- a/src/workos/common/models/organization_membership_deleted.py +++ b/src/workos/common/models/organization_membership_deleted.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "OrganizationMembershipDeleted": return cls( id=data["id"], event=data["event"], - data=OrganizationMembershipDeletedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=OrganizationMembershipDeletedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("OrganizationMembershipDeleted", e) diff --git a/src/workos/common/models/organization_membership_deleted_data_status.py b/src/workos/common/models/organization_membership_deleted_data_status.py index d035e7e2..079b47a6 100644 --- a/src/workos/common/models/organization_membership_deleted_data_status.py +++ b/src/workos/common/models/organization_membership_deleted_data_status.py @@ -1,11 +1,7 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias -from .organization_membership_created_data_status import ( - OrganizationMembershipCreatedDataStatus, -) +from .organization_membership_created_data_status import OrganizationMembershipCreatedDataStatus -OrganizationMembershipDeletedDataStatus: TypeAlias = ( - OrganizationMembershipCreatedDataStatus -) +OrganizationMembershipDeletedDataStatus: TypeAlias = OrganizationMembershipCreatedDataStatus __all__ = ["OrganizationMembershipDeletedDataStatus"] diff --git a/src/workos/common/models/organization_membership_status.py b/src/workos/common/models/organization_membership_status.py index af08a099..5e4391d7 100644 --- a/src/workos/common/models/organization_membership_status.py +++ b/src/workos/common/models/organization_membership_status.py @@ -1,9 +1,7 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias -from .organization_membership_created_data_status import ( - OrganizationMembershipCreatedDataStatus, -) +from .organization_membership_created_data_status import OrganizationMembershipCreatedDataStatus OrganizationMembershipStatus: TypeAlias = OrganizationMembershipCreatedDataStatus __all__ = ["OrganizationMembershipStatus"] diff --git a/src/workos/common/models/organization_membership_updated.py b/src/workos/common/models/organization_membership_updated.py index e184e472..f7923624 100644 --- a/src/workos/common/models/organization_membership_updated.py +++ b/src/workos/common/models/organization_membership_updated.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "OrganizationMembershipUpdated": return cls( id=data["id"], event=data["event"], - data=OrganizationMembershipUpdatedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=OrganizationMembershipUpdatedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("OrganizationMembershipUpdated", e) diff --git a/src/workos/common/models/organization_membership_updated_data_status.py b/src/workos/common/models/organization_membership_updated_data_status.py index 13348036..01ce3a3a 100644 --- a/src/workos/common/models/organization_membership_updated_data_status.py +++ b/src/workos/common/models/organization_membership_updated_data_status.py @@ -1,11 +1,7 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias -from .organization_membership_created_data_status import ( - OrganizationMembershipCreatedDataStatus, -) +from .organization_membership_created_data_status import OrganizationMembershipCreatedDataStatus -OrganizationMembershipUpdatedDataStatus: TypeAlias = ( - OrganizationMembershipCreatedDataStatus -) +OrganizationMembershipUpdatedDataStatus: TypeAlias = OrganizationMembershipCreatedDataStatus __all__ = ["OrganizationMembershipUpdatedDataStatus"] diff --git a/src/workos/common/models/organization_role_created.py b/src/workos/common/models/organization_role_created.py index edd129ad..8fbef310 100644 --- a/src/workos/common/models/organization_role_created.py +++ b/src/workos/common/models/organization_role_created.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "OrganizationRoleCreated": return cls( id=data["id"], event=data["event"], - data=OrganizationRoleCreatedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=OrganizationRoleCreatedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("OrganizationRoleCreated", e) diff --git a/src/workos/common/models/organization_role_created_data.py b/src/workos/common/models/organization_role_created_data.py index 4f2aaca0..de197425 100644 --- a/src/workos/common/models/organization_role_created_data.py +++ b/src/workos/common/models/organization_role_created_data.py @@ -4,6 +4,7 @@ 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 diff --git a/src/workos/common/models/organization_role_deleted.py b/src/workos/common/models/organization_role_deleted.py index d00630e8..b23903ec 100644 --- a/src/workos/common/models/organization_role_deleted.py +++ b/src/workos/common/models/organization_role_deleted.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "OrganizationRoleDeleted": return cls( id=data["id"], event=data["event"], - data=OrganizationRoleDeletedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=OrganizationRoleDeletedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("OrganizationRoleDeleted", e) diff --git a/src/workos/common/models/organization_role_updated.py b/src/workos/common/models/organization_role_updated.py index a54878f6..6a7cda7b 100644 --- a/src/workos/common/models/organization_role_updated.py +++ b/src/workos/common/models/organization_role_updated.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "OrganizationRoleUpdated": return cls( id=data["id"], event=data["event"], - data=OrganizationRoleUpdatedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=OrganizationRoleUpdatedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("OrganizationRoleUpdated", e) diff --git a/src/workos/common/models/organization_updated.py b/src/workos/common/models/organization_updated.py index 44b18a35..35e391a3 100644 --- a/src/workos/common/models/organization_updated.py +++ b/src/workos/common/models/organization_updated.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "OrganizationUpdated": return cls( id=data["id"], event=data["event"], - data=OrganizationUpdatedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=OrganizationUpdatedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("OrganizationUpdated", e) diff --git a/src/workos/common/models/organization_updated_data_domain_verification_strategy.py b/src/workos/common/models/organization_updated_data_domain_verification_strategy.py index 0e5a1f97..443b9ce9 100644 --- a/src/workos/common/models/organization_updated_data_domain_verification_strategy.py +++ b/src/workos/common/models/organization_updated_data_domain_verification_strategy.py @@ -1,11 +1,7 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias -from .organization_created_data_domain_verification_strategy import ( - OrganizationCreatedDataDomainVerificationStrategy, -) +from .organization_created_data_domain_verification_strategy import OrganizationCreatedDataDomainVerificationStrategy -OrganizationUpdatedDataDomainVerificationStrategy: TypeAlias = ( - OrganizationCreatedDataDomainVerificationStrategy -) +OrganizationUpdatedDataDomainVerificationStrategy: TypeAlias = OrganizationCreatedDataDomainVerificationStrategy __all__ = ["OrganizationUpdatedDataDomainVerificationStrategy"] diff --git a/src/workos/common/models/password_reset_created.py b/src/workos/common/models/password_reset_created.py index f0f3f12d..79274d57 100644 --- a/src/workos/common/models/password_reset_created.py +++ b/src/workos/common/models/password_reset_created.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "PasswordResetCreated": return cls( id=data["id"], event=data["event"], - data=PasswordResetCreatedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=PasswordResetCreatedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("PasswordResetCreated", e) diff --git a/src/workos/common/models/password_reset_created_data.py b/src/workos/common/models/password_reset_created_data.py index be30137b..707760c2 100644 --- a/src/workos/common/models/password_reset_created_data.py +++ b/src/workos/common/models/password_reset_created_data.py @@ -4,6 +4,7 @@ from dataclasses import dataclass from datetime import datetime +from typing import cast from typing import Any, Dict, Literal from workos._types import _raise_deserialize_error from workos._types import _format_datetime, _parse_datetime diff --git a/src/workos/common/models/password_reset_succeeded.py b/src/workos/common/models/password_reset_succeeded.py index eacfb2a5..a707af13 100644 --- a/src/workos/common/models/password_reset_succeeded.py +++ b/src/workos/common/models/password_reset_succeeded.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "PasswordResetSucceeded": return cls( id=data["id"], event=data["event"], - data=PasswordResetSucceededData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=PasswordResetSucceededData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("PasswordResetSucceeded", e) diff --git a/src/workos/common/models/permission_created.py b/src/workos/common/models/permission_created.py index a86915a2..f85a89b4 100644 --- a/src/workos/common/models/permission_created.py +++ b/src/workos/common/models/permission_created.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "PermissionCreated": return cls( id=data["id"], event=data["event"], - data=PermissionCreatedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=PermissionCreatedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("PermissionCreated", e) diff --git a/src/workos/common/models/permission_created_data.py b/src/workos/common/models/permission_created_data.py index e8331f07..780edbca 100644 --- a/src/workos/common/models/permission_created_data.py +++ b/src/workos/common/models/permission_created_data.py @@ -4,6 +4,7 @@ from dataclasses import dataclass from datetime import datetime +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 diff --git a/src/workos/common/models/permission_deleted.py b/src/workos/common/models/permission_deleted.py index 6127f413..44becc58 100644 --- a/src/workos/common/models/permission_deleted.py +++ b/src/workos/common/models/permission_deleted.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "PermissionDeleted": return cls( id=data["id"], event=data["event"], - data=PermissionDeletedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=PermissionDeletedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("PermissionDeleted", e) diff --git a/src/workos/common/models/permission_updated.py b/src/workos/common/models/permission_updated.py index 35383491..b8496375 100644 --- a/src/workos/common/models/permission_updated.py +++ b/src/workos/common/models/permission_updated.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "PermissionUpdated": return cls( id=data["id"], event=data["event"], - data=PermissionUpdatedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=PermissionUpdatedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("PermissionUpdated", e) diff --git a/src/workos/common/models/radar_standalone_assess_request_action.py b/src/workos/common/models/radar_standalone_assess_request_action.py index 44cd1da3..9903f3f0 100644 --- a/src/workos/common/models/radar_standalone_assess_request_action.py +++ b/src/workos/common/models/radar_standalone_assess_request_action.py @@ -30,7 +30,4 @@ def _missing_(cls, value: object) -> Optional["RadarStandaloneAssessRequestActio unknown._value_ = value return unknown - -RadarStandaloneAssessRequestActionLiteral: TypeAlias = Literal[ - "login", "signup", "sign-up", "sign-in", "sign_up", "sign_in", "sign in", "sign up" -] +RadarStandaloneAssessRequestActionLiteral: TypeAlias = Literal["login", "signup", "sign-up", "sign-in", "sign_up", "sign_in", "sign in", "sign up"] diff --git a/src/workos/common/models/radar_standalone_assess_request_auth_method.py b/src/workos/common/models/radar_standalone_assess_request_auth_method.py index 324a899e..14bfd21c 100644 --- a/src/workos/common/models/radar_standalone_assess_request_auth_method.py +++ b/src/workos/common/models/radar_standalone_assess_request_auth_method.py @@ -22,9 +22,7 @@ class RadarStandaloneAssessRequestAuthMethod(str, Enum): OTHER = "Other" @classmethod - def _missing_( - cls, value: object - ) -> Optional["RadarStandaloneAssessRequestAuthMethod"]: + def _missing_(cls, value: object) -> Optional["RadarStandaloneAssessRequestAuthMethod"]: if not isinstance(value, str): return None unknown = str.__new__(cls, value) @@ -32,14 +30,4 @@ def _missing_( unknown._value_ = value return unknown - -RadarStandaloneAssessRequestAuthMethodLiteral: TypeAlias = Literal[ - "Password", - "Passkey", - "Authenticator", - "SMS_OTP", - "Email_OTP", - "Social", - "SSO", - "Other", -] +RadarStandaloneAssessRequestAuthMethodLiteral: TypeAlias = Literal["Password", "Passkey", "Authenticator", "SMS_OTP", "Email_OTP", "Social", "SSO", "Other"] diff --git a/src/workos/common/models/radar_standalone_response_blocklist_type.py b/src/workos/common/models/radar_standalone_response_blocklist_type.py index ca45b4dd..a81f2517 100644 --- a/src/workos/common/models/radar_standalone_response_blocklist_type.py +++ b/src/workos/common/models/radar_standalone_response_blocklist_type.py @@ -21,9 +21,7 @@ class RadarStandaloneResponseBlocklistType(str, Enum): COUNTRY = "country" @classmethod - def _missing_( - cls, value: object - ) -> Optional["RadarStandaloneResponseBlocklistType"]: + def _missing_(cls, value: object) -> Optional["RadarStandaloneResponseBlocklistType"]: if not isinstance(value, str): return None unknown = str.__new__(cls, value) @@ -31,13 +29,4 @@ def _missing_( unknown._value_ = value return unknown - -RadarStandaloneResponseBlocklistTypeLiteral: TypeAlias = Literal[ - "ip_address", - "domain", - "email", - "device", - "user_agent", - "device_fingerprint", - "country", -] +RadarStandaloneResponseBlocklistTypeLiteral: TypeAlias = Literal["ip_address", "domain", "email", "device", "user_agent", "device_fingerprint", "country"] diff --git a/src/workos/common/models/radar_standalone_response_control.py b/src/workos/common/models/radar_standalone_response_control.py index 2e599da7..f93416ef 100644 --- a/src/workos/common/models/radar_standalone_response_control.py +++ b/src/workos/common/models/radar_standalone_response_control.py @@ -32,16 +32,4 @@ def _missing_(cls, value: object) -> Optional["RadarStandaloneResponseControl"]: unknown._value_ = value return unknown - -RadarStandaloneResponseControlLiteral: TypeAlias = Literal[ - "bot_detection", - "brute_force_attack", - "credential_stuffing", - "domain_sign_up_rate_limit", - "ip_sign_up_rate_limit", - "impossible_travel", - "repeat_sign_up", - "stale_account", - "unrecognized_device", - "restriction", -] +RadarStandaloneResponseControlLiteral: TypeAlias = Literal["bot_detection", "brute_force_attack", "credential_stuffing", "domain_sign_up_rate_limit", "ip_sign_up_rate_limit", "impossible_travel", "repeat_sign_up", "stale_account", "unrecognized_device", "restriction"] diff --git a/src/workos/common/models/radar_standalone_response_verdict.py b/src/workos/common/models/radar_standalone_response_verdict.py index 75a911f5..c442166c 100644 --- a/src/workos/common/models/radar_standalone_response_verdict.py +++ b/src/workos/common/models/radar_standalone_response_verdict.py @@ -25,7 +25,4 @@ def _missing_(cls, value: object) -> Optional["RadarStandaloneResponseVerdict"]: unknown._value_ = value return unknown - -RadarStandaloneResponseVerdictLiteral: TypeAlias = Literal[ - "allow", "block", "challenge" -] +RadarStandaloneResponseVerdictLiteral: TypeAlias = Literal["allow", "block", "challenge"] diff --git a/src/workos/common/models/role_created.py b/src/workos/common/models/role_created.py index 7d003756..bb285de3 100644 --- a/src/workos/common/models/role_created.py +++ b/src/workos/common/models/role_created.py @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "RoleCreated": data=RoleCreatedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("RoleCreated", e) diff --git a/src/workos/common/models/role_created_data.py b/src/workos/common/models/role_created_data.py index eeea9d07..1c377f22 100644 --- a/src/workos/common/models/role_created_data.py +++ b/src/workos/common/models/role_created_data.py @@ -4,6 +4,7 @@ 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 diff --git a/src/workos/common/models/role_deleted.py b/src/workos/common/models/role_deleted.py index 66f90208..5ef34915 100644 --- a/src/workos/common/models/role_deleted.py +++ b/src/workos/common/models/role_deleted.py @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "RoleDeleted": data=RoleDeletedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("RoleDeleted", e) diff --git a/src/workos/common/models/role_type.py b/src/workos/common/models/role_type.py index a9f7b0e1..4c8d8bd5 100644 --- a/src/workos/common/models/role_type.py +++ b/src/workos/common/models/role_type.py @@ -24,5 +24,4 @@ def _missing_(cls, value: object) -> Optional["RoleType"]: unknown._value_ = value return unknown - RoleTypeLiteral: TypeAlias = Literal["EnvironmentRole", "OrganizationRole"] diff --git a/src/workos/common/models/role_updated.py b/src/workos/common/models/role_updated.py index 32f5c9fa..ffa870e8 100644 --- a/src/workos/common/models/role_updated.py +++ b/src/workos/common/models/role_updated.py @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "RoleUpdated": data=RoleUpdatedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("RoleUpdated", e) diff --git a/src/workos/common/models/session_created.py b/src/workos/common/models/session_created.py index 17744c1e..3e2231d8 100644 --- a/src/workos/common/models/session_created.py +++ b/src/workos/common/models/session_created.py @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "SessionCreated": data=SessionCreatedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("SessionCreated", e) diff --git a/src/workos/common/models/session_created_data_auth_method.py b/src/workos/common/models/session_created_data_auth_method.py index d2ae2a7d..13fd7678 100644 --- a/src/workos/common/models/session_created_data_auth_method.py +++ b/src/workos/common/models/session_created_data_auth_method.py @@ -32,16 +32,4 @@ def _missing_(cls, value: object) -> Optional["SessionCreatedDataAuthMethod"]: unknown._value_ = value return unknown - -SessionCreatedDataAuthMethodLiteral: TypeAlias = Literal[ - "cross_app_auth", - "external_auth", - "impersonation", - "magic_code", - "migrated_session", - "oauth", - "passkey", - "password", - "sso", - "unknown", -] +SessionCreatedDataAuthMethodLiteral: TypeAlias = Literal["cross_app_auth", "external_auth", "impersonation", "magic_code", "migrated_session", "oauth", "passkey", "password", "sso", "unknown"] diff --git a/src/workos/common/models/session_created_data_impersonator.py b/src/workos/common/models/session_created_data_impersonator.py index 4114d18b..86cf9879 100644 --- a/src/workos/common/models/session_created_data_impersonator.py +++ b/src/workos/common/models/session_created_data_impersonator.py @@ -1,8 +1,6 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias -from workos.user_management.models.authenticate_response_impersonator import ( - AuthenticateResponseImpersonator, -) +from workos.user_management.models.authenticate_response_impersonator import AuthenticateResponseImpersonator SessionCreatedDataImpersonator: TypeAlias = AuthenticateResponseImpersonator diff --git a/src/workos/common/models/session_created_data_status.py b/src/workos/common/models/session_created_data_status.py index 17bad1de..e4c967ee 100644 --- a/src/workos/common/models/session_created_data_status.py +++ b/src/workos/common/models/session_created_data_status.py @@ -25,5 +25,4 @@ def _missing_(cls, value: object) -> Optional["SessionCreatedDataStatus"]: unknown._value_ = value return unknown - SessionCreatedDataStatusLiteral: TypeAlias = Literal["active", "expired", "revoked"] diff --git a/src/workos/common/models/session_revoked.py b/src/workos/common/models/session_revoked.py index 26f0bcb3..4106cf66 100644 --- a/src/workos/common/models/session_revoked.py +++ b/src/workos/common/models/session_revoked.py @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "SessionRevoked": data=SessionRevokedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("SessionRevoked", e) diff --git a/src/workos/common/models/session_revoked_data_impersonator.py b/src/workos/common/models/session_revoked_data_impersonator.py index e254b8f0..da9c2144 100644 --- a/src/workos/common/models/session_revoked_data_impersonator.py +++ b/src/workos/common/models/session_revoked_data_impersonator.py @@ -1,8 +1,6 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias -from workos.user_management.models.authenticate_response_impersonator import ( - AuthenticateResponseImpersonator, -) +from workos.user_management.models.authenticate_response_impersonator import AuthenticateResponseImpersonator SessionRevokedDataImpersonator: TypeAlias = AuthenticateResponseImpersonator diff --git a/src/workos/common/models/update_webhook_endpoint_status.py b/src/workos/common/models/update_webhook_endpoint_status.py index 927bafde..84bffc80 100644 --- a/src/workos/common/models/update_webhook_endpoint_status.py +++ b/src/workos/common/models/update_webhook_endpoint_status.py @@ -24,5 +24,4 @@ def _missing_(cls, value: object) -> Optional["UpdateWebhookEndpointStatus"]: unknown._value_ = value return unknown - UpdateWebhookEndpointStatusLiteral: TypeAlias = Literal["enabled", "disabled"] diff --git a/src/workos/common/models/user_created.py b/src/workos/common/models/user_created.py index f62f10ba..8ef399a1 100644 --- a/src/workos/common/models/user_created.py +++ b/src/workos/common/models/user_created.py @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "UserCreated": data=User.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("UserCreated", e) diff --git a/src/workos/common/models/user_deleted.py b/src/workos/common/models/user_deleted.py index f86e0d9b..5b1134de 100644 --- a/src/workos/common/models/user_deleted.py +++ b/src/workos/common/models/user_deleted.py @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "UserDeleted": data=User.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("UserDeleted", e) 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..2d169ca0 100644 --- a/src/workos/common/models/user_identities_get_item_provider.py +++ b/src/workos/common/models/user_identities_get_item_provider.py @@ -36,20 +36,4 @@ def _missing_(cls, value: object) -> Optional["UserIdentitiesGetItemProvider"]: unknown._value_ = value return unknown - -UserIdentitiesGetItemProviderLiteral: TypeAlias = Literal[ - "AppleOAuth", - "BitbucketOAuth", - "DiscordOAuth", - "GithubOAuth", - "GitLabOAuth", - "GoogleOAuth", - "IntuitOAuth", - "LinkedInOAuth", - "MicrosoftOAuth", - "SalesforceOAuth", - "SlackOAuth", - "VercelMarketplaceOAuth", - "VercelOAuth", - "XeroOAuth", -] +UserIdentitiesGetItemProviderLiteral: TypeAlias = Literal["AppleOAuth", "BitbucketOAuth", "DiscordOAuth", "GithubOAuth", "GitLabOAuth", "GoogleOAuth", "IntuitOAuth", "LinkedInOAuth", "MicrosoftOAuth", "SalesforceOAuth", "SlackOAuth", "VercelMarketplaceOAuth", "VercelOAuth", "XeroOAuth"] diff --git a/src/workos/common/models/user_organization_membership_base_list_data_status.py b/src/workos/common/models/user_organization_membership_base_list_data_status.py index 9cc1d012..5cf029c0 100644 --- a/src/workos/common/models/user_organization_membership_base_list_data_status.py +++ b/src/workos/common/models/user_organization_membership_base_list_data_status.py @@ -1,11 +1,7 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias -from .organization_membership_created_data_status import ( - OrganizationMembershipCreatedDataStatus, -) +from .organization_membership_created_data_status import OrganizationMembershipCreatedDataStatus -UserOrganizationMembershipBaseListDataStatus: TypeAlias = ( - OrganizationMembershipCreatedDataStatus -) +UserOrganizationMembershipBaseListDataStatus: TypeAlias = OrganizationMembershipCreatedDataStatus __all__ = ["UserOrganizationMembershipBaseListDataStatus"] diff --git a/src/workos/common/models/user_organization_membership_status.py b/src/workos/common/models/user_organization_membership_status.py index 3559cb49..1bbbfc01 100644 --- a/src/workos/common/models/user_organization_membership_status.py +++ b/src/workos/common/models/user_organization_membership_status.py @@ -1,9 +1,7 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias -from .organization_membership_created_data_status import ( - OrganizationMembershipCreatedDataStatus, -) +from .organization_membership_created_data_status import OrganizationMembershipCreatedDataStatus UserOrganizationMembershipStatus: TypeAlias = OrganizationMembershipCreatedDataStatus __all__ = ["UserOrganizationMembershipStatus"] diff --git a/src/workos/common/models/user_updated.py b/src/workos/common/models/user_updated.py index d9467522..698ce0f7 100644 --- a/src/workos/common/models/user_updated.py +++ b/src/workos/common/models/user_updated.py @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "UserUpdated": data=User.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("UserUpdated", e) diff --git a/src/workos/common/models/vault_byok_key_verification_completed.py b/src/workos/common/models/vault_byok_key_verification_completed.py index bd191239..4405193f 100644 --- a/src/workos/common/models/vault_byok_key_verification_completed.py +++ b/src/workos/common/models/vault_byok_key_verification_completed.py @@ -10,9 +10,7 @@ from workos._types import _format_datetime, _parse_datetime from .event_context import EventContext -from .vault_byok_key_verification_completed_data import ( - VaultByokKeyVerificationCompletedData, -) +from .vault_byok_key_verification_completed_data import VaultByokKeyVerificationCompletedData @dataclass(slots=True) @@ -37,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "VaultByokKeyVerificationCompleted": return cls( id=data["id"], event=data["event"], - data=VaultByokKeyVerificationCompletedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=VaultByokKeyVerificationCompletedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("VaultByokKeyVerificationCompleted", e) diff --git a/src/workos/common/models/vault_byok_key_verification_completed_data.py b/src/workos/common/models/vault_byok_key_verification_completed_data.py index 0d9528d7..0c495e55 100644 --- a/src/workos/common/models/vault_byok_key_verification_completed_data.py +++ b/src/workos/common/models/vault_byok_key_verification_completed_data.py @@ -4,11 +4,10 @@ from dataclasses import dataclass from enum import Enum +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error -from .vault_byok_key_verification_completed_data_key_provider import ( - VaultByokKeyVerificationCompletedDataKeyProvider, -) +from .vault_byok_key_verification_completed_data_key_provider import VaultByokKeyVerificationCompletedDataKeyProvider @dataclass(slots=True) @@ -28,9 +27,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "VaultByokKeyVerificationCompletedDa try: return cls( organization_id=data["organization_id"], - key_provider=VaultByokKeyVerificationCompletedDataKeyProvider( - data["key_provider"] - ), + key_provider=VaultByokKeyVerificationCompletedDataKeyProvider(data["key_provider"]), verified=data["verified"], ) except (KeyError, ValueError) as e: @@ -40,10 +37,6 @@ def to_dict(self) -> Dict[str, Any]: """Serialize to a dictionary.""" result: Dict[str, Any] = {} result["organization_id"] = self.organization_id - result["key_provider"] = ( - self.key_provider.value - if isinstance(self.key_provider, Enum) - else self.key_provider - ) + result["key_provider"] = self.key_provider.value if isinstance(self.key_provider, Enum) else self.key_provider result["verified"] = self.verified return result diff --git a/src/workos/common/models/vault_byok_key_verification_completed_data_key_provider.py b/src/workos/common/models/vault_byok_key_verification_completed_data_key_provider.py index c63ba21d..249097ef 100644 --- a/src/workos/common/models/vault_byok_key_verification_completed_data_key_provider.py +++ b/src/workos/common/models/vault_byok_key_verification_completed_data_key_provider.py @@ -17,9 +17,7 @@ class VaultByokKeyVerificationCompletedDataKeyProvider(str, Enum): AZURE_KEY_VAULT = "AZURE_KEY_VAULT" @classmethod - def _missing_( - cls, value: object - ) -> Optional["VaultByokKeyVerificationCompletedDataKeyProvider"]: + def _missing_(cls, value: object) -> Optional["VaultByokKeyVerificationCompletedDataKeyProvider"]: if not isinstance(value, str): return None unknown = str.__new__(cls, value) @@ -27,7 +25,4 @@ def _missing_( unknown._value_ = value return unknown - -VaultByokKeyVerificationCompletedDataKeyProviderLiteral: TypeAlias = Literal[ - "AWS_KMS", "GCP_KMS", "AZURE_KEY_VAULT" -] +VaultByokKeyVerificationCompletedDataKeyProviderLiteral: TypeAlias = Literal["AWS_KMS", "GCP_KMS", "AZURE_KEY_VAULT"] diff --git a/src/workos/common/models/vault_data_created.py b/src/workos/common/models/vault_data_created.py index 34b6c53d..d22e4eae 100644 --- a/src/workos/common/models/vault_data_created.py +++ b/src/workos/common/models/vault_data_created.py @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "VaultDataCreated": data=VaultDataCreatedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("VaultDataCreated", e) diff --git a/src/workos/common/models/vault_data_created_data.py b/src/workos/common/models/vault_data_created_data.py index 4155b560..f8bd3ecf 100644 --- a/src/workos/common/models/vault_data_created_data.py +++ b/src/workos/common/models/vault_data_created_data.py @@ -4,6 +4,7 @@ from dataclasses import dataclass from enum import Enum +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error from .vault_data_created_data_actor_source import VaultDataCreatedDataActorSource @@ -43,11 +44,7 @@ def to_dict(self) -> Dict[str, Any]: """Serialize to a dictionary.""" result: Dict[str, Any] = {} result["actor_id"] = self.actor_id - result["actor_source"] = ( - self.actor_source.value - if isinstance(self.actor_source, Enum) - else self.actor_source - ) + result["actor_source"] = self.actor_source.value if isinstance(self.actor_source, Enum) else self.actor_source result["actor_name"] = self.actor_name result["kv_name"] = self.kv_name result["key_id"] = self.key_id diff --git a/src/workos/common/models/vault_data_created_data_actor_source.py b/src/workos/common/models/vault_data_created_data_actor_source.py index 94994e67..3676dfad 100644 --- a/src/workos/common/models/vault_data_created_data_actor_source.py +++ b/src/workos/common/models/vault_data_created_data_actor_source.py @@ -24,5 +24,4 @@ def _missing_(cls, value: object) -> Optional["VaultDataCreatedDataActorSource"] unknown._value_ = value return unknown - VaultDataCreatedDataActorSourceLiteral: TypeAlias = Literal["api", "dashboard"] diff --git a/src/workos/common/models/vault_data_deleted.py b/src/workos/common/models/vault_data_deleted.py index 32bff672..2ad58fef 100644 --- a/src/workos/common/models/vault_data_deleted.py +++ b/src/workos/common/models/vault_data_deleted.py @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "VaultDataDeleted": data=VaultDataDeletedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("VaultDataDeleted", e) diff --git a/src/workos/common/models/vault_data_deleted_data.py b/src/workos/common/models/vault_data_deleted_data.py index e3aa3ac1..ce3cdc01 100644 --- a/src/workos/common/models/vault_data_deleted_data.py +++ b/src/workos/common/models/vault_data_deleted_data.py @@ -4,6 +4,7 @@ from dataclasses import dataclass from enum import Enum +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error from .vault_data_deleted_data_actor_source import VaultDataDeletedDataActorSource @@ -38,11 +39,7 @@ def to_dict(self) -> Dict[str, Any]: """Serialize to a dictionary.""" result: Dict[str, Any] = {} result["actor_id"] = self.actor_id - result["actor_source"] = ( - self.actor_source.value - if isinstance(self.actor_source, Enum) - else self.actor_source - ) + result["actor_source"] = self.actor_source.value if isinstance(self.actor_source, Enum) else self.actor_source result["actor_name"] = self.actor_name result["kv_name"] = self.kv_name return result diff --git a/src/workos/common/models/vault_data_read.py b/src/workos/common/models/vault_data_read.py index e5a294fd..cde3f26b 100644 --- a/src/workos/common/models/vault_data_read.py +++ b/src/workos/common/models/vault_data_read.py @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "VaultDataRead": data=VaultDataReadData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("VaultDataRead", e) diff --git a/src/workos/common/models/vault_data_read_data.py b/src/workos/common/models/vault_data_read_data.py index 2efffdaa..f34133d8 100644 --- a/src/workos/common/models/vault_data_read_data.py +++ b/src/workos/common/models/vault_data_read_data.py @@ -4,6 +4,7 @@ from dataclasses import dataclass from enum import Enum +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error from .vault_data_read_data_actor_source import VaultDataReadDataActorSource @@ -41,11 +42,7 @@ def to_dict(self) -> Dict[str, Any]: """Serialize to a dictionary.""" result: Dict[str, Any] = {} result["actor_id"] = self.actor_id - result["actor_source"] = ( - self.actor_source.value - if isinstance(self.actor_source, Enum) - else self.actor_source - ) + result["actor_source"] = self.actor_source.value if isinstance(self.actor_source, Enum) else self.actor_source result["actor_name"] = self.actor_name result["kv_name"] = self.kv_name result["key_id"] = self.key_id diff --git a/src/workos/common/models/vault_data_updated.py b/src/workos/common/models/vault_data_updated.py index ae9e8bfd..068c4cb1 100644 --- a/src/workos/common/models/vault_data_updated.py +++ b/src/workos/common/models/vault_data_updated.py @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "VaultDataUpdated": data=VaultDataUpdatedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("VaultDataUpdated", e) diff --git a/src/workos/common/models/vault_dek_decrypted.py b/src/workos/common/models/vault_dek_decrypted.py index 64330a76..84cbe642 100644 --- a/src/workos/common/models/vault_dek_decrypted.py +++ b/src/workos/common/models/vault_dek_decrypted.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "VaultDekDecrypted": return cls( id=data["id"], event=data["event"], - data=VaultDekDecryptedData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=VaultDekDecryptedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("VaultDekDecrypted", e) diff --git a/src/workos/common/models/vault_dek_decrypted_data.py b/src/workos/common/models/vault_dek_decrypted_data.py index 88465979..9b033ce9 100644 --- a/src/workos/common/models/vault_dek_decrypted_data.py +++ b/src/workos/common/models/vault_dek_decrypted_data.py @@ -4,6 +4,7 @@ from dataclasses import dataclass from enum import Enum +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error from .vault_dek_decrypted_data_actor_source import VaultDekDecryptedDataActorSource @@ -38,11 +39,7 @@ def to_dict(self) -> Dict[str, Any]: """Serialize to a dictionary.""" result: Dict[str, Any] = {} result["actor_id"] = self.actor_id - result["actor_source"] = ( - self.actor_source.value - if isinstance(self.actor_source, Enum) - else self.actor_source - ) + result["actor_source"] = self.actor_source.value if isinstance(self.actor_source, Enum) else self.actor_source result["actor_name"] = self.actor_name result["key_id"] = self.key_id return result diff --git a/src/workos/common/models/vault_dek_read.py b/src/workos/common/models/vault_dek_read.py index e0ab75c4..de52525c 100644 --- a/src/workos/common/models/vault_dek_read.py +++ b/src/workos/common/models/vault_dek_read.py @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "VaultDekRead": data=VaultDekReadData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("VaultDekRead", e) diff --git a/src/workos/common/models/vault_dek_read_data.py b/src/workos/common/models/vault_dek_read_data.py index 10740165..ff859504 100644 --- a/src/workos/common/models/vault_dek_read_data.py +++ b/src/workos/common/models/vault_dek_read_data.py @@ -4,6 +4,7 @@ from dataclasses import dataclass from enum import Enum +from typing import cast from typing import Any, Dict, List from workos._types import _raise_deserialize_error from .vault_dek_read_data_actor_source import VaultDekReadDataActorSource @@ -40,11 +41,7 @@ def to_dict(self) -> Dict[str, Any]: """Serialize to a dictionary.""" result: Dict[str, Any] = {} result["actor_id"] = self.actor_id - result["actor_source"] = ( - self.actor_source.value - if isinstance(self.actor_source, Enum) - else self.actor_source - ) + result["actor_source"] = self.actor_source.value if isinstance(self.actor_source, Enum) else self.actor_source result["actor_name"] = self.actor_name result["key_ids"] = self.key_ids result["key_context"] = self.key_context diff --git a/src/workos/common/models/vault_kek_created.py b/src/workos/common/models/vault_kek_created.py index 6530258d..3cf4504c 100644 --- a/src/workos/common/models/vault_kek_created.py +++ b/src/workos/common/models/vault_kek_created.py @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "VaultKekCreated": data=VaultKekCreatedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("VaultKekCreated", e) diff --git a/src/workos/common/models/vault_kek_created_data.py b/src/workos/common/models/vault_kek_created_data.py index 975e0e96..2b66cb16 100644 --- a/src/workos/common/models/vault_kek_created_data.py +++ b/src/workos/common/models/vault_kek_created_data.py @@ -4,6 +4,7 @@ from dataclasses import dataclass from enum import Enum +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error from .vault_kek_created_data_actor_source import VaultKekCreatedDataActorSource @@ -41,11 +42,7 @@ def to_dict(self) -> Dict[str, Any]: """Serialize to a dictionary.""" result: Dict[str, Any] = {} result["actor_id"] = self.actor_id - result["actor_source"] = ( - self.actor_source.value - if isinstance(self.actor_source, Enum) - else self.actor_source - ) + result["actor_source"] = self.actor_source.value if isinstance(self.actor_source, Enum) else self.actor_source result["actor_name"] = self.actor_name result["key_name"] = self.key_name result["key_id"] = self.key_id diff --git a/src/workos/common/models/vault_metadata_read.py b/src/workos/common/models/vault_metadata_read.py index 37fe20dc..d527ee67 100644 --- a/src/workos/common/models/vault_metadata_read.py +++ b/src/workos/common/models/vault_metadata_read.py @@ -35,14 +35,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "VaultMetadataRead": return cls( id=data["id"], event=data["event"], - data=VaultMetadataReadData.from_dict( - cast(Dict[str, Any], data["data"]) - ), + data=VaultMetadataReadData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("VaultMetadataRead", e) diff --git a/src/workos/common/models/vault_names_listed.py b/src/workos/common/models/vault_names_listed.py index e9a4d22b..cb9bd9a1 100644 --- a/src/workos/common/models/vault_names_listed.py +++ b/src/workos/common/models/vault_names_listed.py @@ -38,9 +38,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "VaultNamesListed": data=VaultNamesListedData.from_dict(cast(Dict[str, Any], data["data"])), created_at=_parse_datetime(data["created_at"]), object=data["object"], - context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) - if (_v_context := data.get("context")) is not None - else None, + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("VaultNamesListed", e) diff --git a/src/workos/common/models/vault_names_listed_data.py b/src/workos/common/models/vault_names_listed_data.py index 99048d21..9e3684b7 100644 --- a/src/workos/common/models/vault_names_listed_data.py +++ b/src/workos/common/models/vault_names_listed_data.py @@ -4,6 +4,7 @@ from dataclasses import dataclass from enum import Enum +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error from .vault_names_listed_data_actor_source import VaultNamesListedDataActorSource @@ -35,10 +36,6 @@ def to_dict(self) -> Dict[str, Any]: """Serialize to a dictionary.""" result: Dict[str, Any] = {} result["actor_id"] = self.actor_id - result["actor_source"] = ( - self.actor_source.value - if isinstance(self.actor_source, Enum) - else self.actor_source - ) + result["actor_source"] = self.actor_source.value if isinstance(self.actor_source, Enum) else self.actor_source result["actor_name"] = self.actor_name return result diff --git a/src/workos/common/models/waitlist_user.py b/src/workos/common/models/waitlist_user.py new file mode 100644 index 00000000..176e274f --- /dev/null +++ b/src/workos/common/models/waitlist_user.py @@ -0,0 +1,63 @@ +# This file is auto-generated by oagen. Do not edit. + +from __future__ import annotations + +from dataclasses import dataclass +from datetime import datetime +from enum import Enum +from typing import cast +from typing import Any, Dict, Literal, Optional +from workos._types import _raise_deserialize_error +from workos._types import _format_datetime, _parse_datetime +from .waitlist_user_state import WaitlistUserState + + +@dataclass(slots=True) +class WaitlistUser: + """Waitlist User model.""" + + object: Literal["waitlist_user"] + """Distinguishes the Waitlist User object.""" + id: str + """The unique ID of the Waitlist User.""" + email: str + """The email address of the Waitlist User.""" + state: "WaitlistUserState" + """The state of the Waitlist User.""" + approved_at: Optional[datetime] + """The timestamp when the Waitlist User was approved, or null if not yet approved.""" + created_at: datetime + """An ISO 8601 timestamp.""" + updated_at: datetime + """An ISO 8601 timestamp.""" + + @classmethod + def from_dict(cls, data: Dict[str, Any]) -> "WaitlistUser": + """Deserialize from a dictionary.""" + try: + return cls( + object=data["object"], + id=data["id"], + email=data["email"], + state=WaitlistUserState(data["state"]), + approved_at=_parse_datetime(_v_approved_at) if (_v_approved_at := data["approved_at"]) is not None else None, + created_at=_parse_datetime(data["created_at"]), + updated_at=_parse_datetime(data["updated_at"]), + ) + except (KeyError, ValueError) as e: + _raise_deserialize_error("WaitlistUser", e) + + def to_dict(self) -> Dict[str, Any]: + """Serialize to a dictionary.""" + result: Dict[str, Any] = {} + result["object"] = self.object + result["id"] = self.id + result["email"] = self.email + result["state"] = self.state.value if isinstance(self.state, Enum) else self.state + if self.approved_at is not None: + result["approved_at"] = _format_datetime(self.approved_at) + else: + result["approved_at"] = None + result["created_at"] = _format_datetime(self.created_at) + result["updated_at"] = _format_datetime(self.updated_at) + return result diff --git a/src/workos/common/models/waitlist_user_approved.py b/src/workos/common/models/waitlist_user_approved.py new file mode 100644 index 00000000..b75d4d91 --- /dev/null +++ b/src/workos/common/models/waitlist_user_approved.py @@ -0,0 +1,56 @@ +# This file is auto-generated by oagen. Do not edit. + +from __future__ import annotations + +from dataclasses import dataclass +from datetime import datetime +from typing import cast +from typing import Any, Dict, Literal, Optional +from workos._types import _raise_deserialize_error +from workos._types import _format_datetime, _parse_datetime + +from .event_context import EventContext +from .waitlist_user import WaitlistUser + + +@dataclass(slots=True) +class WaitlistUserApproved: + """Waitlist User Approved model.""" + + id: str + """Unique identifier for the event.""" + event: Literal["waitlist_user.approved"] + data: "WaitlistUser" + """The event payload.""" + created_at: datetime + """An ISO 8601 timestamp.""" + object: Literal["event"] + """Distinguishes the Event object.""" + context: Optional["EventContext"] = None + + @classmethod + def from_dict(cls, data: Dict[str, Any]) -> "WaitlistUserApproved": + """Deserialize from a dictionary.""" + try: + return cls( + id=data["id"], + event=data["event"], + data=WaitlistUser.from_dict(cast(Dict[str, Any], data["data"])), + created_at=_parse_datetime(data["created_at"]), + object=data["object"], + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, + ) + except (KeyError, ValueError) as e: + _raise_deserialize_error("WaitlistUserApproved", e) + + def to_dict(self) -> Dict[str, Any]: + """Serialize to a dictionary.""" + result: Dict[str, Any] = {} + result["id"] = self.id + result["event"] = self.event + result["data"] = self.data.to_dict() + result["created_at"] = _format_datetime(self.created_at) + result["object"] = self.object + if self.context is not None: + result["context"] = self.context.to_dict() + return result diff --git a/src/workos/common/models/waitlist_user_created.py b/src/workos/common/models/waitlist_user_created.py new file mode 100644 index 00000000..8ae6ff14 --- /dev/null +++ b/src/workos/common/models/waitlist_user_created.py @@ -0,0 +1,56 @@ +# This file is auto-generated by oagen. Do not edit. + +from __future__ import annotations + +from dataclasses import dataclass +from datetime import datetime +from typing import cast +from typing import Any, Dict, Literal, Optional +from workos._types import _raise_deserialize_error +from workos._types import _format_datetime, _parse_datetime + +from .event_context import EventContext +from .waitlist_user import WaitlistUser + + +@dataclass(slots=True) +class WaitlistUserCreated: + """Waitlist User Created model.""" + + id: str + """Unique identifier for the event.""" + event: Literal["waitlist_user.created"] + data: "WaitlistUser" + """The event payload.""" + created_at: datetime + """An ISO 8601 timestamp.""" + object: Literal["event"] + """Distinguishes the Event object.""" + context: Optional["EventContext"] = None + + @classmethod + def from_dict(cls, data: Dict[str, Any]) -> "WaitlistUserCreated": + """Deserialize from a dictionary.""" + try: + return cls( + id=data["id"], + event=data["event"], + data=WaitlistUser.from_dict(cast(Dict[str, Any], data["data"])), + created_at=_parse_datetime(data["created_at"]), + object=data["object"], + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, + ) + except (KeyError, ValueError) as e: + _raise_deserialize_error("WaitlistUserCreated", e) + + def to_dict(self) -> Dict[str, Any]: + """Serialize to a dictionary.""" + result: Dict[str, Any] = {} + result["id"] = self.id + result["event"] = self.event + result["data"] = self.data.to_dict() + result["created_at"] = _format_datetime(self.created_at) + result["object"] = self.object + if self.context is not None: + result["context"] = self.context.to_dict() + return result diff --git a/src/workos/common/models/waitlist_user_denied.py b/src/workos/common/models/waitlist_user_denied.py new file mode 100644 index 00000000..9397ca41 --- /dev/null +++ b/src/workos/common/models/waitlist_user_denied.py @@ -0,0 +1,56 @@ +# This file is auto-generated by oagen. Do not edit. + +from __future__ import annotations + +from dataclasses import dataclass +from datetime import datetime +from typing import cast +from typing import Any, Dict, Literal, Optional +from workos._types import _raise_deserialize_error +from workos._types import _format_datetime, _parse_datetime + +from .event_context import EventContext +from .waitlist_user import WaitlistUser + + +@dataclass(slots=True) +class WaitlistUserDenied: + """Waitlist User Denied model.""" + + id: str + """Unique identifier for the event.""" + event: Literal["waitlist_user.denied"] + data: "WaitlistUser" + """The event payload.""" + created_at: datetime + """An ISO 8601 timestamp.""" + object: Literal["event"] + """Distinguishes the Event object.""" + context: Optional["EventContext"] = None + + @classmethod + def from_dict(cls, data: Dict[str, Any]) -> "WaitlistUserDenied": + """Deserialize from a dictionary.""" + try: + return cls( + id=data["id"], + event=data["event"], + data=WaitlistUser.from_dict(cast(Dict[str, Any], data["data"])), + created_at=_parse_datetime(data["created_at"]), + object=data["object"], + context=EventContext.from_dict(cast(Dict[str, Any], _v_context)) if (_v_context := data.get("context")) is not None else None, + ) + except (KeyError, ValueError) as e: + _raise_deserialize_error("WaitlistUserDenied", e) + + def to_dict(self) -> Dict[str, Any]: + """Serialize to a dictionary.""" + result: Dict[str, Any] = {} + result["id"] = self.id + result["event"] = self.event + result["data"] = self.data.to_dict() + result["created_at"] = _format_datetime(self.created_at) + result["object"] = self.object + if self.context is not None: + result["context"] = self.context.to_dict() + return result diff --git a/src/workos/common/models/waitlist_user_state.py b/src/workos/common/models/waitlist_user_state.py new file mode 100644 index 00000000..2667e154 --- /dev/null +++ b/src/workos/common/models/waitlist_user_state.py @@ -0,0 +1,28 @@ +# This file is auto-generated by oagen. Do not edit. + +"""Enumeration of waitlist user state values.""" + +from __future__ import annotations + +from enum import Enum +from typing import Optional +from typing import Literal, TypeAlias + + +class WaitlistUserState(str, Enum): + """Known values for WaitlistUserState.""" + + PENDING = "pending" + APPROVED = "approved" + DENIED = "denied" + + @classmethod + def _missing_(cls, value: object) -> Optional["WaitlistUserState"]: + if not isinstance(value, str): + return None + unknown = str.__new__(cls, value) + unknown._name_ = value.upper() + unknown._value_ = value + return unknown + +WaitlistUserStateLiteral: TypeAlias = Literal["pending", "approved", "denied"] diff --git a/src/workos/common/models/widget_session_token_scopes.py b/src/workos/common/models/widget_session_token_scopes.py index ac8d3017..84f175bd 100644 --- a/src/workos/common/models/widget_session_token_scopes.py +++ b/src/workos/common/models/widget_session_token_scopes.py @@ -28,12 +28,4 @@ def _missing_(cls, value: object) -> Optional["WidgetSessionTokenScopes"]: unknown._value_ = value return unknown - -WidgetSessionTokenScopesLiteral: TypeAlias = Literal[ - "widgets:users-table:manage", - "widgets:domain-verification:manage", - "widgets:sso:manage", - "widgets:api-keys:manage", - "widgets:dsync:manage", - "widgets:audit-log-streaming:manage", -] +WidgetSessionTokenScopesLiteral: TypeAlias = Literal["widgets:users-table:manage", "widgets:domain-verification:manage", "widgets:sso:manage", "widgets:api-keys:manage", "widgets:dsync:manage", "widgets:audit-log-streaming:manage"] diff --git a/src/workos/connect/_resource.py b/src/workos/connect/_resource.py index e7b474de..163f6361 100644 --- a/src/workos/connect/_resource.py +++ b/src/workos/connect/_resource.py @@ -2,27 +2,16 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union, cast +from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Type, Union, cast if TYPE_CHECKING: from .._client import AsyncWorkOSClient, WorkOSClient from .._types import RequestOptions, enum_value -from .models import ( - ApplicationCredentialsListItem, - ConnectApplication, - CreateM2MApplication, - CreateOAuthApplication, - ExternalAuthCompleteResponse, - NewConnectApplicationSecret, - RedirectUriInput, - UserConsentOption, - UserObject, -) +from .models import ApplicationCredentialsListItem, ConnectApplication, CreateApplicationSecret, CreateM2MApplication, CreateOAuthApplication, ExternalAuthCompleteResponse, NewConnectApplicationSecret, RedirectUriInput, UpdateOAuthApplication, UserConsentOption, UserManagementLoginRequest, UserObject from .models import ApplicationsOrder from .._pagination import AsyncPage, SyncPage - class Connect: """Connect API resources.""" @@ -67,19 +56,11 @@ def complete_oauth2( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "external_auth_id": external_auth_id, - "user": user.to_dict(), - "user_consent_options": [ - item.to_dict() for item in user_consent_options - ] - if user_consent_options is not None - else None, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "external_auth_id": external_auth_id, + "user": user.to_dict(), + "user_consent_options": [item.to_dict() for item in user_consent_options] if user_consent_options is not None else None, + }.items() if v is not None} return self._client.request( method="post", path="authkit/oauth2/complete", @@ -119,17 +100,13 @@ def list_applications( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - "organization_id": organization_id, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + "organization_id": organization_id, + }.items() if v is not None} return self._client.request_page( method="get", path="connect/applications", @@ -298,18 +275,12 @@ def update_application( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "name": name, - "description": description, - "scopes": scopes, - "redirect_uris": [item.to_dict() for item in redirect_uris] - if redirect_uris is not None - else None, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "name": name, + "description": description, + "scopes": scopes, + "redirect_uris": [item.to_dict() for item in redirect_uris] if redirect_uris is not None else None, + }.items() if v is not None} return self._client.request( method="put", path=f"connect/applications/{id}", @@ -372,10 +343,7 @@ def list_application_client_secrets( path=f"connect/applications/{id}/client_secrets", request_options=request_options, ) - return [ - ApplicationCredentialsListItem.from_dict(cast(Dict[str, Any], item)) - for item in raw - ] + return [ApplicationCredentialsListItem.from_dict(cast(Dict[str, Any], item)) for item in raw] def create_application_client_secret( self, @@ -481,19 +449,11 @@ async def complete_oauth2( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "external_auth_id": external_auth_id, - "user": user.to_dict(), - "user_consent_options": [ - item.to_dict() for item in user_consent_options - ] - if user_consent_options is not None - else None, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "external_auth_id": external_auth_id, + "user": user.to_dict(), + "user_consent_options": [item.to_dict() for item in user_consent_options] if user_consent_options is not None else None, + }.items() if v is not None} return await self._client.request( method="post", path="authkit/oauth2/complete", @@ -533,17 +493,13 @@ async def list_applications( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - "organization_id": organization_id, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + "organization_id": organization_id, + }.items() if v is not None} return await self._client.request_page( method="get", path="connect/applications", @@ -712,18 +668,12 @@ async def update_application( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "name": name, - "description": description, - "scopes": scopes, - "redirect_uris": [item.to_dict() for item in redirect_uris] - if redirect_uris is not None - else None, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "name": name, + "description": description, + "scopes": scopes, + "redirect_uris": [item.to_dict() for item in redirect_uris] if redirect_uris is not None else None, + }.items() if v is not None} return await self._client.request( method="put", path=f"connect/applications/{id}", @@ -786,10 +736,7 @@ async def list_application_client_secrets( path=f"connect/applications/{id}/client_secrets", request_options=request_options, ) - return [ - ApplicationCredentialsListItem.from_dict(cast(Dict[str, Any], item)) - for item in raw - ] + return [ApplicationCredentialsListItem.from_dict(cast(Dict[str, Any], item)) for item in raw] async def create_application_client_secret( self, diff --git a/src/workos/connect/models/__init__.py b/src/workos/connect/models/__init__.py index 47c3afac..c6810b2f 100644 --- a/src/workos/connect/models/__init__.py +++ b/src/workos/connect/models/__init__.py @@ -1,28 +1,16 @@ # This file is auto-generated by oagen. Do not edit. -from .application_credentials_list_item import ( - ApplicationCredentialsListItem as ApplicationCredentialsListItem, -) +from .application_credentials_list_item import ApplicationCredentialsListItem as ApplicationCredentialsListItem from .applications_order import ApplicationsOrder as ApplicationsOrder from .connect_application import ConnectApplication as ConnectApplication -from .create_application_secret import ( - CreateApplicationSecret as CreateApplicationSecret, -) +from .create_application_secret import CreateApplicationSecret as CreateApplicationSecret from .create_m2m_application import CreateM2MApplication as CreateM2MApplication from .create_oauth_application import CreateOAuthApplication as CreateOAuthApplication -from .external_auth_complete_response import ( - ExternalAuthCompleteResponse as ExternalAuthCompleteResponse, -) -from .new_connect_application_secret import ( - NewConnectApplicationSecret as NewConnectApplicationSecret, -) +from .external_auth_complete_response import ExternalAuthCompleteResponse as ExternalAuthCompleteResponse +from .new_connect_application_secret import NewConnectApplicationSecret as NewConnectApplicationSecret from .redirect_uri_input import RedirectUriInput as RedirectUriInput from .update_oauth_application import UpdateOAuthApplication as UpdateOAuthApplication from .user_consent_option import UserConsentOption as UserConsentOption -from .user_consent_option_choice import ( - UserConsentOptionChoice as UserConsentOptionChoice, -) -from .user_management_login_request import ( - UserManagementLoginRequest as UserManagementLoginRequest, -) +from .user_consent_option_choice import UserConsentOptionChoice as UserConsentOptionChoice +from .user_management_login_request import UserManagementLoginRequest as UserManagementLoginRequest from .user_object import UserObject as UserObject diff --git a/src/workos/connect/models/application_credentials_list_item.py b/src/workos/connect/models/application_credentials_list_item.py index 228c311d..a8c9e9e4 100644 --- a/src/workos/connect/models/application_credentials_list_item.py +++ b/src/workos/connect/models/application_credentials_list_item.py @@ -4,6 +4,7 @@ from dataclasses import dataclass from datetime import datetime +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 diff --git a/src/workos/connect/models/applications_order.py b/src/workos/connect/models/applications_order.py index 15ae48f3..7e284d0f 100644 --- a/src/workos/connect/models/applications_order.py +++ b/src/workos/connect/models/applications_order.py @@ -25,5 +25,4 @@ def _missing_(cls, value: object) -> Optional["ApplicationsOrder"]: unknown._value_ = value return unknown - ApplicationsOrderLiteral: TypeAlias = Literal["normal", "desc", "asc"] diff --git a/src/workos/connect/models/connect_application.py b/src/workos/connect/models/connect_application.py index 67c5a038..14148364 100644 --- a/src/workos/connect/models/connect_application.py +++ b/src/workos/connect/models/connect_application.py @@ -4,6 +4,7 @@ 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 diff --git a/src/workos/connect/models/create_application_secret.py b/src/workos/connect/models/create_application_secret.py index 94dba52c..91ce00dd 100644 --- a/src/workos/connect/models/create_application_secret.py +++ b/src/workos/connect/models/create_application_secret.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error @@ -11,11 +12,13 @@ class CreateApplicationSecret: """Create Application Secret model.""" + @classmethod def from_dict(cls, data: Dict[str, Any]) -> "CreateApplicationSecret": """Deserialize from a dictionary.""" try: - return cls() + return cls( + ) except (KeyError, ValueError) as e: _raise_deserialize_error("CreateApplicationSecret", e) diff --git a/src/workos/connect/models/create_m2m_application.py b/src/workos/connect/models/create_m2m_application.py index d80b91c0..4966aaf8 100644 --- a/src/workos/connect/models/create_m2m_application.py +++ b/src/workos/connect/models/create_m2m_application.py @@ -3,6 +3,7 @@ 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 diff --git a/src/workos/connect/models/create_oauth_application.py b/src/workos/connect/models/create_oauth_application.py index 5f98d730..4446453a 100644 --- a/src/workos/connect/models/create_oauth_application.py +++ b/src/workos/connect/models/create_oauth_application.py @@ -41,12 +41,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "CreateOAuthApplication": is_first_party=data["is_first_party"], description=data.get("description"), scopes=data.get("scopes"), - redirect_uris=[ - RedirectUriInput.from_dict(cast(Dict[str, Any], item)) - for item in cast(list[Any], _v_redirect_uris) - ] - if (_v_redirect_uris := data.get("redirect_uris")) is not None - else None, + redirect_uris=[RedirectUriInput.from_dict(cast(Dict[str, Any], item)) for item in cast(list[Any], _v_redirect_uris)] if (_v_redirect_uris := data.get("redirect_uris")) is not None else None, uses_pkce=data.get("uses_pkce"), organization_id=data.get("organization_id"), ) diff --git a/src/workos/connect/models/external_auth_complete_response.py b/src/workos/connect/models/external_auth_complete_response.py index ec3ce6c2..b61bb466 100644 --- a/src/workos/connect/models/external_auth_complete_response.py +++ b/src/workos/connect/models/external_auth_complete_response.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error diff --git a/src/workos/connect/models/new_connect_application_secret.py b/src/workos/connect/models/new_connect_application_secret.py index 0c917ff6..a8f220f5 100644 --- a/src/workos/connect/models/new_connect_application_secret.py +++ b/src/workos/connect/models/new_connect_application_secret.py @@ -4,6 +4,7 @@ from dataclasses import dataclass from datetime import datetime +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 diff --git a/src/workos/connect/models/redirect_uri_input.py b/src/workos/connect/models/redirect_uri_input.py index aa67623f..f180bdb8 100644 --- a/src/workos/connect/models/redirect_uri_input.py +++ b/src/workos/connect/models/redirect_uri_input.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Optional from workos._types import _raise_deserialize_error diff --git a/src/workos/connect/models/update_oauth_application.py b/src/workos/connect/models/update_oauth_application.py index f555cffb..33175c10 100644 --- a/src/workos/connect/models/update_oauth_application.py +++ b/src/workos/connect/models/update_oauth_application.py @@ -31,12 +31,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "UpdateOAuthApplication": name=data.get("name"), description=data.get("description"), scopes=data.get("scopes"), - redirect_uris=[ - RedirectUriInput.from_dict(cast(Dict[str, Any], item)) - for item in cast(list[Any], _v_redirect_uris) - ] - if (_v_redirect_uris := data.get("redirect_uris")) is not None - else None, + redirect_uris=[RedirectUriInput.from_dict(cast(Dict[str, Any], item)) for item in cast(list[Any], _v_redirect_uris)] if (_v_redirect_uris := data.get("redirect_uris")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("UpdateOAuthApplication", e) diff --git a/src/workos/connect/models/user_consent_option.py b/src/workos/connect/models/user_consent_option.py index 5d123969..19177e4b 100644 --- a/src/workos/connect/models/user_consent_option.py +++ b/src/workos/connect/models/user_consent_option.py @@ -31,10 +31,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "UserConsentOption": claim=data["claim"], type=data["type"], label=data["label"], - choices=[ - UserConsentOptionChoice.from_dict(cast(Dict[str, Any], item)) - for item in cast(list[Any], data["choices"]) - ], + choices=[UserConsentOptionChoice.from_dict(cast(Dict[str, Any], item)) for item in cast(list[Any], data["choices"])], ) except (KeyError, ValueError) as e: _raise_deserialize_error("UserConsentOption", e) diff --git a/src/workos/connect/models/user_consent_option_choice.py b/src/workos/connect/models/user_consent_option_choice.py index 0639bb65..4bf10738 100644 --- a/src/workos/connect/models/user_consent_option_choice.py +++ b/src/workos/connect/models/user_consent_option_choice.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Optional from workos._types import _raise_deserialize_error diff --git a/src/workos/connect/models/user_management_login_request.py b/src/workos/connect/models/user_management_login_request.py index c1ebac9a..38c8d09d 100644 --- a/src/workos/connect/models/user_management_login_request.py +++ b/src/workos/connect/models/user_management_login_request.py @@ -29,13 +29,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "UserManagementLoginRequest": return cls( external_auth_id=data["external_auth_id"], user=UserObject.from_dict(cast(Dict[str, Any], data["user"])), - user_consent_options=[ - UserConsentOption.from_dict(cast(Dict[str, Any], item)) - for item in cast(list[Any], _v_user_consent_options) - ] - if (_v_user_consent_options := data.get("user_consent_options")) - is not None - else None, + user_consent_options=[UserConsentOption.from_dict(cast(Dict[str, Any], item)) for item in cast(list[Any], _v_user_consent_options)] if (_v_user_consent_options := data.get("user_consent_options")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("UserManagementLoginRequest", e) @@ -46,7 +40,5 @@ def to_dict(self) -> Dict[str, Any]: result["external_auth_id"] = self.external_auth_id result["user"] = self.user.to_dict() if self.user_consent_options is not None: - result["user_consent_options"] = [ - item.to_dict() for item in self.user_consent_options - ] + result["user_consent_options"] = [item.to_dict() for item in self.user_consent_options] return result diff --git a/src/workos/connect/models/user_object.py b/src/workos/connect/models/user_object.py index 94bd3a27..1dcf7fba 100644 --- a/src/workos/connect/models/user_object.py +++ b/src/workos/connect/models/user_object.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Optional from workos._types import _raise_deserialize_error diff --git a/src/workos/directory_sync/_resource.py b/src/workos/directory_sync/_resource.py index d183730e..df9562f1 100644 --- a/src/workos/directory_sync/_resource.py +++ b/src/workos/directory_sync/_resource.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Optional, Union +from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Type, Union, cast if TYPE_CHECKING: from .._client import AsyncWorkOSClient, WorkOSClient @@ -12,7 +12,6 @@ from .models import DirectoriesOrder, DirectoryGroupsOrder, DirectoryUsersOrder from .._pagination import AsyncPage, SyncPage - class DirectorySync: """Directory Sync API resources.""" @@ -55,19 +54,15 @@ def list_directories( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - "organization_id": organization_id, - "search": search, - "domain": domain, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + "organization_id": organization_id, + "search": search, + "domain": domain, + }.items() if v is not None} return self._client.request_page( method="get", path="directories", @@ -168,18 +163,14 @@ def list_groups( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - "directory": directory, - "user": user, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + "directory": directory, + "user": user, + }.items() if v is not None} return self._client.request_page( method="get", path="directory_groups", @@ -254,18 +245,14 @@ def list_users( AuthenticationError: If the API key is invalid (401). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - "directory": directory, - "group": group, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + "directory": directory, + "group": group, + }.items() if v is not None} return self._client.request_page( method="get", path="directory_users", @@ -348,19 +335,15 @@ async def list_directories( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - "organization_id": organization_id, - "search": search, - "domain": domain, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + "organization_id": organization_id, + "search": search, + "domain": domain, + }.items() if v is not None} return await self._client.request_page( method="get", path="directories", @@ -461,18 +444,14 @@ async def list_groups( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - "directory": directory, - "user": user, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + "directory": directory, + "user": user, + }.items() if v is not None} return await self._client.request_page( method="get", path="directory_groups", @@ -547,18 +526,14 @@ async def list_users( AuthenticationError: If the API key is invalid (401). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - "directory": directory, - "group": group, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + "directory": directory, + "group": group, + }.items() if v is not None} return await self._client.request_page( method="get", path="directory_users", diff --git a/src/workos/directory_sync/models/__init__.py b/src/workos/directory_sync/models/__init__.py index 7857cdb8..dc06733b 100644 --- a/src/workos/directory_sync/models/__init__.py +++ b/src/workos/directory_sync/models/__init__.py @@ -6,10 +6,6 @@ from .directory_groups_order import DirectoryGroupsOrder as DirectoryGroupsOrder from .directory_metadata import DirectoryMetadata as DirectoryMetadata from .directory_metadata_user import DirectoryMetadataUser as DirectoryMetadataUser -from .directory_user_with_groups import ( - DirectoryUserWithGroups as DirectoryUserWithGroups, -) -from .directory_user_with_groups_email import ( - DirectoryUserWithGroupsEmail as DirectoryUserWithGroupsEmail, -) +from .directory_user_with_groups import DirectoryUserWithGroups as DirectoryUserWithGroups +from .directory_user_with_groups_email import DirectoryUserWithGroupsEmail as DirectoryUserWithGroupsEmail from .directory_users_order import DirectoryUsersOrder as DirectoryUsersOrder diff --git a/src/workos/directory_sync/models/directory.py b/src/workos/directory_sync/models/directory.py index 89f2926b..66634e79 100644 --- a/src/workos/directory_sync/models/directory.py +++ b/src/workos/directory_sync/models/directory.py @@ -57,9 +57,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "Directory": created_at=_parse_datetime(data["created_at"]), updated_at=_parse_datetime(data["updated_at"]), domain=data.get("domain"), - metadata=DirectoryMetadata.from_dict(cast(Dict[str, Any], _v_metadata)) - if (_v_metadata := data.get("metadata")) is not None - else None, + metadata=DirectoryMetadata.from_dict(cast(Dict[str, Any], _v_metadata)) if (_v_metadata := data.get("metadata")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("Directory", e) @@ -72,9 +70,7 @@ def to_dict(self) -> Dict[str, Any]: result["organization_id"] = self.organization_id result["external_key"] = self.external_key result["type"] = self.type.value if isinstance(self.type, Enum) else self.type - result["state"] = ( - self.state.value if isinstance(self.state, Enum) else self.state - ) + result["state"] = self.state.value if isinstance(self.state, Enum) else self.state result["name"] = self.name result["created_at"] = _format_datetime(self.created_at) result["updated_at"] = _format_datetime(self.updated_at) diff --git a/src/workos/directory_sync/models/directory_group.py b/src/workos/directory_sync/models/directory_group.py index 63a4c39f..38ba8eb6 100644 --- a/src/workos/directory_sync/models/directory_group.py +++ b/src/workos/directory_sync/models/directory_group.py @@ -4,6 +4,7 @@ from dataclasses import dataclass from datetime import datetime +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 diff --git a/src/workos/directory_sync/models/directory_metadata.py b/src/workos/directory_sync/models/directory_metadata.py index da591989..8ea59559 100644 --- a/src/workos/directory_sync/models/directory_metadata.py +++ b/src/workos/directory_sync/models/directory_metadata.py @@ -24,9 +24,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "DirectoryMetadata": """Deserialize from a dictionary.""" try: return cls( - users=DirectoryMetadataUser.from_dict( - cast(Dict[str, Any], data["users"]) - ), + users=DirectoryMetadataUser.from_dict(cast(Dict[str, Any], data["users"])), groups=data["groups"], ) except (KeyError, ValueError) as e: diff --git a/src/workos/directory_sync/models/directory_metadata_user.py b/src/workos/directory_sync/models/directory_metadata_user.py index f0fbc884..1dc88b2d 100644 --- a/src/workos/directory_sync/models/directory_metadata_user.py +++ b/src/workos/directory_sync/models/directory_metadata_user.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error diff --git a/src/workos/directory_sync/models/directory_user_with_groups.py b/src/workos/directory_sync/models/directory_user_with_groups.py index 2a9970f1..aa0a9e1a 100644 --- a/src/workos/directory_sync/models/directory_user_with_groups.py +++ b/src/workos/directory_sync/models/directory_user_with_groups.py @@ -13,9 +13,7 @@ from .directory_group import DirectoryGroup from .directory_user_with_groups_email import DirectoryUserWithGroupsEmail from workos.authorization.models.slim_role import SlimRole -from workos.common.models.directory_user_with_groups_state import ( - DirectoryUserWithGroupsState, -) +from workos.common.models.directory_user_with_groups_state import DirectoryUserWithGroupsState @dataclass(slots=True) @@ -42,8 +40,6 @@ class DirectoryUserWithGroups: """An ISO 8601 timestamp.""" updated_at: datetime """An ISO 8601 timestamp.""" - groups: List["DirectoryGroup"] - """The directory groups the user belongs to.""" first_name: Optional[str] = None """The first name of the user.""" last_name: Optional[str] = None @@ -67,6 +63,10 @@ class DirectoryUserWithGroups: role: Optional["SlimRole"] = None roles: Optional[List["SlimRole"]] = None """All roles assigned to the user.""" + groups: Optional[List["DirectoryGroup"]] = None + """The directory groups the user belongs to. Use the List Directory Groups endpoint with a user filter instead. + + .. deprecated:: This field is deprecated.""" @classmethod def from_dict(cls, data: Dict[str, Any]) -> "DirectoryUserWithGroups": @@ -83,30 +83,15 @@ def from_dict(cls, data: Dict[str, Any]) -> "DirectoryUserWithGroups": custom_attributes=data["custom_attributes"], created_at=_parse_datetime(data["created_at"]), updated_at=_parse_datetime(data["updated_at"]), - groups=[ - DirectoryGroup.from_dict(cast(Dict[str, Any], item)) - for item in cast(list[Any], data["groups"]) - ], first_name=data.get("first_name"), last_name=data.get("last_name"), - emails=[ - DirectoryUserWithGroupsEmail.from_dict(cast(Dict[str, Any], item)) - for item in cast(list[Any], _v_emails) - ] - if (_v_emails := data.get("emails")) is not None - else None, + emails=[DirectoryUserWithGroupsEmail.from_dict(cast(Dict[str, Any], item)) for item in cast(list[Any], _v_emails)] if (_v_emails := data.get("emails")) is not None else None, job_title=data.get("job_title"), username=data.get("username"), raw_attributes=data.get("raw_attributes"), - role=SlimRole.from_dict(cast(Dict[str, Any], _v_role)) - if (_v_role := data.get("role")) is not None - else None, - roles=[ - SlimRole.from_dict(cast(Dict[str, Any], item)) - for item in cast(list[Any], _v_roles) - ] - if (_v_roles := data.get("roles")) is not None - else None, + role=SlimRole.from_dict(cast(Dict[str, Any], _v_role)) if (_v_role := data.get("role")) is not None else None, + roles=[SlimRole.from_dict(cast(Dict[str, Any], item)) for item in cast(list[Any], _v_roles)] if (_v_roles := data.get("roles")) is not None else None, + groups=[DirectoryGroup.from_dict(cast(Dict[str, Any], item)) for item in cast(list[Any], _v_groups)] if (_v_groups := data.get("groups")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("DirectoryUserWithGroups", e) @@ -123,13 +108,10 @@ def to_dict(self) -> Dict[str, Any]: result["email"] = self.email else: result["email"] = None - result["state"] = ( - self.state.value if isinstance(self.state, Enum) else self.state - ) + result["state"] = self.state.value if isinstance(self.state, Enum) else self.state result["custom_attributes"] = self.custom_attributes result["created_at"] = _format_datetime(self.created_at) result["updated_at"] = _format_datetime(self.updated_at) - result["groups"] = [item.to_dict() for item in self.groups] if self.first_name is not None: result["first_name"] = self.first_name else: @@ -154,4 +136,6 @@ def to_dict(self) -> Dict[str, Any]: result["role"] = self.role.to_dict() if self.roles is not None: result["roles"] = [item.to_dict() for item in self.roles] + if self.groups is not None: + result["groups"] = [item.to_dict() for item in self.groups] return result diff --git a/src/workos/events/_resource.py b/src/workos/events/_resource.py index 4271433b..3980d3a3 100644 --- a/src/workos/events/_resource.py +++ b/src/workos/events/_resource.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import TYPE_CHECKING, List, Optional, Union, cast +from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Type, Union, cast if TYPE_CHECKING: from .._client import AsyncWorkOSClient, WorkOSClient @@ -12,7 +12,6 @@ from .models import EventsOrder from .._pagination import AsyncPage, SyncPage - class Events: """Events API resources.""" @@ -57,22 +56,16 @@ def list_events( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - "events": ",".join(str(v) for v in events) - if events is not None - else None, - "range_start": range_start, - "range_end": range_end, - "organization_id": organization_id, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + "events": ",".join(str(v) for v in events) if events is not None else None, + "range_start": range_start, + "range_end": range_end, + "organization_id": organization_id, + }.items() if v is not None} return cast( SyncPage[EventSchemaVariant], self._client.request_page( @@ -81,7 +74,7 @@ def list_events( model=EventSchema, # type: ignore[arg-type] # dispatcher; pagination only calls from_dict params=params, request_options=request_options, - ), + ) ) @@ -129,22 +122,16 @@ async def list_events( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - "events": ",".join(str(v) for v in events) - if events is not None - else None, - "range_start": range_start, - "range_end": range_end, - "organization_id": organization_id, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + "events": ",".join(str(v) for v in events) if events is not None else None, + "range_start": range_start, + "range_end": range_end, + "organization_id": organization_id, + }.items() if v is not None} return cast( AsyncPage[EventSchemaVariant], await self._client.request_page( @@ -153,5 +140,5 @@ async def list_events( model=EventSchema, # type: ignore[arg-type] # dispatcher; pagination only calls from_dict params=params, request_options=request_options, - ), + ) ) diff --git a/src/workos/events/models/event_list_list_metadata.py b/src/workos/events/models/event_list_list_metadata.py index e4a97a0d..bd2e6de8 100644 --- a/src/workos/events/models/event_list_list_metadata.py +++ b/src/workos/events/models/event_list_list_metadata.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Optional from workos._types import _raise_deserialize_error diff --git a/src/workos/events/models/event_schema.py b/src/workos/events/models/event_schema.py index 55d806f0..f275238c 100644 --- a/src/workos/events/models/event_schema.py +++ b/src/workos/events/models/event_schema.py @@ -7,44 +7,22 @@ from workos._types import _raise_deserialize_error from workos.common.models.action_authentication_denied import ActionAuthenticationDenied -from workos.common.models.action_user_registration_denied import ( - ActionUserRegistrationDenied, -) +from workos.common.models.action_user_registration_denied import ActionUserRegistrationDenied from workos.common.models.api_key_created import ApiKeyCreated from workos.common.models.api_key_revoked import ApiKeyRevoked -from workos.common.models.authentication_email_verification_failed import ( - AuthenticationEmailVerificationFailed, -) -from workos.common.models.authentication_email_verification_succeeded import ( - AuthenticationEmailVerificationSucceeded, -) -from workos.common.models.authentication_magic_auth_failed import ( - AuthenticationMagicAuthFailed, -) -from workos.common.models.authentication_magic_auth_succeeded import ( - AuthenticationMagicAuthSucceeded, -) +from workos.common.models.authentication_email_verification_failed import AuthenticationEmailVerificationFailed +from workos.common.models.authentication_email_verification_succeeded import AuthenticationEmailVerificationSucceeded +from workos.common.models.authentication_magic_auth_failed import AuthenticationMagicAuthFailed +from workos.common.models.authentication_magic_auth_succeeded import AuthenticationMagicAuthSucceeded from workos.common.models.authentication_mfa_failed import AuthenticationMFAFailed from workos.common.models.authentication_mfa_succeeded import AuthenticationMFASucceeded from workos.common.models.authentication_oauth_failed import AuthenticationOAuthFailed -from workos.common.models.authentication_oauth_succeeded import ( - AuthenticationOAuthSucceeded, -) -from workos.common.models.authentication_passkey_failed import ( - AuthenticationPasskeyFailed, -) -from workos.common.models.authentication_passkey_succeeded import ( - AuthenticationPasskeySucceeded, -) -from workos.common.models.authentication_password_failed import ( - AuthenticationPasswordFailed, -) -from workos.common.models.authentication_password_succeeded import ( - AuthenticationPasswordSucceeded, -) -from workos.common.models.authentication_radar_risk_detected import ( - AuthenticationRadarRiskDetected, -) +from workos.common.models.authentication_oauth_succeeded import AuthenticationOAuthSucceeded +from workos.common.models.authentication_passkey_failed import AuthenticationPasskeyFailed +from workos.common.models.authentication_passkey_succeeded import AuthenticationPasskeySucceeded +from workos.common.models.authentication_password_failed import AuthenticationPasswordFailed +from workos.common.models.authentication_password_succeeded import AuthenticationPasswordSucceeded +from workos.common.models.authentication_radar_risk_detected import AuthenticationRadarRiskDetected from workos.common.models.authentication_sso_failed import AuthenticationSSOFailed from workos.common.models.authentication_sso_started import AuthenticationSSOStarted from workos.common.models.authentication_sso_succeeded import AuthenticationSSOSucceeded @@ -52,12 +30,8 @@ from workos.common.models.connection_activated import ConnectionActivated from workos.common.models.connection_deactivated import ConnectionDeactivated from workos.common.models.connection_deleted import ConnectionDeleted -from workos.common.models.connection_saml_certificate_renewal_required import ( - ConnectionSAMLCertificateRenewalRequired, -) -from workos.common.models.connection_saml_certificate_renewed import ( - ConnectionSAMLCertificateRenewed, -) +from workos.common.models.connection_saml_certificate_renewal_required import ConnectionSAMLCertificateRenewalRequired +from workos.common.models.connection_saml_certificate_renewed import ConnectionSAMLCertificateRenewed from workos.common.models.dsync_activated import DsyncActivated from workos.common.models.dsync_deactivated import DsyncDeactivated from workos.common.models.dsync_deleted import DsyncDeleted @@ -89,19 +63,11 @@ from workos.common.models.organization_domain_created import OrganizationDomainCreated from workos.common.models.organization_domain_deleted import OrganizationDomainDeleted from workos.common.models.organization_domain_updated import OrganizationDomainUpdated -from workos.common.models.organization_domain_verification_failed import ( - OrganizationDomainVerificationFailed, -) +from workos.common.models.organization_domain_verification_failed import OrganizationDomainVerificationFailed from workos.common.models.organization_domain_verified import OrganizationDomainVerified -from workos.common.models.organization_membership_created import ( - OrganizationMembershipCreated, -) -from workos.common.models.organization_membership_deleted import ( - OrganizationMembershipDeleted, -) -from workos.common.models.organization_membership_updated import ( - OrganizationMembershipUpdated, -) +from workos.common.models.organization_membership_created import OrganizationMembershipCreated +from workos.common.models.organization_membership_deleted import OrganizationMembershipDeleted +from workos.common.models.organization_membership_updated import OrganizationMembershipUpdated from workos.common.models.organization_role_created import OrganizationRoleCreated from workos.common.models.organization_role_deleted import OrganizationRoleDeleted from workos.common.models.organization_role_updated import OrganizationRoleUpdated @@ -119,9 +85,7 @@ from workos.common.models.user_created import UserCreated from workos.common.models.user_deleted import UserDeleted from workos.common.models.user_updated import UserUpdated -from workos.common.models.vault_byok_key_verification_completed import ( - VaultByokKeyVerificationCompleted, -) +from workos.common.models.vault_byok_key_verification_completed import VaultByokKeyVerificationCompleted from workos.common.models.vault_data_created import VaultDataCreated from workos.common.models.vault_data_deleted import VaultDataDeleted from workos.common.models.vault_data_read import VaultDataRead @@ -131,6 +95,9 @@ from workos.common.models.vault_kek_created import VaultKekCreated from workos.common.models.vault_metadata_read import VaultMetadataRead from workos.common.models.vault_names_listed import VaultNamesListed +from workos.common.models.waitlist_user_approved import WaitlistUserApproved +from workos.common.models.waitlist_user_created import WaitlistUserCreated +from workos.common.models.waitlist_user_denied import WaitlistUserDenied @dataclass(slots=True) @@ -240,6 +207,9 @@ def to_dict(self) -> Dict[str, Any]: VaultKekCreated, VaultMetadataRead, VaultNamesListed, + WaitlistUserApproved, + WaitlistUserCreated, + WaitlistUserDenied, EventSchemaUnknown, ] @@ -337,20 +307,19 @@ class EventSchema: "vault.kek.created": VaultKekCreated, "vault.metadata.read": VaultMetadataRead, "vault.names.listed": VaultNamesListed, + "waitlist_user.approved": WaitlistUserApproved, + "waitlist_user.created": WaitlistUserCreated, + "waitlist_user.denied": WaitlistUserDenied, } @classmethod def from_dict(cls, data: Dict[str, Any]) -> "EventSchemaVariant": """Deserialize from a dictionary, dispatching to the correct variant.""" if "event" not in data: - _raise_deserialize_error( - "EventSchema", ValueError("Missing required field 'event'") - ) + _raise_deserialize_error("EventSchema", ValueError("Missing required field 'event'")) disc_value = data["event"] if disc_value is None: - _raise_deserialize_error( - "EventSchema", ValueError("event must not be None") - ) + _raise_deserialize_error("EventSchema", ValueError("event must not be None")) dispatch_cls = cls._DISPATCH.get(disc_value) if dispatch_cls is not None: return cast("EventSchemaVariant", dispatch_cls.from_dict(data)) diff --git a/src/workos/feature_flags/_resource.py b/src/workos/feature_flags/_resource.py index b1da5d77..6e1a6502 100644 --- a/src/workos/feature_flags/_resource.py +++ b/src/workos/feature_flags/_resource.py @@ -2,21 +2,16 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Optional, Union +from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Type, Union, cast if TYPE_CHECKING: from .._client import AsyncWorkOSClient, WorkOSClient from .._types import RequestOptions, enum_value from .models import FeatureFlag, Flag -from .models import ( - FeatureFlagsOrder, - OrganizationsFeatureFlagsOrder, - UserManagementUsersFeatureFlagsOrder, -) +from .models import FeatureFlagsOrder, OrganizationsFeatureFlagsOrder, UserManagementUsersFeatureFlagsOrder from .._pagination import AsyncPage, SyncPage - class FeatureFlags: """Feature Flags API resources.""" @@ -54,16 +49,12 @@ def list_feature_flags( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + }.items() if v is not None} return self._client.request_page( method="get", path="feature-flags", @@ -253,16 +244,12 @@ def list_organization_feature_flags( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + }.items() if v is not None} return self._client.request_page( method="get", path=f"organizations/{organization_id}/feature-flags", @@ -302,16 +289,12 @@ def list_user_feature_flags( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + }.items() if v is not None} return self._client.request_page( method="get", path=f"user_management/users/{user_id}/feature-flags", @@ -358,16 +341,12 @@ async def list_feature_flags( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + }.items() if v is not None} return await self._client.request_page( method="get", path="feature-flags", @@ -557,16 +536,12 @@ async def list_organization_feature_flags( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + }.items() if v is not None} return await self._client.request_page( method="get", path=f"organizations/{organization_id}/feature-flags", @@ -606,16 +581,12 @@ async def list_user_feature_flags( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + }.items() if v is not None} return await self._client.request_page( method="get", path=f"user_management/users/{user_id}/feature-flags", diff --git a/src/workos/feature_flags/models/__init__.py b/src/workos/feature_flags/models/__init__.py index 27979c7c..19f86aa6 100644 --- a/src/workos/feature_flags/models/__init__.py +++ b/src/workos/feature_flags/models/__init__.py @@ -5,9 +5,5 @@ from .feature_flags_order import FeatureFlagsOrder as FeatureFlagsOrder from .flag import Flag as Flag from .flag_owner import FlagOwner as FlagOwner -from .organizations_feature_flags_order import ( - OrganizationsFeatureFlagsOrder as OrganizationsFeatureFlagsOrder, -) -from .user_management_users_feature_flags_order import ( - UserManagementUsersFeatureFlagsOrder as UserManagementUsersFeatureFlagsOrder, -) +from .organizations_feature_flags_order import OrganizationsFeatureFlagsOrder as OrganizationsFeatureFlagsOrder +from .user_management_users_feature_flags_order import UserManagementUsersFeatureFlagsOrder as UserManagementUsersFeatureFlagsOrder diff --git a/src/workos/feature_flags/models/feature_flag.py b/src/workos/feature_flags/models/feature_flag.py index c89d037f..a8edfdbd 100644 --- a/src/workos/feature_flags/models/feature_flag.py +++ b/src/workos/feature_flags/models/feature_flag.py @@ -49,9 +49,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "FeatureFlag": slug=data["slug"], name=data["name"], description=data["description"], - owner=FeatureFlagOwner.from_dict(cast(Dict[str, Any], _v_owner)) - if (_v_owner := data["owner"]) is not None - else None, + owner=FeatureFlagOwner.from_dict(cast(Dict[str, Any], _v_owner)) if (_v_owner := data["owner"]) is not None else None, tags=data["tags"], enabled=data["enabled"], default_value=data["default_value"], diff --git a/src/workos/feature_flags/models/feature_flag_owner.py b/src/workos/feature_flags/models/feature_flag_owner.py index 05dc41d0..31a2e730 100644 --- a/src/workos/feature_flags/models/feature_flag_owner.py +++ b/src/workos/feature_flags/models/feature_flag_owner.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Optional from workos._types import _raise_deserialize_error diff --git a/src/workos/groups/__init__.py b/src/workos/groups/__init__.py new file mode 100644 index 00000000..ad3acc85 --- /dev/null +++ b/src/workos/groups/__init__.py @@ -0,0 +1,4 @@ +# This file is auto-generated by oagen. Do not edit. + +from ._resource import Groups, AsyncGroups +from .models import * diff --git a/src/workos/groups/_resource.py b/src/workos/groups/_resource.py new file mode 100644 index 00000000..9fc1f3a6 --- /dev/null +++ b/src/workos/groups/_resource.py @@ -0,0 +1,653 @@ +# This file is auto-generated by oagen. Do not edit. + +from __future__ import annotations + +from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Type, Union, cast + +if TYPE_CHECKING: + from .._client import AsyncWorkOSClient, WorkOSClient + +from .._types import RequestOptions, enum_value +from .models import CreateGroup, CreateGroupMembership, Group, UpdateGroup +from workos.authorization.models.user_organization_membership_base_list_data import UserOrganizationMembershipBaseListData +from .models import GroupsOrder +from .._pagination import AsyncPage, SyncPage + +class Groups: + """Groups API resources.""" + + def __init__(self, client: "WorkOSClient") -> None: + self._client = client + + def list_organization_groups( + self, + organization_id: str, + *, + limit: Optional[int] = None, + before: Optional[str] = None, + after: Optional[str] = None, + order: Optional[Union[GroupsOrder, str]] = "desc", + request_options: Optional[RequestOptions] = None, + ) -> SyncPage[Group]: + """List groups + + Get a paginated list of groups within an organization. + + Args: + organization_id: The ID of the organization. + limit: Upper limit on the number of objects to return, between `1` and `100`. Defaults to `10`. + before: An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`. + after: An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`. + order: Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. Defaults to `desc`. + request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. + + Returns: + SyncPage[Group] + + Raises: + AuthorizationError: If the request is forbidden (403). + NotFoundError: If the resource is not found (404). + AuthenticationError: If the API key is invalid (401). + RateLimitExceededError: If rate limited (429). + ServerError: If the server returns a 5xx error. + """ + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + }.items() if v is not None} + return self._client.request_page( + method="get", + path=f"organizations/{organization_id}/groups", + model=Group, + params=params, + request_options=request_options, + ) + + def create_organization_group( + self, + organization_id: str, + *, + name: str, + description: Optional[str] = None, + request_options: Optional[RequestOptions] = None, + ) -> Group: + """Create a group + + Create a new group within an organization. + + Args: + organization_id: The ID of the organization. + name: The name of the Group. + description: An optional description of the Group. + request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. + + Returns: + Group + + Raises: + BadRequestError: If the request is malformed (400). + AuthorizationError: If the request is forbidden (403). + NotFoundError: If the resource is not found (404). + UnprocessableEntityError: If the request data is unprocessable (422). + AuthenticationError: If the API key is invalid (401). + RateLimitExceededError: If rate limited (429). + ServerError: If the server returns a 5xx error. + """ + body: Dict[str, Any] = {k: v for k, v in { + "name": name, + "description": description, + }.items() if v is not None} + return self._client.request( + method="post", + path=f"organizations/{organization_id}/groups", + body=body, + model=Group, + request_options=request_options, + ) + + def get_organization_group( + self, + organization_id: str, + group_id: str, + *, + request_options: Optional[RequestOptions] = None, + ) -> Group: + """Get a group + + Retrieve a group by its ID within an organization. + + Args: + organization_id: The ID of the organization. + group_id: The ID of the group. + request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. + + Returns: + Group + + Raises: + AuthorizationError: If the request is forbidden (403). + NotFoundError: If the resource is not found (404). + AuthenticationError: If the API key is invalid (401). + RateLimitExceededError: If rate limited (429). + ServerError: If the server returns a 5xx error. + """ + return self._client.request( + method="get", + path=f"organizations/{organization_id}/groups/{group_id}", + model=Group, + request_options=request_options, + ) + + def update_organization_group( + self, + organization_id: str, + group_id: str, + *, + name: Optional[str] = None, + description: Optional[str] = None, + request_options: Optional[RequestOptions] = None, + ) -> Group: + """Update a group + + Update an existing group. Only the fields provided in the request body will be updated. + + Args: + organization_id: The ID of the organization. + group_id: The ID of the group. + name: The name of the Group. + description: An optional description of the Group. + request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. + + Returns: + Group + + Raises: + BadRequestError: If the request is malformed (400). + AuthorizationError: If the request is forbidden (403). + NotFoundError: If the resource is not found (404). + UnprocessableEntityError: If the request data is unprocessable (422). + AuthenticationError: If the API key is invalid (401). + RateLimitExceededError: If rate limited (429). + ServerError: If the server returns a 5xx error. + """ + body: Dict[str, Any] = {k: v for k, v in { + "name": name, + "description": description, + }.items() if v is not None} + return self._client.request( + method="patch", + path=f"organizations/{organization_id}/groups/{group_id}", + body=body, + model=Group, + request_options=request_options, + ) + + def delete_organization_group( + self, + organization_id: str, + group_id: str, + *, + request_options: Optional[RequestOptions] = None, + ) -> None: + """Delete a group + + Delete a group from an organization. + + Args: + organization_id: The ID of the organization. + group_id: The ID of the group. + request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. + + Raises: + AuthorizationError: If the request is forbidden (403). + NotFoundError: If the resource is not found (404). + AuthenticationError: If the API key is invalid (401). + RateLimitExceededError: If rate limited (429). + ServerError: If the server returns a 5xx error. + """ + self._client.request( + method="delete", + path=f"organizations/{organization_id}/groups/{group_id}", + request_options=request_options, + ) + + def list_group_organization_memberships( + self, + organization_id: str, + group_id: str, + *, + limit: Optional[int] = None, + before: Optional[str] = None, + after: Optional[str] = None, + order: Optional[Union[GroupsOrder, str]] = "desc", + request_options: Optional[RequestOptions] = None, + ) -> SyncPage[UserOrganizationMembershipBaseListData]: + """List Group members + + Get a list of organization memberships in a group. + + Args: + organization_id: Unique identifier of the Organization. + group_id: Unique identifier of the Group. + limit: Upper limit on the number of objects to return, between `1` and `100`. Defaults to `10`. + before: An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`. + after: An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`. + order: Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. Defaults to `desc`. + request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. + + Returns: + SyncPage[UserOrganizationMembershipBaseListData] + + Raises: + AuthorizationError: If the request is forbidden (403). + NotFoundError: If the resource is not found (404). + AuthenticationError: If the API key is invalid (401). + RateLimitExceededError: If rate limited (429). + ServerError: If the server returns a 5xx error. + """ + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + }.items() if v is not None} + return self._client.request_page( + method="get", + path=f"organizations/{organization_id}/groups/{group_id}/organization-memberships", + model=UserOrganizationMembershipBaseListData, + params=params, + request_options=request_options, + ) + + def create_group_organization_membership( + self, + organization_id: str, + group_id: str, + *, + organization_membership_id: str, + request_options: Optional[RequestOptions] = None, + ) -> Group: + """Add a member to a Group + + Add an organization membership to a group. + + Args: + organization_id: Unique identifier of the Organization. + group_id: Unique identifier of the Group. + organization_membership_id: The ID of the Organization Membership to add to the group. + request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. + + Returns: + Group + + Raises: + AuthorizationError: If the request is forbidden (403). + NotFoundError: If the resource is not found (404). + UnprocessableEntityError: If the request data is unprocessable (422). + AuthenticationError: If the API key is invalid (401). + RateLimitExceededError: If rate limited (429). + ServerError: If the server returns a 5xx error. + """ + body: Dict[str, Any] = { + "organization_membership_id": organization_membership_id, + } + return self._client.request( + method="post", + path=f"organizations/{organization_id}/groups/{group_id}/organization-memberships", + body=body, + model=Group, + request_options=request_options, + ) + + def delete_group_organization_membership( + self, + organization_id: str, + group_id: str, + om_id: str, + *, + request_options: Optional[RequestOptions] = None, + ) -> None: + """Remove a member from a Group + + Remove an organization membership from a group. + + Args: + organization_id: Unique identifier of the Organization. + group_id: Unique identifier of the Group. + om_id: Unique identifier of the Organization Membership. + request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. + + Raises: + AuthorizationError: If the request is forbidden (403). + NotFoundError: If the resource is not found (404). + AuthenticationError: If the API key is invalid (401). + RateLimitExceededError: If rate limited (429). + ServerError: If the server returns a 5xx error. + """ + self._client.request( + method="delete", + path=f"organizations/{organization_id}/groups/{group_id}/organization-memberships/{om_id}", + request_options=request_options, + ) + + +class AsyncGroups: + """Groups API resources (async).""" + + def __init__(self, client: "AsyncWorkOSClient") -> None: + self._client = client + + async def list_organization_groups( + self, + organization_id: str, + *, + limit: Optional[int] = None, + before: Optional[str] = None, + after: Optional[str] = None, + order: Optional[Union[GroupsOrder, str]] = "desc", + request_options: Optional[RequestOptions] = None, + ) -> AsyncPage[Group]: + """List groups + + Get a paginated list of groups within an organization. + + Args: + organization_id: The ID of the organization. + limit: Upper limit on the number of objects to return, between `1` and `100`. Defaults to `10`. + before: An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`. + after: An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`. + order: Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. Defaults to `desc`. + request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. + + Returns: + AsyncPage[Group] + + Raises: + AuthorizationError: If the request is forbidden (403). + NotFoundError: If the resource is not found (404). + AuthenticationError: If the API key is invalid (401). + RateLimitExceededError: If rate limited (429). + ServerError: If the server returns a 5xx error. + """ + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + }.items() if v is not None} + return await self._client.request_page( + method="get", + path=f"organizations/{organization_id}/groups", + model=Group, + params=params, + request_options=request_options, + ) + + async def create_organization_group( + self, + organization_id: str, + *, + name: str, + description: Optional[str] = None, + request_options: Optional[RequestOptions] = None, + ) -> Group: + """Create a group + + Create a new group within an organization. + + Args: + organization_id: The ID of the organization. + name: The name of the Group. + description: An optional description of the Group. + request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. + + Returns: + Group + + Raises: + BadRequestError: If the request is malformed (400). + AuthorizationError: If the request is forbidden (403). + NotFoundError: If the resource is not found (404). + UnprocessableEntityError: If the request data is unprocessable (422). + AuthenticationError: If the API key is invalid (401). + RateLimitExceededError: If rate limited (429). + ServerError: If the server returns a 5xx error. + """ + body: Dict[str, Any] = {k: v for k, v in { + "name": name, + "description": description, + }.items() if v is not None} + return await self._client.request( + method="post", + path=f"organizations/{organization_id}/groups", + body=body, + model=Group, + request_options=request_options, + ) + + async def get_organization_group( + self, + organization_id: str, + group_id: str, + *, + request_options: Optional[RequestOptions] = None, + ) -> Group: + """Get a group + + Retrieve a group by its ID within an organization. + + Args: + organization_id: The ID of the organization. + group_id: The ID of the group. + request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. + + Returns: + Group + + Raises: + AuthorizationError: If the request is forbidden (403). + NotFoundError: If the resource is not found (404). + AuthenticationError: If the API key is invalid (401). + RateLimitExceededError: If rate limited (429). + ServerError: If the server returns a 5xx error. + """ + return await self._client.request( + method="get", + path=f"organizations/{organization_id}/groups/{group_id}", + model=Group, + request_options=request_options, + ) + + async def update_organization_group( + self, + organization_id: str, + group_id: str, + *, + name: Optional[str] = None, + description: Optional[str] = None, + request_options: Optional[RequestOptions] = None, + ) -> Group: + """Update a group + + Update an existing group. Only the fields provided in the request body will be updated. + + Args: + organization_id: The ID of the organization. + group_id: The ID of the group. + name: The name of the Group. + description: An optional description of the Group. + request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. + + Returns: + Group + + Raises: + BadRequestError: If the request is malformed (400). + AuthorizationError: If the request is forbidden (403). + NotFoundError: If the resource is not found (404). + UnprocessableEntityError: If the request data is unprocessable (422). + AuthenticationError: If the API key is invalid (401). + RateLimitExceededError: If rate limited (429). + ServerError: If the server returns a 5xx error. + """ + body: Dict[str, Any] = {k: v for k, v in { + "name": name, + "description": description, + }.items() if v is not None} + return await self._client.request( + method="patch", + path=f"organizations/{organization_id}/groups/{group_id}", + body=body, + model=Group, + request_options=request_options, + ) + + async def delete_organization_group( + self, + organization_id: str, + group_id: str, + *, + request_options: Optional[RequestOptions] = None, + ) -> None: + """Delete a group + + Delete a group from an organization. + + Args: + organization_id: The ID of the organization. + group_id: The ID of the group. + request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. + + Raises: + AuthorizationError: If the request is forbidden (403). + NotFoundError: If the resource is not found (404). + AuthenticationError: If the API key is invalid (401). + RateLimitExceededError: If rate limited (429). + ServerError: If the server returns a 5xx error. + """ + await self._client.request( + method="delete", + path=f"organizations/{organization_id}/groups/{group_id}", + request_options=request_options, + ) + + async def list_group_organization_memberships( + self, + organization_id: str, + group_id: str, + *, + limit: Optional[int] = None, + before: Optional[str] = None, + after: Optional[str] = None, + order: Optional[Union[GroupsOrder, str]] = "desc", + request_options: Optional[RequestOptions] = None, + ) -> AsyncPage[UserOrganizationMembershipBaseListData]: + """List Group members + + Get a list of organization memberships in a group. + + Args: + organization_id: Unique identifier of the Organization. + group_id: Unique identifier of the Group. + limit: Upper limit on the number of objects to return, between `1` and `100`. Defaults to `10`. + before: An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`. + after: An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`. + order: Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. Defaults to `desc`. + request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. + + Returns: + AsyncPage[UserOrganizationMembershipBaseListData] + + Raises: + AuthorizationError: If the request is forbidden (403). + NotFoundError: If the resource is not found (404). + AuthenticationError: If the API key is invalid (401). + RateLimitExceededError: If rate limited (429). + ServerError: If the server returns a 5xx error. + """ + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + }.items() if v is not None} + return await self._client.request_page( + method="get", + path=f"organizations/{organization_id}/groups/{group_id}/organization-memberships", + model=UserOrganizationMembershipBaseListData, + params=params, + request_options=request_options, + ) + + async def create_group_organization_membership( + self, + organization_id: str, + group_id: str, + *, + organization_membership_id: str, + request_options: Optional[RequestOptions] = None, + ) -> Group: + """Add a member to a Group + + Add an organization membership to a group. + + Args: + organization_id: Unique identifier of the Organization. + group_id: Unique identifier of the Group. + organization_membership_id: The ID of the Organization Membership to add to the group. + request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. + + Returns: + Group + + Raises: + AuthorizationError: If the request is forbidden (403). + NotFoundError: If the resource is not found (404). + UnprocessableEntityError: If the request data is unprocessable (422). + AuthenticationError: If the API key is invalid (401). + RateLimitExceededError: If rate limited (429). + ServerError: If the server returns a 5xx error. + """ + body: Dict[str, Any] = { + "organization_membership_id": organization_membership_id, + } + return await self._client.request( + method="post", + path=f"organizations/{organization_id}/groups/{group_id}/organization-memberships", + body=body, + model=Group, + request_options=request_options, + ) + + async def delete_group_organization_membership( + self, + organization_id: str, + group_id: str, + om_id: str, + *, + request_options: Optional[RequestOptions] = None, + ) -> None: + """Remove a member from a Group + + Remove an organization membership from a group. + + Args: + organization_id: Unique identifier of the Organization. + group_id: Unique identifier of the Group. + om_id: Unique identifier of the Organization Membership. + request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. + + Raises: + AuthorizationError: If the request is forbidden (403). + NotFoundError: If the resource is not found (404). + AuthenticationError: If the API key is invalid (401). + RateLimitExceededError: If rate limited (429). + ServerError: If the server returns a 5xx error. + """ + await self._client.request( + method="delete", + path=f"organizations/{organization_id}/groups/{group_id}/organization-memberships/{om_id}", + request_options=request_options, + ) diff --git a/src/workos/groups/models/__init__.py b/src/workos/groups/models/__init__.py new file mode 100644 index 00000000..ce775a5e --- /dev/null +++ b/src/workos/groups/models/__init__.py @@ -0,0 +1,7 @@ +# 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 .group import Group as Group +from .groups_order import GroupsOrder as GroupsOrder +from .update_group import UpdateGroup as UpdateGroup diff --git a/src/workos/groups/models/create_group.py b/src/workos/groups/models/create_group.py new file mode 100644 index 00000000..83e09bb3 --- /dev/null +++ b/src/workos/groups/models/create_group.py @@ -0,0 +1,39 @@ +# This file is auto-generated by oagen. Do not edit. + +from __future__ import annotations + +from dataclasses import dataclass +from typing import cast +from typing import Any, Dict, Optional +from workos._types import _raise_deserialize_error + + +@dataclass(slots=True) +class CreateGroup: + """Create Group model.""" + + name: str + """The name of the Group.""" + description: Optional[str] = None + """An optional description of the Group.""" + + @classmethod + def from_dict(cls, data: Dict[str, Any]) -> "CreateGroup": + """Deserialize from a dictionary.""" + try: + return cls( + name=data["name"], + description=data.get("description"), + ) + except (KeyError, ValueError) as e: + _raise_deserialize_error("CreateGroup", e) + + def to_dict(self) -> Dict[str, Any]: + """Serialize to a dictionary.""" + result: Dict[str, Any] = {} + result["name"] = self.name + if self.description is not None: + result["description"] = self.description + else: + result["description"] = None + return result diff --git a/src/workos/groups/models/create_group_membership.py b/src/workos/groups/models/create_group_membership.py new file mode 100644 index 00000000..18ff535b --- /dev/null +++ b/src/workos/groups/models/create_group_membership.py @@ -0,0 +1,32 @@ +# This file is auto-generated by oagen. Do not edit. + +from __future__ import annotations + +from dataclasses import dataclass +from typing import cast +from typing import Any, Dict +from workos._types import _raise_deserialize_error + + +@dataclass(slots=True) +class CreateGroupMembership: + """Create Group Membership model.""" + + organization_membership_id: str + """The ID of the Organization Membership to add to the group.""" + + @classmethod + def from_dict(cls, data: Dict[str, Any]) -> "CreateGroupMembership": + """Deserialize from a dictionary.""" + try: + return cls( + organization_membership_id=data["organization_membership_id"], + ) + except (KeyError, ValueError) as e: + _raise_deserialize_error("CreateGroupMembership", e) + + def to_dict(self) -> Dict[str, Any]: + """Serialize to a dictionary.""" + result: Dict[str, Any] = {} + result["organization_membership_id"] = self.organization_membership_id + return result diff --git a/src/workos/common/models/group.py b/src/workos/groups/models/group.py similarity index 98% rename from src/workos/common/models/group.py rename to src/workos/groups/models/group.py index 59c14f73..01f2e737 100644 --- a/src/workos/common/models/group.py +++ b/src/workos/groups/models/group.py @@ -4,6 +4,7 @@ from dataclasses import dataclass from datetime import datetime +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 diff --git a/src/workos/groups/models/groups_order.py b/src/workos/groups/models/groups_order.py new file mode 100644 index 00000000..6a6b4d04 --- /dev/null +++ b/src/workos/groups/models/groups_order.py @@ -0,0 +1,7 @@ +# This file is auto-generated by oagen. Do not edit. + +from typing import TypeAlias +from workos.connect.models.applications_order import ApplicationsOrder + +GroupsOrder: TypeAlias = ApplicationsOrder +__all__ = ["GroupsOrder"] diff --git a/src/workos/groups/models/update_group.py b/src/workos/groups/models/update_group.py new file mode 100644 index 00000000..8f4c594e --- /dev/null +++ b/src/workos/groups/models/update_group.py @@ -0,0 +1,6 @@ +# This file is auto-generated by oagen. Do not edit. + +from typing import TypeAlias +from workos.authorization.models.update_authorization_permission import UpdateAuthorizationPermission + +UpdateGroup: TypeAlias = UpdateAuthorizationPermission diff --git a/src/workos/multi_factor_auth/_resource.py b/src/workos/multi_factor_auth/_resource.py index d89a5e09..d8140826 100644 --- a/src/workos/multi_factor_auth/_resource.py +++ b/src/workos/multi_factor_auth/_resource.py @@ -2,26 +2,17 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Dict, Literal, Optional, Union +from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Type, Union, cast if TYPE_CHECKING: from .._client import AsyncWorkOSClient, WorkOSClient from .._types import RequestOptions, enum_value -from .models import ( - AuthenticationChallenge, - AuthenticationChallengeVerifyResponse, - AuthenticationFactor, - AuthenticationFactorEnrolled, - UserAuthenticationFactorEnrollResponse, -) +from .models import AuthenticationChallenge, AuthenticationChallengeVerifyResponse, AuthenticationChallengesVerifyRequest, AuthenticationFactor, AuthenticationFactorEnrolled, AuthenticationFactorsCreateRequest, ChallengeAuthenticationFactor, EnrollUserAuthenticationFactor, UserAuthenticationFactorEnrollResponse from .models import UserManagementMultiFactorAuthenticationOrder -from workos.common.models.authentication_factors_create_request_type import ( - AuthenticationFactorsCreateRequestType, -) +from workos.common.models.authentication_factors_create_request_type import AuthenticationFactorsCreateRequestType from .._pagination import AsyncPage, SyncPage - class MultiFactorAuth: """Multi Factor Auth API resources.""" @@ -97,17 +88,13 @@ def enroll_factor( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "type": enum_value(type), - "phone_number": phone_number, - "totp_issuer": totp_issuer, - "totp_user": totp_user, - "user_id": user_id, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "type": enum_value(type), + "phone_number": phone_number, + "totp_issuer": totp_issuer, + "totp_user": totp_user, + "user_id": user_id, + }.items() if v is not None} return self._client.request( method="post", path="auth/factors/enroll", @@ -198,13 +185,9 @@ def challenge_factor( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "sms_template": sms_template, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "sms_template": sms_template, + }.items() if v is not None} return self._client.request( method="post", path=f"auth/factors/{id}/challenge", @@ -220,9 +203,7 @@ def list_user_auth_factors( limit: Optional[int] = None, before: Optional[str] = None, after: Optional[str] = None, - order: Optional[ - Union[UserManagementMultiFactorAuthenticationOrder, str] - ] = "desc", + order: Optional[Union[UserManagementMultiFactorAuthenticationOrder, str]] = "desc", request_options: Optional[RequestOptions] = None, ) -> SyncPage[AuthenticationFactor]: """List authentication factors @@ -246,16 +227,12 @@ def list_user_auth_factors( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + }.items() if v is not None} return self._client.request_page( method="get", path=f"user_management/users/{userland_user_id}/auth_factors", @@ -295,16 +272,12 @@ def create_user_auth_factor( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "type": type, - "totp_issuer": totp_issuer, - "totp_user": totp_user, - "totp_secret": totp_secret, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "type": type, + "totp_issuer": totp_issuer, + "totp_user": totp_user, + "totp_secret": totp_secret, + }.items() if v is not None} return self._client.request( method="post", path=f"user_management/users/{userland_user_id}/auth_factors", @@ -389,17 +362,13 @@ async def enroll_factor( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "type": enum_value(type), - "phone_number": phone_number, - "totp_issuer": totp_issuer, - "totp_user": totp_user, - "user_id": user_id, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "type": enum_value(type), + "phone_number": phone_number, + "totp_issuer": totp_issuer, + "totp_user": totp_user, + "user_id": user_id, + }.items() if v is not None} return await self._client.request( method="post", path="auth/factors/enroll", @@ -490,13 +459,9 @@ async def challenge_factor( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "sms_template": sms_template, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "sms_template": sms_template, + }.items() if v is not None} return await self._client.request( method="post", path=f"auth/factors/{id}/challenge", @@ -512,9 +477,7 @@ async def list_user_auth_factors( limit: Optional[int] = None, before: Optional[str] = None, after: Optional[str] = None, - order: Optional[ - Union[UserManagementMultiFactorAuthenticationOrder, str] - ] = "desc", + order: Optional[Union[UserManagementMultiFactorAuthenticationOrder, str]] = "desc", request_options: Optional[RequestOptions] = None, ) -> AsyncPage[AuthenticationFactor]: """List authentication factors @@ -538,16 +501,12 @@ async def list_user_auth_factors( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + }.items() if v is not None} return await self._client.request_page( method="get", path=f"user_management/users/{userland_user_id}/auth_factors", @@ -587,16 +546,12 @@ async def create_user_auth_factor( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "type": type, - "totp_issuer": totp_issuer, - "totp_user": totp_user, - "totp_secret": totp_secret, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "type": type, + "totp_issuer": totp_issuer, + "totp_user": totp_user, + "totp_secret": totp_secret, + }.items() if v is not None} return await self._client.request( method="post", path=f"user_management/users/{userland_user_id}/auth_factors", diff --git a/src/workos/multi_factor_auth/models/__init__.py b/src/workos/multi_factor_auth/models/__init__.py index 4c0e060b..33caf252 100644 --- a/src/workos/multi_factor_auth/models/__init__.py +++ b/src/workos/multi_factor_auth/models/__init__.py @@ -1,40 +1,16 @@ # This file is auto-generated by oagen. Do not edit. from .authentication_challenge import AuthenticationChallenge as AuthenticationChallenge -from .authentication_challenge_verify_response import ( - AuthenticationChallengeVerifyResponse as AuthenticationChallengeVerifyResponse, -) -from .authentication_challenges_verify_request import ( - AuthenticationChallengesVerifyRequest as AuthenticationChallengesVerifyRequest, -) +from .authentication_challenge_verify_response import AuthenticationChallengeVerifyResponse as AuthenticationChallengeVerifyResponse +from .authentication_challenges_verify_request import AuthenticationChallengesVerifyRequest as AuthenticationChallengesVerifyRequest from .authentication_factor import AuthenticationFactor as AuthenticationFactor -from .authentication_factor_enrolled import ( - AuthenticationFactorEnrolled as AuthenticationFactorEnrolled, -) -from .authentication_factor_enrolled_sms import ( - AuthenticationFactorEnrolledSms as AuthenticationFactorEnrolledSms, -) -from .authentication_factor_enrolled_totp import ( - AuthenticationFactorEnrolledTotp as AuthenticationFactorEnrolledTotp, -) -from .authentication_factor_sms import ( - AuthenticationFactorSms as AuthenticationFactorSms, -) -from .authentication_factor_totp import ( - AuthenticationFactorTotp as AuthenticationFactorTotp, -) -from .authentication_factors_create_request import ( - AuthenticationFactorsCreateRequest as AuthenticationFactorsCreateRequest, -) -from .challenge_authentication_factor import ( - ChallengeAuthenticationFactor as ChallengeAuthenticationFactor, -) -from .enroll_user_authentication_factor import ( - EnrollUserAuthenticationFactor as EnrollUserAuthenticationFactor, -) -from .user_authentication_factor_enroll_response import ( - UserAuthenticationFactorEnrollResponse as UserAuthenticationFactorEnrollResponse, -) -from .user_management_multi_factor_authentication_order import ( - UserManagementMultiFactorAuthenticationOrder as UserManagementMultiFactorAuthenticationOrder, -) +from .authentication_factor_enrolled import AuthenticationFactorEnrolled as AuthenticationFactorEnrolled +from .authentication_factor_enrolled_sms import AuthenticationFactorEnrolledSms as AuthenticationFactorEnrolledSms +from .authentication_factor_enrolled_totp import AuthenticationFactorEnrolledTotp as AuthenticationFactorEnrolledTotp +from .authentication_factor_sms import AuthenticationFactorSms as AuthenticationFactorSms +from .authentication_factor_totp import AuthenticationFactorTotp as AuthenticationFactorTotp +from .authentication_factors_create_request import AuthenticationFactorsCreateRequest as AuthenticationFactorsCreateRequest +from .challenge_authentication_factor import ChallengeAuthenticationFactor as ChallengeAuthenticationFactor +from .enroll_user_authentication_factor import EnrollUserAuthenticationFactor as EnrollUserAuthenticationFactor +from .user_authentication_factor_enroll_response import UserAuthenticationFactorEnrollResponse as UserAuthenticationFactorEnrollResponse +from .user_management_multi_factor_authentication_order import UserManagementMultiFactorAuthenticationOrder as UserManagementMultiFactorAuthenticationOrder diff --git a/src/workos/multi_factor_auth/models/authentication_challenge.py b/src/workos/multi_factor_auth/models/authentication_challenge.py index 14afd8f2..c25abfbd 100644 --- a/src/workos/multi_factor_auth/models/authentication_challenge.py +++ b/src/workos/multi_factor_auth/models/authentication_challenge.py @@ -4,6 +4,7 @@ from dataclasses import dataclass from datetime import datetime +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 @@ -38,9 +39,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuthenticationChallenge": authentication_factor_id=data["authentication_factor_id"], created_at=_parse_datetime(data["created_at"]), updated_at=_parse_datetime(data["updated_at"]), - expires_at=_parse_datetime(_v_expires_at) - if (_v_expires_at := data.get("expires_at")) is not None - else None, + expires_at=_parse_datetime(_v_expires_at) if (_v_expires_at := data.get("expires_at")) is not None else None, code=data.get("code"), ) except (KeyError, ValueError) as e: diff --git a/src/workos/multi_factor_auth/models/authentication_challenge_verify_response.py b/src/workos/multi_factor_auth/models/authentication_challenge_verify_response.py index 96e6686a..9d749cfc 100644 --- a/src/workos/multi_factor_auth/models/authentication_challenge_verify_response.py +++ b/src/workos/multi_factor_auth/models/authentication_challenge_verify_response.py @@ -24,9 +24,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuthenticationChallengeVerifyRespon """Deserialize from a dictionary.""" try: return cls( - challenge=AuthenticationChallenge.from_dict( - cast(Dict[str, Any], data["challenge"]) - ), + challenge=AuthenticationChallenge.from_dict(cast(Dict[str, Any], data["challenge"])), valid=data["valid"], ) except (KeyError, ValueError) as e: diff --git a/src/workos/multi_factor_auth/models/authentication_challenges_verify_request.py b/src/workos/multi_factor_auth/models/authentication_challenges_verify_request.py index 06904a6d..64fe8dbf 100644 --- a/src/workos/multi_factor_auth/models/authentication_challenges_verify_request.py +++ b/src/workos/multi_factor_auth/models/authentication_challenges_verify_request.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error diff --git a/src/workos/multi_factor_auth/models/authentication_factor.py b/src/workos/multi_factor_auth/models/authentication_factor.py index 900d02e4..2d9018da 100644 --- a/src/workos/multi_factor_auth/models/authentication_factor.py +++ b/src/workos/multi_factor_auth/models/authentication_factor.py @@ -47,12 +47,8 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuthenticationFactor": created_at=_parse_datetime(data["created_at"]), updated_at=_parse_datetime(data["updated_at"]), user_id=data.get("user_id"), - sms=AuthenticationFactorSms.from_dict(cast(Dict[str, Any], _v_sms)) - if (_v_sms := data.get("sms")) is not None - else None, - totp=AuthenticationFactorTotp.from_dict(cast(Dict[str, Any], _v_totp)) - if (_v_totp := data.get("totp")) is not None - else None, + sms=AuthenticationFactorSms.from_dict(cast(Dict[str, Any], _v_sms)) if (_v_sms := data.get("sms")) is not None else None, + totp=AuthenticationFactorTotp.from_dict(cast(Dict[str, Any], _v_totp)) if (_v_totp := data.get("totp")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("AuthenticationFactor", e) diff --git a/src/workos/multi_factor_auth/models/authentication_factor_enrolled.py b/src/workos/multi_factor_auth/models/authentication_factor_enrolled.py index ae026e3b..86244ea4 100644 --- a/src/workos/multi_factor_auth/models/authentication_factor_enrolled.py +++ b/src/workos/multi_factor_auth/models/authentication_factor_enrolled.py @@ -12,9 +12,7 @@ from .authentication_factor_enrolled_sms import AuthenticationFactorEnrolledSms from .authentication_factor_enrolled_totp import AuthenticationFactorEnrolledTotp -from workos.common.models.authentication_factor_enrolled_type import ( - AuthenticationFactorEnrolledType, -) +from workos.common.models.authentication_factor_enrolled_type import AuthenticationFactorEnrolledType @dataclass(slots=True) @@ -49,16 +47,8 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuthenticationFactorEnrolled": created_at=_parse_datetime(data["created_at"]), updated_at=_parse_datetime(data["updated_at"]), user_id=data.get("user_id"), - sms=AuthenticationFactorEnrolledSms.from_dict( - cast(Dict[str, Any], _v_sms) - ) - if (_v_sms := data.get("sms")) is not None - else None, - totp=AuthenticationFactorEnrolledTotp.from_dict( - cast(Dict[str, Any], _v_totp) - ) - if (_v_totp := data.get("totp")) is not None - else None, + sms=AuthenticationFactorEnrolledSms.from_dict(cast(Dict[str, Any], _v_sms)) if (_v_sms := data.get("sms")) is not None else None, + totp=AuthenticationFactorEnrolledTotp.from_dict(cast(Dict[str, Any], _v_totp)) if (_v_totp := data.get("totp")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("AuthenticationFactorEnrolled", e) diff --git a/src/workos/multi_factor_auth/models/authentication_factor_enrolled_sms.py b/src/workos/multi_factor_auth/models/authentication_factor_enrolled_sms.py index af088285..de4ad215 100644 --- a/src/workos/multi_factor_auth/models/authentication_factor_enrolled_sms.py +++ b/src/workos/multi_factor_auth/models/authentication_factor_enrolled_sms.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error diff --git a/src/workos/multi_factor_auth/models/authentication_factor_enrolled_totp.py b/src/workos/multi_factor_auth/models/authentication_factor_enrolled_totp.py index fbe322d9..d7780035 100644 --- a/src/workos/multi_factor_auth/models/authentication_factor_enrolled_totp.py +++ b/src/workos/multi_factor_auth/models/authentication_factor_enrolled_totp.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error diff --git a/src/workos/multi_factor_auth/models/authentication_factor_totp.py b/src/workos/multi_factor_auth/models/authentication_factor_totp.py index aafcd4d5..8589c9c7 100644 --- a/src/workos/multi_factor_auth/models/authentication_factor_totp.py +++ b/src/workos/multi_factor_auth/models/authentication_factor_totp.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error diff --git a/src/workos/multi_factor_auth/models/authentication_factors_create_request.py b/src/workos/multi_factor_auth/models/authentication_factors_create_request.py index f5a3c1de..f9383168 100644 --- a/src/workos/multi_factor_auth/models/authentication_factors_create_request.py +++ b/src/workos/multi_factor_auth/models/authentication_factors_create_request.py @@ -4,11 +4,10 @@ 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 workos.common.models.authentication_factors_create_request_type import ( - AuthenticationFactorsCreateRequestType, -) +from workos.common.models.authentication_factors_create_request_type import AuthenticationFactorsCreateRequestType @dataclass(slots=True) diff --git a/src/workos/multi_factor_auth/models/challenge_authentication_factor.py b/src/workos/multi_factor_auth/models/challenge_authentication_factor.py index d18f886d..a61704d8 100644 --- a/src/workos/multi_factor_auth/models/challenge_authentication_factor.py +++ b/src/workos/multi_factor_auth/models/challenge_authentication_factor.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Optional from workos._types import _raise_deserialize_error diff --git a/src/workos/multi_factor_auth/models/enroll_user_authentication_factor.py b/src/workos/multi_factor_auth/models/enroll_user_authentication_factor.py index 4d276a53..e73642b1 100644 --- a/src/workos/multi_factor_auth/models/enroll_user_authentication_factor.py +++ b/src/workos/multi_factor_auth/models/enroll_user_authentication_factor.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Literal, Optional from workos._types import _raise_deserialize_error diff --git a/src/workos/multi_factor_auth/models/user_authentication_factor_enroll_response.py b/src/workos/multi_factor_auth/models/user_authentication_factor_enroll_response.py index 1ba6421a..f8fa4fa0 100644 --- a/src/workos/multi_factor_auth/models/user_authentication_factor_enroll_response.py +++ b/src/workos/multi_factor_auth/models/user_authentication_factor_enroll_response.py @@ -21,18 +21,12 @@ class UserAuthenticationFactorEnrollResponse: """The [authentication challenge](https://workos.com/docs/reference/authkit/mfa/authentication-challenge) object that is used to complete the authentication process.""" @classmethod - def from_dict( - cls, data: Dict[str, Any] - ) -> "UserAuthenticationFactorEnrollResponse": + def from_dict(cls, data: Dict[str, Any]) -> "UserAuthenticationFactorEnrollResponse": """Deserialize from a dictionary.""" try: return cls( - authentication_factor=AuthenticationFactorEnrolled.from_dict( - cast(Dict[str, Any], data["authentication_factor"]) - ), - authentication_challenge=AuthenticationChallenge.from_dict( - cast(Dict[str, Any], data["authentication_challenge"]) - ), + authentication_factor=AuthenticationFactorEnrolled.from_dict(cast(Dict[str, Any], data["authentication_factor"])), + authentication_challenge=AuthenticationChallenge.from_dict(cast(Dict[str, Any], data["authentication_challenge"])), ) except (KeyError, ValueError) as e: _raise_deserialize_error("UserAuthenticationFactorEnrollResponse", e) diff --git a/src/workos/organization_domains/_resource.py b/src/workos/organization_domains/_resource.py index ab3cc141..ddda5a31 100644 --- a/src/workos/organization_domains/_resource.py +++ b/src/workos/organization_domains/_resource.py @@ -2,14 +2,13 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Dict, Optional +from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Type, Union, cast if TYPE_CHECKING: from .._client import AsyncWorkOSClient, WorkOSClient from .._types import RequestOptions -from .models import OrganizationDomain, OrganizationDomainStandAlone - +from .models import CreateOrganizationDomain, OrganizationDomain, OrganizationDomainStandAlone class OrganizationDomains: """Organization Domains API resources.""" diff --git a/src/workos/organization_domains/models/__init__.py b/src/workos/organization_domains/models/__init__.py index 5b4f6869..30ce47c7 100644 --- a/src/workos/organization_domains/models/__init__.py +++ b/src/workos/organization_domains/models/__init__.py @@ -1,9 +1,5 @@ # This file is auto-generated by oagen. Do not edit. -from .create_organization_domain import ( - CreateOrganizationDomain as CreateOrganizationDomain, -) +from .create_organization_domain import CreateOrganizationDomain as CreateOrganizationDomain from .organization_domain import OrganizationDomain as OrganizationDomain -from .organization_domain_stand_alone import ( - OrganizationDomainStandAlone as OrganizationDomainStandAlone, -) +from .organization_domain_stand_alone import OrganizationDomainStandAlone as OrganizationDomainStandAlone diff --git a/src/workos/organization_domains/models/create_organization_domain.py b/src/workos/organization_domains/models/create_organization_domain.py index b0b3c625..efc70384 100644 --- a/src/workos/organization_domains/models/create_organization_domain.py +++ b/src/workos/organization_domains/models/create_organization_domain.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error diff --git a/src/workos/organization_domains/models/organization_domain.py b/src/workos/organization_domains/models/organization_domain.py index 42eb72ec..87951478 100644 --- a/src/workos/organization_domains/models/organization_domain.py +++ b/src/workos/organization_domains/models/organization_domain.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 workos.common.models.organization_domain_state import OrganizationDomainState -from workos.common.models.organization_domain_verification_strategy import ( - OrganizationDomainVerificationStrategy, -) +from workos.common.models.organization_domain_verification_strategy import OrganizationDomainVerificationStrategy @dataclass(slots=True) @@ -50,17 +49,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "OrganizationDomain": domain=data["domain"], created_at=_parse_datetime(data["created_at"]), updated_at=_parse_datetime(data["updated_at"]), - state=OrganizationDomainState(_v_state) - if (_v_state := data.get("state")) is not None - else None, + state=OrganizationDomainState(_v_state) if (_v_state := data.get("state")) is not None else None, verification_prefix=data.get("verification_prefix"), verification_token=data.get("verification_token"), - verification_strategy=OrganizationDomainVerificationStrategy( - _v_verification_strategy - ) - if (_v_verification_strategy := data.get("verification_strategy")) - is not None - else None, + verification_strategy=OrganizationDomainVerificationStrategy(_v_verification_strategy) if (_v_verification_strategy := data.get("verification_strategy")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("OrganizationDomain", e) @@ -75,17 +67,11 @@ def to_dict(self) -> Dict[str, Any]: result["created_at"] = _format_datetime(self.created_at) result["updated_at"] = _format_datetime(self.updated_at) if self.state is not None: - result["state"] = ( - self.state.value if isinstance(self.state, Enum) else self.state - ) + result["state"] = self.state.value if isinstance(self.state, Enum) else self.state if self.verification_prefix is not None: result["verification_prefix"] = self.verification_prefix if self.verification_token is not None: result["verification_token"] = self.verification_token if self.verification_strategy is not None: - result["verification_strategy"] = ( - self.verification_strategy.value - if isinstance(self.verification_strategy, Enum) - else self.verification_strategy - ) + result["verification_strategy"] = self.verification_strategy.value if isinstance(self.verification_strategy, Enum) else self.verification_strategy return result diff --git a/src/workos/organizations/_resource.py b/src/workos/organizations/_resource.py index e0065743..2d408fbb 100644 --- a/src/workos/organizations/_resource.py +++ b/src/workos/organizations/_resource.py @@ -2,17 +2,16 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union +from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Type, Union, cast if TYPE_CHECKING: from .._client import AsyncWorkOSClient, WorkOSClient from .._types import RequestOptions, enum_value -from .models import AuditLogConfiguration, Organization, OrganizationDomainData +from .models import AuditLogConfiguration, Organization, OrganizationDomainData, OrganizationInput, UpdateOrganization from .models import OrganizationsOrder from .._pagination import AsyncPage, SyncPage - class Organizations: """Organizations API resources.""" @@ -52,20 +51,14 @@ def list_organizations( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - "domains": ",".join(str(v) for v in domains) - if domains is not None - else None, - "search": search, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + "domains": ",".join(str(v) for v in domains) if domains is not None else None, + "search": search, + }.items() if v is not None} return self._client.request_page( method="get", path="organizations", @@ -109,20 +102,14 @@ def create_organization( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "name": name, - "allow_profiles_outside_organization": allow_profiles_outside_organization, - "domains": domains, - "domain_data": [item.to_dict() for item in domain_data] - if domain_data is not None - else None, - "metadata": metadata, - "external_id": external_id, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "name": name, + "allow_profiles_outside_organization": allow_profiles_outside_organization, + "domains": domains, + "domain_data": [item.to_dict() for item in domain_data] if domain_data is not None else None, + "metadata": metadata, + "external_id": external_id, + }.items() if v is not None} return self._client.request( method="post", path="organizations", @@ -232,21 +219,15 @@ def update_organization( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "name": name, - "allow_profiles_outside_organization": allow_profiles_outside_organization, - "domains": domains, - "domain_data": [item.to_dict() for item in domain_data] - if domain_data is not None - else None, - "stripe_customer_id": stripe_customer_id, - "metadata": metadata, - "external_id": external_id, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "name": name, + "allow_profiles_outside_organization": allow_profiles_outside_organization, + "domains": domains, + "domain_data": [item.to_dict() for item in domain_data] if domain_data is not None else None, + "stripe_customer_id": stripe_customer_id, + "metadata": metadata, + "external_id": external_id, + }.items() if v is not None} return self._client.request( method="put", path=f"organizations/{id}", @@ -351,20 +332,14 @@ async def list_organizations( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - "domains": ",".join(str(v) for v in domains) - if domains is not None - else None, - "search": search, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + "domains": ",".join(str(v) for v in domains) if domains is not None else None, + "search": search, + }.items() if v is not None} return await self._client.request_page( method="get", path="organizations", @@ -408,20 +383,14 @@ async def create_organization( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "name": name, - "allow_profiles_outside_organization": allow_profiles_outside_organization, - "domains": domains, - "domain_data": [item.to_dict() for item in domain_data] - if domain_data is not None - else None, - "metadata": metadata, - "external_id": external_id, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "name": name, + "allow_profiles_outside_organization": allow_profiles_outside_organization, + "domains": domains, + "domain_data": [item.to_dict() for item in domain_data] if domain_data is not None else None, + "metadata": metadata, + "external_id": external_id, + }.items() if v is not None} return await self._client.request( method="post", path="organizations", @@ -531,21 +500,15 @@ async def update_organization( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "name": name, - "allow_profiles_outside_organization": allow_profiles_outside_organization, - "domains": domains, - "domain_data": [item.to_dict() for item in domain_data] - if domain_data is not None - else None, - "stripe_customer_id": stripe_customer_id, - "metadata": metadata, - "external_id": external_id, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "name": name, + "allow_profiles_outside_organization": allow_profiles_outside_organization, + "domains": domains, + "domain_data": [item.to_dict() for item in domain_data] if domain_data is not None else None, + "stripe_customer_id": stripe_customer_id, + "metadata": metadata, + "external_id": external_id, + }.items() if v is not None} return await self._client.request( method="put", path=f"organizations/{id}", diff --git a/src/workos/organizations/models/__init__.py b/src/workos/organizations/models/__init__.py index d64209ec..bd7ba1e7 100644 --- a/src/workos/organizations/models/__init__.py +++ b/src/workos/organizations/models/__init__.py @@ -1,15 +1,11 @@ # This file is auto-generated by oagen. Do not edit. from .audit_log_configuration import AuditLogConfiguration as AuditLogConfiguration -from .audit_log_configuration_log_stream import ( - AuditLogConfigurationLogStream as AuditLogConfigurationLogStream, -) +from .audit_log_configuration_log_stream import AuditLogConfigurationLogStream as AuditLogConfigurationLogStream from .audit_logs_retention_json import AuditLogsRetentionJson as AuditLogsRetentionJson from .organization import Organization as Organization from .organization_domain_data import OrganizationDomainData as OrganizationDomainData from .organization_input import OrganizationInput as OrganizationInput from .organizations_order import OrganizationsOrder as OrganizationsOrder -from .update_audit_logs_retention import ( - UpdateAuditLogsRetention as UpdateAuditLogsRetention, -) +from .update_audit_logs_retention import UpdateAuditLogsRetention as UpdateAuditLogsRetention from .update_organization import UpdateOrganization as UpdateOrganization diff --git a/src/workos/organizations/models/audit_log_configuration.py b/src/workos/organizations/models/audit_log_configuration.py index cc4da171..c68a835a 100644 --- a/src/workos/organizations/models/audit_log_configuration.py +++ b/src/workos/organizations/models/audit_log_configuration.py @@ -9,9 +9,7 @@ from workos._types import _raise_deserialize_error from .audit_log_configuration_log_stream import AuditLogConfigurationLogStream -from workos.common.models.audit_log_configuration_state import ( - AuditLogConfigurationState, -) +from workos.common.models.audit_log_configuration_state import AuditLogConfigurationState @dataclass(slots=True) @@ -35,11 +33,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuditLogConfiguration": organization_id=data["organization_id"], retention_period_in_days=data["retention_period_in_days"], state=AuditLogConfigurationState(data["state"]), - log_stream=AuditLogConfigurationLogStream.from_dict( - cast(Dict[str, Any], _v_log_stream) - ) - if (_v_log_stream := data.get("log_stream")) is not None - else None, + log_stream=AuditLogConfigurationLogStream.from_dict(cast(Dict[str, Any], _v_log_stream)) if (_v_log_stream := data.get("log_stream")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("AuditLogConfiguration", e) @@ -49,9 +43,7 @@ def to_dict(self) -> Dict[str, Any]: result: Dict[str, Any] = {} result["organization_id"] = self.organization_id result["retention_period_in_days"] = self.retention_period_in_days - result["state"] = ( - self.state.value if isinstance(self.state, Enum) else self.state - ) + result["state"] = self.state.value if isinstance(self.state, Enum) else self.state if self.log_stream is not None: result["log_stream"] = self.log_stream.to_dict() return result diff --git a/src/workos/organizations/models/audit_log_configuration_log_stream.py b/src/workos/organizations/models/audit_log_configuration_log_stream.py index 37a3208a..acd76f55 100644 --- a/src/workos/organizations/models/audit_log_configuration_log_stream.py +++ b/src/workos/organizations/models/audit_log_configuration_log_stream.py @@ -5,15 +5,12 @@ from dataclasses import dataclass from datetime import datetime from enum import Enum +from typing import cast from typing import Any, Dict, Optional from workos._types import _raise_deserialize_error from workos._types import _format_datetime, _parse_datetime -from workos.common.models.audit_log_configuration_log_stream_state import ( - AuditLogConfigurationLogStreamState, -) -from workos.common.models.audit_log_configuration_log_stream_type import ( - AuditLogConfigurationLogStreamType, -) +from workos.common.models.audit_log_configuration_log_stream_state import AuditLogConfigurationLogStreamState +from workos.common.models.audit_log_configuration_log_stream_type import AuditLogConfigurationLogStreamType @dataclass(slots=True) @@ -50,9 +47,7 @@ def to_dict(self) -> Dict[str, Any]: result: Dict[str, Any] = {} result["id"] = self.id result["type"] = self.type.value if isinstance(self.type, Enum) else self.type - result["state"] = ( - self.state.value if isinstance(self.state, Enum) else self.state - ) + result["state"] = self.state.value if isinstance(self.state, Enum) else self.state if self.last_synced_at is not None: result["last_synced_at"] = self.last_synced_at else: diff --git a/src/workos/organizations/models/audit_logs_retention_json.py b/src/workos/organizations/models/audit_logs_retention_json.py index 1e7fdf4b..d2b59cf7 100644 --- a/src/workos/organizations/models/audit_logs_retention_json.py +++ b/src/workos/organizations/models/audit_logs_retention_json.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Optional from workos._types import _raise_deserialize_error diff --git a/src/workos/organizations/models/organization.py b/src/workos/organizations/models/organization.py index cb72b57d..a63d2bf9 100644 --- a/src/workos/organizations/models/organization.py +++ b/src/workos/organizations/models/organization.py @@ -47,18 +47,13 @@ def from_dict(cls, data: Dict[str, Any]) -> "Organization": object=data["object"], id=data["id"], name=data["name"], - domains=[ - OrganizationDomain.from_dict(cast(Dict[str, Any], item)) - for item in cast(list[Any], data["domains"]) - ], + domains=[OrganizationDomain.from_dict(cast(Dict[str, Any], item)) for item in cast(list[Any], data["domains"])], metadata=data["metadata"], external_id=data["external_id"], created_at=_parse_datetime(data["created_at"]), updated_at=_parse_datetime(data["updated_at"]), stripe_customer_id=data.get("stripe_customer_id"), - allow_profiles_outside_organization=data.get( - "allow_profiles_outside_organization" - ), + allow_profiles_outside_organization=data.get("allow_profiles_outside_organization"), ) except (KeyError, ValueError) as e: _raise_deserialize_error("Organization", e) @@ -80,7 +75,5 @@ def to_dict(self) -> Dict[str, Any]: if self.stripe_customer_id is not None: result["stripe_customer_id"] = self.stripe_customer_id if self.allow_profiles_outside_organization is not None: - result["allow_profiles_outside_organization"] = ( - self.allow_profiles_outside_organization - ) + result["allow_profiles_outside_organization"] = self.allow_profiles_outside_organization return result diff --git a/src/workos/organizations/models/organization_domain_data.py b/src/workos/organizations/models/organization_domain_data.py index 9ce37d84..9115ed26 100644 --- a/src/workos/organizations/models/organization_domain_data.py +++ b/src/workos/organizations/models/organization_domain_data.py @@ -4,11 +4,10 @@ from dataclasses import dataclass from enum import Enum +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error -from workos.common.models.organization_domain_data_state import ( - OrganizationDomainDataState, -) +from workos.common.models.organization_domain_data_state import OrganizationDomainDataState @dataclass(slots=True) @@ -35,7 +34,5 @@ def to_dict(self) -> Dict[str, Any]: """Serialize to a dictionary.""" result: Dict[str, Any] = {} result["domain"] = self.domain - result["state"] = ( - self.state.value if isinstance(self.state, Enum) else self.state - ) + result["state"] = self.state.value if isinstance(self.state, Enum) else self.state return result diff --git a/src/workos/organizations/models/organization_input.py b/src/workos/organizations/models/organization_input.py index ba419992..bf5fb0b4 100644 --- a/src/workos/organizations/models/organization_input.py +++ b/src/workos/organizations/models/organization_input.py @@ -33,16 +33,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "OrganizationInput": try: return cls( name=data["name"], - allow_profiles_outside_organization=data.get( - "allow_profiles_outside_organization" - ), + allow_profiles_outside_organization=data.get("allow_profiles_outside_organization"), domains=data.get("domains"), - domain_data=[ - OrganizationDomainData.from_dict(cast(Dict[str, Any], item)) - for item in cast(list[Any], _v_domain_data) - ] - if (_v_domain_data := data.get("domain_data")) is not None - else None, + domain_data=[OrganizationDomainData.from_dict(cast(Dict[str, Any], item)) for item in cast(list[Any], _v_domain_data)] if (_v_domain_data := data.get("domain_data")) is not None else None, metadata=data.get("metadata"), external_id=data.get("external_id"), ) @@ -54,9 +47,7 @@ def to_dict(self) -> Dict[str, Any]: result: Dict[str, Any] = {} result["name"] = self.name if self.allow_profiles_outside_organization is not None: - result["allow_profiles_outside_organization"] = ( - self.allow_profiles_outside_organization - ) + result["allow_profiles_outside_organization"] = self.allow_profiles_outside_organization if self.domains is not None: result["domains"] = self.domains if self.domain_data is not None: diff --git a/src/workos/organizations/models/update_audit_logs_retention.py b/src/workos/organizations/models/update_audit_logs_retention.py index 0aed5b30..e4746769 100644 --- a/src/workos/organizations/models/update_audit_logs_retention.py +++ b/src/workos/organizations/models/update_audit_logs_retention.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error diff --git a/src/workos/organizations/models/update_organization.py b/src/workos/organizations/models/update_organization.py index e3d73e6e..d5650517 100644 --- a/src/workos/organizations/models/update_organization.py +++ b/src/workos/organizations/models/update_organization.py @@ -37,16 +37,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "UpdateOrganization": try: return cls( name=data.get("name"), - allow_profiles_outside_organization=data.get( - "allow_profiles_outside_organization" - ), + allow_profiles_outside_organization=data.get("allow_profiles_outside_organization"), domains=data.get("domains"), - domain_data=[ - OrganizationDomainData.from_dict(cast(Dict[str, Any], item)) - for item in cast(list[Any], _v_domain_data) - ] - if (_v_domain_data := data.get("domain_data")) is not None - else None, + domain_data=[OrganizationDomainData.from_dict(cast(Dict[str, Any], item)) for item in cast(list[Any], _v_domain_data)] if (_v_domain_data := data.get("domain_data")) is not None else None, stripe_customer_id=data.get("stripe_customer_id"), metadata=data.get("metadata"), external_id=data.get("external_id"), @@ -60,9 +53,7 @@ def to_dict(self) -> Dict[str, Any]: if self.name is not None: result["name"] = self.name if self.allow_profiles_outside_organization is not None: - result["allow_profiles_outside_organization"] = ( - self.allow_profiles_outside_organization - ) + result["allow_profiles_outside_organization"] = self.allow_profiles_outside_organization if self.domains is not None: result["domains"] = self.domains if self.domain_data is not None: diff --git a/src/workos/pipes/_resource.py b/src/workos/pipes/_resource.py index d48766c6..483f1dd4 100644 --- a/src/workos/pipes/_resource.py +++ b/src/workos/pipes/_resource.py @@ -2,19 +2,13 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Dict, Optional +from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Type, Union, cast if TYPE_CHECKING: from .._client import AsyncWorkOSClient, WorkOSClient from .._types import RequestOptions -from .models import ( - ConnectedAccount, - DataIntegrationAccessTokenResponse, - DataIntegrationAuthorizeUrlResponse, - DataIntegrationsListResponse, -) - +from .models import ConnectedAccount, DataIntegrationAccessTokenResponse, DataIntegrationAuthorizeUrlResponse, DataIntegrationsGetDataIntegrationAuthorizeUrlRequest, DataIntegrationsGetUserTokenRequest, DataIntegrationsListResponse class Pipes: """Pipes API resources.""" @@ -53,15 +47,11 @@ def authorize_data_integration( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "user_id": user_id, - "organization_id": organization_id, - "return_to": return_to, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "user_id": user_id, + "organization_id": organization_id, + "return_to": return_to, + }.items() if v is not None} return self._client.request( method="post", path=f"data-integrations/{slug}/authorize", @@ -98,14 +88,10 @@ def create_data_integration_token( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "user_id": user_id, - "organization_id": organization_id, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "user_id": user_id, + "organization_id": organization_id, + }.items() if v is not None} return self._client.request( method="post", path=f"data-integrations/{slug}/token", @@ -141,13 +127,9 @@ def get_user_connected_account( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params: Dict[str, Any] = { - k: v - for k, v in { - "organization_id": organization_id, - }.items() - if v is not None - } + params: Dict[str, Any] = {k: v for k, v in { + "organization_id": organization_id, + }.items() if v is not None} return self._client.request( method="get", path=f"user_management/users/{user_id}/connected_accounts/{slug}", @@ -180,13 +162,9 @@ def delete_user_connected_account( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params: Dict[str, Any] = { - k: v - for k, v in { - "organization_id": organization_id, - }.items() - if v is not None - } + params: Dict[str, Any] = {k: v for k, v in { + "organization_id": organization_id, + }.items() if v is not None} self._client.request( method="delete", path=f"user_management/users/{user_id}/connected_accounts/{slug}", @@ -219,13 +197,9 @@ def list_user_data_providers( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params: Dict[str, Any] = { - k: v - for k, v in { - "organization_id": organization_id, - }.items() - if v is not None - } + params: Dict[str, Any] = {k: v for k, v in { + "organization_id": organization_id, + }.items() if v is not None} return self._client.request( method="get", path=f"user_management/users/{user_id}/data_providers", @@ -272,15 +246,11 @@ async def authorize_data_integration( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "user_id": user_id, - "organization_id": organization_id, - "return_to": return_to, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "user_id": user_id, + "organization_id": organization_id, + "return_to": return_to, + }.items() if v is not None} return await self._client.request( method="post", path=f"data-integrations/{slug}/authorize", @@ -317,14 +287,10 @@ async def create_data_integration_token( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "user_id": user_id, - "organization_id": organization_id, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "user_id": user_id, + "organization_id": organization_id, + }.items() if v is not None} return await self._client.request( method="post", path=f"data-integrations/{slug}/token", @@ -360,13 +326,9 @@ async def get_user_connected_account( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params: Dict[str, Any] = { - k: v - for k, v in { - "organization_id": organization_id, - }.items() - if v is not None - } + params: Dict[str, Any] = {k: v for k, v in { + "organization_id": organization_id, + }.items() if v is not None} return await self._client.request( method="get", path=f"user_management/users/{user_id}/connected_accounts/{slug}", @@ -399,13 +361,9 @@ async def delete_user_connected_account( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params: Dict[str, Any] = { - k: v - for k, v in { - "organization_id": organization_id, - }.items() - if v is not None - } + params: Dict[str, Any] = {k: v for k, v in { + "organization_id": organization_id, + }.items() if v is not None} await self._client.request( method="delete", path=f"user_management/users/{user_id}/connected_accounts/{slug}", @@ -438,13 +396,9 @@ async def list_user_data_providers( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params: Dict[str, Any] = { - k: v - for k, v in { - "organization_id": organization_id, - }.items() - if v is not None - } + params: Dict[str, Any] = {k: v for k, v in { + "organization_id": organization_id, + }.items() if v is not None} return await self._client.request( method="get", path=f"user_management/users/{user_id}/data_providers", diff --git a/src/workos/pipes/models/__init__.py b/src/workos/pipes/models/__init__.py index a0899bc4..b5c22aaa 100644 --- a/src/workos/pipes/models/__init__.py +++ b/src/workos/pipes/models/__init__.py @@ -1,27 +1,11 @@ # This file is auto-generated by oagen. Do not edit. from .connected_account import ConnectedAccount as ConnectedAccount -from .data_integration_access_token_response import ( - DataIntegrationAccessTokenResponse as DataIntegrationAccessTokenResponse, -) -from .data_integration_access_token_response_access_token import ( - DataIntegrationAccessTokenResponseAccessToken as DataIntegrationAccessTokenResponseAccessToken, -) -from .data_integration_authorize_url_response import ( - DataIntegrationAuthorizeUrlResponse as DataIntegrationAuthorizeUrlResponse, -) -from .data_integrations_get_data_integration_authorize_url_request import ( - DataIntegrationsGetDataIntegrationAuthorizeUrlRequest as DataIntegrationsGetDataIntegrationAuthorizeUrlRequest, -) -from .data_integrations_get_user_token_request import ( - DataIntegrationsGetUserTokenRequest as DataIntegrationsGetUserTokenRequest, -) -from .data_integrations_list_response import ( - DataIntegrationsListResponse as DataIntegrationsListResponse, -) -from .data_integrations_list_response_data import ( - DataIntegrationsListResponseData as DataIntegrationsListResponseData, -) -from .data_integrations_list_response_data_connected_account import ( - DataIntegrationsListResponseDataConnectedAccount as DataIntegrationsListResponseDataConnectedAccount, -) +from .data_integration_access_token_response import DataIntegrationAccessTokenResponse as DataIntegrationAccessTokenResponse +from .data_integration_access_token_response_access_token import DataIntegrationAccessTokenResponseAccessToken as DataIntegrationAccessTokenResponseAccessToken +from .data_integration_authorize_url_response import DataIntegrationAuthorizeUrlResponse as DataIntegrationAuthorizeUrlResponse +from .data_integrations_get_data_integration_authorize_url_request import DataIntegrationsGetDataIntegrationAuthorizeUrlRequest as DataIntegrationsGetDataIntegrationAuthorizeUrlRequest +from .data_integrations_get_user_token_request import DataIntegrationsGetUserTokenRequest as DataIntegrationsGetUserTokenRequest +from .data_integrations_list_response import DataIntegrationsListResponse as DataIntegrationsListResponse +from .data_integrations_list_response_data import DataIntegrationsListResponseData as DataIntegrationsListResponseData +from .data_integrations_list_response_data_connected_account import DataIntegrationsListResponseDataConnectedAccount as DataIntegrationsListResponseDataConnectedAccount diff --git a/src/workos/pipes/models/connected_account.py b/src/workos/pipes/models/connected_account.py index e24bd856..87c12ff8 100644 --- a/src/workos/pipes/models/connected_account.py +++ b/src/workos/pipes/models/connected_account.py @@ -4,6 +4,7 @@ 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 workos.common.models.connected_account_state import ConnectedAccountState @@ -64,9 +65,7 @@ def to_dict(self) -> Dict[str, Any]: else: result["organization_id"] = None result["scopes"] = self.scopes - result["state"] = ( - self.state.value if isinstance(self.state, Enum) else self.state - ) + result["state"] = self.state.value if isinstance(self.state, Enum) else self.state result["created_at"] = self.created_at result["updated_at"] = self.updated_at return result diff --git a/src/workos/pipes/models/data_integration_access_token_response.py b/src/workos/pipes/models/data_integration_access_token_response.py index eab9acf4..ff59d760 100644 --- a/src/workos/pipes/models/data_integration_access_token_response.py +++ b/src/workos/pipes/models/data_integration_access_token_response.py @@ -8,12 +8,8 @@ from typing import Any, Dict, Literal, Optional from workos._types import _raise_deserialize_error -from .data_integration_access_token_response_access_token import ( - DataIntegrationAccessTokenResponseAccessToken, -) -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) @@ -34,14 +30,8 @@ def from_dict(cls, data: Dict[str, Any]) -> "DataIntegrationAccessTokenResponse" try: return cls( active=data.get("active"), - access_token=DataIntegrationAccessTokenResponseAccessToken.from_dict( - cast(Dict[str, Any], _v_access_token) - ) - if (_v_access_token := data.get("access_token")) is not None - else None, - error=DataIntegrationAccessTokenResponseError(_v_error) - if (_v_error := data.get("error")) is not None - else None, + access_token=DataIntegrationAccessTokenResponseAccessToken.from_dict(cast(Dict[str, Any], _v_access_token)) if (_v_access_token := data.get("access_token")) is not None else None, + error=DataIntegrationAccessTokenResponseError(_v_error) if (_v_error := data.get("error")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("DataIntegrationAccessTokenResponse", e) @@ -54,7 +44,5 @@ def to_dict(self) -> Dict[str, Any]: if self.access_token is not None: result["access_token"] = self.access_token.to_dict() if self.error is not None: - result["error"] = ( - self.error.value if isinstance(self.error, Enum) else self.error - ) + result["error"] = self.error.value if isinstance(self.error, Enum) else self.error return result 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 f6ad8ef3..63801d64 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 @@ -3,6 +3,7 @@ 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 @@ -23,9 +24,7 @@ class DataIntegrationAccessTokenResponseAccessToken: """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": + def from_dict(cls, data: Dict[str, Any]) -> "DataIntegrationAccessTokenResponseAccessToken": """Deserialize from a dictionary.""" try: return cls( 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..8c202115 100644 --- a/src/workos/pipes/models/data_integration_authorize_url_response.py +++ b/src/workos/pipes/models/data_integration_authorize_url_response.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error 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..6c69f97b 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,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Optional from workos._types import _raise_deserialize_error @@ -19,9 +20,7 @@ class DataIntegrationsGetDataIntegrationAuthorizeUrlRequest: """The URL to redirect the user to after authorization.""" @classmethod - def from_dict( - cls, data: Dict[str, Any] - ) -> "DataIntegrationsGetDataIntegrationAuthorizeUrlRequest": + def from_dict(cls, data: Dict[str, Any]) -> "DataIntegrationsGetDataIntegrationAuthorizeUrlRequest": """Deserialize from a dictionary.""" try: return cls( @@ -30,9 +29,7 @@ def from_dict( return_to=data.get("return_to"), ) except (KeyError, ValueError) as e: - _raise_deserialize_error( - "DataIntegrationsGetDataIntegrationAuthorizeUrlRequest", e - ) + _raise_deserialize_error("DataIntegrationsGetDataIntegrationAuthorizeUrlRequest", e) def to_dict(self) -> Dict[str, Any]: """Serialize to a dictionary.""" 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 8098775a..c5c7b71a 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,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Optional from workos._types import _raise_deserialize_error diff --git a/src/workos/pipes/models/data_integrations_list_response.py b/src/workos/pipes/models/data_integrations_list_response.py index 013f13c2..94c697b1 100644 --- a/src/workos/pipes/models/data_integrations_list_response.py +++ b/src/workos/pipes/models/data_integrations_list_response.py @@ -25,12 +25,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "DataIntegrationsListResponse": try: return cls( object=data["object"], - data=[ - DataIntegrationsListResponseData.from_dict( - cast(Dict[str, Any], item) - ) - for item in cast(list[Any], data["data"]) - ], + data=[DataIntegrationsListResponseData.from_dict(cast(Dict[str, Any], item)) for item in cast(list[Any], data["data"])], ) except (KeyError, ValueError) as e: _raise_deserialize_error("DataIntegrationsListResponse", e) 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 6ccc03eb..27dd765d 100644 --- a/src/workos/pipes/models/data_integrations_list_response_data.py +++ b/src/workos/pipes/models/data_integrations_list_response_data.py @@ -8,12 +8,8 @@ from typing import Any, Dict, List, Literal, Optional from workos._types import _raise_deserialize_error -from .data_integrations_list_response_data_connected_account import ( - DataIntegrationsListResponseDataConnectedAccount, -) -from workos.common.models.data_integrations_list_response_data_ownership import ( - DataIntegrationsListResponseDataOwnership, -) +from .data_integrations_list_response_data_connected_account import DataIntegrationsListResponseDataConnectedAccount +from workos.common.models.data_integrations_list_response_data_ownership import DataIntegrationsListResponseDataOwnership @dataclass(slots=True) @@ -61,11 +57,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "DataIntegrationsListResponseData": ownership=DataIntegrationsListResponseDataOwnership(data["ownership"]), created_at=data["created_at"], updated_at=data["updated_at"], - connected_account=DataIntegrationsListResponseDataConnectedAccount.from_dict( - cast(Dict[str, Any], _v_connected_account) - ) - if (_v_connected_account := data["connected_account"]) is not None - else None, + connected_account=DataIntegrationsListResponseDataConnectedAccount.from_dict(cast(Dict[str, Any], _v_connected_account)) if (_v_connected_account := data["connected_account"]) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("DataIntegrationsListResponseData", e) @@ -87,9 +79,7 @@ def to_dict(self) -> Dict[str, Any]: result["scopes"] = self.scopes else: result["scopes"] = None - result["ownership"] = ( - self.ownership.value if isinstance(self.ownership, Enum) else self.ownership - ) + result["ownership"] = self.ownership.value if isinstance(self.ownership, Enum) else self.ownership result["created_at"] = self.created_at result["updated_at"] = self.updated_at if self.connected_account is not None: 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 660a0bbc..2468a8c9 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,11 +4,10 @@ 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 workos.common.models.data_integrations_list_response_data_connected_account_state import ( - DataIntegrationsListResponseDataConnectedAccountState, -) +from workos.common.models.data_integrations_list_response_data_connected_account_state import DataIntegrationsListResponseDataConnectedAccountState @dataclass(slots=True) @@ -40,9 +39,7 @@ class DataIntegrationsListResponseDataConnectedAccount: .. deprecated:: This field is deprecated.""" @classmethod - def from_dict( - cls, data: Dict[str, Any] - ) -> "DataIntegrationsListResponseDataConnectedAccount": + def from_dict(cls, data: Dict[str, Any]) -> "DataIntegrationsListResponseDataConnectedAccount": """Deserialize from a dictionary.""" try: return cls( @@ -51,17 +48,13 @@ def from_dict( user_id=data["user_id"], organization_id=data["organization_id"], scopes=data["scopes"], - state=DataIntegrationsListResponseDataConnectedAccountState( - data["state"] - ), + state=DataIntegrationsListResponseDataConnectedAccountState(data["state"]), created_at=data["created_at"], updated_at=data["updated_at"], userland_user_id=data.get("userlandUserId"), ) except (KeyError, ValueError) as e: - _raise_deserialize_error( - "DataIntegrationsListResponseDataConnectedAccount", e - ) + _raise_deserialize_error("DataIntegrationsListResponseDataConnectedAccount", e) def to_dict(self) -> Dict[str, Any]: """Serialize to a dictionary.""" @@ -77,9 +70,7 @@ def to_dict(self) -> Dict[str, Any]: else: result["organization_id"] = None result["scopes"] = self.scopes - result["state"] = ( - self.state.value if isinstance(self.state, Enum) else self.state - ) + result["state"] = self.state.value if isinstance(self.state, Enum) else self.state result["created_at"] = self.created_at result["updated_at"] = self.updated_at if self.userland_user_id is not None: diff --git a/src/workos/radar/_resource.py b/src/workos/radar/_resource.py index bddd81ed..f679ecb5 100644 --- a/src/workos/radar/_resource.py +++ b/src/workos/radar/_resource.py @@ -2,21 +2,16 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Dict, Literal, Optional, Union +from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Type, Union, cast if TYPE_CHECKING: from .._client import AsyncWorkOSClient, WorkOSClient from .._types import RequestOptions, enum_value -from .models import RadarListEntryAlreadyPresentResponse, RadarStandaloneResponse +from .models import RadarListEntryAlreadyPresentResponse, RadarStandaloneAssessRequest, RadarStandaloneDeleteRadarListEntryRequest, RadarStandaloneResponse, RadarStandaloneUpdateRadarAttemptRequest, RadarStandaloneUpdateRadarListRequest from .models import RadarAction, RadarType -from workos.common.models.radar_standalone_assess_request_action import ( - RadarStandaloneAssessRequestAction, -) -from workos.common.models.radar_standalone_assess_request_auth_method import ( - RadarStandaloneAssessRequestAuthMethod, -) - +from workos.common.models.radar_standalone_assess_request_action import RadarStandaloneAssessRequestAction +from workos.common.models.radar_standalone_assess_request_auth_method import RadarStandaloneAssessRequestAuthMethod class Radar: """Radar API resources.""" @@ -59,19 +54,15 @@ def create_attempt( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "ip_address": ip_address, - "user_agent": user_agent, - "email": email, - "auth_method": enum_value(auth_method), - "action": enum_value(action), - "device_fingerprint": device_fingerprint, - "bot_score": bot_score, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "ip_address": ip_address, + "user_agent": user_agent, + "email": email, + "auth_method": enum_value(auth_method), + "action": enum_value(action), + "device_fingerprint": device_fingerprint, + "bot_score": bot_score, + }.items() if v is not None} return self._client.request( method="post", path="radar/attempts", @@ -105,14 +96,10 @@ def update_attempt( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "challenge_status": challenge_status, - "attempt_status": attempt_status, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "challenge_status": challenge_status, + "attempt_status": attempt_status, + }.items() if v is not None} self._client.request( method="put", path=f"radar/attempts/{id}", @@ -235,19 +222,15 @@ async def create_attempt( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "ip_address": ip_address, - "user_agent": user_agent, - "email": email, - "auth_method": enum_value(auth_method), - "action": enum_value(action), - "device_fingerprint": device_fingerprint, - "bot_score": bot_score, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "ip_address": ip_address, + "user_agent": user_agent, + "email": email, + "auth_method": enum_value(auth_method), + "action": enum_value(action), + "device_fingerprint": device_fingerprint, + "bot_score": bot_score, + }.items() if v is not None} return await self._client.request( method="post", path="radar/attempts", @@ -281,14 +264,10 @@ async def update_attempt( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "challenge_status": challenge_status, - "attempt_status": attempt_status, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "challenge_status": challenge_status, + "attempt_status": attempt_status, + }.items() if v is not None} await self._client.request( method="put", path=f"radar/attempts/{id}", diff --git a/src/workos/radar/models/__init__.py b/src/workos/radar/models/__init__.py index afcc8cec..295610c3 100644 --- a/src/workos/radar/models/__init__.py +++ b/src/workos/radar/models/__init__.py @@ -1,22 +1,10 @@ # This file is auto-generated by oagen. Do not edit. from .radar_action import RadarAction as RadarAction -from .radar_list_entry_already_present_response import ( - RadarListEntryAlreadyPresentResponse as RadarListEntryAlreadyPresentResponse, -) -from .radar_standalone_assess_request import ( - RadarStandaloneAssessRequest as RadarStandaloneAssessRequest, -) -from .radar_standalone_delete_radar_list_entry_request import ( - RadarStandaloneDeleteRadarListEntryRequest as RadarStandaloneDeleteRadarListEntryRequest, -) -from .radar_standalone_response import ( - RadarStandaloneResponse as RadarStandaloneResponse, -) -from .radar_standalone_update_radar_attempt_request import ( - RadarStandaloneUpdateRadarAttemptRequest as RadarStandaloneUpdateRadarAttemptRequest, -) -from .radar_standalone_update_radar_list_request import ( - RadarStandaloneUpdateRadarListRequest as RadarStandaloneUpdateRadarListRequest, -) +from .radar_list_entry_already_present_response import RadarListEntryAlreadyPresentResponse as RadarListEntryAlreadyPresentResponse +from .radar_standalone_assess_request import RadarStandaloneAssessRequest as RadarStandaloneAssessRequest +from .radar_standalone_delete_radar_list_entry_request import RadarStandaloneDeleteRadarListEntryRequest as RadarStandaloneDeleteRadarListEntryRequest +from .radar_standalone_response import RadarStandaloneResponse as RadarStandaloneResponse +from .radar_standalone_update_radar_attempt_request import RadarStandaloneUpdateRadarAttemptRequest as RadarStandaloneUpdateRadarAttemptRequest +from .radar_standalone_update_radar_list_request import RadarStandaloneUpdateRadarListRequest as RadarStandaloneUpdateRadarListRequest from .radar_type import RadarType as RadarType diff --git a/src/workos/radar/models/radar_action.py b/src/workos/radar/models/radar_action.py index 7167dd11..f4fab437 100644 --- a/src/workos/radar/models/radar_action.py +++ b/src/workos/radar/models/radar_action.py @@ -24,5 +24,4 @@ def _missing_(cls, value: object) -> Optional["RadarAction"]: unknown._value_ = value return unknown - RadarActionLiteral: TypeAlias = Literal["block", "allow"] diff --git a/src/workos/radar/models/radar_list_entry_already_present_response.py b/src/workos/radar/models/radar_list_entry_already_present_response.py index 25b80a2b..a2329c66 100644 --- a/src/workos/radar/models/radar_list_entry_already_present_response.py +++ b/src/workos/radar/models/radar_list_entry_already_present_response.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error diff --git a/src/workos/radar/models/radar_standalone_assess_request.py b/src/workos/radar/models/radar_standalone_assess_request.py index 52d65fe2..7763818f 100644 --- a/src/workos/radar/models/radar_standalone_assess_request.py +++ b/src/workos/radar/models/radar_standalone_assess_request.py @@ -4,14 +4,11 @@ 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 workos.common.models.radar_standalone_assess_request_action import ( - RadarStandaloneAssessRequestAction, -) -from workos.common.models.radar_standalone_assess_request_auth_method import ( - RadarStandaloneAssessRequestAuthMethod, -) +from workos.common.models.radar_standalone_assess_request_action import RadarStandaloneAssessRequestAction +from workos.common.models.radar_standalone_assess_request_auth_method import RadarStandaloneAssessRequestAuthMethod @dataclass(slots=True) @@ -55,14 +52,8 @@ def to_dict(self) -> Dict[str, Any]: result["ip_address"] = self.ip_address result["user_agent"] = self.user_agent result["email"] = self.email - result["auth_method"] = ( - self.auth_method.value - if isinstance(self.auth_method, Enum) - else self.auth_method - ) - result["action"] = ( - self.action.value if isinstance(self.action, Enum) else self.action - ) + result["auth_method"] = self.auth_method.value if isinstance(self.auth_method, Enum) else self.auth_method + result["action"] = self.action.value if isinstance(self.action, Enum) else self.action if self.device_fingerprint is not None: result["device_fingerprint"] = self.device_fingerprint if self.bot_score is not None: diff --git a/src/workos/radar/models/radar_standalone_delete_radar_list_entry_request.py b/src/workos/radar/models/radar_standalone_delete_radar_list_entry_request.py index 4332d4c1..9ee7c05c 100644 --- a/src/workos/radar/models/radar_standalone_delete_radar_list_entry_request.py +++ b/src/workos/radar/models/radar_standalone_delete_radar_list_entry_request.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error @@ -15,9 +16,7 @@ class RadarStandaloneDeleteRadarListEntryRequest: """The value to remove from the list. Must match an existing entry.""" @classmethod - def from_dict( - cls, data: Dict[str, Any] - ) -> "RadarStandaloneDeleteRadarListEntryRequest": + def from_dict(cls, data: Dict[str, Any]) -> "RadarStandaloneDeleteRadarListEntryRequest": """Deserialize from a dictionary.""" try: return cls( diff --git a/src/workos/radar/models/radar_standalone_response.py b/src/workos/radar/models/radar_standalone_response.py index f1d7fc72..5b3f298d 100644 --- a/src/workos/radar/models/radar_standalone_response.py +++ b/src/workos/radar/models/radar_standalone_response.py @@ -4,17 +4,12 @@ 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 workos.common.models.radar_standalone_response_blocklist_type import ( - RadarStandaloneResponseBlocklistType, -) -from workos.common.models.radar_standalone_response_control import ( - RadarStandaloneResponseControl, -) -from workos.common.models.radar_standalone_response_verdict import ( - RadarStandaloneResponseVerdict, -) +from workos.common.models.radar_standalone_response_blocklist_type import RadarStandaloneResponseBlocklistType +from workos.common.models.radar_standalone_response_control import RadarStandaloneResponseControl +from workos.common.models.radar_standalone_response_verdict import RadarStandaloneResponseVerdict @dataclass(slots=True) @@ -40,12 +35,8 @@ def from_dict(cls, data: Dict[str, Any]) -> "RadarStandaloneResponse": verdict=RadarStandaloneResponseVerdict(data["verdict"]), reason=data["reason"], attempt_id=data["attempt_id"], - control=RadarStandaloneResponseControl(_v_control) - if (_v_control := data.get("control")) is not None - else None, - blocklist_type=RadarStandaloneResponseBlocklistType(_v_blocklist_type) - if (_v_blocklist_type := data.get("blocklist_type")) is not None - else None, + control=RadarStandaloneResponseControl(_v_control) if (_v_control := data.get("control")) is not None else None, + blocklist_type=RadarStandaloneResponseBlocklistType(_v_blocklist_type) if (_v_blocklist_type := data.get("blocklist_type")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("RadarStandaloneResponse", e) @@ -53,19 +44,11 @@ def from_dict(cls, data: Dict[str, Any]) -> "RadarStandaloneResponse": def to_dict(self) -> Dict[str, Any]: """Serialize to a dictionary.""" result: Dict[str, Any] = {} - result["verdict"] = ( - self.verdict.value if isinstance(self.verdict, Enum) else self.verdict - ) + result["verdict"] = self.verdict.value if isinstance(self.verdict, Enum) else self.verdict result["reason"] = self.reason result["attempt_id"] = self.attempt_id if self.control is not None: - result["control"] = ( - self.control.value if isinstance(self.control, Enum) else self.control - ) + result["control"] = self.control.value if isinstance(self.control, Enum) else self.control if self.blocklist_type is not None: - result["blocklist_type"] = ( - self.blocklist_type.value - if isinstance(self.blocklist_type, Enum) - else self.blocklist_type - ) + result["blocklist_type"] = self.blocklist_type.value if isinstance(self.blocklist_type, Enum) else self.blocklist_type return result diff --git a/src/workos/radar/models/radar_standalone_update_radar_attempt_request.py b/src/workos/radar/models/radar_standalone_update_radar_attempt_request.py index 942fe483..00dca34d 100644 --- a/src/workos/radar/models/radar_standalone_update_radar_attempt_request.py +++ b/src/workos/radar/models/radar_standalone_update_radar_attempt_request.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Literal, Optional from workos._types import _raise_deserialize_error @@ -17,9 +18,7 @@ class RadarStandaloneUpdateRadarAttemptRequest: """Set to `"success"` to mark the authentication attempt as successful.""" @classmethod - def from_dict( - cls, data: Dict[str, Any] - ) -> "RadarStandaloneUpdateRadarAttemptRequest": + def from_dict(cls, data: Dict[str, Any]) -> "RadarStandaloneUpdateRadarAttemptRequest": """Deserialize from a dictionary.""" try: return cls( diff --git a/src/workos/radar/models/radar_standalone_update_radar_list_request.py b/src/workos/radar/models/radar_standalone_update_radar_list_request.py index 4719bbb8..a9c7de09 100644 --- a/src/workos/radar/models/radar_standalone_update_radar_list_request.py +++ b/src/workos/radar/models/radar_standalone_update_radar_list_request.py @@ -1,10 +1,6 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias -from .radar_standalone_delete_radar_list_entry_request import ( - RadarStandaloneDeleteRadarListEntryRequest, -) +from .radar_standalone_delete_radar_list_entry_request import RadarStandaloneDeleteRadarListEntryRequest -RadarStandaloneUpdateRadarListRequest: TypeAlias = ( - RadarStandaloneDeleteRadarListEntryRequest -) +RadarStandaloneUpdateRadarListRequest: TypeAlias = RadarStandaloneDeleteRadarListEntryRequest diff --git a/src/workos/radar/models/radar_type.py b/src/workos/radar/models/radar_type.py index 01d0df82..84ba341e 100644 --- a/src/workos/radar/models/radar_type.py +++ b/src/workos/radar/models/radar_type.py @@ -1,9 +1,7 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias -from workos.common.models.radar_standalone_response_blocklist_type import ( - RadarStandaloneResponseBlocklistType, -) +from workos.common.models.radar_standalone_response_blocklist_type import RadarStandaloneResponseBlocklistType RadarType: TypeAlias = RadarStandaloneResponseBlocklistType __all__ = ["RadarType"] diff --git a/src/workos/sso/_resource.py b/src/workos/sso/_resource.py index 399f3e09..8360f8cc 100644 --- a/src/workos/sso/_resource.py +++ b/src/workos/sso/_resource.py @@ -2,17 +2,16 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union +from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Type, Union, cast if TYPE_CHECKING: from .._client import AsyncWorkOSClient, WorkOSClient from .._types import RequestOptions, enum_value -from .models import Connection, Profile, SSOLogoutAuthorizeResponse, SSOTokenResponse +from .models import Connection, Profile, SSOAuthorizeUrlResponse, SSOLogoutAuthorizeRequest, SSOLogoutAuthorizeResponse, SSOTokenResponse, TokenQuery from .models import ConnectionsConnectionType, ConnectionsOrder, SSOProvider from .._pagination import AsyncPage, SyncPage - class SSO: """SSO API resources.""" @@ -57,22 +56,16 @@ def list_connections( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - "connection_type": enum_value(connection_type) - if connection_type is not None - else None, - "domain": domain, - "organization_id": organization_id, - "search": search, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + "connection_type": enum_value(connection_type) if connection_type is not None else None, + "domain": domain, + "organization_id": organization_id, + "search": search, + }.items() if v is not None} return self._client.request_page( method="get", path="connections", @@ -163,7 +156,7 @@ def get_authorization_url( provider_scopes: Additional scopes to request from the identity provider. Applicable when using OAuth or OpenID Connect connections. provider_query_params: Key/value pairs of query parameters to pass to the OAuth provider. Only applicable when using OAuth connections. domain: (deprecated) Deprecated. Use `connection` or `organization` instead. Used to initiate SSO for a connection by domain. The domain must be associated with a connection in your WorkOS environment. - provider: Used to initiate OAuth authentication with Google, Microsoft, GitHub, or Apple. + provider: Used to initiate OAuth authentication with various providers. redirect_uri: Where to redirect the user after they complete the authentication process. You must use one of the redirect URIs configured via the [Redirects](https://dashboard.workos.com/redirects) page on the dashboard. state: An optional parameter that can be used to encode arbitrary information to help restore application state between redirects. If included, the redirect URI received from WorkOS will contain the exact `state` that was passed. connection: Used to initiate SSO for a connection. The value should be a WorkOS connection ID. @@ -183,25 +176,19 @@ def get_authorization_url( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "provider_scopes": ",".join(str(v) for v in provider_scopes) - if provider_scopes is not None - else None, - "provider_query_params": provider_query_params, - "domain": domain, - "provider": enum_value(provider) if provider is not None else None, - "redirect_uri": redirect_uri, - "state": state, - "connection": connection, - "organization": organization, - "domain_hint": domain_hint, - "login_hint": login_hint, - "nonce": nonce, - }.items() - if v is not None - } + params = {k: v for k, v in { + "provider_scopes": ",".join(str(v) for v in provider_scopes) if provider_scopes is not None else None, + "provider_query_params": provider_query_params, + "domain": domain, + "provider": enum_value(provider) if provider is not None else None, + "redirect_uri": redirect_uri, + "state": state, + "connection": connection, + "organization": organization, + "domain_hint": domain_hint, + "login_hint": login_hint, + "nonce": nonce, + }.items() if v is not None} params["response_type"] = "code" if self._client.client_id is not None: params["client_id"] = self._client.client_id @@ -232,13 +219,9 @@ def get_logout_url( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "token": token, - }.items() - if v is not None - } + params = {k: v for k, v in { + "token": token, + }.items() if v is not None} return self._client.build_url("sso/logout", params) def authorize_logout( @@ -300,13 +283,7 @@ def get_profile( ServerError: If the server returns a 5xx error. """ request_options = request_options or {} - request_options = { - **request_options, - "extra_headers": { - **(request_options.get("extra_headers") or {}), - "Authorization": f"Bearer {access_token}", - }, - } + request_options = {**request_options, "extra_headers": {**(request_options.get("extra_headers") or {}), "Authorization": f"Bearer {access_token}"}} return self._client.request( method="get", path="sso/profile", @@ -474,22 +451,16 @@ async def list_connections( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - "connection_type": enum_value(connection_type) - if connection_type is not None - else None, - "domain": domain, - "organization_id": organization_id, - "search": search, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + "connection_type": enum_value(connection_type) if connection_type is not None else None, + "domain": domain, + "organization_id": organization_id, + "search": search, + }.items() if v is not None} return await self._client.request_page( method="get", path="connections", @@ -580,7 +551,7 @@ def get_authorization_url( provider_scopes: Additional scopes to request from the identity provider. Applicable when using OAuth or OpenID Connect connections. provider_query_params: Key/value pairs of query parameters to pass to the OAuth provider. Only applicable when using OAuth connections. domain: (deprecated) Deprecated. Use `connection` or `organization` instead. Used to initiate SSO for a connection by domain. The domain must be associated with a connection in your WorkOS environment. - provider: Used to initiate OAuth authentication with Google, Microsoft, GitHub, or Apple. + provider: Used to initiate OAuth authentication with various providers. redirect_uri: Where to redirect the user after they complete the authentication process. You must use one of the redirect URIs configured via the [Redirects](https://dashboard.workos.com/redirects) page on the dashboard. state: An optional parameter that can be used to encode arbitrary information to help restore application state between redirects. If included, the redirect URI received from WorkOS will contain the exact `state` that was passed. connection: Used to initiate SSO for a connection. The value should be a WorkOS connection ID. @@ -600,25 +571,19 @@ def get_authorization_url( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "provider_scopes": ",".join(str(v) for v in provider_scopes) - if provider_scopes is not None - else None, - "provider_query_params": provider_query_params, - "domain": domain, - "provider": enum_value(provider) if provider is not None else None, - "redirect_uri": redirect_uri, - "state": state, - "connection": connection, - "organization": organization, - "domain_hint": domain_hint, - "login_hint": login_hint, - "nonce": nonce, - }.items() - if v is not None - } + params = {k: v for k, v in { + "provider_scopes": ",".join(str(v) for v in provider_scopes) if provider_scopes is not None else None, + "provider_query_params": provider_query_params, + "domain": domain, + "provider": enum_value(provider) if provider is not None else None, + "redirect_uri": redirect_uri, + "state": state, + "connection": connection, + "organization": organization, + "domain_hint": domain_hint, + "login_hint": login_hint, + "nonce": nonce, + }.items() if v is not None} params["response_type"] = "code" if self._client.client_id is not None: params["client_id"] = self._client.client_id @@ -649,13 +614,9 @@ def get_logout_url( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "token": token, - }.items() - if v is not None - } + params = {k: v for k, v in { + "token": token, + }.items() if v is not None} return self._client.build_url("sso/logout", params) async def authorize_logout( @@ -717,13 +678,7 @@ async def get_profile( ServerError: If the server returns a 5xx error. """ request_options = request_options or {} - request_options = { - **request_options, - "extra_headers": { - **(request_options.get("extra_headers") or {}), - "Authorization": f"Bearer {access_token}", - }, - } + request_options = {**request_options, "extra_headers": {**(request_options.get("extra_headers") or {}), "Authorization": f"Bearer {access_token}"}} return await self._client.request( method="get", path="sso/profile", diff --git a/src/workos/sso/models/__init__.py b/src/workos/sso/models/__init__.py index cd9ff9f0..b8c51a42 100644 --- a/src/workos/sso/models/__init__.py +++ b/src/workos/sso/models/__init__.py @@ -3,23 +3,13 @@ from .connection import Connection as Connection from .connection_domain import ConnectionDomain as ConnectionDomain from .connection_option import ConnectionOption as ConnectionOption -from .connections_connection_type import ( - ConnectionsConnectionType as ConnectionsConnectionType, -) +from .connections_connection_type import ConnectionsConnectionType as ConnectionsConnectionType from .connections_order import ConnectionsOrder as ConnectionsOrder from .profile import Profile as Profile -from .sso_authorize_url_response import ( - SSOAuthorizeUrlResponse as SSOAuthorizeUrlResponse, -) -from .sso_logout_authorize_request import ( - SSOLogoutAuthorizeRequest as SSOLogoutAuthorizeRequest, -) -from .sso_logout_authorize_response import ( - SSOLogoutAuthorizeResponse as SSOLogoutAuthorizeResponse, -) +from .sso_authorize_url_response import SSOAuthorizeUrlResponse as SSOAuthorizeUrlResponse +from .sso_logout_authorize_request import SSOLogoutAuthorizeRequest as SSOLogoutAuthorizeRequest +from .sso_logout_authorize_response import SSOLogoutAuthorizeResponse as SSOLogoutAuthorizeResponse from .sso_provider import SSOProvider as SSOProvider from .sso_token_response import SSOTokenResponse as SSOTokenResponse -from .sso_token_response_oauth_token import ( - SSOTokenResponseOAuthToken as SSOTokenResponseOAuthToken, -) +from .sso_token_response_oauth_token import SSOTokenResponseOAuthToken as SSOTokenResponseOAuthToken from .token_query import TokenQuery as TokenQuery diff --git a/src/workos/sso/models/connection.py b/src/workos/sso/models/connection.py index d69a9800..c6159880 100644 --- a/src/workos/sso/models/connection.py +++ b/src/workos/sso/models/connection.py @@ -56,19 +56,12 @@ def from_dict(cls, data: Dict[str, Any]) -> "Connection": connection_type=ConnectionType(data["connection_type"]), name=data["name"], state=ConnectionState(data["state"]), - domains=[ - ConnectionDomain.from_dict(cast(Dict[str, Any], item)) - for item in cast(list[Any], data["domains"]) - ], + domains=[ConnectionDomain.from_dict(cast(Dict[str, Any], item)) for item in cast(list[Any], data["domains"])], created_at=_parse_datetime(data["created_at"]), updated_at=_parse_datetime(data["updated_at"]), organization_id=data.get("organization_id"), - status=ConnectionStatus(_v_status) - if (_v_status := data.get("status")) is not None - else None, - options=ConnectionOption.from_dict(cast(Dict[str, Any], _v_options)) - if (_v_options := data.get("options")) is not None - else None, + status=ConnectionStatus(_v_status) if (_v_status := data.get("status")) is not None else None, + options=ConnectionOption.from_dict(cast(Dict[str, Any], _v_options)) if (_v_options := data.get("options")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("Connection", e) @@ -78,24 +71,16 @@ def to_dict(self) -> Dict[str, Any]: result: Dict[str, Any] = {} result["object"] = self.object result["id"] = self.id - result["connection_type"] = ( - self.connection_type.value - if isinstance(self.connection_type, Enum) - else self.connection_type - ) + result["connection_type"] = self.connection_type.value if isinstance(self.connection_type, Enum) else self.connection_type result["name"] = self.name - result["state"] = ( - self.state.value if isinstance(self.state, Enum) else self.state - ) + result["state"] = self.state.value if isinstance(self.state, Enum) else self.state result["domains"] = [item.to_dict() for item in self.domains] result["created_at"] = _format_datetime(self.created_at) result["updated_at"] = _format_datetime(self.updated_at) if self.organization_id is not None: result["organization_id"] = self.organization_id if self.status is not None: - result["status"] = ( - self.status.value if isinstance(self.status, Enum) else self.status - ) + result["status"] = self.status.value if isinstance(self.status, Enum) else self.status if self.options is not None: result["options"] = self.options.to_dict() return result diff --git a/src/workos/sso/models/connection_domain.py b/src/workos/sso/models/connection_domain.py index 96a4f53d..bd0f3088 100644 --- a/src/workos/sso/models/connection_domain.py +++ b/src/workos/sso/models/connection_domain.py @@ -1,8 +1,6 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias -from workos.common.models.connection_activated_data_domain import ( - ConnectionActivatedDataDomain, -) +from workos.common.models.connection_activated_data_domain import ConnectionActivatedDataDomain ConnectionDomain: TypeAlias = ConnectionActivatedDataDomain diff --git a/src/workos/sso/models/connection_option.py b/src/workos/sso/models/connection_option.py index a5b11de5..fb35d95a 100644 --- a/src/workos/sso/models/connection_option.py +++ b/src/workos/sso/models/connection_option.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Optional from workos._types import _raise_deserialize_error diff --git a/src/workos/sso/models/connections_connection_type.py b/src/workos/sso/models/connections_connection_type.py index 23a0c60f..ea3db567 100644 --- a/src/workos/sso/models/connections_connection_type.py +++ b/src/workos/sso/models/connections_connection_type.py @@ -70,54 +70,4 @@ def _missing_(cls, value: object) -> Optional["ConnectionsConnectionType"]: unknown._value_ = value return unknown - -ConnectionsConnectionTypeLiteral: TypeAlias = Literal[ - "ADFSSAML", - "AdpOidc", - "AppleOAuth", - "Auth0SAML", - "AzureSAML", - "BitbucketOAuth", - "CasSAML", - "CloudflareSAML", - "ClassLinkSAML", - "CleverOIDC", - "CyberArkSAML", - "DiscordOAuth", - "DuoSAML", - "EntraIdOIDC", - "GenericOIDC", - "GenericSAML", - "GithubOAuth", - "GitLabOAuth", - "GoogleOAuth", - "GoogleOIDC", - "GoogleSAML", - "IntuitOAuth", - "JumpCloudSAML", - "KeycloakSAML", - "LastPassSAML", - "LinkedInOAuth", - "LoginGovOidc", - "MagicLink", - "MicrosoftOAuth", - "MiniOrangeSAML", - "NetIqSAML", - "OktaOIDC", - "OktaSAML", - "OneLoginSAML", - "OracleSAML", - "PingFederateSAML", - "PingOneSAML", - "RipplingSAML", - "SalesforceSAML", - "ShibbolethGenericSAML", - "ShibbolethSAML", - "SimpleSamlPhpSAML", - "SalesforceOAuth", - "SlackOAuth", - "VercelMarketplaceOAuth", - "VercelOAuth", - "VMwareSAML", - "XeroOAuth", -] +ConnectionsConnectionTypeLiteral: TypeAlias = Literal["ADFSSAML", "AdpOidc", "AppleOAuth", "Auth0SAML", "AzureSAML", "BitbucketOAuth", "CasSAML", "CloudflareSAML", "ClassLinkSAML", "CleverOIDC", "CyberArkSAML", "DiscordOAuth", "DuoSAML", "EntraIdOIDC", "GenericOIDC", "GenericSAML", "GithubOAuth", "GitLabOAuth", "GoogleOAuth", "GoogleOIDC", "GoogleSAML", "IntuitOAuth", "JumpCloudSAML", "KeycloakSAML", "LastPassSAML", "LinkedInOAuth", "LoginGovOidc", "MagicLink", "MicrosoftOAuth", "MiniOrangeSAML", "NetIqSAML", "OktaOIDC", "OktaSAML", "OneLoginSAML", "OracleSAML", "PingFederateSAML", "PingOneSAML", "RipplingSAML", "SalesforceSAML", "ShibbolethGenericSAML", "ShibbolethSAML", "SimpleSamlPhpSAML", "SalesforceOAuth", "SlackOAuth", "VercelMarketplaceOAuth", "VercelOAuth", "VMwareSAML", "XeroOAuth"] diff --git a/src/workos/sso/models/profile.py b/src/workos/sso/models/profile.py index 5d828ee5..b6a42c5e 100644 --- a/src/workos/sso/models/profile.py +++ b/src/workos/sso/models/profile.py @@ -60,15 +60,8 @@ def from_dict(cls, data: Dict[str, Any]) -> "Profile": first_name=data["first_name"], last_name=data["last_name"], raw_attributes=data["raw_attributes"], - role=SlimRole.from_dict(cast(Dict[str, Any], _v_role)) - if (_v_role := data.get("role")) is not None - else None, - roles=[ - SlimRole.from_dict(cast(Dict[str, Any], item)) - for item in cast(list[Any], _v_roles) - ] - if (_v_roles := data.get("roles")) is not None - else None, + role=SlimRole.from_dict(cast(Dict[str, Any], _v_role)) if (_v_role := data.get("role")) is not None else None, + roles=[SlimRole.from_dict(cast(Dict[str, Any], item)) for item in cast(list[Any], _v_roles)] if (_v_roles := data.get("roles")) is not None else None, groups=data.get("groups"), custom_attributes=data.get("custom_attributes"), ) @@ -85,11 +78,7 @@ def to_dict(self) -> Dict[str, Any]: else: result["organization_id"] = None result["connection_id"] = self.connection_id - result["connection_type"] = ( - self.connection_type.value - if isinstance(self.connection_type, Enum) - else self.connection_type - ) + result["connection_type"] = self.connection_type.value if isinstance(self.connection_type, Enum) else self.connection_type result["idp_id"] = self.idp_id result["email"] = self.email if self.first_name is not None: diff --git a/src/workos/sso/models/sso_authorize_url_response.py b/src/workos/sso/models/sso_authorize_url_response.py index ae08dfa0..cc43e3e5 100644 --- a/src/workos/sso/models/sso_authorize_url_response.py +++ b/src/workos/sso/models/sso_authorize_url_response.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error diff --git a/src/workos/sso/models/sso_logout_authorize_request.py b/src/workos/sso/models/sso_logout_authorize_request.py index 359ae4f0..d8021441 100644 --- a/src/workos/sso/models/sso_logout_authorize_request.py +++ b/src/workos/sso/models/sso_logout_authorize_request.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error diff --git a/src/workos/sso/models/sso_logout_authorize_response.py b/src/workos/sso/models/sso_logout_authorize_response.py index 0d438f3b..df3cf417 100644 --- a/src/workos/sso/models/sso_logout_authorize_response.py +++ b/src/workos/sso/models/sso_logout_authorize_response.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error diff --git a/src/workos/sso/models/sso_provider.py b/src/workos/sso/models/sso_provider.py index 2e836c2e..d728f200 100644 --- a/src/workos/sso/models/sso_provider.py +++ b/src/workos/sso/models/sso_provider.py @@ -14,7 +14,6 @@ class SSOProvider(str, Enum): APPLE_OAUTH = "AppleOAuth" BITBUCKET_OAUTH = "BitbucketOAuth" - DISCORD_OAUTH = "DiscordOAuth" GIT_HUB_OAUTH = "GitHubOAuth" GIT_LAB_OAUTH = "GitLabOAuth" GOOGLE_OAUTH = "GoogleOAuth" @@ -36,20 +35,4 @@ def _missing_(cls, value: object) -> Optional["SSOProvider"]: unknown._value_ = value return unknown - -SSOProviderLiteral: TypeAlias = Literal[ - "AppleOAuth", - "BitbucketOAuth", - "DiscordOAuth", - "GitHubOAuth", - "GitLabOAuth", - "GoogleOAuth", - "IntuitOAuth", - "LinkedInOAuth", - "MicrosoftOAuth", - "SalesforceOAuth", - "SlackOAuth", - "VercelMarketplaceOAuth", - "VercelOAuth", - "XeroOAuth", -] +SSOProviderLiteral: TypeAlias = Literal["AppleOAuth", "BitbucketOAuth", "GitHubOAuth", "GitLabOAuth", "GoogleOAuth", "IntuitOAuth", "LinkedInOAuth", "MicrosoftOAuth", "SalesforceOAuth", "SlackOAuth", "VercelMarketplaceOAuth", "VercelOAuth", "XeroOAuth"] diff --git a/src/workos/sso/models/sso_token_response.py b/src/workos/sso/models/sso_token_response.py index 6b477609..55a1fd20 100644 --- a/src/workos/sso/models/sso_token_response.py +++ b/src/workos/sso/models/sso_token_response.py @@ -35,11 +35,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "SSOTokenResponse": access_token=data["access_token"], expires_in=data["expires_in"], profile=Profile.from_dict(cast(Dict[str, Any], data["profile"])), - oauth_tokens=SSOTokenResponseOAuthToken.from_dict( - cast(Dict[str, Any], _v_oauth_tokens) - ) - if (_v_oauth_tokens := data.get("oauth_tokens")) is not None - else None, + oauth_tokens=SSOTokenResponseOAuthToken.from_dict(cast(Dict[str, Any], _v_oauth_tokens)) if (_v_oauth_tokens := data.get("oauth_tokens")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("SSOTokenResponse", e) diff --git a/src/workos/sso/models/sso_token_response_oauth_token.py b/src/workos/sso/models/sso_token_response_oauth_token.py index ea90e36d..694c0b76 100644 --- a/src/workos/sso/models/sso_token_response_oauth_token.py +++ b/src/workos/sso/models/sso_token_response_oauth_token.py @@ -1,8 +1,6 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias -from workos.user_management.models.authenticate_response_oauth_token import ( - AuthenticateResponseOAuthToken, -) +from workos.user_management.models.authenticate_response_oauth_token import AuthenticateResponseOAuthToken SSOTokenResponseOAuthToken: TypeAlias = AuthenticateResponseOAuthToken diff --git a/src/workos/sso/models/token_query.py b/src/workos/sso/models/token_query.py index 0b498762..77173526 100644 --- a/src/workos/sso/models/token_query.py +++ b/src/workos/sso/models/token_query.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Literal from workos._types import _raise_deserialize_error diff --git a/src/workos/types/groups/__init__.py b/src/workos/types/groups/__init__.py new file mode 100644 index 00000000..2a645cc4 --- /dev/null +++ b/src/workos/types/groups/__init__.py @@ -0,0 +1,3 @@ +# This file is auto-generated by oagen. Do not edit. + +from workos.groups.models import * # noqa: F401,F403 diff --git a/src/workos/types/user_management_organization_membership_groups/__init__.py b/src/workos/types/user_management_organization_membership_groups/__init__.py new file mode 100644 index 00000000..08efae58 --- /dev/null +++ b/src/workos/types/user_management_organization_membership_groups/__init__.py @@ -0,0 +1,3 @@ +# This file is auto-generated by oagen. Do not edit. + +from workos.user_management_organization_membership_groups.models import * # noqa: F401,F403 diff --git a/src/workos/user_management/__init__.py b/src/workos/user_management/__init__.py index b77c4389..a3539781 100644 --- a/src/workos/user_management/__init__.py +++ b/src/workos/user_management/__init__.py @@ -1,11 +1,4 @@ # This file is auto-generated by oagen. Do not edit. -from ._resource import ( - UserManagement, - AsyncUserManagement, - PasswordPlaintext, - PasswordHashed, - RoleSingle, - RoleMultiple, -) +from ._resource import UserManagement, AsyncUserManagement, PasswordPlaintext, PasswordHashed, RoleSingle, RoleMultiple from .models import * diff --git a/src/workos/user_management/_resource.py b/src/workos/user_management/_resource.py index e84d43a2..5fc5abdd 100644 --- a/src/workos/user_management/_resource.py +++ b/src/workos/user_management/_resource.py @@ -2,101 +2,42 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Union, cast +from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Type, Union, cast if TYPE_CHECKING: from .._client import AsyncWorkOSClient, WorkOSClient from .._types import RequestOptions, enum_value -from .models import ( - AuthenticateResponse, - AuthorizationCodeSessionAuthenticateRequest, - AuthorizedConnectApplicationListData, - CORSOriginResponse, - DeviceAuthorizationResponse, - EmailChange, - EmailChangeConfirmation, - EmailVerification, - Invitation, - JWTTemplateResponse, - JwksResponse, - MagicAuth, - OrganizationMembership, - PasswordReset, - PasswordSessionAuthenticateRequest, - RedirectUri, - RefreshTokenSessionAuthenticateRequest, - ResetPasswordResponse, - SendVerificationEmailResponse, - DeviceCodeSessionAuthenticateRequest, - EmailVerificationCodeSessionAuthenticateRequest, - MagicAuthCodeSessionAuthenticateRequest, - MFATotpSessionAuthenticateRequest, - OrganizationSelectionSessionAuthenticateRequest, - User, - UserIdentitiesGetItem, - UserInvite, - UserOrganizationMembership, - UserSessionsListItem, - VerifyEmailResponse, -) -from .models import ( - UserManagementAuthenticationProvider, - UserManagementAuthenticationScreenHint, - UserManagementInvitationsOrder, - UserManagementOrganizationMembershipOrder, - UserManagementOrganizationMembershipStatuses, - UserManagementUsersAuthorizedApplicationsOrder, - UserManagementUsersOrder, -) -from workos.common.models.create_user_invite_options_locale import ( - CreateUserInviteOptionsLocale, -) -from workos.common.models.resend_user_invite_options_locale import ( - ResendUserInviteOptionsLocale, -) +from .models import AuthenticateResponse, AuthorizationCodeSessionAuthenticateRequest, AuthorizedConnectApplicationListData, ConfirmEmailChange, CORSOriginResponse, CreateCORSOrigin, CreateMagicCodeAndReturn, CreatePasswordReset, CreatePasswordResetToken, CreateRedirectUri, CreateUser, CreateUserInviteOptions, CreateUserOrganizationMembership, DeviceAuthorizationResponse, EmailChange, EmailChangeConfirmation, EmailVerification, Invitation, JWTTemplateResponse, JwksResponse, MagicAuth, OrganizationMembership, PasswordReset, PasswordSessionAuthenticateRequest, RedirectUri, RefreshTokenSessionAuthenticateRequest, ResendUserInviteOptions, ResetPasswordResponse, RevokeSession, SSODeviceAuthorizationRequest, SendEmailChange, SendVerificationEmailResponse, UpdateJWTTemplate, UpdateUser, UpdateUserOrganizationMembership, DeviceCodeSessionAuthenticateRequest, EmailVerificationCodeSessionAuthenticateRequest, MagicAuthCodeSessionAuthenticateRequest, MFATotpSessionAuthenticateRequest, OrganizationSelectionSessionAuthenticateRequest, User, UserIdentitiesGetItem, UserInvite, UserOrganizationMembership, UserSessionsListItem, VerifyEmailAddress, VerifyEmailResponse +from .models import UserManagementAuthenticationProvider, UserManagementAuthenticationScreenHint, UserManagementInvitationsOrder, UserManagementOrganizationMembershipOrder, UserManagementOrganizationMembershipStatuses, UserManagementUsersAuthorizedApplicationsOrder, UserManagementUsersOrder +from workos.common.models.create_user_invite_options_locale import CreateUserInviteOptionsLocale +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, -) - +from workos.common.models.create_user_password_hash_type import CreateUserPasswordHashType +from ..session import AsyncSession, AuthenticateWithSessionCookieErrorResponse, AuthenticateWithSessionCookieSuccessResponse, Session @dataclass class PasswordPlaintext: """Identify password plaintext.""" - password: Optional[str] - @dataclass class PasswordHashed: """Identify password hashed.""" - password_hash: str password_hash_type: Union[CreateUserPasswordHashType, str] - @dataclass class RoleSingle: """Identify role single.""" - role_slug: str - @dataclass class RoleMultiple: """Identify role multiple.""" - role_slugs: List[str] - class UserManagement: """User Management API resources.""" @@ -136,17 +77,7 @@ def get_jwks( def create_authenticate( self, *, - body: Union[ - AuthorizationCodeSessionAuthenticateRequest, - PasswordSessionAuthenticateRequest, - RefreshTokenSessionAuthenticateRequest, - MagicAuthCodeSessionAuthenticateRequest, - EmailVerificationCodeSessionAuthenticateRequest, - MFATotpSessionAuthenticateRequest, - OrganizationSelectionSessionAuthenticateRequest, - DeviceCodeSessionAuthenticateRequest, - Dict[str, Any], - ], + body: Union[AuthorizationCodeSessionAuthenticateRequest, PasswordSessionAuthenticateRequest, RefreshTokenSessionAuthenticateRequest, MagicAuthCodeSessionAuthenticateRequest, EmailVerificationCodeSessionAuthenticateRequest, MFATotpSessionAuthenticateRequest, OrganizationSelectionSessionAuthenticateRequest, DeviceCodeSessionAuthenticateRequest, Dict[str, Any]], request_options: Optional[RequestOptions] = None, ) -> AuthenticateResponse: """Authenticate @@ -477,9 +408,7 @@ def get_authorization_url( provider_query_params: Optional[Dict[str, str]] = None, provider_scopes: Optional[List[str]] = None, invitation_token: Optional[str] = None, - screen_hint: Optional[ - Union[UserManagementAuthenticationScreenHint, str] - ] = None, + screen_hint: Optional[Union[UserManagementAuthenticationScreenHint, str]] = None, login_hint: Optional[str] = None, provider: Optional[Union[UserManagementAuthenticationProvider, str]] = None, prompt: Optional[str] = None, @@ -517,30 +446,22 @@ def get_authorization_url( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "code_challenge_method": code_challenge_method, - "code_challenge": code_challenge, - "domain_hint": domain_hint, - "connection_id": connection_id, - "provider_query_params": provider_query_params, - "provider_scopes": ",".join(str(v) for v in provider_scopes) - if provider_scopes is not None - else None, - "invitation_token": invitation_token, - "screen_hint": enum_value(screen_hint) - if screen_hint is not None - else None, - "login_hint": login_hint, - "provider": enum_value(provider) if provider is not None else None, - "prompt": prompt, - "state": state, - "organization_id": organization_id, - "redirect_uri": redirect_uri, - }.items() - if v is not None - } + params = {k: v for k, v in { + "code_challenge_method": code_challenge_method, + "code_challenge": code_challenge, + "domain_hint": domain_hint, + "connection_id": connection_id, + "provider_query_params": provider_query_params, + "provider_scopes": ",".join(str(v) for v in provider_scopes) if provider_scopes is not None else None, + "invitation_token": invitation_token, + "screen_hint": enum_value(screen_hint) if screen_hint is not None else None, + "login_hint": login_hint, + "provider": enum_value(provider) if provider is not None else None, + "prompt": prompt, + "state": state, + "organization_id": organization_id, + "redirect_uri": redirect_uri, + }.items() if v is not None} params["response_type"] = "code" if self._client.client_id is not None: params["client_id"] = self._client.client_id @@ -606,14 +527,10 @@ def get_logout_url( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "session_id": session_id, - "return_to": return_to, - }.items() - if v is not None - } + params = {k: v for k, v in { + "session_id": session_id, + "return_to": return_to, + }.items() if v is not None} return self._client.build_url("user_management/sessions/logout", params) def revoke_session( @@ -638,14 +555,10 @@ def revoke_session( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "session_id": session_id, - "return_to": return_to, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "session_id": session_id, + "return_to": return_to, + }.items() if v is not None} self._client.request( method="post", path="user_management/sessions/revoke", @@ -859,19 +772,15 @@ def list_users( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - "organization": organization, - "organization_id": organization_id, - "email": email, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + "organization": organization, + "organization_id": organization_id, + "email": email, + }.items() if v is not None} return self._client.request_page( method="get", path="user_management/users", @@ -917,18 +826,14 @@ def create_user( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "email": email, - "first_name": first_name, - "last_name": last_name, - "email_verified": email_verified, - "metadata": metadata, - "external_id": external_id, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "email": email, + "first_name": first_name, + "last_name": last_name, + "email_verified": email_verified, + "metadata": metadata, + "external_id": external_id, + }.items() if v is not None} if password is not None: if isinstance(password, PasswordPlaintext): body["password"] = password.password @@ -1043,19 +948,15 @@ def update_user( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "email": email, - "first_name": first_name, - "last_name": last_name, - "email_verified": email_verified, - "metadata": metadata, - "external_id": external_id, - "locale": locale, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "email": email, + "first_name": first_name, + "last_name": last_name, + "email_verified": email_verified, + "metadata": metadata, + "external_id": external_id, + "locale": locale, + }.items() if v is not None} if password is not None: if isinstance(password, PasswordPlaintext): body["password"] = password.password @@ -1270,9 +1171,7 @@ def get_user_identities( path=f"user_management/users/{id}/identities", request_options=request_options, ) - return [ - UserIdentitiesGetItem.from_dict(cast(Dict[str, Any], item)) for item in raw - ] + return [UserIdentitiesGetItem.from_dict(cast(Dict[str, Any], item)) for item in raw] def list_sessions( self, @@ -1306,16 +1205,12 @@ def list_sessions( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + }.items() if v is not None} return self._client.request_page( method="get", path=f"user_management/users/{id}/sessions", @@ -1357,18 +1252,14 @@ def list_invitations( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - "organization_id": organization_id, - "email": email, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + "organization_id": organization_id, + "email": email, + }.items() if v is not None} return self._client.request_page( method="get", path="user_management/invitations", @@ -1412,18 +1303,14 @@ def send_invitation( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "email": email, - "organization_id": organization_id, - "role_slug": role_slug, - "expires_in_days": expires_in_days, - "inviter_user_id": inviter_user_id, - "locale": enum_value(locale) if locale is not None else None, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "email": email, + "organization_id": organization_id, + "role_slug": role_slug, + "expires_in_days": expires_in_days, + "inviter_user_id": inviter_user_id, + "locale": enum_value(locale) if locale is not None else None, + }.items() if v is not None} return self._client.request( method="post", path="user_management/invitations", @@ -1550,13 +1437,9 @@ def resend_invitation( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "locale": enum_value(locale) if locale is not None else None, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "locale": enum_value(locale) if locale is not None else None, + }.items() if v is not None} return self._client.request( method="post", path=f"user_management/invitations/{id}/resend", @@ -1655,14 +1538,10 @@ def create_magic_auth( AuthenticationError: If the API key is invalid (401). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "email": email, - "invitation_token": invitation_token, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "email": email, + "invitation_token": invitation_token, + }.items() if v is not None} return self._client.request( method="post", path="user_management/magic_auth", @@ -1709,9 +1588,7 @@ def list_organization_memberships( after: Optional[str] = None, order: Optional[Union[UserManagementOrganizationMembershipOrder, str]] = "desc", organization_id: Optional[str] = None, - statuses: Optional[ - List[Union[UserManagementOrganizationMembershipStatuses, str]] - ] = None, + statuses: Optional[List[Union[UserManagementOrganizationMembershipStatuses, str]]] = None, user_id: Optional[str] = None, request_options: Optional[RequestOptions] = None, ) -> SyncPage[UserOrganizationMembership]: @@ -1740,21 +1617,15 @@ def list_organization_memberships( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - "organization_id": organization_id, - "statuses": ",".join(str(v) for v in statuses) - if statuses is not None - else None, - "user_id": user_id, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + "organization_id": organization_id, + "statuses": ",".join(str(v) for v in statuses) if statuses is not None else None, + "user_id": user_id, + }.items() if v is not None} return self._client.request_page( method="get", path="user_management/organization_memberships", @@ -2023,9 +1894,7 @@ def list_user_authorized_applications( limit: Optional[int] = None, before: Optional[str] = None, after: Optional[str] = None, - order: Optional[ - Union[UserManagementUsersAuthorizedApplicationsOrder, str] - ] = "desc", + order: Optional[Union[UserManagementUsersAuthorizedApplicationsOrder, str]] = "desc", request_options: Optional[RequestOptions] = None, ) -> SyncPage[AuthorizedConnectApplicationListData]: """List authorized applications @@ -2050,16 +1919,12 @@ def list_user_authorized_applications( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + }.items() if v is not None} return self._client.request_page( method="get", path=f"user_management/users/{user_id}/authorized_applications", @@ -2304,17 +2169,7 @@ async def get_jwks( async def create_authenticate( self, *, - body: Union[ - AuthorizationCodeSessionAuthenticateRequest, - PasswordSessionAuthenticateRequest, - RefreshTokenSessionAuthenticateRequest, - MagicAuthCodeSessionAuthenticateRequest, - EmailVerificationCodeSessionAuthenticateRequest, - MFATotpSessionAuthenticateRequest, - OrganizationSelectionSessionAuthenticateRequest, - DeviceCodeSessionAuthenticateRequest, - Dict[str, Any], - ], + body: Union[AuthorizationCodeSessionAuthenticateRequest, PasswordSessionAuthenticateRequest, RefreshTokenSessionAuthenticateRequest, MagicAuthCodeSessionAuthenticateRequest, EmailVerificationCodeSessionAuthenticateRequest, MFATotpSessionAuthenticateRequest, OrganizationSelectionSessionAuthenticateRequest, DeviceCodeSessionAuthenticateRequest, Dict[str, Any]], request_options: Optional[RequestOptions] = None, ) -> AuthenticateResponse: """Authenticate @@ -2645,9 +2500,7 @@ def get_authorization_url( provider_query_params: Optional[Dict[str, str]] = None, provider_scopes: Optional[List[str]] = None, invitation_token: Optional[str] = None, - screen_hint: Optional[ - Union[UserManagementAuthenticationScreenHint, str] - ] = None, + screen_hint: Optional[Union[UserManagementAuthenticationScreenHint, str]] = None, login_hint: Optional[str] = None, provider: Optional[Union[UserManagementAuthenticationProvider, str]] = None, prompt: Optional[str] = None, @@ -2685,30 +2538,22 @@ def get_authorization_url( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "code_challenge_method": code_challenge_method, - "code_challenge": code_challenge, - "domain_hint": domain_hint, - "connection_id": connection_id, - "provider_query_params": provider_query_params, - "provider_scopes": ",".join(str(v) for v in provider_scopes) - if provider_scopes is not None - else None, - "invitation_token": invitation_token, - "screen_hint": enum_value(screen_hint) - if screen_hint is not None - else None, - "login_hint": login_hint, - "provider": enum_value(provider) if provider is not None else None, - "prompt": prompt, - "state": state, - "organization_id": organization_id, - "redirect_uri": redirect_uri, - }.items() - if v is not None - } + params = {k: v for k, v in { + "code_challenge_method": code_challenge_method, + "code_challenge": code_challenge, + "domain_hint": domain_hint, + "connection_id": connection_id, + "provider_query_params": provider_query_params, + "provider_scopes": ",".join(str(v) for v in provider_scopes) if provider_scopes is not None else None, + "invitation_token": invitation_token, + "screen_hint": enum_value(screen_hint) if screen_hint is not None else None, + "login_hint": login_hint, + "provider": enum_value(provider) if provider is not None else None, + "prompt": prompt, + "state": state, + "organization_id": organization_id, + "redirect_uri": redirect_uri, + }.items() if v is not None} params["response_type"] = "code" if self._client.client_id is not None: params["client_id"] = self._client.client_id @@ -2774,14 +2619,10 @@ def get_logout_url( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "session_id": session_id, - "return_to": return_to, - }.items() - if v is not None - } + params = {k: v for k, v in { + "session_id": session_id, + "return_to": return_to, + }.items() if v is not None} return self._client.build_url("user_management/sessions/logout", params) async def revoke_session( @@ -2806,14 +2647,10 @@ async def revoke_session( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "session_id": session_id, - "return_to": return_to, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "session_id": session_id, + "return_to": return_to, + }.items() if v is not None} await self._client.request( method="post", path="user_management/sessions/revoke", @@ -3027,19 +2864,15 @@ async def list_users( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - "organization": organization, - "organization_id": organization_id, - "email": email, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + "organization": organization, + "organization_id": organization_id, + "email": email, + }.items() if v is not None} return await self._client.request_page( method="get", path="user_management/users", @@ -3085,18 +2918,14 @@ async def create_user( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "email": email, - "first_name": first_name, - "last_name": last_name, - "email_verified": email_verified, - "metadata": metadata, - "external_id": external_id, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "email": email, + "first_name": first_name, + "last_name": last_name, + "email_verified": email_verified, + "metadata": metadata, + "external_id": external_id, + }.items() if v is not None} if password is not None: if isinstance(password, PasswordPlaintext): body["password"] = password.password @@ -3211,19 +3040,15 @@ async def update_user( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "email": email, - "first_name": first_name, - "last_name": last_name, - "email_verified": email_verified, - "metadata": metadata, - "external_id": external_id, - "locale": locale, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "email": email, + "first_name": first_name, + "last_name": last_name, + "email_verified": email_verified, + "metadata": metadata, + "external_id": external_id, + "locale": locale, + }.items() if v is not None} if password is not None: if isinstance(password, PasswordPlaintext): body["password"] = password.password @@ -3438,9 +3263,7 @@ async def get_user_identities( path=f"user_management/users/{id}/identities", request_options=request_options, ) - return [ - UserIdentitiesGetItem.from_dict(cast(Dict[str, Any], item)) for item in raw - ] + return [UserIdentitiesGetItem.from_dict(cast(Dict[str, Any], item)) for item in raw] async def list_sessions( self, @@ -3474,16 +3297,12 @@ async def list_sessions( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + }.items() if v is not None} return await self._client.request_page( method="get", path=f"user_management/users/{id}/sessions", @@ -3525,18 +3344,14 @@ async def list_invitations( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - "organization_id": organization_id, - "email": email, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + "organization_id": organization_id, + "email": email, + }.items() if v is not None} return await self._client.request_page( method="get", path="user_management/invitations", @@ -3580,18 +3395,14 @@ async def send_invitation( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "email": email, - "organization_id": organization_id, - "role_slug": role_slug, - "expires_in_days": expires_in_days, - "inviter_user_id": inviter_user_id, - "locale": enum_value(locale) if locale is not None else None, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "email": email, + "organization_id": organization_id, + "role_slug": role_slug, + "expires_in_days": expires_in_days, + "inviter_user_id": inviter_user_id, + "locale": enum_value(locale) if locale is not None else None, + }.items() if v is not None} return await self._client.request( method="post", path="user_management/invitations", @@ -3718,13 +3529,9 @@ async def resend_invitation( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "locale": enum_value(locale) if locale is not None else None, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "locale": enum_value(locale) if locale is not None else None, + }.items() if v is not None} return await self._client.request( method="post", path=f"user_management/invitations/{id}/resend", @@ -3823,14 +3630,10 @@ 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] = { - k: v - for k, v in { - "email": email, - "invitation_token": invitation_token, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "email": email, + "invitation_token": invitation_token, + }.items() if v is not None} return await self._client.request( method="post", path="user_management/magic_auth", @@ -3877,9 +3680,7 @@ async def list_organization_memberships( after: Optional[str] = None, order: Optional[Union[UserManagementOrganizationMembershipOrder, str]] = "desc", organization_id: Optional[str] = None, - statuses: Optional[ - List[Union[UserManagementOrganizationMembershipStatuses, str]] - ] = None, + statuses: Optional[List[Union[UserManagementOrganizationMembershipStatuses, str]]] = None, user_id: Optional[str] = None, request_options: Optional[RequestOptions] = None, ) -> AsyncPage[UserOrganizationMembership]: @@ -3908,21 +3709,15 @@ async def list_organization_memberships( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - "organization_id": organization_id, - "statuses": ",".join(str(v) for v in statuses) - if statuses is not None - else None, - "user_id": user_id, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + "organization_id": organization_id, + "statuses": ",".join(str(v) for v in statuses) if statuses is not None else None, + "user_id": user_id, + }.items() if v is not None} return await self._client.request_page( method="get", path="user_management/organization_memberships", @@ -4191,9 +3986,7 @@ async def list_user_authorized_applications( limit: Optional[int] = None, before: Optional[str] = None, after: Optional[str] = None, - order: Optional[ - Union[UserManagementUsersAuthorizedApplicationsOrder, str] - ] = "desc", + order: Optional[Union[UserManagementUsersAuthorizedApplicationsOrder, str]] = "desc", request_options: Optional[RequestOptions] = None, ) -> AsyncPage[AuthorizedConnectApplicationListData]: """List authorized applications @@ -4218,16 +4011,12 @@ async def list_user_authorized_applications( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + }.items() if v is not None} return await self._client.request_page( method="get", path=f"user_management/users/{user_id}/authorized_applications", diff --git a/src/workos/user_management/models/__init__.py b/src/workos/user_management/models/__init__.py index 12ba3b65..7ef01e2e 100644 --- a/src/workos/user_management/models/__init__.py +++ b/src/workos/user_management/models/__init__.py @@ -1,46 +1,24 @@ # This file is auto-generated by oagen. Do not edit. from .authenticate_response import AuthenticateResponse as AuthenticateResponse -from .authenticate_response_impersonator import ( - AuthenticateResponseImpersonator as AuthenticateResponseImpersonator, -) -from .authenticate_response_oauth_token import ( - AuthenticateResponseOAuthToken as AuthenticateResponseOAuthToken, -) -from .authorization_code_session_authenticate_request import ( - AuthorizationCodeSessionAuthenticateRequest as AuthorizationCodeSessionAuthenticateRequest, -) -from .authorized_connect_application_list_data import ( - AuthorizedConnectApplicationListData as AuthorizedConnectApplicationListData, -) +from .authenticate_response_impersonator import AuthenticateResponseImpersonator as AuthenticateResponseImpersonator +from .authenticate_response_oauth_token import AuthenticateResponseOAuthToken as AuthenticateResponseOAuthToken +from .authorization_code_session_authenticate_request import AuthorizationCodeSessionAuthenticateRequest as AuthorizationCodeSessionAuthenticateRequest +from .authorized_connect_application_list_data import AuthorizedConnectApplicationListData as AuthorizedConnectApplicationListData from .confirm_email_change import ConfirmEmailChange as ConfirmEmailChange from .cors_origin_response import CORSOriginResponse as CORSOriginResponse from .create_cors_origin import CreateCORSOrigin as CreateCORSOrigin -from .create_magic_code_and_return import ( - CreateMagicCodeAndReturn as CreateMagicCodeAndReturn, -) +from .create_magic_code_and_return import CreateMagicCodeAndReturn as CreateMagicCodeAndReturn from .create_password_reset import CreatePasswordReset as CreatePasswordReset -from .create_password_reset_token import ( - CreatePasswordResetToken as CreatePasswordResetToken, -) +from .create_password_reset_token import CreatePasswordResetToken as CreatePasswordResetToken from .create_redirect_uri import CreateRedirectUri as CreateRedirectUri from .create_user import CreateUser as CreateUser -from .create_user_invite_options import ( - CreateUserInviteOptions as CreateUserInviteOptions, -) -from .create_user_organization_membership import ( - CreateUserOrganizationMembership as CreateUserOrganizationMembership, -) -from .device_authorization_response import ( - DeviceAuthorizationResponse as DeviceAuthorizationResponse, -) +from .create_user_invite_options import CreateUserInviteOptions as CreateUserInviteOptions +from .create_user_organization_membership import CreateUserOrganizationMembership as CreateUserOrganizationMembership +from .device_authorization_response import DeviceAuthorizationResponse as DeviceAuthorizationResponse from .email_change import EmailChange as EmailChange -from .email_change_confirmation import ( - EmailChangeConfirmation as EmailChangeConfirmation, -) -from .email_change_confirmation_user import ( - EmailChangeConfirmationUser as EmailChangeConfirmationUser, -) +from .email_change_confirmation import EmailChangeConfirmation as EmailChangeConfirmation +from .email_change_confirmation_user import EmailChangeConfirmationUser as EmailChangeConfirmationUser from .email_verification import EmailVerification as EmailVerification from .invitation import Invitation as Invitation from .jwt_template_response import JWTTemplateResponse as JWTTemplateResponse @@ -49,75 +27,35 @@ from .magic_auth import MagicAuth as MagicAuth from .organization_membership import OrganizationMembership as OrganizationMembership from .password_reset import PasswordReset as PasswordReset -from .password_session_authenticate_request import ( - PasswordSessionAuthenticateRequest as PasswordSessionAuthenticateRequest, -) +from .password_session_authenticate_request import PasswordSessionAuthenticateRequest as PasswordSessionAuthenticateRequest from .redirect_uri import RedirectUri as RedirectUri -from .refresh_token_session_authenticate_request import ( - RefreshTokenSessionAuthenticateRequest as RefreshTokenSessionAuthenticateRequest, -) -from .resend_user_invite_options import ( - ResendUserInviteOptions as ResendUserInviteOptions, -) +from .refresh_token_session_authenticate_request import RefreshTokenSessionAuthenticateRequest as RefreshTokenSessionAuthenticateRequest +from .resend_user_invite_options import ResendUserInviteOptions as ResendUserInviteOptions from .reset_password_response import ResetPasswordResponse as ResetPasswordResponse from .revoke_session import RevokeSession as RevokeSession -from .sso_device_authorization_request import ( - SSODeviceAuthorizationRequest as SSODeviceAuthorizationRequest, -) +from .sso_device_authorization_request import SSODeviceAuthorizationRequest as SSODeviceAuthorizationRequest from .send_email_change import SendEmailChange as SendEmailChange -from .send_verification_email_response import ( - SendVerificationEmailResponse as SendVerificationEmailResponse, -) +from .send_verification_email_response import SendVerificationEmailResponse as SendVerificationEmailResponse from .update_jwt_template import UpdateJWTTemplate as UpdateJWTTemplate from .update_user import UpdateUser as UpdateUser -from .update_user_organization_membership import ( - UpdateUserOrganizationMembership as UpdateUserOrganizationMembership, -) -from .device_code_session_authenticate_request import ( - DeviceCodeSessionAuthenticateRequest as DeviceCodeSessionAuthenticateRequest, -) -from .email_verification_code_session_authenticate_request import ( - EmailVerificationCodeSessionAuthenticateRequest as EmailVerificationCodeSessionAuthenticateRequest, -) -from .magic_auth_code_session_authenticate_request import ( - MagicAuthCodeSessionAuthenticateRequest as MagicAuthCodeSessionAuthenticateRequest, -) -from .mfa_totp_session_authenticate_request import ( - MFATotpSessionAuthenticateRequest as MFATotpSessionAuthenticateRequest, -) -from .organization_selection_session_authenticate_request import ( - OrganizationSelectionSessionAuthenticateRequest as OrganizationSelectionSessionAuthenticateRequest, -) +from .update_user_organization_membership import UpdateUserOrganizationMembership as UpdateUserOrganizationMembership +from .device_code_session_authenticate_request import DeviceCodeSessionAuthenticateRequest as DeviceCodeSessionAuthenticateRequest +from .email_verification_code_session_authenticate_request import EmailVerificationCodeSessionAuthenticateRequest as EmailVerificationCodeSessionAuthenticateRequest +from .magic_auth_code_session_authenticate_request import MagicAuthCodeSessionAuthenticateRequest as MagicAuthCodeSessionAuthenticateRequest +from .mfa_totp_session_authenticate_request import MFATotpSessionAuthenticateRequest as MFATotpSessionAuthenticateRequest +from .organization_selection_session_authenticate_request import OrganizationSelectionSessionAuthenticateRequest as OrganizationSelectionSessionAuthenticateRequest from .user import User as User from .user_identities_get_item import UserIdentitiesGetItem as UserIdentitiesGetItem from .user_invite import UserInvite as UserInvite -from .user_management_authentication_provider import ( - UserManagementAuthenticationProvider as UserManagementAuthenticationProvider, -) -from .user_management_authentication_screen_hint import ( - UserManagementAuthenticationScreenHint as UserManagementAuthenticationScreenHint, -) -from .user_management_invitations_order import ( - UserManagementInvitationsOrder as UserManagementInvitationsOrder, -) -from .user_management_organization_membership_order import ( - UserManagementOrganizationMembershipOrder as UserManagementOrganizationMembershipOrder, -) -from .user_management_organization_membership_statuses import ( - UserManagementOrganizationMembershipStatuses as UserManagementOrganizationMembershipStatuses, -) -from .user_management_users_authorized_applications_order import ( - UserManagementUsersAuthorizedApplicationsOrder as UserManagementUsersAuthorizedApplicationsOrder, -) -from .user_management_users_order import ( - UserManagementUsersOrder as UserManagementUsersOrder, -) -from .user_organization_membership import ( - UserOrganizationMembership as UserOrganizationMembership, -) -from .user_sessions_impersonator import ( - UserSessionsImpersonator as UserSessionsImpersonator, -) +from .user_management_authentication_provider import UserManagementAuthenticationProvider as UserManagementAuthenticationProvider +from .user_management_authentication_screen_hint import UserManagementAuthenticationScreenHint as UserManagementAuthenticationScreenHint +from .user_management_invitations_order import UserManagementInvitationsOrder as UserManagementInvitationsOrder +from .user_management_organization_membership_order import UserManagementOrganizationMembershipOrder as UserManagementOrganizationMembershipOrder +from .user_management_organization_membership_statuses import UserManagementOrganizationMembershipStatuses as UserManagementOrganizationMembershipStatuses +from .user_management_users_authorized_applications_order import UserManagementUsersAuthorizedApplicationsOrder as UserManagementUsersAuthorizedApplicationsOrder +from .user_management_users_order import UserManagementUsersOrder as UserManagementUsersOrder +from .user_organization_membership import UserOrganizationMembership as UserOrganizationMembership +from .user_sessions_impersonator import UserSessionsImpersonator as UserSessionsImpersonator from .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 d9557b15..b248a057 100644 --- a/src/workos/user_management/models/authenticate_response.py +++ b/src/workos/user_management/models/authenticate_response.py @@ -11,9 +11,7 @@ from .authenticate_response_impersonator import AuthenticateResponseImpersonator from .authenticate_response_oauth_token import AuthenticateResponseOAuthToken from .user import User -from workos.common.models.authenticate_response_authentication_method import ( - AuthenticateResponseAuthenticationMethod, -) +from workos.common.models.authenticate_response_authentication_method import AuthenticateResponseAuthenticationMethod @dataclass(slots=True) @@ -47,22 +45,9 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuthenticateResponse": refresh_token=data["refresh_token"], organization_id=data.get("organization_id"), authkit_authorization_code=data.get("authkit_authorization_code"), - authentication_method=AuthenticateResponseAuthenticationMethod( - _v_authentication_method - ) - if (_v_authentication_method := data.get("authentication_method")) - is not None - else None, - impersonator=AuthenticateResponseImpersonator.from_dict( - 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) - ) - if (_v_oauth_tokens := data.get("oauth_tokens")) is not None - else None, + authentication_method=AuthenticateResponseAuthenticationMethod(_v_authentication_method) if (_v_authentication_method := data.get("authentication_method")) is not None else None, + impersonator=AuthenticateResponseImpersonator.from_dict(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)) if (_v_oauth_tokens := data.get("oauth_tokens")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("AuthenticateResponse", e) @@ -78,11 +63,7 @@ def to_dict(self) -> Dict[str, Any]: if self.authkit_authorization_code is not None: result["authkit_authorization_code"] = self.authkit_authorization_code if self.authentication_method is not None: - result["authentication_method"] = ( - self.authentication_method.value - if isinstance(self.authentication_method, Enum) - else self.authentication_method - ) + result["authentication_method"] = self.authentication_method.value if isinstance(self.authentication_method, Enum) else self.authentication_method if self.impersonator is not None: result["impersonator"] = self.impersonator.to_dict() if self.oauth_tokens is not None: diff --git a/src/workos/user_management/models/authenticate_response_impersonator.py b/src/workos/user_management/models/authenticate_response_impersonator.py index 7cf3bad4..04620184 100644 --- a/src/workos/user_management/models/authenticate_response_impersonator.py +++ b/src/workos/user_management/models/authenticate_response_impersonator.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Optional from workos._types import _raise_deserialize_error 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..e796adf3 100644 --- a/src/workos/user_management/models/authenticate_response_oauth_token.py +++ b/src/workos/user_management/models/authenticate_response_oauth_token.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, List from workos._types import _raise_deserialize_error 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 1f0cda21..0519046c 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,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Literal, Optional from workos._types import _raise_deserialize_error @@ -30,9 +31,7 @@ class AuthorizationCodeSessionAuthenticateRequest: """The user agent string from the user's browser.""" @classmethod - def from_dict( - cls, data: Dict[str, Any] - ) -> "AuthorizationCodeSessionAuthenticateRequest": + def from_dict(cls, data: Dict[str, Any]) -> "AuthorizationCodeSessionAuthenticateRequest": """Deserialize from a dictionary.""" try: return cls( 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 df0c9e05..16800dd3 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 @@ -32,9 +32,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "AuthorizedConnectApplicationListDat object=data["object"], id=data["id"], granted_scopes=data["granted_scopes"], - application=ConnectApplication.from_dict( - cast(Dict[str, Any], data["application"]) - ), + application=ConnectApplication.from_dict(cast(Dict[str, Any], data["application"])), oauth_resource=data.get("oauth_resource"), ) except (KeyError, ValueError) as e: diff --git a/src/workos/user_management/models/confirm_email_change.py b/src/workos/user_management/models/confirm_email_change.py index de692cb5..dbb5378c 100644 --- a/src/workos/user_management/models/confirm_email_change.py +++ b/src/workos/user_management/models/confirm_email_change.py @@ -1,8 +1,6 @@ # 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, -) +from workos.multi_factor_auth.models.authentication_challenges_verify_request import AuthenticationChallengesVerifyRequest ConfirmEmailChange: TypeAlias = AuthenticationChallengesVerifyRequest diff --git a/src/workos/user_management/models/cors_origin_response.py b/src/workos/user_management/models/cors_origin_response.py index e6402f6e..37c99910 100644 --- a/src/workos/user_management/models/cors_origin_response.py +++ b/src/workos/user_management/models/cors_origin_response.py @@ -4,6 +4,7 @@ from dataclasses import dataclass from datetime import datetime +from typing import cast from typing import Any, Dict, Literal from workos._types import _raise_deserialize_error from workos._types import _format_datetime, _parse_datetime diff --git a/src/workos/user_management/models/create_cors_origin.py b/src/workos/user_management/models/create_cors_origin.py index bf68cd6a..67f8d042 100644 --- a/src/workos/user_management/models/create_cors_origin.py +++ b/src/workos/user_management/models/create_cors_origin.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error 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 1bbed0b5..d585b775 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,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Optional from workos._types import _raise_deserialize_error diff --git a/src/workos/user_management/models/create_password_reset.py b/src/workos/user_management/models/create_password_reset.py index d1151d0f..86e3a5e8 100644 --- a/src/workos/user_management/models/create_password_reset.py +++ b/src/workos/user_management/models/create_password_reset.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error 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..f1da0e29 100644 --- a/src/workos/user_management/models/create_password_reset_token.py +++ b/src/workos/user_management/models/create_password_reset_token.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error diff --git a/src/workos/user_management/models/create_redirect_uri.py b/src/workos/user_management/models/create_redirect_uri.py index f838eab8..09f5ded7 100644 --- a/src/workos/user_management/models/create_redirect_uri.py +++ b/src/workos/user_management/models/create_redirect_uri.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error diff --git a/src/workos/user_management/models/create_user.py b/src/workos/user_management/models/create_user.py index 8c8a37c1..97225704 100644 --- a/src/workos/user_management/models/create_user.py +++ b/src/workos/user_management/models/create_user.py @@ -4,11 +4,10 @@ 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 workos.common.models.create_user_password_hash_type import ( - CreateUserPasswordHashType, -) +from workos.common.models.create_user_password_hash_type import CreateUserPasswordHashType @dataclass(slots=True) @@ -47,9 +46,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "CreateUser": external_id=data.get("external_id"), password=data.get("password"), password_hash=data.get("password_hash"), - password_hash_type=CreateUserPasswordHashType(_v_password_hash_type) - if (_v_password_hash_type := data.get("password_hash_type")) is not None - else None, + password_hash_type=CreateUserPasswordHashType(_v_password_hash_type) if (_v_password_hash_type := data.get("password_hash_type")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("CreateUser", e) @@ -85,9 +82,5 @@ def to_dict(self) -> Dict[str, Any]: if self.password_hash is not None: result["password_hash"] = self.password_hash if self.password_hash_type is not None: - result["password_hash_type"] = ( - self.password_hash_type.value - if isinstance(self.password_hash_type, Enum) - else self.password_hash_type - ) + result["password_hash_type"] = self.password_hash_type.value if isinstance(self.password_hash_type, Enum) else self.password_hash_type return result 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..0893f23f 100644 --- a/src/workos/user_management/models/create_user_invite_options.py +++ b/src/workos/user_management/models/create_user_invite_options.py @@ -4,11 +4,10 @@ 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 workos.common.models.create_user_invite_options_locale import ( - CreateUserInviteOptionsLocale, -) +from workos.common.models.create_user_invite_options_locale import CreateUserInviteOptionsLocale @dataclass(slots=True) @@ -38,9 +37,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "CreateUserInviteOptions": role_slug=data.get("role_slug"), expires_in_days=data.get("expires_in_days"), inviter_user_id=data.get("inviter_user_id"), - locale=CreateUserInviteOptionsLocale(_v_locale) - if (_v_locale := data.get("locale")) is not None - else None, + locale=CreateUserInviteOptionsLocale(_v_locale) if (_v_locale := data.get("locale")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("CreateUserInviteOptions", e) @@ -58,7 +55,5 @@ def to_dict(self) -> Dict[str, Any]: if self.inviter_user_id is not None: result["inviter_user_id"] = self.inviter_user_id if self.locale is not None: - result["locale"] = ( - self.locale.value if isinstance(self.locale, Enum) else self.locale - ) + result["locale"] = self.locale.value if isinstance(self.locale, Enum) else self.locale return result diff --git a/src/workos/user_management/models/create_user_organization_membership.py b/src/workos/user_management/models/create_user_organization_membership.py index 60e0fad3..91b1c350 100644 --- a/src/workos/user_management/models/create_user_organization_membership.py +++ b/src/workos/user_management/models/create_user_organization_membership.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, List, Optional from workos._types import _raise_deserialize_error diff --git a/src/workos/user_management/models/device_authorization_response.py b/src/workos/user_management/models/device_authorization_response.py index 2ef7eb88..ad5945b8 100644 --- a/src/workos/user_management/models/device_authorization_response.py +++ b/src/workos/user_management/models/device_authorization_response.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Optional from workos._types import _raise_deserialize_error 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 7396f755..c26c1a5c 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,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Literal, Optional from workos._types import _raise_deserialize_error diff --git a/src/workos/user_management/models/email_change_confirmation.py b/src/workos/user_management/models/email_change_confirmation.py index 62cb0c7f..251ccc54 100644 --- a/src/workos/user_management/models/email_change_confirmation.py +++ b/src/workos/user_management/models/email_change_confirmation.py @@ -25,9 +25,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "EmailChangeConfirmation": try: return cls( object=data["object"], - user=EmailChangeConfirmationUser.from_dict( - cast(Dict[str, Any], data["user"]) - ), + user=EmailChangeConfirmationUser.from_dict(cast(Dict[str, Any], data["user"])), ) except (KeyError, ValueError) as e: _raise_deserialize_error("EmailChangeConfirmation", e) diff --git a/src/workos/user_management/models/email_verification.py b/src/workos/user_management/models/email_verification.py index e44f8c96..949546cb 100644 --- a/src/workos/user_management/models/email_verification.py +++ b/src/workos/user_management/models/email_verification.py @@ -4,6 +4,7 @@ from dataclasses import dataclass from datetime import datetime +from typing import cast from typing import Any, Dict, Literal from workos._types import _raise_deserialize_error from workos._types import _format_datetime, _parse_datetime 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 4bb38461..0127b73f 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,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Literal, Optional from workos._types import _raise_deserialize_error @@ -28,9 +29,7 @@ class EmailVerificationCodeSessionAuthenticateRequest: """The user agent string from the user's browser.""" @classmethod - def from_dict( - cls, data: Dict[str, Any] - ) -> "EmailVerificationCodeSessionAuthenticateRequest": + def from_dict(cls, data: Dict[str, Any]) -> "EmailVerificationCodeSessionAuthenticateRequest": """Deserialize from a dictionary.""" try: return cls( @@ -44,9 +43,7 @@ def from_dict( user_agent=data.get("user_agent"), ) except (KeyError, ValueError) as e: - _raise_deserialize_error( - "EmailVerificationCodeSessionAuthenticateRequest", e - ) + _raise_deserialize_error("EmailVerificationCodeSessionAuthenticateRequest", e) def to_dict(self) -> Dict[str, Any]: """Serialize to a dictionary.""" diff --git a/src/workos/user_management/models/invitation.py b/src/workos/user_management/models/invitation.py index d5592b34..7858244c 100644 --- a/src/workos/user_management/models/invitation.py +++ b/src/workos/user_management/models/invitation.py @@ -5,6 +5,7 @@ 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 @@ -35,6 +36,8 @@ class Invitation: """The ID of the user who invited the recipient, if provided.""" accepted_user_id: Optional[str] """The ID of the user who accepted the invitation, once accepted.""" + role_slug: Optional[str] + """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.""" updated_at: datetime @@ -53,16 +56,13 @@ def from_dict(cls, data: Dict[str, Any]) -> "Invitation": id=data["id"], email=data["email"], state=InvitationState(data["state"]), - accepted_at=_parse_datetime(_v_accepted_at) - if (_v_accepted_at := data["accepted_at"]) is not None - else None, - revoked_at=_parse_datetime(_v_revoked_at) - if (_v_revoked_at := data["revoked_at"]) is not None - else None, + accepted_at=_parse_datetime(_v_accepted_at) if (_v_accepted_at := data["accepted_at"]) is not None else None, + revoked_at=_parse_datetime(_v_revoked_at) if (_v_revoked_at := data["revoked_at"]) is not None else None, expires_at=_parse_datetime(data["expires_at"]), organization_id=data["organization_id"], inviter_user_id=data["inviter_user_id"], accepted_user_id=data["accepted_user_id"], + role_slug=data["role_slug"], created_at=_parse_datetime(data["created_at"]), updated_at=_parse_datetime(data["updated_at"]), token=data["token"], @@ -77,9 +77,7 @@ def to_dict(self) -> Dict[str, Any]: result["object"] = self.object result["id"] = self.id result["email"] = self.email - result["state"] = ( - self.state.value if isinstance(self.state, Enum) else self.state - ) + result["state"] = self.state.value if isinstance(self.state, Enum) else self.state if self.accepted_at is not None: result["accepted_at"] = _format_datetime(self.accepted_at) else: @@ -101,6 +99,10 @@ def to_dict(self) -> Dict[str, Any]: result["accepted_user_id"] = self.accepted_user_id else: result["accepted_user_id"] = None + if self.role_slug is not None: + result["role_slug"] = self.role_slug + else: + result["role_slug"] = None result["created_at"] = _format_datetime(self.created_at) result["updated_at"] = _format_datetime(self.updated_at) result["token"] = self.token diff --git a/src/workos/user_management/models/jwks_response.py b/src/workos/user_management/models/jwks_response.py index b0e7f14d..cc42b55a 100644 --- a/src/workos/user_management/models/jwks_response.py +++ b/src/workos/user_management/models/jwks_response.py @@ -22,10 +22,7 @@ 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)) - for item in cast(list[Any], data["keys"]) - ], + keys=[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) diff --git a/src/workos/user_management/models/jwks_response_keys.py b/src/workos/user_management/models/jwks_response_keys.py index acc3d826..33c94101 100644 --- a/src/workos/user_management/models/jwks_response_keys.py +++ b/src/workos/user_management/models/jwks_response_keys.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, List, Literal from workos._types import _raise_deserialize_error diff --git a/src/workos/user_management/models/jwt_template_response.py b/src/workos/user_management/models/jwt_template_response.py index 565e3613..37b3994f 100644 --- a/src/workos/user_management/models/jwt_template_response.py +++ b/src/workos/user_management/models/jwt_template_response.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Literal from workos._types import _raise_deserialize_error diff --git a/src/workos/user_management/models/magic_auth.py b/src/workos/user_management/models/magic_auth.py index de21570e..97d3e180 100644 --- a/src/workos/user_management/models/magic_auth.py +++ b/src/workos/user_management/models/magic_auth.py @@ -4,6 +4,7 @@ from dataclasses import dataclass from datetime import datetime +from typing import cast from typing import Any, Dict, Literal from workos._types import _raise_deserialize_error from workos._types import _format_datetime, _parse_datetime 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 cfaca3b2..d1708d3c 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,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Literal, Optional from workos._types import _raise_deserialize_error @@ -30,9 +31,7 @@ class MagicAuthCodeSessionAuthenticateRequest: """The user agent string from the user's browser.""" @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( 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 c37b94cb..abd37010 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,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Literal, Optional from workos._types import _raise_deserialize_error diff --git a/src/workos/user_management/models/organization_membership.py b/src/workos/user_management/models/organization_membership.py index afb1fd6b..c5d4c886 100644 --- a/src/workos/user_management/models/organization_membership.py +++ b/src/workos/user_management/models/organization_membership.py @@ -11,9 +11,7 @@ from workos._types import _format_datetime, _parse_datetime from workos.authorization.models.slim_role import SlimRole -from workos.common.models.organization_membership_status import ( - OrganizationMembershipStatus, -) +from workos.common.models.organization_membership_status import OrganizationMembershipStatus @dataclass(slots=True) @@ -70,9 +68,7 @@ def to_dict(self) -> Dict[str, Any]: result["id"] = self.id result["user_id"] = self.user_id result["organization_id"] = self.organization_id - result["status"] = ( - self.status.value if isinstance(self.status, Enum) else self.status - ) + result["status"] = self.status.value if isinstance(self.status, Enum) else self.status result["directory_managed"] = self.directory_managed result["created_at"] = _format_datetime(self.created_at) result["updated_at"] = _format_datetime(self.updated_at) 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 73a9d05f..bdfd1691 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,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Literal, Optional from workos._types import _raise_deserialize_error @@ -28,9 +29,7 @@ class OrganizationSelectionSessionAuthenticateRequest: """The user agent string from the user's browser.""" @classmethod - def from_dict( - cls, data: Dict[str, Any] - ) -> "OrganizationSelectionSessionAuthenticateRequest": + def from_dict(cls, data: Dict[str, Any]) -> "OrganizationSelectionSessionAuthenticateRequest": """Deserialize from a dictionary.""" try: return cls( @@ -44,9 +43,7 @@ def from_dict( user_agent=data.get("user_agent"), ) except (KeyError, ValueError) as e: - _raise_deserialize_error( - "OrganizationSelectionSessionAuthenticateRequest", e - ) + _raise_deserialize_error("OrganizationSelectionSessionAuthenticateRequest", e) def to_dict(self) -> Dict[str, Any]: """Serialize to a dictionary.""" diff --git a/src/workos/user_management/models/password_reset.py b/src/workos/user_management/models/password_reset.py index f4338881..9c89fd6d 100644 --- a/src/workos/user_management/models/password_reset.py +++ b/src/workos/user_management/models/password_reset.py @@ -4,6 +4,7 @@ from dataclasses import dataclass from datetime import datetime +from typing import cast from typing import Any, Dict, Literal from workos._types import _raise_deserialize_error from workos._types import _format_datetime, _parse_datetime 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 ad9b8b63..7ff99af5 100644 --- a/src/workos/user_management/models/password_session_authenticate_request.py +++ b/src/workos/user_management/models/password_session_authenticate_request.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Literal, Optional from workos._types import _raise_deserialize_error diff --git a/src/workos/user_management/models/redirect_uri.py b/src/workos/user_management/models/redirect_uri.py index f78d58b3..83f6115e 100644 --- a/src/workos/user_management/models/redirect_uri.py +++ b/src/workos/user_management/models/redirect_uri.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Literal from workos._types import _raise_deserialize_error 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 023b2568..914dd232 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,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Literal, Optional from workos._types import _raise_deserialize_error @@ -28,9 +29,7 @@ class RefreshTokenSessionAuthenticateRequest: """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( 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..44b94967 100644 --- a/src/workos/user_management/models/resend_user_invite_options.py +++ b/src/workos/user_management/models/resend_user_invite_options.py @@ -4,11 +4,10 @@ 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 workos.common.models.resend_user_invite_options_locale import ( - ResendUserInviteOptionsLocale, -) +from workos.common.models.resend_user_invite_options_locale import ResendUserInviteOptionsLocale @dataclass(slots=True) @@ -23,9 +22,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "ResendUserInviteOptions": """Deserialize from a dictionary.""" try: return cls( - locale=ResendUserInviteOptionsLocale(_v_locale) - if (_v_locale := data.get("locale")) is not None - else None, + locale=ResendUserInviteOptionsLocale(_v_locale) if (_v_locale := data.get("locale")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("ResendUserInviteOptions", e) @@ -34,7 +31,5 @@ def to_dict(self) -> Dict[str, Any]: """Serialize to a dictionary.""" result: Dict[str, Any] = {} if self.locale is not None: - result["locale"] = ( - self.locale.value if isinstance(self.locale, Enum) else self.locale - ) + result["locale"] = self.locale.value if isinstance(self.locale, Enum) else self.locale return result diff --git a/src/workos/user_management/models/revoke_session.py b/src/workos/user_management/models/revoke_session.py index b024ee09..f60bce85 100644 --- a/src/workos/user_management/models/revoke_session.py +++ b/src/workos/user_management/models/revoke_session.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, Optional from workos._types import _raise_deserialize_error diff --git a/src/workos/user_management/models/send_email_change.py b/src/workos/user_management/models/send_email_change.py index 4ed98d36..169e282a 100644 --- a/src/workos/user_management/models/send_email_change.py +++ b/src/workos/user_management/models/send_email_change.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error 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..8ea07019 100644 --- a/src/workos/user_management/models/sso_device_authorization_request.py +++ b/src/workos/user_management/models/sso_device_authorization_request.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error diff --git a/src/workos/user_management/models/update_jwt_template.py b/src/workos/user_management/models/update_jwt_template.py index b29da54e..5632a18b 100644 --- a/src/workos/user_management/models/update_jwt_template.py +++ b/src/workos/user_management/models/update_jwt_template.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error diff --git a/src/workos/user_management/models/update_user.py b/src/workos/user_management/models/update_user.py index b5241180..04eb107e 100644 --- a/src/workos/user_management/models/update_user.py +++ b/src/workos/user_management/models/update_user.py @@ -4,11 +4,10 @@ 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 workos.common.models.update_user_password_hash_type import ( - UpdateUserPasswordHashType, -) +from workos.common.models.update_user_password_hash_type import UpdateUserPasswordHashType @dataclass(slots=True) @@ -50,9 +49,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "UpdateUser": locale=data.get("locale"), password=data.get("password"), password_hash=data.get("password_hash"), - password_hash_type=UpdateUserPasswordHashType(_v_password_hash_type) - if (_v_password_hash_type := data.get("password_hash_type")) is not None - else None, + password_hash_type=UpdateUserPasswordHashType(_v_password_hash_type) if (_v_password_hash_type := data.get("password_hash_type")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("UpdateUser", e) @@ -85,9 +82,5 @@ def to_dict(self) -> Dict[str, Any]: if self.password_hash is not None: result["password_hash"] = self.password_hash if self.password_hash_type is not None: - result["password_hash_type"] = ( - self.password_hash_type.value - if isinstance(self.password_hash_type, Enum) - else self.password_hash_type - ) + result["password_hash_type"] = self.password_hash_type.value if isinstance(self.password_hash_type, Enum) else self.password_hash_type return result diff --git a/src/workos/user_management/models/update_user_organization_membership.py b/src/workos/user_management/models/update_user_organization_membership.py index cb152d29..f81eee7e 100644 --- a/src/workos/user_management/models/update_user_organization_membership.py +++ b/src/workos/user_management/models/update_user_organization_membership.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict, List, Optional from workos._types import _raise_deserialize_error diff --git a/src/workos/user_management/models/user.py b/src/workos/user_management/models/user.py index 3f8efa5c..f4c544d1 100644 --- a/src/workos/user_management/models/user.py +++ b/src/workos/user_management/models/user.py @@ -4,6 +4,7 @@ from dataclasses import dataclass from datetime import datetime +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 @@ -53,9 +54,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "User": email=data["email"], email_verified=data["email_verified"], external_id=data["external_id"], - last_sign_in_at=_parse_datetime(_v_last_sign_in_at) - if (_v_last_sign_in_at := data["last_sign_in_at"]) is not None - else None, + last_sign_in_at=_parse_datetime(_v_last_sign_in_at) if (_v_last_sign_in_at := data["last_sign_in_at"]) is not None else None, created_at=_parse_datetime(data["created_at"]), updated_at=_parse_datetime(data["updated_at"]), metadata=data.get("metadata"), 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 6c433ad6..1aa59042 100644 --- a/src/workos/user_management/models/user_identities_get_item.py +++ b/src/workos/user_management/models/user_identities_get_item.py @@ -4,11 +4,10 @@ from dataclasses import dataclass from enum import Enum +from typing import cast from typing import Any, Dict, Literal from workos._types import _raise_deserialize_error -from workos.common.models.user_identities_get_item_provider import ( - UserIdentitiesGetItemProvider, -) +from workos.common.models.user_identities_get_item_provider import UserIdentitiesGetItemProvider @dataclass(slots=True) @@ -39,7 +38,5 @@ def to_dict(self) -> Dict[str, Any]: result: Dict[str, Any] = {} result["idp_id"] = self.idp_id result["type"] = self.type - result["provider"] = ( - self.provider.value if isinstance(self.provider, Enum) else self.provider - ) + result["provider"] = self.provider.value if isinstance(self.provider, Enum) else self.provider return result 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 80b1f715..8423f5e0 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,8 @@ from __future__ import annotations from enum import Enum -from typing import Literal, Optional, TypeAlias +from typing import Optional +from typing import Literal, TypeAlias class UserManagementAuthenticationProvider(str, Enum): @@ -14,7 +15,6 @@ class UserManagementAuthenticationProvider(str, Enum): AUTHKIT = "authkit" APPLE_OAUTH = "AppleOAuth" BITBUCKET_OAUTH = "BitbucketOAuth" - DISCORD_OAUTH = "DiscordOAuth" GIT_HUB_OAUTH = "GitHubOAuth" GIT_LAB_OAUTH = "GitLabOAuth" GOOGLE_OAUTH = "GoogleOAuth" @@ -28,9 +28,7 @@ class UserManagementAuthenticationProvider(str, Enum): XERO_OAUTH = "XeroOAuth" @classmethod - def _missing_( - cls, value: object - ) -> Optional["UserManagementAuthenticationProvider"]: + def _missing_(cls, value: object) -> Optional["UserManagementAuthenticationProvider"]: if not isinstance(value, str): return None unknown = str.__new__(cls, value) @@ -38,21 +36,4 @@ def _missing_( unknown._value_ = value return unknown - -UserManagementAuthenticationProviderLiteral: TypeAlias = Literal[ - "authkit", - "AppleOAuth", - "BitbucketOAuth", - "DiscordOAuth", - "GitHubOAuth", - "GitLabOAuth", - "GoogleOAuth", - "IntuitOAuth", - "LinkedInOAuth", - "MicrosoftOAuth", - "SalesforceOAuth", - "SlackOAuth", - "VercelMarketplaceOAuth", - "VercelOAuth", - "XeroOAuth", -] +UserManagementAuthenticationProviderLiteral: TypeAlias = Literal["authkit", "AppleOAuth", "BitbucketOAuth", "GitHubOAuth", "GitLabOAuth", "GoogleOAuth", "IntuitOAuth", "LinkedInOAuth", "MicrosoftOAuth", "SalesforceOAuth", "SlackOAuth", "VercelMarketplaceOAuth", "VercelOAuth", "XeroOAuth"] diff --git a/src/workos/user_management/models/user_management_authentication_screen_hint.py b/src/workos/user_management/models/user_management_authentication_screen_hint.py index 857f793a..ddb0846c 100644 --- a/src/workos/user_management/models/user_management_authentication_screen_hint.py +++ b/src/workos/user_management/models/user_management_authentication_screen_hint.py @@ -16,9 +16,7 @@ class UserManagementAuthenticationScreenHint(str, Enum): SIGN_IN = "sign-in" @classmethod - def _missing_( - cls, value: object - ) -> Optional["UserManagementAuthenticationScreenHint"]: + def _missing_(cls, value: object) -> Optional["UserManagementAuthenticationScreenHint"]: if not isinstance(value, str): return None unknown = str.__new__(cls, value) @@ -26,5 +24,4 @@ def _missing_( unknown._value_ = value return unknown - UserManagementAuthenticationScreenHintLiteral: TypeAlias = Literal["sign-up", "sign-in"] diff --git a/src/workos/user_management/models/user_management_organization_membership_statuses.py b/src/workos/user_management/models/user_management_organization_membership_statuses.py index 96e35b1f..4a3a381e 100644 --- a/src/workos/user_management/models/user_management_organization_membership_statuses.py +++ b/src/workos/user_management/models/user_management_organization_membership_statuses.py @@ -1,11 +1,7 @@ # This file is auto-generated by oagen. Do not edit. from typing import TypeAlias -from workos.common.models.organization_membership_created_data_status import ( - OrganizationMembershipCreatedDataStatus, -) +from workos.common.models.organization_membership_created_data_status import OrganizationMembershipCreatedDataStatus -UserManagementOrganizationMembershipStatuses: TypeAlias = ( - OrganizationMembershipCreatedDataStatus -) +UserManagementOrganizationMembershipStatuses: TypeAlias = OrganizationMembershipCreatedDataStatus __all__ = ["UserManagementOrganizationMembershipStatuses"] diff --git a/src/workos/user_management/models/user_sessions_list_item.py b/src/workos/user_management/models/user_sessions_list_item.py index fb0a82fb..064fb1b2 100644 --- a/src/workos/user_management/models/user_sessions_list_item.py +++ b/src/workos/user_management/models/user_sessions_list_item.py @@ -59,16 +59,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "UserSessionsListItem": auth_method=UserSessionsAuthMethod(data["auth_method"]), status=UserSessionsStatus(data["status"]), expires_at=_parse_datetime(data["expires_at"]), - ended_at=_parse_datetime(_v_ended_at) - if (_v_ended_at := data["ended_at"]) is not None - else None, + ended_at=_parse_datetime(_v_ended_at) if (_v_ended_at := data["ended_at"]) is not None else None, created_at=_parse_datetime(data["created_at"]), updated_at=_parse_datetime(data["updated_at"]), - impersonator=UserSessionsImpersonator.from_dict( - cast(Dict[str, Any], _v_impersonator) - ) - if (_v_impersonator := data.get("impersonator")) is not None - else None, + impersonator=UserSessionsImpersonator.from_dict(cast(Dict[str, Any], _v_impersonator)) if (_v_impersonator := data.get("impersonator")) is not None else None, organization_id=data.get("organization_id"), ) except (KeyError, ValueError) as e: @@ -88,14 +82,8 @@ def to_dict(self) -> Dict[str, Any]: else: result["user_agent"] = None result["user_id"] = self.user_id - result["auth_method"] = ( - self.auth_method.value - if isinstance(self.auth_method, Enum) - else self.auth_method - ) - result["status"] = ( - self.status.value if isinstance(self.status, Enum) else self.status - ) + result["auth_method"] = self.auth_method.value if isinstance(self.auth_method, Enum) else self.auth_method + result["status"] = self.status.value if isinstance(self.status, Enum) else self.status result["expires_at"] = _format_datetime(self.expires_at) if self.ended_at is not None: result["ended_at"] = _format_datetime(self.ended_at) diff --git a/src/workos/user_management/models/verify_email_address.py b/src/workos/user_management/models/verify_email_address.py index 773b38e7..c2562972 100644 --- a/src/workos/user_management/models/verify_email_address.py +++ b/src/workos/user_management/models/verify_email_address.py @@ -1,8 +1,6 @@ # 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, -) +from workos.multi_factor_auth.models.authentication_challenges_verify_request import AuthenticationChallengesVerifyRequest VerifyEmailAddress: TypeAlias = AuthenticationChallengesVerifyRequest diff --git a/src/workos/user_management_organization_membership_groups/__init__.py b/src/workos/user_management_organization_membership_groups/__init__.py new file mode 100644 index 00000000..64f81417 --- /dev/null +++ b/src/workos/user_management_organization_membership_groups/__init__.py @@ -0,0 +1,4 @@ +# This file is auto-generated by oagen. Do not edit. + +from ._resource import UserManagementOrganizationMembershipGroups, AsyncUserManagementOrganizationMembershipGroups +from .models import * diff --git a/src/workos/user_management_organization_membership_groups/_resource.py b/src/workos/user_management_organization_membership_groups/_resource.py new file mode 100644 index 00000000..1feace05 --- /dev/null +++ b/src/workos/user_management_organization_membership_groups/_resource.py @@ -0,0 +1,116 @@ +# This file is auto-generated by oagen. Do not edit. + +from __future__ import annotations + +from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Type, Union, cast + +if TYPE_CHECKING: + from .._client import AsyncWorkOSClient, WorkOSClient + +from .._types import RequestOptions, enum_value +from workos.groups.models.group import Group +from .models import UserManagementOrganizationMembershipGroupsOrder +from .._pagination import AsyncPage, SyncPage + +class UserManagementOrganizationMembershipGroups: + """User Management Organization Membership Groups API resources.""" + + def __init__(self, client: "WorkOSClient") -> None: + self._client = client + + def list_organization_membership_groups( + self, + om_id: str, + *, + limit: Optional[int] = None, + before: Optional[str] = None, + after: Optional[str] = None, + order: Optional[Union[UserManagementOrganizationMembershipGroupsOrder, str]] = "desc", + request_options: Optional[RequestOptions] = None, + ) -> SyncPage[Group]: + """List groups + + Get a list of groups that an organization membership belongs to. + + Args: + om_id: Unique identifier of the Organization Membership. + limit: Upper limit on the number of objects to return, between `1` and `100`. Defaults to `10`. + before: An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`. + after: An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`. + order: Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. Defaults to `desc`. + request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. + + Returns: + SyncPage[Group] + + Raises: + NotFoundError: If the resource is not found (404). + AuthenticationError: If the API key is invalid (401). + RateLimitExceededError: If rate limited (429). + ServerError: If the server returns a 5xx error. + """ + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + }.items() if v is not None} + return self._client.request_page( + method="get", + path=f"user_management/organization_memberships/{om_id}/groups", + model=Group, + params=params, + request_options=request_options, + ) + + +class AsyncUserManagementOrganizationMembershipGroups: + """User Management Organization Membership Groups API resources (async).""" + + def __init__(self, client: "AsyncWorkOSClient") -> None: + self._client = client + + async def list_organization_membership_groups( + self, + om_id: str, + *, + limit: Optional[int] = None, + before: Optional[str] = None, + after: Optional[str] = None, + order: Optional[Union[UserManagementOrganizationMembershipGroupsOrder, str]] = "desc", + request_options: Optional[RequestOptions] = None, + ) -> AsyncPage[Group]: + """List groups + + Get a list of groups that an organization membership belongs to. + + Args: + om_id: Unique identifier of the Organization Membership. + limit: Upper limit on the number of objects to return, between `1` and `100`. Defaults to `10`. + before: An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`. + after: An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`. + order: Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. Defaults to `desc`. + request_options: Per-request options. Supports extra_headers, timeout, max_retries, and base_url override. + + Returns: + AsyncPage[Group] + + Raises: + NotFoundError: If the resource is not found (404). + AuthenticationError: If the API key is invalid (401). + RateLimitExceededError: If rate limited (429). + ServerError: If the server returns a 5xx error. + """ + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + }.items() if v is not None} + return await self._client.request_page( + method="get", + path=f"user_management/organization_memberships/{om_id}/groups", + model=Group, + params=params, + request_options=request_options, + ) diff --git a/src/workos/user_management_organization_membership_groups/models/__init__.py b/src/workos/user_management_organization_membership_groups/models/__init__.py new file mode 100644 index 00000000..db9b89c2 --- /dev/null +++ b/src/workos/user_management_organization_membership_groups/models/__init__.py @@ -0,0 +1,3 @@ +# This file is auto-generated by oagen. Do not edit. + +from .user_management_organization_membership_groups_order import UserManagementOrganizationMembershipGroupsOrder as UserManagementOrganizationMembershipGroupsOrder diff --git a/src/workos/user_management_organization_membership_groups/models/user_management_organization_membership_groups_order.py b/src/workos/user_management_organization_membership_groups/models/user_management_organization_membership_groups_order.py new file mode 100644 index 00000000..eb8d238e --- /dev/null +++ b/src/workos/user_management_organization_membership_groups/models/user_management_organization_membership_groups_order.py @@ -0,0 +1,7 @@ +# This file is auto-generated by oagen. Do not edit. + +from typing import TypeAlias +from workos.connect.models.applications_order import ApplicationsOrder + +UserManagementOrganizationMembershipGroupsOrder: TypeAlias = ApplicationsOrder +__all__ = ["UserManagementOrganizationMembershipGroupsOrder"] diff --git a/src/workos/webhooks/_resource.py b/src/workos/webhooks/_resource.py index 7f0a27f2..57b97322 100644 --- a/src/workos/webhooks/_resource.py +++ b/src/workos/webhooks/_resource.py @@ -2,30 +2,23 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union +from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Type, Union, cast if TYPE_CHECKING: from .._client import AsyncWorkOSClient, WorkOSClient from .._types import RequestOptions, enum_value -from .models import WebhookEndpointJson +from .models import CreateWebhookEndpoint, UpdateWebhookEndpoint, WebhookEndpointJson from .models import WebhooksOrder -from workos.common.models.create_webhook_endpoint_events import ( - CreateWebhookEndpointEvents, -) -from workos.common.models.update_webhook_endpoint_events import ( - UpdateWebhookEndpointEvents, -) -from workos.common.models.update_webhook_endpoint_status import ( - UpdateWebhookEndpointStatus, -) +from workos.common.models.create_webhook_endpoint_events import CreateWebhookEndpointEvents +from workos.common.models.update_webhook_endpoint_events import UpdateWebhookEndpointEvents +from workos.common.models.update_webhook_endpoint_status import UpdateWebhookEndpointStatus from .._pagination import AsyncPage, SyncPage import hashlib import hmac import json import time - class Webhooks: """Webhooks API resources.""" @@ -60,16 +53,12 @@ def list_webhook_endpoints( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + }.items() if v is not None} return self._client.request_page( method="get", path="webhook_endpoints", @@ -147,15 +136,11 @@ def update_webhook_endpoint( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "endpoint_url": endpoint_url, - "status": enum_value(status) if status is not None else None, - "events": events, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "endpoint_url": endpoint_url, + "status": enum_value(status) if status is not None else None, + "events": events, + }.items() if v is not None} return self._client.request( method="patch", path=f"webhook_endpoints/{id}", @@ -317,16 +302,12 @@ async def list_webhook_endpoints( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - params = { - k: v - for k, v in { - "limit": limit, - "before": before, - "after": after, - "order": enum_value(order) if order is not None else None, - }.items() - if v is not None - } + params = {k: v for k, v in { + "limit": limit, + "before": before, + "after": after, + "order": enum_value(order) if order is not None else None, + }.items() if v is not None} return await self._client.request_page( method="get", path="webhook_endpoints", @@ -404,15 +385,11 @@ async def update_webhook_endpoint( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "endpoint_url": endpoint_url, - "status": enum_value(status) if status is not None else None, - "events": events, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "endpoint_url": endpoint_url, + "status": enum_value(status) if status is not None else None, + "events": events, + }.items() if v is not None} return await self._client.request( method="patch", path=f"webhook_endpoints/{id}", @@ -539,7 +516,6 @@ def verify_header( # @oagen-ignore-end - # @oagen-ignore-start if TYPE_CHECKING: from workos.events.models import EventSchemaVariant diff --git a/src/workos/webhooks/models/create_webhook_endpoint.py b/src/workos/webhooks/models/create_webhook_endpoint.py index 8f498e27..81ec5617 100644 --- a/src/workos/webhooks/models/create_webhook_endpoint.py +++ b/src/workos/webhooks/models/create_webhook_endpoint.py @@ -7,9 +7,7 @@ from typing import cast from typing import Any, Dict, List from workos._types import _raise_deserialize_error -from workos.common.models.create_webhook_endpoint_events import ( - CreateWebhookEndpointEvents, -) +from workos.common.models.create_webhook_endpoint_events import CreateWebhookEndpointEvents @dataclass(slots=True) @@ -27,10 +25,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "CreateWebhookEndpoint": try: return cls( endpoint_url=data["endpoint_url"], - events=[ - CreateWebhookEndpointEvents(item) - for item in cast(list[Any], data["events"]) - ], + events=[CreateWebhookEndpointEvents(item) for item in cast(list[Any], data["events"])], ) except (KeyError, ValueError) as e: _raise_deserialize_error("CreateWebhookEndpoint", e) @@ -39,7 +34,5 @@ def to_dict(self) -> Dict[str, Any]: """Serialize to a dictionary.""" result: Dict[str, Any] = {} result["endpoint_url"] = self.endpoint_url - result["events"] = [ - item.value if isinstance(item, Enum) else item for item in self.events - ] + result["events"] = [item.value if isinstance(item, Enum) else item for item in self.events] return result diff --git a/src/workos/webhooks/models/update_webhook_endpoint.py b/src/workos/webhooks/models/update_webhook_endpoint.py index 90046bc2..80905818 100644 --- a/src/workos/webhooks/models/update_webhook_endpoint.py +++ b/src/workos/webhooks/models/update_webhook_endpoint.py @@ -7,12 +7,8 @@ from typing import cast from typing import Any, Dict, List, Optional from workos._types import _raise_deserialize_error -from workos.common.models.update_webhook_endpoint_events import ( - UpdateWebhookEndpointEvents, -) -from workos.common.models.update_webhook_endpoint_status import ( - UpdateWebhookEndpointStatus, -) +from workos.common.models.update_webhook_endpoint_events import UpdateWebhookEndpointEvents +from workos.common.models.update_webhook_endpoint_status import UpdateWebhookEndpointStatus @dataclass(slots=True) @@ -32,15 +28,8 @@ def from_dict(cls, data: Dict[str, Any]) -> "UpdateWebhookEndpoint": try: return cls( endpoint_url=data.get("endpoint_url"), - status=UpdateWebhookEndpointStatus(_v_status) - if (_v_status := data.get("status")) is not None - else None, - events=[ - UpdateWebhookEndpointEvents(item) - for item in cast(list[Any], _v_events) - ] - if (_v_events := data.get("events")) is not None - else None, + status=UpdateWebhookEndpointStatus(_v_status) if (_v_status := data.get("status")) is not None else None, + events=[UpdateWebhookEndpointEvents(item) for item in cast(list[Any], _v_events)] if (_v_events := data.get("events")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("UpdateWebhookEndpoint", e) @@ -51,11 +40,7 @@ def to_dict(self) -> Dict[str, Any]: if self.endpoint_url is not None: result["endpoint_url"] = self.endpoint_url if self.status is not None: - result["status"] = ( - self.status.value if isinstance(self.status, Enum) else self.status - ) + result["status"] = self.status.value if isinstance(self.status, Enum) else self.status if self.events is not None: - result["events"] = [ - item.value if isinstance(item, Enum) else item for item in self.events - ] + result["events"] = [item.value if isinstance(item, Enum) else item for item in self.events] return result diff --git a/src/workos/webhooks/models/webhook_endpoint_json.py b/src/workos/webhooks/models/webhook_endpoint_json.py index 2954f5b3..0c7e2552 100644 --- a/src/workos/webhooks/models/webhook_endpoint_json.py +++ b/src/workos/webhooks/models/webhook_endpoint_json.py @@ -5,6 +5,7 @@ from dataclasses import dataclass from datetime import datetime from enum import Enum +from typing import cast from typing import Any, Dict, List, Literal from workos._types import _raise_deserialize_error from workos._types import _format_datetime, _parse_datetime @@ -56,9 +57,7 @@ def to_dict(self) -> Dict[str, Any]: result["id"] = self.id result["endpoint_url"] = self.endpoint_url result["secret"] = self.secret - result["status"] = ( - self.status.value if isinstance(self.status, Enum) else self.status - ) + result["status"] = self.status.value if isinstance(self.status, Enum) else self.status result["events"] = self.events result["created_at"] = _format_datetime(self.created_at) result["updated_at"] = _format_datetime(self.updated_at) diff --git a/src/workos/widgets/_resource.py b/src/workos/widgets/_resource.py index 8d9e491d..2b9e132d 100644 --- a/src/workos/widgets/_resource.py +++ b/src/workos/widgets/_resource.py @@ -2,16 +2,15 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union +from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Type, Union, cast if TYPE_CHECKING: from .._client import AsyncWorkOSClient, WorkOSClient -from .._types import RequestOptions -from .models import WidgetSessionTokenResponse +from .._types import RequestOptions, enum_value +from .models import WidgetSessionToken, WidgetSessionTokenResponse from workos.common.models.widget_session_token_scopes import WidgetSessionTokenScopes - class Widgets: """Widgets API resources.""" @@ -47,15 +46,11 @@ def create_token( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "organization_id": organization_id, - "user_id": user_id, - "scopes": scopes, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "organization_id": organization_id, + "user_id": user_id, + "scopes": scopes, + }.items() if v is not None} return self._client.request( method="post", path="widgets/token", @@ -100,15 +95,11 @@ async def create_token( RateLimitExceededError: If rate limited (429). ServerError: If the server returns a 5xx error. """ - body: Dict[str, Any] = { - k: v - for k, v in { - "organization_id": organization_id, - "user_id": user_id, - "scopes": scopes, - }.items() - if v is not None - } + body: Dict[str, Any] = {k: v for k, v in { + "organization_id": organization_id, + "user_id": user_id, + "scopes": scopes, + }.items() if v is not None} return await self._client.request( method="post", path="widgets/token", diff --git a/src/workos/widgets/models/__init__.py b/src/workos/widgets/models/__init__.py index a55c90f7..11919a5f 100644 --- a/src/workos/widgets/models/__init__.py +++ b/src/workos/widgets/models/__init__.py @@ -1,6 +1,4 @@ # This file is auto-generated by oagen. Do not edit. from .widget_session_token import WidgetSessionToken as WidgetSessionToken -from .widget_session_token_response import ( - WidgetSessionTokenResponse as WidgetSessionTokenResponse, -) +from .widget_session_token_response import WidgetSessionTokenResponse as WidgetSessionTokenResponse diff --git a/src/workos/widgets/models/widget_session_token.py b/src/workos/widgets/models/widget_session_token.py index 5a19c7c1..c11eac5e 100644 --- a/src/workos/widgets/models/widget_session_token.py +++ b/src/workos/widgets/models/widget_session_token.py @@ -28,12 +28,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "WidgetSessionToken": return cls( organization_id=data["organization_id"], user_id=data.get("user_id"), - scopes=[ - WidgetSessionTokenScopes(item) - for item in cast(list[Any], _v_scopes) - ] - if (_v_scopes := data.get("scopes")) is not None - else None, + scopes=[WidgetSessionTokenScopes(item) for item in cast(list[Any], _v_scopes)] if (_v_scopes := data.get("scopes")) is not None else None, ) except (KeyError, ValueError) as e: _raise_deserialize_error("WidgetSessionToken", e) @@ -45,7 +40,5 @@ def to_dict(self) -> Dict[str, Any]: if self.user_id is not None: result["user_id"] = self.user_id if self.scopes is not None: - result["scopes"] = [ - item.value if isinstance(item, Enum) else item for item in self.scopes - ] + result["scopes"] = [item.value if isinstance(item, Enum) else item for item in self.scopes] return result diff --git a/src/workos/widgets/models/widget_session_token_response.py b/src/workos/widgets/models/widget_session_token_response.py index 5b1e92a1..667416d7 100644 --- a/src/workos/widgets/models/widget_session_token_response.py +++ b/src/workos/widgets/models/widget_session_token_response.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import cast from typing import Any, Dict from workos._types import _raise_deserialize_error diff --git a/tests/fixtures/create_group.json b/tests/fixtures/create_group.json new file mode 100644 index 00000000..bcb47249 --- /dev/null +++ b/tests/fixtures/create_group.json @@ -0,0 +1,4 @@ +{ + "name": "Engineering", + "description": "The engineering team" +} diff --git a/tests/fixtures/create_group_membership.json b/tests/fixtures/create_group_membership.json new file mode 100644 index 00000000..45ebd1dd --- /dev/null +++ b/tests/fixtures/create_group_membership.json @@ -0,0 +1,3 @@ +{ + "organization_membership_id": "om_01HXYZ123456789ABCDEFGHIJ" +} diff --git a/tests/fixtures/domain_verification_intent_options.json b/tests/fixtures/domain_verification_intent_options.json new file mode 100644 index 00000000..d132a78a --- /dev/null +++ b/tests/fixtures/domain_verification_intent_options.json @@ -0,0 +1,3 @@ +{ + "domain_name": "example.com" +} diff --git a/tests/fixtures/generate_link.json b/tests/fixtures/generate_link.json index 660b36a7..47084d30 100644 --- a/tests/fixtures/generate_link.json +++ b/tests/fixtures/generate_link.json @@ -7,9 +7,12 @@ "sso": { "bookmark_slug": "chatgpt", "provider_type": "GoogleSAML" + }, + "domain_verification": { + "domain_name": "example.com" } }, - "admin_emails": [ - "admin@example.com" + "it_contact_emails": [ + "it-contact@example.com" ] } diff --git a/tests/fixtures/intent_options.json b/tests/fixtures/intent_options.json index 31bad913..894d5998 100644 --- a/tests/fixtures/intent_options.json +++ b/tests/fixtures/intent_options.json @@ -2,5 +2,8 @@ "sso": { "bookmark_slug": "chatgpt", "provider_type": "GoogleSAML" + }, + "domain_verification": { + "domain_name": "example.com" } } diff --git a/tests/fixtures/invitation.json b/tests/fixtures/invitation.json index c2019df7..c97b3187 100644 --- a/tests/fixtures/invitation.json +++ b/tests/fixtures/invitation.json @@ -9,6 +9,7 @@ "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", "accepted_user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", + "role_slug": "admin", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "token": "Z1uX3RbwcIl5fIGJJJCXXisdI", diff --git a/tests/fixtures/invitation_accepted.json b/tests/fixtures/invitation_accepted.json index 61b93ab4..a1460b3c 100644 --- a/tests/fixtures/invitation_accepted.json +++ b/tests/fixtures/invitation_accepted.json @@ -12,6 +12,7 @@ "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", "accepted_user_id": null, + "role_slug": "admin", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z" }, diff --git a/tests/fixtures/invitation_accepted_data.json b/tests/fixtures/invitation_accepted_data.json index 66102c6b..845de7b9 100644 --- a/tests/fixtures/invitation_accepted_data.json +++ b/tests/fixtures/invitation_accepted_data.json @@ -9,6 +9,7 @@ "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", "accepted_user_id": null, + "role_slug": "admin", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z" } diff --git a/tests/fixtures/invitation_created.json b/tests/fixtures/invitation_created.json index c83b104d..19039528 100644 --- a/tests/fixtures/invitation_created.json +++ b/tests/fixtures/invitation_created.json @@ -12,6 +12,7 @@ "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", "accepted_user_id": null, + "role_slug": "admin", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z" }, diff --git a/tests/fixtures/invitation_created_data.json b/tests/fixtures/invitation_created_data.json index 66102c6b..845de7b9 100644 --- a/tests/fixtures/invitation_created_data.json +++ b/tests/fixtures/invitation_created_data.json @@ -9,6 +9,7 @@ "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", "accepted_user_id": null, + "role_slug": "admin", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z" } diff --git a/tests/fixtures/invitation_resent.json b/tests/fixtures/invitation_resent.json index 7ace11e7..39f240fb 100644 --- a/tests/fixtures/invitation_resent.json +++ b/tests/fixtures/invitation_resent.json @@ -12,6 +12,7 @@ "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", "accepted_user_id": null, + "role_slug": "admin", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z" }, diff --git a/tests/fixtures/invitation_resent_data.json b/tests/fixtures/invitation_resent_data.json index 66102c6b..845de7b9 100644 --- a/tests/fixtures/invitation_resent_data.json +++ b/tests/fixtures/invitation_resent_data.json @@ -9,6 +9,7 @@ "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", "accepted_user_id": null, + "role_slug": "admin", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z" } diff --git a/tests/fixtures/invitation_revoked.json b/tests/fixtures/invitation_revoked.json index e8f8ff62..5b2fdfac 100644 --- a/tests/fixtures/invitation_revoked.json +++ b/tests/fixtures/invitation_revoked.json @@ -12,6 +12,7 @@ "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", "accepted_user_id": null, + "role_slug": "admin", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z" }, diff --git a/tests/fixtures/invitation_revoked_data.json b/tests/fixtures/invitation_revoked_data.json index 66102c6b..845de7b9 100644 --- a/tests/fixtures/invitation_revoked_data.json +++ b/tests/fixtures/invitation_revoked_data.json @@ -9,6 +9,7 @@ "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", "accepted_user_id": null, + "role_slug": "admin", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z" } diff --git a/tests/fixtures/list_group.json b/tests/fixtures/list_group.json new file mode 100644 index 00000000..9516016b --- /dev/null +++ b/tests/fixtures/list_group.json @@ -0,0 +1,17 @@ +{ + "data": [ + { + "object": "group", + "id": "group_01HXYZ123456789ABCDEFGHIJ", + "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", + "name": "Engineering", + "description": "The engineering team", + "created_at": "2026-01-15T12:00:00.000Z", + "updated_at": "2026-01-15T12:00:00.000Z" + } + ], + "list_metadata": { + "before": null, + "after": null + } +} diff --git a/tests/fixtures/list_user_invite.json b/tests/fixtures/list_user_invite.json index 355f3e44..6288c488 100644 --- a/tests/fixtures/list_user_invite.json +++ b/tests/fixtures/list_user_invite.json @@ -11,6 +11,7 @@ "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", "accepted_user_id": null, + "role_slug": "admin", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "token": "Z1uX3RbwcIl5fIGJJJCXXisdI", diff --git a/tests/fixtures/update_group.json b/tests/fixtures/update_group.json new file mode 100644 index 00000000..bcb47249 --- /dev/null +++ b/tests/fixtures/update_group.json @@ -0,0 +1,4 @@ +{ + "name": "Engineering", + "description": "The engineering team" +} diff --git a/tests/fixtures/user_invite.json b/tests/fixtures/user_invite.json index b3a1dbbd..6deb2ab7 100644 --- a/tests/fixtures/user_invite.json +++ b/tests/fixtures/user_invite.json @@ -9,6 +9,7 @@ "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", "accepted_user_id": null, + "role_slug": "admin", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "token": "Z1uX3RbwcIl5fIGJJJCXXisdI", diff --git a/tests/fixtures/waitlist_user.json b/tests/fixtures/waitlist_user.json new file mode 100644 index 00000000..05973598 --- /dev/null +++ b/tests/fixtures/waitlist_user.json @@ -0,0 +1,9 @@ +{ + "object": "waitlist_user", + "id": "wl_user_01E4ZCR3C56J083X43JQXF3JK5", + "email": "marcelina.davis@example.com", + "state": "pending", + "approved_at": null, + "created_at": "2026-01-15T12:00:00.000Z", + "updated_at": "2026-01-15T12:00:00.000Z" +} diff --git a/tests/fixtures/waitlist_user_approved.json b/tests/fixtures/waitlist_user_approved.json new file mode 100644 index 00000000..eddf230b --- /dev/null +++ b/tests/fixtures/waitlist_user_approved.json @@ -0,0 +1,35 @@ +{ + "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", + "event": "waitlist_user.approved", + "data": { + "object": "waitlist_user", + "id": "wl_user_01E4ZCR3C56J083X43JQXF3JK5", + "email": "marcelina.davis@example.com", + "state": "pending", + "approved_at": null, + "created_at": "2026-01-15T12:00:00.000Z", + "updated_at": "2026-01-15T12:00:00.000Z" + }, + "created_at": "2026-01-15T12:00:00.000Z", + "context": { + "google_analytics_client_id": "GA1.2.1234567890.1234567890", + "google_analytics_sessions": [ + { + "containerId": "GTM-ABCDEF", + "sessionId": "1234567890", + "sessionNumber": "1" + } + ], + "ajs_anonymous_id": "ajs_anon_01EHWNCE74X7JSDV0X3SZ3KJNY", + "client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY", + "actor": { + "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", + "source": "api", + "name": "Jane Doe" + }, + "previous_attributes": { + "key": {} + } + }, + "object": "event" +} diff --git a/tests/fixtures/waitlist_user_created.json b/tests/fixtures/waitlist_user_created.json new file mode 100644 index 00000000..c3faaad7 --- /dev/null +++ b/tests/fixtures/waitlist_user_created.json @@ -0,0 +1,35 @@ +{ + "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", + "event": "waitlist_user.created", + "data": { + "object": "waitlist_user", + "id": "wl_user_01E4ZCR3C56J083X43JQXF3JK5", + "email": "marcelina.davis@example.com", + "state": "pending", + "approved_at": null, + "created_at": "2026-01-15T12:00:00.000Z", + "updated_at": "2026-01-15T12:00:00.000Z" + }, + "created_at": "2026-01-15T12:00:00.000Z", + "context": { + "google_analytics_client_id": "GA1.2.1234567890.1234567890", + "google_analytics_sessions": [ + { + "containerId": "GTM-ABCDEF", + "sessionId": "1234567890", + "sessionNumber": "1" + } + ], + "ajs_anonymous_id": "ajs_anon_01EHWNCE74X7JSDV0X3SZ3KJNY", + "client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY", + "actor": { + "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", + "source": "api", + "name": "Jane Doe" + }, + "previous_attributes": { + "key": {} + } + }, + "object": "event" +} diff --git a/tests/fixtures/waitlist_user_denied.json b/tests/fixtures/waitlist_user_denied.json new file mode 100644 index 00000000..6079919b --- /dev/null +++ b/tests/fixtures/waitlist_user_denied.json @@ -0,0 +1,35 @@ +{ + "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", + "event": "waitlist_user.denied", + "data": { + "object": "waitlist_user", + "id": "wl_user_01E4ZCR3C56J083X43JQXF3JK5", + "email": "marcelina.davis@example.com", + "state": "pending", + "approved_at": null, + "created_at": "2026-01-15T12:00:00.000Z", + "updated_at": "2026-01-15T12:00:00.000Z" + }, + "created_at": "2026-01-15T12:00:00.000Z", + "context": { + "google_analytics_client_id": "GA1.2.1234567890.1234567890", + "google_analytics_sessions": [ + { + "containerId": "GTM-ABCDEF", + "sessionId": "1234567890", + "sessionNumber": "1" + } + ], + "ajs_anonymous_id": "ajs_anon_01EHWNCE74X7JSDV0X3SZ3KJNY", + "client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY", + "actor": { + "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", + "source": "api", + "name": "Jane Doe" + }, + "previous_attributes": { + "key": {} + } + }, + "object": "event" +} diff --git a/tests/test_admin_portal.py b/tests/test_admin_portal.py index 95a877cb..cc171b8c 100644 --- a/tests/test_admin_portal.py +++ b/tests/test_admin_portal.py @@ -6,28 +6,20 @@ from workos import WorkOSClient, AsyncWorkOSClient from tests.generated_helpers import load_fixture -from workos.admin_portal.models import PortalLinkResponse -from workos._errors import ( - AuthenticationError, - BadRequestError, - NotFoundError, - RateLimitExceededError, - ServerError, - UnprocessableEntityError, -) +from workos.admin_portal.models import IntentOptions, PortalLinkResponse +from workos.common.models import GenerateLinkIntent +from workos._errors import AuthenticationError, BadRequestError, NotFoundError, RateLimitExceededError, ServerError, UnprocessableEntityError class TestAdminPortal: + def test_generate_link(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("portal_link_response.json"), ) result = workos.admin_portal.generate_link(organization="test_organization") assert isinstance(result, PortalLinkResponse) - assert ( - result.link - == "https://setup.workos.com?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." - ) + assert result.link == "https://setup.workos.com?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." request = httpx_mock.get_request() assert request.method == "POST" assert request.url.path.endswith("/portal/generate_link") @@ -36,10 +28,7 @@ def test_generate_link(self, workos, httpx_mock): def test_generate_link_with_request_options(self, workos, httpx_mock): httpx_mock.add_response(json=load_fixture("portal_link_response.json")) - workos.admin_portal.generate_link( - organization="test_organization", - request_options={"extra_headers": {"X-Custom": "value"}}, - ) + workos.admin_portal.generate_link(organization="test_organization", request_options={"extra_headers": {"X-Custom": "value"}}) request = httpx_mock.get_request() assert request.headers["X-Custom"] == "value" @@ -52,9 +41,7 @@ def test_generate_link_unauthorized(self, workos, httpx_mock): workos.admin_portal.generate_link(organization="test_organization") def test_generate_link_not_found(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=404, json={"message": "Not found"}) with pytest.raises(NotFoundError): @@ -63,24 +50,16 @@ def test_generate_link_not_found(self, httpx_mock): workos.close() def test_generate_link_rate_limited(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: - httpx_mock.add_response( - status_code=429, - headers={"Retry-After": "0"}, - json={"message": "Slow down"}, - ) + httpx_mock.add_response(status_code=429, headers={"Retry-After": "0"}, json={"message": "Slow down"}) with pytest.raises(RateLimitExceededError): workos.admin_portal.generate_link(organization="test_organization") finally: workos.close() def test_generate_link_server_error(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=500, json={"message": "Server error"}) with pytest.raises(ServerError): @@ -89,9 +68,7 @@ def test_generate_link_server_error(self, httpx_mock): workos.close() def test_generate_link_bad_request(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) with pytest.raises(BadRequestError): @@ -100,9 +77,7 @@ def test_generate_link_bad_request(self, httpx_mock): workos.close() def test_generate_link_unprocessable(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) with pytest.raises(UnprocessableEntityError): @@ -112,17 +87,13 @@ def test_generate_link_unprocessable(self, httpx_mock): class TestAsyncAdminPortal: + @pytest.mark.asyncio async def test_generate_link(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("portal_link_response.json")) - result = await async_workos.admin_portal.generate_link( - organization="test_organization" - ) + result = await async_workos.admin_portal.generate_link(organization="test_organization") assert isinstance(result, PortalLinkResponse) - assert ( - result.link - == "https://setup.workos.com?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." - ) + assert result.link == "https://setup.workos.com?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." request = httpx_mock.get_request() assert request.method == "POST" assert request.url.path.endswith("/portal/generate_link") @@ -130,10 +101,7 @@ async def test_generate_link(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_generate_link_with_request_options(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("portal_link_response.json")) - await async_workos.admin_portal.generate_link( - organization="test_organization", - request_options={"extra_headers": {"X-Custom": "value"}}, - ) + await async_workos.admin_portal.generate_link(organization="test_organization", request_options={"extra_headers": {"X-Custom": "value"}}) request = httpx_mock.get_request() assert request.headers["X-Custom"] == "value" @@ -141,80 +109,54 @@ async def test_generate_link_with_request_options(self, async_workos, httpx_mock async def test_generate_link_unauthorized(self, async_workos, httpx_mock): httpx_mock.add_response(status_code=401, json={"message": "Unauthorized"}) with pytest.raises(AuthenticationError): - await async_workos.admin_portal.generate_link( - organization="test_organization" - ) + await async_workos.admin_portal.generate_link(organization="test_organization") @pytest.mark.asyncio async def test_generate_link_not_found(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=404, json={"message": "Not found"}) with pytest.raises(NotFoundError): - await workos.admin_portal.generate_link( - organization="test_organization" - ) + await workos.admin_portal.generate_link(organization="test_organization") finally: await workos.close() @pytest.mark.asyncio async def test_generate_link_rate_limited(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: - httpx_mock.add_response( - status_code=429, - headers={"Retry-After": "0"}, - json={"message": "Slow down"}, - ) + httpx_mock.add_response(status_code=429, headers={"Retry-After": "0"}, json={"message": "Slow down"}) with pytest.raises(RateLimitExceededError): - await workos.admin_portal.generate_link( - organization="test_organization" - ) + await workos.admin_portal.generate_link(organization="test_organization") finally: await workos.close() @pytest.mark.asyncio async def test_generate_link_server_error(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=500, json={"message": "Server error"}) with pytest.raises(ServerError): - await workos.admin_portal.generate_link( - organization="test_organization" - ) + await workos.admin_portal.generate_link(organization="test_organization") finally: await workos.close() @pytest.mark.asyncio async def test_generate_link_bad_request(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) with pytest.raises(BadRequestError): - await workos.admin_portal.generate_link( - organization="test_organization" - ) + await workos.admin_portal.generate_link(organization="test_organization") finally: await workos.close() @pytest.mark.asyncio async def test_generate_link_unprocessable(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) with pytest.raises(UnprocessableEntityError): - await workos.admin_portal.generate_link( - organization="test_organization" - ) + await workos.admin_portal.generate_link(organization="test_organization") finally: await workos.close() diff --git a/tests/test_api_keys.py b/tests/test_api_keys.py index e2a13dde..756cd9bc 100644 --- a/tests/test_api_keys.py +++ b/tests/test_api_keys.py @@ -6,24 +6,13 @@ from workos import WorkOSClient, AsyncWorkOSClient from tests.generated_helpers import load_fixture -from workos.api_keys.models import ( - ApiKey, - ApiKeyValidationResponse, - ApiKeyWithValue, - OrganizationsApiKeysOrder, -) +from workos.api_keys.models import ApiKey, ApiKeyValidationResponse, ApiKeyWithValue, OrganizationsApiKeysOrder from workos._pagination import AsyncPage, SyncPage -from workos._errors import ( - AuthenticationError, - BadRequestError, - NotFoundError, - RateLimitExceededError, - ServerError, - UnprocessableEntityError, -) +from workos._errors import AuthenticationError, BadRequestError, NotFoundError, RateLimitExceededError, ServerError, UnprocessableEntityError class TestApiKeys: + def test_create_validation(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("api_key_validation_response.json"), @@ -61,13 +50,7 @@ def test_list_organization_api_keys_empty_page(self, workos, httpx_mock): def test_list_organization_api_keys_encodes_query_params(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - workos.api_keys.list_organization_api_keys( - "test_organizationId", - limit=10, - before="cursor before", - after="cursor/after", - order=OrganizationsApiKeysOrder("normal"), - ) + workos.api_keys.list_organization_api_keys("test_organizationId", limit=10, before="cursor before", after="cursor/after", order=OrganizationsApiKeysOrder("normal")) request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -78,9 +61,7 @@ def test_create_organization_api_key(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("api_key_with_value.json"), ) - result = workos.api_keys.create_organization_api_key( - "test_organizationId", name="test_name" - ) + result = workos.api_keys.create_organization_api_key("test_organizationId", name="test_name") assert isinstance(result, ApiKeyWithValue) assert result.object == "api_key" assert result.id == "api_key_01EHZNVPK3SFK441A1RGBFSHRT" @@ -92,9 +73,7 @@ def test_create_organization_api_key(self, workos, httpx_mock): def test_create_validation_with_request_options(self, workos, httpx_mock): httpx_mock.add_response(json=load_fixture("api_key_validation_response.json")) - workos.api_keys.create_validation( - value="test_value", request_options={"extra_headers": {"X-Custom": "value"}} - ) + workos.api_keys.create_validation(value="test_value", request_options={"extra_headers": {"X-Custom": "value"}}) request = httpx_mock.get_request() assert request.headers["X-Custom"] == "value" @@ -107,9 +86,7 @@ def test_create_validation_unauthorized(self, workos, httpx_mock): workos.api_keys.create_validation(value="test_value") def test_create_validation_not_found(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=404, json={"message": "Not found"}) with pytest.raises(NotFoundError): @@ -118,24 +95,16 @@ def test_create_validation_not_found(self, httpx_mock): workos.close() def test_create_validation_rate_limited(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: - httpx_mock.add_response( - status_code=429, - headers={"Retry-After": "0"}, - json={"message": "Slow down"}, - ) + httpx_mock.add_response(status_code=429, headers={"Retry-After": "0"}, json={"message": "Slow down"}) with pytest.raises(RateLimitExceededError): workos.api_keys.create_validation(value="test_value") finally: workos.close() def test_create_validation_server_error(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=500, json={"message": "Server error"}) with pytest.raises(ServerError): @@ -144,9 +113,7 @@ def test_create_validation_server_error(self, httpx_mock): workos.close() def test_create_validation_bad_request(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) with pytest.raises(BadRequestError): @@ -155,9 +122,7 @@ def test_create_validation_bad_request(self, httpx_mock): workos.close() def test_create_validation_unprocessable(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) with pytest.raises(UnprocessableEntityError): @@ -167,6 +132,7 @@ def test_create_validation_unprocessable(self, httpx_mock): class TestAsyncApiKeys: + @pytest.mark.asyncio async def test_create_validation(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("api_key_validation_response.json")) @@ -188,36 +154,22 @@ async def test_delete_api_key(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_list_organization_api_keys(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("list_api_key.json")) - page = await async_workos.api_keys.list_organization_api_keys( - "test_organizationId" - ) + page = await async_workos.api_keys.list_organization_api_keys("test_organizationId") assert isinstance(page, AsyncPage) assert len(page.data) == 1 assert isinstance(page.data[0], ApiKey) @pytest.mark.asyncio - async def test_list_organization_api_keys_empty_page( - self, async_workos, httpx_mock - ): + async def test_list_organization_api_keys_empty_page(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - page = await async_workos.api_keys.list_organization_api_keys( - "test_organizationId" - ) + page = await async_workos.api_keys.list_organization_api_keys("test_organizationId") assert isinstance(page, AsyncPage) assert page.data == [] @pytest.mark.asyncio - async def test_list_organization_api_keys_encodes_query_params( - self, async_workos, httpx_mock - ): + async def test_list_organization_api_keys_encodes_query_params(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - await async_workos.api_keys.list_organization_api_keys( - "test_organizationId", - limit=10, - before="cursor before", - after="cursor/after", - order=OrganizationsApiKeysOrder("normal"), - ) + await async_workos.api_keys.list_organization_api_keys("test_organizationId", limit=10, before="cursor before", after="cursor/after", order=OrganizationsApiKeysOrder("normal")) request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -227,9 +179,7 @@ async def test_list_organization_api_keys_encodes_query_params( @pytest.mark.asyncio async def test_create_organization_api_key(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("api_key_with_value.json")) - result = await async_workos.api_keys.create_organization_api_key( - "test_organizationId", name="test_name" - ) + result = await async_workos.api_keys.create_organization_api_key("test_organizationId", name="test_name") assert isinstance(result, ApiKeyWithValue) assert result.object == "api_key" assert result.id == "api_key_01EHZNVPK3SFK441A1RGBFSHRT" @@ -238,13 +188,9 @@ async def test_create_organization_api_key(self, async_workos, httpx_mock): assert request.url.path.endswith("/organizations/test_organizationId/api_keys") @pytest.mark.asyncio - async def test_create_validation_with_request_options( - self, async_workos, httpx_mock - ): + async def test_create_validation_with_request_options(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("api_key_validation_response.json")) - await async_workos.api_keys.create_validation( - value="test_value", request_options={"extra_headers": {"X-Custom": "value"}} - ) + await async_workos.api_keys.create_validation(value="test_value", request_options={"extra_headers": {"X-Custom": "value"}}) request = httpx_mock.get_request() assert request.headers["X-Custom"] == "value" @@ -256,9 +202,7 @@ async def test_create_validation_unauthorized(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_create_validation_not_found(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=404, json={"message": "Not found"}) with pytest.raises(NotFoundError): @@ -268,15 +212,9 @@ async def test_create_validation_not_found(self, httpx_mock): @pytest.mark.asyncio async def test_create_validation_rate_limited(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: - httpx_mock.add_response( - status_code=429, - headers={"Retry-After": "0"}, - json={"message": "Slow down"}, - ) + httpx_mock.add_response(status_code=429, headers={"Retry-After": "0"}, json={"message": "Slow down"}) with pytest.raises(RateLimitExceededError): await workos.api_keys.create_validation(value="test_value") finally: @@ -284,9 +222,7 @@ async def test_create_validation_rate_limited(self, httpx_mock): @pytest.mark.asyncio async def test_create_validation_server_error(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=500, json={"message": "Server error"}) with pytest.raises(ServerError): @@ -296,9 +232,7 @@ async def test_create_validation_server_error(self, httpx_mock): @pytest.mark.asyncio async def test_create_validation_bad_request(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) with pytest.raises(BadRequestError): @@ -308,9 +242,7 @@ async def test_create_validation_bad_request(self, httpx_mock): @pytest.mark.asyncio async def test_create_validation_unprocessable(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) with pytest.raises(UnprocessableEntityError): diff --git a/tests/test_audit_logs.py b/tests/test_audit_logs.py index 5bd6d3bc..8fac2528 100644 --- a/tests/test_audit_logs.py +++ b/tests/test_audit_logs.py @@ -6,27 +6,14 @@ from workos import WorkOSClient, AsyncWorkOSClient from tests.generated_helpers import load_fixture -from workos.audit_logs.models import ( - AuditLogActionJson, - AuditLogEvent, - AuditLogEventCreateResponse, - AuditLogExportJson, - AuditLogSchemaJson, - AuditLogsOrder, -) +from workos.audit_logs.models import AuditLogActionJson, AuditLogEvent, AuditLogEventCreateResponse, AuditLogExportJson, AuditLogSchemaActor, AuditLogSchemaJson, AuditLogSchemaTarget, AuditLogsOrder from workos.organizations.models import AuditLogsRetentionJson from workos._pagination import AsyncPage, SyncPage -from workos._errors import ( - AuthenticationError, - BadRequestError, - NotFoundError, - RateLimitExceededError, - ServerError, - UnprocessableEntityError, -) +from workos._errors import AuthenticationError, BadRequestError, NotFoundError, RateLimitExceededError, ServerError, UnprocessableEntityError class TestAuditLogs: + def test_get_organization_audit_logs_retention(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("audit_logs_retention_json.json"), @@ -42,9 +29,7 @@ def test_update_organization_audit_logs_retention(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("audit_logs_retention_json.json"), ) - result = workos.audit_logs.update_organization_audit_logs_retention( - "test_id", retention_period_in_days=1 - ) + result = workos.audit_logs.update_organization_audit_logs_retention("test_id", retention_period_in_days=1) assert isinstance(result, AuditLogsRetentionJson) assert result.retention_period_in_days == 30 request = httpx_mock.get_request() @@ -70,12 +55,7 @@ def test_list_actions_empty_page(self, workos, httpx_mock): def test_list_actions_encodes_query_params(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - workos.audit_logs.list_actions( - limit=10, - before="cursor before", - after="cursor/after", - order=AuditLogsOrder("normal"), - ) + workos.audit_logs.list_actions(limit=10, before="cursor before", after="cursor/after", order=AuditLogsOrder("normal")) request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -99,13 +79,7 @@ def test_list_action_schemas_empty_page(self, workos, httpx_mock): def test_list_action_schemas_encodes_query_params(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - workos.audit_logs.list_action_schemas( - "test_actionName", - limit=10, - before="cursor before", - after="cursor/after", - order=AuditLogsOrder("normal"), - ) + workos.audit_logs.list_action_schemas("test_actionName", limit=10, before="cursor before", after="cursor/after", order=AuditLogsOrder("normal")) request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -130,10 +104,7 @@ def test_create_event(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("audit_log_event_create_response.json"), ) - result = workos.audit_logs.create_event( - organization_id="test_organization_id", - event=AuditLogEvent.from_dict(load_fixture("audit_log_event.json")), - ) + result = workos.audit_logs.create_event(organization_id="test_organization_id", event=AuditLogEvent.from_dict(load_fixture("audit_log_event.json"))) assert isinstance(result, AuditLogEventCreateResponse) assert result.success is True request = httpx_mock.get_request() @@ -147,11 +118,7 @@ def test_create_export(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("audit_log_export_json.json"), ) - result = workos.audit_logs.create_export( - organization_id="test_organization_id", - range_start="test_range_start", - range_end="test_range_end", - ) + result = workos.audit_logs.create_export(organization_id="test_organization_id", range_start="test_range_start", range_end="test_range_end") assert isinstance(result, AuditLogExportJson) assert result.object == "audit_log_export" assert result.id == "audit_log_export_01GBZK5MP7TD1YCFQHFR22180V" @@ -175,19 +142,13 @@ def test_get_export(self, workos, httpx_mock): assert request.method == "GET" assert request.url.path.endswith("/audit_logs/exports/test_auditLogExportId") - def test_get_organization_audit_logs_retention_with_request_options( - self, workos, httpx_mock - ): + def test_get_organization_audit_logs_retention_with_request_options(self, workos, httpx_mock): httpx_mock.add_response(json=load_fixture("audit_logs_retention_json.json")) - workos.audit_logs.get_organization_audit_logs_retention( - "test_id", request_options={"extra_headers": {"X-Custom": "value"}} - ) + workos.audit_logs.get_organization_audit_logs_retention("test_id", request_options={"extra_headers": {"X-Custom": "value"}}) request = httpx_mock.get_request() assert request.headers["X-Custom"] == "value" - def test_get_organization_audit_logs_retention_unauthorized( - self, workos, httpx_mock - ): + def test_get_organization_audit_logs_retention_unauthorized(self, workos, httpx_mock): httpx_mock.add_response( status_code=401, json={"message": "Unauthorized"}, @@ -196,9 +157,7 @@ def test_get_organization_audit_logs_retention_unauthorized( workos.audit_logs.get_organization_audit_logs_retention("test_id") def test_get_organization_audit_logs_retention_not_found(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=404, json={"message": "Not found"}) with pytest.raises(NotFoundError): @@ -207,24 +166,16 @@ def test_get_organization_audit_logs_retention_not_found(self, httpx_mock): workos.close() def test_get_organization_audit_logs_retention_rate_limited(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: - httpx_mock.add_response( - status_code=429, - headers={"Retry-After": "0"}, - json={"message": "Slow down"}, - ) + httpx_mock.add_response(status_code=429, headers={"Retry-After": "0"}, json={"message": "Slow down"}) with pytest.raises(RateLimitExceededError): workos.audit_logs.get_organization_audit_logs_retention("test_id") finally: workos.close() def test_get_organization_audit_logs_retention_server_error(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=500, json={"message": "Server error"}) with pytest.raises(ServerError): @@ -233,9 +184,7 @@ def test_get_organization_audit_logs_retention_server_error(self, httpx_mock): workos.close() def test_get_organization_audit_logs_retention_bad_request(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) with pytest.raises(BadRequestError): @@ -244,9 +193,7 @@ def test_get_organization_audit_logs_retention_bad_request(self, httpx_mock): workos.close() def test_get_organization_audit_logs_retention_unprocessable(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) with pytest.raises(UnprocessableEntityError): @@ -256,14 +203,11 @@ def test_get_organization_audit_logs_retention_unprocessable(self, httpx_mock): class TestAsyncAuditLogs: + @pytest.mark.asyncio - async def test_get_organization_audit_logs_retention( - self, async_workos, httpx_mock - ): + async def test_get_organization_audit_logs_retention(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("audit_logs_retention_json.json")) - result = await async_workos.audit_logs.get_organization_audit_logs_retention( - "test_id" - ) + result = await async_workos.audit_logs.get_organization_audit_logs_retention("test_id") assert isinstance(result, AuditLogsRetentionJson) assert result.retention_period_in_days == 30 request = httpx_mock.get_request() @@ -271,13 +215,9 @@ async def test_get_organization_audit_logs_retention( assert request.url.path.endswith("/organizations/test_id/audit_logs_retention") @pytest.mark.asyncio - async def test_update_organization_audit_logs_retention( - self, async_workos, httpx_mock - ): + async def test_update_organization_audit_logs_retention(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("audit_logs_retention_json.json")) - result = await async_workos.audit_logs.update_organization_audit_logs_retention( - "test_id", retention_period_in_days=1 - ) + result = await async_workos.audit_logs.update_organization_audit_logs_retention("test_id", retention_period_in_days=1) assert isinstance(result, AuditLogsRetentionJson) assert result.retention_period_in_days == 30 request = httpx_mock.get_request() @@ -302,12 +242,7 @@ async def test_list_actions_empty_page(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_list_actions_encodes_query_params(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - await async_workos.audit_logs.list_actions( - limit=10, - before="cursor before", - after="cursor/after", - order=AuditLogsOrder("normal"), - ) + await async_workos.audit_logs.list_actions(limit=10, before="cursor before", after="cursor/after", order=AuditLogsOrder("normal")) request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -330,17 +265,9 @@ async def test_list_action_schemas_empty_page(self, async_workos, httpx_mock): assert page.data == [] @pytest.mark.asyncio - async def test_list_action_schemas_encodes_query_params( - self, async_workos, httpx_mock - ): + async def test_list_action_schemas_encodes_query_params(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - await async_workos.audit_logs.list_action_schemas( - "test_actionName", - limit=10, - before="cursor before", - after="cursor/after", - order=AuditLogsOrder("normal"), - ) + await async_workos.audit_logs.list_action_schemas("test_actionName", limit=10, before="cursor before", after="cursor/after", order=AuditLogsOrder("normal")) request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -350,9 +277,7 @@ async def test_list_action_schemas_encodes_query_params( @pytest.mark.asyncio async def test_create_schema(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("audit_log_schema_json.json")) - result = await async_workos.audit_logs.create_schema( - "test_actionName", targets=[] - ) + result = await async_workos.audit_logs.create_schema("test_actionName", targets=[]) assert isinstance(result, AuditLogSchemaJson) assert result.object == "audit_log_schema" assert result.version == 1 @@ -362,13 +287,8 @@ async def test_create_schema(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_create_event(self, async_workos, httpx_mock): - httpx_mock.add_response( - json=load_fixture("audit_log_event_create_response.json") - ) - result = await async_workos.audit_logs.create_event( - organization_id="test_organization_id", - event=AuditLogEvent.from_dict(load_fixture("audit_log_event.json")), - ) + httpx_mock.add_response(json=load_fixture("audit_log_event_create_response.json")) + result = await async_workos.audit_logs.create_event(organization_id="test_organization_id", event=AuditLogEvent.from_dict(load_fixture("audit_log_event.json"))) assert isinstance(result, AuditLogEventCreateResponse) assert result.success is True request = httpx_mock.get_request() @@ -378,11 +298,7 @@ async def test_create_event(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_create_export(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("audit_log_export_json.json")) - result = await async_workos.audit_logs.create_export( - organization_id="test_organization_id", - range_start="test_range_start", - range_end="test_range_end", - ) + result = await async_workos.audit_logs.create_export(organization_id="test_organization_id", range_start="test_range_start", range_end="test_range_end") assert isinstance(result, AuditLogExportJson) assert result.object == "audit_log_export" assert result.id == "audit_log_export_01GBZK5MP7TD1YCFQHFR22180V" @@ -402,31 +318,21 @@ async def test_get_export(self, async_workos, httpx_mock): assert request.url.path.endswith("/audit_logs/exports/test_auditLogExportId") @pytest.mark.asyncio - async def test_get_organization_audit_logs_retention_with_request_options( - self, async_workos, httpx_mock - ): + async def test_get_organization_audit_logs_retention_with_request_options(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("audit_logs_retention_json.json")) - await async_workos.audit_logs.get_organization_audit_logs_retention( - "test_id", request_options={"extra_headers": {"X-Custom": "value"}} - ) + await async_workos.audit_logs.get_organization_audit_logs_retention("test_id", request_options={"extra_headers": {"X-Custom": "value"}}) request = httpx_mock.get_request() assert request.headers["X-Custom"] == "value" @pytest.mark.asyncio - async def test_get_organization_audit_logs_retention_unauthorized( - self, async_workos, httpx_mock - ): + async def test_get_organization_audit_logs_retention_unauthorized(self, async_workos, httpx_mock): httpx_mock.add_response(status_code=401, json={"message": "Unauthorized"}) with pytest.raises(AuthenticationError): - await async_workos.audit_logs.get_organization_audit_logs_retention( - "test_id" - ) + await async_workos.audit_logs.get_organization_audit_logs_retention("test_id") @pytest.mark.asyncio async def test_get_organization_audit_logs_retention_not_found(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=404, json={"message": "Not found"}) with pytest.raises(NotFoundError): @@ -436,15 +342,9 @@ async def test_get_organization_audit_logs_retention_not_found(self, httpx_mock) @pytest.mark.asyncio async def test_get_organization_audit_logs_retention_rate_limited(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: - httpx_mock.add_response( - status_code=429, - headers={"Retry-After": "0"}, - json={"message": "Slow down"}, - ) + httpx_mock.add_response(status_code=429, headers={"Retry-After": "0"}, json={"message": "Slow down"}) with pytest.raises(RateLimitExceededError): await workos.audit_logs.get_organization_audit_logs_retention("test_id") finally: @@ -452,9 +352,7 @@ async def test_get_organization_audit_logs_retention_rate_limited(self, httpx_mo @pytest.mark.asyncio async def test_get_organization_audit_logs_retention_server_error(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=500, json={"message": "Server error"}) with pytest.raises(ServerError): @@ -464,9 +362,7 @@ async def test_get_organization_audit_logs_retention_server_error(self, httpx_mo @pytest.mark.asyncio async def test_get_organization_audit_logs_retention_bad_request(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) with pytest.raises(BadRequestError): @@ -475,12 +371,8 @@ async def test_get_organization_audit_logs_retention_bad_request(self, httpx_moc await workos.close() @pytest.mark.asyncio - async def test_get_organization_audit_logs_retention_unprocessable( - self, httpx_mock - ): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + async def test_get_organization_audit_logs_retention_unprocessable(self, httpx_mock): + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) with pytest.raises(UnprocessableEntityError): diff --git a/tests/test_authorization.py b/tests/test_authorization.py index 2df6450f..43f519fe 100644 --- a/tests/test_authorization.py +++ b/tests/test_authorization.py @@ -6,134 +6,71 @@ from workos import WorkOSClient, AsyncWorkOSClient from tests.generated_helpers import load_fixture -from workos.authorization.models import ( - AuthorizationCheck, - AuthorizationPermission, - AuthorizationResource, - Permission, - Role, - RoleAssignment, - RoleList, - UserOrganizationMembershipBaseListData, - AuthorizationAssignment, - AuthorizationOrder, - PermissionsOrder, -) +from workos.authorization.models import AuthorizationCheck, AuthorizationPermission, AuthorizationResource, Permission, Role, RoleAssignment, RoleList, UserOrganizationMembershipBaseListData, AuthorizationAssignment, AuthorizationOrder, PermissionsOrder from workos._pagination import AsyncPage, SyncPage -from workos._errors import ( - AuthenticationError, - BadRequestError, - NotFoundError, - RateLimitExceededError, - ServerError, - UnprocessableEntityError, -) -from workos.authorization._resource import ( - ResourceTargetById, - ParentResourceById, - ParentById, -) +from workos._errors import AuthenticationError, BadRequestError, NotFoundError, RateLimitExceededError, ServerError, UnprocessableEntityError +from workos.authorization._resource import ResourceTargetById, ResourceTargetByExternalId, ParentResourceById, ParentResourceByExternalId, ParentById, ParentByExternalId class TestAuthorization: + def test_check(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("authorization_check.json"), ) - result = workos.authorization.check( - "test_organization_membership_id", - permission_slug="test_permission_slug", - resource_target=ResourceTargetById(resource_id="test_value"), - ) + result = workos.authorization.check("test_organization_membership_id", permission_slug="test_permission_slug", resource_target=ResourceTargetById(resource_id="test_value")) assert isinstance(result, AuthorizationCheck) assert result.authorized is True request = httpx_mock.get_request() assert request.method == "POST" - assert request.url.path.endswith( - "/authorization/organization_memberships/test_organization_membership_id/check" - ) + assert request.url.path.endswith("/authorization/organization_memberships/test_organization_membership_id/check") body = json.loads(request.content) assert body["permission_slug"] == "test_permission_slug" - def test_list_organization_membership_resources(self, workos, httpx_mock): + def test_list_resources_for_membership(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("list_authorization_resource.json"), ) - page = workos.authorization.list_organization_membership_resources( - "test_organization_membership_id", - parent_resource=ParentResourceById(parent_resource_id="test_value"), - permission_slug="test_permission_slug", - ) + page = workos.authorization.list_resources_for_membership("test_organization_membership_id", parent_resource=ParentResourceById(parent_resource_id="test_value"), permission_slug="test_permission_slug") assert isinstance(page, SyncPage) assert len(page.data) == 1 assert isinstance(page.data[0], AuthorizationResource) - def test_list_organization_membership_resources_empty_page( - self, workos, httpx_mock - ): + def test_list_resources_for_membership_empty_page(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - page = workos.authorization.list_organization_membership_resources( - "test_organization_membership_id", - parent_resource=ParentResourceById(parent_resource_id="test_value"), - permission_slug="test_permission_slug", - ) + page = workos.authorization.list_resources_for_membership("test_organization_membership_id", parent_resource=ParentResourceById(parent_resource_id="test_value"), permission_slug="test_permission_slug") assert isinstance(page, SyncPage) assert page.data == [] - def test_list_organization_membership_resources_encodes_query_params( - self, workos, httpx_mock - ): + def test_list_resources_for_membership_encodes_query_params(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - workos.authorization.list_organization_membership_resources( - "test_organization_membership_id", - parent_resource=ParentResourceById( - parent_resource_id="value parent_resource_id/test" - ), - limit=10, - before="cursor before", - after="cursor/after", - order=AuthorizationOrder("normal"), - permission_slug="value permission_slug/test", - ) + workos.authorization.list_resources_for_membership("test_organization_membership_id", parent_resource=ParentResourceById(parent_resource_id="value parent_resource_id/test"), limit=10, before="cursor before", after="cursor/after", order=AuthorizationOrder("normal"), permission_slug="value permission_slug/test") request = httpx_mock.get_request() - assert ( - request.url.params["parent_resource_id"] == "value parent_resource_id/test" - ) + assert request.url.params["parent_resource_id"] == "value parent_resource_id/test" assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" assert request.url.params["after"] == "cursor/after" assert request.url.params["order"] == "normal" assert request.url.params["permission_slug"] == "value permission_slug/test" - def test_list_resource_permissions(self, workos, httpx_mock): + def test_list_effective_permissions(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("list_authorization_permission.json"), ) - page = workos.authorization.list_resource_permissions( - "test_organization_membership_id", "test_resource_id" - ) + page = workos.authorization.list_effective_permissions("test_organization_membership_id", "test_resource_id") assert isinstance(page, SyncPage) assert len(page.data) == 1 assert isinstance(page.data[0], AuthorizationPermission) - def test_list_resource_permissions_empty_page(self, workos, httpx_mock): + def test_list_effective_permissions_empty_page(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - page = workos.authorization.list_resource_permissions( - "test_organization_membership_id", "test_resource_id" - ) + page = workos.authorization.list_effective_permissions("test_organization_membership_id", "test_resource_id") assert isinstance(page, SyncPage) assert page.data == [] - def test_list_resource_permissions_encodes_query_params(self, workos, httpx_mock): + def test_list_effective_permissions_encodes_query_params(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - workos.authorization.list_resource_permissions( - "test_organization_membership_id", - "test_resource_id", - limit=10, - before="cursor before", - after="cursor/after", - order=AuthorizationOrder("normal"), - ) + workos.authorization.list_effective_permissions("test_organization_membership_id", "test_resource_id", limit=10, before="cursor before", after="cursor/after", order=AuthorizationOrder("normal")) request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -144,78 +81,44 @@ def test_list_effective_permissions_by_external_id(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("list_authorization_permission.json"), ) - page = workos.authorization.list_effective_permissions_by_external_id( - "test_organization_membership_id", - "test_resource_type_slug", - "test_external_id", - ) + page = workos.authorization.list_effective_permissions_by_external_id("test_organization_membership_id", "test_resource_type_slug", "test_external_id") assert isinstance(page, SyncPage) assert len(page.data) == 1 assert isinstance(page.data[0], AuthorizationPermission) - def test_list_effective_permissions_by_external_id_empty_page( - self, workos, httpx_mock - ): + def test_list_effective_permissions_by_external_id_empty_page(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - page = workos.authorization.list_effective_permissions_by_external_id( - "test_organization_membership_id", - "test_resource_type_slug", - "test_external_id", - ) + page = workos.authorization.list_effective_permissions_by_external_id("test_organization_membership_id", "test_resource_type_slug", "test_external_id") assert isinstance(page, SyncPage) assert page.data == [] - def test_list_effective_permissions_by_external_id_encodes_query_params( - self, workos, httpx_mock - ): + def test_list_effective_permissions_by_external_id_encodes_query_params(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - workos.authorization.list_effective_permissions_by_external_id( - "test_organization_membership_id", - "test_resource_type_slug", - "test_external_id", - limit=10, - before="cursor before", - after="cursor/after", - order=AuthorizationOrder("normal"), - ) + workos.authorization.list_effective_permissions_by_external_id("test_organization_membership_id", "test_resource_type_slug", "test_external_id", limit=10, before="cursor before", after="cursor/after", order=AuthorizationOrder("normal")) request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" assert request.url.params["after"] == "cursor/after" assert request.url.params["order"] == "normal" - def test_list_organization_membership_role_assignments(self, workos, httpx_mock): + def test_list_role_assignments(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("list_role_assignment.json"), ) - page = workos.authorization.list_organization_membership_role_assignments( - "test_organization_membership_id" - ) + page = workos.authorization.list_role_assignments("test_organization_membership_id") assert isinstance(page, SyncPage) assert len(page.data) == 1 assert isinstance(page.data[0], RoleAssignment) - def test_list_organization_membership_role_assignments_empty_page( - self, workos, httpx_mock - ): + def test_list_role_assignments_empty_page(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - page = workos.authorization.list_organization_membership_role_assignments( - "test_organization_membership_id" - ) + page = workos.authorization.list_role_assignments("test_organization_membership_id") assert isinstance(page, SyncPage) assert page.data == [] - def test_list_organization_membership_role_assignments_encodes_query_params( - self, workos, httpx_mock - ): + def test_list_role_assignments_encodes_query_params(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - workos.authorization.list_organization_membership_role_assignments( - "test_organization_membership_id", - limit=10, - before="cursor before", - after="cursor/after", - order=AuthorizationOrder("normal"), - ) + workos.authorization.list_role_assignments("test_organization_membership_id", limit=10, before="cursor before", after="cursor/after", order=AuthorizationOrder("normal")) request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -226,47 +129,31 @@ def test_assign_role(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("role_assignment.json"), ) - result = workos.authorization.assign_role( - "test_organization_membership_id", - role_slug="test_role_slug", - resource_target=ResourceTargetById(resource_id="test_value"), - ) + result = workos.authorization.assign_role("test_organization_membership_id", role_slug="test_role_slug", resource_target=ResourceTargetById(resource_id="test_value")) assert isinstance(result, RoleAssignment) assert result.object == "role_assignment" assert result.id == "role_assignment_01HXYZ123456789ABCDEFGH" request = httpx_mock.get_request() assert request.method == "POST" - assert request.url.path.endswith( - "/authorization/organization_memberships/test_organization_membership_id/role_assignments" - ) + assert request.url.path.endswith("/authorization/organization_memberships/test_organization_membership_id/role_assignments") body = json.loads(request.content) assert body["role_slug"] == "test_role_slug" def test_remove_role(self, workos, httpx_mock): httpx_mock.add_response(status_code=204) - result = workos.authorization.remove_role( - "test_organization_membership_id", - role_slug="test_role_slug", - resource_target=ResourceTargetById(resource_id="test_value"), - ) + result = workos.authorization.remove_role("test_organization_membership_id", role_slug="test_role_slug", resource_target=ResourceTargetById(resource_id="test_value")) assert result is None request = httpx_mock.get_request() assert request.method == "DELETE" - assert request.url.path.endswith( - "/authorization/organization_memberships/test_organization_membership_id/role_assignments" - ) + assert request.url.path.endswith("/authorization/organization_memberships/test_organization_membership_id/role_assignments") - def test_delete_organization_membership_role_assignment(self, workos, httpx_mock): + def test_remove_role_assignment(self, workos, httpx_mock): httpx_mock.add_response(status_code=204) - result = workos.authorization.delete_organization_membership_role_assignment( - "test_organization_membership_id", "test_role_assignment_id" - ) + result = workos.authorization.remove_role_assignment("test_organization_membership_id", "test_role_assignment_id") assert result is None request = httpx_mock.get_request() assert request.method == "DELETE" - assert request.url.path.endswith( - "/authorization/organization_memberships/test_organization_membership_id/role_assignments/test_role_assignment_id" - ) + assert request.url.path.endswith("/authorization/organization_memberships/test_organization_membership_id/role_assignments/test_role_assignment_id") def test_list_organization_roles(self, workos, httpx_mock): httpx_mock.add_response( @@ -277,25 +164,19 @@ def test_list_organization_roles(self, workos, httpx_mock): assert result.object == "list" request = httpx_mock.get_request() assert request.method == "GET" - assert request.url.path.endswith( - "/authorization/organizations/test_organizationId/roles" - ) + assert request.url.path.endswith("/authorization/organizations/test_organizationId/roles") def test_create_organization_role(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("role.json"), ) - result = workos.authorization.create_organization_role( - "test_organizationId", name="test_name" - ) + result = workos.authorization.create_organization_role("test_organizationId", name="test_name") assert isinstance(result, Role) assert result.slug == "admin" assert result.object == "role" request = httpx_mock.get_request() assert request.method == "POST" - assert request.url.path.endswith( - "/authorization/organizations/test_organizationId/roles" - ) + assert request.url.path.endswith("/authorization/organizations/test_organizationId/roles") body = json.loads(request.content) assert body["name"] == "test_name" @@ -303,196 +184,126 @@ def test_get_organization_role(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("role.json"), ) - result = workos.authorization.get_organization_role( - "test_organizationId", "test_slug" - ) + result = workos.authorization.get_organization_role("test_organizationId", "test_slug") assert isinstance(result, Role) assert result.slug == "admin" assert result.object == "role" request = httpx_mock.get_request() assert request.method == "GET" - assert request.url.path.endswith( - "/authorization/organizations/test_organizationId/roles/test_slug" - ) + assert request.url.path.endswith("/authorization/organizations/test_organizationId/roles/test_slug") def test_update_organization_role(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("role.json"), ) - result = workos.authorization.update_organization_role( - "test_organizationId", "test_slug" - ) + result = workos.authorization.update_organization_role("test_organizationId", "test_slug") assert isinstance(result, Role) assert result.slug == "admin" assert result.object == "role" request = httpx_mock.get_request() assert request.method == "PATCH" - assert request.url.path.endswith( - "/authorization/organizations/test_organizationId/roles/test_slug" - ) + assert request.url.path.endswith("/authorization/organizations/test_organizationId/roles/test_slug") def test_delete_organization_role(self, workos, httpx_mock): httpx_mock.add_response(status_code=204) - result = workos.authorization.delete_organization_role( - "test_organizationId", "test_slug" - ) + result = workos.authorization.delete_organization_role("test_organizationId", "test_slug") assert result is None request = httpx_mock.get_request() assert request.method == "DELETE" - assert request.url.path.endswith( - "/authorization/organizations/test_organizationId/roles/test_slug" - ) + assert request.url.path.endswith("/authorization/organizations/test_organizationId/roles/test_slug") - def test_create_role_permission(self, workos, httpx_mock): + def test_add_organization_role_permission(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("role.json"), ) - result = workos.authorization.create_role_permission( - "test_organizationId", "test_slug", body_slug="test_slug" - ) + result = workos.authorization.add_organization_role_permission("test_organizationId", "test_slug", body_slug="test_slug") assert isinstance(result, Role) assert result.slug == "admin" assert result.object == "role" request = httpx_mock.get_request() assert request.method == "POST" - assert request.url.path.endswith( - "/authorization/organizations/test_organizationId/roles/test_slug/permissions" - ) + assert request.url.path.endswith("/authorization/organizations/test_organizationId/roles/test_slug/permissions") body = json.loads(request.content) assert body["slug"] == "test_slug" - def test_update_role_permissions(self, workos, httpx_mock): + def test_set_organization_role_permissions(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("role.json"), ) - result = workos.authorization.update_role_permissions( - "test_organizationId", "test_slug", permissions=[] - ) + result = workos.authorization.set_organization_role_permissions("test_organizationId", "test_slug", permissions=[]) assert isinstance(result, Role) assert result.slug == "admin" assert result.object == "role" request = httpx_mock.get_request() assert request.method == "PUT" - assert request.url.path.endswith( - "/authorization/organizations/test_organizationId/roles/test_slug/permissions" - ) + assert request.url.path.endswith("/authorization/organizations/test_organizationId/roles/test_slug/permissions") body = json.loads(request.content) assert "permissions" in body - def test_delete_role_permission(self, workos, httpx_mock): + def test_remove_organization_role_permission(self, workos, httpx_mock): httpx_mock.add_response(status_code=204) - result = workos.authorization.delete_role_permission( - "test_organizationId", "test_slug", "test_permissionSlug" - ) + result = workos.authorization.remove_organization_role_permission("test_organizationId", "test_slug", "test_permissionSlug") assert result is None request = httpx_mock.get_request() assert request.method == "DELETE" - assert request.url.path.endswith( - "/authorization/organizations/test_organizationId/roles/test_slug/permissions/test_permissionSlug" - ) + assert request.url.path.endswith("/authorization/organizations/test_organizationId/roles/test_slug/permissions/test_permissionSlug") - def test_get_organization_resource(self, workos, httpx_mock): + def test_get_resource_by_external_id(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("authorization_resource.json"), ) - result = workos.authorization.get_organization_resource( - "test_organization_id", "test_resource_type_slug", "test_external_id" - ) + result = workos.authorization.get_resource_by_external_id("test_organization_id", "test_resource_type_slug", "test_external_id") assert isinstance(result, AuthorizationResource) assert result.object == "authorization_resource" assert result.name == "Website Redesign" request = httpx_mock.get_request() assert request.method == "GET" - assert request.url.path.endswith( - "/authorization/organizations/test_organization_id/resources/test_resource_type_slug/test_external_id" - ) + assert request.url.path.endswith("/authorization/organizations/test_organization_id/resources/test_resource_type_slug/test_external_id") - def test_update_organization_resource(self, workos, httpx_mock): + def test_update_resource_by_external_id(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("authorization_resource.json"), ) - result = workos.authorization.update_organization_resource( - "test_organization_id", - "test_resource_type_slug", - "test_external_id", - parent_resource=ParentResourceById(parent_resource_id="test_value"), - ) + result = workos.authorization.update_resource_by_external_id("test_organization_id", "test_resource_type_slug", "test_external_id", parent_resource=ParentResourceById(parent_resource_id="test_value")) assert isinstance(result, AuthorizationResource) assert result.object == "authorization_resource" assert result.name == "Website Redesign" request = httpx_mock.get_request() assert request.method == "PATCH" - assert request.url.path.endswith( - "/authorization/organizations/test_organization_id/resources/test_resource_type_slug/test_external_id" - ) + assert request.url.path.endswith("/authorization/organizations/test_organization_id/resources/test_resource_type_slug/test_external_id") - def test_delete_organization_resource(self, workos, httpx_mock): + def test_delete_resource_by_external_id(self, workos, httpx_mock): httpx_mock.add_response(status_code=204) - result = workos.authorization.delete_organization_resource( - "test_organization_id", "test_resource_type_slug", "test_external_id" - ) + result = workos.authorization.delete_resource_by_external_id("test_organization_id", "test_resource_type_slug", "test_external_id") assert result is None request = httpx_mock.get_request() assert request.method == "DELETE" - assert request.url.path.endswith( - "/authorization/organizations/test_organization_id/resources/test_resource_type_slug/test_external_id" - ) + assert request.url.path.endswith("/authorization/organizations/test_organization_id/resources/test_resource_type_slug/test_external_id") - def test_delete_organization_resource_encodes_query_params( - self, workos, httpx_mock - ): + def test_delete_resource_by_external_id_encodes_query_params(self, workos, httpx_mock): httpx_mock.add_response(status_code=204) - workos.authorization.delete_organization_resource( - "test_organization_id", - "test_resource_type_slug", - "test_external_id", - cascade_delete=True, - ) + workos.authorization.delete_resource_by_external_id("test_organization_id", "test_resource_type_slug", "test_external_id", cascade_delete=True) request = httpx_mock.get_request() assert request.url.params["cascade_delete"] == "true" - def test_list_resource_organization_memberships(self, workos, httpx_mock): + def test_list_memberships_for_resource_by_external_id(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("list_user_organization_membership_base_list_data.json"), ) - page = workos.authorization.list_resource_organization_memberships( - "test_organization_id", - "test_resource_type_slug", - "test_external_id", - permission_slug="test_permission_slug", - ) + page = workos.authorization.list_memberships_for_resource_by_external_id("test_organization_id", "test_resource_type_slug", "test_external_id", permission_slug="test_permission_slug") assert isinstance(page, SyncPage) assert len(page.data) == 1 assert isinstance(page.data[0], UserOrganizationMembershipBaseListData) - def test_list_resource_organization_memberships_empty_page( - self, workos, httpx_mock - ): + def test_list_memberships_for_resource_by_external_id_empty_page(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - page = workos.authorization.list_resource_organization_memberships( - "test_organization_id", - "test_resource_type_slug", - "test_external_id", - permission_slug="test_permission_slug", - ) + page = workos.authorization.list_memberships_for_resource_by_external_id("test_organization_id", "test_resource_type_slug", "test_external_id", permission_slug="test_permission_slug") assert isinstance(page, SyncPage) assert page.data == [] - def test_list_resource_organization_memberships_encodes_query_params( - self, workos, httpx_mock - ): + def test_list_memberships_for_resource_by_external_id_encodes_query_params(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - workos.authorization.list_resource_organization_memberships( - "test_organization_id", - "test_resource_type_slug", - "test_external_id", - limit=10, - before="cursor before", - after="cursor/after", - order=AuthorizationOrder("normal"), - permission_slug="value permission_slug/test", - assignment=AuthorizationAssignment("direct"), - ) + workos.authorization.list_memberships_for_resource_by_external_id("test_organization_id", "test_resource_type_slug", "test_external_id", limit=10, before="cursor before", after="cursor/after", order=AuthorizationOrder("normal"), permission_slug="value permission_slug/test", assignment=AuthorizationAssignment("direct")) request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -505,58 +316,36 @@ def test_list_resources(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("list_authorization_resource.json"), ) - page = workos.authorization.list_resources( - parent=ParentById(parent_resource_id="test_value") - ) + page = workos.authorization.list_resources(parent=ParentById(parent_resource_id="test_value")) assert isinstance(page, SyncPage) assert len(page.data) == 1 assert isinstance(page.data[0], AuthorizationResource) def test_list_resources_empty_page(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - page = workos.authorization.list_resources( - parent=ParentById(parent_resource_id="test_value") - ) + page = workos.authorization.list_resources(parent=ParentById(parent_resource_id="test_value")) assert isinstance(page, SyncPage) assert page.data == [] def test_list_resources_encodes_query_params(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - workos.authorization.list_resources( - parent=ParentById(parent_resource_id="value parent_resource_id/test"), - limit=10, - before="cursor before", - after="cursor/after", - order=AuthorizationOrder("normal"), - organization_id="value organization_id/test", - resource_type_slug="value resource_type_slug/test", - search="value search/test", - ) + workos.authorization.list_resources(parent=ParentById(parent_resource_id="value parent_resource_id/test"), limit=10, before="cursor before", after="cursor/after", order=AuthorizationOrder("normal"), organization_id="value organization_id/test", resource_type_slug="value resource_type_slug/test", resource_external_id="value resource_external_id/test", search="value search/test") request = httpx_mock.get_request() - assert ( - request.url.params["parent_resource_id"] == "value parent_resource_id/test" - ) + assert request.url.params["parent_resource_id"] == "value parent_resource_id/test" assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" assert request.url.params["after"] == "cursor/after" assert request.url.params["order"] == "normal" assert request.url.params["organization_id"] == "value organization_id/test" - assert ( - request.url.params["resource_type_slug"] == "value resource_type_slug/test" - ) + assert request.url.params["resource_type_slug"] == "value resource_type_slug/test" + assert request.url.params["resource_external_id"] == "value resource_external_id/test" assert request.url.params["search"] == "value search/test" def test_create_resource(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("authorization_resource.json"), ) - result = workos.authorization.create_resource( - external_id="test_external_id", - name="test_name", - resource_type_slug="test_resource_type_slug", - organization_id="test_organization_id", - parent_resource=ParentResourceById(parent_resource_id="test_value"), - ) + result = workos.authorization.create_resource(external_id="test_external_id", name="test_name", resource_type_slug="test_resource_type_slug", organization_id="test_organization_id", parent_resource=ParentResourceById(parent_resource_id="test_value")) assert isinstance(result, AuthorizationResource) assert result.object == "authorization_resource" assert result.name == "Website Redesign" @@ -585,10 +374,7 @@ def test_update_resource(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("authorization_resource.json"), ) - result = workos.authorization.update_resource( - "test_resource_id", - parent_resource=ParentResourceById(parent_resource_id="test_value"), - ) + result = workos.authorization.update_resource("test_resource_id", parent_resource=ParentResourceById(parent_resource_id="test_value")) assert isinstance(result, AuthorizationResource) assert result.object == "authorization_resource" assert result.name == "Website Redesign" @@ -614,34 +400,20 @@ def test_list_memberships_for_resource(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("list_user_organization_membership_base_list_data.json"), ) - page = workos.authorization.list_memberships_for_resource( - "test_resource_id", permission_slug="test_permission_slug" - ) + page = workos.authorization.list_memberships_for_resource("test_resource_id", permission_slug="test_permission_slug") assert isinstance(page, SyncPage) assert len(page.data) == 1 assert isinstance(page.data[0], UserOrganizationMembershipBaseListData) def test_list_memberships_for_resource_empty_page(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - page = workos.authorization.list_memberships_for_resource( - "test_resource_id", permission_slug="test_permission_slug" - ) + page = workos.authorization.list_memberships_for_resource("test_resource_id", permission_slug="test_permission_slug") assert isinstance(page, SyncPage) assert page.data == [] - def test_list_memberships_for_resource_encodes_query_params( - self, workos, httpx_mock - ): + def test_list_memberships_for_resource_encodes_query_params(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - workos.authorization.list_memberships_for_resource( - "test_resource_id", - limit=10, - before="cursor before", - after="cursor/after", - order=AuthorizationOrder("normal"), - permission_slug="value permission_slug/test", - assignment=AuthorizationAssignment("direct"), - ) + workos.authorization.list_memberships_for_resource("test_resource_id", limit=10, before="cursor before", after="cursor/after", order=AuthorizationOrder("normal"), permission_slug="value permission_slug/test", assignment=AuthorizationAssignment("direct")) request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -665,9 +437,7 @@ def test_create_environment_role(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("role.json"), ) - result = workos.authorization.create_environment_role( - slug="test_slug", name="test_name" - ) + result = workos.authorization.create_environment_role(slug="test_slug", name="test_name") assert isinstance(result, Role) assert result.slug == "admin" assert result.object == "role" @@ -706,9 +476,7 @@ def test_add_environment_role_permission(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("role.json"), ) - result = workos.authorization.add_environment_role_permission( - "test_slug", body_slug="test_slug" - ) + result = workos.authorization.add_environment_role_permission("test_slug", body_slug="test_slug") assert isinstance(result, Role) assert result.slug == "admin" assert result.object == "role" @@ -722,9 +490,7 @@ def test_set_environment_role_permissions(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("role.json"), ) - result = workos.authorization.set_environment_role_permissions( - "test_slug", permissions=[] - ) + result = workos.authorization.set_environment_role_permissions("test_slug", permissions=[]) assert isinstance(result, Role) assert result.slug == "admin" assert result.object == "role" @@ -751,12 +517,7 @@ def test_list_permissions_empty_page(self, workos, httpx_mock): def test_list_permissions_encodes_query_params(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - workos.authorization.list_permissions( - limit=10, - before="cursor before", - after="cursor/after", - order=PermissionsOrder("normal"), - ) + workos.authorization.list_permissions(limit=10, before="cursor before", after="cursor/after", order=PermissionsOrder("normal")) request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -767,9 +528,7 @@ def test_create_permission(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("permission.json"), ) - result = workos.authorization.create_permission( - slug="test_slug", name="test_name" - ) + result = workos.authorization.create_permission(slug="test_slug", name="test_name") assert isinstance(result, Permission) assert result.object == "permission" assert result.id == "perm_01HXYZ123456789ABCDEFGHIJ" @@ -814,12 +573,7 @@ def test_delete_permission(self, workos, httpx_mock): def test_check_with_request_options(self, workos, httpx_mock): httpx_mock.add_response(json=load_fixture("authorization_check.json")) - workos.authorization.check( - "test_organization_membership_id", - permission_slug="test_permission_slug", - resource_target=ResourceTargetById(resource_id="test_value"), - request_options={"extra_headers": {"X-Custom": "value"}}, - ) + workos.authorization.check("test_organization_membership_id", permission_slug="test_permission_slug", resource_target=ResourceTargetById(resource_id="test_value"), request_options={"extra_headers": {"X-Custom": "value"}}) request = httpx_mock.get_request() assert request.headers["X-Custom"] == "value" @@ -829,156 +583,87 @@ def test_check_unauthorized(self, workos, httpx_mock): json={"message": "Unauthorized"}, ) with pytest.raises(AuthenticationError): - workos.authorization.check( - "test_organization_membership_id", - permission_slug="test_permission_slug", - resource_target=ResourceTargetById(resource_id="test_value"), - ) + workos.authorization.check("test_organization_membership_id", permission_slug="test_permission_slug", resource_target=ResourceTargetById(resource_id="test_value")) def test_check_not_found(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=404, json={"message": "Not found"}) with pytest.raises(NotFoundError): - workos.authorization.check( - "test_organization_membership_id", - permission_slug="test_permission_slug", - resource_target=ResourceTargetById(resource_id="test_value"), - ) + workos.authorization.check("test_organization_membership_id", permission_slug="test_permission_slug", resource_target=ResourceTargetById(resource_id="test_value")) finally: workos.close() def test_check_rate_limited(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: - httpx_mock.add_response( - status_code=429, - headers={"Retry-After": "0"}, - json={"message": "Slow down"}, - ) + httpx_mock.add_response(status_code=429, headers={"Retry-After": "0"}, json={"message": "Slow down"}) with pytest.raises(RateLimitExceededError): - workos.authorization.check( - "test_organization_membership_id", - permission_slug="test_permission_slug", - resource_target=ResourceTargetById(resource_id="test_value"), - ) + workos.authorization.check("test_organization_membership_id", permission_slug="test_permission_slug", resource_target=ResourceTargetById(resource_id="test_value")) finally: workos.close() def test_check_server_error(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=500, json={"message": "Server error"}) with pytest.raises(ServerError): - workos.authorization.check( - "test_organization_membership_id", - permission_slug="test_permission_slug", - resource_target=ResourceTargetById(resource_id="test_value"), - ) + workos.authorization.check("test_organization_membership_id", permission_slug="test_permission_slug", resource_target=ResourceTargetById(resource_id="test_value")) finally: workos.close() def test_check_bad_request(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) with pytest.raises(BadRequestError): - workos.authorization.check( - "test_organization_membership_id", - permission_slug="test_permission_slug", - resource_target=ResourceTargetById(resource_id="test_value"), - ) + workos.authorization.check("test_organization_membership_id", permission_slug="test_permission_slug", resource_target=ResourceTargetById(resource_id="test_value")) finally: workos.close() def test_check_unprocessable(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) with pytest.raises(UnprocessableEntityError): - workos.authorization.check( - "test_organization_membership_id", - permission_slug="test_permission_slug", - resource_target=ResourceTargetById(resource_id="test_value"), - ) + workos.authorization.check("test_organization_membership_id", permission_slug="test_permission_slug", resource_target=ResourceTargetById(resource_id="test_value")) finally: workos.close() class TestAsyncAuthorization: + @pytest.mark.asyncio async def test_check(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("authorization_check.json")) - result = await async_workos.authorization.check( - "test_organization_membership_id", - permission_slug="test_permission_slug", - resource_target=ResourceTargetById(resource_id="test_value"), - ) + result = await async_workos.authorization.check("test_organization_membership_id", permission_slug="test_permission_slug", resource_target=ResourceTargetById(resource_id="test_value")) assert isinstance(result, AuthorizationCheck) assert result.authorized is True request = httpx_mock.get_request() assert request.method == "POST" - assert request.url.path.endswith( - "/authorization/organization_memberships/test_organization_membership_id/check" - ) + assert request.url.path.endswith("/authorization/organization_memberships/test_organization_membership_id/check") @pytest.mark.asyncio - async def test_list_organization_membership_resources( - self, async_workos, httpx_mock - ): + async def test_list_resources_for_membership(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("list_authorization_resource.json")) - page = await async_workos.authorization.list_organization_membership_resources( - "test_organization_membership_id", - parent_resource=ParentResourceById(parent_resource_id="test_value"), - permission_slug="test_permission_slug", - ) + page = await async_workos.authorization.list_resources_for_membership("test_organization_membership_id", parent_resource=ParentResourceById(parent_resource_id="test_value"), permission_slug="test_permission_slug") assert isinstance(page, AsyncPage) assert len(page.data) == 1 assert isinstance(page.data[0], AuthorizationResource) @pytest.mark.asyncio - async def test_list_organization_membership_resources_empty_page( - self, async_workos, httpx_mock - ): + async def test_list_resources_for_membership_empty_page(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - page = await async_workos.authorization.list_organization_membership_resources( - "test_organization_membership_id", - parent_resource=ParentResourceById(parent_resource_id="test_value"), - permission_slug="test_permission_slug", - ) + page = await async_workos.authorization.list_resources_for_membership("test_organization_membership_id", parent_resource=ParentResourceById(parent_resource_id="test_value"), permission_slug="test_permission_slug") assert isinstance(page, AsyncPage) assert page.data == [] @pytest.mark.asyncio - async def test_list_organization_membership_resources_encodes_query_params( - self, async_workos, httpx_mock - ): + async def test_list_resources_for_membership_encodes_query_params(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - await async_workos.authorization.list_organization_membership_resources( - "test_organization_membership_id", - parent_resource=ParentResourceById( - parent_resource_id="value parent_resource_id/test" - ), - limit=10, - before="cursor before", - after="cursor/after", - order=AuthorizationOrder("normal"), - permission_slug="value permission_slug/test", - ) + await async_workos.authorization.list_resources_for_membership("test_organization_membership_id", parent_resource=ParentResourceById(parent_resource_id="value parent_resource_id/test"), limit=10, before="cursor before", after="cursor/after", order=AuthorizationOrder("normal"), permission_slug="value permission_slug/test") request = httpx_mock.get_request() - assert ( - request.url.params["parent_resource_id"] == "value parent_resource_id/test" - ) + assert request.url.params["parent_resource_id"] == "value parent_resource_id/test" assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" assert request.url.params["after"] == "cursor/after" @@ -986,37 +671,24 @@ async def test_list_organization_membership_resources_encodes_query_params( assert request.url.params["permission_slug"] == "value permission_slug/test" @pytest.mark.asyncio - async def test_list_resource_permissions(self, async_workos, httpx_mock): + async def test_list_effective_permissions(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("list_authorization_permission.json")) - page = await async_workos.authorization.list_resource_permissions( - "test_organization_membership_id", "test_resource_id" - ) + page = await async_workos.authorization.list_effective_permissions("test_organization_membership_id", "test_resource_id") assert isinstance(page, AsyncPage) assert len(page.data) == 1 assert isinstance(page.data[0], AuthorizationPermission) @pytest.mark.asyncio - async def test_list_resource_permissions_empty_page(self, async_workos, httpx_mock): + async def test_list_effective_permissions_empty_page(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - page = await async_workos.authorization.list_resource_permissions( - "test_organization_membership_id", "test_resource_id" - ) + page = await async_workos.authorization.list_effective_permissions("test_organization_membership_id", "test_resource_id") assert isinstance(page, AsyncPage) assert page.data == [] @pytest.mark.asyncio - async def test_list_resource_permissions_encodes_query_params( - self, async_workos, httpx_mock - ): + async def test_list_effective_permissions_encodes_query_params(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - await async_workos.authorization.list_resource_permissions( - "test_organization_membership_id", - "test_resource_id", - limit=10, - before="cursor before", - after="cursor/after", - order=AuthorizationOrder("normal"), - ) + await async_workos.authorization.list_effective_permissions("test_organization_membership_id", "test_resource_id", limit=10, before="cursor before", after="cursor/after", order=AuthorizationOrder("normal")) request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -1024,50 +696,24 @@ async def test_list_resource_permissions_encodes_query_params( assert request.url.params["order"] == "normal" @pytest.mark.asyncio - async def test_list_effective_permissions_by_external_id( - self, async_workos, httpx_mock - ): + async def test_list_effective_permissions_by_external_id(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("list_authorization_permission.json")) - page = ( - await async_workos.authorization.list_effective_permissions_by_external_id( - "test_organization_membership_id", - "test_resource_type_slug", - "test_external_id", - ) - ) + page = await async_workos.authorization.list_effective_permissions_by_external_id("test_organization_membership_id", "test_resource_type_slug", "test_external_id") assert isinstance(page, AsyncPage) assert len(page.data) == 1 assert isinstance(page.data[0], AuthorizationPermission) @pytest.mark.asyncio - async def test_list_effective_permissions_by_external_id_empty_page( - self, async_workos, httpx_mock - ): + async def test_list_effective_permissions_by_external_id_empty_page(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - page = ( - await async_workos.authorization.list_effective_permissions_by_external_id( - "test_organization_membership_id", - "test_resource_type_slug", - "test_external_id", - ) - ) + page = await async_workos.authorization.list_effective_permissions_by_external_id("test_organization_membership_id", "test_resource_type_slug", "test_external_id") assert isinstance(page, AsyncPage) assert page.data == [] @pytest.mark.asyncio - async def test_list_effective_permissions_by_external_id_encodes_query_params( - self, async_workos, httpx_mock - ): + async def test_list_effective_permissions_by_external_id_encodes_query_params(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - await async_workos.authorization.list_effective_permissions_by_external_id( - "test_organization_membership_id", - "test_resource_type_slug", - "test_external_id", - limit=10, - before="cursor before", - after="cursor/after", - order=AuthorizationOrder("normal"), - ) + await async_workos.authorization.list_effective_permissions_by_external_id("test_organization_membership_id", "test_resource_type_slug", "test_external_id", limit=10, before="cursor before", after="cursor/after", order=AuthorizationOrder("normal")) request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -1075,40 +721,24 @@ async def test_list_effective_permissions_by_external_id_encodes_query_params( assert request.url.params["order"] == "normal" @pytest.mark.asyncio - async def test_list_organization_membership_role_assignments( - self, async_workos, httpx_mock - ): + async def test_list_role_assignments(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("list_role_assignment.json")) - page = await async_workos.authorization.list_organization_membership_role_assignments( - "test_organization_membership_id" - ) + page = await async_workos.authorization.list_role_assignments("test_organization_membership_id") assert isinstance(page, AsyncPage) assert len(page.data) == 1 assert isinstance(page.data[0], RoleAssignment) @pytest.mark.asyncio - async def test_list_organization_membership_role_assignments_empty_page( - self, async_workos, httpx_mock - ): + async def test_list_role_assignments_empty_page(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - page = await async_workos.authorization.list_organization_membership_role_assignments( - "test_organization_membership_id" - ) + page = await async_workos.authorization.list_role_assignments("test_organization_membership_id") assert isinstance(page, AsyncPage) assert page.data == [] @pytest.mark.asyncio - async def test_list_organization_membership_role_assignments_encodes_query_params( - self, async_workos, httpx_mock - ): + async def test_list_role_assignments_encodes_query_params(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - await async_workos.authorization.list_organization_membership_role_assignments( - "test_organization_membership_id", - limit=10, - before="cursor before", - after="cursor/after", - order=AuthorizationOrder("normal"), - ) + await async_workos.authorization.list_role_assignments("test_organization_membership_id", limit=10, before="cursor before", after="cursor/after", order=AuthorizationOrder("normal")) request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -1118,272 +748,172 @@ async def test_list_organization_membership_role_assignments_encodes_query_param @pytest.mark.asyncio async def test_assign_role(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("role_assignment.json")) - result = await async_workos.authorization.assign_role( - "test_organization_membership_id", - role_slug="test_role_slug", - resource_target=ResourceTargetById(resource_id="test_value"), - ) + result = await async_workos.authorization.assign_role("test_organization_membership_id", role_slug="test_role_slug", resource_target=ResourceTargetById(resource_id="test_value")) assert isinstance(result, RoleAssignment) assert result.object == "role_assignment" assert result.id == "role_assignment_01HXYZ123456789ABCDEFGH" request = httpx_mock.get_request() assert request.method == "POST" - assert request.url.path.endswith( - "/authorization/organization_memberships/test_organization_membership_id/role_assignments" - ) + assert request.url.path.endswith("/authorization/organization_memberships/test_organization_membership_id/role_assignments") @pytest.mark.asyncio async def test_remove_role(self, async_workos, httpx_mock): httpx_mock.add_response(status_code=204) - result = await async_workos.authorization.remove_role( - "test_organization_membership_id", - role_slug="test_role_slug", - resource_target=ResourceTargetById(resource_id="test_value"), - ) + result = await async_workos.authorization.remove_role("test_organization_membership_id", role_slug="test_role_slug", resource_target=ResourceTargetById(resource_id="test_value")) assert result is None request = httpx_mock.get_request() assert request.method == "DELETE" - assert request.url.path.endswith( - "/authorization/organization_memberships/test_organization_membership_id/role_assignments" - ) + assert request.url.path.endswith("/authorization/organization_memberships/test_organization_membership_id/role_assignments") @pytest.mark.asyncio - async def test_delete_organization_membership_role_assignment( - self, async_workos, httpx_mock - ): + async def test_remove_role_assignment(self, async_workos, httpx_mock): httpx_mock.add_response(status_code=204) - result = await async_workos.authorization.delete_organization_membership_role_assignment( - "test_organization_membership_id", "test_role_assignment_id" - ) + result = await async_workos.authorization.remove_role_assignment("test_organization_membership_id", "test_role_assignment_id") assert result is None request = httpx_mock.get_request() assert request.method == "DELETE" - assert request.url.path.endswith( - "/authorization/organization_memberships/test_organization_membership_id/role_assignments/test_role_assignment_id" - ) + assert request.url.path.endswith("/authorization/organization_memberships/test_organization_membership_id/role_assignments/test_role_assignment_id") @pytest.mark.asyncio async def test_list_organization_roles(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("role_list.json")) - result = await async_workos.authorization.list_organization_roles( - "test_organizationId" - ) + result = await async_workos.authorization.list_organization_roles("test_organizationId") assert isinstance(result, RoleList) assert result.object == "list" request = httpx_mock.get_request() assert request.method == "GET" - assert request.url.path.endswith( - "/authorization/organizations/test_organizationId/roles" - ) + assert request.url.path.endswith("/authorization/organizations/test_organizationId/roles") @pytest.mark.asyncio async def test_create_organization_role(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("role.json")) - result = await async_workos.authorization.create_organization_role( - "test_organizationId", name="test_name" - ) + result = await async_workos.authorization.create_organization_role("test_organizationId", name="test_name") assert isinstance(result, Role) assert result.slug == "admin" assert result.object == "role" request = httpx_mock.get_request() assert request.method == "POST" - assert request.url.path.endswith( - "/authorization/organizations/test_organizationId/roles" - ) + assert request.url.path.endswith("/authorization/organizations/test_organizationId/roles") @pytest.mark.asyncio async def test_get_organization_role(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("role.json")) - result = await async_workos.authorization.get_organization_role( - "test_organizationId", "test_slug" - ) + result = await async_workos.authorization.get_organization_role("test_organizationId", "test_slug") assert isinstance(result, Role) assert result.slug == "admin" assert result.object == "role" request = httpx_mock.get_request() assert request.method == "GET" - assert request.url.path.endswith( - "/authorization/organizations/test_organizationId/roles/test_slug" - ) + assert request.url.path.endswith("/authorization/organizations/test_organizationId/roles/test_slug") @pytest.mark.asyncio async def test_update_organization_role(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("role.json")) - result = await async_workos.authorization.update_organization_role( - "test_organizationId", "test_slug" - ) + result = await async_workos.authorization.update_organization_role("test_organizationId", "test_slug") assert isinstance(result, Role) assert result.slug == "admin" assert result.object == "role" request = httpx_mock.get_request() assert request.method == "PATCH" - assert request.url.path.endswith( - "/authorization/organizations/test_organizationId/roles/test_slug" - ) + assert request.url.path.endswith("/authorization/organizations/test_organizationId/roles/test_slug") @pytest.mark.asyncio async def test_delete_organization_role(self, async_workos, httpx_mock): httpx_mock.add_response(status_code=204) - result = await async_workos.authorization.delete_organization_role( - "test_organizationId", "test_slug" - ) + result = await async_workos.authorization.delete_organization_role("test_organizationId", "test_slug") assert result is None request = httpx_mock.get_request() assert request.method == "DELETE" - assert request.url.path.endswith( - "/authorization/organizations/test_organizationId/roles/test_slug" - ) + assert request.url.path.endswith("/authorization/organizations/test_organizationId/roles/test_slug") @pytest.mark.asyncio - async def test_create_role_permission(self, async_workos, httpx_mock): + async def test_add_organization_role_permission(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("role.json")) - result = await async_workos.authorization.create_role_permission( - "test_organizationId", "test_slug", body_slug="test_slug" - ) + result = await async_workos.authorization.add_organization_role_permission("test_organizationId", "test_slug", body_slug="test_slug") assert isinstance(result, Role) assert result.slug == "admin" assert result.object == "role" request = httpx_mock.get_request() assert request.method == "POST" - assert request.url.path.endswith( - "/authorization/organizations/test_organizationId/roles/test_slug/permissions" - ) + assert request.url.path.endswith("/authorization/organizations/test_organizationId/roles/test_slug/permissions") @pytest.mark.asyncio - async def test_update_role_permissions(self, async_workos, httpx_mock): + async def test_set_organization_role_permissions(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("role.json")) - result = await async_workos.authorization.update_role_permissions( - "test_organizationId", "test_slug", permissions=[] - ) + result = await async_workos.authorization.set_organization_role_permissions("test_organizationId", "test_slug", permissions=[]) assert isinstance(result, Role) assert result.slug == "admin" assert result.object == "role" request = httpx_mock.get_request() assert request.method == "PUT" - assert request.url.path.endswith( - "/authorization/organizations/test_organizationId/roles/test_slug/permissions" - ) + assert request.url.path.endswith("/authorization/organizations/test_organizationId/roles/test_slug/permissions") @pytest.mark.asyncio - async def test_delete_role_permission(self, async_workos, httpx_mock): + async def test_remove_organization_role_permission(self, async_workos, httpx_mock): httpx_mock.add_response(status_code=204) - result = await async_workos.authorization.delete_role_permission( - "test_organizationId", "test_slug", "test_permissionSlug" - ) + result = await async_workos.authorization.remove_organization_role_permission("test_organizationId", "test_slug", "test_permissionSlug") assert result is None request = httpx_mock.get_request() assert request.method == "DELETE" - assert request.url.path.endswith( - "/authorization/organizations/test_organizationId/roles/test_slug/permissions/test_permissionSlug" - ) + assert request.url.path.endswith("/authorization/organizations/test_organizationId/roles/test_slug/permissions/test_permissionSlug") @pytest.mark.asyncio - async def test_get_organization_resource(self, async_workos, httpx_mock): + async def test_get_resource_by_external_id(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("authorization_resource.json")) - result = await async_workos.authorization.get_organization_resource( - "test_organization_id", "test_resource_type_slug", "test_external_id" - ) + result = await async_workos.authorization.get_resource_by_external_id("test_organization_id", "test_resource_type_slug", "test_external_id") assert isinstance(result, AuthorizationResource) assert result.object == "authorization_resource" assert result.name == "Website Redesign" request = httpx_mock.get_request() assert request.method == "GET" - assert request.url.path.endswith( - "/authorization/organizations/test_organization_id/resources/test_resource_type_slug/test_external_id" - ) + assert request.url.path.endswith("/authorization/organizations/test_organization_id/resources/test_resource_type_slug/test_external_id") @pytest.mark.asyncio - async def test_update_organization_resource(self, async_workos, httpx_mock): + async def test_update_resource_by_external_id(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("authorization_resource.json")) - result = await async_workos.authorization.update_organization_resource( - "test_organization_id", - "test_resource_type_slug", - "test_external_id", - parent_resource=ParentResourceById(parent_resource_id="test_value"), - ) + result = await async_workos.authorization.update_resource_by_external_id("test_organization_id", "test_resource_type_slug", "test_external_id", parent_resource=ParentResourceById(parent_resource_id="test_value")) assert isinstance(result, AuthorizationResource) assert result.object == "authorization_resource" assert result.name == "Website Redesign" request = httpx_mock.get_request() assert request.method == "PATCH" - assert request.url.path.endswith( - "/authorization/organizations/test_organization_id/resources/test_resource_type_slug/test_external_id" - ) + assert request.url.path.endswith("/authorization/organizations/test_organization_id/resources/test_resource_type_slug/test_external_id") @pytest.mark.asyncio - async def test_delete_organization_resource(self, async_workos, httpx_mock): + async def test_delete_resource_by_external_id(self, async_workos, httpx_mock): httpx_mock.add_response(status_code=204) - result = await async_workos.authorization.delete_organization_resource( - "test_organization_id", "test_resource_type_slug", "test_external_id" - ) + result = await async_workos.authorization.delete_resource_by_external_id("test_organization_id", "test_resource_type_slug", "test_external_id") assert result is None request = httpx_mock.get_request() assert request.method == "DELETE" - assert request.url.path.endswith( - "/authorization/organizations/test_organization_id/resources/test_resource_type_slug/test_external_id" - ) + assert request.url.path.endswith("/authorization/organizations/test_organization_id/resources/test_resource_type_slug/test_external_id") @pytest.mark.asyncio - async def test_delete_organization_resource_encodes_query_params( - self, async_workos, httpx_mock - ): + async def test_delete_resource_by_external_id_encodes_query_params(self, async_workos, httpx_mock): httpx_mock.add_response(status_code=204) - await async_workos.authorization.delete_organization_resource( - "test_organization_id", - "test_resource_type_slug", - "test_external_id", - cascade_delete=True, - ) + await async_workos.authorization.delete_resource_by_external_id("test_organization_id", "test_resource_type_slug", "test_external_id", cascade_delete=True) request = httpx_mock.get_request() assert request.url.params["cascade_delete"] == "true" @pytest.mark.asyncio - async def test_list_resource_organization_memberships( - self, async_workos, httpx_mock - ): - httpx_mock.add_response( - json=load_fixture("list_user_organization_membership_base_list_data.json") - ) - page = await async_workos.authorization.list_resource_organization_memberships( - "test_organization_id", - "test_resource_type_slug", - "test_external_id", - permission_slug="test_permission_slug", - ) + async def test_list_memberships_for_resource_by_external_id(self, async_workos, httpx_mock): + httpx_mock.add_response(json=load_fixture("list_user_organization_membership_base_list_data.json")) + page = await async_workos.authorization.list_memberships_for_resource_by_external_id("test_organization_id", "test_resource_type_slug", "test_external_id", permission_slug="test_permission_slug") assert isinstance(page, AsyncPage) assert len(page.data) == 1 assert isinstance(page.data[0], UserOrganizationMembershipBaseListData) @pytest.mark.asyncio - async def test_list_resource_organization_memberships_empty_page( - self, async_workos, httpx_mock - ): + async def test_list_memberships_for_resource_by_external_id_empty_page(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - page = await async_workos.authorization.list_resource_organization_memberships( - "test_organization_id", - "test_resource_type_slug", - "test_external_id", - permission_slug="test_permission_slug", - ) + page = await async_workos.authorization.list_memberships_for_resource_by_external_id("test_organization_id", "test_resource_type_slug", "test_external_id", permission_slug="test_permission_slug") assert isinstance(page, AsyncPage) assert page.data == [] @pytest.mark.asyncio - async def test_list_resource_organization_memberships_encodes_query_params( - self, async_workos, httpx_mock - ): + async def test_list_memberships_for_resource_by_external_id_encodes_query_params(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - await async_workos.authorization.list_resource_organization_memberships( - "test_organization_id", - "test_resource_type_slug", - "test_external_id", - limit=10, - before="cursor before", - after="cursor/after", - order=AuthorizationOrder("normal"), - permission_slug="value permission_slug/test", - assignment=AuthorizationAssignment("direct"), - ) + await async_workos.authorization.list_memberships_for_resource_by_external_id("test_organization_id", "test_resource_type_slug", "test_external_id", limit=10, before="cursor before", after="cursor/after", order=AuthorizationOrder("normal"), permission_slug="value permission_slug/test", assignment=AuthorizationAssignment("direct")) request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -1395,9 +925,7 @@ async def test_list_resource_organization_memberships_encodes_query_params( @pytest.mark.asyncio async def test_list_resources(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("list_authorization_resource.json")) - page = await async_workos.authorization.list_resources( - parent=ParentById(parent_resource_id="test_value") - ) + page = await async_workos.authorization.list_resources(parent=ParentById(parent_resource_id="test_value")) assert isinstance(page, AsyncPage) assert len(page.data) == 1 assert isinstance(page.data[0], AuthorizationResource) @@ -1405,49 +933,29 @@ async def test_list_resources(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_list_resources_empty_page(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - page = await async_workos.authorization.list_resources( - parent=ParentById(parent_resource_id="test_value") - ) + page = await async_workos.authorization.list_resources(parent=ParentById(parent_resource_id="test_value")) assert isinstance(page, AsyncPage) assert page.data == [] @pytest.mark.asyncio async def test_list_resources_encodes_query_params(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - await async_workos.authorization.list_resources( - parent=ParentById(parent_resource_id="value parent_resource_id/test"), - limit=10, - before="cursor before", - after="cursor/after", - order=AuthorizationOrder("normal"), - organization_id="value organization_id/test", - resource_type_slug="value resource_type_slug/test", - search="value search/test", - ) + await async_workos.authorization.list_resources(parent=ParentById(parent_resource_id="value parent_resource_id/test"), limit=10, before="cursor before", after="cursor/after", order=AuthorizationOrder("normal"), organization_id="value organization_id/test", resource_type_slug="value resource_type_slug/test", resource_external_id="value resource_external_id/test", search="value search/test") request = httpx_mock.get_request() - assert ( - request.url.params["parent_resource_id"] == "value parent_resource_id/test" - ) + assert request.url.params["parent_resource_id"] == "value parent_resource_id/test" assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" assert request.url.params["after"] == "cursor/after" assert request.url.params["order"] == "normal" assert request.url.params["organization_id"] == "value organization_id/test" - assert ( - request.url.params["resource_type_slug"] == "value resource_type_slug/test" - ) + assert request.url.params["resource_type_slug"] == "value resource_type_slug/test" + assert request.url.params["resource_external_id"] == "value resource_external_id/test" assert request.url.params["search"] == "value search/test" @pytest.mark.asyncio async def test_create_resource(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("authorization_resource.json")) - result = await async_workos.authorization.create_resource( - external_id="test_external_id", - name="test_name", - resource_type_slug="test_resource_type_slug", - organization_id="test_organization_id", - parent_resource=ParentResourceById(parent_resource_id="test_value"), - ) + result = await async_workos.authorization.create_resource(external_id="test_external_id", name="test_name", resource_type_slug="test_resource_type_slug", organization_id="test_organization_id", parent_resource=ParentResourceById(parent_resource_id="test_value")) assert isinstance(result, AuthorizationResource) assert result.object == "authorization_resource" assert result.name == "Website Redesign" @@ -1469,10 +977,7 @@ async def test_get_resource(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_update_resource(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("authorization_resource.json")) - result = await async_workos.authorization.update_resource( - "test_resource_id", - parent_resource=ParentResourceById(parent_resource_id="test_value"), - ) + result = await async_workos.authorization.update_resource("test_resource_id", parent_resource=ParentResourceById(parent_resource_id="test_value")) assert isinstance(result, AuthorizationResource) assert result.object == "authorization_resource" assert result.name == "Website Redesign" @@ -1492,49 +997,29 @@ async def test_delete_resource(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_delete_resource_encodes_query_params(self, async_workos, httpx_mock): httpx_mock.add_response(status_code=204) - await async_workos.authorization.delete_resource( - "test_resource_id", cascade_delete=True - ) + await async_workos.authorization.delete_resource("test_resource_id", cascade_delete=True) request = httpx_mock.get_request() assert request.url.params["cascade_delete"] == "true" @pytest.mark.asyncio async def test_list_memberships_for_resource(self, async_workos, httpx_mock): - httpx_mock.add_response( - json=load_fixture("list_user_organization_membership_base_list_data.json") - ) - page = await async_workos.authorization.list_memberships_for_resource( - "test_resource_id", permission_slug="test_permission_slug" - ) + httpx_mock.add_response(json=load_fixture("list_user_organization_membership_base_list_data.json")) + page = await async_workos.authorization.list_memberships_for_resource("test_resource_id", permission_slug="test_permission_slug") assert isinstance(page, AsyncPage) assert len(page.data) == 1 assert isinstance(page.data[0], UserOrganizationMembershipBaseListData) @pytest.mark.asyncio - async def test_list_memberships_for_resource_empty_page( - self, async_workos, httpx_mock - ): + async def test_list_memberships_for_resource_empty_page(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - page = await async_workos.authorization.list_memberships_for_resource( - "test_resource_id", permission_slug="test_permission_slug" - ) + page = await async_workos.authorization.list_memberships_for_resource("test_resource_id", permission_slug="test_permission_slug") assert isinstance(page, AsyncPage) assert page.data == [] @pytest.mark.asyncio - async def test_list_memberships_for_resource_encodes_query_params( - self, async_workos, httpx_mock - ): + async def test_list_memberships_for_resource_encodes_query_params(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - await async_workos.authorization.list_memberships_for_resource( - "test_resource_id", - limit=10, - before="cursor before", - after="cursor/after", - order=AuthorizationOrder("normal"), - permission_slug="value permission_slug/test", - assignment=AuthorizationAssignment("direct"), - ) + await async_workos.authorization.list_memberships_for_resource("test_resource_id", limit=10, before="cursor before", after="cursor/after", order=AuthorizationOrder("normal"), permission_slug="value permission_slug/test", assignment=AuthorizationAssignment("direct")) request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -1556,9 +1041,7 @@ async def test_list_environment_roles(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_create_environment_role(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("role.json")) - result = await async_workos.authorization.create_environment_role( - slug="test_slug", name="test_name" - ) + result = await async_workos.authorization.create_environment_role(slug="test_slug", name="test_name") assert isinstance(result, Role) assert result.slug == "admin" assert result.object == "role" @@ -1591,9 +1074,7 @@ async def test_update_environment_role(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_add_environment_role_permission(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("role.json")) - result = await async_workos.authorization.add_environment_role_permission( - "test_slug", body_slug="test_slug" - ) + result = await async_workos.authorization.add_environment_role_permission("test_slug", body_slug="test_slug") assert isinstance(result, Role) assert result.slug == "admin" assert result.object == "role" @@ -1604,9 +1085,7 @@ async def test_add_environment_role_permission(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_set_environment_role_permissions(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("role.json")) - result = await async_workos.authorization.set_environment_role_permissions( - "test_slug", permissions=[] - ) + result = await async_workos.authorization.set_environment_role_permissions("test_slug", permissions=[]) assert isinstance(result, Role) assert result.slug == "admin" assert result.object == "role" @@ -1630,16 +1109,9 @@ async def test_list_permissions_empty_page(self, async_workos, httpx_mock): assert page.data == [] @pytest.mark.asyncio - async def test_list_permissions_encodes_query_params( - self, async_workos, httpx_mock - ): + async def test_list_permissions_encodes_query_params(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - await async_workos.authorization.list_permissions( - limit=10, - before="cursor before", - after="cursor/after", - order=PermissionsOrder("normal"), - ) + await async_workos.authorization.list_permissions(limit=10, before="cursor before", after="cursor/after", order=PermissionsOrder("normal")) request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -1649,9 +1121,7 @@ async def test_list_permissions_encodes_query_params( @pytest.mark.asyncio async def test_create_permission(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("permission.json")) - result = await async_workos.authorization.create_permission( - slug="test_slug", name="test_name" - ) + result = await async_workos.authorization.create_permission(slug="test_slug", name="test_name") assert isinstance(result, Permission) assert result.object == "permission" assert result.id == "perm_01HXYZ123456789ABCDEFGHIJ" @@ -1693,12 +1163,7 @@ async def test_delete_permission(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_check_with_request_options(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("authorization_check.json")) - await async_workos.authorization.check( - "test_organization_membership_id", - permission_slug="test_permission_slug", - resource_target=ResourceTargetById(resource_id="test_value"), - request_options={"extra_headers": {"X-Custom": "value"}}, - ) + await async_workos.authorization.check("test_organization_membership_id", permission_slug="test_permission_slug", resource_target=ResourceTargetById(resource_id="test_value"), request_options={"extra_headers": {"X-Custom": "value"}}) request = httpx_mock.get_request() assert request.headers["X-Custom"] == "value" @@ -1706,92 +1171,54 @@ async def test_check_with_request_options(self, async_workos, httpx_mock): async def test_check_unauthorized(self, async_workos, httpx_mock): httpx_mock.add_response(status_code=401, json={"message": "Unauthorized"}) with pytest.raises(AuthenticationError): - await async_workos.authorization.check( - "test_organization_membership_id", - permission_slug="test_permission_slug", - resource_target=ResourceTargetById(resource_id="test_value"), - ) + await async_workos.authorization.check("test_organization_membership_id", permission_slug="test_permission_slug", resource_target=ResourceTargetById(resource_id="test_value")) @pytest.mark.asyncio async def test_check_not_found(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=404, json={"message": "Not found"}) with pytest.raises(NotFoundError): - await workos.authorization.check( - "test_organization_membership_id", - permission_slug="test_permission_slug", - resource_target=ResourceTargetById(resource_id="test_value"), - ) + await workos.authorization.check("test_organization_membership_id", permission_slug="test_permission_slug", resource_target=ResourceTargetById(resource_id="test_value")) finally: await workos.close() @pytest.mark.asyncio async def test_check_rate_limited(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: - httpx_mock.add_response( - status_code=429, - headers={"Retry-After": "0"}, - json={"message": "Slow down"}, - ) + httpx_mock.add_response(status_code=429, headers={"Retry-After": "0"}, json={"message": "Slow down"}) with pytest.raises(RateLimitExceededError): - await workos.authorization.check( - "test_organization_membership_id", - permission_slug="test_permission_slug", - resource_target=ResourceTargetById(resource_id="test_value"), - ) + await workos.authorization.check("test_organization_membership_id", permission_slug="test_permission_slug", resource_target=ResourceTargetById(resource_id="test_value")) finally: await workos.close() @pytest.mark.asyncio async def test_check_server_error(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=500, json={"message": "Server error"}) with pytest.raises(ServerError): - await workos.authorization.check( - "test_organization_membership_id", - permission_slug="test_permission_slug", - resource_target=ResourceTargetById(resource_id="test_value"), - ) + await workos.authorization.check("test_organization_membership_id", permission_slug="test_permission_slug", resource_target=ResourceTargetById(resource_id="test_value")) finally: await workos.close() @pytest.mark.asyncio async def test_check_bad_request(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) with pytest.raises(BadRequestError): - await workos.authorization.check( - "test_organization_membership_id", - permission_slug="test_permission_slug", - resource_target=ResourceTargetById(resource_id="test_value"), - ) + await workos.authorization.check("test_organization_membership_id", permission_slug="test_permission_slug", resource_target=ResourceTargetById(resource_id="test_value")) finally: await workos.close() @pytest.mark.asyncio async def test_check_unprocessable(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) with pytest.raises(UnprocessableEntityError): - await workos.authorization.check( - "test_organization_membership_id", - permission_slug="test_permission_slug", - resource_target=ResourceTargetById(resource_id="test_value"), - ) + await workos.authorization.check("test_organization_membership_id", permission_slug="test_permission_slug", resource_target=ResourceTargetById(resource_id="test_value")) finally: await workos.close() diff --git a/tests/test_connect.py b/tests/test_connect.py index 64dbebd9..9d927f9e 100644 --- a/tests/test_connect.py +++ b/tests/test_connect.py @@ -6,39 +6,20 @@ from workos import WorkOSClient, AsyncWorkOSClient from tests.generated_helpers import load_fixture -from workos.connect.models import ( - ApplicationCredentialsListItem, - ConnectApplication, - ExternalAuthCompleteResponse, - NewConnectApplicationSecret, - UserObject, - ApplicationsOrder, -) +from workos.connect.models import ApplicationCredentialsListItem, ConnectApplication, ExternalAuthCompleteResponse, NewConnectApplicationSecret, UserConsentOption, UserObject, ApplicationsOrder from workos._pagination import AsyncPage, SyncPage -from workos._errors import ( - AuthenticationError, - BadRequestError, - NotFoundError, - RateLimitExceededError, - ServerError, - UnprocessableEntityError, -) +from workos._errors import AuthenticationError, BadRequestError, NotFoundError, RateLimitExceededError, ServerError, UnprocessableEntityError class TestConnect: + def test_complete_oauth2(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("external_auth_complete_response.json"), ) - result = workos.connect.complete_oauth2( - external_auth_id="test_external_auth_id", - user=UserObject.from_dict(load_fixture("user_object.json")), - ) + result = workos.connect.complete_oauth2(external_auth_id="test_external_auth_id", user=UserObject.from_dict(load_fixture("user_object.json"))) assert isinstance(result, ExternalAuthCompleteResponse) - assert ( - result.redirect_uri - == "https://your-authkit-domain.workos.com/oauth/authorize/complete?state=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdGF0ZSI6InJhbmRvbV9zdGF0ZV9zdHJpbmciLCJpYXQiOjE3NDI2MDQ4NTN9.abc123def456ghi789" - ) + assert result.redirect_uri == "https://your-authkit-domain.workos.com/oauth/authorize/complete?state=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdGF0ZSI6InJhbmRvbV9zdGF0ZV9zdHJpbmciLCJpYXQiOjE3NDI2MDQ4NTN9.abc123def456ghi789" request = httpx_mock.get_request() assert request.method == "POST" assert request.url.path.endswith("/authkit/oauth2/complete") @@ -63,13 +44,7 @@ def test_list_applications_empty_page(self, workos, httpx_mock): def test_list_applications_encodes_query_params(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - workos.connect.list_applications( - limit=10, - before="cursor before", - after="cursor/after", - order=ApplicationsOrder("normal"), - organization_id="value organization_id/test", - ) + workos.connect.list_applications(limit=10, before="cursor before", after="cursor/after", order=ApplicationsOrder("normal"), organization_id="value organization_id/test") request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -81,9 +56,7 @@ def test_create_application(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("connect_application.json"), ) - result = workos.connect.create_application( - body=load_fixture("create_oauth_application.json") - ) + result = workos.connect.create_application(body=load_fixture("create_oauth_application.json")) assert isinstance(result, ConnectApplication) assert result.object == "connect_application" assert result.id == "conn_app_01HXYZ123456789ABCDEFGHIJ" @@ -124,9 +97,7 @@ def test_delete_application(self, workos, httpx_mock): assert request.url.path.endswith("/connect/applications/test_id") def test_list_application_client_secrets(self, workos, httpx_mock): - httpx_mock.add_response( - json=[load_fixture("application_credentials_list_item.json")] - ) + httpx_mock.add_response(json=[load_fixture("application_credentials_list_item.json")]) result = workos.connect.list_application_client_secrets("test_id") assert isinstance(result, list) assert len(result) == 1 @@ -154,9 +125,7 @@ def test_delete_client_secret(self, workos, httpx_mock): def test_create_oauth_application(self, workos, httpx_mock): httpx_mock.add_response(json=load_fixture("connect_application.json")) - result = workos.connect.create_oauth_application( - name="test_name", is_first_party=True - ) + result = workos.connect.create_oauth_application(name="test_name", is_first_party=True) assert isinstance(result, ConnectApplication) request = httpx_mock.get_request() assert request.method == "POST" @@ -165,9 +134,7 @@ def test_create_oauth_application(self, workos, httpx_mock): def test_create_m2m_application(self, workos, httpx_mock): httpx_mock.add_response(json=load_fixture("connect_application.json")) - result = workos.connect.create_m2m_application( - name="test_name", organization_id="test_organization_id" - ) + result = workos.connect.create_m2m_application(name="test_name", organization_id="test_organization_id") assert isinstance(result, ConnectApplication) request = httpx_mock.get_request() assert request.method == "POST" @@ -175,14 +142,8 @@ def test_create_m2m_application(self, workos, httpx_mock): assert body["application_type"] == "m2m" def test_complete_oauth2_with_request_options(self, workos, httpx_mock): - httpx_mock.add_response( - json=load_fixture("external_auth_complete_response.json") - ) - workos.connect.complete_oauth2( - external_auth_id="test_external_auth_id", - user=UserObject.from_dict(load_fixture("user_object.json")), - request_options={"extra_headers": {"X-Custom": "value"}}, - ) + httpx_mock.add_response(json=load_fixture("external_auth_complete_response.json")) + workos.connect.complete_oauth2(external_auth_id="test_external_auth_id", user=UserObject.from_dict(load_fixture("user_object.json")), request_options={"extra_headers": {"X-Custom": "value"}}) request = httpx_mock.get_request() assert request.headers["X-Custom"] == "value" @@ -192,101 +153,62 @@ def test_complete_oauth2_unauthorized(self, workos, httpx_mock): json={"message": "Unauthorized"}, ) with pytest.raises(AuthenticationError): - workos.connect.complete_oauth2( - external_auth_id="test_external_auth_id", - user=UserObject.from_dict(load_fixture("user_object.json")), - ) + workos.connect.complete_oauth2(external_auth_id="test_external_auth_id", user=UserObject.from_dict(load_fixture("user_object.json"))) def test_complete_oauth2_not_found(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=404, json={"message": "Not found"}) with pytest.raises(NotFoundError): - workos.connect.complete_oauth2( - external_auth_id="test_external_auth_id", - user=UserObject.from_dict(load_fixture("user_object.json")), - ) + workos.connect.complete_oauth2(external_auth_id="test_external_auth_id", user=UserObject.from_dict(load_fixture("user_object.json"))) finally: workos.close() def test_complete_oauth2_rate_limited(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: - httpx_mock.add_response( - status_code=429, - headers={"Retry-After": "0"}, - json={"message": "Slow down"}, - ) + httpx_mock.add_response(status_code=429, headers={"Retry-After": "0"}, json={"message": "Slow down"}) with pytest.raises(RateLimitExceededError): - workos.connect.complete_oauth2( - external_auth_id="test_external_auth_id", - user=UserObject.from_dict(load_fixture("user_object.json")), - ) + workos.connect.complete_oauth2(external_auth_id="test_external_auth_id", user=UserObject.from_dict(load_fixture("user_object.json"))) finally: workos.close() def test_complete_oauth2_server_error(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=500, json={"message": "Server error"}) with pytest.raises(ServerError): - workos.connect.complete_oauth2( - external_auth_id="test_external_auth_id", - user=UserObject.from_dict(load_fixture("user_object.json")), - ) + workos.connect.complete_oauth2(external_auth_id="test_external_auth_id", user=UserObject.from_dict(load_fixture("user_object.json"))) finally: workos.close() def test_complete_oauth2_bad_request(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) with pytest.raises(BadRequestError): - workos.connect.complete_oauth2( - external_auth_id="test_external_auth_id", - user=UserObject.from_dict(load_fixture("user_object.json")), - ) + workos.connect.complete_oauth2(external_auth_id="test_external_auth_id", user=UserObject.from_dict(load_fixture("user_object.json"))) finally: workos.close() def test_complete_oauth2_unprocessable(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) with pytest.raises(UnprocessableEntityError): - workos.connect.complete_oauth2( - external_auth_id="test_external_auth_id", - user=UserObject.from_dict(load_fixture("user_object.json")), - ) + workos.connect.complete_oauth2(external_auth_id="test_external_auth_id", user=UserObject.from_dict(load_fixture("user_object.json"))) finally: workos.close() class TestAsyncConnect: + @pytest.mark.asyncio async def test_complete_oauth2(self, async_workos, httpx_mock): - httpx_mock.add_response( - json=load_fixture("external_auth_complete_response.json") - ) - result = await async_workos.connect.complete_oauth2( - external_auth_id="test_external_auth_id", - user=UserObject.from_dict(load_fixture("user_object.json")), - ) + httpx_mock.add_response(json=load_fixture("external_auth_complete_response.json")) + result = await async_workos.connect.complete_oauth2(external_auth_id="test_external_auth_id", user=UserObject.from_dict(load_fixture("user_object.json"))) assert isinstance(result, ExternalAuthCompleteResponse) - assert ( - result.redirect_uri - == "https://your-authkit-domain.workos.com/oauth/authorize/complete?state=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdGF0ZSI6InJhbmRvbV9zdGF0ZV9zdHJpbmciLCJpYXQiOjE3NDI2MDQ4NTN9.abc123def456ghi789" - ) + assert result.redirect_uri == "https://your-authkit-domain.workos.com/oauth/authorize/complete?state=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdGF0ZSI6InJhbmRvbV9zdGF0ZV9zdHJpbmciLCJpYXQiOjE3NDI2MDQ4NTN9.abc123def456ghi789" request = httpx_mock.get_request() assert request.method == "POST" assert request.url.path.endswith("/authkit/oauth2/complete") @@ -307,17 +229,9 @@ async def test_list_applications_empty_page(self, async_workos, httpx_mock): assert page.data == [] @pytest.mark.asyncio - async def test_list_applications_encodes_query_params( - self, async_workos, httpx_mock - ): + async def test_list_applications_encodes_query_params(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - await async_workos.connect.list_applications( - limit=10, - before="cursor before", - after="cursor/after", - order=ApplicationsOrder("normal"), - organization_id="value organization_id/test", - ) + await async_workos.connect.list_applications(limit=10, before="cursor before", after="cursor/after", order=ApplicationsOrder("normal"), organization_id="value organization_id/test") request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -328,9 +242,7 @@ async def test_list_applications_encodes_query_params( @pytest.mark.asyncio async def test_create_application(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("connect_application.json")) - result = await async_workos.connect.create_application( - body=load_fixture("create_oauth_application.json") - ) + result = await async_workos.connect.create_application(body=load_fixture("create_oauth_application.json")) assert isinstance(result, ConnectApplication) assert result.object == "connect_application" assert result.id == "conn_app_01HXYZ123456789ABCDEFGHIJ" @@ -371,9 +283,7 @@ async def test_delete_application(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_list_application_client_secrets(self, async_workos, httpx_mock): - httpx_mock.add_response( - json=[load_fixture("application_credentials_list_item.json")] - ) + httpx_mock.add_response(json=[load_fixture("application_credentials_list_item.json")]) result = await async_workos.connect.list_application_client_secrets("test_id") assert isinstance(result, list) assert len(result) == 1 @@ -381,9 +291,7 @@ async def test_list_application_client_secrets(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_create_application_client_secret(self, async_workos, httpx_mock): - httpx_mock.add_response( - json=load_fixture("new_connect_application_secret.json") - ) + httpx_mock.add_response(json=load_fixture("new_connect_application_secret.json")) result = await async_workos.connect.create_application_client_secret("test_id") assert isinstance(result, NewConnectApplicationSecret) assert result.object == "connect_application_secret" @@ -404,9 +312,7 @@ async def test_delete_client_secret(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_create_oauth_application(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("connect_application.json")) - result = await async_workos.connect.create_oauth_application( - name="test_name", is_first_party=True - ) + result = await async_workos.connect.create_oauth_application(name="test_name", is_first_party=True) assert isinstance(result, ConnectApplication) request = httpx_mock.get_request() assert request.method == "POST" @@ -416,9 +322,7 @@ async def test_create_oauth_application(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_create_m2m_application(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("connect_application.json")) - result = await async_workos.connect.create_m2m_application( - name="test_name", organization_id="test_organization_id" - ) + result = await async_workos.connect.create_m2m_application(name="test_name", organization_id="test_organization_id") assert isinstance(result, ConnectApplication) request = httpx_mock.get_request() assert request.method == "POST" @@ -427,14 +331,8 @@ async def test_create_m2m_application(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_complete_oauth2_with_request_options(self, async_workos, httpx_mock): - httpx_mock.add_response( - json=load_fixture("external_auth_complete_response.json") - ) - await async_workos.connect.complete_oauth2( - external_auth_id="test_external_auth_id", - user=UserObject.from_dict(load_fixture("user_object.json")), - request_options={"extra_headers": {"X-Custom": "value"}}, - ) + httpx_mock.add_response(json=load_fixture("external_auth_complete_response.json")) + await async_workos.connect.complete_oauth2(external_auth_id="test_external_auth_id", user=UserObject.from_dict(load_fixture("user_object.json")), request_options={"extra_headers": {"X-Custom": "value"}}) request = httpx_mock.get_request() assert request.headers["X-Custom"] == "value" @@ -442,86 +340,54 @@ async def test_complete_oauth2_with_request_options(self, async_workos, httpx_mo async def test_complete_oauth2_unauthorized(self, async_workos, httpx_mock): httpx_mock.add_response(status_code=401, json={"message": "Unauthorized"}) with pytest.raises(AuthenticationError): - await async_workos.connect.complete_oauth2( - external_auth_id="test_external_auth_id", - user=UserObject.from_dict(load_fixture("user_object.json")), - ) + await async_workos.connect.complete_oauth2(external_auth_id="test_external_auth_id", user=UserObject.from_dict(load_fixture("user_object.json"))) @pytest.mark.asyncio async def test_complete_oauth2_not_found(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=404, json={"message": "Not found"}) with pytest.raises(NotFoundError): - await workos.connect.complete_oauth2( - external_auth_id="test_external_auth_id", - user=UserObject.from_dict(load_fixture("user_object.json")), - ) + await workos.connect.complete_oauth2(external_auth_id="test_external_auth_id", user=UserObject.from_dict(load_fixture("user_object.json"))) finally: await workos.close() @pytest.mark.asyncio async def test_complete_oauth2_rate_limited(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: - httpx_mock.add_response( - status_code=429, - headers={"Retry-After": "0"}, - json={"message": "Slow down"}, - ) + httpx_mock.add_response(status_code=429, headers={"Retry-After": "0"}, json={"message": "Slow down"}) with pytest.raises(RateLimitExceededError): - await workos.connect.complete_oauth2( - external_auth_id="test_external_auth_id", - user=UserObject.from_dict(load_fixture("user_object.json")), - ) + await workos.connect.complete_oauth2(external_auth_id="test_external_auth_id", user=UserObject.from_dict(load_fixture("user_object.json"))) finally: await workos.close() @pytest.mark.asyncio async def test_complete_oauth2_server_error(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=500, json={"message": "Server error"}) with pytest.raises(ServerError): - await workos.connect.complete_oauth2( - external_auth_id="test_external_auth_id", - user=UserObject.from_dict(load_fixture("user_object.json")), - ) + await workos.connect.complete_oauth2(external_auth_id="test_external_auth_id", user=UserObject.from_dict(load_fixture("user_object.json"))) finally: await workos.close() @pytest.mark.asyncio async def test_complete_oauth2_bad_request(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) with pytest.raises(BadRequestError): - await workos.connect.complete_oauth2( - external_auth_id="test_external_auth_id", - user=UserObject.from_dict(load_fixture("user_object.json")), - ) + await workos.connect.complete_oauth2(external_auth_id="test_external_auth_id", user=UserObject.from_dict(load_fixture("user_object.json"))) finally: await workos.close() @pytest.mark.asyncio async def test_complete_oauth2_unprocessable(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) with pytest.raises(UnprocessableEntityError): - await workos.connect.complete_oauth2( - external_auth_id="test_external_auth_id", - user=UserObject.from_dict(load_fixture("user_object.json")), - ) + await workos.connect.complete_oauth2(external_auth_id="test_external_auth_id", user=UserObject.from_dict(load_fixture("user_object.json"))) finally: await workos.close() diff --git a/tests/test_directory_sync.py b/tests/test_directory_sync.py index 7dae6f98..ae4cc458 100644 --- a/tests/test_directory_sync.py +++ b/tests/test_directory_sync.py @@ -1,30 +1,18 @@ # This file is auto-generated by oagen. Do not edit. +import json import pytest from workos import WorkOSClient, AsyncWorkOSClient from tests.generated_helpers import load_fixture -from workos.directory_sync.models import ( - Directory, - DirectoryGroup, - DirectoryUserWithGroups, - DirectoriesOrder, - DirectoryGroupsOrder, - DirectoryUsersOrder, -) +from workos.directory_sync.models import Directory, DirectoryGroup, DirectoryUserWithGroups, DirectoriesOrder, DirectoryGroupsOrder, DirectoryUsersOrder from workos._pagination import AsyncPage, SyncPage -from workos._errors import ( - AuthenticationError, - BadRequestError, - NotFoundError, - RateLimitExceededError, - ServerError, - UnprocessableEntityError, -) +from workos._errors import AuthenticationError, BadRequestError, NotFoundError, RateLimitExceededError, ServerError, UnprocessableEntityError class TestDirectorySync: + def test_list_directories(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("list_directory.json"), @@ -42,15 +30,7 @@ def test_list_directories_empty_page(self, workos, httpx_mock): def test_list_directories_encodes_query_params(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - workos.directory_sync.list_directories( - limit=10, - before="cursor before", - after="cursor/after", - order=DirectoriesOrder("normal"), - organization_id="value organization_id/test", - search="value search/test", - domain="value domain/test", - ) + workos.directory_sync.list_directories(limit=10, before="cursor before", after="cursor/after", order=DirectoriesOrder("normal"), organization_id="value organization_id/test", search="value search/test", domain="value domain/test") request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -97,14 +77,7 @@ def test_list_groups_empty_page(self, workos, httpx_mock): def test_list_groups_encodes_query_params(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - workos.directory_sync.list_groups( - limit=10, - before="cursor before", - after="cursor/after", - order=DirectoryGroupsOrder("normal"), - directory="value directory/test", - user="value user/test", - ) + workos.directory_sync.list_groups(limit=10, before="cursor before", after="cursor/after", order=DirectoryGroupsOrder("normal"), directory="value directory/test", user="value user/test") request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -142,14 +115,7 @@ def test_list_users_empty_page(self, workos, httpx_mock): def test_list_users_encodes_query_params(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - workos.directory_sync.list_users( - limit=10, - before="cursor before", - after="cursor/after", - order=DirectoryUsersOrder("normal"), - directory="value directory/test", - group="value group/test", - ) + workos.directory_sync.list_users(limit=10, before="cursor before", after="cursor/after", order=DirectoryUsersOrder("normal"), directory="value directory/test", group="value group/test") request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -172,9 +138,7 @@ def test_get_user(self, workos, httpx_mock): def test_list_directories_with_request_options(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - workos.directory_sync.list_directories( - request_options={"extra_headers": {"X-Custom": "value"}} - ) + workos.directory_sync.list_directories(request_options={"extra_headers": {"X-Custom": "value"}}) request = httpx_mock.get_request() assert request.headers["X-Custom"] == "value" @@ -187,9 +151,7 @@ def test_list_directories_unauthorized(self, workos, httpx_mock): workos.directory_sync.list_directories() def test_list_directories_not_found(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=404, json={"message": "Not found"}) with pytest.raises(NotFoundError): @@ -198,24 +160,16 @@ def test_list_directories_not_found(self, httpx_mock): workos.close() def test_list_directories_rate_limited(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: - httpx_mock.add_response( - status_code=429, - headers={"Retry-After": "0"}, - json={"message": "Slow down"}, - ) + httpx_mock.add_response(status_code=429, headers={"Retry-After": "0"}, json={"message": "Slow down"}) with pytest.raises(RateLimitExceededError): workos.directory_sync.list_directories() finally: workos.close() def test_list_directories_server_error(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=500, json={"message": "Server error"}) with pytest.raises(ServerError): @@ -224,9 +178,7 @@ def test_list_directories_server_error(self, httpx_mock): workos.close() def test_list_directories_bad_request(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) with pytest.raises(BadRequestError): @@ -235,9 +187,7 @@ def test_list_directories_bad_request(self, httpx_mock): workos.close() def test_list_directories_unprocessable(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) with pytest.raises(UnprocessableEntityError): @@ -247,6 +197,7 @@ def test_list_directories_unprocessable(self, httpx_mock): class TestAsyncDirectorySync: + @pytest.mark.asyncio async def test_list_directories(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("list_directory.json")) @@ -263,19 +214,9 @@ async def test_list_directories_empty_page(self, async_workos, httpx_mock): assert page.data == [] @pytest.mark.asyncio - async def test_list_directories_encodes_query_params( - self, async_workos, httpx_mock - ): + async def test_list_directories_encodes_query_params(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - await async_workos.directory_sync.list_directories( - limit=10, - before="cursor before", - after="cursor/after", - order=DirectoriesOrder("normal"), - organization_id="value organization_id/test", - search="value search/test", - domain="value domain/test", - ) + await async_workos.directory_sync.list_directories(limit=10, before="cursor before", after="cursor/after", order=DirectoriesOrder("normal"), organization_id="value organization_id/test", search="value search/test", domain="value domain/test") request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -323,14 +264,7 @@ async def test_list_groups_empty_page(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_list_groups_encodes_query_params(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - await async_workos.directory_sync.list_groups( - limit=10, - before="cursor before", - after="cursor/after", - order=DirectoryGroupsOrder("normal"), - directory="value directory/test", - user="value user/test", - ) + await async_workos.directory_sync.list_groups(limit=10, before="cursor before", after="cursor/after", order=DirectoryGroupsOrder("normal"), directory="value directory/test", user="value user/test") request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -352,9 +286,7 @@ async def test_get_group(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_list_users(self, async_workos, httpx_mock): - httpx_mock.add_response( - json=load_fixture("list_directory_user_with_groups.json") - ) + httpx_mock.add_response(json=load_fixture("list_directory_user_with_groups.json")) page = await async_workos.directory_sync.list_users() assert isinstance(page, AsyncPage) assert len(page.data) == 1 @@ -370,14 +302,7 @@ async def test_list_users_empty_page(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_list_users_encodes_query_params(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - await async_workos.directory_sync.list_users( - limit=10, - before="cursor before", - after="cursor/after", - order=DirectoryUsersOrder("normal"), - directory="value directory/test", - group="value group/test", - ) + await async_workos.directory_sync.list_users(limit=10, before="cursor before", after="cursor/after", order=DirectoryUsersOrder("normal"), directory="value directory/test", group="value group/test") request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -398,13 +323,9 @@ async def test_get_user(self, async_workos, httpx_mock): assert request.url.path.endswith("/directory_users/test_id") @pytest.mark.asyncio - async def test_list_directories_with_request_options( - self, async_workos, httpx_mock - ): + async def test_list_directories_with_request_options(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - await async_workos.directory_sync.list_directories( - request_options={"extra_headers": {"X-Custom": "value"}} - ) + await async_workos.directory_sync.list_directories(request_options={"extra_headers": {"X-Custom": "value"}}) request = httpx_mock.get_request() assert request.headers["X-Custom"] == "value" @@ -416,9 +337,7 @@ async def test_list_directories_unauthorized(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_list_directories_not_found(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=404, json={"message": "Not found"}) with pytest.raises(NotFoundError): @@ -428,15 +347,9 @@ async def test_list_directories_not_found(self, httpx_mock): @pytest.mark.asyncio async def test_list_directories_rate_limited(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: - httpx_mock.add_response( - status_code=429, - headers={"Retry-After": "0"}, - json={"message": "Slow down"}, - ) + httpx_mock.add_response(status_code=429, headers={"Retry-After": "0"}, json={"message": "Slow down"}) with pytest.raises(RateLimitExceededError): await workos.directory_sync.list_directories() finally: @@ -444,9 +357,7 @@ async def test_list_directories_rate_limited(self, httpx_mock): @pytest.mark.asyncio async def test_list_directories_server_error(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=500, json={"message": "Server error"}) with pytest.raises(ServerError): @@ -456,9 +367,7 @@ async def test_list_directories_server_error(self, httpx_mock): @pytest.mark.asyncio async def test_list_directories_bad_request(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) with pytest.raises(BadRequestError): @@ -468,9 +377,7 @@ async def test_list_directories_bad_request(self, httpx_mock): @pytest.mark.asyncio async def test_list_directories_unprocessable(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) with pytest.raises(UnprocessableEntityError): diff --git a/tests/test_events.py b/tests/test_events.py index 34b5be84..53e07bc4 100644 --- a/tests/test_events.py +++ b/tests/test_events.py @@ -1,24 +1,19 @@ # This file is auto-generated by oagen. Do not edit. +import json import pytest from workos import WorkOSClient, AsyncWorkOSClient from tests.generated_helpers import load_fixture from workos.common.models import DsyncUserCreated -from workos.events.models import EventsOrder +from workos.events.models import EventSchema, EventsOrder from workos._pagination import AsyncPage, SyncPage -from workos._errors import ( - AuthenticationError, - BadRequestError, - NotFoundError, - RateLimitExceededError, - ServerError, - UnprocessableEntityError, -) +from workos._errors import AuthenticationError, BadRequestError, NotFoundError, RateLimitExceededError, ServerError, UnprocessableEntityError class TestEvents: + def test_list_events(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("list_event_schema.json"), @@ -36,16 +31,7 @@ def test_list_events_empty_page(self, workos, httpx_mock): def test_list_events_encodes_query_params(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - workos.events.list_events( - limit=10, - before="cursor before", - after="cursor/after", - order=EventsOrder("normal"), - events=["val1", "val2"], - range_start="value range_start/test", - range_end="value range_end/test", - organization_id="value organization_id/test", - ) + workos.events.list_events(limit=10, before="cursor before", after="cursor/after", order=EventsOrder("normal"), events=["val1", "val2"], range_start="value range_start/test", range_end="value range_end/test", organization_id="value organization_id/test") request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -58,9 +44,7 @@ def test_list_events_encodes_query_params(self, workos, httpx_mock): def test_list_events_with_request_options(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - workos.events.list_events( - request_options={"extra_headers": {"X-Custom": "value"}} - ) + workos.events.list_events(request_options={"extra_headers": {"X-Custom": "value"}}) request = httpx_mock.get_request() assert request.headers["X-Custom"] == "value" @@ -73,9 +57,7 @@ def test_list_events_unauthorized(self, workos, httpx_mock): workos.events.list_events() def test_list_events_not_found(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=404, json={"message": "Not found"}) with pytest.raises(NotFoundError): @@ -84,24 +66,16 @@ def test_list_events_not_found(self, httpx_mock): workos.close() def test_list_events_rate_limited(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: - httpx_mock.add_response( - status_code=429, - headers={"Retry-After": "0"}, - json={"message": "Slow down"}, - ) + httpx_mock.add_response(status_code=429, headers={"Retry-After": "0"}, json={"message": "Slow down"}) with pytest.raises(RateLimitExceededError): workos.events.list_events() finally: workos.close() def test_list_events_server_error(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=500, json={"message": "Server error"}) with pytest.raises(ServerError): @@ -110,9 +84,7 @@ def test_list_events_server_error(self, httpx_mock): workos.close() def test_list_events_bad_request(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) with pytest.raises(BadRequestError): @@ -121,9 +93,7 @@ def test_list_events_bad_request(self, httpx_mock): workos.close() def test_list_events_unprocessable(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) with pytest.raises(UnprocessableEntityError): @@ -133,6 +103,7 @@ def test_list_events_unprocessable(self, httpx_mock): class TestAsyncEvents: + @pytest.mark.asyncio async def test_list_events(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("list_event_schema.json")) @@ -151,16 +122,7 @@ async def test_list_events_empty_page(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_list_events_encodes_query_params(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - await async_workos.events.list_events( - limit=10, - before="cursor before", - after="cursor/after", - order=EventsOrder("normal"), - events=["val1", "val2"], - range_start="value range_start/test", - range_end="value range_end/test", - organization_id="value organization_id/test", - ) + await async_workos.events.list_events(limit=10, before="cursor before", after="cursor/after", order=EventsOrder("normal"), events=["val1", "val2"], range_start="value range_start/test", range_end="value range_end/test", organization_id="value organization_id/test") request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -174,9 +136,7 @@ async def test_list_events_encodes_query_params(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_list_events_with_request_options(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - await async_workos.events.list_events( - request_options={"extra_headers": {"X-Custom": "value"}} - ) + await async_workos.events.list_events(request_options={"extra_headers": {"X-Custom": "value"}}) request = httpx_mock.get_request() assert request.headers["X-Custom"] == "value" @@ -188,9 +148,7 @@ async def test_list_events_unauthorized(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_list_events_not_found(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=404, json={"message": "Not found"}) with pytest.raises(NotFoundError): @@ -200,15 +158,9 @@ async def test_list_events_not_found(self, httpx_mock): @pytest.mark.asyncio async def test_list_events_rate_limited(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: - httpx_mock.add_response( - status_code=429, - headers={"Retry-After": "0"}, - json={"message": "Slow down"}, - ) + httpx_mock.add_response(status_code=429, headers={"Retry-After": "0"}, json={"message": "Slow down"}) with pytest.raises(RateLimitExceededError): await workos.events.list_events() finally: @@ -216,9 +168,7 @@ async def test_list_events_rate_limited(self, httpx_mock): @pytest.mark.asyncio async def test_list_events_server_error(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=500, json={"message": "Server error"}) with pytest.raises(ServerError): @@ -228,9 +178,7 @@ async def test_list_events_server_error(self, httpx_mock): @pytest.mark.asyncio async def test_list_events_bad_request(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) with pytest.raises(BadRequestError): @@ -240,9 +188,7 @@ async def test_list_events_bad_request(self, httpx_mock): @pytest.mark.asyncio async def test_list_events_unprocessable(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) with pytest.raises(UnprocessableEntityError): diff --git a/tests/test_feature_flags.py b/tests/test_feature_flags.py index 6f8ef66b..c50fab8e 100644 --- a/tests/test_feature_flags.py +++ b/tests/test_feature_flags.py @@ -1,29 +1,18 @@ # This file is auto-generated by oagen. Do not edit. +import json import pytest from workos import WorkOSClient, AsyncWorkOSClient from tests.generated_helpers import load_fixture -from workos.feature_flags.models import ( - FeatureFlag, - Flag, - FeatureFlagsOrder, - OrganizationsFeatureFlagsOrder, - UserManagementUsersFeatureFlagsOrder, -) +from workos.feature_flags.models import FeatureFlag, Flag, FeatureFlagsOrder, OrganizationsFeatureFlagsOrder, UserManagementUsersFeatureFlagsOrder from workos._pagination import AsyncPage, SyncPage -from workos._errors import ( - AuthenticationError, - BadRequestError, - NotFoundError, - RateLimitExceededError, - ServerError, - UnprocessableEntityError, -) +from workos._errors import AuthenticationError, BadRequestError, NotFoundError, RateLimitExceededError, ServerError, UnprocessableEntityError class TestFeatureFlags: + def test_list_feature_flags(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("list_flag.json"), @@ -41,12 +30,7 @@ def test_list_feature_flags_empty_page(self, workos, httpx_mock): def test_list_feature_flags_encodes_query_params(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - workos.feature_flags.list_feature_flags( - limit=10, - before="cursor before", - after="cursor/after", - order=FeatureFlagsOrder("normal"), - ) + workos.feature_flags.list_feature_flags(limit=10, before="cursor before", after="cursor/after", order=FeatureFlagsOrder("normal")) request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -94,9 +78,7 @@ def test_add_flag_target(self, workos, httpx_mock): workos.feature_flags.add_flag_target("test_resourceId", "test_slug") request = httpx_mock.get_request() assert request.method == "POST" - assert request.url.path.endswith( - "/feature-flags/test_slug/targets/test_resourceId" - ) + assert request.url.path.endswith("/feature-flags/test_slug/targets/test_resourceId") def test_remove_flag_target(self, workos, httpx_mock): httpx_mock.add_response(status_code=204) @@ -104,40 +86,26 @@ def test_remove_flag_target(self, workos, httpx_mock): assert result is None request = httpx_mock.get_request() assert request.method == "DELETE" - assert request.url.path.endswith( - "/feature-flags/test_slug/targets/test_resourceId" - ) + assert request.url.path.endswith("/feature-flags/test_slug/targets/test_resourceId") def test_list_organization_feature_flags(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("list_flag.json"), ) - page = workos.feature_flags.list_organization_feature_flags( - "test_organizationId" - ) + page = workos.feature_flags.list_organization_feature_flags("test_organizationId") assert isinstance(page, SyncPage) assert len(page.data) == 1 assert isinstance(page.data[0], Flag) def test_list_organization_feature_flags_empty_page(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - page = workos.feature_flags.list_organization_feature_flags( - "test_organizationId" - ) + page = workos.feature_flags.list_organization_feature_flags("test_organizationId") assert isinstance(page, SyncPage) assert page.data == [] - def test_list_organization_feature_flags_encodes_query_params( - self, workos, httpx_mock - ): + def test_list_organization_feature_flags_encodes_query_params(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - workos.feature_flags.list_organization_feature_flags( - "test_organizationId", - limit=10, - before="cursor before", - after="cursor/after", - order=OrganizationsFeatureFlagsOrder("normal"), - ) + workos.feature_flags.list_organization_feature_flags("test_organizationId", limit=10, before="cursor before", after="cursor/after", order=OrganizationsFeatureFlagsOrder("normal")) request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -161,13 +129,7 @@ def test_list_user_feature_flags_empty_page(self, workos, httpx_mock): def test_list_user_feature_flags_encodes_query_params(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - workos.feature_flags.list_user_feature_flags( - "test_userId", - limit=10, - before="cursor before", - after="cursor/after", - order=UserManagementUsersFeatureFlagsOrder("normal"), - ) + workos.feature_flags.list_user_feature_flags("test_userId", limit=10, before="cursor before", after="cursor/after", order=UserManagementUsersFeatureFlagsOrder("normal")) request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -176,9 +138,7 @@ def test_list_user_feature_flags_encodes_query_params(self, workos, httpx_mock): def test_list_feature_flags_with_request_options(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - workos.feature_flags.list_feature_flags( - request_options={"extra_headers": {"X-Custom": "value"}} - ) + workos.feature_flags.list_feature_flags(request_options={"extra_headers": {"X-Custom": "value"}}) request = httpx_mock.get_request() assert request.headers["X-Custom"] == "value" @@ -191,9 +151,7 @@ def test_list_feature_flags_unauthorized(self, workos, httpx_mock): workos.feature_flags.list_feature_flags() def test_list_feature_flags_not_found(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=404, json={"message": "Not found"}) with pytest.raises(NotFoundError): @@ -202,24 +160,16 @@ def test_list_feature_flags_not_found(self, httpx_mock): workos.close() def test_list_feature_flags_rate_limited(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: - httpx_mock.add_response( - status_code=429, - headers={"Retry-After": "0"}, - json={"message": "Slow down"}, - ) + httpx_mock.add_response(status_code=429, headers={"Retry-After": "0"}, json={"message": "Slow down"}) with pytest.raises(RateLimitExceededError): workos.feature_flags.list_feature_flags() finally: workos.close() def test_list_feature_flags_server_error(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=500, json={"message": "Server error"}) with pytest.raises(ServerError): @@ -228,9 +178,7 @@ def test_list_feature_flags_server_error(self, httpx_mock): workos.close() def test_list_feature_flags_bad_request(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) with pytest.raises(BadRequestError): @@ -239,9 +187,7 @@ def test_list_feature_flags_bad_request(self, httpx_mock): workos.close() def test_list_feature_flags_unprocessable(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) with pytest.raises(UnprocessableEntityError): @@ -251,6 +197,7 @@ def test_list_feature_flags_unprocessable(self, httpx_mock): class TestAsyncFeatureFlags: + @pytest.mark.asyncio async def test_list_feature_flags(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("list_flag.json")) @@ -267,16 +214,9 @@ async def test_list_feature_flags_empty_page(self, async_workos, httpx_mock): assert page.data == [] @pytest.mark.asyncio - async def test_list_feature_flags_encodes_query_params( - self, async_workos, httpx_mock - ): + async def test_list_feature_flags_encodes_query_params(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - await async_workos.feature_flags.list_feature_flags( - limit=10, - before="cursor before", - after="cursor/after", - order=FeatureFlagsOrder("normal"), - ) + await async_workos.feature_flags.list_feature_flags(limit=10, before="cursor before", after="cursor/after", order=FeatureFlagsOrder("normal")) request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -322,56 +262,36 @@ async def test_add_flag_target(self, async_workos, httpx_mock): await async_workos.feature_flags.add_flag_target("test_resourceId", "test_slug") request = httpx_mock.get_request() assert request.method == "POST" - assert request.url.path.endswith( - "/feature-flags/test_slug/targets/test_resourceId" - ) + assert request.url.path.endswith("/feature-flags/test_slug/targets/test_resourceId") @pytest.mark.asyncio async def test_remove_flag_target(self, async_workos, httpx_mock): httpx_mock.add_response(status_code=204) - result = await async_workos.feature_flags.remove_flag_target( - "test_resourceId", "test_slug" - ) + result = await async_workos.feature_flags.remove_flag_target("test_resourceId", "test_slug") assert result is None request = httpx_mock.get_request() assert request.method == "DELETE" - assert request.url.path.endswith( - "/feature-flags/test_slug/targets/test_resourceId" - ) + assert request.url.path.endswith("/feature-flags/test_slug/targets/test_resourceId") @pytest.mark.asyncio async def test_list_organization_feature_flags(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("list_flag.json")) - page = await async_workos.feature_flags.list_organization_feature_flags( - "test_organizationId" - ) + page = await async_workos.feature_flags.list_organization_feature_flags("test_organizationId") assert isinstance(page, AsyncPage) assert len(page.data) == 1 assert isinstance(page.data[0], Flag) @pytest.mark.asyncio - async def test_list_organization_feature_flags_empty_page( - self, async_workos, httpx_mock - ): + async def test_list_organization_feature_flags_empty_page(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - page = await async_workos.feature_flags.list_organization_feature_flags( - "test_organizationId" - ) + page = await async_workos.feature_flags.list_organization_feature_flags("test_organizationId") assert isinstance(page, AsyncPage) assert page.data == [] @pytest.mark.asyncio - async def test_list_organization_feature_flags_encodes_query_params( - self, async_workos, httpx_mock - ): + async def test_list_organization_feature_flags_encodes_query_params(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - await async_workos.feature_flags.list_organization_feature_flags( - "test_organizationId", - limit=10, - before="cursor before", - after="cursor/after", - order=OrganizationsFeatureFlagsOrder("normal"), - ) + await async_workos.feature_flags.list_organization_feature_flags("test_organizationId", limit=10, before="cursor before", after="cursor/after", order=OrganizationsFeatureFlagsOrder("normal")) request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -394,17 +314,9 @@ async def test_list_user_feature_flags_empty_page(self, async_workos, httpx_mock assert page.data == [] @pytest.mark.asyncio - async def test_list_user_feature_flags_encodes_query_params( - self, async_workos, httpx_mock - ): + async def test_list_user_feature_flags_encodes_query_params(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - await async_workos.feature_flags.list_user_feature_flags( - "test_userId", - limit=10, - before="cursor before", - after="cursor/after", - order=UserManagementUsersFeatureFlagsOrder("normal"), - ) + await async_workos.feature_flags.list_user_feature_flags("test_userId", limit=10, before="cursor before", after="cursor/after", order=UserManagementUsersFeatureFlagsOrder("normal")) request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -412,13 +324,9 @@ async def test_list_user_feature_flags_encodes_query_params( assert request.url.params["order"] == "normal" @pytest.mark.asyncio - async def test_list_feature_flags_with_request_options( - self, async_workos, httpx_mock - ): + async def test_list_feature_flags_with_request_options(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - await async_workos.feature_flags.list_feature_flags( - request_options={"extra_headers": {"X-Custom": "value"}} - ) + await async_workos.feature_flags.list_feature_flags(request_options={"extra_headers": {"X-Custom": "value"}}) request = httpx_mock.get_request() assert request.headers["X-Custom"] == "value" @@ -430,9 +338,7 @@ async def test_list_feature_flags_unauthorized(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_list_feature_flags_not_found(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=404, json={"message": "Not found"}) with pytest.raises(NotFoundError): @@ -442,15 +348,9 @@ async def test_list_feature_flags_not_found(self, httpx_mock): @pytest.mark.asyncio async def test_list_feature_flags_rate_limited(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: - httpx_mock.add_response( - status_code=429, - headers={"Retry-After": "0"}, - json={"message": "Slow down"}, - ) + httpx_mock.add_response(status_code=429, headers={"Retry-After": "0"}, json={"message": "Slow down"}) with pytest.raises(RateLimitExceededError): await workos.feature_flags.list_feature_flags() finally: @@ -458,9 +358,7 @@ async def test_list_feature_flags_rate_limited(self, httpx_mock): @pytest.mark.asyncio async def test_list_feature_flags_server_error(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=500, json={"message": "Server error"}) with pytest.raises(ServerError): @@ -470,9 +368,7 @@ async def test_list_feature_flags_server_error(self, httpx_mock): @pytest.mark.asyncio async def test_list_feature_flags_bad_request(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) with pytest.raises(BadRequestError): @@ -482,9 +378,7 @@ async def test_list_feature_flags_bad_request(self, httpx_mock): @pytest.mark.asyncio async def test_list_feature_flags_unprocessable(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) with pytest.raises(UnprocessableEntityError): diff --git a/tests/test_groups.py b/tests/test_groups.py new file mode 100644 index 00000000..d664fd60 --- /dev/null +++ b/tests/test_groups.py @@ -0,0 +1,368 @@ +# This file is auto-generated by oagen. Do not edit. + +import json + +import pytest +from workos import WorkOSClient, AsyncWorkOSClient +from tests.generated_helpers import load_fixture + +from workos.authorization.models import UserOrganizationMembershipBaseListData +from workos.groups.models import Group, GroupsOrder +from workos._pagination import AsyncPage, SyncPage +from workos._errors import AuthenticationError, BadRequestError, NotFoundError, RateLimitExceededError, ServerError, UnprocessableEntityError + + +class TestGroups: + + def test_list_organization_groups(self, workos, httpx_mock): + httpx_mock.add_response( + json=load_fixture("list_group.json"), + ) + page = workos.groups.list_organization_groups("test_organizationId") + assert isinstance(page, SyncPage) + assert len(page.data) == 1 + assert isinstance(page.data[0], Group) + + def test_list_organization_groups_empty_page(self, workos, httpx_mock): + httpx_mock.add_response(json={"data": [], "list_metadata": {}}) + page = workos.groups.list_organization_groups("test_organizationId") + assert isinstance(page, SyncPage) + assert page.data == [] + + def test_list_organization_groups_encodes_query_params(self, workos, httpx_mock): + httpx_mock.add_response(json={"data": [], "list_metadata": {}}) + workos.groups.list_organization_groups("test_organizationId", limit=10, before="cursor before", after="cursor/after", order=GroupsOrder("normal")) + request = httpx_mock.get_request() + assert request.url.params["limit"] == "10" + assert request.url.params["before"] == "cursor before" + assert request.url.params["after"] == "cursor/after" + assert request.url.params["order"] == "normal" + + def test_create_organization_group(self, workos, httpx_mock): + httpx_mock.add_response( + json=load_fixture("group.json"), + ) + result = workos.groups.create_organization_group("test_organizationId", name="test_name") + assert isinstance(result, Group) + assert result.object == "group" + assert result.id == "group_01HXYZ123456789ABCDEFGHIJ" + request = httpx_mock.get_request() + assert request.method == "POST" + assert request.url.path.endswith("/organizations/test_organizationId/groups") + body = json.loads(request.content) + assert body["name"] == "test_name" + + def test_get_organization_group(self, workos, httpx_mock): + httpx_mock.add_response( + json=load_fixture("group.json"), + ) + result = workos.groups.get_organization_group("test_organizationId", "test_groupId") + assert isinstance(result, Group) + assert result.object == "group" + assert result.id == "group_01HXYZ123456789ABCDEFGHIJ" + request = httpx_mock.get_request() + assert request.method == "GET" + assert request.url.path.endswith("/organizations/test_organizationId/groups/test_groupId") + + def test_update_organization_group(self, workos, httpx_mock): + httpx_mock.add_response( + json=load_fixture("group.json"), + ) + result = workos.groups.update_organization_group("test_organizationId", "test_groupId") + assert isinstance(result, Group) + assert result.object == "group" + assert result.id == "group_01HXYZ123456789ABCDEFGHIJ" + request = httpx_mock.get_request() + assert request.method == "PATCH" + assert request.url.path.endswith("/organizations/test_organizationId/groups/test_groupId") + + def test_delete_organization_group(self, workos, httpx_mock): + httpx_mock.add_response(status_code=204) + result = workos.groups.delete_organization_group("test_organizationId", "test_groupId") + assert result is None + request = httpx_mock.get_request() + assert request.method == "DELETE" + assert request.url.path.endswith("/organizations/test_organizationId/groups/test_groupId") + + def test_list_group_organization_memberships(self, workos, httpx_mock): + httpx_mock.add_response( + json=load_fixture("list_user_organization_membership_base_list_data.json"), + ) + page = workos.groups.list_group_organization_memberships("test_organizationId", "test_groupId") + assert isinstance(page, SyncPage) + assert len(page.data) == 1 + assert isinstance(page.data[0], UserOrganizationMembershipBaseListData) + + def test_list_group_organization_memberships_empty_page(self, workos, httpx_mock): + httpx_mock.add_response(json={"data": [], "list_metadata": {}}) + page = workos.groups.list_group_organization_memberships("test_organizationId", "test_groupId") + assert isinstance(page, SyncPage) + assert page.data == [] + + def test_list_group_organization_memberships_encodes_query_params(self, workos, httpx_mock): + httpx_mock.add_response(json={"data": [], "list_metadata": {}}) + workos.groups.list_group_organization_memberships("test_organizationId", "test_groupId", limit=10, before="cursor before", after="cursor/after", order=GroupsOrder("normal")) + request = httpx_mock.get_request() + assert request.url.params["limit"] == "10" + assert request.url.params["before"] == "cursor before" + assert request.url.params["after"] == "cursor/after" + assert request.url.params["order"] == "normal" + + def test_create_group_organization_membership(self, workos, httpx_mock): + httpx_mock.add_response( + json=load_fixture("group.json"), + ) + result = workos.groups.create_group_organization_membership("test_organizationId", "test_groupId", organization_membership_id="test_organization_membership_id") + assert isinstance(result, Group) + assert result.object == "group" + assert result.id == "group_01HXYZ123456789ABCDEFGHIJ" + request = httpx_mock.get_request() + assert request.method == "POST" + assert request.url.path.endswith("/organizations/test_organizationId/groups/test_groupId/organization-memberships") + body = json.loads(request.content) + assert body["organization_membership_id"] == "test_organization_membership_id" + + def test_delete_group_organization_membership(self, workos, httpx_mock): + httpx_mock.add_response(status_code=204) + result = workos.groups.delete_group_organization_membership("test_organizationId", "test_groupId", "test_omId") + assert result is None + request = httpx_mock.get_request() + assert request.method == "DELETE" + assert request.url.path.endswith("/organizations/test_organizationId/groups/test_groupId/organization-memberships/test_omId") + + def test_list_organization_groups_with_request_options(self, workos, httpx_mock): + httpx_mock.add_response(json={"data": [], "list_metadata": {}}) + workos.groups.list_organization_groups("test_organizationId", request_options={"extra_headers": {"X-Custom": "value"}}) + request = httpx_mock.get_request() + assert request.headers["X-Custom"] == "value" + + def test_list_organization_groups_unauthorized(self, workos, httpx_mock): + httpx_mock.add_response( + status_code=401, + json={"message": "Unauthorized"}, + ) + with pytest.raises(AuthenticationError): + workos.groups.list_organization_groups("test_organizationId") + + def test_list_organization_groups_not_found(self, httpx_mock): + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) + try: + httpx_mock.add_response(status_code=404, json={"message": "Not found"}) + with pytest.raises(NotFoundError): + workos.groups.list_organization_groups("test_organizationId") + finally: + workos.close() + + def test_list_organization_groups_rate_limited(self, httpx_mock): + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) + try: + httpx_mock.add_response(status_code=429, headers={"Retry-After": "0"}, json={"message": "Slow down"}) + with pytest.raises(RateLimitExceededError): + workos.groups.list_organization_groups("test_organizationId") + finally: + workos.close() + + def test_list_organization_groups_server_error(self, httpx_mock): + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) + try: + httpx_mock.add_response(status_code=500, json={"message": "Server error"}) + with pytest.raises(ServerError): + workos.groups.list_organization_groups("test_organizationId") + finally: + workos.close() + + def test_list_organization_groups_bad_request(self, httpx_mock): + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) + try: + httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) + with pytest.raises(BadRequestError): + workos.groups.list_organization_groups("test_organizationId") + finally: + workos.close() + + def test_list_organization_groups_unprocessable(self, httpx_mock): + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) + try: + httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) + with pytest.raises(UnprocessableEntityError): + workos.groups.list_organization_groups("test_organizationId") + finally: + workos.close() + + +class TestAsyncGroups: + + @pytest.mark.asyncio + async def test_list_organization_groups(self, async_workos, httpx_mock): + httpx_mock.add_response(json=load_fixture("list_group.json")) + page = await async_workos.groups.list_organization_groups("test_organizationId") + assert isinstance(page, AsyncPage) + assert len(page.data) == 1 + assert isinstance(page.data[0], Group) + + @pytest.mark.asyncio + async def test_list_organization_groups_empty_page(self, async_workos, httpx_mock): + httpx_mock.add_response(json={"data": [], "list_metadata": {}}) + page = await async_workos.groups.list_organization_groups("test_organizationId") + assert isinstance(page, AsyncPage) + assert page.data == [] + + @pytest.mark.asyncio + async def test_list_organization_groups_encodes_query_params(self, async_workos, httpx_mock): + httpx_mock.add_response(json={"data": [], "list_metadata": {}}) + await async_workos.groups.list_organization_groups("test_organizationId", limit=10, before="cursor before", after="cursor/after", order=GroupsOrder("normal")) + request = httpx_mock.get_request() + assert request.url.params["limit"] == "10" + assert request.url.params["before"] == "cursor before" + assert request.url.params["after"] == "cursor/after" + assert request.url.params["order"] == "normal" + + @pytest.mark.asyncio + async def test_create_organization_group(self, async_workos, httpx_mock): + httpx_mock.add_response(json=load_fixture("group.json")) + result = await async_workos.groups.create_organization_group("test_organizationId", name="test_name") + assert isinstance(result, Group) + assert result.object == "group" + assert result.id == "group_01HXYZ123456789ABCDEFGHIJ" + request = httpx_mock.get_request() + assert request.method == "POST" + assert request.url.path.endswith("/organizations/test_organizationId/groups") + + @pytest.mark.asyncio + async def test_get_organization_group(self, async_workos, httpx_mock): + httpx_mock.add_response(json=load_fixture("group.json")) + result = await async_workos.groups.get_organization_group("test_organizationId", "test_groupId") + assert isinstance(result, Group) + assert result.object == "group" + assert result.id == "group_01HXYZ123456789ABCDEFGHIJ" + request = httpx_mock.get_request() + assert request.method == "GET" + assert request.url.path.endswith("/organizations/test_organizationId/groups/test_groupId") + + @pytest.mark.asyncio + async def test_update_organization_group(self, async_workos, httpx_mock): + httpx_mock.add_response(json=load_fixture("group.json")) + result = await async_workos.groups.update_organization_group("test_organizationId", "test_groupId") + assert isinstance(result, Group) + assert result.object == "group" + assert result.id == "group_01HXYZ123456789ABCDEFGHIJ" + request = httpx_mock.get_request() + assert request.method == "PATCH" + assert request.url.path.endswith("/organizations/test_organizationId/groups/test_groupId") + + @pytest.mark.asyncio + async def test_delete_organization_group(self, async_workos, httpx_mock): + httpx_mock.add_response(status_code=204) + result = await async_workos.groups.delete_organization_group("test_organizationId", "test_groupId") + assert result is None + request = httpx_mock.get_request() + assert request.method == "DELETE" + assert request.url.path.endswith("/organizations/test_organizationId/groups/test_groupId") + + @pytest.mark.asyncio + async def test_list_group_organization_memberships(self, async_workos, httpx_mock): + httpx_mock.add_response(json=load_fixture("list_user_organization_membership_base_list_data.json")) + page = await async_workos.groups.list_group_organization_memberships("test_organizationId", "test_groupId") + assert isinstance(page, AsyncPage) + assert len(page.data) == 1 + assert isinstance(page.data[0], UserOrganizationMembershipBaseListData) + + @pytest.mark.asyncio + async def test_list_group_organization_memberships_empty_page(self, async_workos, httpx_mock): + httpx_mock.add_response(json={"data": [], "list_metadata": {}}) + page = await async_workos.groups.list_group_organization_memberships("test_organizationId", "test_groupId") + assert isinstance(page, AsyncPage) + assert page.data == [] + + @pytest.mark.asyncio + async def test_list_group_organization_memberships_encodes_query_params(self, async_workos, httpx_mock): + httpx_mock.add_response(json={"data": [], "list_metadata": {}}) + await async_workos.groups.list_group_organization_memberships("test_organizationId", "test_groupId", limit=10, before="cursor before", after="cursor/after", order=GroupsOrder("normal")) + request = httpx_mock.get_request() + assert request.url.params["limit"] == "10" + assert request.url.params["before"] == "cursor before" + assert request.url.params["after"] == "cursor/after" + assert request.url.params["order"] == "normal" + + @pytest.mark.asyncio + async def test_create_group_organization_membership(self, async_workos, httpx_mock): + httpx_mock.add_response(json=load_fixture("group.json")) + result = await async_workos.groups.create_group_organization_membership("test_organizationId", "test_groupId", organization_membership_id="test_organization_membership_id") + assert isinstance(result, Group) + assert result.object == "group" + assert result.id == "group_01HXYZ123456789ABCDEFGHIJ" + request = httpx_mock.get_request() + assert request.method == "POST" + assert request.url.path.endswith("/organizations/test_organizationId/groups/test_groupId/organization-memberships") + + @pytest.mark.asyncio + async def test_delete_group_organization_membership(self, async_workos, httpx_mock): + httpx_mock.add_response(status_code=204) + result = await async_workos.groups.delete_group_organization_membership("test_organizationId", "test_groupId", "test_omId") + assert result is None + request = httpx_mock.get_request() + assert request.method == "DELETE" + assert request.url.path.endswith("/organizations/test_organizationId/groups/test_groupId/organization-memberships/test_omId") + + @pytest.mark.asyncio + async def test_list_organization_groups_with_request_options(self, async_workos, httpx_mock): + httpx_mock.add_response(json={"data": [], "list_metadata": {}}) + await async_workos.groups.list_organization_groups("test_organizationId", request_options={"extra_headers": {"X-Custom": "value"}}) + request = httpx_mock.get_request() + assert request.headers["X-Custom"] == "value" + + @pytest.mark.asyncio + async def test_list_organization_groups_unauthorized(self, async_workos, httpx_mock): + httpx_mock.add_response(status_code=401, json={"message": "Unauthorized"}) + with pytest.raises(AuthenticationError): + await async_workos.groups.list_organization_groups("test_organizationId") + + @pytest.mark.asyncio + async def test_list_organization_groups_not_found(self, httpx_mock): + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) + try: + httpx_mock.add_response(status_code=404, json={"message": "Not found"}) + with pytest.raises(NotFoundError): + await workos.groups.list_organization_groups("test_organizationId") + finally: + await workos.close() + + @pytest.mark.asyncio + async def test_list_organization_groups_rate_limited(self, httpx_mock): + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) + try: + httpx_mock.add_response(status_code=429, headers={"Retry-After": "0"}, json={"message": "Slow down"}) + with pytest.raises(RateLimitExceededError): + await workos.groups.list_organization_groups("test_organizationId") + finally: + await workos.close() + + @pytest.mark.asyncio + async def test_list_organization_groups_server_error(self, httpx_mock): + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) + try: + httpx_mock.add_response(status_code=500, json={"message": "Server error"}) + with pytest.raises(ServerError): + await workos.groups.list_organization_groups("test_organizationId") + finally: + await workos.close() + + @pytest.mark.asyncio + async def test_list_organization_groups_bad_request(self, httpx_mock): + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) + try: + httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) + with pytest.raises(BadRequestError): + await workos.groups.list_organization_groups("test_organizationId") + finally: + await workos.close() + + @pytest.mark.asyncio + async def test_list_organization_groups_unprocessable(self, httpx_mock): + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) + try: + httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) + with pytest.raises(UnprocessableEntityError): + await workos.groups.list_organization_groups("test_organizationId") + finally: + await workos.close() diff --git a/tests/test_models_round_trip.py b/tests/test_models_round_trip.py index 8ee7ba69..0bd7b2c7 100644 --- a/tests/test_models_round_trip.py +++ b/tests/test_models_round_trip.py @@ -6,371 +6,29 @@ from tests.generated_helpers import load_fixture -from workos.admin_portal.models import ( - IntentOptions, - PortalLinkResponse, - SSOIntentOptions, -) -from workos.api_keys.models import ( - ApiKey, - ApiKeyOwner, - ApiKeyValidationResponse, - ApiKeyWithValue, - ApiKeyWithValueOwner, -) -from workos.audit_logs.models import ( - AuditLogActionJson, - AuditLogEvent, - AuditLogEventActor, - AuditLogEventContext, - AuditLogEventCreateResponse, - AuditLogEventTarget, - AuditLogExportJson, - AuditLogSchemaActor, - AuditLogSchemaJson, - AuditLogSchemaJsonActor, - AuditLogSchemaJsonTarget, - AuditLogSchemaTarget, -) -from workos.authorization.models import ( - AuthorizationCheck, - AuthorizationPermission, - AuthorizationResource, - Permission, - Role, - RoleAssignment, - RoleAssignmentResource, - RoleList, - SlimRole, - UserOrganizationMembershipBaseListData, -) -from workos.common.models import ( - ActionAuthenticationDenied, - ActionAuthenticationDeniedData, - ActionUserRegistrationDenied, - ActionUserRegistrationDeniedData, - ApiKeyCreated, - ApiKeyCreatedData, - ApiKeyCreatedDataOwner, - ApiKeyRevoked, - ApiKeyRevokedData, - ApiKeyRevokedDataOwner, - AuthenticationEmailVerificationFailed, - AuthenticationEmailVerificationFailedData, - AuthenticationEmailVerificationFailedDataError, - AuthenticationEmailVerificationSucceeded, - AuthenticationEmailVerificationSucceededData, - AuthenticationMFAFailed, - AuthenticationMFAFailedData, - AuthenticationMFAFailedDataError, - AuthenticationMFASucceeded, - AuthenticationMFASucceededData, - AuthenticationMagicAuthFailed, - AuthenticationMagicAuthFailedData, - AuthenticationMagicAuthFailedDataError, - AuthenticationMagicAuthSucceeded, - AuthenticationMagicAuthSucceededData, - AuthenticationOAuthFailed, - AuthenticationOAuthFailedData, - AuthenticationOAuthFailedDataError, - AuthenticationOAuthSucceeded, - AuthenticationOAuthSucceededData, - AuthenticationPasskeyFailed, - AuthenticationPasskeyFailedData, - AuthenticationPasskeyFailedDataError, - AuthenticationPasskeySucceeded, - AuthenticationPasskeySucceededData, - AuthenticationPasswordFailed, - AuthenticationPasswordFailedData, - AuthenticationPasswordFailedDataError, - AuthenticationPasswordSucceeded, - AuthenticationPasswordSucceededData, - AuthenticationRadarRiskDetected, - AuthenticationRadarRiskDetectedData, - AuthenticationSSOFailed, - AuthenticationSSOFailedData, - AuthenticationSSOFailedDataError, - AuthenticationSSOFailedDataSSO, - AuthenticationSSOStarted, - AuthenticationSSOStartedData, - AuthenticationSSOStartedDataSSO, - AuthenticationSSOSucceeded, - AuthenticationSSOSucceededData, - AuthenticationSSOSucceededDataSSO, - AuthenticationSSOTimedOut, - AuthenticationSSOTimedOutData, - AuthenticationSSOTimedOutDataError, - AuthenticationSSOTimedOutDataSSO, - ConnectionActivated, - ConnectionActivatedData, - ConnectionActivatedDataDomain, - ConnectionDeactivated, - ConnectionDeactivatedData, - ConnectionDeactivatedDataDomain, - ConnectionDeleted, - ConnectionDeletedData, - ConnectionSAMLCertificateRenewalRequired, - ConnectionSAMLCertificateRenewalRequiredData, - ConnectionSAMLCertificateRenewalRequiredDataCertificate, - ConnectionSAMLCertificateRenewalRequiredDataConnection, - ConnectionSAMLCertificateRenewed, - ConnectionSAMLCertificateRenewedData, - ConnectionSAMLCertificateRenewedDataCertificate, - ConnectionSAMLCertificateRenewedDataConnection, - DirectoryUser, - DirectoryUserEmail, - DsyncActivated, - DsyncActivatedData, - DsyncActivatedDataDomain, - DsyncDeactivated, - DsyncDeactivatedData, - DsyncDeactivatedDataDomain, - DsyncDeleted, - DsyncDeletedData, - DsyncGroupCreated, - DsyncGroupDeleted, - DsyncGroupUpdated, - DsyncGroupUpdatedData, - DsyncGroupUserAdded, - DsyncGroupUserAddedData, - DsyncGroupUserRemoved, - DsyncGroupUserRemovedData, - DsyncUserCreated, - DsyncUserDeleted, - DsyncUserUpdated, - DsyncUserUpdatedData, - DsyncUserUpdatedDataEmail, - EmailVerificationCreated, - EmailVerificationCreatedData, - EventContext, - EventContextActor, - EventContextGoogleAnalyticsSession, - FlagCreated, - FlagCreatedContext, - FlagCreatedContextActor, - FlagCreatedData, - FlagCreatedDataOwner, - FlagDeleted, - FlagDeletedContext, - FlagDeletedContextActor, - FlagDeletedData, - FlagDeletedDataOwner, - FlagRuleUpdated, - FlagRuleUpdatedContext, - FlagRuleUpdatedContextActor, - FlagRuleUpdatedContextConfiguredTarget, - FlagRuleUpdatedContextConfiguredTargetOrganization, - FlagRuleUpdatedContextConfiguredTargetUser, - FlagRuleUpdatedContextPreviousAttribute, - FlagRuleUpdatedContextPreviousAttributeContext, - FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget, - FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetOrganization, - FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetUser, - FlagRuleUpdatedContextPreviousAttributeData, - FlagRuleUpdatedData, - FlagRuleUpdatedDataOwner, - FlagUpdated, - FlagUpdatedContext, - FlagUpdatedContextActor, - FlagUpdatedContextPreviousAttribute, - FlagUpdatedContextPreviousAttributeData, - FlagUpdatedData, - FlagUpdatedDataOwner, - Group, - GroupCreated, - GroupDeleted, - GroupMemberAdded, - GroupMemberAddedData, - GroupMemberRemoved, - GroupMemberRemovedData, - GroupUpdated, - InvitationAccepted, - InvitationAcceptedData, - InvitationCreated, - InvitationCreatedData, - InvitationResent, - InvitationResentData, - InvitationRevoked, - InvitationRevokedData, - MagicAuthCreated, - MagicAuthCreatedData, - OrganizationCreated, - OrganizationCreatedData, - OrganizationCreatedDataDomain, - OrganizationDeleted, - OrganizationDeletedData, - OrganizationDeletedDataDomain, - OrganizationDomainCreated, - OrganizationDomainCreatedData, - OrganizationDomainDeleted, - OrganizationDomainDeletedData, - OrganizationDomainUpdated, - OrganizationDomainUpdatedData, - OrganizationDomainVerificationFailed, - OrganizationDomainVerificationFailedData, - OrganizationDomainVerificationFailedDataOrganizationDomain, - OrganizationDomainVerified, - OrganizationDomainVerifiedData, - OrganizationMembershipCreated, - OrganizationMembershipCreatedData, - OrganizationMembershipDeleted, - OrganizationMembershipDeletedData, - OrganizationMembershipUpdated, - OrganizationMembershipUpdatedData, - OrganizationRoleCreated, - OrganizationRoleCreatedData, - OrganizationRoleDeleted, - OrganizationRoleDeletedData, - OrganizationRoleUpdated, - OrganizationRoleUpdatedData, - OrganizationUpdated, - OrganizationUpdatedData, - OrganizationUpdatedDataDomain, - PasswordResetCreated, - PasswordResetCreatedData, - PasswordResetSucceeded, - PasswordResetSucceededData, - PermissionCreated, - PermissionCreatedData, - PermissionDeleted, - PermissionDeletedData, - PermissionUpdated, - PermissionUpdatedData, - RoleCreated, - RoleCreatedData, - RoleDeleted, - RoleDeletedData, - RoleUpdated, - RoleUpdatedData, - SessionCreated, - SessionCreatedData, - SessionCreatedDataImpersonator, - SessionRevoked, - SessionRevokedData, - SessionRevokedDataImpersonator, - UserCreated, - UserDeleted, - UserUpdated, - VaultByokKeyVerificationCompleted, - VaultByokKeyVerificationCompletedData, - VaultDataCreated, - VaultDataCreatedData, - VaultDataDeleted, - VaultDataDeletedData, - VaultDataRead, - VaultDataReadData, - VaultDataUpdated, - VaultDataUpdatedData, - VaultDekDecrypted, - VaultDekDecryptedData, - VaultDekRead, - VaultDekReadData, - VaultKekCreated, - VaultKekCreatedData, - VaultMetadataRead, - VaultMetadataReadData, - VaultNamesListed, - VaultNamesListedData, -) -from workos.connect.models import ( - ApplicationCredentialsListItem, - ConnectApplication, - ExternalAuthCompleteResponse, - NewConnectApplicationSecret, - RedirectUriInput, - UserConsentOption, - UserConsentOptionChoice, - UserObject, -) -from workos.directory_sync.models import ( - Directory, - DirectoryGroup, - DirectoryMetadata, - DirectoryMetadataUser, - DirectoryUserWithGroups, - DirectoryUserWithGroupsEmail, -) +from workos.admin_portal.models import DomainVerificationIntentOptions, IntentOptions, PortalLinkResponse, SSOIntentOptions +from workos.api_keys.models import ApiKey, ApiKeyOwner, ApiKeyValidationResponse, ApiKeyWithValue, ApiKeyWithValueOwner +from workos.audit_logs.models import AuditLogActionJson, AuditLogEvent, AuditLogEventActor, AuditLogEventContext, AuditLogEventCreateResponse, AuditLogEventTarget, AuditLogExportJson, AuditLogSchemaActor, AuditLogSchemaJson, AuditLogSchemaJsonActor, AuditLogSchemaJsonTarget, AuditLogSchemaTarget +from workos.authorization.models import AuthorizationCheck, AuthorizationPermission, AuthorizationResource, Permission, Role, RoleAssignment, RoleAssignmentResource, RoleList, SlimRole, UserOrganizationMembershipBaseListData +from workos.common.models import ActionAuthenticationDenied, ActionAuthenticationDeniedData, ActionUserRegistrationDenied, ActionUserRegistrationDeniedData, ApiKeyCreated, ApiKeyCreatedData, ApiKeyCreatedDataOwner, ApiKeyRevoked, ApiKeyRevokedData, ApiKeyRevokedDataOwner, AuthenticationEmailVerificationFailed, AuthenticationEmailVerificationFailedData, AuthenticationEmailVerificationFailedDataError, AuthenticationEmailVerificationSucceeded, AuthenticationEmailVerificationSucceededData, AuthenticationMFAFailed, AuthenticationMFAFailedData, AuthenticationMFAFailedDataError, AuthenticationMFASucceeded, AuthenticationMFASucceededData, AuthenticationMagicAuthFailed, AuthenticationMagicAuthFailedData, AuthenticationMagicAuthFailedDataError, AuthenticationMagicAuthSucceeded, AuthenticationMagicAuthSucceededData, AuthenticationOAuthFailed, AuthenticationOAuthFailedData, AuthenticationOAuthFailedDataError, AuthenticationOAuthSucceeded, AuthenticationOAuthSucceededData, AuthenticationPasskeyFailed, AuthenticationPasskeyFailedData, AuthenticationPasskeyFailedDataError, AuthenticationPasskeySucceeded, AuthenticationPasskeySucceededData, AuthenticationPasswordFailed, AuthenticationPasswordFailedData, AuthenticationPasswordFailedDataError, AuthenticationPasswordSucceeded, AuthenticationPasswordSucceededData, AuthenticationRadarRiskDetected, AuthenticationRadarRiskDetectedData, AuthenticationSSOFailed, AuthenticationSSOFailedData, AuthenticationSSOFailedDataError, AuthenticationSSOFailedDataSSO, AuthenticationSSOStarted, AuthenticationSSOStartedData, AuthenticationSSOStartedDataSSO, AuthenticationSSOSucceeded, AuthenticationSSOSucceededData, AuthenticationSSOSucceededDataSSO, AuthenticationSSOTimedOut, AuthenticationSSOTimedOutData, AuthenticationSSOTimedOutDataError, AuthenticationSSOTimedOutDataSSO, ConnectionActivated, ConnectionActivatedData, ConnectionActivatedDataDomain, ConnectionDeactivated, ConnectionDeactivatedData, ConnectionDeactivatedDataDomain, ConnectionDeleted, ConnectionDeletedData, ConnectionSAMLCertificateRenewalRequired, ConnectionSAMLCertificateRenewalRequiredData, ConnectionSAMLCertificateRenewalRequiredDataCertificate, ConnectionSAMLCertificateRenewalRequiredDataConnection, ConnectionSAMLCertificateRenewed, ConnectionSAMLCertificateRenewedData, ConnectionSAMLCertificateRenewedDataCertificate, ConnectionSAMLCertificateRenewedDataConnection, DirectoryUser, DirectoryUserEmail, DsyncActivated, DsyncActivatedData, DsyncActivatedDataDomain, DsyncDeactivated, DsyncDeactivatedData, DsyncDeactivatedDataDomain, DsyncDeleted, DsyncDeletedData, DsyncGroupCreated, DsyncGroupDeleted, DsyncGroupUpdated, DsyncGroupUpdatedData, DsyncGroupUserAdded, DsyncGroupUserAddedData, DsyncGroupUserRemoved, DsyncGroupUserRemovedData, DsyncUserCreated, DsyncUserDeleted, DsyncUserUpdated, DsyncUserUpdatedData, DsyncUserUpdatedDataEmail, EmailVerificationCreated, EmailVerificationCreatedData, EventContext, EventContextActor, EventContextGoogleAnalyticsSession, FlagCreated, FlagCreatedContext, FlagCreatedContextActor, FlagCreatedData, FlagCreatedDataOwner, FlagDeleted, FlagDeletedContext, FlagDeletedContextActor, FlagDeletedData, FlagDeletedDataOwner, FlagRuleUpdated, FlagRuleUpdatedContext, FlagRuleUpdatedContextActor, FlagRuleUpdatedContextConfiguredTarget, FlagRuleUpdatedContextConfiguredTargetOrganization, FlagRuleUpdatedContextConfiguredTargetUser, FlagRuleUpdatedContextPreviousAttribute, FlagRuleUpdatedContextPreviousAttributeContext, FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget, FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetOrganization, FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetUser, FlagRuleUpdatedContextPreviousAttributeData, FlagRuleUpdatedData, FlagRuleUpdatedDataOwner, FlagUpdated, FlagUpdatedContext, FlagUpdatedContextActor, FlagUpdatedContextPreviousAttribute, FlagUpdatedContextPreviousAttributeData, FlagUpdatedData, FlagUpdatedDataOwner, GroupCreated, GroupDeleted, GroupMemberAdded, GroupMemberAddedData, GroupMemberRemoved, GroupMemberRemovedData, GroupUpdated, InvitationAccepted, InvitationAcceptedData, InvitationCreated, InvitationCreatedData, InvitationResent, InvitationResentData, InvitationRevoked, InvitationRevokedData, MagicAuthCreated, MagicAuthCreatedData, OrganizationCreated, OrganizationCreatedData, OrganizationCreatedDataDomain, OrganizationDeleted, OrganizationDeletedData, OrganizationDeletedDataDomain, OrganizationDomainCreated, OrganizationDomainCreatedData, OrganizationDomainDeleted, OrganizationDomainDeletedData, OrganizationDomainUpdated, OrganizationDomainUpdatedData, OrganizationDomainVerificationFailed, OrganizationDomainVerificationFailedData, OrganizationDomainVerificationFailedDataOrganizationDomain, OrganizationDomainVerified, OrganizationDomainVerifiedData, OrganizationMembershipCreated, OrganizationMembershipCreatedData, OrganizationMembershipDeleted, OrganizationMembershipDeletedData, OrganizationMembershipUpdated, OrganizationMembershipUpdatedData, OrganizationRoleCreated, OrganizationRoleCreatedData, OrganizationRoleDeleted, OrganizationRoleDeletedData, OrganizationRoleUpdated, OrganizationRoleUpdatedData, OrganizationUpdated, OrganizationUpdatedData, OrganizationUpdatedDataDomain, PasswordResetCreated, PasswordResetCreatedData, PasswordResetSucceeded, PasswordResetSucceededData, PermissionCreated, PermissionCreatedData, PermissionDeleted, PermissionDeletedData, PermissionUpdated, PermissionUpdatedData, RoleCreated, RoleCreatedData, RoleDeleted, RoleDeletedData, RoleUpdated, RoleUpdatedData, SessionCreated, SessionCreatedData, SessionCreatedDataImpersonator, SessionRevoked, SessionRevokedData, SessionRevokedDataImpersonator, UserCreated, UserDeleted, UserUpdated, VaultByokKeyVerificationCompleted, VaultByokKeyVerificationCompletedData, VaultDataCreated, VaultDataCreatedData, VaultDataDeleted, VaultDataDeletedData, VaultDataRead, VaultDataReadData, VaultDataUpdated, VaultDataUpdatedData, VaultDekDecrypted, VaultDekDecryptedData, VaultDekRead, VaultDekReadData, VaultKekCreated, VaultKekCreatedData, VaultMetadataRead, VaultMetadataReadData, VaultNamesListed, VaultNamesListedData, WaitlistUser, WaitlistUserApproved, WaitlistUserCreated, WaitlistUserDenied +from workos.connect.models import ApplicationCredentialsListItem, ConnectApplication, ExternalAuthCompleteResponse, NewConnectApplicationSecret, RedirectUriInput, UserConsentOption, UserConsentOptionChoice, UserObject +from workos.directory_sync.models import Directory, DirectoryGroup, DirectoryMetadata, DirectoryMetadataUser, DirectoryUserWithGroups, DirectoryUserWithGroupsEmail from workos.events.models import EventListListMetadata, EventSchema, EventSchemaUnknown from workos.feature_flags.models import FeatureFlag, FeatureFlagOwner, Flag, FlagOwner -from workos.multi_factor_auth.models import ( - AuthenticationChallenge, - AuthenticationChallengeVerifyResponse, - AuthenticationFactor, - AuthenticationFactorEnrolled, - AuthenticationFactorEnrolledSms, - AuthenticationFactorEnrolledTotp, - AuthenticationFactorSms, - AuthenticationFactorTotp, - UserAuthenticationFactorEnrollResponse, -) -from workos.organization_domains.models import ( - OrganizationDomain, - OrganizationDomainStandAlone, -) -from workos.organizations.models import ( - AuditLogConfiguration, - AuditLogConfigurationLogStream, - AuditLogsRetentionJson, - Organization, - OrganizationDomainData, -) -from workos.pipes.models import ( - ConnectedAccount, - DataIntegrationAccessTokenResponse, - DataIntegrationAccessTokenResponseAccessToken, - DataIntegrationAuthorizeUrlResponse, - DataIntegrationsListResponse, - DataIntegrationsListResponseData, - DataIntegrationsListResponseDataConnectedAccount, -) -from workos.radar.models import ( - RadarListEntryAlreadyPresentResponse, - RadarStandaloneResponse, -) -from workos.sso.models import ( - Connection, - ConnectionDomain, - ConnectionOption, - Profile, - SSOAuthorizeUrlResponse, - SSOLogoutAuthorizeResponse, - SSOTokenResponse, - SSOTokenResponseOAuthToken, -) -from workos.user_management.models import ( - AuthenticateResponse, - AuthenticateResponseImpersonator, - AuthenticateResponseOAuthToken, - AuthorizedConnectApplicationListData, - CORSOriginResponse, - DeviceAuthorizationResponse, - EmailChange, - EmailChangeConfirmation, - EmailChangeConfirmationUser, - EmailVerification, - Invitation, - JWTTemplateResponse, - JwksResponse, - JwksResponseKeys, - MagicAuth, - OrganizationMembership, - PasswordReset, - RedirectUri, - ResetPasswordResponse, - SendVerificationEmailResponse, - User, - UserIdentitiesGetItem, - UserInvite, - UserOrganizationMembership, - UserSessionsImpersonator, - UserSessionsListItem, - VerifyEmailResponse, -) +from workos.groups.models import Group +from workos.multi_factor_auth.models import AuthenticationChallenge, AuthenticationChallengeVerifyResponse, AuthenticationFactor, AuthenticationFactorEnrolled, AuthenticationFactorEnrolledSms, AuthenticationFactorEnrolledTotp, AuthenticationFactorSms, AuthenticationFactorTotp, UserAuthenticationFactorEnrollResponse +from workos.organization_domains.models import OrganizationDomain, OrganizationDomainStandAlone +from workos.organizations.models import AuditLogConfiguration, AuditLogConfigurationLogStream, AuditLogsRetentionJson, Organization, OrganizationDomainData +from workos.pipes.models import ConnectedAccount, DataIntegrationAccessTokenResponse, DataIntegrationAccessTokenResponseAccessToken, DataIntegrationAuthorizeUrlResponse, DataIntegrationsListResponse, DataIntegrationsListResponseData, DataIntegrationsListResponseDataConnectedAccount +from workos.radar.models import RadarListEntryAlreadyPresentResponse, RadarStandaloneResponse +from workos.sso.models import Connection, ConnectionDomain, ConnectionOption, Profile, SSOAuthorizeUrlResponse, SSOLogoutAuthorizeResponse, SSOTokenResponse, SSOTokenResponseOAuthToken +from workos.user_management.models import AuthenticateResponse, AuthenticateResponseImpersonator, AuthenticateResponseOAuthToken, AuthorizedConnectApplicationListData, CORSOriginResponse, DeviceAuthorizationResponse, EmailChange, EmailChangeConfirmation, EmailChangeConfirmationUser, EmailVerification, Invitation, JWTTemplateResponse, JwksResponse, JwksResponseKeys, MagicAuth, OrganizationMembership, PasswordReset, RedirectUri, ResetPasswordResponse, SendVerificationEmailResponse, User, UserIdentitiesGetItem, UserInvite, UserOrganizationMembership, UserSessionsImpersonator, UserSessionsListItem, VerifyEmailResponse from workos.webhooks.models import WebhookEndpointJson from workos.widgets.models import WidgetSessionTokenResponse class TestModelRoundTrip: + def test_user_object_round_trip(self): data = load_fixture("user_object.json") instance = UserObject.from_dict(data) @@ -403,14 +61,7 @@ def test_user_consent_option_round_trip(self): assert restored.to_dict() == serialized def test_user_consent_option_minimal_payload(self): - data = { - "claim": "tos_accepted", - "type": "enum", - "label": "Terms of Service", - "choices": [ - {"value": "accepted", "label": "I accept the Terms of Service"} - ], - } + data = {"claim": "tos_accepted", "type": "enum", "label": "Terms of Service", "choices": [{"value": "accepted", "label": "I accept the Terms of Service"}]} instance = UserConsentOption.from_dict(data) serialized = instance.to_dict() assert serialized["claim"] == data["claim"] @@ -511,28 +162,7 @@ def test_audit_log_event_round_trip(self): assert restored.to_dict() == serialized def test_audit_log_event_minimal_payload(self): - data = { - "action": "user.signed_in", - "occurred_at": "2026-02-02T16:35:39.317Z", - "actor": { - "id": "user_TF4C5938", - "type": "user", - "name": "Jon Smith", - "metadata": {"owner": "user_01GBTCQ2"}, - }, - "targets": [ - { - "id": "user_TF4C5938", - "type": "user", - "name": "Jon Smith", - "metadata": {"owner": "user_01GBTCQ2"}, - } - ], - "context": { - "location": "123.123.123.123", - "user_agent": "Chrome/104.0.0.0", - }, - } + data = {"action": "user.signed_in", "occurred_at": "2026-02-02T16:35:39.317Z", "actor": {"id": "user_TF4C5938", "type": "user", "name": "Jon Smith", "metadata": {"owner": "user_01GBTCQ2"}}, "targets": [{"id": "user_TF4C5938", "type": "user", "name": "Jon Smith", "metadata": {"owner": "user_01GBTCQ2"}}], "context": {"location": "123.123.123.123", "user_agent": "Chrome/104.0.0.0"}} instance = AuditLogEvent.from_dict(data) serialized = instance.to_dict() assert serialized["action"] == data["action"] @@ -542,28 +172,7 @@ def test_audit_log_event_minimal_payload(self): assert serialized["context"] == data["context"] def test_audit_log_event_omits_absent_optional_non_nullable_fields(self): - data = { - "action": "user.signed_in", - "occurred_at": "2026-02-02T16:35:39.317Z", - "actor": { - "id": "user_TF4C5938", - "type": "user", - "name": "Jon Smith", - "metadata": {"owner": "user_01GBTCQ2"}, - }, - "targets": [ - { - "id": "user_TF4C5938", - "type": "user", - "name": "Jon Smith", - "metadata": {"owner": "user_01GBTCQ2"}, - } - ], - "context": { - "location": "123.123.123.123", - "user_agent": "Chrome/104.0.0.0", - }, - } + data = {"action": "user.signed_in", "occurred_at": "2026-02-02T16:35:39.317Z", "actor": {"id": "user_TF4C5938", "type": "user", "name": "Jon Smith", "metadata": {"owner": "user_01GBTCQ2"}}, "targets": [{"id": "user_TF4C5938", "type": "user", "name": "Jon Smith", "metadata": {"owner": "user_01GBTCQ2"}}], "context": {"location": "123.123.123.123", "user_agent": "Chrome/104.0.0.0"}} instance = AuditLogEvent.from_dict(data) serialized = instance.to_dict() assert "metadata" not in serialized @@ -578,9 +187,7 @@ def test_audit_log_schema_actor_round_trip(self): assert restored.to_dict() == serialized def test_audit_log_schema_actor_minimal_payload(self): - data = { - "metadata": {"type": "object", "properties": {"role": {"type": "string"}}} - } + data = {"metadata": {"type": "object", "properties": {"role": {"type": "string"}}}} instance = AuditLogSchemaActor.from_dict(data) serialized = instance.to_dict() assert serialized["metadata"] == data["metadata"] @@ -621,10 +228,7 @@ def test_organization_domain_data_minimal_payload(self): assert serialized["state"] == data["state"] def test_organization_domain_data_round_trips_unknown_enum_values(self): - data = { - "domain": "foo-corp.com", - "state": "unexpected_organization_domain_data_state", - } + data = {"domain": "foo-corp.com", "state": "unexpected_organization_domain_data_state"} instance = OrganizationDomainData.from_dict(data) assert instance.to_dict() == data @@ -648,6 +252,25 @@ def test_sso_intent_options_omits_absent_optional_non_nullable_fields(self): assert "bookmark_slug" not in serialized assert "provider_type" not in serialized + def test_domain_verification_intent_options_round_trip(self): + data = load_fixture("domain_verification_intent_options.json") + instance = DomainVerificationIntentOptions.from_dict(data) + serialized = instance.to_dict() + assert serialized == data + restored = DomainVerificationIntentOptions.from_dict(serialized) + assert restored.to_dict() == serialized + + def test_domain_verification_intent_options_minimal_payload(self): + data = {} + instance = DomainVerificationIntentOptions.from_dict(data) + assert instance.to_dict() is not None + + def test_domain_verification_intent_options_omits_absent_optional_non_nullable_fields(self): + data = {} + instance = DomainVerificationIntentOptions.from_dict(data) + serialized = instance.to_dict() + assert "domain_name" not in serialized + def test_intent_options_round_trip(self): data = load_fixture("intent_options.json") instance = IntentOptions.from_dict(data) @@ -657,10 +280,16 @@ def test_intent_options_round_trip(self): assert restored.to_dict() == serialized def test_intent_options_minimal_payload(self): - data = {"sso": {"bookmark_slug": "chatgpt", "provider_type": "GoogleSAML"}} + data = {} + instance = IntentOptions.from_dict(data) + assert instance.to_dict() is not None + + def test_intent_options_omits_absent_optional_non_nullable_fields(self): + data = {} instance = IntentOptions.from_dict(data) serialized = instance.to_dict() - assert serialized["sso"] == data["sso"] + assert "sso" not in serialized + assert "domain_verification" not in serialized def test_external_auth_complete_response_round_trip(self): data = load_fixture("external_auth_complete_response.json") @@ -671,9 +300,7 @@ def test_external_auth_complete_response_round_trip(self): assert restored.to_dict() == serialized def test_external_auth_complete_response_minimal_payload(self): - data = { - "redirect_uri": "https://your-authkit-domain.workos.com/oauth/authorize/complete?state=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdGF0ZSI6InJhbmRvbV9zdGF0ZV9zdHJpbmciLCJpYXQiOjE3NDI2MDQ4NTN9.abc123def456ghi789" - } + data = {"redirect_uri": "https://your-authkit-domain.workos.com/oauth/authorize/complete?state=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdGF0ZSI6InJhbmRvbV9zdGF0ZV9zdHJpbmciLCJpYXQiOjE3NDI2MDQ4NTN9.abc123def456ghi789"} instance = ExternalAuthCompleteResponse.from_dict(data) serialized = instance.to_dict() assert serialized["redirect_uri"] == data["redirect_uri"] @@ -687,17 +314,7 @@ def test_api_key_round_trip(self): assert restored.to_dict() == serialized def test_api_key_minimal_payload(self): - data = { - "object": "api_key", - "id": "api_key_01EHZNVPK3SFK441A1RGBFSHRT", - "owner": {"type": "organization", "id": "org_01EHZNVPK3SFK441A1RGBFSHRT"}, - "name": "Production API Key", - "obfuscated_value": "sk_...3456", - "last_used_at": None, - "permissions": ["posts:read", "posts:write"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "api_key", "id": "api_key_01EHZNVPK3SFK441A1RGBFSHRT", "owner": {"type": "organization", "id": "org_01EHZNVPK3SFK441A1RGBFSHRT"}, "name": "Production API Key", "obfuscated_value": "sk_...3456", "last_used_at": None, "permissions": ["posts:read", "posts:write"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = ApiKey.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -711,17 +328,7 @@ def test_api_key_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_api_key_preserves_nullable_fields(self): - data = { - "object": "api_key", - "id": "api_key_01EHZNVPK3SFK441A1RGBFSHRT", - "owner": {"type": "organization", "id": "org_01EHZNVPK3SFK441A1RGBFSHRT"}, - "name": "Production API Key", - "obfuscated_value": "sk_...3456", - "last_used_at": None, - "permissions": ["posts:read", "posts:write"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "api_key", "id": "api_key_01EHZNVPK3SFK441A1RGBFSHRT", "owner": {"type": "organization", "id": "org_01EHZNVPK3SFK441A1RGBFSHRT"}, "name": "Production API Key", "obfuscated_value": "sk_...3456", "last_used_at": None, "permissions": ["posts:read", "posts:write"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = ApiKey.from_dict(data) serialized = instance.to_dict() assert serialized["last_used_at"] is None @@ -755,16 +362,7 @@ def test_connect_application_round_trip(self): assert restored.to_dict() == serialized def test_connect_application_minimal_payload(self): - data = { - "object": "connect_application", - "id": "conn_app_01HXYZ123456789ABCDEFGHIJ", - "client_id": "client_01HXYZ123456789ABCDEFGHIJ", - "description": None, - "name": "My Application", - "scopes": ["openid", "profile", "email"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "connect_application", "id": "conn_app_01HXYZ123456789ABCDEFGHIJ", "client_id": "client_01HXYZ123456789ABCDEFGHIJ", "description": None, "name": "My Application", "scopes": ["openid", "profile", "email"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = ConnectApplication.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -777,34 +375,14 @@ def test_connect_application_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_connect_application_omits_absent_optional_non_nullable_fields(self): - data = { - "object": "connect_application", - "id": "conn_app_01HXYZ123456789ABCDEFGHIJ", - "client_id": "client_01HXYZ123456789ABCDEFGHIJ", - "description": "An application for managing user access", - "name": "My Application", - "scopes": ["openid", "profile", "email"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "connect_application", "id": "conn_app_01HXYZ123456789ABCDEFGHIJ", "client_id": "client_01HXYZ123456789ABCDEFGHIJ", "description": "An application for managing user access", "name": "My Application", "scopes": ["openid", "profile", "email"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = ConnectApplication.from_dict(data) serialized = instance.to_dict() assert "application_type" not in serialized assert "organization_id" not in serialized def test_connect_application_preserves_nullable_fields(self): - data = { - "object": "connect_application", - "id": "conn_app_01HXYZ123456789ABCDEFGHIJ", - "client_id": "client_01HXYZ123456789ABCDEFGHIJ", - "description": None, - "name": "My Application", - "scopes": ["openid", "profile", "email"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "application_type": "m2m", - "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT", - } + data = {"object": "connect_application", "id": "conn_app_01HXYZ123456789ABCDEFGHIJ", "client_id": "client_01HXYZ123456789ABCDEFGHIJ", "description": None, "name": "My Application", "scopes": ["openid", "profile", "email"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "application_type": "m2m", "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT"} instance = ConnectApplication.from_dict(data) serialized = instance.to_dict() assert serialized["description"] is None @@ -818,15 +396,7 @@ def test_new_connect_application_secret_round_trip(self): assert restored.to_dict() == serialized def test_new_connect_application_secret_minimal_payload(self): - data = { - "object": "connect_application_secret", - "id": "secret_01J9Q2Z3X4Y5W6V7U8T9S0R1Q", - "secret_hint": "abc123", - "last_used_at": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "secret": "abc123def456ghi789jkl012mno345pqr678stu901vwx234yz", - } + data = {"object": "connect_application_secret", "id": "secret_01J9Q2Z3X4Y5W6V7U8T9S0R1Q", "secret_hint": "abc123", "last_used_at": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "secret": "abc123def456ghi789jkl012mno345pqr678stu901vwx234yz"} instance = NewConnectApplicationSecret.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -838,15 +408,7 @@ def test_new_connect_application_secret_minimal_payload(self): assert serialized["secret"] == data["secret"] def test_new_connect_application_secret_preserves_nullable_fields(self): - data = { - "object": "connect_application_secret", - "id": "secret_01J9Q2Z3X4Y5W6V7U8T9S0R1Q", - "secret_hint": "abc123", - "last_used_at": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "secret": "abc123def456ghi789jkl012mno345pqr678stu901vwx234yz", - } + data = {"object": "connect_application_secret", "id": "secret_01J9Q2Z3X4Y5W6V7U8T9S0R1Q", "secret_hint": "abc123", "last_used_at": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "secret": "abc123def456ghi789jkl012mno345pqr678stu901vwx234yz"} instance = NewConnectApplicationSecret.from_dict(data) serialized = instance.to_dict() assert serialized["last_used_at"] is None @@ -874,13 +436,7 @@ def test_audit_log_export_json_round_trip(self): assert restored.to_dict() == serialized def test_audit_log_export_json_minimal_payload(self): - data = { - "object": "audit_log_export", - "id": "audit_log_export_01GBZK5MP7TD1YCFQHFR22180V", - "state": "ready", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "audit_log_export", "id": "audit_log_export_01GBZK5MP7TD1YCFQHFR22180V", "state": "ready", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = AuditLogExportJson.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -890,27 +446,13 @@ def test_audit_log_export_json_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_audit_log_export_json_preserves_nullable_fields(self): - data = { - "object": "audit_log_export", - "id": "audit_log_export_01GBZK5MP7TD1YCFQHFR22180V", - "state": "ready", - "url": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "audit_log_export", "id": "audit_log_export_01GBZK5MP7TD1YCFQHFR22180V", "state": "ready", "url": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = AuditLogExportJson.from_dict(data) serialized = instance.to_dict() assert serialized["url"] is None def test_audit_log_export_json_round_trips_unknown_enum_values(self): - data = { - "object": "audit_log_export", - "id": "audit_log_export_01GBZK5MP7TD1YCFQHFR22180V", - "state": "unexpected_audit_log_export_json_state", - "url": "https://exports.audit-logs.com/audit-log-exports/export.csv", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "audit_log_export", "id": "audit_log_export_01GBZK5MP7TD1YCFQHFR22180V", "state": "unexpected_audit_log_export_json_state", "url": "https://exports.audit-logs.com/audit-log-exports/export.csv", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = AuditLogExportJson.from_dict(data) assert instance.to_dict() == data @@ -926,9 +468,7 @@ def test_audit_logs_retention_json_minimal_payload(self): data = {"retention_period_in_days": None} instance = AuditLogsRetentionJson.from_dict(data) serialized = instance.to_dict() - assert ( - serialized["retention_period_in_days"] == data["retention_period_in_days"] - ) + assert serialized["retention_period_in_days"] == data["retention_period_in_days"] def test_audit_logs_retention_json_preserves_nullable_fields(self): data = {"retention_period_in_days": None} @@ -945,20 +485,7 @@ def test_audit_log_schema_json_round_trip(self): assert restored.to_dict() == serialized def test_audit_log_schema_json_minimal_payload(self): - data = { - "object": "audit_log_schema", - "version": 1, - "targets": [ - { - "type": "invoice", - "metadata": { - "type": "object", - "properties": {"cost": {"type": "number"}}, - }, - } - ], - "created_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "audit_log_schema", "version": 1, "targets": [{"type": "invoice", "metadata": {"type": "object", "properties": {"cost": {"type": "number"}}}}], "created_at": "2026-01-15T12:00:00.000Z"} instance = AuditLogSchemaJson.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -967,20 +494,7 @@ def test_audit_log_schema_json_minimal_payload(self): assert serialized["created_at"] == data["created_at"] def test_audit_log_schema_json_omits_absent_optional_non_nullable_fields(self): - data = { - "object": "audit_log_schema", - "version": 1, - "targets": [ - { - "type": "invoice", - "metadata": { - "type": "object", - "properties": {"cost": {"type": "number"}}, - }, - } - ], - "created_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "audit_log_schema", "version": 1, "targets": [{"type": "invoice", "metadata": {"type": "object", "properties": {"cost": {"type": "number"}}}}], "created_at": "2026-01-15T12:00:00.000Z"} instance = AuditLogSchemaJson.from_dict(data) serialized = instance.to_dict() assert "actor" not in serialized @@ -995,36 +509,7 @@ def test_audit_log_action_json_round_trip(self): assert restored.to_dict() == serialized def test_audit_log_action_json_minimal_payload(self): - data = { - "object": "audit_log_action", - "name": "user.viewed_invoice", - "schema": { - "object": "audit_log_schema", - "version": 1, - "actor": { - "metadata": { - "type": "object", - "properties": {"role": {"type": "string"}}, - } - }, - "targets": [ - { - "type": "invoice", - "metadata": { - "type": "object", - "properties": {"cost": {"type": "number"}}, - }, - } - ], - "metadata": { - "type": "object", - "properties": {"transactionId": {"type": "string"}}, - }, - "created_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "audit_log_action", "name": "user.viewed_invoice", "schema": {"object": "audit_log_schema", "version": 1, "actor": {"metadata": {"type": "object", "properties": {"role": {"type": "string"}}}}, "targets": [{"type": "invoice", "metadata": {"type": "object", "properties": {"cost": {"type": "number"}}}}], "metadata": {"type": "object", "properties": {"transactionId": {"type": "string"}}}, "created_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = AuditLogActionJson.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -1042,31 +527,17 @@ def test_authentication_challenge_round_trip(self): assert restored.to_dict() == serialized def test_authentication_challenge_minimal_payload(self): - data = { - "object": "authentication_challenge", - "id": "auth_challenge_01FVYZ5QM8N98T9ME5BCB2BBMJ", - "authentication_factor_id": "auth_factor_01FVYZ5QM8N98T9ME5BCB2BBMJ", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "authentication_challenge", "id": "auth_challenge_01FVYZ5QM8N98T9ME5BCB2BBMJ", "authentication_factor_id": "auth_factor_01FVYZ5QM8N98T9ME5BCB2BBMJ", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = AuthenticationChallenge.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] assert serialized["id"] == data["id"] - assert ( - serialized["authentication_factor_id"] == data["authentication_factor_id"] - ) + assert serialized["authentication_factor_id"] == data["authentication_factor_id"] assert serialized["created_at"] == data["created_at"] assert serialized["updated_at"] == data["updated_at"] def test_authentication_challenge_omits_absent_optional_non_nullable_fields(self): - data = { - "object": "authentication_challenge", - "id": "auth_challenge_01FVYZ5QM8N98T9ME5BCB2BBMJ", - "authentication_factor_id": "auth_factor_01FVYZ5QM8N98T9ME5BCB2BBMJ", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "authentication_challenge", "id": "auth_challenge_01FVYZ5QM8N98T9ME5BCB2BBMJ", "authentication_factor_id": "auth_factor_01FVYZ5QM8N98T9ME5BCB2BBMJ", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = AuthenticationChallenge.from_dict(data) serialized = instance.to_dict() assert "expires_at" not in serialized @@ -1081,18 +552,7 @@ def test_authentication_challenge_verify_response_round_trip(self): assert restored.to_dict() == serialized def test_authentication_challenge_verify_response_minimal_payload(self): - data = { - "challenge": { - "object": "authentication_challenge", - "id": "auth_challenge_01FVYZ5QM8N98T9ME5BCB2BBMJ", - "expires_at": "2026-01-15T12:00:00.000Z", - "code": "123456", - "authentication_factor_id": "auth_factor_01FVYZ5QM8N98T9ME5BCB2BBMJ", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "valid": True, - } + data = {"challenge": {"object": "authentication_challenge", "id": "auth_challenge_01FVYZ5QM8N98T9ME5BCB2BBMJ", "expires_at": "2026-01-15T12:00:00.000Z", "code": "123456", "authentication_factor_id": "auth_factor_01FVYZ5QM8N98T9ME5BCB2BBMJ", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "valid": True} instance = AuthenticationChallengeVerifyResponse.from_dict(data) serialized = instance.to_dict() assert serialized["challenge"] == data["challenge"] @@ -1107,13 +567,7 @@ def test_authentication_factor_enrolled_round_trip(self): assert restored.to_dict() == serialized def test_authentication_factor_enrolled_minimal_payload(self): - data = { - "object": "authentication_factor", - "id": "auth_factor_01FVYZ5QM8N98T9ME5BCB2BBMJ", - "type": "totp", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "authentication_factor", "id": "auth_factor_01FVYZ5QM8N98T9ME5BCB2BBMJ", "type": "totp", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = AuthenticationFactorEnrolled.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -1122,16 +576,8 @@ def test_authentication_factor_enrolled_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["updated_at"] == data["updated_at"] - def test_authentication_factor_enrolled_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "object": "authentication_factor", - "id": "auth_factor_01FVYZ5QM8N98T9ME5BCB2BBMJ", - "type": "totp", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + def test_authentication_factor_enrolled_omits_absent_optional_non_nullable_fields(self): + data = {"object": "authentication_factor", "id": "auth_factor_01FVYZ5QM8N98T9ME5BCB2BBMJ", "type": "totp", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = AuthenticationFactorEnrolled.from_dict(data) serialized = instance.to_dict() assert "user_id" not in serialized @@ -1139,22 +585,7 @@ def test_authentication_factor_enrolled_omits_absent_optional_non_nullable_field assert "totp" not in serialized def test_authentication_factor_enrolled_round_trips_unknown_enum_values(self): - data = { - "object": "authentication_factor", - "id": "auth_factor_01FVYZ5QM8N98T9ME5BCB2BBMJ", - "type": "unexpected_authentication_factor_enrolled_type", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "sms": {"phone_number": "+15005550006"}, - "totp": { - "issuer": "WorkOS", - "user": "user@example.com", - "secret": "JBSWY3DPEHPK3PXP", - "qr_code": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUg...", - "uri": "otpauth://totp/WorkOS:user@example.com?secret=JBSWY3DPEHPK3PXP&issuer=WorkOS", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "authentication_factor", "id": "auth_factor_01FVYZ5QM8N98T9ME5BCB2BBMJ", "type": "unexpected_authentication_factor_enrolled_type", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "sms": {"phone_number": "+15005550006"}, "totp": {"issuer": "WorkOS", "user": "user@example.com", "secret": "JBSWY3DPEHPK3PXP", "qr_code": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUg...", "uri": "otpauth://totp/WorkOS:user@example.com?secret=JBSWY3DPEHPK3PXP&issuer=WorkOS"}, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = AuthenticationFactorEnrolled.from_dict(data) assert instance.to_dict() == data @@ -1167,13 +598,7 @@ def test_authentication_factor_round_trip(self): assert restored.to_dict() == serialized def test_authentication_factor_minimal_payload(self): - data = { - "object": "authentication_factor", - "id": "auth_factor_01FVYZ5QM8N98T9ME5BCB2BBMJ", - "type": "totp", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "authentication_factor", "id": "auth_factor_01FVYZ5QM8N98T9ME5BCB2BBMJ", "type": "totp", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = AuthenticationFactor.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -1183,13 +608,7 @@ def test_authentication_factor_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_authentication_factor_omits_absent_optional_non_nullable_fields(self): - data = { - "object": "authentication_factor", - "id": "auth_factor_01FVYZ5QM8N98T9ME5BCB2BBMJ", - "type": "totp", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "authentication_factor", "id": "auth_factor_01FVYZ5QM8N98T9ME5BCB2BBMJ", "type": "totp", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = AuthenticationFactor.from_dict(data) serialized = instance.to_dict() assert "user_id" not in serialized @@ -1197,16 +616,7 @@ def test_authentication_factor_omits_absent_optional_non_nullable_fields(self): assert "totp" not in serialized def test_authentication_factor_round_trips_unknown_enum_values(self): - data = { - "object": "authentication_factor", - "id": "auth_factor_01FVYZ5QM8N98T9ME5BCB2BBMJ", - "type": "unexpected_authentication_factor_type", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "sms": {"phone_number": "+15005550006"}, - "totp": {"issuer": "WorkOS", "user": "user@example.com"}, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "authentication_factor", "id": "auth_factor_01FVYZ5QM8N98T9ME5BCB2BBMJ", "type": "unexpected_authentication_factor_type", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "sms": {"phone_number": "+15005550006"}, "totp": {"issuer": "WorkOS", "user": "user@example.com"}, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = AuthenticationFactor.from_dict(data) assert instance.to_dict() == data @@ -1233,18 +643,7 @@ def test_authorization_resource_round_trip(self): assert restored.to_dict() == serialized def test_authorization_resource_minimal_payload(self): - data = { - "object": "authorization_resource", - "name": "Website Redesign", - "description": None, - "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT", - "parent_resource_id": None, - "id": "authz_resource_01HXYZ123456789ABCDEFGH", - "external_id": "proj-456", - "resource_type_slug": "project", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "authorization_resource", "name": "Website Redesign", "description": None, "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT", "parent_resource_id": None, "id": "authz_resource_01HXYZ123456789ABCDEFGH", "external_id": "proj-456", "resource_type_slug": "project", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = AuthorizationResource.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -1259,18 +658,7 @@ def test_authorization_resource_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_authorization_resource_preserves_nullable_fields(self): - data = { - "object": "authorization_resource", - "name": "Website Redesign", - "description": None, - "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT", - "parent_resource_id": None, - "id": "authz_resource_01HXYZ123456789ABCDEFGH", - "external_id": "proj-456", - "resource_type_slug": "project", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "authorization_resource", "name": "Website Redesign", "description": None, "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT", "parent_resource_id": None, "id": "authz_resource_01HXYZ123456789ABCDEFGH", "external_id": "proj-456", "resource_type_slug": "project", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = AuthorizationResource.from_dict(data) serialized = instance.to_dict() assert serialized["description"] is None @@ -1285,17 +673,7 @@ def test_authorization_permission_round_trip(self): assert restored.to_dict() == serialized def test_authorization_permission_minimal_payload(self): - data = { - "object": "permission", - "id": "perm_01HXYZ123456789ABCDEFGHIJ", - "slug": "documents:read", - "name": "View Documents", - "description": None, - "system": False, - "resource_type_slug": "workspace", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "permission", "id": "perm_01HXYZ123456789ABCDEFGHIJ", "slug": "documents:read", "name": "View Documents", "description": None, "system": False, "resource_type_slug": "workspace", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = AuthorizationPermission.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -1309,17 +687,7 @@ def test_authorization_permission_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_authorization_permission_preserves_nullable_fields(self): - data = { - "object": "permission", - "id": "perm_01HXYZ123456789ABCDEFGHIJ", - "slug": "documents:read", - "name": "View Documents", - "description": None, - "system": False, - "resource_type_slug": "workspace", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "permission", "id": "perm_01HXYZ123456789ABCDEFGHIJ", "slug": "documents:read", "name": "View Documents", "description": None, "system": False, "resource_type_slug": "workspace", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = AuthorizationPermission.from_dict(data) serialized = instance.to_dict() assert serialized["description"] is None @@ -1347,18 +715,7 @@ def test_role_assignment_round_trip(self): assert restored.to_dict() == serialized def test_role_assignment_minimal_payload(self): - data = { - "object": "role_assignment", - "id": "role_assignment_01HXYZ123456789ABCDEFGH", - "role": {"slug": "admin"}, - "resource": { - "id": "authz_resource_01HXYZ123456789ABCDEFGH", - "external_id": "proj-456", - "resource_type_slug": "project", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "role_assignment", "id": "role_assignment_01HXYZ123456789ABCDEFGH", "role": {"slug": "admin"}, "resource": {"id": "authz_resource_01HXYZ123456789ABCDEFGH", "external_id": "proj-456", "resource_type_slug": "project"}, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = RoleAssignment.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -1377,18 +734,7 @@ def test_role_round_trip(self): assert restored.to_dict() == serialized def test_role_minimal_payload(self): - data = { - "slug": "admin", - "object": "role", - "id": "role_01EHQMYV6MBK39QC5PZXHY59C3", - "name": "Admin", - "description": None, - "type": "EnvironmentRole", - "resource_type_slug": "organization", - "permissions": ["posts:read", "posts:write"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"slug": "admin", "object": "role", "id": "role_01EHQMYV6MBK39QC5PZXHY59C3", "name": "Admin", "description": None, "type": "EnvironmentRole", "resource_type_slug": "organization", "permissions": ["posts:read", "posts:write"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = Role.from_dict(data) serialized = instance.to_dict() assert serialized["slug"] == data["slug"] @@ -1403,35 +749,13 @@ def test_role_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_role_preserves_nullable_fields(self): - data = { - "slug": "admin", - "object": "role", - "id": "role_01EHQMYV6MBK39QC5PZXHY59C3", - "name": "Admin", - "description": None, - "type": "EnvironmentRole", - "resource_type_slug": "organization", - "permissions": ["posts:read", "posts:write"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"slug": "admin", "object": "role", "id": "role_01EHQMYV6MBK39QC5PZXHY59C3", "name": "Admin", "description": None, "type": "EnvironmentRole", "resource_type_slug": "organization", "permissions": ["posts:read", "posts:write"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = Role.from_dict(data) serialized = instance.to_dict() assert serialized["description"] is None def test_role_round_trips_unknown_enum_values(self): - data = { - "slug": "admin", - "object": "role", - "id": "role_01EHQMYV6MBK39QC5PZXHY59C3", - "name": "Admin", - "description": "Can manage all resources", - "type": "unexpected_role_type", - "resource_type_slug": "organization", - "permissions": ["posts:read", "posts:write"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"slug": "admin", "object": "role", "id": "role_01EHQMYV6MBK39QC5PZXHY59C3", "name": "Admin", "description": "Can manage all resources", "type": "unexpected_role_type", "resource_type_slug": "organization", "permissions": ["posts:read", "posts:write"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = Role.from_dict(data) assert instance.to_dict() == data @@ -1444,23 +768,7 @@ def test_role_list_round_trip(self): assert restored.to_dict() == serialized def test_role_list_minimal_payload(self): - data = { - "object": "list", - "data": [ - { - "slug": "admin", - "object": "role", - "id": "role_01EHQMYV6MBK39QC5PZXHY59C3", - "name": "Admin", - "description": "Can manage all resources", - "type": "EnvironmentRole", - "resource_type_slug": "organization", - "permissions": ["posts:read", "posts:write"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } - ], - } + data = {"object": "list", "data": [{"slug": "admin", "object": "role", "id": "role_01EHQMYV6MBK39QC5PZXHY59C3", "name": "Admin", "description": "Can manage all resources", "type": "EnvironmentRole", "resource_type_slug": "organization", "permissions": ["posts:read", "posts:write"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}]} instance = RoleList.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -1475,23 +783,7 @@ def test_connection_round_trip(self): assert restored.to_dict() == serialized def test_connection_minimal_payload(self): - data = { - "object": "connection", - "id": "conn_01E4ZCR3C56J083X43JQXF3JK5", - "connection_type": "OktaSAML", - "name": "Foo Corp", - "state": "active", - "status": "linked", - "domains": [ - { - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "object": "connection_domain", - "domain": "foo-corp.com", - } - ], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "connection", "id": "conn_01E4ZCR3C56J083X43JQXF3JK5", "connection_type": "OktaSAML", "name": "Foo Corp", "state": "active", "status": "linked", "domains": [{"id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "object": "connection_domain", "domain": "foo-corp.com"}], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = Connection.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -1505,48 +797,14 @@ def test_connection_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_connection_omits_absent_optional_non_nullable_fields(self): - data = { - "object": "connection", - "id": "conn_01E4ZCR3C56J083X43JQXF3JK5", - "connection_type": "OktaSAML", - "name": "Foo Corp", - "state": "active", - "status": "linked", - "domains": [ - { - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "object": "connection_domain", - "domain": "foo-corp.com", - } - ], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "connection", "id": "conn_01E4ZCR3C56J083X43JQXF3JK5", "connection_type": "OktaSAML", "name": "Foo Corp", "state": "active", "status": "linked", "domains": [{"id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "object": "connection_domain", "domain": "foo-corp.com"}], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = Connection.from_dict(data) serialized = instance.to_dict() assert "organization_id" not in serialized assert "options" not in serialized def test_connection_round_trips_unknown_enum_values(self): - data = { - "object": "connection", - "id": "conn_01E4ZCR3C56J083X43JQXF3JK5", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "connection_type": "unexpected_connection_connection_type", - "name": "Foo Corp", - "state": "active", - "status": "linked", - "domains": [ - { - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "object": "connection_domain", - "domain": "foo-corp.com", - } - ], - "options": {"signing_cert": None}, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "connection", "id": "conn_01E4ZCR3C56J083X43JQXF3JK5", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "connection_type": "unexpected_connection_connection_type", "name": "Foo Corp", "state": "active", "status": "linked", "domains": [{"id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "object": "connection_domain", "domain": "foo-corp.com"}], "options": {"signing_cert": None}, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = Connection.from_dict(data) assert instance.to_dict() == data @@ -1559,13 +817,7 @@ def test_cors_origin_response_round_trip(self): assert restored.to_dict() == serialized def test_cors_origin_response_minimal_payload(self): - data = { - "object": "cors_origin", - "id": "cors_origin_01HXYZ123456789ABCDEFGHIJ", - "origin": "https://example.com", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "cors_origin", "id": "cors_origin_01HXYZ123456789ABCDEFGHIJ", "origin": "https://example.com", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = CORSOriginResponse.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -1583,17 +835,7 @@ def test_directory_round_trip(self): assert restored.to_dict() == serialized def test_directory_minimal_payload(self): - data = { - "object": "directory", - "id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT", - "external_key": "sPa12dwRQ", - "type": "gsuite directory", - "state": "linked", - "name": "Foo Corp", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "directory", "id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT", "external_key": "sPa12dwRQ", "type": "gsuite directory", "state": "linked", "name": "Foo Corp", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = Directory.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -1607,36 +849,14 @@ def test_directory_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_directory_omits_absent_optional_non_nullable_fields(self): - data = { - "object": "directory", - "id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT", - "external_key": "sPa12dwRQ", - "type": "gsuite directory", - "state": "linked", - "name": "Foo Corp", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "directory", "id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT", "external_key": "sPa12dwRQ", "type": "gsuite directory", "state": "linked", "name": "Foo Corp", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = Directory.from_dict(data) serialized = instance.to_dict() assert "domain" not in serialized assert "metadata" not in serialized def test_directory_round_trips_unknown_enum_values(self): - data = { - "object": "directory", - "id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT", - "external_key": "sPa12dwRQ", - "type": "unexpected_directory_type", - "state": "linked", - "name": "Foo Corp", - "domain": "foo-corp.com", - "metadata": {"users": {"active": 42, "inactive": 3}, "groups": 5}, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "directory", "id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT", "external_key": "sPa12dwRQ", "type": "unexpected_directory_type", "state": "linked", "name": "Foo Corp", "domain": "foo-corp.com", "metadata": {"users": {"active": 42, "inactive": 3}, "groups": 5}, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = Directory.from_dict(data) assert instance.to_dict() == data @@ -1649,16 +869,7 @@ def test_directory_group_round_trip(self): assert restored.to_dict() == serialized def test_directory_group_minimal_payload(self): - data = { - "object": "directory_group", - "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", - "idp_id": "02grqrue4294w24", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "name": "Developers", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "directory_group", "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", "idp_id": "02grqrue4294w24", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "name": "Developers", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = DirectoryGroup.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -1671,16 +882,7 @@ def test_directory_group_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_directory_group_omits_absent_optional_non_nullable_fields(self): - data = { - "object": "directory_group", - "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", - "idp_id": "02grqrue4294w24", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "name": "Developers", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "directory_group", "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", "idp_id": "02grqrue4294w24", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "name": "Developers", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = DirectoryGroup.from_dict(data) serialized = instance.to_dict() assert "raw_attributes" not in serialized @@ -1694,35 +896,7 @@ def test_directory_user_with_groups_round_trip(self): assert restored.to_dict() == serialized def test_directory_user_with_groups_minimal_payload(self): - data = { - "object": "directory_user", - "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "idp_id": "2836", - "email": None, - "state": "active", - "raw_attributes": {"key": {}}, - "custom_attributes": { - "department": "Engineering", - "job_title": "Software Engineer", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "groups": [ - { - "object": "directory_group", - "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", - "idp_id": "02grqrue4294w24", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "name": "Developers", - "raw_attributes": {"key": {}}, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } - ], - } + data = {"object": "directory_user", "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "idp_id": "2836", "email": None, "state": "active", "raw_attributes": {"key": {}}, "custom_attributes": {"department": "Engineering", "job_title": "Software Engineer"}, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "groups": [{"object": "directory_group", "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", "idp_id": "02grqrue4294w24", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "name": "Developers", "raw_attributes": {"key": {}}, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}]} instance = DirectoryUserWithGroups.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -1739,39 +913,7 @@ def test_directory_user_with_groups_minimal_payload(self): assert serialized["groups"] == data["groups"] def test_directory_user_with_groups_omits_absent_optional_non_nullable_fields(self): - data = { - "object": "directory_user", - "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "idp_id": "2836", - "email": "marcelina.davis@example.com", - "first_name": "Marcelina", - "last_name": "Davis", - "job_title": "Software Engineer", - "username": "mdavis", - "state": "active", - "raw_attributes": {"key": {}}, - "custom_attributes": { - "department": "Engineering", - "job_title": "Software Engineer", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "groups": [ - { - "object": "directory_group", - "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", - "idp_id": "02grqrue4294w24", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "name": "Developers", - "raw_attributes": {"key": {}}, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } - ], - } + data = {"object": "directory_user", "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "idp_id": "2836", "email": "marcelina.davis@example.com", "first_name": "Marcelina", "last_name": "Davis", "job_title": "Software Engineer", "username": "mdavis", "state": "active", "raw_attributes": {"key": {}}, "custom_attributes": {"department": "Engineering", "job_title": "Software Engineer"}, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "groups": [{"object": "directory_group", "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", "idp_id": "02grqrue4294w24", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "name": "Developers", "raw_attributes": {"key": {}}, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}]} instance = DirectoryUserWithGroups.from_dict(data) serialized = instance.to_dict() assert "emails" not in serialized @@ -1779,48 +921,7 @@ def test_directory_user_with_groups_omits_absent_optional_non_nullable_fields(se assert "roles" not in serialized def test_directory_user_with_groups_preserves_nullable_fields(self): - data = { - "object": "directory_user", - "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "idp_id": "2836", - "email": None, - "first_name": None, - "last_name": None, - "emails": [ - { - "primary": True, - "type": "work", - "value": "marcelina.davis@example.com", - } - ], - "job_title": None, - "username": None, - "state": "active", - "raw_attributes": {"key": {}}, - "custom_attributes": { - "department": "Engineering", - "job_title": "Software Engineer", - }, - "role": {"slug": "admin"}, - "roles": [{"slug": "admin"}], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "groups": [ - { - "object": "directory_group", - "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", - "idp_id": "02grqrue4294w24", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "name": "Developers", - "raw_attributes": {"key": {}}, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } - ], - } + data = {"object": "directory_user", "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "idp_id": "2836", "email": None, "first_name": None, "last_name": None, "emails": [{"primary": True, "type": "work", "value": "marcelina.davis@example.com"}], "job_title": None, "username": None, "state": "active", "raw_attributes": {"key": {}}, "custom_attributes": {"department": "Engineering", "job_title": "Software Engineer"}, "role": {"slug": "admin"}, "roles": [{"slug": "admin"}], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "groups": [{"object": "directory_group", "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", "idp_id": "02grqrue4294w24", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "name": "Developers", "raw_attributes": {"key": {}}, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}]} instance = DirectoryUserWithGroups.from_dict(data) serialized = instance.to_dict() assert serialized["email"] is None @@ -1830,51 +931,36 @@ def test_directory_user_with_groups_preserves_nullable_fields(self): assert serialized["username"] is None def test_directory_user_with_groups_round_trips_unknown_enum_values(self): - data = { - "object": "directory_user", - "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "idp_id": "2836", - "email": "marcelina.davis@example.com", - "first_name": "Marcelina", - "last_name": "Davis", - "emails": [ - { - "primary": True, - "type": "work", - "value": "marcelina.davis@example.com", - } - ], - "job_title": "Software Engineer", - "username": "mdavis", - "state": "unexpected_directory_user_with_groups_state", - "raw_attributes": {"key": {}}, - "custom_attributes": { - "department": "Engineering", - "job_title": "Software Engineer", - }, - "role": {"slug": "admin"}, - "roles": [{"slug": "admin"}], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "groups": [ - { - "object": "directory_group", - "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", - "idp_id": "02grqrue4294w24", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "name": "Developers", - "raw_attributes": {"key": {}}, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } - ], - } + data = {"object": "directory_user", "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "idp_id": "2836", "email": "marcelina.davis@example.com", "first_name": "Marcelina", "last_name": "Davis", "emails": [{"primary": True, "type": "work", "value": "marcelina.davis@example.com"}], "job_title": "Software Engineer", "username": "mdavis", "state": "unexpected_directory_user_with_groups_state", "raw_attributes": {"key": {}}, "custom_attributes": {"department": "Engineering", "job_title": "Software Engineer"}, "role": {"slug": "admin"}, "roles": [{"slug": "admin"}], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "groups": [{"object": "directory_group", "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", "idp_id": "02grqrue4294w24", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "name": "Developers", "raw_attributes": {"key": {}}, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}]} instance = DirectoryUserWithGroups.from_dict(data) assert instance.to_dict() == data + def test_group_round_trip(self): + data = load_fixture("group.json") + instance = Group.from_dict(data) + serialized = instance.to_dict() + assert serialized == data + restored = Group.from_dict(serialized) + assert restored.to_dict() == serialized + + def test_group_minimal_payload(self): + data = {"object": "group", "id": "group_01HXYZ123456789ABCDEFGHIJ", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Engineering", "description": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} + instance = Group.from_dict(data) + serialized = instance.to_dict() + assert serialized["object"] == data["object"] + assert serialized["id"] == data["id"] + assert serialized["organization_id"] == data["organization_id"] + assert serialized["name"] == data["name"] + assert serialized["description"] == data["description"] + assert serialized["created_at"] == data["created_at"] + assert serialized["updated_at"] == data["updated_at"] + + def test_group_preserves_nullable_fields(self): + data = {"object": "group", "id": "group_01HXYZ123456789ABCDEFGHIJ", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Engineering", "description": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} + instance = Group.from_dict(data) + serialized = instance.to_dict() + assert serialized["description"] is None + def test_event_context_actor_round_trip(self): data = load_fixture("event_context_actor.json") instance = EventContextActor.from_dict(data) @@ -1898,11 +984,7 @@ def test_event_context_actor_preserves_nullable_fields(self): assert serialized["name"] is None def test_event_context_actor_round_trips_unknown_enum_values(self): - data = { - "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "source": "unexpected_event_context_actor_source", - "name": "Jane Doe", - } + data = {"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "source": "unexpected_event_context_actor_source", "name": "Jane Doe"} instance = EventContextActor.from_dict(data) assert instance.to_dict() == data @@ -1939,22 +1021,7 @@ def test_directory_user_round_trip(self): assert restored.to_dict() == serialized def test_directory_user_minimal_payload(self): - data = { - "object": "directory_user", - "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "idp_id": "2836", - "email": None, - "state": "active", - "raw_attributes": {"key": {}}, - "custom_attributes": { - "department": "Engineering", - "job_title": "Software Engineer", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "directory_user", "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "idp_id": "2836", "email": None, "state": "active", "raw_attributes": {"key": {}}, "custom_attributes": {"department": "Engineering", "job_title": "Software Engineer"}, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = DirectoryUser.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -1970,26 +1037,7 @@ def test_directory_user_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_directory_user_omits_absent_optional_non_nullable_fields(self): - data = { - "object": "directory_user", - "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "idp_id": "2836", - "email": "marcelina.davis@example.com", - "first_name": "Marcelina", - "last_name": "Davis", - "job_title": "Software Engineer", - "username": "mdavis", - "state": "active", - "raw_attributes": {"key": {}}, - "custom_attributes": { - "department": "Engineering", - "job_title": "Software Engineer", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "directory_user", "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "idp_id": "2836", "email": "marcelina.davis@example.com", "first_name": "Marcelina", "last_name": "Davis", "job_title": "Software Engineer", "username": "mdavis", "state": "active", "raw_attributes": {"key": {}}, "custom_attributes": {"department": "Engineering", "job_title": "Software Engineer"}, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = DirectoryUser.from_dict(data) serialized = instance.to_dict() assert "emails" not in serialized @@ -1997,35 +1045,7 @@ def test_directory_user_omits_absent_optional_non_nullable_fields(self): assert "roles" not in serialized def test_directory_user_preserves_nullable_fields(self): - data = { - "object": "directory_user", - "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "idp_id": "2836", - "email": None, - "first_name": None, - "last_name": None, - "emails": [ - { - "primary": True, - "type": "work", - "value": "marcelina.davis@example.com", - } - ], - "job_title": None, - "username": None, - "state": "active", - "raw_attributes": {"key": {}}, - "custom_attributes": { - "department": "Engineering", - "job_title": "Software Engineer", - }, - "role": {"slug": "admin"}, - "roles": [{"slug": "admin"}], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "directory_user", "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "idp_id": "2836", "email": None, "first_name": None, "last_name": None, "emails": [{"primary": True, "type": "work", "value": "marcelina.davis@example.com"}], "job_title": None, "username": None, "state": "active", "raw_attributes": {"key": {}}, "custom_attributes": {"department": "Engineering", "job_title": "Software Engineer"}, "role": {"slug": "admin"}, "roles": [{"slug": "admin"}], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = DirectoryUser.from_dict(data) serialized = instance.to_dict() assert serialized["email"] is None @@ -2035,80 +1055,10 @@ def test_directory_user_preserves_nullable_fields(self): assert serialized["username"] is None def test_directory_user_round_trips_unknown_enum_values(self): - data = { - "object": "directory_user", - "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "idp_id": "2836", - "email": "marcelina.davis@example.com", - "first_name": "Marcelina", - "last_name": "Davis", - "emails": [ - { - "primary": True, - "type": "work", - "value": "marcelina.davis@example.com", - } - ], - "job_title": "Software Engineer", - "username": "mdavis", - "state": "unexpected_directory_user_state", - "raw_attributes": {"key": {}}, - "custom_attributes": { - "department": "Engineering", - "job_title": "Software Engineer", - }, - "role": {"slug": "admin"}, - "roles": [{"slug": "admin"}], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "directory_user", "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "idp_id": "2836", "email": "marcelina.davis@example.com", "first_name": "Marcelina", "last_name": "Davis", "emails": [{"primary": True, "type": "work", "value": "marcelina.davis@example.com"}], "job_title": "Software Engineer", "username": "mdavis", "state": "unexpected_directory_user_state", "raw_attributes": {"key": {}}, "custom_attributes": {"department": "Engineering", "job_title": "Software Engineer"}, "role": {"slug": "admin"}, "roles": [{"slug": "admin"}], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = DirectoryUser.from_dict(data) assert instance.to_dict() == data - def test_group_round_trip(self): - data = load_fixture("group.json") - instance = Group.from_dict(data) - serialized = instance.to_dict() - assert serialized == data - restored = Group.from_dict(serialized) - assert restored.to_dict() == serialized - - def test_group_minimal_payload(self): - data = { - "object": "group", - "id": "group_01HXYZ123456789ABCDEFGHIJ", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "name": "Engineering", - "description": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } - instance = Group.from_dict(data) - serialized = instance.to_dict() - assert serialized["object"] == data["object"] - assert serialized["id"] == data["id"] - assert serialized["organization_id"] == data["organization_id"] - assert serialized["name"] == data["name"] - assert serialized["description"] == data["description"] - assert serialized["created_at"] == data["created_at"] - assert serialized["updated_at"] == data["updated_at"] - - def test_group_preserves_nullable_fields(self): - data = { - "object": "group", - "id": "group_01HXYZ123456789ABCDEFGHIJ", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "name": "Engineering", - "description": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } - instance = Group.from_dict(data) - serialized = instance.to_dict() - assert serialized["description"] is None - def test_user_round_trip(self): data = load_fixture("user.json") instance = User.from_dict(data) @@ -2118,19 +1068,7 @@ def test_user_round_trip(self): assert restored.to_dict() == serialized def test_user_minimal_payload(self): - data = { - "object": "user", - "id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "first_name": None, - "last_name": None, - "profile_picture_url": None, - "email": "marcelina.davis@example.com", - "email_verified": True, - "external_id": None, - "last_sign_in_at": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "user", "id": "user_01E4ZCR3C56J083X43JQXF3JK5", "first_name": None, "last_name": None, "profile_picture_url": None, "email": "marcelina.davis@example.com", "email_verified": True, "external_id": None, "last_sign_in_at": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = User.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -2146,40 +1084,13 @@ def test_user_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_user_omits_absent_optional_non_nullable_fields(self): - data = { - "object": "user", - "id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "first_name": "Marcelina", - "last_name": "Davis", - "profile_picture_url": "https://workoscdn.com/images/v1/123abc", - "email": "marcelina.davis@example.com", - "email_verified": True, - "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222", - "last_sign_in_at": "2025-06-25T19:07:33.155Z", - "locale": "en-US", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "user", "id": "user_01E4ZCR3C56J083X43JQXF3JK5", "first_name": "Marcelina", "last_name": "Davis", "profile_picture_url": "https://workoscdn.com/images/v1/123abc", "email": "marcelina.davis@example.com", "email_verified": True, "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222", "last_sign_in_at": "2025-06-25T19:07:33.155Z", "locale": "en-US", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = User.from_dict(data) serialized = instance.to_dict() assert "metadata" not in serialized def test_user_preserves_nullable_fields(self): - data = { - "object": "user", - "id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "first_name": None, - "last_name": None, - "profile_picture_url": None, - "email": "marcelina.davis@example.com", - "email_verified": True, - "external_id": None, - "metadata": {"timezone": "America/New_York"}, - "last_sign_in_at": None, - "locale": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "user", "id": "user_01E4ZCR3C56J083X43JQXF3JK5", "first_name": None, "last_name": None, "profile_picture_url": None, "email": "marcelina.davis@example.com", "email_verified": True, "external_id": None, "metadata": {"timezone": "America/New_York"}, "last_sign_in_at": None, "locale": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = User.from_dict(data) serialized = instance.to_dict() assert serialized["first_name"] is None @@ -2189,6 +1100,37 @@ def test_user_preserves_nullable_fields(self): assert serialized["last_sign_in_at"] is None assert serialized["locale"] is None + def test_waitlist_user_round_trip(self): + data = load_fixture("waitlist_user.json") + instance = WaitlistUser.from_dict(data) + serialized = instance.to_dict() + assert serialized == data + restored = WaitlistUser.from_dict(serialized) + assert restored.to_dict() == serialized + + def test_waitlist_user_minimal_payload(self): + data = {"object": "waitlist_user", "id": "wl_user_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "state": "pending", "approved_at": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} + instance = WaitlistUser.from_dict(data) + serialized = instance.to_dict() + assert serialized["object"] == data["object"] + assert serialized["id"] == data["id"] + assert serialized["email"] == data["email"] + assert serialized["state"] == data["state"] + assert serialized["approved_at"] == data["approved_at"] + assert serialized["created_at"] == data["created_at"] + assert serialized["updated_at"] == data["updated_at"] + + def test_waitlist_user_preserves_nullable_fields(self): + data = {"object": "waitlist_user", "id": "wl_user_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "state": "pending", "approved_at": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} + instance = WaitlistUser.from_dict(data) + serialized = instance.to_dict() + assert serialized["approved_at"] is None + + def test_waitlist_user_round_trips_unknown_enum_values(self): + data = {"object": "waitlist_user", "id": "wl_user_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "state": "unexpected_waitlist_user_state", "approved_at": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} + instance = WaitlistUser.from_dict(data) + assert instance.to_dict() == data + def test_action_authentication_denied_round_trip(self): data = load_fixture("action_authentication_denied.json") instance = ActionAuthenticationDenied.from_dict(data) @@ -2198,23 +1140,7 @@ def test_action_authentication_denied_round_trip(self): assert restored.to_dict() == serialized def test_action_authentication_denied_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "action.authentication.denied", - "data": { - "action_endpoint_id": "action_endpoint_01EHWNCE74X7JSDV0X3SZ3KJNY", - "action_execution_id": "action_execution_01EHWNCE74X7JSDV0X3SZ3KJNY", - "type": "authentication", - "verdict": "Deny", - "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "email": "user@example.com", - "ip_address": "203.0.113.1", - "user_agent": "Mozilla/5.0", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "action.authentication.denied", "data": {"action_endpoint_id": "action_endpoint_01EHWNCE74X7JSDV0X3SZ3KJNY", "action_execution_id": "action_execution_01EHWNCE74X7JSDV0X3SZ3KJNY", "type": "authentication", "verdict": "Deny", "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "email": "user@example.com", "ip_address": "203.0.113.1", "user_agent": "Mozilla/5.0"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = ActionAuthenticationDenied.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -2223,26 +1149,8 @@ def test_action_authentication_denied_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["object"] == data["object"] - def test_action_authentication_denied_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "action.authentication.denied", - "data": { - "action_endpoint_id": "action_endpoint_01EHWNCE74X7JSDV0X3SZ3KJNY", - "action_execution_id": "action_execution_01EHWNCE74X7JSDV0X3SZ3KJNY", - "type": "authentication", - "verdict": "Deny", - "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "email": "user@example.com", - "ip_address": "203.0.113.1", - "user_agent": "Mozilla/5.0", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + def test_action_authentication_denied_omits_absent_optional_non_nullable_fields(self): + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "action.authentication.denied", "data": {"action_endpoint_id": "action_endpoint_01EHWNCE74X7JSDV0X3SZ3KJNY", "action_execution_id": "action_execution_01EHWNCE74X7JSDV0X3SZ3KJNY", "type": "authentication", "verdict": "Deny", "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "email": "user@example.com", "ip_address": "203.0.113.1", "user_agent": "Mozilla/5.0"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = ActionAuthenticationDenied.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -2256,17 +1164,7 @@ def test_action_authentication_denied_data_round_trip(self): assert restored.to_dict() == serialized def test_action_authentication_denied_data_minimal_payload(self): - data = { - "action_endpoint_id": "action_endpoint_01EHWNCE74X7JSDV0X3SZ3KJNY", - "action_execution_id": "action_execution_01EHWNCE74X7JSDV0X3SZ3KJNY", - "type": "authentication", - "verdict": "Deny", - "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "organization_id": None, - "email": "user@example.com", - "ip_address": None, - "user_agent": None, - } + data = {"action_endpoint_id": "action_endpoint_01EHWNCE74X7JSDV0X3SZ3KJNY", "action_execution_id": "action_execution_01EHWNCE74X7JSDV0X3SZ3KJNY", "type": "authentication", "verdict": "Deny", "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "organization_id": None, "email": "user@example.com", "ip_address": None, "user_agent": None} instance = ActionAuthenticationDeniedData.from_dict(data) serialized = instance.to_dict() assert serialized["action_endpoint_id"] == data["action_endpoint_id"] @@ -2280,17 +1178,7 @@ def test_action_authentication_denied_data_minimal_payload(self): assert serialized["user_agent"] == data["user_agent"] def test_action_authentication_denied_data_preserves_nullable_fields(self): - data = { - "action_endpoint_id": "action_endpoint_01EHWNCE74X7JSDV0X3SZ3KJNY", - "action_execution_id": "action_execution_01EHWNCE74X7JSDV0X3SZ3KJNY", - "type": "authentication", - "verdict": "Deny", - "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "organization_id": None, - "email": "user@example.com", - "ip_address": None, - "user_agent": None, - } + data = {"action_endpoint_id": "action_endpoint_01EHWNCE74X7JSDV0X3SZ3KJNY", "action_execution_id": "action_execution_01EHWNCE74X7JSDV0X3SZ3KJNY", "type": "authentication", "verdict": "Deny", "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "organization_id": None, "email": "user@example.com", "ip_address": None, "user_agent": None} instance = ActionAuthenticationDeniedData.from_dict(data) serialized = instance.to_dict() assert serialized["organization_id"] is None @@ -2306,22 +1194,7 @@ def test_action_user_registration_denied_round_trip(self): assert restored.to_dict() == serialized def test_action_user_registration_denied_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "action.user_registration.denied", - "data": { - "action_endpoint_id": "action_endpoint_01EHWNCE74X7JSDV0X3SZ3KJNY", - "action_execution_id": "action_execution_01EHWNCE74X7JSDV0X3SZ3KJNY", - "type": "user_registration", - "verdict": "Deny", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "email": "user@example.com", - "ip_address": "203.0.113.1", - "user_agent": "Mozilla/5.0", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "action.user_registration.denied", "data": {"action_endpoint_id": "action_endpoint_01EHWNCE74X7JSDV0X3SZ3KJNY", "action_execution_id": "action_execution_01EHWNCE74X7JSDV0X3SZ3KJNY", "type": "user_registration", "verdict": "Deny", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "email": "user@example.com", "ip_address": "203.0.113.1", "user_agent": "Mozilla/5.0"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = ActionUserRegistrationDenied.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -2330,25 +1203,8 @@ def test_action_user_registration_denied_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["object"] == data["object"] - def test_action_user_registration_denied_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "action.user_registration.denied", - "data": { - "action_endpoint_id": "action_endpoint_01EHWNCE74X7JSDV0X3SZ3KJNY", - "action_execution_id": "action_execution_01EHWNCE74X7JSDV0X3SZ3KJNY", - "type": "user_registration", - "verdict": "Deny", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "email": "user@example.com", - "ip_address": "203.0.113.1", - "user_agent": "Mozilla/5.0", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + def test_action_user_registration_denied_omits_absent_optional_non_nullable_fields(self): + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "action.user_registration.denied", "data": {"action_endpoint_id": "action_endpoint_01EHWNCE74X7JSDV0X3SZ3KJNY", "action_execution_id": "action_execution_01EHWNCE74X7JSDV0X3SZ3KJNY", "type": "user_registration", "verdict": "Deny", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "email": "user@example.com", "ip_address": "203.0.113.1", "user_agent": "Mozilla/5.0"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = ActionUserRegistrationDenied.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -2362,16 +1218,7 @@ def test_action_user_registration_denied_data_round_trip(self): assert restored.to_dict() == serialized def test_action_user_registration_denied_data_minimal_payload(self): - data = { - "action_endpoint_id": "action_endpoint_01EHWNCE74X7JSDV0X3SZ3KJNY", - "action_execution_id": "action_execution_01EHWNCE74X7JSDV0X3SZ3KJNY", - "type": "user_registration", - "verdict": "Deny", - "organization_id": None, - "email": "user@example.com", - "ip_address": None, - "user_agent": None, - } + data = {"action_endpoint_id": "action_endpoint_01EHWNCE74X7JSDV0X3SZ3KJNY", "action_execution_id": "action_execution_01EHWNCE74X7JSDV0X3SZ3KJNY", "type": "user_registration", "verdict": "Deny", "organization_id": None, "email": "user@example.com", "ip_address": None, "user_agent": None} instance = ActionUserRegistrationDeniedData.from_dict(data) serialized = instance.to_dict() assert serialized["action_endpoint_id"] == data["action_endpoint_id"] @@ -2384,16 +1231,7 @@ def test_action_user_registration_denied_data_minimal_payload(self): assert serialized["user_agent"] == data["user_agent"] def test_action_user_registration_denied_data_preserves_nullable_fields(self): - data = { - "action_endpoint_id": "action_endpoint_01EHWNCE74X7JSDV0X3SZ3KJNY", - "action_execution_id": "action_execution_01EHWNCE74X7JSDV0X3SZ3KJNY", - "type": "user_registration", - "verdict": "Deny", - "organization_id": None, - "email": "user@example.com", - "ip_address": None, - "user_agent": None, - } + data = {"action_endpoint_id": "action_endpoint_01EHWNCE74X7JSDV0X3SZ3KJNY", "action_execution_id": "action_execution_01EHWNCE74X7JSDV0X3SZ3KJNY", "type": "user_registration", "verdict": "Deny", "organization_id": None, "email": "user@example.com", "ip_address": None, "user_agent": None} instance = ActionUserRegistrationDeniedData.from_dict(data) serialized = instance.to_dict() assert serialized["organization_id"] is None @@ -2409,26 +1247,7 @@ def test_api_key_created_round_trip(self): assert restored.to_dict() == serialized def test_api_key_created_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "api_key.created", - "data": { - "object": "api_key", - "id": "api_key_01EHWNCE74X7JSDV0X3SZ3KJNY", - "owner": { - "type": "organization", - "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - }, - "name": "My API Key", - "obfuscated_value": "sk_test_...1234", - "last_used_at": "2026-01-15T12:00:00.000Z", - "permissions": ["users:read", "users:write"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "api_key.created", "data": {"object": "api_key", "id": "api_key_01EHWNCE74X7JSDV0X3SZ3KJNY", "owner": {"type": "organization", "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY"}, "name": "My API Key", "obfuscated_value": "sk_test_...1234", "last_used_at": "2026-01-15T12:00:00.000Z", "permissions": ["users:read", "users:write"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = ApiKeyCreated.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -2438,26 +1257,7 @@ def test_api_key_created_minimal_payload(self): assert serialized["object"] == data["object"] def test_api_key_created_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "api_key.created", - "data": { - "object": "api_key", - "id": "api_key_01EHWNCE74X7JSDV0X3SZ3KJNY", - "owner": { - "type": "organization", - "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - }, - "name": "My API Key", - "obfuscated_value": "sk_test_...1234", - "last_used_at": "2026-01-15T12:00:00.000Z", - "permissions": ["users:read", "users:write"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "api_key.created", "data": {"object": "api_key", "id": "api_key_01EHWNCE74X7JSDV0X3SZ3KJNY", "owner": {"type": "organization", "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY"}, "name": "My API Key", "obfuscated_value": "sk_test_...1234", "last_used_at": "2026-01-15T12:00:00.000Z", "permissions": ["users:read", "users:write"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = ApiKeyCreated.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -2471,17 +1271,7 @@ def test_api_key_created_data_round_trip(self): assert restored.to_dict() == serialized def test_api_key_created_data_minimal_payload(self): - data = { - "object": "api_key", - "id": "api_key_01EHWNCE74X7JSDV0X3SZ3KJNY", - "owner": {"type": "organization", "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY"}, - "name": "My API Key", - "obfuscated_value": "sk_test_...1234", - "last_used_at": None, - "permissions": ["users:read", "users:write"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "api_key", "id": "api_key_01EHWNCE74X7JSDV0X3SZ3KJNY", "owner": {"type": "organization", "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY"}, "name": "My API Key", "obfuscated_value": "sk_test_...1234", "last_used_at": None, "permissions": ["users:read", "users:write"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = ApiKeyCreatedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -2495,17 +1285,7 @@ def test_api_key_created_data_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_api_key_created_data_preserves_nullable_fields(self): - data = { - "object": "api_key", - "id": "api_key_01EHWNCE74X7JSDV0X3SZ3KJNY", - "owner": {"type": "organization", "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY"}, - "name": "My API Key", - "obfuscated_value": "sk_test_...1234", - "last_used_at": None, - "permissions": ["users:read", "users:write"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "api_key", "id": "api_key_01EHWNCE74X7JSDV0X3SZ3KJNY", "owner": {"type": "organization", "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY"}, "name": "My API Key", "obfuscated_value": "sk_test_...1234", "last_used_at": None, "permissions": ["users:read", "users:write"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = ApiKeyCreatedData.from_dict(data) serialized = instance.to_dict() assert serialized["last_used_at"] is None @@ -2534,26 +1314,7 @@ def test_api_key_revoked_round_trip(self): assert restored.to_dict() == serialized def test_api_key_revoked_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "api_key.revoked", - "data": { - "object": "api_key", - "id": "api_key_01EHWNCE74X7JSDV0X3SZ3KJNY", - "owner": { - "type": "organization", - "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - }, - "name": "My API Key", - "obfuscated_value": "sk_test_...1234", - "last_used_at": "2026-01-15T12:00:00.000Z", - "permissions": ["users:read", "users:write"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "api_key.revoked", "data": {"object": "api_key", "id": "api_key_01EHWNCE74X7JSDV0X3SZ3KJNY", "owner": {"type": "organization", "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY"}, "name": "My API Key", "obfuscated_value": "sk_test_...1234", "last_used_at": "2026-01-15T12:00:00.000Z", "permissions": ["users:read", "users:write"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = ApiKeyRevoked.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -2563,26 +1324,7 @@ def test_api_key_revoked_minimal_payload(self): assert serialized["object"] == data["object"] def test_api_key_revoked_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "api_key.revoked", - "data": { - "object": "api_key", - "id": "api_key_01EHWNCE74X7JSDV0X3SZ3KJNY", - "owner": { - "type": "organization", - "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - }, - "name": "My API Key", - "obfuscated_value": "sk_test_...1234", - "last_used_at": "2026-01-15T12:00:00.000Z", - "permissions": ["users:read", "users:write"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "api_key.revoked", "data": {"object": "api_key", "id": "api_key_01EHWNCE74X7JSDV0X3SZ3KJNY", "owner": {"type": "organization", "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY"}, "name": "My API Key", "obfuscated_value": "sk_test_...1234", "last_used_at": "2026-01-15T12:00:00.000Z", "permissions": ["users:read", "users:write"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = ApiKeyRevoked.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -2596,17 +1338,7 @@ def test_api_key_revoked_data_round_trip(self): assert restored.to_dict() == serialized def test_api_key_revoked_data_minimal_payload(self): - data = { - "object": "api_key", - "id": "api_key_01EHWNCE74X7JSDV0X3SZ3KJNY", - "owner": {"type": "organization", "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY"}, - "name": "My API Key", - "obfuscated_value": "sk_test_...1234", - "last_used_at": None, - "permissions": ["users:read", "users:write"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "api_key", "id": "api_key_01EHWNCE74X7JSDV0X3SZ3KJNY", "owner": {"type": "organization", "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY"}, "name": "My API Key", "obfuscated_value": "sk_test_...1234", "last_used_at": None, "permissions": ["users:read", "users:write"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = ApiKeyRevokedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -2620,17 +1352,7 @@ def test_api_key_revoked_data_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_api_key_revoked_data_preserves_nullable_fields(self): - data = { - "object": "api_key", - "id": "api_key_01EHWNCE74X7JSDV0X3SZ3KJNY", - "owner": {"type": "organization", "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY"}, - "name": "My API Key", - "obfuscated_value": "sk_test_...1234", - "last_used_at": None, - "permissions": ["users:read", "users:write"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "api_key", "id": "api_key_01EHWNCE74X7JSDV0X3SZ3KJNY", "owner": {"type": "organization", "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY"}, "name": "My API Key", "obfuscated_value": "sk_test_...1234", "last_used_at": None, "permissions": ["users:read", "users:write"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = ApiKeyRevokedData.from_dict(data) serialized = instance.to_dict() assert serialized["last_used_at"] is None @@ -2659,24 +1381,7 @@ def test_authentication_email_verification_failed_round_trip(self): assert restored.to_dict() == serialized def test_authentication_email_verification_failed_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "authentication.email_verification_failed", - "data": { - "type": "email_verification", - "status": "failed", - "ip_address": "203.0.113.42", - "user_agent": "Mozilla/5.0", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - "error": { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - }, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "authentication.email_verification_failed", "data": {"type": "email_verification", "status": "failed", "ip_address": "203.0.113.42", "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com", "error": {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."}}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = AuthenticationEmailVerificationFailed.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -2685,27 +1390,8 @@ def test_authentication_email_verification_failed_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["object"] == data["object"] - def test_authentication_email_verification_failed_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "authentication.email_verification_failed", - "data": { - "type": "email_verification", - "status": "failed", - "ip_address": "203.0.113.42", - "user_agent": "Mozilla/5.0", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - "error": { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - }, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + def test_authentication_email_verification_failed_omits_absent_optional_non_nullable_fields(self): + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "authentication.email_verification_failed", "data": {"type": "email_verification", "status": "failed", "ip_address": "203.0.113.42", "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com", "error": {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."}}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = AuthenticationEmailVerificationFailed.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -2719,18 +1405,7 @@ def test_authentication_email_verification_failed_data_round_trip(self): assert restored.to_dict() == serialized def test_authentication_email_verification_failed_data_minimal_payload(self): - data = { - "type": "email_verification", - "status": "failed", - "ip_address": None, - "user_agent": None, - "user_id": None, - "email": None, - "error": { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - }, - } + data = {"type": "email_verification", "status": "failed", "ip_address": None, "user_agent": None, "user_id": None, "email": None, "error": {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."}} instance = AuthenticationEmailVerificationFailedData.from_dict(data) serialized = instance.to_dict() assert serialized["type"] == data["type"] @@ -2741,21 +1416,8 @@ def test_authentication_email_verification_failed_data_minimal_payload(self): assert serialized["email"] == data["email"] assert serialized["error"] == data["error"] - def test_authentication_email_verification_failed_data_preserves_nullable_fields( - self, - ): - data = { - "type": "email_verification", - "status": "failed", - "ip_address": None, - "user_agent": None, - "user_id": None, - "email": None, - "error": { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - }, - } + def test_authentication_email_verification_failed_data_preserves_nullable_fields(self): + data = {"type": "email_verification", "status": "failed", "ip_address": None, "user_agent": None, "user_id": None, "email": None, "error": {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."}} instance = AuthenticationEmailVerificationFailedData.from_dict(data) serialized = instance.to_dict() assert serialized["ip_address"] is None @@ -2772,10 +1434,7 @@ def test_authentication_email_verification_failed_data_error_round_trip(self): assert restored.to_dict() == serialized def test_authentication_email_verification_failed_data_error_minimal_payload(self): - data = { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - } + data = {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."} instance = AuthenticationEmailVerificationFailedDataError.from_dict(data) serialized = instance.to_dict() assert serialized["code"] == data["code"] @@ -2790,20 +1449,7 @@ def test_authentication_email_verification_succeeded_round_trip(self): assert restored.to_dict() == serialized def test_authentication_email_verification_succeeded_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "authentication.email_verification_succeeded", - "data": { - "type": "email_verification", - "status": "succeeded", - "ip_address": "203.0.113.42", - "user_agent": "Mozilla/5.0", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "authentication.email_verification_succeeded", "data": {"type": "email_verification", "status": "succeeded", "ip_address": "203.0.113.42", "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = AuthenticationEmailVerificationSucceeded.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -2812,23 +1458,8 @@ def test_authentication_email_verification_succeeded_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["object"] == data["object"] - def test_authentication_email_verification_succeeded_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "authentication.email_verification_succeeded", - "data": { - "type": "email_verification", - "status": "succeeded", - "ip_address": "203.0.113.42", - "user_agent": "Mozilla/5.0", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + def test_authentication_email_verification_succeeded_omits_absent_optional_non_nullable_fields(self): + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "authentication.email_verification_succeeded", "data": {"type": "email_verification", "status": "succeeded", "ip_address": "203.0.113.42", "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = AuthenticationEmailVerificationSucceeded.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -2842,14 +1473,7 @@ def test_authentication_email_verification_succeeded_data_round_trip(self): assert restored.to_dict() == serialized def test_authentication_email_verification_succeeded_data_minimal_payload(self): - data = { - "type": "email_verification", - "status": "succeeded", - "ip_address": None, - "user_agent": None, - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - } + data = {"type": "email_verification", "status": "succeeded", "ip_address": None, "user_agent": None, "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com"} instance = AuthenticationEmailVerificationSucceededData.from_dict(data) serialized = instance.to_dict() assert serialized["type"] == data["type"] @@ -2859,17 +1483,8 @@ def test_authentication_email_verification_succeeded_data_minimal_payload(self): assert serialized["user_id"] == data["user_id"] assert serialized["email"] == data["email"] - def test_authentication_email_verification_succeeded_data_preserves_nullable_fields( - self, - ): - data = { - "type": "email_verification", - "status": "succeeded", - "ip_address": None, - "user_agent": None, - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - } + def test_authentication_email_verification_succeeded_data_preserves_nullable_fields(self): + data = {"type": "email_verification", "status": "succeeded", "ip_address": None, "user_agent": None, "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com"} instance = AuthenticationEmailVerificationSucceededData.from_dict(data) serialized = instance.to_dict() assert serialized["ip_address"] is None @@ -2884,24 +1499,7 @@ def test_authentication_magic_auth_failed_round_trip(self): assert restored.to_dict() == serialized def test_authentication_magic_auth_failed_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "authentication.magic_auth_failed", - "data": { - "type": "magic_auth", - "status": "failed", - "ip_address": "203.0.113.42", - "user_agent": "Mozilla/5.0", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - "error": { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - }, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "authentication.magic_auth_failed", "data": {"type": "magic_auth", "status": "failed", "ip_address": "203.0.113.42", "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com", "error": {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."}}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = AuthenticationMagicAuthFailed.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -2910,27 +1508,8 @@ def test_authentication_magic_auth_failed_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["object"] == data["object"] - def test_authentication_magic_auth_failed_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "authentication.magic_auth_failed", - "data": { - "type": "magic_auth", - "status": "failed", - "ip_address": "203.0.113.42", - "user_agent": "Mozilla/5.0", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - "error": { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - }, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + def test_authentication_magic_auth_failed_omits_absent_optional_non_nullable_fields(self): + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "authentication.magic_auth_failed", "data": {"type": "magic_auth", "status": "failed", "ip_address": "203.0.113.42", "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com", "error": {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."}}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = AuthenticationMagicAuthFailed.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -2944,18 +1523,7 @@ def test_authentication_magic_auth_failed_data_round_trip(self): assert restored.to_dict() == serialized def test_authentication_magic_auth_failed_data_minimal_payload(self): - data = { - "type": "magic_auth", - "status": "failed", - "ip_address": None, - "user_agent": None, - "user_id": None, - "email": None, - "error": { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - }, - } + data = {"type": "magic_auth", "status": "failed", "ip_address": None, "user_agent": None, "user_id": None, "email": None, "error": {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."}} instance = AuthenticationMagicAuthFailedData.from_dict(data) serialized = instance.to_dict() assert serialized["type"] == data["type"] @@ -2967,18 +1535,7 @@ def test_authentication_magic_auth_failed_data_minimal_payload(self): assert serialized["error"] == data["error"] def test_authentication_magic_auth_failed_data_preserves_nullable_fields(self): - data = { - "type": "magic_auth", - "status": "failed", - "ip_address": None, - "user_agent": None, - "user_id": None, - "email": None, - "error": { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - }, - } + data = {"type": "magic_auth", "status": "failed", "ip_address": None, "user_agent": None, "user_id": None, "email": None, "error": {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."}} instance = AuthenticationMagicAuthFailedData.from_dict(data) serialized = instance.to_dict() assert serialized["ip_address"] is None @@ -2995,10 +1552,7 @@ def test_authentication_magic_auth_failed_data_error_round_trip(self): assert restored.to_dict() == serialized def test_authentication_magic_auth_failed_data_error_minimal_payload(self): - data = { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - } + data = {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."} instance = AuthenticationMagicAuthFailedDataError.from_dict(data) serialized = instance.to_dict() assert serialized["code"] == data["code"] @@ -3013,20 +1567,7 @@ def test_authentication_magic_auth_succeeded_round_trip(self): assert restored.to_dict() == serialized def test_authentication_magic_auth_succeeded_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "authentication.magic_auth_succeeded", - "data": { - "type": "magic_auth", - "status": "succeeded", - "ip_address": "203.0.113.42", - "user_agent": "Mozilla/5.0", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "authentication.magic_auth_succeeded", "data": {"type": "magic_auth", "status": "succeeded", "ip_address": "203.0.113.42", "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = AuthenticationMagicAuthSucceeded.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -3035,23 +1576,8 @@ def test_authentication_magic_auth_succeeded_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["object"] == data["object"] - def test_authentication_magic_auth_succeeded_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "authentication.magic_auth_succeeded", - "data": { - "type": "magic_auth", - "status": "succeeded", - "ip_address": "203.0.113.42", - "user_agent": "Mozilla/5.0", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + def test_authentication_magic_auth_succeeded_omits_absent_optional_non_nullable_fields(self): + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "authentication.magic_auth_succeeded", "data": {"type": "magic_auth", "status": "succeeded", "ip_address": "203.0.113.42", "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = AuthenticationMagicAuthSucceeded.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -3065,14 +1591,7 @@ def test_authentication_magic_auth_succeeded_data_round_trip(self): assert restored.to_dict() == serialized def test_authentication_magic_auth_succeeded_data_minimal_payload(self): - data = { - "type": "magic_auth", - "status": "succeeded", - "ip_address": None, - "user_agent": None, - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - } + data = {"type": "magic_auth", "status": "succeeded", "ip_address": None, "user_agent": None, "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com"} instance = AuthenticationMagicAuthSucceededData.from_dict(data) serialized = instance.to_dict() assert serialized["type"] == data["type"] @@ -3083,14 +1602,7 @@ def test_authentication_magic_auth_succeeded_data_minimal_payload(self): assert serialized["email"] == data["email"] def test_authentication_magic_auth_succeeded_data_preserves_nullable_fields(self): - data = { - "type": "magic_auth", - "status": "succeeded", - "ip_address": None, - "user_agent": None, - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - } + data = {"type": "magic_auth", "status": "succeeded", "ip_address": None, "user_agent": None, "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com"} instance = AuthenticationMagicAuthSucceededData.from_dict(data) serialized = instance.to_dict() assert serialized["ip_address"] is None @@ -3105,24 +1617,7 @@ def test_authentication_mfa_failed_round_trip(self): assert restored.to_dict() == serialized def test_authentication_mfa_failed_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "authentication.mfa_failed", - "data": { - "type": "mfa", - "status": "failed", - "ip_address": "203.0.113.42", - "user_agent": "Mozilla/5.0", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - "error": { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - }, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "authentication.mfa_failed", "data": {"type": "mfa", "status": "failed", "ip_address": "203.0.113.42", "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com", "error": {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."}}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = AuthenticationMFAFailed.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -3132,24 +1627,7 @@ def test_authentication_mfa_failed_minimal_payload(self): assert serialized["object"] == data["object"] def test_authentication_mfa_failed_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "authentication.mfa_failed", - "data": { - "type": "mfa", - "status": "failed", - "ip_address": "203.0.113.42", - "user_agent": "Mozilla/5.0", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - "error": { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - }, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "authentication.mfa_failed", "data": {"type": "mfa", "status": "failed", "ip_address": "203.0.113.42", "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com", "error": {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."}}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = AuthenticationMFAFailed.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -3163,18 +1641,7 @@ def test_authentication_mfa_failed_data_round_trip(self): assert restored.to_dict() == serialized def test_authentication_mfa_failed_data_minimal_payload(self): - data = { - "type": "mfa", - "status": "failed", - "ip_address": None, - "user_agent": None, - "user_id": None, - "email": None, - "error": { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - }, - } + data = {"type": "mfa", "status": "failed", "ip_address": None, "user_agent": None, "user_id": None, "email": None, "error": {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."}} instance = AuthenticationMFAFailedData.from_dict(data) serialized = instance.to_dict() assert serialized["type"] == data["type"] @@ -3186,18 +1653,7 @@ def test_authentication_mfa_failed_data_minimal_payload(self): assert serialized["error"] == data["error"] def test_authentication_mfa_failed_data_preserves_nullable_fields(self): - data = { - "type": "mfa", - "status": "failed", - "ip_address": None, - "user_agent": None, - "user_id": None, - "email": None, - "error": { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - }, - } + data = {"type": "mfa", "status": "failed", "ip_address": None, "user_agent": None, "user_id": None, "email": None, "error": {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."}} instance = AuthenticationMFAFailedData.from_dict(data) serialized = instance.to_dict() assert serialized["ip_address"] is None @@ -3214,10 +1670,7 @@ def test_authentication_mfa_failed_data_error_round_trip(self): assert restored.to_dict() == serialized def test_authentication_mfa_failed_data_error_minimal_payload(self): - data = { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - } + data = {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."} instance = AuthenticationMFAFailedDataError.from_dict(data) serialized = instance.to_dict() assert serialized["code"] == data["code"] @@ -3232,20 +1685,7 @@ def test_authentication_mfa_succeeded_round_trip(self): assert restored.to_dict() == serialized def test_authentication_mfa_succeeded_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "authentication.mfa_succeeded", - "data": { - "type": "mfa", - "status": "succeeded", - "ip_address": "203.0.113.42", - "user_agent": "Mozilla/5.0", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "authentication.mfa_succeeded", "data": {"type": "mfa", "status": "succeeded", "ip_address": "203.0.113.42", "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = AuthenticationMFASucceeded.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -3254,23 +1694,8 @@ def test_authentication_mfa_succeeded_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["object"] == data["object"] - def test_authentication_mfa_succeeded_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "authentication.mfa_succeeded", - "data": { - "type": "mfa", - "status": "succeeded", - "ip_address": "203.0.113.42", - "user_agent": "Mozilla/5.0", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + def test_authentication_mfa_succeeded_omits_absent_optional_non_nullable_fields(self): + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "authentication.mfa_succeeded", "data": {"type": "mfa", "status": "succeeded", "ip_address": "203.0.113.42", "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = AuthenticationMFASucceeded.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -3284,14 +1709,7 @@ def test_authentication_mfa_succeeded_data_round_trip(self): assert restored.to_dict() == serialized def test_authentication_mfa_succeeded_data_minimal_payload(self): - data = { - "type": "mfa", - "status": "succeeded", - "ip_address": None, - "user_agent": None, - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - } + data = {"type": "mfa", "status": "succeeded", "ip_address": None, "user_agent": None, "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com"} instance = AuthenticationMFASucceededData.from_dict(data) serialized = instance.to_dict() assert serialized["type"] == data["type"] @@ -3302,14 +1720,7 @@ def test_authentication_mfa_succeeded_data_minimal_payload(self): assert serialized["email"] == data["email"] def test_authentication_mfa_succeeded_data_preserves_nullable_fields(self): - data = { - "type": "mfa", - "status": "succeeded", - "ip_address": None, - "user_agent": None, - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - } + data = {"type": "mfa", "status": "succeeded", "ip_address": None, "user_agent": None, "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com"} instance = AuthenticationMFASucceededData.from_dict(data) serialized = instance.to_dict() assert serialized["ip_address"] is None @@ -3324,24 +1735,7 @@ def test_authentication_oauth_failed_round_trip(self): assert restored.to_dict() == serialized def test_authentication_oauth_failed_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "authentication.oauth_failed", - "data": { - "type": "oauth", - "status": "failed", - "ip_address": "203.0.113.42", - "user_agent": "Mozilla/5.0", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - "error": { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - }, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "authentication.oauth_failed", "data": {"type": "oauth", "status": "failed", "ip_address": "203.0.113.42", "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com", "error": {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."}}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = AuthenticationOAuthFailed.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -3350,27 +1744,8 @@ def test_authentication_oauth_failed_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["object"] == data["object"] - def test_authentication_oauth_failed_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "authentication.oauth_failed", - "data": { - "type": "oauth", - "status": "failed", - "ip_address": "203.0.113.42", - "user_agent": "Mozilla/5.0", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - "error": { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - }, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + def test_authentication_oauth_failed_omits_absent_optional_non_nullable_fields(self): + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "authentication.oauth_failed", "data": {"type": "oauth", "status": "failed", "ip_address": "203.0.113.42", "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com", "error": {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."}}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = AuthenticationOAuthFailed.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -3384,18 +1759,7 @@ def test_authentication_oauth_failed_data_round_trip(self): assert restored.to_dict() == serialized def test_authentication_oauth_failed_data_minimal_payload(self): - data = { - "type": "oauth", - "status": "failed", - "ip_address": None, - "user_agent": None, - "user_id": None, - "email": None, - "error": { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - }, - } + data = {"type": "oauth", "status": "failed", "ip_address": None, "user_agent": None, "user_id": None, "email": None, "error": {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."}} instance = AuthenticationOAuthFailedData.from_dict(data) serialized = instance.to_dict() assert serialized["type"] == data["type"] @@ -3407,18 +1771,7 @@ def test_authentication_oauth_failed_data_minimal_payload(self): assert serialized["error"] == data["error"] def test_authentication_oauth_failed_data_preserves_nullable_fields(self): - data = { - "type": "oauth", - "status": "failed", - "ip_address": None, - "user_agent": None, - "user_id": None, - "email": None, - "error": { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - }, - } + data = {"type": "oauth", "status": "failed", "ip_address": None, "user_agent": None, "user_id": None, "email": None, "error": {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."}} instance = AuthenticationOAuthFailedData.from_dict(data) serialized = instance.to_dict() assert serialized["ip_address"] is None @@ -3435,10 +1788,7 @@ def test_authentication_oauth_failed_data_error_round_trip(self): assert restored.to_dict() == serialized def test_authentication_oauth_failed_data_error_minimal_payload(self): - data = { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - } + data = {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."} instance = AuthenticationOAuthFailedDataError.from_dict(data) serialized = instance.to_dict() assert serialized["code"] == data["code"] @@ -3453,20 +1803,7 @@ def test_authentication_oauth_succeeded_round_trip(self): assert restored.to_dict() == serialized def test_authentication_oauth_succeeded_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "authentication.oauth_succeeded", - "data": { - "type": "oauth", - "status": "succeeded", - "ip_address": "203.0.113.42", - "user_agent": "Mozilla/5.0", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "authentication.oauth_succeeded", "data": {"type": "oauth", "status": "succeeded", "ip_address": "203.0.113.42", "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = AuthenticationOAuthSucceeded.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -3475,23 +1812,8 @@ def test_authentication_oauth_succeeded_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["object"] == data["object"] - def test_authentication_oauth_succeeded_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "authentication.oauth_succeeded", - "data": { - "type": "oauth", - "status": "succeeded", - "ip_address": "203.0.113.42", - "user_agent": "Mozilla/5.0", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + def test_authentication_oauth_succeeded_omits_absent_optional_non_nullable_fields(self): + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "authentication.oauth_succeeded", "data": {"type": "oauth", "status": "succeeded", "ip_address": "203.0.113.42", "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = AuthenticationOAuthSucceeded.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -3505,14 +1827,7 @@ def test_authentication_oauth_succeeded_data_round_trip(self): assert restored.to_dict() == serialized def test_authentication_oauth_succeeded_data_minimal_payload(self): - data = { - "type": "oauth", - "status": "succeeded", - "ip_address": None, - "user_agent": None, - "user_id": None, - "email": "user@example.com", - } + data = {"type": "oauth", "status": "succeeded", "ip_address": None, "user_agent": None, "user_id": None, "email": "user@example.com"} instance = AuthenticationOAuthSucceededData.from_dict(data) serialized = instance.to_dict() assert serialized["type"] == data["type"] @@ -3523,14 +1838,7 @@ def test_authentication_oauth_succeeded_data_minimal_payload(self): assert serialized["email"] == data["email"] def test_authentication_oauth_succeeded_data_preserves_nullable_fields(self): - data = { - "type": "oauth", - "status": "succeeded", - "ip_address": None, - "user_agent": None, - "user_id": None, - "email": "user@example.com", - } + data = {"type": "oauth", "status": "succeeded", "ip_address": None, "user_agent": None, "user_id": None, "email": "user@example.com"} instance = AuthenticationOAuthSucceededData.from_dict(data) serialized = instance.to_dict() assert serialized["ip_address"] is None @@ -3546,24 +1854,7 @@ def test_authentication_passkey_failed_round_trip(self): assert restored.to_dict() == serialized def test_authentication_passkey_failed_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "authentication.passkey_failed", - "data": { - "type": "passkey", - "status": "failed", - "ip_address": "203.0.113.42", - "user_agent": "Mozilla/5.0", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - "error": { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - }, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "authentication.passkey_failed", "data": {"type": "passkey", "status": "failed", "ip_address": "203.0.113.42", "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com", "error": {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."}}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = AuthenticationPasskeyFailed.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -3572,27 +1863,8 @@ def test_authentication_passkey_failed_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["object"] == data["object"] - def test_authentication_passkey_failed_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "authentication.passkey_failed", - "data": { - "type": "passkey", - "status": "failed", - "ip_address": "203.0.113.42", - "user_agent": "Mozilla/5.0", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - "error": { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - }, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + def test_authentication_passkey_failed_omits_absent_optional_non_nullable_fields(self): + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "authentication.passkey_failed", "data": {"type": "passkey", "status": "failed", "ip_address": "203.0.113.42", "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com", "error": {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."}}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = AuthenticationPasskeyFailed.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -3606,18 +1878,7 @@ def test_authentication_passkey_failed_data_round_trip(self): assert restored.to_dict() == serialized def test_authentication_passkey_failed_data_minimal_payload(self): - data = { - "type": "passkey", - "status": "failed", - "ip_address": None, - "user_agent": None, - "user_id": None, - "email": None, - "error": { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - }, - } + data = {"type": "passkey", "status": "failed", "ip_address": None, "user_agent": None, "user_id": None, "email": None, "error": {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."}} instance = AuthenticationPasskeyFailedData.from_dict(data) serialized = instance.to_dict() assert serialized["type"] == data["type"] @@ -3629,18 +1890,7 @@ def test_authentication_passkey_failed_data_minimal_payload(self): assert serialized["error"] == data["error"] def test_authentication_passkey_failed_data_preserves_nullable_fields(self): - data = { - "type": "passkey", - "status": "failed", - "ip_address": None, - "user_agent": None, - "user_id": None, - "email": None, - "error": { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - }, - } + data = {"type": "passkey", "status": "failed", "ip_address": None, "user_agent": None, "user_id": None, "email": None, "error": {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."}} instance = AuthenticationPasskeyFailedData.from_dict(data) serialized = instance.to_dict() assert serialized["ip_address"] is None @@ -3657,10 +1907,7 @@ def test_authentication_passkey_failed_data_error_round_trip(self): assert restored.to_dict() == serialized def test_authentication_passkey_failed_data_error_minimal_payload(self): - data = { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - } + data = {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."} instance = AuthenticationPasskeyFailedDataError.from_dict(data) serialized = instance.to_dict() assert serialized["code"] == data["code"] @@ -3675,20 +1922,7 @@ def test_authentication_passkey_succeeded_round_trip(self): assert restored.to_dict() == serialized def test_authentication_passkey_succeeded_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "authentication.passkey_succeeded", - "data": { - "type": "passkey", - "status": "succeeded", - "ip_address": "203.0.113.42", - "user_agent": "Mozilla/5.0", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "authentication.passkey_succeeded", "data": {"type": "passkey", "status": "succeeded", "ip_address": "203.0.113.42", "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = AuthenticationPasskeySucceeded.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -3697,23 +1931,8 @@ def test_authentication_passkey_succeeded_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["object"] == data["object"] - def test_authentication_passkey_succeeded_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "authentication.passkey_succeeded", - "data": { - "type": "passkey", - "status": "succeeded", - "ip_address": "203.0.113.42", - "user_agent": "Mozilla/5.0", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + def test_authentication_passkey_succeeded_omits_absent_optional_non_nullable_fields(self): + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "authentication.passkey_succeeded", "data": {"type": "passkey", "status": "succeeded", "ip_address": "203.0.113.42", "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = AuthenticationPasskeySucceeded.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -3727,14 +1946,7 @@ def test_authentication_passkey_succeeded_data_round_trip(self): assert restored.to_dict() == serialized def test_authentication_passkey_succeeded_data_minimal_payload(self): - data = { - "type": "passkey", - "status": "succeeded", - "ip_address": None, - "user_agent": None, - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - } + data = {"type": "passkey", "status": "succeeded", "ip_address": None, "user_agent": None, "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com"} instance = AuthenticationPasskeySucceededData.from_dict(data) serialized = instance.to_dict() assert serialized["type"] == data["type"] @@ -3745,14 +1957,7 @@ def test_authentication_passkey_succeeded_data_minimal_payload(self): assert serialized["email"] == data["email"] def test_authentication_passkey_succeeded_data_preserves_nullable_fields(self): - data = { - "type": "passkey", - "status": "succeeded", - "ip_address": None, - "user_agent": None, - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - } + data = {"type": "passkey", "status": "succeeded", "ip_address": None, "user_agent": None, "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com"} instance = AuthenticationPasskeySucceededData.from_dict(data) serialized = instance.to_dict() assert serialized["ip_address"] is None @@ -3767,24 +1972,7 @@ def test_authentication_password_failed_round_trip(self): assert restored.to_dict() == serialized def test_authentication_password_failed_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "authentication.password_failed", - "data": { - "type": "password", - "status": "failed", - "ip_address": "203.0.113.42", - "user_agent": "Mozilla/5.0", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - "error": { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - }, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "authentication.password_failed", "data": {"type": "password", "status": "failed", "ip_address": "203.0.113.42", "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com", "error": {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."}}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = AuthenticationPasswordFailed.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -3793,27 +1981,8 @@ def test_authentication_password_failed_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["object"] == data["object"] - def test_authentication_password_failed_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "authentication.password_failed", - "data": { - "type": "password", - "status": "failed", - "ip_address": "203.0.113.42", - "user_agent": "Mozilla/5.0", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - "error": { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - }, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + def test_authentication_password_failed_omits_absent_optional_non_nullable_fields(self): + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "authentication.password_failed", "data": {"type": "password", "status": "failed", "ip_address": "203.0.113.42", "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com", "error": {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."}}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = AuthenticationPasswordFailed.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -3827,18 +1996,7 @@ def test_authentication_password_failed_data_round_trip(self): assert restored.to_dict() == serialized def test_authentication_password_failed_data_minimal_payload(self): - data = { - "type": "password", - "status": "failed", - "ip_address": None, - "user_agent": None, - "user_id": None, - "email": None, - "error": { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - }, - } + data = {"type": "password", "status": "failed", "ip_address": None, "user_agent": None, "user_id": None, "email": None, "error": {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."}} instance = AuthenticationPasswordFailedData.from_dict(data) serialized = instance.to_dict() assert serialized["type"] == data["type"] @@ -3850,18 +2008,7 @@ def test_authentication_password_failed_data_minimal_payload(self): assert serialized["error"] == data["error"] def test_authentication_password_failed_data_preserves_nullable_fields(self): - data = { - "type": "password", - "status": "failed", - "ip_address": None, - "user_agent": None, - "user_id": None, - "email": None, - "error": { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - }, - } + data = {"type": "password", "status": "failed", "ip_address": None, "user_agent": None, "user_id": None, "email": None, "error": {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."}} instance = AuthenticationPasswordFailedData.from_dict(data) serialized = instance.to_dict() assert serialized["ip_address"] is None @@ -3878,10 +2025,7 @@ def test_authentication_password_failed_data_error_round_trip(self): assert restored.to_dict() == serialized def test_authentication_password_failed_data_error_minimal_payload(self): - data = { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - } + data = {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."} instance = AuthenticationPasswordFailedDataError.from_dict(data) serialized = instance.to_dict() assert serialized["code"] == data["code"] @@ -3896,20 +2040,7 @@ def test_authentication_password_succeeded_round_trip(self): assert restored.to_dict() == serialized def test_authentication_password_succeeded_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "authentication.password_succeeded", - "data": { - "type": "password", - "status": "succeeded", - "ip_address": "203.0.113.42", - "user_agent": "Mozilla/5.0", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "authentication.password_succeeded", "data": {"type": "password", "status": "succeeded", "ip_address": "203.0.113.42", "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = AuthenticationPasswordSucceeded.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -3918,23 +2049,8 @@ def test_authentication_password_succeeded_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["object"] == data["object"] - def test_authentication_password_succeeded_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "authentication.password_succeeded", - "data": { - "type": "password", - "status": "succeeded", - "ip_address": "203.0.113.42", - "user_agent": "Mozilla/5.0", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + def test_authentication_password_succeeded_omits_absent_optional_non_nullable_fields(self): + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "authentication.password_succeeded", "data": {"type": "password", "status": "succeeded", "ip_address": "203.0.113.42", "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = AuthenticationPasswordSucceeded.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -3948,14 +2064,7 @@ def test_authentication_password_succeeded_data_round_trip(self): assert restored.to_dict() == serialized def test_authentication_password_succeeded_data_minimal_payload(self): - data = { - "type": "password", - "status": "succeeded", - "ip_address": None, - "user_agent": None, - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - } + data = {"type": "password", "status": "succeeded", "ip_address": None, "user_agent": None, "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com"} instance = AuthenticationPasswordSucceededData.from_dict(data) serialized = instance.to_dict() assert serialized["type"] == data["type"] @@ -3966,14 +2075,7 @@ def test_authentication_password_succeeded_data_minimal_payload(self): assert serialized["email"] == data["email"] def test_authentication_password_succeeded_data_preserves_nullable_fields(self): - data = { - "type": "password", - "status": "succeeded", - "ip_address": None, - "user_agent": None, - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - } + data = {"type": "password", "status": "succeeded", "ip_address": None, "user_agent": None, "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com"} instance = AuthenticationPasswordSucceededData.from_dict(data) serialized = instance.to_dict() assert serialized["ip_address"] is None @@ -3988,22 +2090,7 @@ def test_authentication_radar_risk_detected_round_trip(self): assert restored.to_dict() == serialized def test_authentication_radar_risk_detected_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "authentication.radar_risk_detected", - "data": { - "auth_method": "password", - "action": "signup", - "control": "block", - "blocklist_type": "ip", - "ip_address": "203.0.113.42", - "user_agent": "Mozilla/5.0", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "authentication.radar_risk_detected", "data": {"auth_method": "password", "action": "signup", "control": "block", "blocklist_type": "ip", "ip_address": "203.0.113.42", "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = AuthenticationRadarRiskDetected.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -4012,25 +2099,8 @@ def test_authentication_radar_risk_detected_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["object"] == data["object"] - def test_authentication_radar_risk_detected_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "authentication.radar_risk_detected", - "data": { - "auth_method": "password", - "action": "signup", - "control": "block", - "blocklist_type": "ip", - "ip_address": "203.0.113.42", - "user_agent": "Mozilla/5.0", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + def test_authentication_radar_risk_detected_omits_absent_optional_non_nullable_fields(self): + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "authentication.radar_risk_detected", "data": {"auth_method": "password", "action": "signup", "control": "block", "blocklist_type": "ip", "ip_address": "203.0.113.42", "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = AuthenticationRadarRiskDetected.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -4044,16 +2114,7 @@ def test_authentication_radar_risk_detected_data_round_trip(self): assert restored.to_dict() == serialized def test_authentication_radar_risk_detected_data_minimal_payload(self): - data = { - "auth_method": "password", - "action": "signup", - "control": None, - "blocklist_type": None, - "ip_address": None, - "user_agent": None, - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - } + data = {"auth_method": "password", "action": "signup", "control": None, "blocklist_type": None, "ip_address": None, "user_agent": None, "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com"} instance = AuthenticationRadarRiskDetectedData.from_dict(data) serialized = instance.to_dict() assert serialized["auth_method"] == data["auth_method"] @@ -4066,16 +2127,7 @@ def test_authentication_radar_risk_detected_data_minimal_payload(self): assert serialized["email"] == data["email"] def test_authentication_radar_risk_detected_data_preserves_nullable_fields(self): - data = { - "auth_method": "password", - "action": "signup", - "control": None, - "blocklist_type": None, - "ip_address": None, - "user_agent": None, - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - } + data = {"auth_method": "password", "action": "signup", "control": None, "blocklist_type": None, "ip_address": None, "user_agent": None, "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com"} instance = AuthenticationRadarRiskDetectedData.from_dict(data) serialized = instance.to_dict() assert serialized["control"] is None @@ -4083,19 +2135,8 @@ def test_authentication_radar_risk_detected_data_preserves_nullable_fields(self) assert serialized["ip_address"] is None assert serialized["user_agent"] is None - def test_authentication_radar_risk_detected_data_round_trips_unknown_enum_values( - self, - ): - data = { - "auth_method": "password", - "action": "unexpected_authentication_radar_risk_detected_data_action", - "control": "block", - "blocklist_type": "ip", - "ip_address": "203.0.113.42", - "user_agent": "Mozilla/5.0", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - } + def test_authentication_radar_risk_detected_data_round_trips_unknown_enum_values(self): + data = {"auth_method": "password", "action": "unexpected_authentication_radar_risk_detected_data_action", "control": "block", "blocklist_type": "ip", "ip_address": "203.0.113.42", "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com"} instance = AuthenticationRadarRiskDetectedData.from_dict(data) assert instance.to_dict() == data @@ -4108,29 +2149,7 @@ def test_authentication_sso_failed_round_trip(self): assert restored.to_dict() == serialized def test_authentication_sso_failed_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "authentication.sso_failed", - "data": { - "type": "sso", - "status": "failed", - "ip_address": "203.0.113.42", - "user_agent": "Mozilla/5.0", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - "sso": { - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", - "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5", - }, - "error": { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - }, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "authentication.sso_failed", "data": {"type": "sso", "status": "failed", "ip_address": "203.0.113.42", "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com", "sso": {"organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5"}, "error": {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."}}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = AuthenticationSSOFailed.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -4140,29 +2159,7 @@ def test_authentication_sso_failed_minimal_payload(self): assert serialized["object"] == data["object"] def test_authentication_sso_failed_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "authentication.sso_failed", - "data": { - "type": "sso", - "status": "failed", - "ip_address": "203.0.113.42", - "user_agent": "Mozilla/5.0", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - "sso": { - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", - "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5", - }, - "error": { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - }, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "authentication.sso_failed", "data": {"type": "sso", "status": "failed", "ip_address": "203.0.113.42", "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com", "sso": {"organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5"}, "error": {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."}}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = AuthenticationSSOFailed.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -4176,23 +2173,7 @@ def test_authentication_sso_failed_data_round_trip(self): assert restored.to_dict() == serialized def test_authentication_sso_failed_data_minimal_payload(self): - data = { - "type": "sso", - "status": "failed", - "ip_address": None, - "user_agent": None, - "user_id": None, - "email": None, - "sso": { - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", - "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5", - }, - "error": { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - }, - } + data = {"type": "sso", "status": "failed", "ip_address": None, "user_agent": None, "user_id": None, "email": None, "sso": {"organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5"}, "error": {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."}} instance = AuthenticationSSOFailedData.from_dict(data) serialized = instance.to_dict() assert serialized["type"] == data["type"] @@ -4205,23 +2186,7 @@ def test_authentication_sso_failed_data_minimal_payload(self): assert serialized["error"] == data["error"] def test_authentication_sso_failed_data_preserves_nullable_fields(self): - data = { - "type": "sso", - "status": "failed", - "ip_address": None, - "user_agent": None, - "user_id": None, - "email": None, - "sso": { - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", - "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5", - }, - "error": { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - }, - } + data = {"type": "sso", "status": "failed", "ip_address": None, "user_agent": None, "user_id": None, "email": None, "sso": {"organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5"}, "error": {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."}} instance = AuthenticationSSOFailedData.from_dict(data) serialized = instance.to_dict() assert serialized["ip_address"] is None @@ -4262,10 +2227,7 @@ def test_authentication_sso_failed_data_error_round_trip(self): assert restored.to_dict() == serialized def test_authentication_sso_failed_data_error_minimal_payload(self): - data = { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - } + data = {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."} instance = AuthenticationSSOFailedDataError.from_dict(data) serialized = instance.to_dict() assert serialized["code"] == data["code"] @@ -4280,25 +2242,7 @@ def test_authentication_sso_started_round_trip(self): assert restored.to_dict() == serialized def test_authentication_sso_started_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "authentication.sso_started", - "data": { - "type": "sso", - "status": "started", - "ip_address": "203.0.113.42", - "user_agent": "Mozilla/5.0", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - "sso": { - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", - "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5", - }, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "authentication.sso_started", "data": {"type": "sso", "status": "started", "ip_address": "203.0.113.42", "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com", "sso": {"organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5"}}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = AuthenticationSSOStarted.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -4308,25 +2252,7 @@ def test_authentication_sso_started_minimal_payload(self): assert serialized["object"] == data["object"] def test_authentication_sso_started_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "authentication.sso_started", - "data": { - "type": "sso", - "status": "started", - "ip_address": "203.0.113.42", - "user_agent": "Mozilla/5.0", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - "sso": { - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", - "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5", - }, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "authentication.sso_started", "data": {"type": "sso", "status": "started", "ip_address": "203.0.113.42", "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com", "sso": {"organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5"}}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = AuthenticationSSOStarted.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -4340,19 +2266,7 @@ def test_authentication_sso_started_data_round_trip(self): assert restored.to_dict() == serialized def test_authentication_sso_started_data_minimal_payload(self): - data = { - "type": "sso", - "status": "started", - "ip_address": None, - "user_agent": None, - "user_id": None, - "email": None, - "sso": { - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", - "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5", - }, - } + data = {"type": "sso", "status": "started", "ip_address": None, "user_agent": None, "user_id": None, "email": None, "sso": {"organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5"}} instance = AuthenticationSSOStartedData.from_dict(data) serialized = instance.to_dict() assert serialized["type"] == data["type"] @@ -4364,19 +2278,7 @@ def test_authentication_sso_started_data_minimal_payload(self): assert serialized["sso"] == data["sso"] def test_authentication_sso_started_data_preserves_nullable_fields(self): - data = { - "type": "sso", - "status": "started", - "ip_address": None, - "user_agent": None, - "user_id": None, - "email": None, - "sso": { - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", - "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5", - }, - } + data = {"type": "sso", "status": "started", "ip_address": None, "user_agent": None, "user_id": None, "email": None, "sso": {"organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5"}} instance = AuthenticationSSOStartedData.from_dict(data) serialized = instance.to_dict() assert serialized["ip_address"] is None @@ -4417,25 +2319,7 @@ def test_authentication_sso_succeeded_round_trip(self): assert restored.to_dict() == serialized def test_authentication_sso_succeeded_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "authentication.sso_succeeded", - "data": { - "type": "sso", - "status": "succeeded", - "ip_address": "203.0.113.42", - "user_agent": "Mozilla/5.0", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - "sso": { - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", - "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5", - }, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "authentication.sso_succeeded", "data": {"type": "sso", "status": "succeeded", "ip_address": "203.0.113.42", "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com", "sso": {"organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5"}}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = AuthenticationSSOSucceeded.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -4444,28 +2328,8 @@ def test_authentication_sso_succeeded_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["object"] == data["object"] - def test_authentication_sso_succeeded_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "authentication.sso_succeeded", - "data": { - "type": "sso", - "status": "succeeded", - "ip_address": "203.0.113.42", - "user_agent": "Mozilla/5.0", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - "sso": { - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", - "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5", - }, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + def test_authentication_sso_succeeded_omits_absent_optional_non_nullable_fields(self): + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "authentication.sso_succeeded", "data": {"type": "sso", "status": "succeeded", "ip_address": "203.0.113.42", "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com", "sso": {"organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5"}}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = AuthenticationSSOSucceeded.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -4479,19 +2343,7 @@ def test_authentication_sso_succeeded_data_round_trip(self): assert restored.to_dict() == serialized def test_authentication_sso_succeeded_data_minimal_payload(self): - data = { - "type": "sso", - "status": "succeeded", - "ip_address": None, - "user_agent": None, - "user_id": None, - "email": "user@example.com", - "sso": { - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", - "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5", - }, - } + data = {"type": "sso", "status": "succeeded", "ip_address": None, "user_agent": None, "user_id": None, "email": "user@example.com", "sso": {"organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5"}} instance = AuthenticationSSOSucceededData.from_dict(data) serialized = instance.to_dict() assert serialized["type"] == data["type"] @@ -4503,19 +2355,7 @@ def test_authentication_sso_succeeded_data_minimal_payload(self): assert serialized["sso"] == data["sso"] def test_authentication_sso_succeeded_data_preserves_nullable_fields(self): - data = { - "type": "sso", - "status": "succeeded", - "ip_address": None, - "user_agent": None, - "user_id": None, - "email": "user@example.com", - "sso": { - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", - "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5", - }, - } + data = {"type": "sso", "status": "succeeded", "ip_address": None, "user_agent": None, "user_id": None, "email": "user@example.com", "sso": {"organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5"}} instance = AuthenticationSSOSucceededData.from_dict(data) serialized = instance.to_dict() assert serialized["ip_address"] is None @@ -4555,29 +2395,7 @@ def test_authentication_sso_timed_out_round_trip(self): assert restored.to_dict() == serialized def test_authentication_sso_timed_out_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "authentication.sso_timed_out", - "data": { - "type": "sso", - "status": "timed_out", - "ip_address": "203.0.113.42", - "user_agent": "Mozilla/5.0", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - "sso": { - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", - "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5", - }, - "error": { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - }, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "authentication.sso_timed_out", "data": {"type": "sso", "status": "timed_out", "ip_address": "203.0.113.42", "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com", "sso": {"organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5"}, "error": {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."}}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = AuthenticationSSOTimedOut.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -4586,32 +2404,8 @@ def test_authentication_sso_timed_out_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["object"] == data["object"] - def test_authentication_sso_timed_out_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "authentication.sso_timed_out", - "data": { - "type": "sso", - "status": "timed_out", - "ip_address": "203.0.113.42", - "user_agent": "Mozilla/5.0", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "user@example.com", - "sso": { - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", - "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5", - }, - "error": { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - }, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + def test_authentication_sso_timed_out_omits_absent_optional_non_nullable_fields(self): + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "authentication.sso_timed_out", "data": {"type": "sso", "status": "timed_out", "ip_address": "203.0.113.42", "user_agent": "Mozilla/5.0", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "user@example.com", "sso": {"organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5"}, "error": {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."}}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = AuthenticationSSOTimedOut.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -4625,23 +2419,7 @@ def test_authentication_sso_timed_out_data_round_trip(self): assert restored.to_dict() == serialized def test_authentication_sso_timed_out_data_minimal_payload(self): - data = { - "type": "sso", - "status": "timed_out", - "ip_address": None, - "user_agent": None, - "user_id": None, - "email": None, - "sso": { - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", - "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5", - }, - "error": { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - }, - } + data = {"type": "sso", "status": "timed_out", "ip_address": None, "user_agent": None, "user_id": None, "email": None, "sso": {"organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5"}, "error": {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."}} instance = AuthenticationSSOTimedOutData.from_dict(data) serialized = instance.to_dict() assert serialized["type"] == data["type"] @@ -4654,23 +2432,7 @@ def test_authentication_sso_timed_out_data_minimal_payload(self): assert serialized["error"] == data["error"] def test_authentication_sso_timed_out_data_preserves_nullable_fields(self): - data = { - "type": "sso", - "status": "timed_out", - "ip_address": None, - "user_agent": None, - "user_id": None, - "email": None, - "sso": { - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", - "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5", - }, - "error": { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - }, - } + data = {"type": "sso", "status": "timed_out", "ip_address": None, "user_agent": None, "user_id": None, "email": None, "sso": {"organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", "session_id": "sess_01E4ZCR3C56J083X43JQXF3JK5"}, "error": {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."}} instance = AuthenticationSSOTimedOutData.from_dict(data) serialized = instance.to_dict() assert serialized["ip_address"] is None @@ -4711,10 +2473,7 @@ def test_authentication_sso_timed_out_data_error_round_trip(self): assert restored.to_dict() == serialized def test_authentication_sso_timed_out_data_error_minimal_payload(self): - data = { - "code": "mfa_challenge_failed", - "message": "The MFA challenge has failed.", - } + data = {"code": "mfa_challenge_failed", "message": "The MFA challenge has failed."} instance = AuthenticationSSOTimedOutDataError.from_dict(data) serialized = instance.to_dict() assert serialized["code"] == data["code"] @@ -4729,31 +2488,7 @@ def test_connection_activated_round_trip(self): assert restored.to_dict() == serialized def test_connection_activated_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "connection.activated", - "data": { - "object": "connection", - "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", - "state": "active", - "name": "Acme SSO", - "connection_type": "OktaSAML", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", - "status": "linked", - "domains": [ - { - "object": "connection_domain", - "id": "conn_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", - "domain": "acme.com", - } - ], - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "connection.activated", "data": {"object": "connection", "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", "state": "active", "name": "Acme SSO", "connection_type": "OktaSAML", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", "status": "linked", "domains": [{"object": "connection_domain", "id": "conn_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", "domain": "acme.com"}]}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = ConnectionActivated.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -4763,31 +2498,7 @@ def test_connection_activated_minimal_payload(self): assert serialized["object"] == data["object"] def test_connection_activated_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "connection.activated", - "data": { - "object": "connection", - "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", - "state": "active", - "name": "Acme SSO", - "connection_type": "OktaSAML", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", - "status": "linked", - "domains": [ - { - "object": "connection_domain", - "id": "conn_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", - "domain": "acme.com", - } - ], - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "connection.activated", "data": {"object": "connection", "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", "state": "active", "name": "Acme SSO", "connection_type": "OktaSAML", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", "status": "linked", "domains": [{"object": "connection_domain", "id": "conn_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", "domain": "acme.com"}]}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = ConnectionActivated.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -4801,24 +2512,7 @@ def test_connection_activated_data_round_trip(self): assert restored.to_dict() == serialized def test_connection_activated_data_minimal_payload(self): - data = { - "object": "connection", - "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", - "state": "active", - "name": "Acme SSO", - "connection_type": "OktaSAML", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", - "status": "linked", - "domains": [ - { - "object": "connection_domain", - "id": "conn_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", - "domain": "acme.com", - } - ], - } + data = {"object": "connection", "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", "state": "active", "name": "Acme SSO", "connection_type": "OktaSAML", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", "status": "linked", "domains": [{"object": "connection_domain", "id": "conn_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", "domain": "acme.com"}]} instance = ConnectionActivatedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -4833,48 +2527,13 @@ def test_connection_activated_data_minimal_payload(self): assert serialized["domains"] == data["domains"] def test_connection_activated_data_omits_absent_optional_non_nullable_fields(self): - data = { - "object": "connection", - "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", - "state": "active", - "name": "Acme SSO", - "connection_type": "OktaSAML", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", - "status": "linked", - "domains": [ - { - "object": "connection_domain", - "id": "conn_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", - "domain": "acme.com", - } - ], - } + data = {"object": "connection", "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", "state": "active", "name": "Acme SSO", "connection_type": "OktaSAML", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", "status": "linked", "domains": [{"object": "connection_domain", "id": "conn_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", "domain": "acme.com"}]} instance = ConnectionActivatedData.from_dict(data) serialized = instance.to_dict() assert "organization_id" not in serialized def test_connection_activated_data_round_trips_unknown_enum_values(self): - data = { - "object": "connection", - "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", - "state": "unexpected_connection_activated_data_state", - "name": "Acme SSO", - "connection_type": "OktaSAML", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", - "status": "linked", - "domains": [ - { - "object": "connection_domain", - "id": "conn_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", - "domain": "acme.com", - } - ], - } + data = {"object": "connection", "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", "state": "unexpected_connection_activated_data_state", "name": "Acme SSO", "connection_type": "OktaSAML", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", "status": "linked", "domains": [{"object": "connection_domain", "id": "conn_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", "domain": "acme.com"}]} instance = ConnectionActivatedData.from_dict(data) assert instance.to_dict() == data @@ -4887,11 +2546,7 @@ def test_connection_activated_data_domain_round_trip(self): assert restored.to_dict() == serialized def test_connection_activated_data_domain_minimal_payload(self): - data = { - "object": "connection_domain", - "id": "conn_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", - "domain": "acme.com", - } + data = {"object": "connection_domain", "id": "conn_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", "domain": "acme.com"} instance = ConnectionActivatedDataDomain.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -4907,31 +2562,7 @@ def test_connection_deactivated_round_trip(self): assert restored.to_dict() == serialized def test_connection_deactivated_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "connection.deactivated", - "data": { - "object": "connection", - "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", - "state": "active", - "name": "Acme SSO", - "connection_type": "OktaSAML", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", - "status": "linked", - "domains": [ - { - "object": "connection_domain", - "id": "conn_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", - "domain": "acme.com", - } - ], - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "connection.deactivated", "data": {"object": "connection", "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", "state": "active", "name": "Acme SSO", "connection_type": "OktaSAML", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", "status": "linked", "domains": [{"object": "connection_domain", "id": "conn_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", "domain": "acme.com"}]}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = ConnectionDeactivated.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -4941,31 +2572,7 @@ def test_connection_deactivated_minimal_payload(self): assert serialized["object"] == data["object"] def test_connection_deactivated_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "connection.deactivated", - "data": { - "object": "connection", - "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", - "state": "active", - "name": "Acme SSO", - "connection_type": "OktaSAML", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", - "status": "linked", - "domains": [ - { - "object": "connection_domain", - "id": "conn_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", - "domain": "acme.com", - } - ], - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "connection.deactivated", "data": {"object": "connection", "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", "state": "active", "name": "Acme SSO", "connection_type": "OktaSAML", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", "status": "linked", "domains": [{"object": "connection_domain", "id": "conn_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", "domain": "acme.com"}]}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = ConnectionDeactivated.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -4979,24 +2586,7 @@ def test_connection_deactivated_data_round_trip(self): assert restored.to_dict() == serialized def test_connection_deactivated_data_minimal_payload(self): - data = { - "object": "connection", - "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", - "state": "active", - "name": "Acme SSO", - "connection_type": "OktaSAML", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", - "status": "linked", - "domains": [ - { - "object": "connection_domain", - "id": "conn_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", - "domain": "acme.com", - } - ], - } + data = {"object": "connection", "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", "state": "active", "name": "Acme SSO", "connection_type": "OktaSAML", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", "status": "linked", "domains": [{"object": "connection_domain", "id": "conn_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", "domain": "acme.com"}]} instance = ConnectionDeactivatedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -5010,51 +2600,14 @@ def test_connection_deactivated_data_minimal_payload(self): assert serialized["status"] == data["status"] assert serialized["domains"] == data["domains"] - def test_connection_deactivated_data_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "object": "connection", - "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", - "state": "active", - "name": "Acme SSO", - "connection_type": "OktaSAML", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", - "status": "linked", - "domains": [ - { - "object": "connection_domain", - "id": "conn_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", - "domain": "acme.com", - } - ], - } + def test_connection_deactivated_data_omits_absent_optional_non_nullable_fields(self): + data = {"object": "connection", "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", "state": "active", "name": "Acme SSO", "connection_type": "OktaSAML", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", "status": "linked", "domains": [{"object": "connection_domain", "id": "conn_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", "domain": "acme.com"}]} instance = ConnectionDeactivatedData.from_dict(data) serialized = instance.to_dict() assert "organization_id" not in serialized def test_connection_deactivated_data_round_trips_unknown_enum_values(self): - data = { - "object": "connection", - "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", - "state": "unexpected_connection_deactivated_data_state", - "name": "Acme SSO", - "connection_type": "OktaSAML", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", - "status": "linked", - "domains": [ - { - "object": "connection_domain", - "id": "conn_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", - "domain": "acme.com", - } - ], - } + data = {"object": "connection", "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", "state": "unexpected_connection_deactivated_data_state", "name": "Acme SSO", "connection_type": "OktaSAML", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", "status": "linked", "domains": [{"object": "connection_domain", "id": "conn_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", "domain": "acme.com"}]} instance = ConnectionDeactivatedData.from_dict(data) assert instance.to_dict() == data @@ -5067,11 +2620,7 @@ def test_connection_deactivated_data_domain_round_trip(self): assert restored.to_dict() == serialized def test_connection_deactivated_data_domain_minimal_payload(self): - data = { - "object": "connection_domain", - "id": "conn_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", - "domain": "acme.com", - } + data = {"object": "connection_domain", "id": "conn_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", "domain": "acme.com"} instance = ConnectionDeactivatedDataDomain.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -5087,22 +2636,7 @@ def test_connection_deleted_round_trip(self): assert restored.to_dict() == serialized def test_connection_deleted_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "connection.deleted", - "data": { - "object": "connection", - "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", - "state": "active", - "name": "Acme SSO", - "connection_type": "OktaSAML", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "connection.deleted", "data": {"object": "connection", "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", "state": "active", "name": "Acme SSO", "connection_type": "OktaSAML", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = ConnectionDeleted.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -5112,22 +2646,7 @@ def test_connection_deleted_minimal_payload(self): assert serialized["object"] == data["object"] def test_connection_deleted_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "connection.deleted", - "data": { - "object": "connection", - "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", - "state": "active", - "name": "Acme SSO", - "connection_type": "OktaSAML", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "connection.deleted", "data": {"object": "connection", "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", "state": "active", "name": "Acme SSO", "connection_type": "OktaSAML", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = ConnectionDeleted.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -5141,15 +2660,7 @@ def test_connection_deleted_data_round_trip(self): assert restored.to_dict() == serialized def test_connection_deleted_data_minimal_payload(self): - data = { - "object": "connection", - "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", - "state": "active", - "name": "Acme SSO", - "connection_type": "OktaSAML", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "connection", "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", "state": "active", "name": "Acme SSO", "connection_type": "OktaSAML", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = ConnectionDeletedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -5161,30 +2672,13 @@ def test_connection_deleted_data_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_connection_deleted_data_omits_absent_optional_non_nullable_fields(self): - data = { - "object": "connection", - "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", - "state": "active", - "name": "Acme SSO", - "connection_type": "OktaSAML", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "connection", "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", "state": "active", "name": "Acme SSO", "connection_type": "OktaSAML", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = ConnectionDeletedData.from_dict(data) serialized = instance.to_dict() assert "organization_id" not in serialized def test_connection_deleted_data_round_trips_unknown_enum_values(self): - data = { - "object": "connection", - "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", - "state": "unexpected_connection_deleted_data_state", - "name": "Acme SSO", - "connection_type": "OktaSAML", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "connection", "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", "state": "unexpected_connection_deleted_data_state", "name": "Acme SSO", "connection_type": "OktaSAML", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = ConnectionDeletedData.from_dict(data) assert instance.to_dict() == data @@ -5197,24 +2691,7 @@ def test_connection_saml_certificate_renewal_required_round_trip(self): assert restored.to_dict() == serialized def test_connection_saml_certificate_renewal_required_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "connection.saml_certificate_renewal_required", - "data": { - "connection": { - "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - }, - "certificate": { - "certificate_type": "ResponseSigning", - "expiry_date": "2026-01-15T12:00:00.000Z", - "is_expired": False, - }, - "days_until_expiry": 30, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "connection.saml_certificate_renewal_required", "data": {"connection": {"id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY"}, "certificate": {"certificate_type": "ResponseSigning", "expiry_date": "2026-01-15T12:00:00.000Z", "is_expired": False}, "days_until_expiry": 30}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = ConnectionSAMLCertificateRenewalRequired.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -5223,27 +2700,8 @@ def test_connection_saml_certificate_renewal_required_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["object"] == data["object"] - def test_connection_saml_certificate_renewal_required_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "connection.saml_certificate_renewal_required", - "data": { - "connection": { - "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - }, - "certificate": { - "certificate_type": "ResponseSigning", - "expiry_date": "2026-01-15T12:00:00.000Z", - "is_expired": False, - }, - "days_until_expiry": 30, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + def test_connection_saml_certificate_renewal_required_omits_absent_optional_non_nullable_fields(self): + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "connection.saml_certificate_renewal_required", "data": {"connection": {"id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY"}, "certificate": {"certificate_type": "ResponseSigning", "expiry_date": "2026-01-15T12:00:00.000Z", "is_expired": False}, "days_until_expiry": 30}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = ConnectionSAMLCertificateRenewalRequired.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -5257,103 +2715,52 @@ def test_connection_saml_certificate_renewal_required_data_round_trip(self): assert restored.to_dict() == serialized def test_connection_saml_certificate_renewal_required_data_minimal_payload(self): - data = { - "connection": { - "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - }, - "certificate": { - "certificate_type": "ResponseSigning", - "expiry_date": "2026-01-15T12:00:00.000Z", - "is_expired": False, - }, - "days_until_expiry": 30, - } + data = {"connection": {"id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY"}, "certificate": {"certificate_type": "ResponseSigning", "expiry_date": "2026-01-15T12:00:00.000Z", "is_expired": False}, "days_until_expiry": 30} instance = ConnectionSAMLCertificateRenewalRequiredData.from_dict(data) serialized = instance.to_dict() assert serialized["connection"] == data["connection"] assert serialized["certificate"] == data["certificate"] assert serialized["days_until_expiry"] == data["days_until_expiry"] - def test_connection_saml_certificate_renewal_required_data_connection_round_trip( - self, - ): - data = load_fixture( - "connection_saml_certificate_renewal_required_data_connection.json" - ) - instance = ConnectionSAMLCertificateRenewalRequiredDataConnection.from_dict( - data - ) + def test_connection_saml_certificate_renewal_required_data_connection_round_trip(self): + data = load_fixture("connection_saml_certificate_renewal_required_data_connection.json") + instance = ConnectionSAMLCertificateRenewalRequiredDataConnection.from_dict(data) serialized = instance.to_dict() assert serialized == data - restored = ConnectionSAMLCertificateRenewalRequiredDataConnection.from_dict( - serialized - ) + restored = ConnectionSAMLCertificateRenewalRequiredDataConnection.from_dict(serialized) assert restored.to_dict() == serialized - def test_connection_saml_certificate_renewal_required_data_connection_minimal_payload( - self, - ): + def test_connection_saml_certificate_renewal_required_data_connection_minimal_payload(self): data = {"id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY"} - instance = ConnectionSAMLCertificateRenewalRequiredDataConnection.from_dict( - data - ) + instance = ConnectionSAMLCertificateRenewalRequiredDataConnection.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] - def test_connection_saml_certificate_renewal_required_data_connection_omits_absent_optional_non_nullable_fields( - self, - ): + def test_connection_saml_certificate_renewal_required_data_connection_omits_absent_optional_non_nullable_fields(self): data = {"id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY"} - instance = ConnectionSAMLCertificateRenewalRequiredDataConnection.from_dict( - data - ) + instance = ConnectionSAMLCertificateRenewalRequiredDataConnection.from_dict(data) serialized = instance.to_dict() assert "organization_id" not in serialized - def test_connection_saml_certificate_renewal_required_data_certificate_round_trip( - self, - ): - data = load_fixture( - "connection_saml_certificate_renewal_required_data_certificate.json" - ) - instance = ConnectionSAMLCertificateRenewalRequiredDataCertificate.from_dict( - data - ) - serialized = instance.to_dict() - assert serialized == data - restored = ConnectionSAMLCertificateRenewalRequiredDataCertificate.from_dict( - serialized - ) - assert restored.to_dict() == serialized - - def test_connection_saml_certificate_renewal_required_data_certificate_minimal_payload( - self, - ): - data = { - "certificate_type": "ResponseSigning", - "expiry_date": "2026-01-15T12:00:00.000Z", - "is_expired": False, - } - instance = ConnectionSAMLCertificateRenewalRequiredDataCertificate.from_dict( - data - ) + def test_connection_saml_certificate_renewal_required_data_certificate_round_trip(self): + data = load_fixture("connection_saml_certificate_renewal_required_data_certificate.json") + instance = ConnectionSAMLCertificateRenewalRequiredDataCertificate.from_dict(data) + serialized = instance.to_dict() + assert serialized == data + restored = ConnectionSAMLCertificateRenewalRequiredDataCertificate.from_dict(serialized) + assert restored.to_dict() == serialized + + def test_connection_saml_certificate_renewal_required_data_certificate_minimal_payload(self): + data = {"certificate_type": "ResponseSigning", "expiry_date": "2026-01-15T12:00:00.000Z", "is_expired": False} + instance = ConnectionSAMLCertificateRenewalRequiredDataCertificate.from_dict(data) serialized = instance.to_dict() assert serialized["certificate_type"] == data["certificate_type"] assert serialized["expiry_date"] == data["expiry_date"] assert serialized["is_expired"] == data["is_expired"] - def test_connection_saml_certificate_renewal_required_data_certificate_round_trips_unknown_enum_values( - self, - ): - data = { - "certificate_type": "unexpected_connection_saml_certificate_renewal_required_data_certificate_certificate_type", - "expiry_date": "2026-01-15T12:00:00.000Z", - "is_expired": False, - } - instance = ConnectionSAMLCertificateRenewalRequiredDataCertificate.from_dict( - data - ) + def test_connection_saml_certificate_renewal_required_data_certificate_round_trips_unknown_enum_values(self): + data = {"certificate_type": "unexpected_connection_saml_certificate_renewal_required_data_certificate_certificate_type", "expiry_date": "2026-01-15T12:00:00.000Z", "is_expired": False} + instance = ConnectionSAMLCertificateRenewalRequiredDataCertificate.from_dict(data) assert instance.to_dict() == data def test_connection_saml_certificate_renewed_round_trip(self): @@ -5365,23 +2772,7 @@ def test_connection_saml_certificate_renewed_round_trip(self): assert restored.to_dict() == serialized def test_connection_saml_certificate_renewed_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "connection.saml_certificate_renewed", - "data": { - "connection": { - "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - }, - "certificate": { - "certificate_type": "ResponseSigning", - "expiry_date": "2026-01-15T12:00:00.000Z", - }, - "renewed_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "connection.saml_certificate_renewed", "data": {"connection": {"id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY"}, "certificate": {"certificate_type": "ResponseSigning", "expiry_date": "2026-01-15T12:00:00.000Z"}, "renewed_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = ConnectionSAMLCertificateRenewed.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -5390,26 +2781,8 @@ def test_connection_saml_certificate_renewed_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["object"] == data["object"] - def test_connection_saml_certificate_renewed_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "connection.saml_certificate_renewed", - "data": { - "connection": { - "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - }, - "certificate": { - "certificate_type": "ResponseSigning", - "expiry_date": "2026-01-15T12:00:00.000Z", - }, - "renewed_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + def test_connection_saml_certificate_renewed_omits_absent_optional_non_nullable_fields(self): + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "connection.saml_certificate_renewed", "data": {"connection": {"id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY"}, "certificate": {"certificate_type": "ResponseSigning", "expiry_date": "2026-01-15T12:00:00.000Z"}, "renewed_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = ConnectionSAMLCertificateRenewed.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -5423,17 +2796,7 @@ def test_connection_saml_certificate_renewed_data_round_trip(self): assert restored.to_dict() == serialized def test_connection_saml_certificate_renewed_data_minimal_payload(self): - data = { - "connection": { - "id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - }, - "certificate": { - "certificate_type": "ResponseSigning", - "expiry_date": "2026-01-15T12:00:00.000Z", - }, - "renewed_at": "2026-01-15T12:00:00.000Z", - } + data = {"connection": {"id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY"}, "certificate": {"certificate_type": "ResponseSigning", "expiry_date": "2026-01-15T12:00:00.000Z"}, "renewed_at": "2026-01-15T12:00:00.000Z"} instance = ConnectionSAMLCertificateRenewedData.from_dict(data) serialized = instance.to_dict() assert serialized["connection"] == data["connection"] @@ -5454,9 +2817,7 @@ def test_connection_saml_certificate_renewed_data_connection_minimal_payload(sel serialized = instance.to_dict() assert serialized["id"] == data["id"] - def test_connection_saml_certificate_renewed_data_connection_omits_absent_optional_non_nullable_fields( - self, - ): + def test_connection_saml_certificate_renewed_data_connection_omits_absent_optional_non_nullable_fields(self): data = {"id": "conn_01EHWNCE74X7JSDV0X3SZ3KJNY"} instance = ConnectionSAMLCertificateRenewedDataConnection.from_dict(data) serialized = instance.to_dict() @@ -5471,22 +2832,14 @@ def test_connection_saml_certificate_renewed_data_certificate_round_trip(self): assert restored.to_dict() == serialized def test_connection_saml_certificate_renewed_data_certificate_minimal_payload(self): - data = { - "certificate_type": "ResponseSigning", - "expiry_date": "2026-01-15T12:00:00.000Z", - } + data = {"certificate_type": "ResponseSigning", "expiry_date": "2026-01-15T12:00:00.000Z"} instance = ConnectionSAMLCertificateRenewedDataCertificate.from_dict(data) serialized = instance.to_dict() assert serialized["certificate_type"] == data["certificate_type"] assert serialized["expiry_date"] == data["expiry_date"] - def test_connection_saml_certificate_renewed_data_certificate_round_trips_unknown_enum_values( - self, - ): - data = { - "certificate_type": "unexpected_connection_saml_certificate_renewed_data_certificate_certificate_type", - "expiry_date": "2026-01-15T12:00:00.000Z", - } + def test_connection_saml_certificate_renewed_data_certificate_round_trips_unknown_enum_values(self): + data = {"certificate_type": "unexpected_connection_saml_certificate_renewed_data_certificate_certificate_type", "expiry_date": "2026-01-15T12:00:00.000Z"} instance = ConnectionSAMLCertificateRenewedDataCertificate.from_dict(data) assert instance.to_dict() == data @@ -5499,30 +2852,7 @@ def test_dsync_activated_round_trip(self): assert restored.to_dict() == serialized def test_dsync_activated_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "dsync.activated", - "data": { - "object": "directory", - "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "type": "okta scim v2.0", - "state": "active", - "name": "Acme Directory", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", - "domains": [ - { - "object": "organization_domain", - "id": "org_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", - "domain": "acme.com", - } - ], - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "dsync.activated", "data": {"object": "directory", "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "type": "okta scim v2.0", "state": "active", "name": "Acme Directory", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", "domains": [{"object": "organization_domain", "id": "org_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", "domain": "acme.com"}]}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = DsyncActivated.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -5532,30 +2862,7 @@ def test_dsync_activated_minimal_payload(self): assert serialized["object"] == data["object"] def test_dsync_activated_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "dsync.activated", - "data": { - "object": "directory", - "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "type": "okta scim v2.0", - "state": "active", - "name": "Acme Directory", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", - "domains": [ - { - "object": "organization_domain", - "id": "org_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", - "domain": "acme.com", - } - ], - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "dsync.activated", "data": {"object": "directory", "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "type": "okta scim v2.0", "state": "active", "name": "Acme Directory", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", "domains": [{"object": "organization_domain", "id": "org_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", "domain": "acme.com"}]}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = DsyncActivated.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -5569,23 +2876,7 @@ def test_dsync_activated_data_round_trip(self): assert restored.to_dict() == serialized def test_dsync_activated_data_minimal_payload(self): - data = { - "object": "directory", - "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", - "type": "okta scim v2.0", - "state": "active", - "name": "Acme Directory", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", - "domains": [ - { - "object": "organization_domain", - "id": "org_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", - "domain": "acme.com", - } - ], - } + data = {"object": "directory", "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", "type": "okta scim v2.0", "state": "active", "name": "Acme Directory", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", "domains": [{"object": "organization_domain", "id": "org_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", "domain": "acme.com"}]} instance = DsyncActivatedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -5599,46 +2890,13 @@ def test_dsync_activated_data_minimal_payload(self): assert serialized["domains"] == data["domains"] def test_dsync_activated_data_omits_absent_optional_non_nullable_fields(self): - data = { - "object": "directory", - "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", - "type": "okta scim v2.0", - "state": "active", - "name": "Acme Directory", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", - "domains": [ - { - "object": "organization_domain", - "id": "org_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", - "domain": "acme.com", - } - ], - } + data = {"object": "directory", "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", "type": "okta scim v2.0", "state": "active", "name": "Acme Directory", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", "domains": [{"object": "organization_domain", "id": "org_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", "domain": "acme.com"}]} instance = DsyncActivatedData.from_dict(data) serialized = instance.to_dict() assert "organization_id" not in serialized def test_dsync_activated_data_round_trips_unknown_enum_values(self): - data = { - "object": "directory", - "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "type": "unexpected_dsync_activated_data_type", - "state": "active", - "name": "Acme Directory", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", - "domains": [ - { - "object": "organization_domain", - "id": "org_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", - "domain": "acme.com", - } - ], - } + data = {"object": "directory", "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "type": "unexpected_dsync_activated_data_type", "state": "active", "name": "Acme Directory", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", "domains": [{"object": "organization_domain", "id": "org_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", "domain": "acme.com"}]} instance = DsyncActivatedData.from_dict(data) assert instance.to_dict() == data @@ -5651,11 +2909,7 @@ def test_dsync_activated_data_domain_round_trip(self): assert restored.to_dict() == serialized def test_dsync_activated_data_domain_minimal_payload(self): - data = { - "object": "organization_domain", - "id": "org_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", - "domain": "acme.com", - } + data = {"object": "organization_domain", "id": "org_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", "domain": "acme.com"} instance = DsyncActivatedDataDomain.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -5671,30 +2925,7 @@ def test_dsync_deactivated_round_trip(self): assert restored.to_dict() == serialized def test_dsync_deactivated_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "dsync.deactivated", - "data": { - "object": "directory", - "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "type": "okta scim v2.0", - "state": "active", - "name": "Acme Directory", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", - "domains": [ - { - "object": "organization_domain", - "id": "org_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", - "domain": "acme.com", - } - ], - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "dsync.deactivated", "data": {"object": "directory", "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "type": "okta scim v2.0", "state": "active", "name": "Acme Directory", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", "domains": [{"object": "organization_domain", "id": "org_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", "domain": "acme.com"}]}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = DsyncDeactivated.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -5704,30 +2935,7 @@ def test_dsync_deactivated_minimal_payload(self): assert serialized["object"] == data["object"] def test_dsync_deactivated_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "dsync.deactivated", - "data": { - "object": "directory", - "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "type": "okta scim v2.0", - "state": "active", - "name": "Acme Directory", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", - "domains": [ - { - "object": "organization_domain", - "id": "org_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", - "domain": "acme.com", - } - ], - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "dsync.deactivated", "data": {"object": "directory", "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "type": "okta scim v2.0", "state": "active", "name": "Acme Directory", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", "domains": [{"object": "organization_domain", "id": "org_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", "domain": "acme.com"}]}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = DsyncDeactivated.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -5741,23 +2949,7 @@ def test_dsync_deactivated_data_round_trip(self): assert restored.to_dict() == serialized def test_dsync_deactivated_data_minimal_payload(self): - data = { - "object": "directory", - "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", - "type": "okta scim v2.0", - "state": "active", - "name": "Acme Directory", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", - "domains": [ - { - "object": "organization_domain", - "id": "org_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", - "domain": "acme.com", - } - ], - } + data = {"object": "directory", "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", "type": "okta scim v2.0", "state": "active", "name": "Acme Directory", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", "domains": [{"object": "organization_domain", "id": "org_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", "domain": "acme.com"}]} instance = DsyncDeactivatedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -5771,46 +2963,13 @@ def test_dsync_deactivated_data_minimal_payload(self): assert serialized["domains"] == data["domains"] def test_dsync_deactivated_data_omits_absent_optional_non_nullable_fields(self): - data = { - "object": "directory", - "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", - "type": "okta scim v2.0", - "state": "active", - "name": "Acme Directory", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", - "domains": [ - { - "object": "organization_domain", - "id": "org_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", - "domain": "acme.com", - } - ], - } + data = {"object": "directory", "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", "type": "okta scim v2.0", "state": "active", "name": "Acme Directory", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", "domains": [{"object": "organization_domain", "id": "org_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", "domain": "acme.com"}]} instance = DsyncDeactivatedData.from_dict(data) serialized = instance.to_dict() assert "organization_id" not in serialized def test_dsync_deactivated_data_round_trips_unknown_enum_values(self): - data = { - "object": "directory", - "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "type": "unexpected_dsync_deactivated_data_type", - "state": "active", - "name": "Acme Directory", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", - "domains": [ - { - "object": "organization_domain", - "id": "org_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", - "domain": "acme.com", - } - ], - } + data = {"object": "directory", "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "type": "unexpected_dsync_deactivated_data_type", "state": "active", "name": "Acme Directory", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "external_key": "ext_01EHWNCE74X7JSDV0X3SZ3KJNY", "domains": [{"object": "organization_domain", "id": "org_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", "domain": "acme.com"}]} instance = DsyncDeactivatedData.from_dict(data) assert instance.to_dict() == data @@ -5823,11 +2982,7 @@ def test_dsync_deactivated_data_domain_round_trip(self): assert restored.to_dict() == serialized def test_dsync_deactivated_data_domain_minimal_payload(self): - data = { - "object": "organization_domain", - "id": "org_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", - "domain": "acme.com", - } + data = {"object": "organization_domain", "id": "org_domain_01EHWNCE74X7JSDV0X3SZ3KJNY", "domain": "acme.com"} instance = DsyncDeactivatedDataDomain.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -5843,22 +2998,7 @@ def test_dsync_deleted_round_trip(self): assert restored.to_dict() == serialized def test_dsync_deleted_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "dsync.deleted", - "data": { - "object": "directory", - "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "type": "okta scim v2.0", - "state": "active", - "name": "Acme Directory", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "dsync.deleted", "data": {"object": "directory", "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "type": "okta scim v2.0", "state": "active", "name": "Acme Directory", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = DsyncDeleted.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -5868,22 +3008,7 @@ def test_dsync_deleted_minimal_payload(self): assert serialized["object"] == data["object"] def test_dsync_deleted_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "dsync.deleted", - "data": { - "object": "directory", - "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "type": "okta scim v2.0", - "state": "active", - "name": "Acme Directory", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "dsync.deleted", "data": {"object": "directory", "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "type": "okta scim v2.0", "state": "active", "name": "Acme Directory", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = DsyncDeleted.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -5897,15 +3022,7 @@ def test_dsync_deleted_data_round_trip(self): assert restored.to_dict() == serialized def test_dsync_deleted_data_minimal_payload(self): - data = { - "object": "directory", - "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", - "type": "okta scim v2.0", - "state": "active", - "name": "Acme Directory", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "directory", "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", "type": "okta scim v2.0", "state": "active", "name": "Acme Directory", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = DsyncDeletedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -5917,30 +3034,13 @@ def test_dsync_deleted_data_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_dsync_deleted_data_omits_absent_optional_non_nullable_fields(self): - data = { - "object": "directory", - "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", - "type": "okta scim v2.0", - "state": "active", - "name": "Acme Directory", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "directory", "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", "type": "okta scim v2.0", "state": "active", "name": "Acme Directory", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = DsyncDeletedData.from_dict(data) serialized = instance.to_dict() assert "organization_id" not in serialized def test_dsync_deleted_data_round_trips_unknown_enum_values(self): - data = { - "object": "directory", - "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "type": "unexpected_dsync_deleted_data_type", - "state": "active", - "name": "Acme Directory", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "directory", "id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "type": "unexpected_dsync_deleted_data_type", "state": "active", "name": "Acme Directory", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = DsyncDeletedData.from_dict(data) assert instance.to_dict() == data @@ -5953,23 +3053,7 @@ def test_dsync_group_created_round_trip(self): assert restored.to_dict() == serialized def test_dsync_group_created_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "dsync.group.created", - "data": { - "object": "directory_group", - "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", - "idp_id": "02grqrue4294w24", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "name": "Developers", - "raw_attributes": {"key": {}}, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "dsync.group.created", "data": {"object": "directory_group", "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", "idp_id": "02grqrue4294w24", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "name": "Developers", "raw_attributes": {"key": {}}, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = DsyncGroupCreated.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -5979,23 +3063,7 @@ def test_dsync_group_created_minimal_payload(self): assert serialized["object"] == data["object"] def test_dsync_group_created_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "dsync.group.created", - "data": { - "object": "directory_group", - "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", - "idp_id": "02grqrue4294w24", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "name": "Developers", - "raw_attributes": {"key": {}}, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "dsync.group.created", "data": {"object": "directory_group", "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", "idp_id": "02grqrue4294w24", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "name": "Developers", "raw_attributes": {"key": {}}, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = DsyncGroupCreated.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -6009,23 +3077,7 @@ def test_dsync_group_deleted_round_trip(self): assert restored.to_dict() == serialized def test_dsync_group_deleted_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "dsync.group.deleted", - "data": { - "object": "directory_group", - "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", - "idp_id": "02grqrue4294w24", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "name": "Developers", - "raw_attributes": {"key": {}}, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "dsync.group.deleted", "data": {"object": "directory_group", "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", "idp_id": "02grqrue4294w24", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "name": "Developers", "raw_attributes": {"key": {}}, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = DsyncGroupDeleted.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -6035,23 +3087,7 @@ def test_dsync_group_deleted_minimal_payload(self): assert serialized["object"] == data["object"] def test_dsync_group_deleted_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "dsync.group.deleted", - "data": { - "object": "directory_group", - "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", - "idp_id": "02grqrue4294w24", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "name": "Developers", - "raw_attributes": {"key": {}}, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "dsync.group.deleted", "data": {"object": "directory_group", "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", "idp_id": "02grqrue4294w24", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "name": "Developers", "raw_attributes": {"key": {}}, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = DsyncGroupDeleted.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -6065,24 +3101,7 @@ def test_dsync_group_updated_round_trip(self): assert restored.to_dict() == serialized def test_dsync_group_updated_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "dsync.group.updated", - "data": { - "object": "directory_group", - "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", - "idp_id": "02grqrue4294w24", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "name": "Developers", - "raw_attributes": {"key": {}}, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "previous_attributes": {"key": {}}, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "dsync.group.updated", "data": {"object": "directory_group", "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", "idp_id": "02grqrue4294w24", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "name": "Developers", "raw_attributes": {"key": {}}, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "previous_attributes": {"key": {}}}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = DsyncGroupUpdated.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -6092,24 +3111,7 @@ def test_dsync_group_updated_minimal_payload(self): assert serialized["object"] == data["object"] def test_dsync_group_updated_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "dsync.group.updated", - "data": { - "object": "directory_group", - "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", - "idp_id": "02grqrue4294w24", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "name": "Developers", - "raw_attributes": {"key": {}}, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "previous_attributes": {"key": {}}, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "dsync.group.updated", "data": {"object": "directory_group", "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", "idp_id": "02grqrue4294w24", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "name": "Developers", "raw_attributes": {"key": {}}, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "previous_attributes": {"key": {}}}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = DsyncGroupUpdated.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -6123,16 +3125,7 @@ def test_dsync_group_updated_data_round_trip(self): assert restored.to_dict() == serialized def test_dsync_group_updated_data_minimal_payload(self): - data = { - "object": "directory_group", - "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", - "idp_id": "02grqrue4294w24", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "name": "Developers", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "directory_group", "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", "idp_id": "02grqrue4294w24", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "name": "Developers", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = DsyncGroupUpdatedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -6145,16 +3138,7 @@ def test_dsync_group_updated_data_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_dsync_group_updated_data_omits_absent_optional_non_nullable_fields(self): - data = { - "object": "directory_group", - "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", - "idp_id": "02grqrue4294w24", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "name": "Developers", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "directory_group", "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", "idp_id": "02grqrue4294w24", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "name": "Developers", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = DsyncGroupUpdatedData.from_dict(data) serialized = instance.to_dict() assert "raw_attributes" not in serialized @@ -6169,55 +3153,7 @@ def test_dsync_group_user_added_round_trip(self): assert restored.to_dict() == serialized def test_dsync_group_user_added_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "dsync.group.user_added", - "data": { - "directory_id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", - "user": { - "object": "directory_user", - "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "idp_id": "2836", - "email": "marcelina.davis@example.com", - "first_name": "Marcelina", - "last_name": "Davis", - "emails": [ - { - "primary": True, - "type": "work", - "value": "marcelina.davis@example.com", - } - ], - "job_title": "Software Engineer", - "username": "mdavis", - "state": "active", - "raw_attributes": {"key": {}}, - "custom_attributes": { - "department": "Engineering", - "job_title": "Software Engineer", - }, - "role": {"slug": "admin"}, - "roles": [{"slug": "admin"}], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "group": { - "object": "directory_group", - "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", - "idp_id": "02grqrue4294w24", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "name": "Developers", - "raw_attributes": {"key": {}}, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "dsync.group.user_added", "data": {"directory_id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", "user": {"object": "directory_user", "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "idp_id": "2836", "email": "marcelina.davis@example.com", "first_name": "Marcelina", "last_name": "Davis", "emails": [{"primary": True, "type": "work", "value": "marcelina.davis@example.com"}], "job_title": "Software Engineer", "username": "mdavis", "state": "active", "raw_attributes": {"key": {}}, "custom_attributes": {"department": "Engineering", "job_title": "Software Engineer"}, "role": {"slug": "admin"}, "roles": [{"slug": "admin"}], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "group": {"object": "directory_group", "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", "idp_id": "02grqrue4294w24", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "name": "Developers", "raw_attributes": {"key": {}}, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = DsyncGroupUserAdded.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -6227,55 +3163,7 @@ def test_dsync_group_user_added_minimal_payload(self): assert serialized["object"] == data["object"] def test_dsync_group_user_added_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "dsync.group.user_added", - "data": { - "directory_id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", - "user": { - "object": "directory_user", - "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "idp_id": "2836", - "email": "marcelina.davis@example.com", - "first_name": "Marcelina", - "last_name": "Davis", - "emails": [ - { - "primary": True, - "type": "work", - "value": "marcelina.davis@example.com", - } - ], - "job_title": "Software Engineer", - "username": "mdavis", - "state": "active", - "raw_attributes": {"key": {}}, - "custom_attributes": { - "department": "Engineering", - "job_title": "Software Engineer", - }, - "role": {"slug": "admin"}, - "roles": [{"slug": "admin"}], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "group": { - "object": "directory_group", - "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", - "idp_id": "02grqrue4294w24", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "name": "Developers", - "raw_attributes": {"key": {}}, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "dsync.group.user_added", "data": {"directory_id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", "user": {"object": "directory_user", "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "idp_id": "2836", "email": "marcelina.davis@example.com", "first_name": "Marcelina", "last_name": "Davis", "emails": [{"primary": True, "type": "work", "value": "marcelina.davis@example.com"}], "job_title": "Software Engineer", "username": "mdavis", "state": "active", "raw_attributes": {"key": {}}, "custom_attributes": {"department": "Engineering", "job_title": "Software Engineer"}, "role": {"slug": "admin"}, "roles": [{"slug": "admin"}], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "group": {"object": "directory_group", "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", "idp_id": "02grqrue4294w24", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "name": "Developers", "raw_attributes": {"key": {}}, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = DsyncGroupUserAdded.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -6289,49 +3177,7 @@ def test_dsync_group_user_added_data_round_trip(self): assert restored.to_dict() == serialized def test_dsync_group_user_added_data_minimal_payload(self): - data = { - "directory_id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", - "user": { - "object": "directory_user", - "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "idp_id": "2836", - "email": "marcelina.davis@example.com", - "first_name": "Marcelina", - "last_name": "Davis", - "emails": [ - { - "primary": True, - "type": "work", - "value": "marcelina.davis@example.com", - } - ], - "job_title": "Software Engineer", - "username": "mdavis", - "state": "active", - "raw_attributes": {"key": {}}, - "custom_attributes": { - "department": "Engineering", - "job_title": "Software Engineer", - }, - "role": {"slug": "admin"}, - "roles": [{"slug": "admin"}], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "group": { - "object": "directory_group", - "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", - "idp_id": "02grqrue4294w24", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "name": "Developers", - "raw_attributes": {"key": {}}, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - } + data = {"directory_id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", "user": {"object": "directory_user", "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "idp_id": "2836", "email": "marcelina.davis@example.com", "first_name": "Marcelina", "last_name": "Davis", "emails": [{"primary": True, "type": "work", "value": "marcelina.davis@example.com"}], "job_title": "Software Engineer", "username": "mdavis", "state": "active", "raw_attributes": {"key": {}}, "custom_attributes": {"department": "Engineering", "job_title": "Software Engineer"}, "role": {"slug": "admin"}, "roles": [{"slug": "admin"}], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "group": {"object": "directory_group", "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", "idp_id": "02grqrue4294w24", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "name": "Developers", "raw_attributes": {"key": {}}, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}} instance = DsyncGroupUserAddedData.from_dict(data) serialized = instance.to_dict() assert serialized["directory_id"] == data["directory_id"] @@ -6347,41 +3193,7 @@ def test_dsync_user_created_round_trip(self): assert restored.to_dict() == serialized def test_dsync_user_created_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "dsync.user.created", - "data": { - "object": "directory_user", - "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "idp_id": "2836", - "email": "marcelina.davis@example.com", - "first_name": "Marcelina", - "last_name": "Davis", - "emails": [ - { - "primary": True, - "type": "work", - "value": "marcelina.davis@example.com", - } - ], - "job_title": "Software Engineer", - "username": "mdavis", - "state": "active", - "raw_attributes": {"key": {}}, - "custom_attributes": { - "department": "Engineering", - "job_title": "Software Engineer", - }, - "role": {"slug": "admin"}, - "roles": [{"slug": "admin"}], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "dsync.user.created", "data": {"object": "directory_user", "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "idp_id": "2836", "email": "marcelina.davis@example.com", "first_name": "Marcelina", "last_name": "Davis", "emails": [{"primary": True, "type": "work", "value": "marcelina.davis@example.com"}], "job_title": "Software Engineer", "username": "mdavis", "state": "active", "raw_attributes": {"key": {}}, "custom_attributes": {"department": "Engineering", "job_title": "Software Engineer"}, "role": {"slug": "admin"}, "roles": [{"slug": "admin"}], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = DsyncUserCreated.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -6391,41 +3203,7 @@ def test_dsync_user_created_minimal_payload(self): assert serialized["object"] == data["object"] def test_dsync_user_created_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "dsync.user.created", - "data": { - "object": "directory_user", - "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "idp_id": "2836", - "email": "marcelina.davis@example.com", - "first_name": "Marcelina", - "last_name": "Davis", - "emails": [ - { - "primary": True, - "type": "work", - "value": "marcelina.davis@example.com", - } - ], - "job_title": "Software Engineer", - "username": "mdavis", - "state": "active", - "raw_attributes": {"key": {}}, - "custom_attributes": { - "department": "Engineering", - "job_title": "Software Engineer", - }, - "role": {"slug": "admin"}, - "roles": [{"slug": "admin"}], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "dsync.user.created", "data": {"object": "directory_user", "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "idp_id": "2836", "email": "marcelina.davis@example.com", "first_name": "Marcelina", "last_name": "Davis", "emails": [{"primary": True, "type": "work", "value": "marcelina.davis@example.com"}], "job_title": "Software Engineer", "username": "mdavis", "state": "active", "raw_attributes": {"key": {}}, "custom_attributes": {"department": "Engineering", "job_title": "Software Engineer"}, "role": {"slug": "admin"}, "roles": [{"slug": "admin"}], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = DsyncUserCreated.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -6439,41 +3217,7 @@ def test_dsync_user_deleted_round_trip(self): assert restored.to_dict() == serialized def test_dsync_user_deleted_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "dsync.user.deleted", - "data": { - "object": "directory_user", - "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "idp_id": "2836", - "email": "marcelina.davis@example.com", - "first_name": "Marcelina", - "last_name": "Davis", - "emails": [ - { - "primary": True, - "type": "work", - "value": "marcelina.davis@example.com", - } - ], - "job_title": "Software Engineer", - "username": "mdavis", - "state": "active", - "raw_attributes": {"key": {}}, - "custom_attributes": { - "department": "Engineering", - "job_title": "Software Engineer", - }, - "role": {"slug": "admin"}, - "roles": [{"slug": "admin"}], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "dsync.user.deleted", "data": {"object": "directory_user", "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "idp_id": "2836", "email": "marcelina.davis@example.com", "first_name": "Marcelina", "last_name": "Davis", "emails": [{"primary": True, "type": "work", "value": "marcelina.davis@example.com"}], "job_title": "Software Engineer", "username": "mdavis", "state": "active", "raw_attributes": {"key": {}}, "custom_attributes": {"department": "Engineering", "job_title": "Software Engineer"}, "role": {"slug": "admin"}, "roles": [{"slug": "admin"}], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = DsyncUserDeleted.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -6483,41 +3227,7 @@ def test_dsync_user_deleted_minimal_payload(self): assert serialized["object"] == data["object"] def test_dsync_user_deleted_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "dsync.user.deleted", - "data": { - "object": "directory_user", - "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "idp_id": "2836", - "email": "marcelina.davis@example.com", - "first_name": "Marcelina", - "last_name": "Davis", - "emails": [ - { - "primary": True, - "type": "work", - "value": "marcelina.davis@example.com", - } - ], - "job_title": "Software Engineer", - "username": "mdavis", - "state": "active", - "raw_attributes": {"key": {}}, - "custom_attributes": { - "department": "Engineering", - "job_title": "Software Engineer", - }, - "role": {"slug": "admin"}, - "roles": [{"slug": "admin"}], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "dsync.user.deleted", "data": {"object": "directory_user", "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "idp_id": "2836", "email": "marcelina.davis@example.com", "first_name": "Marcelina", "last_name": "Davis", "emails": [{"primary": True, "type": "work", "value": "marcelina.davis@example.com"}], "job_title": "Software Engineer", "username": "mdavis", "state": "active", "raw_attributes": {"key": {}}, "custom_attributes": {"department": "Engineering", "job_title": "Software Engineer"}, "role": {"slug": "admin"}, "roles": [{"slug": "admin"}], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = DsyncUserDeleted.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -6531,55 +3241,7 @@ def test_dsync_group_user_removed_round_trip(self): assert restored.to_dict() == serialized def test_dsync_group_user_removed_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "dsync.group.user_removed", - "data": { - "directory_id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", - "user": { - "object": "directory_user", - "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "idp_id": "2836", - "email": "marcelina.davis@example.com", - "first_name": "Marcelina", - "last_name": "Davis", - "emails": [ - { - "primary": True, - "type": "work", - "value": "marcelina.davis@example.com", - } - ], - "job_title": "Software Engineer", - "username": "mdavis", - "state": "active", - "raw_attributes": {"key": {}}, - "custom_attributes": { - "department": "Engineering", - "job_title": "Software Engineer", - }, - "role": {"slug": "admin"}, - "roles": [{"slug": "admin"}], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "group": { - "object": "directory_group", - "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", - "idp_id": "02grqrue4294w24", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "name": "Developers", - "raw_attributes": {"key": {}}, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "dsync.group.user_removed", "data": {"directory_id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", "user": {"object": "directory_user", "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "idp_id": "2836", "email": "marcelina.davis@example.com", "first_name": "Marcelina", "last_name": "Davis", "emails": [{"primary": True, "type": "work", "value": "marcelina.davis@example.com"}], "job_title": "Software Engineer", "username": "mdavis", "state": "active", "raw_attributes": {"key": {}}, "custom_attributes": {"department": "Engineering", "job_title": "Software Engineer"}, "role": {"slug": "admin"}, "roles": [{"slug": "admin"}], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "group": {"object": "directory_group", "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", "idp_id": "02grqrue4294w24", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "name": "Developers", "raw_attributes": {"key": {}}, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = DsyncGroupUserRemoved.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -6589,55 +3251,7 @@ def test_dsync_group_user_removed_minimal_payload(self): assert serialized["object"] == data["object"] def test_dsync_group_user_removed_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "dsync.group.user_removed", - "data": { - "directory_id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", - "user": { - "object": "directory_user", - "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "idp_id": "2836", - "email": "marcelina.davis@example.com", - "first_name": "Marcelina", - "last_name": "Davis", - "emails": [ - { - "primary": True, - "type": "work", - "value": "marcelina.davis@example.com", - } - ], - "job_title": "Software Engineer", - "username": "mdavis", - "state": "active", - "raw_attributes": {"key": {}}, - "custom_attributes": { - "department": "Engineering", - "job_title": "Software Engineer", - }, - "role": {"slug": "admin"}, - "roles": [{"slug": "admin"}], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "group": { - "object": "directory_group", - "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", - "idp_id": "02grqrue4294w24", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "name": "Developers", - "raw_attributes": {"key": {}}, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "dsync.group.user_removed", "data": {"directory_id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", "user": {"object": "directory_user", "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "idp_id": "2836", "email": "marcelina.davis@example.com", "first_name": "Marcelina", "last_name": "Davis", "emails": [{"primary": True, "type": "work", "value": "marcelina.davis@example.com"}], "job_title": "Software Engineer", "username": "mdavis", "state": "active", "raw_attributes": {"key": {}}, "custom_attributes": {"department": "Engineering", "job_title": "Software Engineer"}, "role": {"slug": "admin"}, "roles": [{"slug": "admin"}], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "group": {"object": "directory_group", "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", "idp_id": "02grqrue4294w24", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "name": "Developers", "raw_attributes": {"key": {}}, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = DsyncGroupUserRemoved.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -6651,49 +3265,7 @@ def test_dsync_group_user_removed_data_round_trip(self): assert restored.to_dict() == serialized def test_dsync_group_user_removed_data_minimal_payload(self): - data = { - "directory_id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", - "user": { - "object": "directory_user", - "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "idp_id": "2836", - "email": "marcelina.davis@example.com", - "first_name": "Marcelina", - "last_name": "Davis", - "emails": [ - { - "primary": True, - "type": "work", - "value": "marcelina.davis@example.com", - } - ], - "job_title": "Software Engineer", - "username": "mdavis", - "state": "active", - "raw_attributes": {"key": {}}, - "custom_attributes": { - "department": "Engineering", - "job_title": "Software Engineer", - }, - "role": {"slug": "admin"}, - "roles": [{"slug": "admin"}], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "group": { - "object": "directory_group", - "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", - "idp_id": "02grqrue4294w24", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "name": "Developers", - "raw_attributes": {"key": {}}, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - } + data = {"directory_id": "directory_01EHWNCE74X7JSDV0X3SZ3KJNY", "user": {"object": "directory_user", "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "idp_id": "2836", "email": "marcelina.davis@example.com", "first_name": "Marcelina", "last_name": "Davis", "emails": [{"primary": True, "type": "work", "value": "marcelina.davis@example.com"}], "job_title": "Software Engineer", "username": "mdavis", "state": "active", "raw_attributes": {"key": {}}, "custom_attributes": {"department": "Engineering", "job_title": "Software Engineer"}, "role": {"slug": "admin"}, "roles": [{"slug": "admin"}], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "group": {"object": "directory_group", "id": "directory_group_01E1JJS84MFPPQ3G655FHTKX6Z", "idp_id": "02grqrue4294w24", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "name": "Developers", "raw_attributes": {"key": {}}, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}} instance = DsyncGroupUserRemovedData.from_dict(data) serialized = instance.to_dict() assert serialized["directory_id"] == data["directory_id"] @@ -6709,42 +3281,7 @@ def test_dsync_user_updated_round_trip(self): assert restored.to_dict() == serialized def test_dsync_user_updated_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "dsync.user.updated", - "data": { - "object": "directory_user", - "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "idp_id": "2836", - "email": "marcelina.davis@example.com", - "first_name": "Marcelina", - "last_name": "Davis", - "emails": [ - { - "primary": True, - "type": "work", - "value": "marcelina.davis@example.com", - } - ], - "job_title": "Software Engineer", - "username": "mdavis", - "state": "active", - "raw_attributes": {"key": {}}, - "custom_attributes": { - "department": "Engineering", - "job_title": "Software Engineer", - }, - "role": {"slug": "admin"}, - "roles": [{"slug": "admin"}], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "previous_attributes": {"key": {}}, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "dsync.user.updated", "data": {"object": "directory_user", "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "idp_id": "2836", "email": "marcelina.davis@example.com", "first_name": "Marcelina", "last_name": "Davis", "emails": [{"primary": True, "type": "work", "value": "marcelina.davis@example.com"}], "job_title": "Software Engineer", "username": "mdavis", "state": "active", "raw_attributes": {"key": {}}, "custom_attributes": {"department": "Engineering", "job_title": "Software Engineer"}, "role": {"slug": "admin"}, "roles": [{"slug": "admin"}], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "previous_attributes": {"key": {}}}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = DsyncUserUpdated.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -6754,42 +3291,7 @@ def test_dsync_user_updated_minimal_payload(self): assert serialized["object"] == data["object"] def test_dsync_user_updated_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "dsync.user.updated", - "data": { - "object": "directory_user", - "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "idp_id": "2836", - "email": "marcelina.davis@example.com", - "first_name": "Marcelina", - "last_name": "Davis", - "emails": [ - { - "primary": True, - "type": "work", - "value": "marcelina.davis@example.com", - } - ], - "job_title": "Software Engineer", - "username": "mdavis", - "state": "active", - "raw_attributes": {"key": {}}, - "custom_attributes": { - "department": "Engineering", - "job_title": "Software Engineer", - }, - "role": {"slug": "admin"}, - "roles": [{"slug": "admin"}], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "previous_attributes": {"key": {}}, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "dsync.user.updated", "data": {"object": "directory_user", "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "idp_id": "2836", "email": "marcelina.davis@example.com", "first_name": "Marcelina", "last_name": "Davis", "emails": [{"primary": True, "type": "work", "value": "marcelina.davis@example.com"}], "job_title": "Software Engineer", "username": "mdavis", "state": "active", "raw_attributes": {"key": {}}, "custom_attributes": {"department": "Engineering", "job_title": "Software Engineer"}, "role": {"slug": "admin"}, "roles": [{"slug": "admin"}], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "previous_attributes": {"key": {}}}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = DsyncUserUpdated.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -6803,22 +3305,7 @@ def test_dsync_user_updated_data_round_trip(self): assert restored.to_dict() == serialized def test_dsync_user_updated_data_minimal_payload(self): - data = { - "object": "directory_user", - "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "idp_id": "2836", - "email": None, - "state": "active", - "raw_attributes": {"key": {}}, - "custom_attributes": { - "department": "Engineering", - "job_title": "Software Engineer", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "directory_user", "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "idp_id": "2836", "email": None, "state": "active", "raw_attributes": {"key": {}}, "custom_attributes": {"department": "Engineering", "job_title": "Software Engineer"}, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = DsyncUserUpdatedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -6834,26 +3321,7 @@ def test_dsync_user_updated_data_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_dsync_user_updated_data_omits_absent_optional_non_nullable_fields(self): - data = { - "object": "directory_user", - "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "idp_id": "2836", - "email": "marcelina.davis@example.com", - "first_name": "Marcelina", - "last_name": "Davis", - "job_title": "Software Engineer", - "username": "mdavis", - "state": "active", - "raw_attributes": {"key": {}}, - "custom_attributes": { - "department": "Engineering", - "job_title": "Software Engineer", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "directory_user", "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "idp_id": "2836", "email": "marcelina.davis@example.com", "first_name": "Marcelina", "last_name": "Davis", "job_title": "Software Engineer", "username": "mdavis", "state": "active", "raw_attributes": {"key": {}}, "custom_attributes": {"department": "Engineering", "job_title": "Software Engineer"}, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = DsyncUserUpdatedData.from_dict(data) serialized = instance.to_dict() assert "emails" not in serialized @@ -6862,36 +3330,7 @@ def test_dsync_user_updated_data_omits_absent_optional_non_nullable_fields(self) assert "previous_attributes" not in serialized def test_dsync_user_updated_data_preserves_nullable_fields(self): - data = { - "object": "directory_user", - "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "idp_id": "2836", - "email": None, - "first_name": None, - "last_name": None, - "emails": [ - { - "primary": True, - "type": "work", - "value": "marcelina.davis@example.com", - } - ], - "job_title": None, - "username": None, - "state": "active", - "raw_attributes": {"key": {}}, - "custom_attributes": { - "department": "Engineering", - "job_title": "Software Engineer", - }, - "role": {"slug": "admin"}, - "roles": [{"slug": "admin"}], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "previous_attributes": {"key": {}}, - } + data = {"object": "directory_user", "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "idp_id": "2836", "email": None, "first_name": None, "last_name": None, "emails": [{"primary": True, "type": "work", "value": "marcelina.davis@example.com"}], "job_title": None, "username": None, "state": "active", "raw_attributes": {"key": {}}, "custom_attributes": {"department": "Engineering", "job_title": "Software Engineer"}, "role": {"slug": "admin"}, "roles": [{"slug": "admin"}], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "previous_attributes": {"key": {}}} instance = DsyncUserUpdatedData.from_dict(data) serialized = instance.to_dict() assert serialized["email"] is None @@ -6901,36 +3340,7 @@ def test_dsync_user_updated_data_preserves_nullable_fields(self): assert serialized["username"] is None def test_dsync_user_updated_data_round_trips_unknown_enum_values(self): - data = { - "object": "directory_user", - "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", - "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", - "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", - "idp_id": "2836", - "email": "marcelina.davis@example.com", - "first_name": "Marcelina", - "last_name": "Davis", - "emails": [ - { - "primary": True, - "type": "work", - "value": "marcelina.davis@example.com", - } - ], - "job_title": "Software Engineer", - "username": "mdavis", - "state": "unexpected_dsync_user_updated_data_state", - "raw_attributes": {"key": {}}, - "custom_attributes": { - "department": "Engineering", - "job_title": "Software Engineer", - }, - "role": {"slug": "admin"}, - "roles": [{"slug": "admin"}], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "previous_attributes": {"key": {}}, - } + data = {"object": "directory_user", "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "idp_id": "2836", "email": "marcelina.davis@example.com", "first_name": "Marcelina", "last_name": "Davis", "emails": [{"primary": True, "type": "work", "value": "marcelina.davis@example.com"}], "job_title": "Software Engineer", "username": "mdavis", "state": "unexpected_dsync_user_updated_data_state", "raw_attributes": {"key": {}}, "custom_attributes": {"department": "Engineering", "job_title": "Software Engineer"}, "role": {"slug": "admin"}, "roles": [{"slug": "admin"}], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "previous_attributes": {"key": {}}} instance = DsyncUserUpdatedData.from_dict(data) assert instance.to_dict() == data @@ -6947,9 +3357,7 @@ def test_dsync_user_updated_data_email_minimal_payload(self): instance = DsyncUserUpdatedDataEmail.from_dict(data) assert instance.to_dict() is not None - def test_dsync_user_updated_data_email_omits_absent_optional_non_nullable_fields( - self, - ): + def test_dsync_user_updated_data_email_omits_absent_optional_non_nullable_fields(self): data = {"value": "marcelina.davis@example.com"} instance = DsyncUserUpdatedDataEmail.from_dict(data) serialized = instance.to_dict() @@ -6971,21 +3379,7 @@ def test_email_verification_created_round_trip(self): assert restored.to_dict() == serialized def test_email_verification_created_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "email_verification.created", - "data": { - "object": "email_verification", - "id": "email_verification_01E4ZCR3C56J083X43JQXF3JK5", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "expires_at": "2026-01-15T12:00:00.000Z", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "email_verification.created", "data": {"object": "email_verification", "id": "email_verification_01E4ZCR3C56J083X43JQXF3JK5", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "expires_at": "2026-01-15T12:00:00.000Z", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = EmailVerificationCreated.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -6995,21 +3389,7 @@ def test_email_verification_created_minimal_payload(self): assert serialized["object"] == data["object"] def test_email_verification_created_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "email_verification.created", - "data": { - "object": "email_verification", - "id": "email_verification_01E4ZCR3C56J083X43JQXF3JK5", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "expires_at": "2026-01-15T12:00:00.000Z", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "email_verification.created", "data": {"object": "email_verification", "id": "email_verification_01E4ZCR3C56J083X43JQXF3JK5", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "expires_at": "2026-01-15T12:00:00.000Z", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = EmailVerificationCreated.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -7023,15 +3403,7 @@ def test_email_verification_created_data_round_trip(self): assert restored.to_dict() == serialized def test_email_verification_created_data_minimal_payload(self): - data = { - "object": "email_verification", - "id": "email_verification_01E4ZCR3C56J083X43JQXF3JK5", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "expires_at": "2026-01-15T12:00:00.000Z", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "email_verification", "id": "email_verification_01E4ZCR3C56J083X43JQXF3JK5", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "expires_at": "2026-01-15T12:00:00.000Z", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = EmailVerificationCreatedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -7051,38 +3423,7 @@ def test_flag_created_round_trip(self): assert restored.to_dict() == serialized def test_flag_created_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "flag.created", - "data": { - "object": "feature_flag", - "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT", - "environment_id": "environment_01EHWNCE74X7JSDV0X3SZ3KJNY", - "slug": "advanced-analytics", - "name": "Advanced Analytics", - "description": "Enable advanced analytics dashboard feature", - "owner": { - "email": "jane@example.com", - "first_name": "Jane", - "last_name": "Doe", - }, - "tags": ["reports"], - "enabled": True, - "default_value": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "context": { - "client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor": { - "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "source": "api", - "name": "Jane Doe", - }, - }, - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "flag.created", "data": {"object": "feature_flag", "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT", "environment_id": "environment_01EHWNCE74X7JSDV0X3SZ3KJNY", "slug": "advanced-analytics", "name": "Advanced Analytics", "description": "Enable advanced analytics dashboard feature", "owner": {"email": "jane@example.com", "first_name": "Jane", "last_name": "Doe"}, "tags": ["reports"], "enabled": True, "default_value": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "context": {"client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor": {"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "source": "api", "name": "Jane Doe"}}, "object": "event"} instance = FlagCreated.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -7101,20 +3442,7 @@ def test_flag_created_data_round_trip(self): assert restored.to_dict() == serialized def test_flag_created_data_minimal_payload(self): - data = { - "object": "feature_flag", - "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT", - "environment_id": "environment_01EHWNCE74X7JSDV0X3SZ3KJNY", - "slug": "advanced-analytics", - "name": "Advanced Analytics", - "description": None, - "owner": None, - "tags": ["reports"], - "enabled": True, - "default_value": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "feature_flag", "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT", "environment_id": "environment_01EHWNCE74X7JSDV0X3SZ3KJNY", "slug": "advanced-analytics", "name": "Advanced Analytics", "description": None, "owner": None, "tags": ["reports"], "enabled": True, "default_value": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = FlagCreatedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -7131,20 +3459,7 @@ def test_flag_created_data_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_flag_created_data_preserves_nullable_fields(self): - data = { - "object": "feature_flag", - "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT", - "environment_id": "environment_01EHWNCE74X7JSDV0X3SZ3KJNY", - "slug": "advanced-analytics", - "name": "Advanced Analytics", - "description": None, - "owner": None, - "tags": ["reports"], - "enabled": True, - "default_value": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "feature_flag", "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT", "environment_id": "environment_01EHWNCE74X7JSDV0X3SZ3KJNY", "slug": "advanced-analytics", "name": "Advanced Analytics", "description": None, "owner": None, "tags": ["reports"], "enabled": True, "default_value": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = FlagCreatedData.from_dict(data) serialized = instance.to_dict() assert serialized["description"] is None @@ -7182,14 +3497,7 @@ def test_flag_created_context_round_trip(self): assert restored.to_dict() == serialized def test_flag_created_context_minimal_payload(self): - data = { - "client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor": { - "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "source": "api", - "name": "Jane Doe", - }, - } + data = {"client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor": {"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "source": "api", "name": "Jane Doe"}} instance = FlagCreatedContext.from_dict(data) serialized = instance.to_dict() assert serialized["client_id"] == data["client_id"] @@ -7218,11 +3526,7 @@ def test_flag_created_context_actor_preserves_nullable_fields(self): assert serialized["name"] is None def test_flag_created_context_actor_round_trips_unknown_enum_values(self): - data = { - "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "source": "unexpected_flag_created_context_actor_source", - "name": "Jane Doe", - } + data = {"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "source": "unexpected_flag_created_context_actor_source", "name": "Jane Doe"} instance = FlagCreatedContextActor.from_dict(data) assert instance.to_dict() == data @@ -7235,38 +3539,7 @@ def test_flag_deleted_round_trip(self): assert restored.to_dict() == serialized def test_flag_deleted_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "flag.deleted", - "data": { - "object": "feature_flag", - "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT", - "environment_id": "environment_01EHWNCE74X7JSDV0X3SZ3KJNY", - "slug": "advanced-analytics", - "name": "Advanced Analytics", - "description": "Enable advanced analytics dashboard feature", - "owner": { - "email": "jane@example.com", - "first_name": "Jane", - "last_name": "Doe", - }, - "tags": ["reports"], - "enabled": True, - "default_value": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "context": { - "client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor": { - "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "source": "api", - "name": "Jane Doe", - }, - }, - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "flag.deleted", "data": {"object": "feature_flag", "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT", "environment_id": "environment_01EHWNCE74X7JSDV0X3SZ3KJNY", "slug": "advanced-analytics", "name": "Advanced Analytics", "description": "Enable advanced analytics dashboard feature", "owner": {"email": "jane@example.com", "first_name": "Jane", "last_name": "Doe"}, "tags": ["reports"], "enabled": True, "default_value": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "context": {"client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor": {"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "source": "api", "name": "Jane Doe"}}, "object": "event"} instance = FlagDeleted.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -7285,20 +3558,7 @@ def test_flag_deleted_data_round_trip(self): assert restored.to_dict() == serialized def test_flag_deleted_data_minimal_payload(self): - data = { - "object": "feature_flag", - "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT", - "environment_id": "environment_01EHWNCE74X7JSDV0X3SZ3KJNY", - "slug": "advanced-analytics", - "name": "Advanced Analytics", - "description": None, - "owner": None, - "tags": ["reports"], - "enabled": True, - "default_value": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "feature_flag", "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT", "environment_id": "environment_01EHWNCE74X7JSDV0X3SZ3KJNY", "slug": "advanced-analytics", "name": "Advanced Analytics", "description": None, "owner": None, "tags": ["reports"], "enabled": True, "default_value": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = FlagDeletedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -7315,20 +3575,7 @@ def test_flag_deleted_data_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_flag_deleted_data_preserves_nullable_fields(self): - data = { - "object": "feature_flag", - "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT", - "environment_id": "environment_01EHWNCE74X7JSDV0X3SZ3KJNY", - "slug": "advanced-analytics", - "name": "Advanced Analytics", - "description": None, - "owner": None, - "tags": ["reports"], - "enabled": True, - "default_value": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "feature_flag", "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT", "environment_id": "environment_01EHWNCE74X7JSDV0X3SZ3KJNY", "slug": "advanced-analytics", "name": "Advanced Analytics", "description": None, "owner": None, "tags": ["reports"], "enabled": True, "default_value": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = FlagDeletedData.from_dict(data) serialized = instance.to_dict() assert serialized["description"] is None @@ -7366,14 +3613,7 @@ def test_flag_deleted_context_round_trip(self): assert restored.to_dict() == serialized def test_flag_deleted_context_minimal_payload(self): - data = { - "client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor": { - "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "source": "api", - "name": "Jane Doe", - }, - } + data = {"client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor": {"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "source": "api", "name": "Jane Doe"}} instance = FlagDeletedContext.from_dict(data) serialized = instance.to_dict() assert serialized["client_id"] == data["client_id"] @@ -7402,11 +3642,7 @@ def test_flag_deleted_context_actor_preserves_nullable_fields(self): assert serialized["name"] is None def test_flag_deleted_context_actor_round_trips_unknown_enum_values(self): - data = { - "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "source": "unexpected_flag_deleted_context_actor_source", - "name": "Jane Doe", - } + data = {"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "source": "unexpected_flag_deleted_context_actor_source", "name": "Jane Doe"} instance = FlagDeletedContextActor.from_dict(data) assert instance.to_dict() == data @@ -7419,70 +3655,7 @@ def test_flag_rule_updated_round_trip(self): assert restored.to_dict() == serialized def test_flag_rule_updated_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "flag.rule_updated", - "data": { - "object": "feature_flag", - "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT", - "environment_id": "environment_01EHWNCE74X7JSDV0X3SZ3KJNY", - "slug": "advanced-analytics", - "name": "Advanced Analytics", - "description": "Enable advanced analytics dashboard feature", - "owner": { - "email": "jane@example.com", - "first_name": "Jane", - "last_name": "Doe", - }, - "tags": ["reports"], - "enabled": True, - "default_value": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "context": { - "client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor": { - "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "source": "api", - "name": "Jane Doe", - }, - "access_type": "none", - "configured_targets": { - "organizations": [ - {"id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Corp"} - ], - "users": [ - { - "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "email": "user@example.com", - } - ], - }, - "previous_attributes": { - "data": {"enabled": True, "default_value": False}, - "context": { - "access_type": "none", - "configured_targets": { - "organizations": [ - { - "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "name": "Acme Corp", - } - ], - "users": [ - { - "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "email": "user@example.com", - } - ], - }, - }, - }, - }, - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "flag.rule_updated", "data": {"object": "feature_flag", "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT", "environment_id": "environment_01EHWNCE74X7JSDV0X3SZ3KJNY", "slug": "advanced-analytics", "name": "Advanced Analytics", "description": "Enable advanced analytics dashboard feature", "owner": {"email": "jane@example.com", "first_name": "Jane", "last_name": "Doe"}, "tags": ["reports"], "enabled": True, "default_value": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "context": {"client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor": {"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "source": "api", "name": "Jane Doe"}, "access_type": "none", "configured_targets": {"organizations": [{"id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Corp"}], "users": [{"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "email": "user@example.com"}]}, "previous_attributes": {"data": {"enabled": True, "default_value": False}, "context": {"access_type": "none", "configured_targets": {"organizations": [{"id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Corp"}], "users": [{"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "email": "user@example.com"}]}}}}, "object": "event"} instance = FlagRuleUpdated.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -7501,20 +3674,7 @@ def test_flag_rule_updated_data_round_trip(self): assert restored.to_dict() == serialized def test_flag_rule_updated_data_minimal_payload(self): - data = { - "object": "feature_flag", - "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT", - "environment_id": "environment_01EHWNCE74X7JSDV0X3SZ3KJNY", - "slug": "advanced-analytics", - "name": "Advanced Analytics", - "description": None, - "owner": None, - "tags": ["reports"], - "enabled": True, - "default_value": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "feature_flag", "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT", "environment_id": "environment_01EHWNCE74X7JSDV0X3SZ3KJNY", "slug": "advanced-analytics", "name": "Advanced Analytics", "description": None, "owner": None, "tags": ["reports"], "enabled": True, "default_value": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = FlagRuleUpdatedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -7531,20 +3691,7 @@ def test_flag_rule_updated_data_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_flag_rule_updated_data_preserves_nullable_fields(self): - data = { - "object": "feature_flag", - "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT", - "environment_id": "environment_01EHWNCE74X7JSDV0X3SZ3KJNY", - "slug": "advanced-analytics", - "name": "Advanced Analytics", - "description": None, - "owner": None, - "tags": ["reports"], - "enabled": True, - "default_value": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "feature_flag", "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT", "environment_id": "environment_01EHWNCE74X7JSDV0X3SZ3KJNY", "slug": "advanced-analytics", "name": "Advanced Analytics", "description": None, "owner": None, "tags": ["reports"], "enabled": True, "default_value": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = FlagRuleUpdatedData.from_dict(data) serialized = instance.to_dict() assert serialized["description"] is None @@ -7582,46 +3729,7 @@ def test_flag_rule_updated_context_round_trip(self): assert restored.to_dict() == serialized def test_flag_rule_updated_context_minimal_payload(self): - data = { - "client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor": { - "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "source": "api", - "name": "Jane Doe", - }, - "access_type": "none", - "configured_targets": { - "organizations": [ - {"id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Corp"} - ], - "users": [ - { - "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "email": "user@example.com", - } - ], - }, - "previous_attributes": { - "data": {"enabled": True, "default_value": False}, - "context": { - "access_type": "none", - "configured_targets": { - "organizations": [ - { - "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "name": "Acme Corp", - } - ], - "users": [ - { - "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "email": "user@example.com", - } - ], - }, - }, - }, - } + data = {"client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor": {"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "source": "api", "name": "Jane Doe"}, "access_type": "none", "configured_targets": {"organizations": [{"id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Corp"}], "users": [{"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "email": "user@example.com"}]}, "previous_attributes": {"data": {"enabled": True, "default_value": False}, "context": {"access_type": "none", "configured_targets": {"organizations": [{"id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Corp"}], "users": [{"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "email": "user@example.com"}]}}}} instance = FlagRuleUpdatedContext.from_dict(data) serialized = instance.to_dict() assert serialized["client_id"] == data["client_id"] @@ -7631,46 +3739,7 @@ def test_flag_rule_updated_context_minimal_payload(self): assert serialized["previous_attributes"] == data["previous_attributes"] def test_flag_rule_updated_context_round_trips_unknown_enum_values(self): - data = { - "client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor": { - "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "source": "api", - "name": "Jane Doe", - }, - "access_type": "unexpected_flag_rule_updated_context_access_type", - "configured_targets": { - "organizations": [ - {"id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Corp"} - ], - "users": [ - { - "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "email": "user@example.com", - } - ], - }, - "previous_attributes": { - "data": {"enabled": True, "default_value": False}, - "context": { - "access_type": "none", - "configured_targets": { - "organizations": [ - { - "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "name": "Acme Corp", - } - ], - "users": [ - { - "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "email": "user@example.com", - } - ], - }, - }, - }, - } + data = {"client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor": {"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "source": "api", "name": "Jane Doe"}, "access_type": "unexpected_flag_rule_updated_context_access_type", "configured_targets": {"organizations": [{"id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Corp"}], "users": [{"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "email": "user@example.com"}]}, "previous_attributes": {"data": {"enabled": True, "default_value": False}, "context": {"access_type": "none", "configured_targets": {"organizations": [{"id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Corp"}], "users": [{"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "email": "user@example.com"}]}}}} instance = FlagRuleUpdatedContext.from_dict(data) assert instance.to_dict() == data @@ -7697,11 +3766,7 @@ def test_flag_rule_updated_context_actor_preserves_nullable_fields(self): assert serialized["name"] is None def test_flag_rule_updated_context_actor_round_trips_unknown_enum_values(self): - data = { - "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "source": "unexpected_flag_rule_updated_context_actor_source", - "name": "Jane Doe", - } + data = {"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "source": "unexpected_flag_rule_updated_context_actor_source", "name": "Jane Doe"} instance = FlagRuleUpdatedContextActor.from_dict(data) assert instance.to_dict() == data @@ -7714,34 +3779,21 @@ def test_flag_rule_updated_context_configured_target_round_trip(self): assert restored.to_dict() == serialized def test_flag_rule_updated_context_configured_target_minimal_payload(self): - data = { - "organizations": [ - {"id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Corp"} - ], - "users": [ - {"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "email": "user@example.com"} - ], - } + data = {"organizations": [{"id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Corp"}], "users": [{"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "email": "user@example.com"}]} instance = FlagRuleUpdatedContextConfiguredTarget.from_dict(data) serialized = instance.to_dict() assert serialized["organizations"] == data["organizations"] assert serialized["users"] == data["users"] def test_flag_rule_updated_context_configured_target_organization_round_trip(self): - data = load_fixture( - "flag_rule_updated_context_configured_target_organization.json" - ) + data = load_fixture("flag_rule_updated_context_configured_target_organization.json") instance = FlagRuleUpdatedContextConfiguredTargetOrganization.from_dict(data) serialized = instance.to_dict() assert serialized == data - restored = FlagRuleUpdatedContextConfiguredTargetOrganization.from_dict( - serialized - ) + restored = FlagRuleUpdatedContextConfiguredTargetOrganization.from_dict(serialized) assert restored.to_dict() == serialized - def test_flag_rule_updated_context_configured_target_organization_minimal_payload( - self, - ): + def test_flag_rule_updated_context_configured_target_organization_minimal_payload(self): data = {"id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Corp"} instance = FlagRuleUpdatedContextConfiguredTargetOrganization.from_dict(data) serialized = instance.to_dict() @@ -7776,9 +3828,7 @@ def test_flag_rule_updated_context_previous_attribute_minimal_payload(self): instance = FlagRuleUpdatedContextPreviousAttribute.from_dict(data) assert instance.to_dict() is not None - def test_flag_rule_updated_context_previous_attribute_omits_absent_optional_non_nullable_fields( - self, - ): + def test_flag_rule_updated_context_previous_attribute_omits_absent_optional_non_nullable_fields(self): data = {} instance = FlagRuleUpdatedContextPreviousAttribute.from_dict(data) serialized = instance.to_dict() @@ -7798,9 +3848,7 @@ def test_flag_rule_updated_context_previous_attribute_data_minimal_payload(self) instance = FlagRuleUpdatedContextPreviousAttributeData.from_dict(data) assert instance.to_dict() is not None - def test_flag_rule_updated_context_previous_attribute_data_omits_absent_optional_non_nullable_fields( - self, - ): + def test_flag_rule_updated_context_previous_attribute_data_omits_absent_optional_non_nullable_fields(self): data = {} instance = FlagRuleUpdatedContextPreviousAttributeData.from_dict(data) serialized = instance.to_dict() @@ -7820,125 +3868,59 @@ def test_flag_rule_updated_context_previous_attribute_context_minimal_payload(se instance = FlagRuleUpdatedContextPreviousAttributeContext.from_dict(data) assert instance.to_dict() is not None - def test_flag_rule_updated_context_previous_attribute_context_omits_absent_optional_non_nullable_fields( - self, - ): + def test_flag_rule_updated_context_previous_attribute_context_omits_absent_optional_non_nullable_fields(self): data = {} instance = FlagRuleUpdatedContextPreviousAttributeContext.from_dict(data) serialized = instance.to_dict() assert "access_type" not in serialized assert "configured_targets" not in serialized - def test_flag_rule_updated_context_previous_attribute_context_round_trips_unknown_enum_values( - self, - ): - data = { - "access_type": "unexpected_flag_rule_updated_context_previous_attribute_context_access_type", - "configured_targets": { - "organizations": [ - {"id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Corp"} - ], - "users": [ - { - "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "email": "user@example.com", - } - ], - }, - } + def test_flag_rule_updated_context_previous_attribute_context_round_trips_unknown_enum_values(self): + data = {"access_type": "unexpected_flag_rule_updated_context_previous_attribute_context_access_type", "configured_targets": {"organizations": [{"id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Corp"}], "users": [{"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "email": "user@example.com"}]}} instance = FlagRuleUpdatedContextPreviousAttributeContext.from_dict(data) assert instance.to_dict() == data - def test_flag_rule_updated_context_previous_attribute_context_configured_target_round_trip( - self, - ): - data = load_fixture( - "flag_rule_updated_context_previous_attribute_context_configured_target.json" - ) - instance = ( - FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget.from_dict( - data - ) - ) - serialized = instance.to_dict() - assert serialized == data - restored = ( - FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget.from_dict( - serialized - ) - ) - assert restored.to_dict() == serialized - - def test_flag_rule_updated_context_previous_attribute_context_configured_target_minimal_payload( - self, - ): - data = { - "organizations": [ - {"id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Corp"} - ], - "users": [ - {"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "email": "user@example.com"} - ], - } - instance = ( - FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget.from_dict( - data - ) - ) + def test_flag_rule_updated_context_previous_attribute_context_configured_target_round_trip(self): + data = load_fixture("flag_rule_updated_context_previous_attribute_context_configured_target.json") + instance = FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget.from_dict(data) + serialized = instance.to_dict() + assert serialized == data + restored = FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget.from_dict(serialized) + assert restored.to_dict() == serialized + + def test_flag_rule_updated_context_previous_attribute_context_configured_target_minimal_payload(self): + data = {"organizations": [{"id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Corp"}], "users": [{"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "email": "user@example.com"}]} + instance = FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget.from_dict(data) serialized = instance.to_dict() assert serialized["organizations"] == data["organizations"] assert serialized["users"] == data["users"] - def test_flag_rule_updated_context_previous_attribute_context_configured_target_organization_round_trip( - self, - ): - data = load_fixture( - "flag_rule_updated_context_previous_attribute_context_configured_target_organization.json" - ) - instance = FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetOrganization.from_dict( - data - ) + def test_flag_rule_updated_context_previous_attribute_context_configured_target_organization_round_trip(self): + data = load_fixture("flag_rule_updated_context_previous_attribute_context_configured_target_organization.json") + instance = FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetOrganization.from_dict(data) serialized = instance.to_dict() assert serialized == data - restored = FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetOrganization.from_dict( - serialized - ) + restored = FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetOrganization.from_dict(serialized) assert restored.to_dict() == serialized - def test_flag_rule_updated_context_previous_attribute_context_configured_target_organization_minimal_payload( - self, - ): + def test_flag_rule_updated_context_previous_attribute_context_configured_target_organization_minimal_payload(self): data = {"id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Corp"} - instance = FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetOrganization.from_dict( - data - ) + instance = FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetOrganization.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] assert serialized["name"] == data["name"] - def test_flag_rule_updated_context_previous_attribute_context_configured_target_user_round_trip( - self, - ): - data = load_fixture( - "flag_rule_updated_context_previous_attribute_context_configured_target_user.json" - ) - instance = FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetUser.from_dict( - data - ) + def test_flag_rule_updated_context_previous_attribute_context_configured_target_user_round_trip(self): + data = load_fixture("flag_rule_updated_context_previous_attribute_context_configured_target_user.json") + instance = FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetUser.from_dict(data) serialized = instance.to_dict() assert serialized == data - restored = FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetUser.from_dict( - serialized - ) + restored = FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetUser.from_dict(serialized) assert restored.to_dict() == serialized - def test_flag_rule_updated_context_previous_attribute_context_configured_target_user_minimal_payload( - self, - ): + def test_flag_rule_updated_context_previous_attribute_context_configured_target_user_minimal_payload(self): data = {"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "email": "user@example.com"} - instance = FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetUser.from_dict( - data - ) + instance = FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetUser.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] assert serialized["email"] == data["email"] @@ -7952,47 +3934,7 @@ def test_flag_updated_round_trip(self): assert restored.to_dict() == serialized def test_flag_updated_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "flag.updated", - "data": { - "object": "feature_flag", - "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT", - "environment_id": "environment_01EHWNCE74X7JSDV0X3SZ3KJNY", - "slug": "advanced-analytics", - "name": "Advanced Analytics", - "description": "Enable advanced analytics dashboard feature", - "owner": { - "email": "jane@example.com", - "first_name": "Jane", - "last_name": "Doe", - }, - "tags": ["reports"], - "enabled": True, - "default_value": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "context": { - "client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor": { - "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "source": "api", - "name": "Jane Doe", - }, - "previous_attributes": { - "data": { - "name": "My Feature Flag", - "description": "Enables the new feature.", - "tags": ["beta", "release"], - "enabled": True, - "default_value": False, - } - }, - }, - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "flag.updated", "data": {"object": "feature_flag", "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT", "environment_id": "environment_01EHWNCE74X7JSDV0X3SZ3KJNY", "slug": "advanced-analytics", "name": "Advanced Analytics", "description": "Enable advanced analytics dashboard feature", "owner": {"email": "jane@example.com", "first_name": "Jane", "last_name": "Doe"}, "tags": ["reports"], "enabled": True, "default_value": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "context": {"client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor": {"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "source": "api", "name": "Jane Doe"}, "previous_attributes": {"data": {"name": "My Feature Flag", "description": "Enables the new feature.", "tags": ["beta", "release"], "enabled": True, "default_value": False}}}, "object": "event"} instance = FlagUpdated.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -8011,20 +3953,7 @@ def test_flag_updated_data_round_trip(self): assert restored.to_dict() == serialized def test_flag_updated_data_minimal_payload(self): - data = { - "object": "feature_flag", - "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT", - "environment_id": "environment_01EHWNCE74X7JSDV0X3SZ3KJNY", - "slug": "advanced-analytics", - "name": "Advanced Analytics", - "description": None, - "owner": None, - "tags": ["reports"], - "enabled": True, - "default_value": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "feature_flag", "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT", "environment_id": "environment_01EHWNCE74X7JSDV0X3SZ3KJNY", "slug": "advanced-analytics", "name": "Advanced Analytics", "description": None, "owner": None, "tags": ["reports"], "enabled": True, "default_value": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = FlagUpdatedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -8041,20 +3970,7 @@ def test_flag_updated_data_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_flag_updated_data_preserves_nullable_fields(self): - data = { - "object": "feature_flag", - "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT", - "environment_id": "environment_01EHWNCE74X7JSDV0X3SZ3KJNY", - "slug": "advanced-analytics", - "name": "Advanced Analytics", - "description": None, - "owner": None, - "tags": ["reports"], - "enabled": True, - "default_value": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "feature_flag", "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT", "environment_id": "environment_01EHWNCE74X7JSDV0X3SZ3KJNY", "slug": "advanced-analytics", "name": "Advanced Analytics", "description": None, "owner": None, "tags": ["reports"], "enabled": True, "default_value": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = FlagUpdatedData.from_dict(data) serialized = instance.to_dict() assert serialized["description"] is None @@ -8092,28 +4008,14 @@ def test_flag_updated_context_round_trip(self): assert restored.to_dict() == serialized def test_flag_updated_context_minimal_payload(self): - data = { - "client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor": { - "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "source": "api", - "name": "Jane Doe", - }, - } + data = {"client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor": {"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "source": "api", "name": "Jane Doe"}} instance = FlagUpdatedContext.from_dict(data) serialized = instance.to_dict() assert serialized["client_id"] == data["client_id"] assert serialized["actor"] == data["actor"] def test_flag_updated_context_omits_absent_optional_non_nullable_fields(self): - data = { - "client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor": { - "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "source": "api", - "name": "Jane Doe", - }, - } + data = {"client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor": {"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "source": "api", "name": "Jane Doe"}} instance = FlagUpdatedContext.from_dict(data) serialized = instance.to_dict() assert "previous_attributes" not in serialized @@ -8141,11 +4043,7 @@ def test_flag_updated_context_actor_preserves_nullable_fields(self): assert serialized["name"] is None def test_flag_updated_context_actor_round_trips_unknown_enum_values(self): - data = { - "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "source": "unexpected_flag_updated_context_actor_source", - "name": "Jane Doe", - } + data = {"id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "source": "unexpected_flag_updated_context_actor_source", "name": "Jane Doe"} instance = FlagUpdatedContextActor.from_dict(data) assert instance.to_dict() == data @@ -8162,9 +4060,7 @@ def test_flag_updated_context_previous_attribute_minimal_payload(self): instance = FlagUpdatedContextPreviousAttribute.from_dict(data) assert instance.to_dict() is not None - def test_flag_updated_context_previous_attribute_omits_absent_optional_non_nullable_fields( - self, - ): + def test_flag_updated_context_previous_attribute_omits_absent_optional_non_nullable_fields(self): data = {} instance = FlagUpdatedContextPreviousAttribute.from_dict(data) serialized = instance.to_dict() @@ -8183,9 +4079,7 @@ def test_flag_updated_context_previous_attribute_data_minimal_payload(self): instance = FlagUpdatedContextPreviousAttributeData.from_dict(data) assert instance.to_dict() is not None - def test_flag_updated_context_previous_attribute_data_omits_absent_optional_non_nullable_fields( - self, - ): + def test_flag_updated_context_previous_attribute_data_omits_absent_optional_non_nullable_fields(self): data = {"description": "Enables the new feature."} instance = FlagUpdatedContextPreviousAttributeData.from_dict(data) serialized = instance.to_dict() @@ -8194,16 +4088,8 @@ def test_flag_updated_context_previous_attribute_data_omits_absent_optional_non_ assert "enabled" not in serialized assert "default_value" not in serialized - def test_flag_updated_context_previous_attribute_data_preserves_nullable_fields( - self, - ): - data = { - "name": "My Feature Flag", - "description": None, - "tags": ["beta", "release"], - "enabled": True, - "default_value": False, - } + def test_flag_updated_context_previous_attribute_data_preserves_nullable_fields(self): + data = {"name": "My Feature Flag", "description": None, "tags": ["beta", "release"], "enabled": True, "default_value": False} instance = FlagUpdatedContextPreviousAttributeData.from_dict(data) serialized = instance.to_dict() assert serialized["description"] is None @@ -8217,21 +4103,7 @@ def test_group_created_round_trip(self): assert restored.to_dict() == serialized def test_group_created_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "group.created", - "data": { - "object": "group", - "id": "group_01HXYZ123456789ABCDEFGHIJ", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "name": "Engineering", - "description": "The engineering team", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "group.created", "data": {"object": "group", "id": "group_01HXYZ123456789ABCDEFGHIJ", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Engineering", "description": "The engineering team", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = GroupCreated.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -8241,21 +4113,7 @@ def test_group_created_minimal_payload(self): assert serialized["object"] == data["object"] def test_group_created_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "group.created", - "data": { - "object": "group", - "id": "group_01HXYZ123456789ABCDEFGHIJ", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "name": "Engineering", - "description": "The engineering team", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "group.created", "data": {"object": "group", "id": "group_01HXYZ123456789ABCDEFGHIJ", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Engineering", "description": "The engineering team", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = GroupCreated.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -8269,21 +4127,7 @@ def test_group_deleted_round_trip(self): assert restored.to_dict() == serialized def test_group_deleted_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "group.deleted", - "data": { - "object": "group", - "id": "group_01HXYZ123456789ABCDEFGHIJ", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "name": "Engineering", - "description": "The engineering team", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "group.deleted", "data": {"object": "group", "id": "group_01HXYZ123456789ABCDEFGHIJ", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Engineering", "description": "The engineering team", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = GroupDeleted.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -8293,21 +4137,7 @@ def test_group_deleted_minimal_payload(self): assert serialized["object"] == data["object"] def test_group_deleted_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "group.deleted", - "data": { - "object": "group", - "id": "group_01HXYZ123456789ABCDEFGHIJ", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "name": "Engineering", - "description": "The engineering team", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "group.deleted", "data": {"object": "group", "id": "group_01HXYZ123456789ABCDEFGHIJ", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Engineering", "description": "The engineering team", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = GroupDeleted.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -8321,16 +4151,7 @@ def test_group_member_added_round_trip(self): assert restored.to_dict() == serialized def test_group_member_added_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "group.member_added", - "data": { - "group_id": "group_01HXYZ123456789ABCDEFGHIJ", - "organization_membership_id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "group.member_added", "data": {"group_id": "group_01HXYZ123456789ABCDEFGHIJ", "organization_membership_id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = GroupMemberAdded.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -8340,16 +4161,7 @@ def test_group_member_added_minimal_payload(self): assert serialized["object"] == data["object"] def test_group_member_added_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "group.member_added", - "data": { - "group_id": "group_01HXYZ123456789ABCDEFGHIJ", - "organization_membership_id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "group.member_added", "data": {"group_id": "group_01HXYZ123456789ABCDEFGHIJ", "organization_membership_id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = GroupMemberAdded.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -8363,17 +4175,11 @@ def test_group_member_added_data_round_trip(self): assert restored.to_dict() == serialized def test_group_member_added_data_minimal_payload(self): - data = { - "group_id": "group_01HXYZ123456789ABCDEFGHIJ", - "organization_membership_id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY", - } + data = {"group_id": "group_01HXYZ123456789ABCDEFGHIJ", "organization_membership_id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY"} instance = GroupMemberAddedData.from_dict(data) serialized = instance.to_dict() assert serialized["group_id"] == data["group_id"] - assert ( - serialized["organization_membership_id"] - == data["organization_membership_id"] - ) + assert serialized["organization_membership_id"] == data["organization_membership_id"] def test_group_member_removed_round_trip(self): data = load_fixture("group_member_removed.json") @@ -8384,16 +4190,7 @@ def test_group_member_removed_round_trip(self): assert restored.to_dict() == serialized def test_group_member_removed_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "group.member_removed", - "data": { - "group_id": "group_01HXYZ123456789ABCDEFGHIJ", - "organization_membership_id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "group.member_removed", "data": {"group_id": "group_01HXYZ123456789ABCDEFGHIJ", "organization_membership_id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = GroupMemberRemoved.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -8403,16 +4200,7 @@ def test_group_member_removed_minimal_payload(self): assert serialized["object"] == data["object"] def test_group_member_removed_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "group.member_removed", - "data": { - "group_id": "group_01HXYZ123456789ABCDEFGHIJ", - "organization_membership_id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "group.member_removed", "data": {"group_id": "group_01HXYZ123456789ABCDEFGHIJ", "organization_membership_id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = GroupMemberRemoved.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -8426,17 +4214,11 @@ def test_group_member_removed_data_round_trip(self): assert restored.to_dict() == serialized def test_group_member_removed_data_minimal_payload(self): - data = { - "group_id": "group_01HXYZ123456789ABCDEFGHIJ", - "organization_membership_id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY", - } + data = {"group_id": "group_01HXYZ123456789ABCDEFGHIJ", "organization_membership_id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY"} instance = GroupMemberRemovedData.from_dict(data) serialized = instance.to_dict() assert serialized["group_id"] == data["group_id"] - assert ( - serialized["organization_membership_id"] - == data["organization_membership_id"] - ) + assert serialized["organization_membership_id"] == data["organization_membership_id"] def test_group_updated_round_trip(self): data = load_fixture("group_updated.json") @@ -8447,21 +4229,7 @@ def test_group_updated_round_trip(self): assert restored.to_dict() == serialized def test_group_updated_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "group.updated", - "data": { - "object": "group", - "id": "group_01HXYZ123456789ABCDEFGHIJ", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "name": "Engineering", - "description": "The engineering team", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "group.updated", "data": {"object": "group", "id": "group_01HXYZ123456789ABCDEFGHIJ", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Engineering", "description": "The engineering team", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = GroupUpdated.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -8471,21 +4239,7 @@ def test_group_updated_minimal_payload(self): assert serialized["object"] == data["object"] def test_group_updated_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "group.updated", - "data": { - "object": "group", - "id": "group_01HXYZ123456789ABCDEFGHIJ", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "name": "Engineering", - "description": "The engineering team", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "group.updated", "data": {"object": "group", "id": "group_01HXYZ123456789ABCDEFGHIJ", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Engineering", "description": "The engineering team", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = GroupUpdated.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -8499,26 +4253,7 @@ def test_invitation_accepted_round_trip(self): assert restored.to_dict() == serialized def test_invitation_accepted_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "invitation.accepted", - "data": { - "object": "invitation", - "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "state": "pending", - "accepted_at": None, - "revoked_at": None, - "expires_at": "2026-01-15T12:00:00.000Z", - "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", - "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", - "accepted_user_id": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "invitation.accepted", "data": {"object": "invitation", "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "state": "pending", "accepted_at": None, "revoked_at": None, "expires_at": "2026-01-15T12:00:00.000Z", "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", "accepted_user_id": None, "role_slug": "admin", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = InvitationAccepted.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -8528,26 +4263,7 @@ def test_invitation_accepted_minimal_payload(self): assert serialized["object"] == data["object"] def test_invitation_accepted_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "invitation.accepted", - "data": { - "object": "invitation", - "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "state": "pending", - "accepted_at": None, - "revoked_at": None, - "expires_at": "2026-01-15T12:00:00.000Z", - "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", - "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", - "accepted_user_id": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "invitation.accepted", "data": {"object": "invitation", "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "state": "pending", "accepted_at": None, "revoked_at": None, "expires_at": "2026-01-15T12:00:00.000Z", "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", "accepted_user_id": None, "role_slug": "admin", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = InvitationAccepted.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -8561,20 +4277,7 @@ def test_invitation_accepted_data_round_trip(self): assert restored.to_dict() == serialized def test_invitation_accepted_data_minimal_payload(self): - data = { - "object": "invitation", - "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "state": "pending", - "accepted_at": None, - "revoked_at": None, - "expires_at": "2026-01-15T12:00:00.000Z", - "organization_id": None, - "inviter_user_id": None, - "accepted_user_id": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "invitation", "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "state": "pending", "accepted_at": None, "revoked_at": None, "expires_at": "2026-01-15T12:00:00.000Z", "organization_id": None, "inviter_user_id": None, "accepted_user_id": None, "role_slug": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = InvitationAcceptedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -8587,24 +4290,12 @@ def test_invitation_accepted_data_minimal_payload(self): assert serialized["organization_id"] == data["organization_id"] assert serialized["inviter_user_id"] == data["inviter_user_id"] assert serialized["accepted_user_id"] == data["accepted_user_id"] + assert serialized["role_slug"] == data["role_slug"] assert serialized["created_at"] == data["created_at"] assert serialized["updated_at"] == data["updated_at"] def test_invitation_accepted_data_preserves_nullable_fields(self): - data = { - "object": "invitation", - "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "state": "pending", - "accepted_at": None, - "revoked_at": None, - "expires_at": "2026-01-15T12:00:00.000Z", - "organization_id": None, - "inviter_user_id": None, - "accepted_user_id": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "invitation", "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "state": "pending", "accepted_at": None, "revoked_at": None, "expires_at": "2026-01-15T12:00:00.000Z", "organization_id": None, "inviter_user_id": None, "accepted_user_id": None, "role_slug": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = InvitationAcceptedData.from_dict(data) serialized = instance.to_dict() assert serialized["accepted_at"] is None @@ -8612,22 +4303,10 @@ def test_invitation_accepted_data_preserves_nullable_fields(self): assert serialized["organization_id"] is None assert serialized["inviter_user_id"] is None assert serialized["accepted_user_id"] is None + assert serialized["role_slug"] is None def test_invitation_accepted_data_round_trips_unknown_enum_values(self): - data = { - "object": "invitation", - "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "state": "unexpected_invitation_accepted_data_state", - "accepted_at": None, - "revoked_at": None, - "expires_at": "2026-01-15T12:00:00.000Z", - "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", - "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", - "accepted_user_id": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "invitation", "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "state": "unexpected_invitation_accepted_data_state", "accepted_at": None, "revoked_at": None, "expires_at": "2026-01-15T12:00:00.000Z", "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", "accepted_user_id": None, "role_slug": "admin", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = InvitationAcceptedData.from_dict(data) assert instance.to_dict() == data @@ -8640,26 +4319,7 @@ def test_invitation_created_round_trip(self): assert restored.to_dict() == serialized def test_invitation_created_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "invitation.created", - "data": { - "object": "invitation", - "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "state": "pending", - "accepted_at": None, - "revoked_at": None, - "expires_at": "2026-01-15T12:00:00.000Z", - "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", - "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", - "accepted_user_id": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "invitation.created", "data": {"object": "invitation", "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "state": "pending", "accepted_at": None, "revoked_at": None, "expires_at": "2026-01-15T12:00:00.000Z", "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", "accepted_user_id": None, "role_slug": "admin", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = InvitationCreated.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -8669,26 +4329,7 @@ def test_invitation_created_minimal_payload(self): assert serialized["object"] == data["object"] def test_invitation_created_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "invitation.created", - "data": { - "object": "invitation", - "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "state": "pending", - "accepted_at": None, - "revoked_at": None, - "expires_at": "2026-01-15T12:00:00.000Z", - "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", - "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", - "accepted_user_id": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "invitation.created", "data": {"object": "invitation", "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "state": "pending", "accepted_at": None, "revoked_at": None, "expires_at": "2026-01-15T12:00:00.000Z", "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", "accepted_user_id": None, "role_slug": "admin", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = InvitationCreated.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -8702,20 +4343,7 @@ def test_invitation_created_data_round_trip(self): assert restored.to_dict() == serialized def test_invitation_created_data_minimal_payload(self): - data = { - "object": "invitation", - "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "state": "pending", - "accepted_at": None, - "revoked_at": None, - "expires_at": "2026-01-15T12:00:00.000Z", - "organization_id": None, - "inviter_user_id": None, - "accepted_user_id": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "invitation", "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "state": "pending", "accepted_at": None, "revoked_at": None, "expires_at": "2026-01-15T12:00:00.000Z", "organization_id": None, "inviter_user_id": None, "accepted_user_id": None, "role_slug": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = InvitationCreatedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -8728,24 +4356,12 @@ def test_invitation_created_data_minimal_payload(self): assert serialized["organization_id"] == data["organization_id"] assert serialized["inviter_user_id"] == data["inviter_user_id"] assert serialized["accepted_user_id"] == data["accepted_user_id"] + assert serialized["role_slug"] == data["role_slug"] assert serialized["created_at"] == data["created_at"] assert serialized["updated_at"] == data["updated_at"] def test_invitation_created_data_preserves_nullable_fields(self): - data = { - "object": "invitation", - "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "state": "pending", - "accepted_at": None, - "revoked_at": None, - "expires_at": "2026-01-15T12:00:00.000Z", - "organization_id": None, - "inviter_user_id": None, - "accepted_user_id": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "invitation", "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "state": "pending", "accepted_at": None, "revoked_at": None, "expires_at": "2026-01-15T12:00:00.000Z", "organization_id": None, "inviter_user_id": None, "accepted_user_id": None, "role_slug": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = InvitationCreatedData.from_dict(data) serialized = instance.to_dict() assert serialized["accepted_at"] is None @@ -8753,22 +4369,10 @@ def test_invitation_created_data_preserves_nullable_fields(self): assert serialized["organization_id"] is None assert serialized["inviter_user_id"] is None assert serialized["accepted_user_id"] is None + assert serialized["role_slug"] is None def test_invitation_created_data_round_trips_unknown_enum_values(self): - data = { - "object": "invitation", - "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "state": "unexpected_invitation_created_data_state", - "accepted_at": None, - "revoked_at": None, - "expires_at": "2026-01-15T12:00:00.000Z", - "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", - "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", - "accepted_user_id": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "invitation", "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "state": "unexpected_invitation_created_data_state", "accepted_at": None, "revoked_at": None, "expires_at": "2026-01-15T12:00:00.000Z", "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", "accepted_user_id": None, "role_slug": "admin", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = InvitationCreatedData.from_dict(data) assert instance.to_dict() == data @@ -8781,26 +4385,7 @@ def test_invitation_resent_round_trip(self): assert restored.to_dict() == serialized def test_invitation_resent_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "invitation.resent", - "data": { - "object": "invitation", - "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "state": "pending", - "accepted_at": None, - "revoked_at": None, - "expires_at": "2026-01-15T12:00:00.000Z", - "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", - "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", - "accepted_user_id": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "invitation.resent", "data": {"object": "invitation", "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "state": "pending", "accepted_at": None, "revoked_at": None, "expires_at": "2026-01-15T12:00:00.000Z", "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", "accepted_user_id": None, "role_slug": "admin", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = InvitationResent.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -8810,26 +4395,7 @@ def test_invitation_resent_minimal_payload(self): assert serialized["object"] == data["object"] def test_invitation_resent_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "invitation.resent", - "data": { - "object": "invitation", - "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "state": "pending", - "accepted_at": None, - "revoked_at": None, - "expires_at": "2026-01-15T12:00:00.000Z", - "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", - "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", - "accepted_user_id": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "invitation.resent", "data": {"object": "invitation", "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "state": "pending", "accepted_at": None, "revoked_at": None, "expires_at": "2026-01-15T12:00:00.000Z", "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", "accepted_user_id": None, "role_slug": "admin", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = InvitationResent.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -8843,20 +4409,7 @@ def test_invitation_resent_data_round_trip(self): assert restored.to_dict() == serialized def test_invitation_resent_data_minimal_payload(self): - data = { - "object": "invitation", - "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "state": "pending", - "accepted_at": None, - "revoked_at": None, - "expires_at": "2026-01-15T12:00:00.000Z", - "organization_id": None, - "inviter_user_id": None, - "accepted_user_id": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "invitation", "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "state": "pending", "accepted_at": None, "revoked_at": None, "expires_at": "2026-01-15T12:00:00.000Z", "organization_id": None, "inviter_user_id": None, "accepted_user_id": None, "role_slug": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = InvitationResentData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -8869,24 +4422,12 @@ def test_invitation_resent_data_minimal_payload(self): assert serialized["organization_id"] == data["organization_id"] assert serialized["inviter_user_id"] == data["inviter_user_id"] assert serialized["accepted_user_id"] == data["accepted_user_id"] + assert serialized["role_slug"] == data["role_slug"] assert serialized["created_at"] == data["created_at"] assert serialized["updated_at"] == data["updated_at"] def test_invitation_resent_data_preserves_nullable_fields(self): - data = { - "object": "invitation", - "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "state": "pending", - "accepted_at": None, - "revoked_at": None, - "expires_at": "2026-01-15T12:00:00.000Z", - "organization_id": None, - "inviter_user_id": None, - "accepted_user_id": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "invitation", "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "state": "pending", "accepted_at": None, "revoked_at": None, "expires_at": "2026-01-15T12:00:00.000Z", "organization_id": None, "inviter_user_id": None, "accepted_user_id": None, "role_slug": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = InvitationResentData.from_dict(data) serialized = instance.to_dict() assert serialized["accepted_at"] is None @@ -8894,22 +4435,10 @@ def test_invitation_resent_data_preserves_nullable_fields(self): assert serialized["organization_id"] is None assert serialized["inviter_user_id"] is None assert serialized["accepted_user_id"] is None + assert serialized["role_slug"] is None def test_invitation_resent_data_round_trips_unknown_enum_values(self): - data = { - "object": "invitation", - "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "state": "unexpected_invitation_resent_data_state", - "accepted_at": None, - "revoked_at": None, - "expires_at": "2026-01-15T12:00:00.000Z", - "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", - "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", - "accepted_user_id": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "invitation", "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "state": "unexpected_invitation_resent_data_state", "accepted_at": None, "revoked_at": None, "expires_at": "2026-01-15T12:00:00.000Z", "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", "accepted_user_id": None, "role_slug": "admin", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = InvitationResentData.from_dict(data) assert instance.to_dict() == data @@ -8922,26 +4451,7 @@ def test_invitation_revoked_round_trip(self): assert restored.to_dict() == serialized def test_invitation_revoked_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "invitation.revoked", - "data": { - "object": "invitation", - "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "state": "pending", - "accepted_at": None, - "revoked_at": None, - "expires_at": "2026-01-15T12:00:00.000Z", - "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", - "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", - "accepted_user_id": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "invitation.revoked", "data": {"object": "invitation", "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "state": "pending", "accepted_at": None, "revoked_at": None, "expires_at": "2026-01-15T12:00:00.000Z", "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", "accepted_user_id": None, "role_slug": "admin", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = InvitationRevoked.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -8951,26 +4461,7 @@ def test_invitation_revoked_minimal_payload(self): assert serialized["object"] == data["object"] def test_invitation_revoked_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "invitation.revoked", - "data": { - "object": "invitation", - "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "state": "pending", - "accepted_at": None, - "revoked_at": None, - "expires_at": "2026-01-15T12:00:00.000Z", - "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", - "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", - "accepted_user_id": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "invitation.revoked", "data": {"object": "invitation", "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "state": "pending", "accepted_at": None, "revoked_at": None, "expires_at": "2026-01-15T12:00:00.000Z", "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", "accepted_user_id": None, "role_slug": "admin", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = InvitationRevoked.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -8984,20 +4475,7 @@ def test_invitation_revoked_data_round_trip(self): assert restored.to_dict() == serialized def test_invitation_revoked_data_minimal_payload(self): - data = { - "object": "invitation", - "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "state": "pending", - "accepted_at": None, - "revoked_at": None, - "expires_at": "2026-01-15T12:00:00.000Z", - "organization_id": None, - "inviter_user_id": None, - "accepted_user_id": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "invitation", "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "state": "pending", "accepted_at": None, "revoked_at": None, "expires_at": "2026-01-15T12:00:00.000Z", "organization_id": None, "inviter_user_id": None, "accepted_user_id": None, "role_slug": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = InvitationRevokedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -9010,24 +4488,12 @@ def test_invitation_revoked_data_minimal_payload(self): assert serialized["organization_id"] == data["organization_id"] assert serialized["inviter_user_id"] == data["inviter_user_id"] assert serialized["accepted_user_id"] == data["accepted_user_id"] + assert serialized["role_slug"] == data["role_slug"] assert serialized["created_at"] == data["created_at"] assert serialized["updated_at"] == data["updated_at"] def test_invitation_revoked_data_preserves_nullable_fields(self): - data = { - "object": "invitation", - "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "state": "pending", - "accepted_at": None, - "revoked_at": None, - "expires_at": "2026-01-15T12:00:00.000Z", - "organization_id": None, - "inviter_user_id": None, - "accepted_user_id": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "invitation", "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "state": "pending", "accepted_at": None, "revoked_at": None, "expires_at": "2026-01-15T12:00:00.000Z", "organization_id": None, "inviter_user_id": None, "accepted_user_id": None, "role_slug": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = InvitationRevokedData.from_dict(data) serialized = instance.to_dict() assert serialized["accepted_at"] is None @@ -9035,22 +4501,10 @@ def test_invitation_revoked_data_preserves_nullable_fields(self): assert serialized["organization_id"] is None assert serialized["inviter_user_id"] is None assert serialized["accepted_user_id"] is None + assert serialized["role_slug"] is None def test_invitation_revoked_data_round_trips_unknown_enum_values(self): - data = { - "object": "invitation", - "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "state": "unexpected_invitation_revoked_data_state", - "accepted_at": None, - "revoked_at": None, - "expires_at": "2026-01-15T12:00:00.000Z", - "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", - "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", - "accepted_user_id": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "invitation", "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "state": "unexpected_invitation_revoked_data_state", "accepted_at": None, "revoked_at": None, "expires_at": "2026-01-15T12:00:00.000Z", "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", "accepted_user_id": None, "role_slug": "admin", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = InvitationRevokedData.from_dict(data) assert instance.to_dict() == data @@ -9063,21 +4517,7 @@ def test_magic_auth_created_round_trip(self): assert restored.to_dict() == serialized def test_magic_auth_created_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "magic_auth.created", - "data": { - "object": "magic_auth", - "id": "magic_auth_01HWZBQZY2M3AMQW166Q22K88F", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "expires_at": "2026-01-15T12:00:00.000Z", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "magic_auth.created", "data": {"object": "magic_auth", "id": "magic_auth_01HWZBQZY2M3AMQW166Q22K88F", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "expires_at": "2026-01-15T12:00:00.000Z", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = MagicAuthCreated.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -9087,21 +4527,7 @@ def test_magic_auth_created_minimal_payload(self): assert serialized["object"] == data["object"] def test_magic_auth_created_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "magic_auth.created", - "data": { - "object": "magic_auth", - "id": "magic_auth_01HWZBQZY2M3AMQW166Q22K88F", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "expires_at": "2026-01-15T12:00:00.000Z", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "magic_auth.created", "data": {"object": "magic_auth", "id": "magic_auth_01HWZBQZY2M3AMQW166Q22K88F", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "expires_at": "2026-01-15T12:00:00.000Z", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = MagicAuthCreated.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -9115,15 +4541,7 @@ def test_magic_auth_created_data_round_trip(self): assert restored.to_dict() == serialized def test_magic_auth_created_data_minimal_payload(self): - data = { - "object": "magic_auth", - "id": "magic_auth_01HWZBQZY2M3AMQW166Q22K88F", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "expires_at": "2026-01-15T12:00:00.000Z", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "magic_auth", "id": "magic_auth_01HWZBQZY2M3AMQW166Q22K88F", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "expires_at": "2026-01-15T12:00:00.000Z", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = MagicAuthCreatedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -9143,36 +4561,7 @@ def test_organization_created_round_trip(self): assert restored.to_dict() == serialized def test_organization_created_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "organization.created", - "data": { - "object": "organization", - "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "name": "Acme Inc.", - "domains": [ - { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "pending", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } - ], - "metadata": {"tier": "diamond"}, - "external_id": "2fe01467-f7ea-4dd2-8b79-c2b4f56d0191", - "stripe_customer_id": "cus_R9qWAGMQ6nGE7V", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "organization.created", "data": {"object": "organization", "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Inc.", "domains": [{"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "pending", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}], "metadata": {"tier": "diamond"}, "external_id": "2fe01467-f7ea-4dd2-8b79-c2b4f56d0191", "stripe_customer_id": "cus_R9qWAGMQ6nGE7V", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = OrganizationCreated.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -9182,36 +4571,7 @@ def test_organization_created_minimal_payload(self): assert serialized["object"] == data["object"] def test_organization_created_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "organization.created", - "data": { - "object": "organization", - "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "name": "Acme Inc.", - "domains": [ - { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "pending", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } - ], - "metadata": {"tier": "diamond"}, - "external_id": "2fe01467-f7ea-4dd2-8b79-c2b4f56d0191", - "stripe_customer_id": "cus_R9qWAGMQ6nGE7V", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "organization.created", "data": {"object": "organization", "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Inc.", "domains": [{"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "pending", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}], "metadata": {"tier": "diamond"}, "external_id": "2fe01467-f7ea-4dd2-8b79-c2b4f56d0191", "stripe_customer_id": "cus_R9qWAGMQ6nGE7V", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = OrganizationCreated.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -9225,29 +4585,7 @@ def test_organization_created_data_round_trip(self): assert restored.to_dict() == serialized def test_organization_created_data_minimal_payload(self): - data = { - "object": "organization", - "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "name": "Acme Inc.", - "domains": [ - { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "pending", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } - ], - "metadata": {"tier": "diamond"}, - "external_id": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization", "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Inc.", "domains": [{"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "pending", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}], "metadata": {"tier": "diamond"}, "external_id": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationCreatedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -9260,58 +4598,13 @@ def test_organization_created_data_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_organization_created_data_omits_absent_optional_non_nullable_fields(self): - data = { - "object": "organization", - "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "name": "Acme Inc.", - "domains": [ - { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "pending", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } - ], - "metadata": {"tier": "diamond"}, - "external_id": "2fe01467-f7ea-4dd2-8b79-c2b4f56d0191", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization", "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Inc.", "domains": [{"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "pending", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}], "metadata": {"tier": "diamond"}, "external_id": "2fe01467-f7ea-4dd2-8b79-c2b4f56d0191", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationCreatedData.from_dict(data) serialized = instance.to_dict() assert "stripe_customer_id" not in serialized def test_organization_created_data_preserves_nullable_fields(self): - data = { - "object": "organization", - "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "name": "Acme Inc.", - "domains": [ - { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "pending", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } - ], - "metadata": {"tier": "diamond"}, - "external_id": None, - "stripe_customer_id": "cus_R9qWAGMQ6nGE7V", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization", "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Inc.", "domains": [{"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "pending", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}], "metadata": {"tier": "diamond"}, "external_id": None, "stripe_customer_id": "cus_R9qWAGMQ6nGE7V", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationCreatedData.from_dict(data) serialized = instance.to_dict() assert serialized["external_id"] is None @@ -9325,14 +4618,7 @@ def test_organization_created_data_domain_round_trip(self): assert restored.to_dict() == serialized def test_organization_created_data_domain_minimal_payload(self): - data = { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationCreatedDataDomain.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -9342,17 +4628,8 @@ def test_organization_created_data_domain_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["updated_at"] == data["updated_at"] - def test_organization_created_data_domain_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + def test_organization_created_data_domain_omits_absent_optional_non_nullable_fields(self): + data = {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationCreatedDataDomain.from_dict(data) serialized = instance.to_dict() assert "state" not in serialized @@ -9361,18 +4638,7 @@ def test_organization_created_data_domain_omits_absent_optional_non_nullable_fie assert "verification_strategy" not in serialized def test_organization_created_data_domain_round_trips_unknown_enum_values(self): - data = { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "unexpected_organization_created_data_domain_state", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "unexpected_organization_created_data_domain_state", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationCreatedDataDomain.from_dict(data) assert instance.to_dict() == data @@ -9385,36 +4651,7 @@ def test_organization_deleted_round_trip(self): assert restored.to_dict() == serialized def test_organization_deleted_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "organization.deleted", - "data": { - "object": "organization", - "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "name": "Acme Inc.", - "domains": [ - { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "pending", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } - ], - "metadata": {"tier": "diamond"}, - "external_id": "2fe01467-f7ea-4dd2-8b79-c2b4f56d0191", - "stripe_customer_id": "cus_R9qWAGMQ6nGE7V", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "organization.deleted", "data": {"object": "organization", "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Inc.", "domains": [{"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "pending", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}], "metadata": {"tier": "diamond"}, "external_id": "2fe01467-f7ea-4dd2-8b79-c2b4f56d0191", "stripe_customer_id": "cus_R9qWAGMQ6nGE7V", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = OrganizationDeleted.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -9424,36 +4661,7 @@ def test_organization_deleted_minimal_payload(self): assert serialized["object"] == data["object"] def test_organization_deleted_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "organization.deleted", - "data": { - "object": "organization", - "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "name": "Acme Inc.", - "domains": [ - { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "pending", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } - ], - "metadata": {"tier": "diamond"}, - "external_id": "2fe01467-f7ea-4dd2-8b79-c2b4f56d0191", - "stripe_customer_id": "cus_R9qWAGMQ6nGE7V", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "organization.deleted", "data": {"object": "organization", "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Inc.", "domains": [{"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "pending", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}], "metadata": {"tier": "diamond"}, "external_id": "2fe01467-f7ea-4dd2-8b79-c2b4f56d0191", "stripe_customer_id": "cus_R9qWAGMQ6nGE7V", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = OrganizationDeleted.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -9467,29 +4675,7 @@ def test_organization_deleted_data_round_trip(self): assert restored.to_dict() == serialized def test_organization_deleted_data_minimal_payload(self): - data = { - "object": "organization", - "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "name": "Acme Inc.", - "domains": [ - { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "pending", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } - ], - "metadata": {"tier": "diamond"}, - "external_id": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization", "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Inc.", "domains": [{"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "pending", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}], "metadata": {"tier": "diamond"}, "external_id": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationDeletedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -9502,58 +4688,13 @@ def test_organization_deleted_data_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_organization_deleted_data_omits_absent_optional_non_nullable_fields(self): - data = { - "object": "organization", - "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "name": "Acme Inc.", - "domains": [ - { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "pending", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } - ], - "metadata": {"tier": "diamond"}, - "external_id": "2fe01467-f7ea-4dd2-8b79-c2b4f56d0191", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization", "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Inc.", "domains": [{"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "pending", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}], "metadata": {"tier": "diamond"}, "external_id": "2fe01467-f7ea-4dd2-8b79-c2b4f56d0191", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationDeletedData.from_dict(data) serialized = instance.to_dict() assert "stripe_customer_id" not in serialized def test_organization_deleted_data_preserves_nullable_fields(self): - data = { - "object": "organization", - "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "name": "Acme Inc.", - "domains": [ - { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "pending", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } - ], - "metadata": {"tier": "diamond"}, - "external_id": None, - "stripe_customer_id": "cus_R9qWAGMQ6nGE7V", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization", "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Inc.", "domains": [{"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "pending", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}], "metadata": {"tier": "diamond"}, "external_id": None, "stripe_customer_id": "cus_R9qWAGMQ6nGE7V", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationDeletedData.from_dict(data) serialized = instance.to_dict() assert serialized["external_id"] is None @@ -9567,14 +4708,7 @@ def test_organization_deleted_data_domain_round_trip(self): assert restored.to_dict() == serialized def test_organization_deleted_data_domain_minimal_payload(self): - data = { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationDeletedDataDomain.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -9584,17 +4718,8 @@ def test_organization_deleted_data_domain_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["updated_at"] == data["updated_at"] - def test_organization_deleted_data_domain_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + def test_organization_deleted_data_domain_omits_absent_optional_non_nullable_fields(self): + data = {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationDeletedDataDomain.from_dict(data) serialized = instance.to_dict() assert "state" not in serialized @@ -9603,18 +4728,7 @@ def test_organization_deleted_data_domain_omits_absent_optional_non_nullable_fie assert "verification_strategy" not in serialized def test_organization_deleted_data_domain_round_trips_unknown_enum_values(self): - data = { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "unexpected_organization_deleted_data_domain_state", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "unexpected_organization_deleted_data_domain_state", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationDeletedDataDomain.from_dict(data) assert instance.to_dict() == data @@ -9627,24 +4741,7 @@ def test_organization_domain_created_round_trip(self): assert restored.to_dict() == serialized def test_organization_domain_created_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "organization_domain.created", - "data": { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "pending", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "organization_domain.created", "data": {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "pending", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = OrganizationDomainCreated.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -9653,27 +4750,8 @@ def test_organization_domain_created_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["object"] == data["object"] - def test_organization_domain_created_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "organization_domain.created", - "data": { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "pending", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + def test_organization_domain_created_omits_absent_optional_non_nullable_fields(self): + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "organization_domain.created", "data": {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "pending", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = OrganizationDomainCreated.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -9687,14 +4765,7 @@ def test_organization_domain_created_data_round_trip(self): assert restored.to_dict() == serialized def test_organization_domain_created_data_minimal_payload(self): - data = { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationDomainCreatedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -9704,17 +4775,8 @@ def test_organization_domain_created_data_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["updated_at"] == data["updated_at"] - def test_organization_domain_created_data_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + def test_organization_domain_created_data_omits_absent_optional_non_nullable_fields(self): + data = {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationDomainCreatedData.from_dict(data) serialized = instance.to_dict() assert "state" not in serialized @@ -9723,18 +4785,7 @@ def test_organization_domain_created_data_omits_absent_optional_non_nullable_fie assert "verification_strategy" not in serialized def test_organization_domain_created_data_round_trips_unknown_enum_values(self): - data = { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "unexpected_organization_domain_created_data_state", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "unexpected_organization_domain_created_data_state", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationDomainCreatedData.from_dict(data) assert instance.to_dict() == data @@ -9747,24 +4798,7 @@ def test_organization_domain_deleted_round_trip(self): assert restored.to_dict() == serialized def test_organization_domain_deleted_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "organization_domain.deleted", - "data": { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "pending", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "organization_domain.deleted", "data": {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "pending", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = OrganizationDomainDeleted.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -9773,27 +4807,8 @@ def test_organization_domain_deleted_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["object"] == data["object"] - def test_organization_domain_deleted_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "organization_domain.deleted", - "data": { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "pending", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + def test_organization_domain_deleted_omits_absent_optional_non_nullable_fields(self): + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "organization_domain.deleted", "data": {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "pending", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = OrganizationDomainDeleted.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -9807,14 +4822,7 @@ def test_organization_domain_deleted_data_round_trip(self): assert restored.to_dict() == serialized def test_organization_domain_deleted_data_minimal_payload(self): - data = { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationDomainDeletedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -9824,17 +4832,8 @@ def test_organization_domain_deleted_data_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["updated_at"] == data["updated_at"] - def test_organization_domain_deleted_data_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + def test_organization_domain_deleted_data_omits_absent_optional_non_nullable_fields(self): + data = {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationDomainDeletedData.from_dict(data) serialized = instance.to_dict() assert "state" not in serialized @@ -9843,18 +4842,7 @@ def test_organization_domain_deleted_data_omits_absent_optional_non_nullable_fie assert "verification_strategy" not in serialized def test_organization_domain_deleted_data_round_trips_unknown_enum_values(self): - data = { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "unexpected_organization_domain_deleted_data_state", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "unexpected_organization_domain_deleted_data_state", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationDomainDeletedData.from_dict(data) assert instance.to_dict() == data @@ -9867,24 +4855,7 @@ def test_organization_domain_updated_round_trip(self): assert restored.to_dict() == serialized def test_organization_domain_updated_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "organization_domain.updated", - "data": { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "pending", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "organization_domain.updated", "data": {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "pending", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = OrganizationDomainUpdated.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -9893,27 +4864,8 @@ def test_organization_domain_updated_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["object"] == data["object"] - def test_organization_domain_updated_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "organization_domain.updated", - "data": { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "pending", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + def test_organization_domain_updated_omits_absent_optional_non_nullable_fields(self): + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "organization_domain.updated", "data": {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "pending", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = OrganizationDomainUpdated.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -9927,14 +4879,7 @@ def test_organization_domain_updated_data_round_trip(self): assert restored.to_dict() == serialized def test_organization_domain_updated_data_minimal_payload(self): - data = { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationDomainUpdatedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -9944,17 +4889,8 @@ def test_organization_domain_updated_data_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["updated_at"] == data["updated_at"] - def test_organization_domain_updated_data_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + def test_organization_domain_updated_data_omits_absent_optional_non_nullable_fields(self): + data = {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationDomainUpdatedData.from_dict(data) serialized = instance.to_dict() assert "state" not in serialized @@ -9963,18 +4899,7 @@ def test_organization_domain_updated_data_omits_absent_optional_non_nullable_fie assert "verification_strategy" not in serialized def test_organization_domain_updated_data_round_trips_unknown_enum_values(self): - data = { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "unexpected_organization_domain_updated_data_state", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "unexpected_organization_domain_updated_data_state", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationDomainUpdatedData.from_dict(data) assert instance.to_dict() == data @@ -9987,27 +4912,7 @@ def test_organization_domain_verification_failed_round_trip(self): assert restored.to_dict() == serialized def test_organization_domain_verification_failed_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "organization_domain.verification_failed", - "data": { - "reason": "domain_verification_period_expired", - "organization_domain": { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "pending", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "organization_domain.verification_failed", "data": {"reason": "domain_verification_period_expired", "organization_domain": {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "pending", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = OrganizationDomainVerificationFailed.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -10016,30 +4921,8 @@ def test_organization_domain_verification_failed_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["object"] == data["object"] - def test_organization_domain_verification_failed_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "organization_domain.verification_failed", - "data": { - "reason": "domain_verification_period_expired", - "organization_domain": { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "pending", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + def test_organization_domain_verification_failed_omits_absent_optional_non_nullable_fields(self): + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "organization_domain.verification_failed", "data": {"reason": "domain_verification_period_expired", "organization_domain": {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "pending", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = OrganizationDomainVerificationFailed.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -10053,77 +4936,28 @@ def test_organization_domain_verification_failed_data_round_trip(self): assert restored.to_dict() == serialized def test_organization_domain_verification_failed_data_minimal_payload(self): - data = { - "reason": "domain_verification_period_expired", - "organization_domain": { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "pending", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - } + data = {"reason": "domain_verification_period_expired", "organization_domain": {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "pending", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}} instance = OrganizationDomainVerificationFailedData.from_dict(data) serialized = instance.to_dict() assert serialized["reason"] == data["reason"] assert serialized["organization_domain"] == data["organization_domain"] - def test_organization_domain_verification_failed_data_round_trips_unknown_enum_values( - self, - ): - data = { - "reason": "unexpected_organization_domain_verification_failed_data_reason", - "organization_domain": { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "pending", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - } + def test_organization_domain_verification_failed_data_round_trips_unknown_enum_values(self): + data = {"reason": "unexpected_organization_domain_verification_failed_data_reason", "organization_domain": {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "pending", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}} instance = OrganizationDomainVerificationFailedData.from_dict(data) assert instance.to_dict() == data - def test_organization_domain_verification_failed_data_organization_domain_round_trip( - self, - ): - data = load_fixture( - "organization_domain_verification_failed_data_organization_domain.json" - ) - instance = OrganizationDomainVerificationFailedDataOrganizationDomain.from_dict( - data - ) + def test_organization_domain_verification_failed_data_organization_domain_round_trip(self): + data = load_fixture("organization_domain_verification_failed_data_organization_domain.json") + instance = OrganizationDomainVerificationFailedDataOrganizationDomain.from_dict(data) serialized = instance.to_dict() assert serialized == data - restored = OrganizationDomainVerificationFailedDataOrganizationDomain.from_dict( - serialized - ) + restored = OrganizationDomainVerificationFailedDataOrganizationDomain.from_dict(serialized) assert restored.to_dict() == serialized - def test_organization_domain_verification_failed_data_organization_domain_minimal_payload( - self, - ): - data = { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } - instance = OrganizationDomainVerificationFailedDataOrganizationDomain.from_dict( - data - ) + def test_organization_domain_verification_failed_data_organization_domain_minimal_payload(self): + data = {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} + instance = OrganizationDomainVerificationFailedDataOrganizationDomain.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] assert serialized["id"] == data["id"] @@ -10132,44 +4966,18 @@ def test_organization_domain_verification_failed_data_organization_domain_minima assert serialized["created_at"] == data["created_at"] assert serialized["updated_at"] == data["updated_at"] - def test_organization_domain_verification_failed_data_organization_domain_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } - instance = OrganizationDomainVerificationFailedDataOrganizationDomain.from_dict( - data - ) + def test_organization_domain_verification_failed_data_organization_domain_omits_absent_optional_non_nullable_fields(self): + data = {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} + instance = OrganizationDomainVerificationFailedDataOrganizationDomain.from_dict(data) serialized = instance.to_dict() assert "state" not in serialized assert "verification_prefix" not in serialized assert "verification_token" not in serialized assert "verification_strategy" not in serialized - def test_organization_domain_verification_failed_data_organization_domain_round_trips_unknown_enum_values( - self, - ): - data = { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "unexpected_organization_domain_verification_failed_data_organization_domain_state", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } - instance = OrganizationDomainVerificationFailedDataOrganizationDomain.from_dict( - data - ) + def test_organization_domain_verification_failed_data_organization_domain_round_trips_unknown_enum_values(self): + data = {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "unexpected_organization_domain_verification_failed_data_organization_domain_state", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} + instance = OrganizationDomainVerificationFailedDataOrganizationDomain.from_dict(data) assert instance.to_dict() == data def test_organization_domain_verified_round_trip(self): @@ -10181,24 +4989,7 @@ def test_organization_domain_verified_round_trip(self): assert restored.to_dict() == serialized def test_organization_domain_verified_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "organization_domain.verified", - "data": { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "pending", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "organization_domain.verified", "data": {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "pending", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = OrganizationDomainVerified.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -10207,27 +4998,8 @@ def test_organization_domain_verified_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["object"] == data["object"] - def test_organization_domain_verified_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "organization_domain.verified", - "data": { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "pending", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + def test_organization_domain_verified_omits_absent_optional_non_nullable_fields(self): + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "organization_domain.verified", "data": {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "pending", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = OrganizationDomainVerified.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -10241,14 +5013,7 @@ def test_organization_domain_verified_data_round_trip(self): assert restored.to_dict() == serialized def test_organization_domain_verified_data_minimal_payload(self): - data = { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationDomainVerifiedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -10258,17 +5023,8 @@ def test_organization_domain_verified_data_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["updated_at"] == data["updated_at"] - def test_organization_domain_verified_data_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + def test_organization_domain_verified_data_omits_absent_optional_non_nullable_fields(self): + data = {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationDomainVerifiedData.from_dict(data) serialized = instance.to_dict() assert "state" not in serialized @@ -10277,18 +5033,7 @@ def test_organization_domain_verified_data_omits_absent_optional_non_nullable_fi assert "verification_strategy" not in serialized def test_organization_domain_verified_data_round_trips_unknown_enum_values(self): - data = { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "unexpected_organization_domain_verified_data_state", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "unexpected_organization_domain_verified_data_state", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationDomainVerifiedData.from_dict(data) assert instance.to_dict() == data @@ -10301,25 +5046,7 @@ def test_organization_membership_created_round_trip(self): assert restored.to_dict() == serialized def test_organization_membership_created_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "organization_membership.created", - "data": { - "object": "organization_membership", - "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY", - "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "status": "active", - "role": {"slug": "admin"}, - "roles": [{"slug": "admin"}], - "custom_attributes": {"key": {}}, - "directory_managed": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "organization_membership.created", "data": {"object": "organization_membership", "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY", "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "status": "active", "role": {"slug": "admin"}, "roles": [{"slug": "admin"}], "custom_attributes": {"key": {}}, "directory_managed": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = OrganizationMembershipCreated.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -10328,28 +5055,8 @@ def test_organization_membership_created_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["object"] == data["object"] - def test_organization_membership_created_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "organization_membership.created", - "data": { - "object": "organization_membership", - "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY", - "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "status": "active", - "role": {"slug": "admin"}, - "roles": [{"slug": "admin"}], - "custom_attributes": {"key": {}}, - "directory_managed": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + def test_organization_membership_created_omits_absent_optional_non_nullable_fields(self): + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "organization_membership.created", "data": {"object": "organization_membership", "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY", "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "status": "active", "role": {"slug": "admin"}, "roles": [{"slug": "admin"}], "custom_attributes": {"key": {}}, "directory_managed": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = OrganizationMembershipCreated.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -10363,18 +5070,7 @@ def test_organization_membership_created_data_round_trip(self): assert restored.to_dict() == serialized def test_organization_membership_created_data_minimal_payload(self): - data = { - "object": "organization_membership", - "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY", - "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "status": "active", - "role": {"slug": "admin"}, - "custom_attributes": {"key": {}}, - "directory_managed": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization_membership", "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY", "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "status": "active", "role": {"slug": "admin"}, "custom_attributes": {"key": {}}, "directory_managed": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationMembershipCreatedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -10388,39 +5084,14 @@ def test_organization_membership_created_data_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["updated_at"] == data["updated_at"] - def test_organization_membership_created_data_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "object": "organization_membership", - "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY", - "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "status": "active", - "role": {"slug": "admin"}, - "custom_attributes": {"key": {}}, - "directory_managed": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + def test_organization_membership_created_data_omits_absent_optional_non_nullable_fields(self): + data = {"object": "organization_membership", "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY", "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "status": "active", "role": {"slug": "admin"}, "custom_attributes": {"key": {}}, "directory_managed": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationMembershipCreatedData.from_dict(data) serialized = instance.to_dict() assert "roles" not in serialized def test_organization_membership_created_data_round_trips_unknown_enum_values(self): - data = { - "object": "organization_membership", - "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY", - "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "status": "unexpected_organization_membership_created_data_status", - "role": {"slug": "admin"}, - "roles": [{"slug": "admin"}], - "custom_attributes": {"key": {}}, - "directory_managed": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization_membership", "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY", "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "status": "unexpected_organization_membership_created_data_status", "role": {"slug": "admin"}, "roles": [{"slug": "admin"}], "custom_attributes": {"key": {}}, "directory_managed": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationMembershipCreatedData.from_dict(data) assert instance.to_dict() == data @@ -10433,25 +5104,7 @@ def test_organization_membership_deleted_round_trip(self): assert restored.to_dict() == serialized def test_organization_membership_deleted_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "organization_membership.deleted", - "data": { - "object": "organization_membership", - "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY", - "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "status": "active", - "role": {"slug": "admin"}, - "roles": [{"slug": "admin"}], - "custom_attributes": {"key": {}}, - "directory_managed": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "organization_membership.deleted", "data": {"object": "organization_membership", "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY", "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "status": "active", "role": {"slug": "admin"}, "roles": [{"slug": "admin"}], "custom_attributes": {"key": {}}, "directory_managed": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = OrganizationMembershipDeleted.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -10460,28 +5113,8 @@ def test_organization_membership_deleted_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["object"] == data["object"] - def test_organization_membership_deleted_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "organization_membership.deleted", - "data": { - "object": "organization_membership", - "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY", - "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "status": "active", - "role": {"slug": "admin"}, - "roles": [{"slug": "admin"}], - "custom_attributes": {"key": {}}, - "directory_managed": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + def test_organization_membership_deleted_omits_absent_optional_non_nullable_fields(self): + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "organization_membership.deleted", "data": {"object": "organization_membership", "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY", "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "status": "active", "role": {"slug": "admin"}, "roles": [{"slug": "admin"}], "custom_attributes": {"key": {}}, "directory_managed": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = OrganizationMembershipDeleted.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -10495,18 +5128,7 @@ def test_organization_membership_deleted_data_round_trip(self): assert restored.to_dict() == serialized def test_organization_membership_deleted_data_minimal_payload(self): - data = { - "object": "organization_membership", - "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY", - "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "status": "active", - "role": {"slug": "admin"}, - "custom_attributes": {"key": {}}, - "directory_managed": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization_membership", "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY", "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "status": "active", "role": {"slug": "admin"}, "custom_attributes": {"key": {}}, "directory_managed": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationMembershipDeletedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -10520,39 +5142,14 @@ def test_organization_membership_deleted_data_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["updated_at"] == data["updated_at"] - def test_organization_membership_deleted_data_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "object": "organization_membership", - "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY", - "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "status": "active", - "role": {"slug": "admin"}, - "custom_attributes": {"key": {}}, - "directory_managed": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + def test_organization_membership_deleted_data_omits_absent_optional_non_nullable_fields(self): + data = {"object": "organization_membership", "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY", "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "status": "active", "role": {"slug": "admin"}, "custom_attributes": {"key": {}}, "directory_managed": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationMembershipDeletedData.from_dict(data) serialized = instance.to_dict() assert "roles" not in serialized def test_organization_membership_deleted_data_round_trips_unknown_enum_values(self): - data = { - "object": "organization_membership", - "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY", - "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "status": "unexpected_organization_membership_deleted_data_status", - "role": {"slug": "admin"}, - "roles": [{"slug": "admin"}], - "custom_attributes": {"key": {}}, - "directory_managed": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization_membership", "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY", "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "status": "unexpected_organization_membership_deleted_data_status", "role": {"slug": "admin"}, "roles": [{"slug": "admin"}], "custom_attributes": {"key": {}}, "directory_managed": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationMembershipDeletedData.from_dict(data) assert instance.to_dict() == data @@ -10565,25 +5162,7 @@ def test_organization_membership_updated_round_trip(self): assert restored.to_dict() == serialized def test_organization_membership_updated_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "organization_membership.updated", - "data": { - "object": "organization_membership", - "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY", - "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "status": "active", - "role": {"slug": "admin"}, - "roles": [{"slug": "admin"}], - "custom_attributes": {"key": {}}, - "directory_managed": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "organization_membership.updated", "data": {"object": "organization_membership", "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY", "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "status": "active", "role": {"slug": "admin"}, "roles": [{"slug": "admin"}], "custom_attributes": {"key": {}}, "directory_managed": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = OrganizationMembershipUpdated.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -10592,28 +5171,8 @@ def test_organization_membership_updated_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["object"] == data["object"] - def test_organization_membership_updated_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "organization_membership.updated", - "data": { - "object": "organization_membership", - "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY", - "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "status": "active", - "role": {"slug": "admin"}, - "roles": [{"slug": "admin"}], - "custom_attributes": {"key": {}}, - "directory_managed": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + def test_organization_membership_updated_omits_absent_optional_non_nullable_fields(self): + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "organization_membership.updated", "data": {"object": "organization_membership", "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY", "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "status": "active", "role": {"slug": "admin"}, "roles": [{"slug": "admin"}], "custom_attributes": {"key": {}}, "directory_managed": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = OrganizationMembershipUpdated.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -10627,18 +5186,7 @@ def test_organization_membership_updated_data_round_trip(self): assert restored.to_dict() == serialized def test_organization_membership_updated_data_minimal_payload(self): - data = { - "object": "organization_membership", - "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY", - "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "status": "active", - "role": {"slug": "admin"}, - "custom_attributes": {"key": {}}, - "directory_managed": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization_membership", "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY", "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "status": "active", "role": {"slug": "admin"}, "custom_attributes": {"key": {}}, "directory_managed": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationMembershipUpdatedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -10652,39 +5200,14 @@ def test_organization_membership_updated_data_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["updated_at"] == data["updated_at"] - def test_organization_membership_updated_data_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "object": "organization_membership", - "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY", - "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "status": "active", - "role": {"slug": "admin"}, - "custom_attributes": {"key": {}}, - "directory_managed": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + def test_organization_membership_updated_data_omits_absent_optional_non_nullable_fields(self): + data = {"object": "organization_membership", "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY", "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "status": "active", "role": {"slug": "admin"}, "custom_attributes": {"key": {}}, "directory_managed": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationMembershipUpdatedData.from_dict(data) serialized = instance.to_dict() assert "roles" not in serialized def test_organization_membership_updated_data_round_trips_unknown_enum_values(self): - data = { - "object": "organization_membership", - "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY", - "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "status": "unexpected_organization_membership_updated_data_status", - "role": {"slug": "admin"}, - "roles": [{"slug": "admin"}], - "custom_attributes": {"key": {}}, - "directory_managed": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization_membership", "id": "om_01EHWNCE74X7JSDV0X3SZ3KJNY", "user_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "status": "unexpected_organization_membership_updated_data_status", "role": {"slug": "admin"}, "roles": [{"slug": "admin"}], "custom_attributes": {"key": {}}, "directory_managed": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationMembershipUpdatedData.from_dict(data) assert instance.to_dict() == data @@ -10697,23 +5220,7 @@ def test_organization_role_created_round_trip(self): assert restored.to_dict() == serialized def test_organization_role_created_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "organization_role.created", - "data": { - "object": "organization_role", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "slug": "billing-admin", - "name": "Billing Administrator", - "description": "Can manage billing settings.", - "resource_type_slug": "organization", - "permissions": ["users:read", "users:write"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "organization_role.created", "data": {"object": "organization_role", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "slug": "billing-admin", "name": "Billing Administrator", "description": "Can manage billing settings.", "resource_type_slug": "organization", "permissions": ["users:read", "users:write"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = OrganizationRoleCreated.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -10723,23 +5230,7 @@ def test_organization_role_created_minimal_payload(self): assert serialized["object"] == data["object"] def test_organization_role_created_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "organization_role.created", - "data": { - "object": "organization_role", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "slug": "billing-admin", - "name": "Billing Administrator", - "description": "Can manage billing settings.", - "resource_type_slug": "organization", - "permissions": ["users:read", "users:write"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "organization_role.created", "data": {"object": "organization_role", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "slug": "billing-admin", "name": "Billing Administrator", "description": "Can manage billing settings.", "resource_type_slug": "organization", "permissions": ["users:read", "users:write"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = OrganizationRoleCreated.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -10753,17 +5244,7 @@ def test_organization_role_created_data_round_trip(self): assert restored.to_dict() == serialized def test_organization_role_created_data_minimal_payload(self): - data = { - "object": "organization_role", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "slug": "billing-admin", - "name": "Billing Administrator", - "description": None, - "resource_type_slug": "organization", - "permissions": ["users:read", "users:write"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization_role", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "slug": "billing-admin", "name": "Billing Administrator", "description": None, "resource_type_slug": "organization", "permissions": ["users:read", "users:write"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationRoleCreatedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -10777,17 +5258,7 @@ def test_organization_role_created_data_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_organization_role_created_data_preserves_nullable_fields(self): - data = { - "object": "organization_role", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "slug": "billing-admin", - "name": "Billing Administrator", - "description": None, - "resource_type_slug": "organization", - "permissions": ["users:read", "users:write"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization_role", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "slug": "billing-admin", "name": "Billing Administrator", "description": None, "resource_type_slug": "organization", "permissions": ["users:read", "users:write"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationRoleCreatedData.from_dict(data) serialized = instance.to_dict() assert serialized["description"] is None @@ -10801,23 +5272,7 @@ def test_organization_role_deleted_round_trip(self): assert restored.to_dict() == serialized def test_organization_role_deleted_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "organization_role.deleted", - "data": { - "object": "organization_role", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "slug": "billing-admin", - "name": "Billing Administrator", - "description": "Can manage billing settings.", - "resource_type_slug": "organization", - "permissions": ["users:read", "users:write"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "organization_role.deleted", "data": {"object": "organization_role", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "slug": "billing-admin", "name": "Billing Administrator", "description": "Can manage billing settings.", "resource_type_slug": "organization", "permissions": ["users:read", "users:write"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = OrganizationRoleDeleted.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -10827,23 +5282,7 @@ def test_organization_role_deleted_minimal_payload(self): assert serialized["object"] == data["object"] def test_organization_role_deleted_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "organization_role.deleted", - "data": { - "object": "organization_role", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "slug": "billing-admin", - "name": "Billing Administrator", - "description": "Can manage billing settings.", - "resource_type_slug": "organization", - "permissions": ["users:read", "users:write"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "organization_role.deleted", "data": {"object": "organization_role", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "slug": "billing-admin", "name": "Billing Administrator", "description": "Can manage billing settings.", "resource_type_slug": "organization", "permissions": ["users:read", "users:write"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = OrganizationRoleDeleted.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -10857,17 +5296,7 @@ def test_organization_role_deleted_data_round_trip(self): assert restored.to_dict() == serialized def test_organization_role_deleted_data_minimal_payload(self): - data = { - "object": "organization_role", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "slug": "billing-admin", - "name": "Billing Administrator", - "description": None, - "resource_type_slug": "organization", - "permissions": ["users:read", "users:write"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization_role", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "slug": "billing-admin", "name": "Billing Administrator", "description": None, "resource_type_slug": "organization", "permissions": ["users:read", "users:write"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationRoleDeletedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -10881,17 +5310,7 @@ def test_organization_role_deleted_data_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_organization_role_deleted_data_preserves_nullable_fields(self): - data = { - "object": "organization_role", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "slug": "billing-admin", - "name": "Billing Administrator", - "description": None, - "resource_type_slug": "organization", - "permissions": ["users:read", "users:write"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization_role", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "slug": "billing-admin", "name": "Billing Administrator", "description": None, "resource_type_slug": "organization", "permissions": ["users:read", "users:write"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationRoleDeletedData.from_dict(data) serialized = instance.to_dict() assert serialized["description"] is None @@ -10905,23 +5324,7 @@ def test_organization_role_updated_round_trip(self): assert restored.to_dict() == serialized def test_organization_role_updated_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "organization_role.updated", - "data": { - "object": "organization_role", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "slug": "billing-admin", - "name": "Billing Administrator", - "description": "Can manage billing settings.", - "resource_type_slug": "organization", - "permissions": ["users:read", "users:write"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "organization_role.updated", "data": {"object": "organization_role", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "slug": "billing-admin", "name": "Billing Administrator", "description": "Can manage billing settings.", "resource_type_slug": "organization", "permissions": ["users:read", "users:write"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = OrganizationRoleUpdated.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -10931,23 +5334,7 @@ def test_organization_role_updated_minimal_payload(self): assert serialized["object"] == data["object"] def test_organization_role_updated_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "organization_role.updated", - "data": { - "object": "organization_role", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "slug": "billing-admin", - "name": "Billing Administrator", - "description": "Can manage billing settings.", - "resource_type_slug": "organization", - "permissions": ["users:read", "users:write"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "organization_role.updated", "data": {"object": "organization_role", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "slug": "billing-admin", "name": "Billing Administrator", "description": "Can manage billing settings.", "resource_type_slug": "organization", "permissions": ["users:read", "users:write"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = OrganizationRoleUpdated.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -10961,17 +5348,7 @@ def test_organization_role_updated_data_round_trip(self): assert restored.to_dict() == serialized def test_organization_role_updated_data_minimal_payload(self): - data = { - "object": "organization_role", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "slug": "billing-admin", - "name": "Billing Administrator", - "description": None, - "resource_type_slug": "organization", - "permissions": ["users:read", "users:write"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization_role", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "slug": "billing-admin", "name": "Billing Administrator", "description": None, "resource_type_slug": "organization", "permissions": ["users:read", "users:write"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationRoleUpdatedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -10985,17 +5362,7 @@ def test_organization_role_updated_data_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_organization_role_updated_data_preserves_nullable_fields(self): - data = { - "object": "organization_role", - "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "slug": "billing-admin", - "name": "Billing Administrator", - "description": None, - "resource_type_slug": "organization", - "permissions": ["users:read", "users:write"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization_role", "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "slug": "billing-admin", "name": "Billing Administrator", "description": None, "resource_type_slug": "organization", "permissions": ["users:read", "users:write"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationRoleUpdatedData.from_dict(data) serialized = instance.to_dict() assert serialized["description"] is None @@ -11009,36 +5376,7 @@ def test_organization_updated_round_trip(self): assert restored.to_dict() == serialized def test_organization_updated_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "organization.updated", - "data": { - "object": "organization", - "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "name": "Acme Inc.", - "domains": [ - { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "pending", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } - ], - "metadata": {"tier": "diamond"}, - "external_id": "2fe01467-f7ea-4dd2-8b79-c2b4f56d0191", - "stripe_customer_id": "cus_R9qWAGMQ6nGE7V", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "organization.updated", "data": {"object": "organization", "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Inc.", "domains": [{"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "pending", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}], "metadata": {"tier": "diamond"}, "external_id": "2fe01467-f7ea-4dd2-8b79-c2b4f56d0191", "stripe_customer_id": "cus_R9qWAGMQ6nGE7V", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = OrganizationUpdated.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -11048,36 +5386,7 @@ def test_organization_updated_minimal_payload(self): assert serialized["object"] == data["object"] def test_organization_updated_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "organization.updated", - "data": { - "object": "organization", - "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "name": "Acme Inc.", - "domains": [ - { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "pending", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } - ], - "metadata": {"tier": "diamond"}, - "external_id": "2fe01467-f7ea-4dd2-8b79-c2b4f56d0191", - "stripe_customer_id": "cus_R9qWAGMQ6nGE7V", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "organization.updated", "data": {"object": "organization", "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Inc.", "domains": [{"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "pending", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}], "metadata": {"tier": "diamond"}, "external_id": "2fe01467-f7ea-4dd2-8b79-c2b4f56d0191", "stripe_customer_id": "cus_R9qWAGMQ6nGE7V", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = OrganizationUpdated.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -11091,29 +5400,7 @@ def test_organization_updated_data_round_trip(self): assert restored.to_dict() == serialized def test_organization_updated_data_minimal_payload(self): - data = { - "object": "organization", - "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "name": "Acme Inc.", - "domains": [ - { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "pending", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } - ], - "metadata": {"tier": "diamond"}, - "external_id": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization", "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Inc.", "domains": [{"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "pending", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}], "metadata": {"tier": "diamond"}, "external_id": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationUpdatedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -11126,58 +5413,13 @@ def test_organization_updated_data_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_organization_updated_data_omits_absent_optional_non_nullable_fields(self): - data = { - "object": "organization", - "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "name": "Acme Inc.", - "domains": [ - { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "pending", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } - ], - "metadata": {"tier": "diamond"}, - "external_id": "2fe01467-f7ea-4dd2-8b79-c2b4f56d0191", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization", "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Inc.", "domains": [{"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "pending", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}], "metadata": {"tier": "diamond"}, "external_id": "2fe01467-f7ea-4dd2-8b79-c2b4f56d0191", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationUpdatedData.from_dict(data) serialized = instance.to_dict() assert "stripe_customer_id" not in serialized def test_organization_updated_data_preserves_nullable_fields(self): - data = { - "object": "organization", - "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "name": "Acme Inc.", - "domains": [ - { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "pending", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } - ], - "metadata": {"tier": "diamond"}, - "external_id": None, - "stripe_customer_id": "cus_R9qWAGMQ6nGE7V", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization", "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Inc.", "domains": [{"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "pending", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}], "metadata": {"tier": "diamond"}, "external_id": None, "stripe_customer_id": "cus_R9qWAGMQ6nGE7V", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationUpdatedData.from_dict(data) serialized = instance.to_dict() assert serialized["external_id"] is None @@ -11191,14 +5433,7 @@ def test_organization_updated_data_domain_round_trip(self): assert restored.to_dict() == serialized def test_organization_updated_data_domain_minimal_payload(self): - data = { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationUpdatedDataDomain.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -11208,17 +5443,8 @@ def test_organization_updated_data_domain_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["updated_at"] == data["updated_at"] - def test_organization_updated_data_domain_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + def test_organization_updated_data_domain_omits_absent_optional_non_nullable_fields(self): + data = {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationUpdatedDataDomain.from_dict(data) serialized = instance.to_dict() assert "state" not in serialized @@ -11227,18 +5453,7 @@ def test_organization_updated_data_domain_omits_absent_optional_non_nullable_fie assert "verification_strategy" not in serialized def test_organization_updated_data_domain_round_trips_unknown_enum_values(self): - data = { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "unexpected_organization_updated_data_domain_state", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "unexpected_organization_updated_data_domain_state", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationUpdatedDataDomain.from_dict(data) assert instance.to_dict() == data @@ -11251,20 +5466,7 @@ def test_password_reset_created_round_trip(self): assert restored.to_dict() == serialized def test_password_reset_created_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "password_reset.created", - "data": { - "object": "password_reset", - "id": "password_reset_01E4ZCR3C56J083X43JQXF3JK5", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "expires_at": "2026-01-15T12:00:00.000Z", - "created_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "password_reset.created", "data": {"object": "password_reset", "id": "password_reset_01E4ZCR3C56J083X43JQXF3JK5", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "expires_at": "2026-01-15T12:00:00.000Z", "created_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = PasswordResetCreated.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -11274,20 +5476,7 @@ def test_password_reset_created_minimal_payload(self): assert serialized["object"] == data["object"] def test_password_reset_created_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "password_reset.created", - "data": { - "object": "password_reset", - "id": "password_reset_01E4ZCR3C56J083X43JQXF3JK5", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "expires_at": "2026-01-15T12:00:00.000Z", - "created_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "password_reset.created", "data": {"object": "password_reset", "id": "password_reset_01E4ZCR3C56J083X43JQXF3JK5", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "expires_at": "2026-01-15T12:00:00.000Z", "created_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = PasswordResetCreated.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -11301,14 +5490,7 @@ def test_password_reset_created_data_round_trip(self): assert restored.to_dict() == serialized def test_password_reset_created_data_minimal_payload(self): - data = { - "object": "password_reset", - "id": "password_reset_01E4ZCR3C56J083X43JQXF3JK5", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "expires_at": "2026-01-15T12:00:00.000Z", - "created_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "password_reset", "id": "password_reset_01E4ZCR3C56J083X43JQXF3JK5", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "expires_at": "2026-01-15T12:00:00.000Z", "created_at": "2026-01-15T12:00:00.000Z"} instance = PasswordResetCreatedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -11327,20 +5509,7 @@ def test_password_reset_succeeded_round_trip(self): assert restored.to_dict() == serialized def test_password_reset_succeeded_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "password_reset.succeeded", - "data": { - "object": "password_reset", - "id": "password_reset_01E4ZCR3C56J083X43JQXF3JK5", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "expires_at": "2026-01-15T12:00:00.000Z", - "created_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "password_reset.succeeded", "data": {"object": "password_reset", "id": "password_reset_01E4ZCR3C56J083X43JQXF3JK5", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "expires_at": "2026-01-15T12:00:00.000Z", "created_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = PasswordResetSucceeded.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -11350,20 +5519,7 @@ def test_password_reset_succeeded_minimal_payload(self): assert serialized["object"] == data["object"] def test_password_reset_succeeded_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "password_reset.succeeded", - "data": { - "object": "password_reset", - "id": "password_reset_01E4ZCR3C56J083X43JQXF3JK5", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "expires_at": "2026-01-15T12:00:00.000Z", - "created_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "password_reset.succeeded", "data": {"object": "password_reset", "id": "password_reset_01E4ZCR3C56J083X43JQXF3JK5", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "expires_at": "2026-01-15T12:00:00.000Z", "created_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = PasswordResetSucceeded.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -11377,14 +5533,7 @@ def test_password_reset_succeeded_data_round_trip(self): assert restored.to_dict() == serialized def test_password_reset_succeeded_data_minimal_payload(self): - data = { - "object": "password_reset", - "id": "password_reset_01E4ZCR3C56J083X43JQXF3JK5", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "expires_at": "2026-01-15T12:00:00.000Z", - "created_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "password_reset", "id": "password_reset_01E4ZCR3C56J083X43JQXF3JK5", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "expires_at": "2026-01-15T12:00:00.000Z", "created_at": "2026-01-15T12:00:00.000Z"} instance = PasswordResetSucceededData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -11403,22 +5552,7 @@ def test_permission_created_round_trip(self): assert restored.to_dict() == serialized def test_permission_created_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "permission.created", - "data": { - "object": "permission", - "id": "perm_01EHWNCE74X7JSDV0X3SZ3KJNY", - "slug": "billing:manage", - "name": "Manage Billing", - "description": "Allows managing billing settings.", - "system": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "permission.created", "data": {"object": "permission", "id": "perm_01EHWNCE74X7JSDV0X3SZ3KJNY", "slug": "billing:manage", "name": "Manage Billing", "description": "Allows managing billing settings.", "system": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = PermissionCreated.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -11428,22 +5562,7 @@ def test_permission_created_minimal_payload(self): assert serialized["object"] == data["object"] def test_permission_created_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "permission.created", - "data": { - "object": "permission", - "id": "perm_01EHWNCE74X7JSDV0X3SZ3KJNY", - "slug": "billing:manage", - "name": "Manage Billing", - "description": "Allows managing billing settings.", - "system": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "permission.created", "data": {"object": "permission", "id": "perm_01EHWNCE74X7JSDV0X3SZ3KJNY", "slug": "billing:manage", "name": "Manage Billing", "description": "Allows managing billing settings.", "system": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = PermissionCreated.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -11457,16 +5576,7 @@ def test_permission_created_data_round_trip(self): assert restored.to_dict() == serialized def test_permission_created_data_minimal_payload(self): - data = { - "object": "permission", - "id": "perm_01EHWNCE74X7JSDV0X3SZ3KJNY", - "slug": "billing:manage", - "name": "Manage Billing", - "description": None, - "system": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "permission", "id": "perm_01EHWNCE74X7JSDV0X3SZ3KJNY", "slug": "billing:manage", "name": "Manage Billing", "description": None, "system": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = PermissionCreatedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -11479,16 +5589,7 @@ def test_permission_created_data_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_permission_created_data_preserves_nullable_fields(self): - data = { - "object": "permission", - "id": "perm_01EHWNCE74X7JSDV0X3SZ3KJNY", - "slug": "billing:manage", - "name": "Manage Billing", - "description": None, - "system": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "permission", "id": "perm_01EHWNCE74X7JSDV0X3SZ3KJNY", "slug": "billing:manage", "name": "Manage Billing", "description": None, "system": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = PermissionCreatedData.from_dict(data) serialized = instance.to_dict() assert serialized["description"] is None @@ -11502,22 +5603,7 @@ def test_permission_deleted_round_trip(self): assert restored.to_dict() == serialized def test_permission_deleted_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "permission.deleted", - "data": { - "object": "permission", - "id": "perm_01EHWNCE74X7JSDV0X3SZ3KJNY", - "slug": "billing:manage", - "name": "Manage Billing", - "description": "Allows managing billing settings.", - "system": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "permission.deleted", "data": {"object": "permission", "id": "perm_01EHWNCE74X7JSDV0X3SZ3KJNY", "slug": "billing:manage", "name": "Manage Billing", "description": "Allows managing billing settings.", "system": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = PermissionDeleted.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -11527,22 +5613,7 @@ def test_permission_deleted_minimal_payload(self): assert serialized["object"] == data["object"] def test_permission_deleted_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "permission.deleted", - "data": { - "object": "permission", - "id": "perm_01EHWNCE74X7JSDV0X3SZ3KJNY", - "slug": "billing:manage", - "name": "Manage Billing", - "description": "Allows managing billing settings.", - "system": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "permission.deleted", "data": {"object": "permission", "id": "perm_01EHWNCE74X7JSDV0X3SZ3KJNY", "slug": "billing:manage", "name": "Manage Billing", "description": "Allows managing billing settings.", "system": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = PermissionDeleted.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -11556,16 +5627,7 @@ def test_permission_deleted_data_round_trip(self): assert restored.to_dict() == serialized def test_permission_deleted_data_minimal_payload(self): - data = { - "object": "permission", - "id": "perm_01EHWNCE74X7JSDV0X3SZ3KJNY", - "slug": "billing:manage", - "name": "Manage Billing", - "description": None, - "system": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "permission", "id": "perm_01EHWNCE74X7JSDV0X3SZ3KJNY", "slug": "billing:manage", "name": "Manage Billing", "description": None, "system": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = PermissionDeletedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -11578,16 +5640,7 @@ def test_permission_deleted_data_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_permission_deleted_data_preserves_nullable_fields(self): - data = { - "object": "permission", - "id": "perm_01EHWNCE74X7JSDV0X3SZ3KJNY", - "slug": "billing:manage", - "name": "Manage Billing", - "description": None, - "system": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "permission", "id": "perm_01EHWNCE74X7JSDV0X3SZ3KJNY", "slug": "billing:manage", "name": "Manage Billing", "description": None, "system": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = PermissionDeletedData.from_dict(data) serialized = instance.to_dict() assert serialized["description"] is None @@ -11601,22 +5654,7 @@ def test_permission_updated_round_trip(self): assert restored.to_dict() == serialized def test_permission_updated_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "permission.updated", - "data": { - "object": "permission", - "id": "perm_01EHWNCE74X7JSDV0X3SZ3KJNY", - "slug": "billing:manage", - "name": "Manage Billing", - "description": "Allows managing billing settings.", - "system": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "permission.updated", "data": {"object": "permission", "id": "perm_01EHWNCE74X7JSDV0X3SZ3KJNY", "slug": "billing:manage", "name": "Manage Billing", "description": "Allows managing billing settings.", "system": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = PermissionUpdated.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -11626,22 +5664,7 @@ def test_permission_updated_minimal_payload(self): assert serialized["object"] == data["object"] def test_permission_updated_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "permission.updated", - "data": { - "object": "permission", - "id": "perm_01EHWNCE74X7JSDV0X3SZ3KJNY", - "slug": "billing:manage", - "name": "Manage Billing", - "description": "Allows managing billing settings.", - "system": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "permission.updated", "data": {"object": "permission", "id": "perm_01EHWNCE74X7JSDV0X3SZ3KJNY", "slug": "billing:manage", "name": "Manage Billing", "description": "Allows managing billing settings.", "system": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = PermissionUpdated.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -11655,16 +5678,7 @@ def test_permission_updated_data_round_trip(self): assert restored.to_dict() == serialized def test_permission_updated_data_minimal_payload(self): - data = { - "object": "permission", - "id": "perm_01EHWNCE74X7JSDV0X3SZ3KJNY", - "slug": "billing:manage", - "name": "Manage Billing", - "description": None, - "system": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "permission", "id": "perm_01EHWNCE74X7JSDV0X3SZ3KJNY", "slug": "billing:manage", "name": "Manage Billing", "description": None, "system": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = PermissionUpdatedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -11677,16 +5691,7 @@ def test_permission_updated_data_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_permission_updated_data_preserves_nullable_fields(self): - data = { - "object": "permission", - "id": "perm_01EHWNCE74X7JSDV0X3SZ3KJNY", - "slug": "billing:manage", - "name": "Manage Billing", - "description": None, - "system": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "permission", "id": "perm_01EHWNCE74X7JSDV0X3SZ3KJNY", "slug": "billing:manage", "name": "Manage Billing", "description": None, "system": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = PermissionUpdatedData.from_dict(data) serialized = instance.to_dict() assert serialized["description"] is None @@ -11700,20 +5705,7 @@ def test_role_created_round_trip(self): assert restored.to_dict() == serialized def test_role_created_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "role.created", - "data": { - "object": "role", - "slug": "admin", - "resource_type_slug": "organization", - "permissions": ["users:read", "users:write"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "role.created", "data": {"object": "role", "slug": "admin", "resource_type_slug": "organization", "permissions": ["users:read", "users:write"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = RoleCreated.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -11723,20 +5715,7 @@ def test_role_created_minimal_payload(self): assert serialized["object"] == data["object"] def test_role_created_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "role.created", - "data": { - "object": "role", - "slug": "admin", - "resource_type_slug": "organization", - "permissions": ["users:read", "users:write"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "role.created", "data": {"object": "role", "slug": "admin", "resource_type_slug": "organization", "permissions": ["users:read", "users:write"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = RoleCreated.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -11750,13 +5729,7 @@ def test_role_created_data_round_trip(self): assert restored.to_dict() == serialized def test_role_created_data_minimal_payload(self): - data = { - "object": "role", - "slug": "admin", - "resource_type_slug": "organization", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "role", "slug": "admin", "resource_type_slug": "organization", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = RoleCreatedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -11766,13 +5739,7 @@ def test_role_created_data_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_role_created_data_omits_absent_optional_non_nullable_fields(self): - data = { - "object": "role", - "slug": "admin", - "resource_type_slug": "organization", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "role", "slug": "admin", "resource_type_slug": "organization", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = RoleCreatedData.from_dict(data) serialized = instance.to_dict() assert "permissions" not in serialized @@ -11786,20 +5753,7 @@ def test_role_deleted_round_trip(self): assert restored.to_dict() == serialized def test_role_deleted_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "role.deleted", - "data": { - "object": "role", - "slug": "admin", - "resource_type_slug": "organization", - "permissions": ["users:read", "users:write"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "role.deleted", "data": {"object": "role", "slug": "admin", "resource_type_slug": "organization", "permissions": ["users:read", "users:write"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = RoleDeleted.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -11809,20 +5763,7 @@ def test_role_deleted_minimal_payload(self): assert serialized["object"] == data["object"] def test_role_deleted_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "role.deleted", - "data": { - "object": "role", - "slug": "admin", - "resource_type_slug": "organization", - "permissions": ["users:read", "users:write"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "role.deleted", "data": {"object": "role", "slug": "admin", "resource_type_slug": "organization", "permissions": ["users:read", "users:write"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = RoleDeleted.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -11836,13 +5777,7 @@ def test_role_deleted_data_round_trip(self): assert restored.to_dict() == serialized def test_role_deleted_data_minimal_payload(self): - data = { - "object": "role", - "slug": "admin", - "resource_type_slug": "organization", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "role", "slug": "admin", "resource_type_slug": "organization", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = RoleDeletedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -11852,13 +5787,7 @@ def test_role_deleted_data_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_role_deleted_data_omits_absent_optional_non_nullable_fields(self): - data = { - "object": "role", - "slug": "admin", - "resource_type_slug": "organization", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "role", "slug": "admin", "resource_type_slug": "organization", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = RoleDeletedData.from_dict(data) serialized = instance.to_dict() assert "permissions" not in serialized @@ -11872,20 +5801,7 @@ def test_role_updated_round_trip(self): assert restored.to_dict() == serialized def test_role_updated_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "role.updated", - "data": { - "object": "role", - "slug": "admin", - "resource_type_slug": "organization", - "permissions": ["users:read", "users:write"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "role.updated", "data": {"object": "role", "slug": "admin", "resource_type_slug": "organization", "permissions": ["users:read", "users:write"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = RoleUpdated.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -11895,20 +5811,7 @@ def test_role_updated_minimal_payload(self): assert serialized["object"] == data["object"] def test_role_updated_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "role.updated", - "data": { - "object": "role", - "slug": "admin", - "resource_type_slug": "organization", - "permissions": ["users:read", "users:write"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "role.updated", "data": {"object": "role", "slug": "admin", "resource_type_slug": "organization", "permissions": ["users:read", "users:write"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = RoleUpdated.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -11922,13 +5825,7 @@ def test_role_updated_data_round_trip(self): assert restored.to_dict() == serialized def test_role_updated_data_minimal_payload(self): - data = { - "object": "role", - "slug": "admin", - "resource_type_slug": "organization", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "role", "slug": "admin", "resource_type_slug": "organization", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = RoleUpdatedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -11938,13 +5835,7 @@ def test_role_updated_data_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_role_updated_data_omits_absent_optional_non_nullable_fields(self): - data = { - "object": "role", - "slug": "admin", - "resource_type_slug": "organization", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "role", "slug": "admin", "resource_type_slug": "organization", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = RoleUpdatedData.from_dict(data) serialized = instance.to_dict() assert "permissions" not in serialized @@ -11958,30 +5849,7 @@ def test_session_created_round_trip(self): assert restored.to_dict() == serialized def test_session_created_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "session.created", - "data": { - "object": "session", - "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8", - "impersonator": { - "email": "admin@foocorp.com", - "reason": "Investigating an issue with the customer's account.", - }, - "ip_address": "198.51.100.42", - "organization_id": "org_01H945H0YD4F97JN9MATX7BYAG", - "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "auth_method": "sso", - "status": "active", - "expires_at": "2026-01-15T12:00:00.000Z", - "ended_at": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "session.created", "data": {"object": "session", "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8", "impersonator": {"email": "admin@foocorp.com", "reason": "Investigating an issue with the customer's account."}, "ip_address": "198.51.100.42", "organization_id": "org_01H945H0YD4F97JN9MATX7BYAG", "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "auth_method": "sso", "status": "active", "expires_at": "2026-01-15T12:00:00.000Z", "ended_at": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = SessionCreated.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -11991,30 +5859,7 @@ def test_session_created_minimal_payload(self): assert serialized["object"] == data["object"] def test_session_created_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "session.created", - "data": { - "object": "session", - "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8", - "impersonator": { - "email": "admin@foocorp.com", - "reason": "Investigating an issue with the customer's account.", - }, - "ip_address": "198.51.100.42", - "organization_id": "org_01H945H0YD4F97JN9MATX7BYAG", - "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "auth_method": "sso", - "status": "active", - "expires_at": "2026-01-15T12:00:00.000Z", - "ended_at": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "session.created", "data": {"object": "session", "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8", "impersonator": {"email": "admin@foocorp.com", "reason": "Investigating an issue with the customer's account."}, "ip_address": "198.51.100.42", "organization_id": "org_01H945H0YD4F97JN9MATX7BYAG", "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "auth_method": "sso", "status": "active", "expires_at": "2026-01-15T12:00:00.000Z", "ended_at": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = SessionCreated.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -12028,19 +5873,7 @@ def test_session_created_data_round_trip(self): assert restored.to_dict() == serialized def test_session_created_data_minimal_payload(self): - data = { - "object": "session", - "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8", - "ip_address": None, - "user_agent": None, - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "auth_method": "sso", - "status": "active", - "expires_at": "2026-01-15T12:00:00.000Z", - "ended_at": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "session", "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8", "ip_address": None, "user_agent": None, "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "auth_method": "sso", "status": "active", "expires_at": "2026-01-15T12:00:00.000Z", "ended_at": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = SessionCreatedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -12056,43 +5889,14 @@ def test_session_created_data_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_session_created_data_omits_absent_optional_non_nullable_fields(self): - data = { - "object": "session", - "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8", - "ip_address": "198.51.100.42", - "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "auth_method": "sso", - "status": "active", - "expires_at": "2026-01-15T12:00:00.000Z", - "ended_at": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "session", "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8", "ip_address": "198.51.100.42", "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "auth_method": "sso", "status": "active", "expires_at": "2026-01-15T12:00:00.000Z", "ended_at": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = SessionCreatedData.from_dict(data) serialized = instance.to_dict() assert "impersonator" not in serialized assert "organization_id" not in serialized def test_session_created_data_preserves_nullable_fields(self): - data = { - "object": "session", - "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8", - "impersonator": { - "email": "admin@foocorp.com", - "reason": "Investigating an issue with the customer's account.", - }, - "ip_address": None, - "organization_id": "org_01H945H0YD4F97JN9MATX7BYAG", - "user_agent": None, - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "auth_method": "sso", - "status": "active", - "expires_at": "2026-01-15T12:00:00.000Z", - "ended_at": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "session", "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8", "impersonator": {"email": "admin@foocorp.com", "reason": "Investigating an issue with the customer's account."}, "ip_address": None, "organization_id": "org_01H945H0YD4F97JN9MATX7BYAG", "user_agent": None, "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "auth_method": "sso", "status": "active", "expires_at": "2026-01-15T12:00:00.000Z", "ended_at": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = SessionCreatedData.from_dict(data) serialized = instance.to_dict() assert serialized["ip_address"] is None @@ -12100,24 +5904,7 @@ def test_session_created_data_preserves_nullable_fields(self): assert serialized["ended_at"] is None def test_session_created_data_round_trips_unknown_enum_values(self): - data = { - "object": "session", - "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8", - "impersonator": { - "email": "admin@foocorp.com", - "reason": "Investigating an issue with the customer's account.", - }, - "ip_address": "198.51.100.42", - "organization_id": "org_01H945H0YD4F97JN9MATX7BYAG", - "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "auth_method": "unexpected_session_created_data_auth_method", - "status": "active", - "expires_at": "2026-01-15T12:00:00.000Z", - "ended_at": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "session", "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8", "impersonator": {"email": "admin@foocorp.com", "reason": "Investigating an issue with the customer's account."}, "ip_address": "198.51.100.42", "organization_id": "org_01H945H0YD4F97JN9MATX7BYAG", "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "auth_method": "unexpected_session_created_data_auth_method", "status": "active", "expires_at": "2026-01-15T12:00:00.000Z", "ended_at": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = SessionCreatedData.from_dict(data) assert instance.to_dict() == data @@ -12151,30 +5938,7 @@ def test_session_revoked_round_trip(self): assert restored.to_dict() == serialized def test_session_revoked_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "session.revoked", - "data": { - "object": "session", - "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8", - "impersonator": { - "email": "admin@foocorp.com", - "reason": "Investigating an issue with the customer's account.", - }, - "ip_address": "198.51.100.42", - "organization_id": "org_01H945H0YD4F97JN9MATX7BYAG", - "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "auth_method": "sso", - "status": "active", - "expires_at": "2026-01-15T12:00:00.000Z", - "ended_at": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "session.revoked", "data": {"object": "session", "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8", "impersonator": {"email": "admin@foocorp.com", "reason": "Investigating an issue with the customer's account."}, "ip_address": "198.51.100.42", "organization_id": "org_01H945H0YD4F97JN9MATX7BYAG", "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "auth_method": "sso", "status": "active", "expires_at": "2026-01-15T12:00:00.000Z", "ended_at": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = SessionRevoked.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -12184,30 +5948,7 @@ def test_session_revoked_minimal_payload(self): assert serialized["object"] == data["object"] def test_session_revoked_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "session.revoked", - "data": { - "object": "session", - "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8", - "impersonator": { - "email": "admin@foocorp.com", - "reason": "Investigating an issue with the customer's account.", - }, - "ip_address": "198.51.100.42", - "organization_id": "org_01H945H0YD4F97JN9MATX7BYAG", - "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "auth_method": "sso", - "status": "active", - "expires_at": "2026-01-15T12:00:00.000Z", - "ended_at": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "session.revoked", "data": {"object": "session", "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8", "impersonator": {"email": "admin@foocorp.com", "reason": "Investigating an issue with the customer's account."}, "ip_address": "198.51.100.42", "organization_id": "org_01H945H0YD4F97JN9MATX7BYAG", "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "auth_method": "sso", "status": "active", "expires_at": "2026-01-15T12:00:00.000Z", "ended_at": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = SessionRevoked.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -12221,19 +5962,7 @@ def test_session_revoked_data_round_trip(self): assert restored.to_dict() == serialized def test_session_revoked_data_minimal_payload(self): - data = { - "object": "session", - "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8", - "ip_address": None, - "user_agent": None, - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "auth_method": "sso", - "status": "active", - "expires_at": "2026-01-15T12:00:00.000Z", - "ended_at": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "session", "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8", "ip_address": None, "user_agent": None, "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "auth_method": "sso", "status": "active", "expires_at": "2026-01-15T12:00:00.000Z", "ended_at": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = SessionRevokedData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -12249,43 +5978,14 @@ def test_session_revoked_data_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_session_revoked_data_omits_absent_optional_non_nullable_fields(self): - data = { - "object": "session", - "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8", - "ip_address": "198.51.100.42", - "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "auth_method": "sso", - "status": "active", - "expires_at": "2026-01-15T12:00:00.000Z", - "ended_at": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "session", "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8", "ip_address": "198.51.100.42", "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "auth_method": "sso", "status": "active", "expires_at": "2026-01-15T12:00:00.000Z", "ended_at": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = SessionRevokedData.from_dict(data) serialized = instance.to_dict() assert "impersonator" not in serialized assert "organization_id" not in serialized def test_session_revoked_data_preserves_nullable_fields(self): - data = { - "object": "session", - "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8", - "impersonator": { - "email": "admin@foocorp.com", - "reason": "Investigating an issue with the customer's account.", - }, - "ip_address": None, - "organization_id": "org_01H945H0YD4F97JN9MATX7BYAG", - "user_agent": None, - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "auth_method": "sso", - "status": "active", - "expires_at": "2026-01-15T12:00:00.000Z", - "ended_at": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "session", "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8", "impersonator": {"email": "admin@foocorp.com", "reason": "Investigating an issue with the customer's account."}, "ip_address": None, "organization_id": "org_01H945H0YD4F97JN9MATX7BYAG", "user_agent": None, "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "auth_method": "sso", "status": "active", "expires_at": "2026-01-15T12:00:00.000Z", "ended_at": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = SessionRevokedData.from_dict(data) serialized = instance.to_dict() assert serialized["ip_address"] is None @@ -12293,24 +5993,7 @@ def test_session_revoked_data_preserves_nullable_fields(self): assert serialized["ended_at"] is None def test_session_revoked_data_round_trips_unknown_enum_values(self): - data = { - "object": "session", - "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8", - "impersonator": { - "email": "admin@foocorp.com", - "reason": "Investigating an issue with the customer's account.", - }, - "ip_address": "198.51.100.42", - "organization_id": "org_01H945H0YD4F97JN9MATX7BYAG", - "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "auth_method": "unexpected_session_revoked_data_auth_method", - "status": "active", - "expires_at": "2026-01-15T12:00:00.000Z", - "ended_at": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "session", "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8", "impersonator": {"email": "admin@foocorp.com", "reason": "Investigating an issue with the customer's account."}, "ip_address": "198.51.100.42", "organization_id": "org_01H945H0YD4F97JN9MATX7BYAG", "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "auth_method": "unexpected_session_revoked_data_auth_method", "status": "active", "expires_at": "2026-01-15T12:00:00.000Z", "ended_at": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = SessionRevokedData.from_dict(data) assert instance.to_dict() == data @@ -12344,27 +6027,7 @@ def test_user_created_round_trip(self): assert restored.to_dict() == serialized def test_user_created_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "user.created", - "data": { - "object": "user", - "id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "first_name": "Marcelina", - "last_name": "Davis", - "profile_picture_url": "https://workoscdn.com/images/v1/123abc", - "email": "marcelina.davis@example.com", - "email_verified": True, - "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222", - "metadata": {"timezone": "America/New_York"}, - "last_sign_in_at": "2025-06-25T19:07:33.155Z", - "locale": "en-US", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "user.created", "data": {"object": "user", "id": "user_01E4ZCR3C56J083X43JQXF3JK5", "first_name": "Marcelina", "last_name": "Davis", "profile_picture_url": "https://workoscdn.com/images/v1/123abc", "email": "marcelina.davis@example.com", "email_verified": True, "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222", "metadata": {"timezone": "America/New_York"}, "last_sign_in_at": "2025-06-25T19:07:33.155Z", "locale": "en-US", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = UserCreated.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -12374,27 +6037,7 @@ def test_user_created_minimal_payload(self): assert serialized["object"] == data["object"] def test_user_created_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "user.created", - "data": { - "object": "user", - "id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "first_name": "Marcelina", - "last_name": "Davis", - "profile_picture_url": "https://workoscdn.com/images/v1/123abc", - "email": "marcelina.davis@example.com", - "email_verified": True, - "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222", - "metadata": {"timezone": "America/New_York"}, - "last_sign_in_at": "2025-06-25T19:07:33.155Z", - "locale": "en-US", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "user.created", "data": {"object": "user", "id": "user_01E4ZCR3C56J083X43JQXF3JK5", "first_name": "Marcelina", "last_name": "Davis", "profile_picture_url": "https://workoscdn.com/images/v1/123abc", "email": "marcelina.davis@example.com", "email_verified": True, "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222", "metadata": {"timezone": "America/New_York"}, "last_sign_in_at": "2025-06-25T19:07:33.155Z", "locale": "en-US", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = UserCreated.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -12408,27 +6051,7 @@ def test_user_deleted_round_trip(self): assert restored.to_dict() == serialized def test_user_deleted_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "user.deleted", - "data": { - "object": "user", - "id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "first_name": "Marcelina", - "last_name": "Davis", - "profile_picture_url": "https://workoscdn.com/images/v1/123abc", - "email": "marcelina.davis@example.com", - "email_verified": True, - "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222", - "metadata": {"timezone": "America/New_York"}, - "last_sign_in_at": "2025-06-25T19:07:33.155Z", - "locale": "en-US", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "user.deleted", "data": {"object": "user", "id": "user_01E4ZCR3C56J083X43JQXF3JK5", "first_name": "Marcelina", "last_name": "Davis", "profile_picture_url": "https://workoscdn.com/images/v1/123abc", "email": "marcelina.davis@example.com", "email_verified": True, "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222", "metadata": {"timezone": "America/New_York"}, "last_sign_in_at": "2025-06-25T19:07:33.155Z", "locale": "en-US", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = UserDeleted.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -12438,27 +6061,7 @@ def test_user_deleted_minimal_payload(self): assert serialized["object"] == data["object"] def test_user_deleted_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "user.deleted", - "data": { - "object": "user", - "id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "first_name": "Marcelina", - "last_name": "Davis", - "profile_picture_url": "https://workoscdn.com/images/v1/123abc", - "email": "marcelina.davis@example.com", - "email_verified": True, - "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222", - "metadata": {"timezone": "America/New_York"}, - "last_sign_in_at": "2025-06-25T19:07:33.155Z", - "locale": "en-US", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "user.deleted", "data": {"object": "user", "id": "user_01E4ZCR3C56J083X43JQXF3JK5", "first_name": "Marcelina", "last_name": "Davis", "profile_picture_url": "https://workoscdn.com/images/v1/123abc", "email": "marcelina.davis@example.com", "email_verified": True, "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222", "metadata": {"timezone": "America/New_York"}, "last_sign_in_at": "2025-06-25T19:07:33.155Z", "locale": "en-US", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = UserDeleted.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -12472,27 +6075,7 @@ def test_user_updated_round_trip(self): assert restored.to_dict() == serialized def test_user_updated_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "user.updated", - "data": { - "object": "user", - "id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "first_name": "Marcelina", - "last_name": "Davis", - "profile_picture_url": "https://workoscdn.com/images/v1/123abc", - "email": "marcelina.davis@example.com", - "email_verified": True, - "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222", - "metadata": {"timezone": "America/New_York"}, - "last_sign_in_at": "2025-06-25T19:07:33.155Z", - "locale": "en-US", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "user.updated", "data": {"object": "user", "id": "user_01E4ZCR3C56J083X43JQXF3JK5", "first_name": "Marcelina", "last_name": "Davis", "profile_picture_url": "https://workoscdn.com/images/v1/123abc", "email": "marcelina.davis@example.com", "email_verified": True, "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222", "metadata": {"timezone": "America/New_York"}, "last_sign_in_at": "2025-06-25T19:07:33.155Z", "locale": "en-US", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = UserUpdated.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -12502,27 +6085,7 @@ def test_user_updated_minimal_payload(self): assert serialized["object"] == data["object"] def test_user_updated_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "user.updated", - "data": { - "object": "user", - "id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "first_name": "Marcelina", - "last_name": "Davis", - "profile_picture_url": "https://workoscdn.com/images/v1/123abc", - "email": "marcelina.davis@example.com", - "email_verified": True, - "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222", - "metadata": {"timezone": "America/New_York"}, - "last_sign_in_at": "2025-06-25T19:07:33.155Z", - "locale": "en-US", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "user.updated", "data": {"object": "user", "id": "user_01E4ZCR3C56J083X43JQXF3JK5", "first_name": "Marcelina", "last_name": "Davis", "profile_picture_url": "https://workoscdn.com/images/v1/123abc", "email": "marcelina.davis@example.com", "email_verified": True, "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222", "metadata": {"timezone": "America/New_York"}, "last_sign_in_at": "2025-06-25T19:07:33.155Z", "locale": "en-US", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = UserUpdated.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -12536,17 +6099,7 @@ def test_vault_byok_key_verification_completed_round_trip(self): assert restored.to_dict() == serialized def test_vault_byok_key_verification_completed_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "vault.byok_key.verification_completed", - "data": { - "organization_id": "org_01EHT88Z8J8795GZNQ4ZP1J81T", - "key_provider": "AWS_KMS", - "verified": True, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "vault.byok_key.verification_completed", "data": {"organization_id": "org_01EHT88Z8J8795GZNQ4ZP1J81T", "key_provider": "AWS_KMS", "verified": True}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = VaultByokKeyVerificationCompleted.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -12555,20 +6108,8 @@ def test_vault_byok_key_verification_completed_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["object"] == data["object"] - def test_vault_byok_key_verification_completed_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "vault.byok_key.verification_completed", - "data": { - "organization_id": "org_01EHT88Z8J8795GZNQ4ZP1J81T", - "key_provider": "AWS_KMS", - "verified": True, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + def test_vault_byok_key_verification_completed_omits_absent_optional_non_nullable_fields(self): + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "vault.byok_key.verification_completed", "data": {"organization_id": "org_01EHT88Z8J8795GZNQ4ZP1J81T", "key_provider": "AWS_KMS", "verified": True}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = VaultByokKeyVerificationCompleted.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -12582,25 +6123,15 @@ def test_vault_byok_key_verification_completed_data_round_trip(self): assert restored.to_dict() == serialized def test_vault_byok_key_verification_completed_data_minimal_payload(self): - data = { - "organization_id": "org_01EHT88Z8J8795GZNQ4ZP1J81T", - "key_provider": "AWS_KMS", - "verified": True, - } + data = {"organization_id": "org_01EHT88Z8J8795GZNQ4ZP1J81T", "key_provider": "AWS_KMS", "verified": True} instance = VaultByokKeyVerificationCompletedData.from_dict(data) serialized = instance.to_dict() assert serialized["organization_id"] == data["organization_id"] assert serialized["key_provider"] == data["key_provider"] assert serialized["verified"] == data["verified"] - def test_vault_byok_key_verification_completed_data_round_trips_unknown_enum_values( - self, - ): - data = { - "organization_id": "org_01EHT88Z8J8795GZNQ4ZP1J81T", - "key_provider": "unexpected_vault_byok_key_verification_completed_data_key_provider", - "verified": True, - } + def test_vault_byok_key_verification_completed_data_round_trips_unknown_enum_values(self): + data = {"organization_id": "org_01EHT88Z8J8795GZNQ4ZP1J81T", "key_provider": "unexpected_vault_byok_key_verification_completed_data_key_provider", "verified": True} instance = VaultByokKeyVerificationCompletedData.from_dict(data) assert instance.to_dict() == data @@ -12613,20 +6144,7 @@ def test_vault_data_created_round_trip(self): assert restored.to_dict() == serialized def test_vault_data_created_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "vault.data.created", - "data": { - "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor_source": "api", - "actor_name": "Jane Doe", - "kv_name": "user-secrets", - "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY", - "key_context": {"key": "test_value"}, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "vault.data.created", "data": {"actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor_source": "api", "actor_name": "Jane Doe", "kv_name": "user-secrets", "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY", "key_context": {"key": "test_value"}}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = VaultDataCreated.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -12636,20 +6154,7 @@ def test_vault_data_created_minimal_payload(self): assert serialized["object"] == data["object"] def test_vault_data_created_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "vault.data.created", - "data": { - "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor_source": "api", - "actor_name": "Jane Doe", - "kv_name": "user-secrets", - "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY", - "key_context": {"key": "test_value"}, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "vault.data.created", "data": {"actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor_source": "api", "actor_name": "Jane Doe", "kv_name": "user-secrets", "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY", "key_context": {"key": "test_value"}}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = VaultDataCreated.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -12663,14 +6168,7 @@ def test_vault_data_created_data_round_trip(self): assert restored.to_dict() == serialized def test_vault_data_created_data_minimal_payload(self): - data = { - "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor_source": "api", - "actor_name": "Jane Doe", - "kv_name": "user-secrets", - "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY", - "key_context": {"key": "test_value"}, - } + data = {"actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor_source": "api", "actor_name": "Jane Doe", "kv_name": "user-secrets", "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY", "key_context": {"key": "test_value"}} instance = VaultDataCreatedData.from_dict(data) serialized = instance.to_dict() assert serialized["actor_id"] == data["actor_id"] @@ -12681,14 +6179,7 @@ def test_vault_data_created_data_minimal_payload(self): assert serialized["key_context"] == data["key_context"] def test_vault_data_created_data_round_trips_unknown_enum_values(self): - data = { - "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor_source": "unexpected_vault_data_created_data_actor_source", - "actor_name": "Jane Doe", - "kv_name": "user-secrets", - "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY", - "key_context": {"key": "test_value"}, - } + data = {"actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor_source": "unexpected_vault_data_created_data_actor_source", "actor_name": "Jane Doe", "kv_name": "user-secrets", "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY", "key_context": {"key": "test_value"}} instance = VaultDataCreatedData.from_dict(data) assert instance.to_dict() == data @@ -12701,18 +6192,7 @@ def test_vault_data_deleted_round_trip(self): assert restored.to_dict() == serialized def test_vault_data_deleted_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "vault.data.deleted", - "data": { - "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor_source": "api", - "actor_name": "Jane Doe", - "kv_name": "user-secrets", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "vault.data.deleted", "data": {"actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor_source": "api", "actor_name": "Jane Doe", "kv_name": "user-secrets"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = VaultDataDeleted.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -12722,18 +6202,7 @@ def test_vault_data_deleted_minimal_payload(self): assert serialized["object"] == data["object"] def test_vault_data_deleted_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "vault.data.deleted", - "data": { - "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor_source": "api", - "actor_name": "Jane Doe", - "kv_name": "user-secrets", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "vault.data.deleted", "data": {"actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor_source": "api", "actor_name": "Jane Doe", "kv_name": "user-secrets"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = VaultDataDeleted.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -12747,12 +6216,7 @@ def test_vault_data_deleted_data_round_trip(self): assert restored.to_dict() == serialized def test_vault_data_deleted_data_minimal_payload(self): - data = { - "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor_source": "api", - "actor_name": "Jane Doe", - "kv_name": "user-secrets", - } + data = {"actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor_source": "api", "actor_name": "Jane Doe", "kv_name": "user-secrets"} instance = VaultDataDeletedData.from_dict(data) serialized = instance.to_dict() assert serialized["actor_id"] == data["actor_id"] @@ -12761,12 +6225,7 @@ def test_vault_data_deleted_data_minimal_payload(self): assert serialized["kv_name"] == data["kv_name"] def test_vault_data_deleted_data_round_trips_unknown_enum_values(self): - data = { - "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor_source": "unexpected_vault_data_deleted_data_actor_source", - "actor_name": "Jane Doe", - "kv_name": "user-secrets", - } + data = {"actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor_source": "unexpected_vault_data_deleted_data_actor_source", "actor_name": "Jane Doe", "kv_name": "user-secrets"} instance = VaultDataDeletedData.from_dict(data) assert instance.to_dict() == data @@ -12779,19 +6238,7 @@ def test_vault_data_read_round_trip(self): assert restored.to_dict() == serialized def test_vault_data_read_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "vault.data.read", - "data": { - "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor_source": "api", - "actor_name": "Jane Doe", - "kv_name": "user-secrets", - "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "vault.data.read", "data": {"actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor_source": "api", "actor_name": "Jane Doe", "kv_name": "user-secrets", "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = VaultDataRead.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -12801,19 +6248,7 @@ def test_vault_data_read_minimal_payload(self): assert serialized["object"] == data["object"] def test_vault_data_read_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "vault.data.read", - "data": { - "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor_source": "api", - "actor_name": "Jane Doe", - "kv_name": "user-secrets", - "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "vault.data.read", "data": {"actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor_source": "api", "actor_name": "Jane Doe", "kv_name": "user-secrets", "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = VaultDataRead.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -12827,13 +6262,7 @@ def test_vault_data_read_data_round_trip(self): assert restored.to_dict() == serialized def test_vault_data_read_data_minimal_payload(self): - data = { - "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor_source": "api", - "actor_name": "Jane Doe", - "kv_name": "user-secrets", - "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY", - } + data = {"actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor_source": "api", "actor_name": "Jane Doe", "kv_name": "user-secrets", "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY"} instance = VaultDataReadData.from_dict(data) serialized = instance.to_dict() assert serialized["actor_id"] == data["actor_id"] @@ -12843,13 +6272,7 @@ def test_vault_data_read_data_minimal_payload(self): assert serialized["key_id"] == data["key_id"] def test_vault_data_read_data_round_trips_unknown_enum_values(self): - data = { - "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor_source": "unexpected_vault_data_read_data_actor_source", - "actor_name": "Jane Doe", - "kv_name": "user-secrets", - "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY", - } + data = {"actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor_source": "unexpected_vault_data_read_data_actor_source", "actor_name": "Jane Doe", "kv_name": "user-secrets", "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY"} instance = VaultDataReadData.from_dict(data) assert instance.to_dict() == data @@ -12862,20 +6285,7 @@ def test_vault_data_updated_round_trip(self): assert restored.to_dict() == serialized def test_vault_data_updated_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "vault.data.updated", - "data": { - "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor_source": "api", - "actor_name": "Jane Doe", - "kv_name": "user-secrets", - "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY", - "key_context": {"key": "test_value"}, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "vault.data.updated", "data": {"actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor_source": "api", "actor_name": "Jane Doe", "kv_name": "user-secrets", "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY", "key_context": {"key": "test_value"}}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = VaultDataUpdated.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -12885,20 +6295,7 @@ def test_vault_data_updated_minimal_payload(self): assert serialized["object"] == data["object"] def test_vault_data_updated_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "vault.data.updated", - "data": { - "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor_source": "api", - "actor_name": "Jane Doe", - "kv_name": "user-secrets", - "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY", - "key_context": {"key": "test_value"}, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "vault.data.updated", "data": {"actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor_source": "api", "actor_name": "Jane Doe", "kv_name": "user-secrets", "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY", "key_context": {"key": "test_value"}}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = VaultDataUpdated.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -12912,14 +6309,7 @@ def test_vault_data_updated_data_round_trip(self): assert restored.to_dict() == serialized def test_vault_data_updated_data_minimal_payload(self): - data = { - "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor_source": "api", - "actor_name": "Jane Doe", - "kv_name": "user-secrets", - "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY", - "key_context": {"key": "test_value"}, - } + data = {"actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor_source": "api", "actor_name": "Jane Doe", "kv_name": "user-secrets", "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY", "key_context": {"key": "test_value"}} instance = VaultDataUpdatedData.from_dict(data) serialized = instance.to_dict() assert serialized["actor_id"] == data["actor_id"] @@ -12930,14 +6320,7 @@ def test_vault_data_updated_data_minimal_payload(self): assert serialized["key_context"] == data["key_context"] def test_vault_data_updated_data_round_trips_unknown_enum_values(self): - data = { - "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor_source": "unexpected_vault_data_updated_data_actor_source", - "actor_name": "Jane Doe", - "kv_name": "user-secrets", - "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY", - "key_context": {"key": "test_value"}, - } + data = {"actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor_source": "unexpected_vault_data_updated_data_actor_source", "actor_name": "Jane Doe", "kv_name": "user-secrets", "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY", "key_context": {"key": "test_value"}} instance = VaultDataUpdatedData.from_dict(data) assert instance.to_dict() == data @@ -12950,18 +6333,7 @@ def test_vault_dek_decrypted_round_trip(self): assert restored.to_dict() == serialized def test_vault_dek_decrypted_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "vault.dek.decrypted", - "data": { - "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor_source": "api", - "actor_name": "Jane Doe", - "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "vault.dek.decrypted", "data": {"actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor_source": "api", "actor_name": "Jane Doe", "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = VaultDekDecrypted.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -12971,18 +6343,7 @@ def test_vault_dek_decrypted_minimal_payload(self): assert serialized["object"] == data["object"] def test_vault_dek_decrypted_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "vault.dek.decrypted", - "data": { - "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor_source": "api", - "actor_name": "Jane Doe", - "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "vault.dek.decrypted", "data": {"actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor_source": "api", "actor_name": "Jane Doe", "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = VaultDekDecrypted.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -12996,12 +6357,7 @@ def test_vault_dek_decrypted_data_round_trip(self): assert restored.to_dict() == serialized def test_vault_dek_decrypted_data_minimal_payload(self): - data = { - "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor_source": "api", - "actor_name": "Jane Doe", - "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY", - } + data = {"actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor_source": "api", "actor_name": "Jane Doe", "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY"} instance = VaultDekDecryptedData.from_dict(data) serialized = instance.to_dict() assert serialized["actor_id"] == data["actor_id"] @@ -13010,12 +6366,7 @@ def test_vault_dek_decrypted_data_minimal_payload(self): assert serialized["key_id"] == data["key_id"] def test_vault_dek_decrypted_data_round_trips_unknown_enum_values(self): - data = { - "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor_source": "unexpected_vault_dek_decrypted_data_actor_source", - "actor_name": "Jane Doe", - "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY", - } + data = {"actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor_source": "unexpected_vault_dek_decrypted_data_actor_source", "actor_name": "Jane Doe", "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY"} instance = VaultDekDecryptedData.from_dict(data) assert instance.to_dict() == data @@ -13028,19 +6379,7 @@ def test_vault_dek_read_round_trip(self): assert restored.to_dict() == serialized def test_vault_dek_read_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "vault.dek.read", - "data": { - "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor_source": "api", - "actor_name": "Jane Doe", - "key_ids": ["dek_01EHWNCE74X7JSDV0X3SZ3KJNY"], - "key_context": {"key": "test_value"}, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "vault.dek.read", "data": {"actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor_source": "api", "actor_name": "Jane Doe", "key_ids": ["dek_01EHWNCE74X7JSDV0X3SZ3KJNY"], "key_context": {"key": "test_value"}}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = VaultDekRead.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -13050,19 +6389,7 @@ def test_vault_dek_read_minimal_payload(self): assert serialized["object"] == data["object"] def test_vault_dek_read_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "vault.dek.read", - "data": { - "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor_source": "api", - "actor_name": "Jane Doe", - "key_ids": ["dek_01EHWNCE74X7JSDV0X3SZ3KJNY"], - "key_context": {"key": "test_value"}, - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "vault.dek.read", "data": {"actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor_source": "api", "actor_name": "Jane Doe", "key_ids": ["dek_01EHWNCE74X7JSDV0X3SZ3KJNY"], "key_context": {"key": "test_value"}}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = VaultDekRead.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -13076,13 +6403,7 @@ def test_vault_dek_read_data_round_trip(self): assert restored.to_dict() == serialized def test_vault_dek_read_data_minimal_payload(self): - data = { - "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor_source": "api", - "actor_name": "Jane Doe", - "key_ids": ["dek_01EHWNCE74X7JSDV0X3SZ3KJNY"], - "key_context": {"key": "test_value"}, - } + data = {"actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor_source": "api", "actor_name": "Jane Doe", "key_ids": ["dek_01EHWNCE74X7JSDV0X3SZ3KJNY"], "key_context": {"key": "test_value"}} instance = VaultDekReadData.from_dict(data) serialized = instance.to_dict() assert serialized["actor_id"] == data["actor_id"] @@ -13092,13 +6413,7 @@ def test_vault_dek_read_data_minimal_payload(self): assert serialized["key_context"] == data["key_context"] def test_vault_dek_read_data_round_trips_unknown_enum_values(self): - data = { - "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor_source": "unexpected_vault_dek_read_data_actor_source", - "actor_name": "Jane Doe", - "key_ids": ["dek_01EHWNCE74X7JSDV0X3SZ3KJNY"], - "key_context": {"key": "test_value"}, - } + data = {"actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor_source": "unexpected_vault_dek_read_data_actor_source", "actor_name": "Jane Doe", "key_ids": ["dek_01EHWNCE74X7JSDV0X3SZ3KJNY"], "key_context": {"key": "test_value"}} instance = VaultDekReadData.from_dict(data) assert instance.to_dict() == data @@ -13111,19 +6426,7 @@ def test_vault_kek_created_round_trip(self): assert restored.to_dict() == serialized def test_vault_kek_created_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "vault.kek.created", - "data": { - "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor_source": "api", - "actor_name": "Jane Doe", - "key_name": "production-kek", - "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "vault.kek.created", "data": {"actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor_source": "api", "actor_name": "Jane Doe", "key_name": "production-kek", "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = VaultKekCreated.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -13133,19 +6436,7 @@ def test_vault_kek_created_minimal_payload(self): assert serialized["object"] == data["object"] def test_vault_kek_created_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "vault.kek.created", - "data": { - "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor_source": "api", - "actor_name": "Jane Doe", - "key_name": "production-kek", - "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "vault.kek.created", "data": {"actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor_source": "api", "actor_name": "Jane Doe", "key_name": "production-kek", "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = VaultKekCreated.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -13159,13 +6450,7 @@ def test_vault_kek_created_data_round_trip(self): assert restored.to_dict() == serialized def test_vault_kek_created_data_minimal_payload(self): - data = { - "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor_source": "api", - "actor_name": "Jane Doe", - "key_name": "production-kek", - "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY", - } + data = {"actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor_source": "api", "actor_name": "Jane Doe", "key_name": "production-kek", "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY"} instance = VaultKekCreatedData.from_dict(data) serialized = instance.to_dict() assert serialized["actor_id"] == data["actor_id"] @@ -13175,13 +6460,7 @@ def test_vault_kek_created_data_minimal_payload(self): assert serialized["key_id"] == data["key_id"] def test_vault_kek_created_data_round_trips_unknown_enum_values(self): - data = { - "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor_source": "unexpected_vault_kek_created_data_actor_source", - "actor_name": "Jane Doe", - "key_name": "production-kek", - "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY", - } + data = {"actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor_source": "unexpected_vault_kek_created_data_actor_source", "actor_name": "Jane Doe", "key_name": "production-kek", "key_id": "key_01EHWNCE74X7JSDV0X3SZ3KJNY"} instance = VaultKekCreatedData.from_dict(data) assert instance.to_dict() == data @@ -13194,18 +6473,7 @@ def test_vault_metadata_read_round_trip(self): assert restored.to_dict() == serialized def test_vault_metadata_read_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "vault.metadata.read", - "data": { - "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor_source": "api", - "actor_name": "Jane Doe", - "kv_name": "user-secrets", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "vault.metadata.read", "data": {"actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor_source": "api", "actor_name": "Jane Doe", "kv_name": "user-secrets"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = VaultMetadataRead.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -13215,18 +6483,7 @@ def test_vault_metadata_read_minimal_payload(self): assert serialized["object"] == data["object"] def test_vault_metadata_read_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "vault.metadata.read", - "data": { - "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor_source": "api", - "actor_name": "Jane Doe", - "kv_name": "user-secrets", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "vault.metadata.read", "data": {"actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor_source": "api", "actor_name": "Jane Doe", "kv_name": "user-secrets"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = VaultMetadataRead.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -13240,12 +6497,7 @@ def test_vault_metadata_read_data_round_trip(self): assert restored.to_dict() == serialized def test_vault_metadata_read_data_minimal_payload(self): - data = { - "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor_source": "api", - "actor_name": "Jane Doe", - "kv_name": "user-secrets", - } + data = {"actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor_source": "api", "actor_name": "Jane Doe", "kv_name": "user-secrets"} instance = VaultMetadataReadData.from_dict(data) serialized = instance.to_dict() assert serialized["actor_id"] == data["actor_id"] @@ -13254,12 +6506,7 @@ def test_vault_metadata_read_data_minimal_payload(self): assert serialized["kv_name"] == data["kv_name"] def test_vault_metadata_read_data_round_trips_unknown_enum_values(self): - data = { - "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor_source": "unexpected_vault_metadata_read_data_actor_source", - "actor_name": "Jane Doe", - "kv_name": "user-secrets", - } + data = {"actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor_source": "unexpected_vault_metadata_read_data_actor_source", "actor_name": "Jane Doe", "kv_name": "user-secrets"} instance = VaultMetadataReadData.from_dict(data) assert instance.to_dict() == data @@ -13272,17 +6519,7 @@ def test_vault_names_listed_round_trip(self): assert restored.to_dict() == serialized def test_vault_names_listed_minimal_payload(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "vault.names.listed", - "data": { - "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor_source": "api", - "actor_name": "Jane Doe", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "vault.names.listed", "data": {"actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor_source": "api", "actor_name": "Jane Doe"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = VaultNamesListed.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -13292,17 +6529,7 @@ def test_vault_names_listed_minimal_payload(self): assert serialized["object"] == data["object"] def test_vault_names_listed_omits_absent_optional_non_nullable_fields(self): - data = { - "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", - "event": "vault.names.listed", - "data": { - "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor_source": "api", - "actor_name": "Jane Doe", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "object": "event", - } + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "vault.names.listed", "data": {"actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor_source": "api", "actor_name": "Jane Doe"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} instance = VaultNamesListed.from_dict(data) serialized = instance.to_dict() assert "context" not in serialized @@ -13316,11 +6543,7 @@ def test_vault_names_listed_data_round_trip(self): assert restored.to_dict() == serialized def test_vault_names_listed_data_minimal_payload(self): - data = { - "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor_source": "api", - "actor_name": "Jane Doe", - } + data = {"actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor_source": "api", "actor_name": "Jane Doe"} instance = VaultNamesListedData.from_dict(data) serialized = instance.to_dict() assert serialized["actor_id"] == data["actor_id"] @@ -13328,14 +6551,82 @@ def test_vault_names_listed_data_minimal_payload(self): assert serialized["actor_name"] == data["actor_name"] def test_vault_names_listed_data_round_trips_unknown_enum_values(self): - data = { - "actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", - "actor_source": "unexpected_vault_names_listed_data_actor_source", - "actor_name": "Jane Doe", - } + data = {"actor_id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", "actor_source": "unexpected_vault_names_listed_data_actor_source", "actor_name": "Jane Doe"} instance = VaultNamesListedData.from_dict(data) assert instance.to_dict() == data + def test_waitlist_user_approved_round_trip(self): + data = load_fixture("waitlist_user_approved.json") + instance = WaitlistUserApproved.from_dict(data) + serialized = instance.to_dict() + assert serialized == data + restored = WaitlistUserApproved.from_dict(serialized) + assert restored.to_dict() == serialized + + def test_waitlist_user_approved_minimal_payload(self): + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "waitlist_user.approved", "data": {"object": "waitlist_user", "id": "wl_user_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "state": "pending", "approved_at": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} + instance = WaitlistUserApproved.from_dict(data) + serialized = instance.to_dict() + assert serialized["id"] == data["id"] + assert serialized["event"] == data["event"] + assert serialized["data"] == data["data"] + assert serialized["created_at"] == data["created_at"] + assert serialized["object"] == data["object"] + + def test_waitlist_user_approved_omits_absent_optional_non_nullable_fields(self): + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "waitlist_user.approved", "data": {"object": "waitlist_user", "id": "wl_user_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "state": "pending", "approved_at": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} + instance = WaitlistUserApproved.from_dict(data) + serialized = instance.to_dict() + assert "context" not in serialized + + def test_waitlist_user_created_round_trip(self): + data = load_fixture("waitlist_user_created.json") + instance = WaitlistUserCreated.from_dict(data) + serialized = instance.to_dict() + assert serialized == data + restored = WaitlistUserCreated.from_dict(serialized) + assert restored.to_dict() == serialized + + def test_waitlist_user_created_minimal_payload(self): + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "waitlist_user.created", "data": {"object": "waitlist_user", "id": "wl_user_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "state": "pending", "approved_at": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} + instance = WaitlistUserCreated.from_dict(data) + serialized = instance.to_dict() + assert serialized["id"] == data["id"] + assert serialized["event"] == data["event"] + assert serialized["data"] == data["data"] + assert serialized["created_at"] == data["created_at"] + assert serialized["object"] == data["object"] + + def test_waitlist_user_created_omits_absent_optional_non_nullable_fields(self): + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "waitlist_user.created", "data": {"object": "waitlist_user", "id": "wl_user_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "state": "pending", "approved_at": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} + instance = WaitlistUserCreated.from_dict(data) + serialized = instance.to_dict() + assert "context" not in serialized + + def test_waitlist_user_denied_round_trip(self): + data = load_fixture("waitlist_user_denied.json") + instance = WaitlistUserDenied.from_dict(data) + serialized = instance.to_dict() + assert serialized == data + restored = WaitlistUserDenied.from_dict(serialized) + assert restored.to_dict() == serialized + + def test_waitlist_user_denied_minimal_payload(self): + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "waitlist_user.denied", "data": {"object": "waitlist_user", "id": "wl_user_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "state": "pending", "approved_at": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} + instance = WaitlistUserDenied.from_dict(data) + serialized = instance.to_dict() + assert serialized["id"] == data["id"] + assert serialized["event"] == data["event"] + assert serialized["data"] == data["data"] + assert serialized["created_at"] == data["created_at"] + assert serialized["object"] == data["object"] + + def test_waitlist_user_denied_omits_absent_optional_non_nullable_fields(self): + data = {"id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "waitlist_user.denied", "data": {"object": "waitlist_user", "id": "wl_user_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "state": "pending", "approved_at": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "created_at": "2026-01-15T12:00:00.000Z", "object": "event"} + instance = WaitlistUserDenied.from_dict(data) + serialized = instance.to_dict() + assert "context" not in serialized + def test_jwt_template_response_round_trip(self): data = load_fixture("jwt_template_response.json") instance = JWTTemplateResponse.from_dict(data) @@ -13345,12 +6636,7 @@ def test_jwt_template_response_round_trip(self): assert restored.to_dict() == serialized def test_jwt_template_response_minimal_payload(self): - data = { - "object": "jwt_template", - "content": '{"iss": "{{environment.id}}", "sub": "{{user.id}}"}', - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "jwt_template", "content": "{\"iss\": \"{{environment.id}}\", \"sub\": \"{{user.id}}\"}", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = JWTTemplateResponse.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -13367,14 +6653,7 @@ def test_organization_domain_stand_alone_round_trip(self): assert restored.to_dict() == serialized def test_organization_domain_stand_alone_minimal_payload(self): - data = { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationDomainStandAlone.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -13384,17 +6663,8 @@ def test_organization_domain_stand_alone_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["updated_at"] == data["updated_at"] - def test_organization_domain_stand_alone_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + def test_organization_domain_stand_alone_omits_absent_optional_non_nullable_fields(self): + data = {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationDomainStandAlone.from_dict(data) serialized = instance.to_dict() assert "state" not in serialized @@ -13403,18 +6673,7 @@ def test_organization_domain_stand_alone_omits_absent_optional_non_nullable_fiel assert "verification_strategy" not in serialized def test_organization_domain_stand_alone_round_trips_unknown_enum_values(self): - data = { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "unexpected_organization_domain_stand_alone_state", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "unexpected_organization_domain_stand_alone_state", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationDomainStandAlone.from_dict(data) assert instance.to_dict() == data @@ -13427,19 +6686,7 @@ def test_flag_round_trip(self): assert restored.to_dict() == serialized def test_flag_minimal_payload(self): - data = { - "object": "feature_flag", - "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT", - "slug": "advanced-analytics", - "name": "Advanced Analytics", - "description": None, - "owner": None, - "tags": ["reports"], - "enabled": True, - "default_value": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "feature_flag", "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT", "slug": "advanced-analytics", "name": "Advanced Analytics", "description": None, "owner": None, "tags": ["reports"], "enabled": True, "default_value": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = Flag.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -13455,19 +6702,7 @@ def test_flag_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_flag_preserves_nullable_fields(self): - data = { - "object": "feature_flag", - "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT", - "slug": "advanced-analytics", - "name": "Advanced Analytics", - "description": None, - "owner": None, - "tags": ["reports"], - "enabled": True, - "default_value": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "feature_flag", "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT", "slug": "advanced-analytics", "name": "Advanced Analytics", "description": None, "owner": None, "tags": ["reports"], "enabled": True, "default_value": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = Flag.from_dict(data) serialized = instance.to_dict() assert serialized["description"] is None @@ -13482,18 +6717,7 @@ def test_api_key_with_value_round_trip(self): assert restored.to_dict() == serialized def test_api_key_with_value_minimal_payload(self): - data = { - "object": "api_key", - "id": "api_key_01EHZNVPK3SFK441A1RGBFSHRT", - "owner": {"type": "organization", "id": "org_01EHZNVPK3SFK441A1RGBFSHRT"}, - "name": "Production API Key", - "obfuscated_value": "sk_...3456", - "last_used_at": None, - "permissions": ["posts:read", "posts:write"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "value": "sk_abcdefghijklmnop123456", - } + data = {"object": "api_key", "id": "api_key_01EHZNVPK3SFK441A1RGBFSHRT", "owner": {"type": "organization", "id": "org_01EHZNVPK3SFK441A1RGBFSHRT"}, "name": "Production API Key", "obfuscated_value": "sk_...3456", "last_used_at": None, "permissions": ["posts:read", "posts:write"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "value": "sk_abcdefghijklmnop123456"} instance = ApiKeyWithValue.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -13508,18 +6732,7 @@ def test_api_key_with_value_minimal_payload(self): assert serialized["value"] == data["value"] def test_api_key_with_value_preserves_nullable_fields(self): - data = { - "object": "api_key", - "id": "api_key_01EHZNVPK3SFK441A1RGBFSHRT", - "owner": {"type": "organization", "id": "org_01EHZNVPK3SFK441A1RGBFSHRT"}, - "name": "Production API Key", - "obfuscated_value": "sk_...3456", - "last_used_at": None, - "permissions": ["posts:read", "posts:write"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "value": "sk_abcdefghijklmnop123456", - } + data = {"object": "api_key", "id": "api_key_01EHZNVPK3SFK441A1RGBFSHRT", "owner": {"type": "organization", "id": "org_01EHZNVPK3SFK441A1RGBFSHRT"}, "name": "Production API Key", "obfuscated_value": "sk_...3456", "last_used_at": None, "permissions": ["posts:read", "posts:write"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "value": "sk_abcdefghijklmnop123456"} instance = ApiKeyWithValue.from_dict(data) serialized = instance.to_dict() assert serialized["last_used_at"] is None @@ -13533,29 +6746,7 @@ def test_organization_round_trip(self): assert restored.to_dict() == serialized def test_organization_minimal_payload(self): - data = { - "object": "organization", - "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "name": "Acme Inc.", - "domains": [ - { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "pending", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } - ], - "metadata": {"tier": "diamond"}, - "external_id": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization", "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Inc.", "domains": [{"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "pending", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}], "metadata": {"tier": "diamond"}, "external_id": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = Organization.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -13568,60 +6759,14 @@ def test_organization_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_organization_omits_absent_optional_non_nullable_fields(self): - data = { - "object": "organization", - "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "name": "Acme Inc.", - "domains": [ - { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "pending", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } - ], - "metadata": {"tier": "diamond"}, - "external_id": "2fe01467-f7ea-4dd2-8b79-c2b4f56d0191", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization", "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Inc.", "domains": [{"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "pending", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}], "metadata": {"tier": "diamond"}, "external_id": "2fe01467-f7ea-4dd2-8b79-c2b4f56d0191", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = Organization.from_dict(data) serialized = instance.to_dict() assert "stripe_customer_id" not in serialized assert "allow_profiles_outside_organization" not in serialized def test_organization_preserves_nullable_fields(self): - data = { - "object": "organization", - "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", - "name": "Acme Inc.", - "domains": [ - { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "pending", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } - ], - "metadata": {"tier": "diamond"}, - "external_id": None, - "stripe_customer_id": "cus_R9qWAGMQ6nGE7V", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "allow_profiles_outside_organization": False, - } + data = {"object": "organization", "id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", "name": "Acme Inc.", "domains": [{"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "pending", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}], "metadata": {"tier": "diamond"}, "external_id": None, "stripe_customer_id": "cus_R9qWAGMQ6nGE7V", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "allow_profiles_outside_organization": False} instance = Organization.from_dict(data) serialized = instance.to_dict() assert serialized["external_id"] is None @@ -13635,42 +6780,21 @@ def test_audit_log_configuration_round_trip(self): assert restored.to_dict() == serialized def test_audit_log_configuration_minimal_payload(self): - data = { - "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT", - "retention_period_in_days": 30, - "state": "active", - } + data = {"organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT", "retention_period_in_days": 30, "state": "active"} instance = AuditLogConfiguration.from_dict(data) serialized = instance.to_dict() assert serialized["organization_id"] == data["organization_id"] - assert ( - serialized["retention_period_in_days"] == data["retention_period_in_days"] - ) + assert serialized["retention_period_in_days"] == data["retention_period_in_days"] assert serialized["state"] == data["state"] def test_audit_log_configuration_omits_absent_optional_non_nullable_fields(self): - data = { - "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT", - "retention_period_in_days": 30, - "state": "active", - } + data = {"organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT", "retention_period_in_days": 30, "state": "active"} instance = AuditLogConfiguration.from_dict(data) serialized = instance.to_dict() assert "log_stream" not in serialized def test_audit_log_configuration_round_trips_unknown_enum_values(self): - data = { - "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT", - "retention_period_in_days": 30, - "state": "unexpected_audit_log_configuration_state", - "log_stream": { - "id": "als_01EHZNVPK3SFK441A1RGBFSHRT", - "type": "Datadog", - "state": "active", - "last_synced_at": "2026-01-15T12:00:00.000Z", - "created_at": "2026-01-15T12:00:00.000Z", - }, - } + data = {"organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT", "retention_period_in_days": 30, "state": "unexpected_audit_log_configuration_state", "log_stream": {"id": "als_01EHZNVPK3SFK441A1RGBFSHRT", "type": "Datadog", "state": "active", "last_synced_at": "2026-01-15T12:00:00.000Z", "created_at": "2026-01-15T12:00:00.000Z"}} instance = AuditLogConfiguration.from_dict(data) assert instance.to_dict() == data @@ -13683,9 +6807,7 @@ def test_data_integration_authorize_url_response_round_trip(self): assert restored.to_dict() == serialized def test_data_integration_authorize_url_response_minimal_payload(self): - data = { - "url": "https://api.workos.com/data-integrations/q2czJKmVAraSBg8xFpT7M9uR/authorize-redirect" - } + data = {"url": "https://api.workos.com/data-integrations/q2czJKmVAraSBg8xFpT7M9uR/authorize-redirect"} instance = DataIntegrationAuthorizeUrlResponse.from_dict(data) serialized = instance.to_dict() assert serialized["url"] == data["url"] @@ -13703,9 +6825,7 @@ def test_data_integration_access_token_response_minimal_payload(self): instance = DataIntegrationAccessTokenResponse.from_dict(data) assert instance.to_dict() is not None - def test_data_integration_access_token_response_omits_absent_optional_non_nullable_fields( - self, - ): + def test_data_integration_access_token_response_omits_absent_optional_non_nullable_fields(self): data = {} instance = DataIntegrationAccessTokenResponse.from_dict(data) serialized = instance.to_dict() @@ -13713,20 +6833,8 @@ def test_data_integration_access_token_response_omits_absent_optional_non_nullab assert "access_token" not in serialized assert "error" not in serialized - def test_data_integration_access_token_response_round_trips_unknown_enum_values( - self, - ): - data = { - "active": True, - "access_token": { - "object": "access_token", - "access_token": "gho_16C7e42F292c6912E7710c838347Ae178B4a", - "expires_at": "2025-12-31T23:59:59.000Z", - "scopes": ["repo", "user:email"], - "missing_scopes": [], - }, - "error": "unexpected_data_integration_access_token_response_error", - } + def test_data_integration_access_token_response_round_trips_unknown_enum_values(self): + data = {"active": True, "access_token": {"object": "access_token", "access_token": "gho_16C7e42F292c6912E7710c838347Ae178B4a", "expires_at": "2025-12-31T23:59:59.000Z", "scopes": ["repo", "user:email"], "missing_scopes": []}, "error": "unexpected_data_integration_access_token_response_error"} instance = DataIntegrationAccessTokenResponse.from_dict(data) assert instance.to_dict() == data @@ -13739,16 +6847,7 @@ def test_connected_account_round_trip(self): assert restored.to_dict() == serialized def test_connected_account_minimal_payload(self): - data = { - "object": "connected_account", - "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", - "user_id": None, - "organization_id": None, - "scopes": ["repo", "user:email"], - "state": "connected", - "created_at": "2024-01-16T14:20:00.000Z", - "updated_at": "2024-01-16T14:20:00.000Z", - } + data = {"object": "connected_account", "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", "user_id": None, "organization_id": None, "scopes": ["repo", "user:email"], "state": "connected", "created_at": "2024-01-16T14:20:00.000Z", "updated_at": "2024-01-16T14:20:00.000Z"} instance = ConnectedAccount.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -13761,32 +6860,14 @@ def test_connected_account_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_connected_account_preserves_nullable_fields(self): - data = { - "object": "connected_account", - "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", - "user_id": None, - "organization_id": None, - "scopes": ["repo", "user:email"], - "state": "connected", - "created_at": "2024-01-16T14:20:00.000Z", - "updated_at": "2024-01-16T14:20:00.000Z", - } + data = {"object": "connected_account", "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", "user_id": None, "organization_id": None, "scopes": ["repo", "user:email"], "state": "connected", "created_at": "2024-01-16T14:20:00.000Z", "updated_at": "2024-01-16T14:20:00.000Z"} instance = ConnectedAccount.from_dict(data) serialized = instance.to_dict() assert serialized["user_id"] is None assert serialized["organization_id"] is None def test_connected_account_round_trips_unknown_enum_values(self): - data = { - "object": "connected_account", - "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", - "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", - "organization_id": None, - "scopes": ["repo", "user:email"], - "state": "unexpected_connected_account_state", - "created_at": "2024-01-16T14:20:00.000Z", - "updated_at": "2024-01-16T14:20:00.000Z", - } + data = {"object": "connected_account", "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", "organization_id": None, "scopes": ["repo", "user:email"], "state": "unexpected_connected_account_state", "created_at": "2024-01-16T14:20:00.000Z", "updated_at": "2024-01-16T14:20:00.000Z"} instance = ConnectedAccount.from_dict(data) assert instance.to_dict() == data @@ -13799,35 +6880,7 @@ def test_data_integrations_list_response_round_trip(self): assert restored.to_dict() == serialized def test_data_integrations_list_response_minimal_payload(self): - data = { - "object": "list", - "data": [ - { - "object": "data_provider", - "id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", - "name": "GitHub", - "description": "Connect your GitHub account to access repositories.", - "slug": "github", - "integration_type": "github", - "credentials_type": "oauth2", - "scopes": ["repo", "user:email"], - "ownership": "userland_user", - "created_at": "2024-01-15T10:30:00.000Z", - "updated_at": "2024-01-15T10:30:00.000Z", - "connected_account": { - "object": "connected_account", - "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", - "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", - "organization_id": None, - "scopes": ["repo", "user:email"], - "state": "connected", - "created_at": "2024-01-16T14:20:00.000Z", - "updated_at": "2024-01-16T14:20:00.000Z", - "userlandUserId": "test_userlandUserId", - }, - } - ], - } + data = {"object": "list", "data": [{"object": "data_provider", "id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", "name": "GitHub", "description": "Connect your GitHub account to access repositories.", "slug": "github", "integration_type": "github", "credentials_type": "oauth2", "scopes": ["repo", "user:email"], "ownership": "userland_user", "created_at": "2024-01-15T10:30:00.000Z", "updated_at": "2024-01-15T10:30:00.000Z", "connected_account": {"object": "connected_account", "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", "organization_id": None, "scopes": ["repo", "user:email"], "state": "connected", "created_at": "2024-01-16T14:20:00.000Z", "updated_at": "2024-01-16T14:20:00.000Z", "userlandUserId": "test_userlandUserId"}}]} instance = DataIntegrationsListResponse.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -13842,9 +6895,7 @@ def test_portal_link_response_round_trip(self): assert restored.to_dict() == serialized def test_portal_link_response_minimal_payload(self): - data = { - "link": "https://setup.workos.com?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." - } + data = {"link": "https://setup.workos.com?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."} instance = PortalLinkResponse.from_dict(data) serialized = instance.to_dict() assert serialized["link"] == data["link"] @@ -13858,11 +6909,7 @@ def test_radar_standalone_response_round_trip(self): assert restored.to_dict() == serialized def test_radar_standalone_response_minimal_payload(self): - data = { - "verdict": "block", - "reason": "Detected enabled Radar control", - "attempt_id": "radar_att_01HZBC6N1EB1ZY7KG32X", - } + data = {"verdict": "block", "reason": "Detected enabled Radar control", "attempt_id": "radar_att_01HZBC6N1EB1ZY7KG32X"} instance = RadarStandaloneResponse.from_dict(data) serialized = instance.to_dict() assert serialized["verdict"] == data["verdict"] @@ -13870,24 +6917,14 @@ def test_radar_standalone_response_minimal_payload(self): assert serialized["attempt_id"] == data["attempt_id"] def test_radar_standalone_response_omits_absent_optional_non_nullable_fields(self): - data = { - "verdict": "block", - "reason": "Detected enabled Radar control", - "attempt_id": "radar_att_01HZBC6N1EB1ZY7KG32X", - } + data = {"verdict": "block", "reason": "Detected enabled Radar control", "attempt_id": "radar_att_01HZBC6N1EB1ZY7KG32X"} instance = RadarStandaloneResponse.from_dict(data) serialized = instance.to_dict() assert "control" not in serialized assert "blocklist_type" not in serialized def test_radar_standalone_response_round_trips_unknown_enum_values(self): - data = { - "verdict": "unexpected_radar_standalone_response_verdict", - "reason": "Detected enabled Radar control", - "attempt_id": "radar_att_01HZBC6N1EB1ZY7KG32X", - "control": "bot_detection", - "blocklist_type": "ip_address", - } + data = {"verdict": "unexpected_radar_standalone_response_verdict", "reason": "Detected enabled Radar control", "attempt_id": "radar_att_01HZBC6N1EB1ZY7KG32X", "control": "bot_detection", "blocklist_type": "ip_address"} instance = RadarStandaloneResponse.from_dict(data) assert instance.to_dict() == data @@ -13914,14 +6951,7 @@ def test_redirect_uri_round_trip(self): assert restored.to_dict() == serialized def test_redirect_uri_minimal_payload(self): - data = { - "object": "redirect_uri", - "id": "ruri_01EHZNVPK3SFK441A1RGBFSHRT", - "uri": "https://example.com/callback", - "default": True, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "redirect_uri", "id": "ruri_01EHZNVPK3SFK441A1RGBFSHRT", "uri": "https://example.com/callback", "default": True, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = RedirectUri.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -13940,39 +6970,11 @@ def test_user_authentication_factor_enroll_response_round_trip(self): assert restored.to_dict() == serialized def test_user_authentication_factor_enroll_response_minimal_payload(self): - data = { - "authentication_factor": { - "object": "authentication_factor", - "id": "auth_factor_01FVYZ5QM8N98T9ME5BCB2BBMJ", - "type": "totp", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "sms": {"phone_number": "+15005550006"}, - "totp": { - "issuer": "WorkOS", - "user": "user@example.com", - "secret": "JBSWY3DPEHPK3PXP", - "qr_code": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUg...", - "uri": "otpauth://totp/WorkOS:user@example.com?secret=JBSWY3DPEHPK3PXP&issuer=WorkOS", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "authentication_challenge": { - "object": "authentication_challenge", - "id": "auth_challenge_01FVYZ5QM8N98T9ME5BCB2BBMJ", - "expires_at": "2026-01-15T12:00:00.000Z", - "code": "123456", - "authentication_factor_id": "auth_factor_01FVYZ5QM8N98T9ME5BCB2BBMJ", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - } + data = {"authentication_factor": {"object": "authentication_factor", "id": "auth_factor_01FVYZ5QM8N98T9ME5BCB2BBMJ", "type": "totp", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "sms": {"phone_number": "+15005550006"}, "totp": {"issuer": "WorkOS", "user": "user@example.com", "secret": "JBSWY3DPEHPK3PXP", "qr_code": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUg...", "uri": "otpauth://totp/WorkOS:user@example.com?secret=JBSWY3DPEHPK3PXP&issuer=WorkOS"}, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "authentication_challenge": {"object": "authentication_challenge", "id": "auth_challenge_01FVYZ5QM8N98T9ME5BCB2BBMJ", "expires_at": "2026-01-15T12:00:00.000Z", "code": "123456", "authentication_factor_id": "auth_factor_01FVYZ5QM8N98T9ME5BCB2BBMJ", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}} instance = UserAuthenticationFactorEnrollResponse.from_dict(data) serialized = instance.to_dict() assert serialized["authentication_factor"] == data["authentication_factor"] - assert ( - serialized["authentication_challenge"] == data["authentication_challenge"] - ) + assert serialized["authentication_challenge"] == data["authentication_challenge"] def test_magic_auth_round_trip(self): data = load_fixture("magic_auth.json") @@ -13983,16 +6985,7 @@ def test_magic_auth_round_trip(self): assert restored.to_dict() == serialized def test_magic_auth_minimal_payload(self): - data = { - "object": "magic_auth", - "id": "magic_auth_01HWZBQZY2M3AMQW166Q22K88F", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "expires_at": "2026-01-15T12:00:00.000Z", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "code": "123456", - } + data = {"object": "magic_auth", "id": "magic_auth_01HWZBQZY2M3AMQW166Q22K88F", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "expires_at": "2026-01-15T12:00:00.000Z", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "code": "123456"} instance = MagicAuth.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -14013,22 +7006,7 @@ def test_user_invite_round_trip(self): assert restored.to_dict() == serialized def test_user_invite_minimal_payload(self): - data = { - "object": "invitation", - "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "state": "pending", - "accepted_at": None, - "revoked_at": None, - "expires_at": "2026-01-15T12:00:00.000Z", - "organization_id": None, - "inviter_user_id": None, - "accepted_user_id": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "token": "Z1uX3RbwcIl5fIGJJJCXXisdI", - "accept_invitation_url": "https://your-app.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI", - } + data = {"object": "invitation", "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "state": "pending", "accepted_at": None, "revoked_at": None, "expires_at": "2026-01-15T12:00:00.000Z", "organization_id": None, "inviter_user_id": None, "accepted_user_id": None, "role_slug": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "token": "Z1uX3RbwcIl5fIGJJJCXXisdI", "accept_invitation_url": "https://your-app.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI"} instance = UserInvite.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -14041,28 +7019,14 @@ def test_user_invite_minimal_payload(self): assert serialized["organization_id"] == data["organization_id"] assert serialized["inviter_user_id"] == data["inviter_user_id"] assert serialized["accepted_user_id"] == data["accepted_user_id"] + assert serialized["role_slug"] == data["role_slug"] assert serialized["created_at"] == data["created_at"] assert serialized["updated_at"] == data["updated_at"] assert serialized["token"] == data["token"] assert serialized["accept_invitation_url"] == data["accept_invitation_url"] def test_user_invite_preserves_nullable_fields(self): - data = { - "object": "invitation", - "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "state": "pending", - "accepted_at": None, - "revoked_at": None, - "expires_at": "2026-01-15T12:00:00.000Z", - "organization_id": None, - "inviter_user_id": None, - "accepted_user_id": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "token": "Z1uX3RbwcIl5fIGJJJCXXisdI", - "accept_invitation_url": "https://your-app.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI", - } + data = {"object": "invitation", "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "state": "pending", "accepted_at": None, "revoked_at": None, "expires_at": "2026-01-15T12:00:00.000Z", "organization_id": None, "inviter_user_id": None, "accepted_user_id": None, "role_slug": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "token": "Z1uX3RbwcIl5fIGJJJCXXisdI", "accept_invitation_url": "https://your-app.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI"} instance = UserInvite.from_dict(data) serialized = instance.to_dict() assert serialized["accepted_at"] is None @@ -14070,24 +7034,10 @@ def test_user_invite_preserves_nullable_fields(self): assert serialized["organization_id"] is None assert serialized["inviter_user_id"] is None assert serialized["accepted_user_id"] is None + assert serialized["role_slug"] is None def test_user_invite_round_trips_unknown_enum_values(self): - data = { - "object": "invitation", - "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "state": "unexpected_user_invite_state", - "accepted_at": None, - "revoked_at": None, - "expires_at": "2026-01-15T12:00:00.000Z", - "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", - "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", - "accepted_user_id": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "token": "Z1uX3RbwcIl5fIGJJJCXXisdI", - "accept_invitation_url": "https://your-app.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI", - } + data = {"object": "invitation", "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "state": "unexpected_user_invite_state", "accepted_at": None, "revoked_at": None, "expires_at": "2026-01-15T12:00:00.000Z", "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", "accepted_user_id": None, "role_slug": "admin", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "token": "Z1uX3RbwcIl5fIGJJJCXXisdI", "accept_invitation_url": "https://your-app.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI"} instance = UserInvite.from_dict(data) assert instance.to_dict() == data @@ -14100,17 +7050,7 @@ def test_user_organization_membership_round_trip(self): assert restored.to_dict() == serialized def test_user_organization_membership_minimal_payload(self): - data = { - "object": "organization_membership", - "id": "om_01HXYZ123456789ABCDEFGHIJ", - "user_id": "user_01EHQTV6MWP9P1F4ZXGXMC8ABB", - "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT", - "status": "active", - "directory_managed": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "role": {"slug": "admin"}, - } + data = {"object": "organization_membership", "id": "om_01HXYZ123456789ABCDEFGHIJ", "user_id": "user_01EHQTV6MWP9P1F4ZXGXMC8ABB", "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT", "status": "active", "directory_managed": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "role": {"slug": "admin"}} instance = UserOrganizationMembership.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -14123,43 +7063,15 @@ def test_user_organization_membership_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] assert serialized["role"] == data["role"] - def test_user_organization_membership_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "object": "organization_membership", - "id": "om_01HXYZ123456789ABCDEFGHIJ", - "user_id": "user_01EHQTV6MWP9P1F4ZXGXMC8ABB", - "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT", - "status": "active", - "directory_managed": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "role": {"slug": "admin"}, - } + def test_user_organization_membership_omits_absent_optional_non_nullable_fields(self): + data = {"object": "organization_membership", "id": "om_01HXYZ123456789ABCDEFGHIJ", "user_id": "user_01EHQTV6MWP9P1F4ZXGXMC8ABB", "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT", "status": "active", "directory_managed": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "role": {"slug": "admin"}} instance = UserOrganizationMembership.from_dict(data) serialized = instance.to_dict() assert "organization_name" not in serialized assert "custom_attributes" not in serialized def test_user_organization_membership_round_trips_unknown_enum_values(self): - data = { - "object": "organization_membership", - "id": "om_01HXYZ123456789ABCDEFGHIJ", - "user_id": "user_01EHQTV6MWP9P1F4ZXGXMC8ABB", - "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT", - "status": "unexpected_user_organization_membership_status", - "directory_managed": False, - "organization_name": "Acme Corp", - "custom_attributes": { - "department": "Engineering", - "title": "Developer Experience Engineer", - "location": "Brooklyn", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "role": {"slug": "admin"}, - } + data = {"object": "organization_membership", "id": "om_01HXYZ123456789ABCDEFGHIJ", "user_id": "user_01EHQTV6MWP9P1F4ZXGXMC8ABB", "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT", "status": "unexpected_user_organization_membership_status", "directory_managed": False, "organization_name": "Acme Corp", "custom_attributes": {"department": "Engineering", "title": "Developer Experience Engineer", "location": "Brooklyn"}, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "role": {"slug": "admin"}} instance = UserOrganizationMembership.from_dict(data) assert instance.to_dict() == data @@ -14172,16 +7084,7 @@ def test_email_verification_round_trip(self): assert restored.to_dict() == serialized def test_email_verification_minimal_payload(self): - data = { - "object": "email_verification", - "id": "email_verification_01E4ZCR3C56J083X43JQXF3JK5", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "expires_at": "2026-01-15T12:00:00.000Z", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "code": "123456", - } + data = {"object": "email_verification", "id": "email_verification_01E4ZCR3C56J083X43JQXF3JK5", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "expires_at": "2026-01-15T12:00:00.000Z", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "code": "123456"} instance = EmailVerification.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -14202,23 +7105,7 @@ def test_send_verification_email_response_round_trip(self): assert restored.to_dict() == serialized def test_send_verification_email_response_minimal_payload(self): - data = { - "user": { - "object": "user", - "id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "first_name": "Marcelina", - "last_name": "Davis", - "profile_picture_url": "https://workoscdn.com/images/v1/123abc", - "email": "marcelina.davis@example.com", - "email_verified": True, - "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222", - "metadata": {"timezone": "America/New_York"}, - "last_sign_in_at": "2025-06-25T19:07:33.155Z", - "locale": "en-US", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } - } + data = {"user": {"object": "user", "id": "user_01E4ZCR3C56J083X43JQXF3JK5", "first_name": "Marcelina", "last_name": "Davis", "profile_picture_url": "https://workoscdn.com/images/v1/123abc", "email": "marcelina.davis@example.com", "email_verified": True, "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222", "metadata": {"timezone": "America/New_York"}, "last_sign_in_at": "2025-06-25T19:07:33.155Z", "locale": "en-US", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}} instance = SendVerificationEmailResponse.from_dict(data) serialized = instance.to_dict() assert serialized["user"] == data["user"] @@ -14232,23 +7119,7 @@ def test_verify_email_response_round_trip(self): assert restored.to_dict() == serialized def test_verify_email_response_minimal_payload(self): - data = { - "user": { - "object": "user", - "id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "first_name": "Marcelina", - "last_name": "Davis", - "profile_picture_url": "https://workoscdn.com/images/v1/123abc", - "email": "marcelina.davis@example.com", - "email_verified": True, - "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222", - "metadata": {"timezone": "America/New_York"}, - "last_sign_in_at": "2025-06-25T19:07:33.155Z", - "locale": "en-US", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } - } + data = {"user": {"object": "user", "id": "user_01E4ZCR3C56J083X43JQXF3JK5", "first_name": "Marcelina", "last_name": "Davis", "profile_picture_url": "https://workoscdn.com/images/v1/123abc", "email": "marcelina.davis@example.com", "email_verified": True, "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222", "metadata": {"timezone": "America/New_York"}, "last_sign_in_at": "2025-06-25T19:07:33.155Z", "locale": "en-US", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}} instance = VerifyEmailResponse.from_dict(data) serialized = instance.to_dict() assert serialized["user"] == data["user"] @@ -14262,16 +7133,7 @@ def test_password_reset_round_trip(self): assert restored.to_dict() == serialized def test_password_reset_minimal_payload(self): - data = { - "object": "password_reset", - "id": "password_reset_01E4ZCR3C56J083X43JQXF3JK5", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "expires_at": "2026-01-15T12:00:00.000Z", - "created_at": "2026-01-15T12:00:00.000Z", - "password_reset_token": "Z1uX3RbwcIl5fIGJJJCXXisdI", - "password_reset_url": "https://your-app.com/reset-password?token=Z1uX3RbwcIl5fIGJJJCXXisdI", - } + data = {"object": "password_reset", "id": "password_reset_01E4ZCR3C56J083X43JQXF3JK5", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "expires_at": "2026-01-15T12:00:00.000Z", "created_at": "2026-01-15T12:00:00.000Z", "password_reset_token": "Z1uX3RbwcIl5fIGJJJCXXisdI", "password_reset_url": "https://your-app.com/reset-password?token=Z1uX3RbwcIl5fIGJJJCXXisdI"} instance = PasswordReset.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -14292,23 +7154,7 @@ def test_reset_password_response_round_trip(self): assert restored.to_dict() == serialized def test_reset_password_response_minimal_payload(self): - data = { - "user": { - "object": "user", - "id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "first_name": "Marcelina", - "last_name": "Davis", - "profile_picture_url": "https://workoscdn.com/images/v1/123abc", - "email": "marcelina.davis@example.com", - "email_verified": True, - "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222", - "metadata": {"timezone": "America/New_York"}, - "last_sign_in_at": "2025-06-25T19:07:33.155Z", - "locale": "en-US", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } - } + data = {"user": {"object": "user", "id": "user_01E4ZCR3C56J083X43JQXF3JK5", "first_name": "Marcelina", "last_name": "Davis", "profile_picture_url": "https://workoscdn.com/images/v1/123abc", "email": "marcelina.davis@example.com", "email_verified": True, "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222", "metadata": {"timezone": "America/New_York"}, "last_sign_in_at": "2025-06-25T19:07:33.155Z", "locale": "en-US", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}} instance = ResetPasswordResponse.from_dict(data) serialized = instance.to_dict() assert serialized["user"] == data["user"] @@ -14322,27 +7168,7 @@ def test_email_change_round_trip(self): assert restored.to_dict() == serialized def test_email_change_minimal_payload(self): - data = { - "object": "email_change", - "user": { - "object": "user", - "id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "first_name": "Marcelina", - "last_name": "Davis", - "profile_picture_url": "https://workoscdn.com/images/v1/123abc", - "email": "marcelina.davis@example.com", - "email_verified": True, - "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222", - "metadata": {"timezone": "America/New_York"}, - "last_sign_in_at": "2025-06-25T19:07:33.155Z", - "locale": "en-US", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "new_email": "new.email@example.com", - "expires_at": "2026-01-15T12:00:00.000Z", - "created_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "email_change", "user": {"object": "user", "id": "user_01E4ZCR3C56J083X43JQXF3JK5", "first_name": "Marcelina", "last_name": "Davis", "profile_picture_url": "https://workoscdn.com/images/v1/123abc", "email": "marcelina.davis@example.com", "email_verified": True, "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222", "metadata": {"timezone": "America/New_York"}, "last_sign_in_at": "2025-06-25T19:07:33.155Z", "locale": "en-US", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "new_email": "new.email@example.com", "expires_at": "2026-01-15T12:00:00.000Z", "created_at": "2026-01-15T12:00:00.000Z"} instance = EmailChange.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -14360,25 +7186,7 @@ def test_authenticate_response_round_trip(self): assert restored.to_dict() == serialized def test_authenticate_response_minimal_payload(self): - data = { - "user": { - "object": "user", - "id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "first_name": "Marcelina", - "last_name": "Davis", - "profile_picture_url": "https://workoscdn.com/images/v1/123abc", - "email": "marcelina.davis@example.com", - "email_verified": True, - "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222", - "metadata": {"timezone": "America/New_York"}, - "last_sign_in_at": "2025-06-25T19:07:33.155Z", - "locale": "en-US", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "access_token": "eyJhb.nNzb19vaWRjX2tleV9.lc5Uk4yWVk5In0", - "refresh_token": "yAjhKk123NLIjdrBdGZPf8pLIDvK", - } + data = {"user": {"object": "user", "id": "user_01E4ZCR3C56J083X43JQXF3JK5", "first_name": "Marcelina", "last_name": "Davis", "profile_picture_url": "https://workoscdn.com/images/v1/123abc", "email": "marcelina.davis@example.com", "email_verified": True, "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222", "metadata": {"timezone": "America/New_York"}, "last_sign_in_at": "2025-06-25T19:07:33.155Z", "locale": "en-US", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "access_token": "eyJhb.nNzb19vaWRjX2tleV9.lc5Uk4yWVk5In0", "refresh_token": "yAjhKk123NLIjdrBdGZPf8pLIDvK"} instance = AuthenticateResponse.from_dict(data) serialized = instance.to_dict() assert serialized["user"] == data["user"] @@ -14386,25 +7194,7 @@ def test_authenticate_response_minimal_payload(self): assert serialized["refresh_token"] == data["refresh_token"] def test_authenticate_response_omits_absent_optional_non_nullable_fields(self): - data = { - "user": { - "object": "user", - "id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "first_name": "Marcelina", - "last_name": "Davis", - "profile_picture_url": "https://workoscdn.com/images/v1/123abc", - "email": "marcelina.davis@example.com", - "email_verified": True, - "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222", - "metadata": {"timezone": "America/New_York"}, - "last_sign_in_at": "2025-06-25T19:07:33.155Z", - "locale": "en-US", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "access_token": "eyJhb.nNzb19vaWRjX2tleV9.lc5Uk4yWVk5In0", - "refresh_token": "yAjhKk123NLIjdrBdGZPf8pLIDvK", - } + data = {"user": {"object": "user", "id": "user_01E4ZCR3C56J083X43JQXF3JK5", "first_name": "Marcelina", "last_name": "Davis", "profile_picture_url": "https://workoscdn.com/images/v1/123abc", "email": "marcelina.davis@example.com", "email_verified": True, "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222", "metadata": {"timezone": "America/New_York"}, "last_sign_in_at": "2025-06-25T19:07:33.155Z", "locale": "en-US", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "access_token": "eyJhb.nNzb19vaWRjX2tleV9.lc5Uk4yWVk5In0", "refresh_token": "yAjhKk123NLIjdrBdGZPf8pLIDvK"} instance = AuthenticateResponse.from_dict(data) serialized = instance.to_dict() assert "organization_id" not in serialized @@ -14414,39 +7204,7 @@ def test_authenticate_response_omits_absent_optional_non_nullable_fields(self): assert "oauth_tokens" not in serialized def test_authenticate_response_round_trips_unknown_enum_values(self): - data = { - "user": { - "object": "user", - "id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "first_name": "Marcelina", - "last_name": "Davis", - "profile_picture_url": "https://workoscdn.com/images/v1/123abc", - "email": "marcelina.davis@example.com", - "email_verified": True, - "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222", - "metadata": {"timezone": "America/New_York"}, - "last_sign_in_at": "2025-06-25T19:07:33.155Z", - "locale": "en-US", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - "organization_id": "org_01H945H0YD4F97JN9MATX7BYAG", - "authkit_authorization_code": "authkit_authz_code_abc123", - "access_token": "eyJhb.nNzb19vaWRjX2tleV9.lc5Uk4yWVk5In0", - "refresh_token": "yAjhKk123NLIjdrBdGZPf8pLIDvK", - "authentication_method": "unexpected_authenticate_response_authentication_method", - "impersonator": { - "email": "admin@foocorp.com", - "reason": "Investigating an issue with the customer's account.", - }, - "oauth_tokens": { - "provider": "GoogleOAuth", - "refresh_token": "1//04g...", - "access_token": "ya29.a0ARrdaM...", - "expires_at": 1735141800, - "scopes": ["profile", "email", "openid"], - }, - } + data = {"user": {"object": "user", "id": "user_01E4ZCR3C56J083X43JQXF3JK5", "first_name": "Marcelina", "last_name": "Davis", "profile_picture_url": "https://workoscdn.com/images/v1/123abc", "email": "marcelina.davis@example.com", "email_verified": True, "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222", "metadata": {"timezone": "America/New_York"}, "last_sign_in_at": "2025-06-25T19:07:33.155Z", "locale": "en-US", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}, "organization_id": "org_01H945H0YD4F97JN9MATX7BYAG", "authkit_authorization_code": "authkit_authz_code_abc123", "access_token": "eyJhb.nNzb19vaWRjX2tleV9.lc5Uk4yWVk5In0", "refresh_token": "yAjhKk123NLIjdrBdGZPf8pLIDvK", "authentication_method": "unexpected_authenticate_response_authentication_method", "impersonator": {"email": "admin@foocorp.com", "reason": "Investigating an issue with the customer's account."}, "oauth_tokens": {"provider": "GoogleOAuth", "refresh_token": "1//04g...", "access_token": "ya29.a0ARrdaM...", "expires_at": 1735141800, "scopes": ["profile", "email", "openid"]}} instance = AuthenticateResponse.from_dict(data) assert instance.to_dict() == data @@ -14459,12 +7217,7 @@ def test_device_authorization_response_round_trip(self): assert restored.to_dict() == serialized def test_device_authorization_response_minimal_payload(self): - data = { - "device_code": "CVE2wOfIFK4vhmiDBntpX9s8KT2f0qngpWYL0LGy9HxYgBRXUKIUkZB9BgIFho5h", - "user_code": "BCDF-GHJK", - "verification_uri": "https://authkit_domain/device", - "expires_in": 300, - } + data = {"device_code": "CVE2wOfIFK4vhmiDBntpX9s8KT2f0qngpWYL0LGy9HxYgBRXUKIUkZB9BgIFho5h", "user_code": "BCDF-GHJK", "verification_uri": "https://authkit_domain/device", "expires_in": 300} instance = DeviceAuthorizationResponse.from_dict(data) serialized = instance.to_dict() assert serialized["device_code"] == data["device_code"] @@ -14472,15 +7225,8 @@ def test_device_authorization_response_minimal_payload(self): assert serialized["verification_uri"] == data["verification_uri"] assert serialized["expires_in"] == data["expires_in"] - def test_device_authorization_response_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "device_code": "CVE2wOfIFK4vhmiDBntpX9s8KT2f0qngpWYL0LGy9HxYgBRXUKIUkZB9BgIFho5h", - "user_code": "BCDF-GHJK", - "verification_uri": "https://authkit_domain/device", - "expires_in": 300, - } + def test_device_authorization_response_omits_absent_optional_non_nullable_fields(self): + data = {"device_code": "CVE2wOfIFK4vhmiDBntpX9s8KT2f0qngpWYL0LGy9HxYgBRXUKIUkZB9BgIFho5h", "user_code": "BCDF-GHJK", "verification_uri": "https://authkit_domain/device", "expires_in": 300} instance = DeviceAuthorizationResponse.from_dict(data) serialized = instance.to_dict() assert "verification_uri_complete" not in serialized @@ -14495,16 +7241,7 @@ def test_webhook_endpoint_json_round_trip(self): assert restored.to_dict() == serialized def test_webhook_endpoint_json_minimal_payload(self): - data = { - "object": "webhook_endpoint", - "id": "we_0123456789", - "endpoint_url": "https://example.com/webhooks", - "secret": "whsec_0FWAiVGkEfGBqqsJH4aNAGBJ4", - "status": "enabled", - "events": ["user.created", "dsync.user.created"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "webhook_endpoint", "id": "we_0123456789", "endpoint_url": "https://example.com/webhooks", "secret": "whsec_0FWAiVGkEfGBqqsJH4aNAGBJ4", "status": "enabled", "events": ["user.created", "dsync.user.created"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = WebhookEndpointJson.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -14517,16 +7254,7 @@ def test_webhook_endpoint_json_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_webhook_endpoint_json_round_trips_unknown_enum_values(self): - data = { - "object": "webhook_endpoint", - "id": "we_0123456789", - "endpoint_url": "https://example.com/webhooks", - "secret": "whsec_0FWAiVGkEfGBqqsJH4aNAGBJ4", - "status": "unexpected_webhook_endpoint_json_status", - "events": ["user.created", "dsync.user.created"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "webhook_endpoint", "id": "we_0123456789", "endpoint_url": "https://example.com/webhooks", "secret": "whsec_0FWAiVGkEfGBqqsJH4aNAGBJ4", "status": "unexpected_webhook_endpoint_json_status", "events": ["user.created", "dsync.user.created"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = WebhookEndpointJson.from_dict(data) assert instance.to_dict() == data @@ -14553,9 +7281,7 @@ def test_sso_authorize_url_response_round_trip(self): assert restored.to_dict() == serialized def test_sso_authorize_url_response_minimal_payload(self): - data = { - "url": "https://accounts.google.com/o/oauth2/v2/auth?client_id=example&redirect_uri=https%3A%2F%2Fapi.workos.com%2Fsso%2Fcallback&response_type=code&scope=openid%20profile%20email" - } + data = {"url": "https://accounts.google.com/o/oauth2/v2/auth?client_id=example&redirect_uri=https%3A%2F%2Fapi.workos.com%2Fsso%2Fcallback&response_type=code&scope=openid%20profile%20email"} instance = SSOAuthorizeUrlResponse.from_dict(data) serialized = instance.to_dict() assert serialized["url"] == data["url"] @@ -14569,18 +7295,7 @@ def test_profile_round_trip(self): assert restored.to_dict() == serialized def test_profile_minimal_payload(self): - data = { - "object": "profile", - "id": "prof_01DMC79VCBZ0NY2099737PSVF1", - "organization_id": None, - "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", - "connection_type": "GoogleOAuth", - "idp_id": "103456789012345678901", - "email": "todd@example.com", - "first_name": None, - "last_name": None, - "raw_attributes": {"key": {}}, - } + data = {"object": "profile", "id": "prof_01DMC79VCBZ0NY2099737PSVF1", "organization_id": None, "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", "connection_type": "GoogleOAuth", "idp_id": "103456789012345678901", "email": "todd@example.com", "first_name": None, "last_name": None, "raw_attributes": {"key": {}}} instance = Profile.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -14595,42 +7310,14 @@ def test_profile_minimal_payload(self): assert serialized["raw_attributes"] == data["raw_attributes"] def test_profile_omits_absent_optional_non_nullable_fields(self): - data = { - "object": "profile", - "id": "prof_01DMC79VCBZ0NY2099737PSVF1", - "organization_id": "org_01EHQMYV6MBK39QC5PZXHY59C3", - "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", - "connection_type": "GoogleOAuth", - "idp_id": "103456789012345678901", - "email": "todd@example.com", - "first_name": "Todd", - "last_name": "Rundgren", - "role": {"slug": "admin"}, - "roles": [{"slug": "admin"}], - "raw_attributes": {"key": {}}, - } + data = {"object": "profile", "id": "prof_01DMC79VCBZ0NY2099737PSVF1", "organization_id": "org_01EHQMYV6MBK39QC5PZXHY59C3", "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", "connection_type": "GoogleOAuth", "idp_id": "103456789012345678901", "email": "todd@example.com", "first_name": "Todd", "last_name": "Rundgren", "role": {"slug": "admin"}, "roles": [{"slug": "admin"}], "raw_attributes": {"key": {}}} instance = Profile.from_dict(data) serialized = instance.to_dict() assert "groups" not in serialized assert "custom_attributes" not in serialized def test_profile_preserves_nullable_fields(self): - data = { - "object": "profile", - "id": "prof_01DMC79VCBZ0NY2099737PSVF1", - "organization_id": None, - "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", - "connection_type": "GoogleOAuth", - "idp_id": "103456789012345678901", - "email": "todd@example.com", - "first_name": None, - "last_name": None, - "role": None, - "roles": None, - "groups": ["Engineering", "Admins"], - "custom_attributes": {"key": {}}, - "raw_attributes": {"key": {}}, - } + data = {"object": "profile", "id": "prof_01DMC79VCBZ0NY2099737PSVF1", "organization_id": None, "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", "connection_type": "GoogleOAuth", "idp_id": "103456789012345678901", "email": "todd@example.com", "first_name": None, "last_name": None, "role": None, "roles": None, "groups": ["Engineering", "Admins"], "custom_attributes": {"key": {}}, "raw_attributes": {"key": {}}} instance = Profile.from_dict(data) serialized = instance.to_dict() assert serialized["organization_id"] is None @@ -14640,22 +7327,7 @@ def test_profile_preserves_nullable_fields(self): assert serialized["roles"] is None def test_profile_round_trips_unknown_enum_values(self): - data = { - "object": "profile", - "id": "prof_01DMC79VCBZ0NY2099737PSVF1", - "organization_id": "org_01EHQMYV6MBK39QC5PZXHY59C3", - "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", - "connection_type": "unexpected_profile_connection_type", - "idp_id": "103456789012345678901", - "email": "todd@example.com", - "first_name": "Todd", - "last_name": "Rundgren", - "role": {"slug": "admin"}, - "roles": [{"slug": "admin"}], - "groups": ["Engineering", "Admins"], - "custom_attributes": {"key": {}}, - "raw_attributes": {"key": {}}, - } + data = {"object": "profile", "id": "prof_01DMC79VCBZ0NY2099737PSVF1", "organization_id": "org_01EHQMYV6MBK39QC5PZXHY59C3", "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", "connection_type": "unexpected_profile_connection_type", "idp_id": "103456789012345678901", "email": "todd@example.com", "first_name": "Todd", "last_name": "Rundgren", "role": {"slug": "admin"}, "roles": [{"slug": "admin"}], "groups": ["Engineering", "Admins"], "custom_attributes": {"key": {}}, "raw_attributes": {"key": {}}} instance = Profile.from_dict(data) assert instance.to_dict() == data @@ -14668,27 +7340,7 @@ def test_sso_token_response_round_trip(self): assert restored.to_dict() == serialized def test_sso_token_response_minimal_payload(self): - data = { - "token_type": "Bearer", - "access_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6InNzby...", - "expires_in": 600, - "profile": { - "object": "profile", - "id": "prof_01DMC79VCBZ0NY2099737PSVF1", - "organization_id": "org_01EHQMYV6MBK39QC5PZXHY59C3", - "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", - "connection_type": "GoogleOAuth", - "idp_id": "103456789012345678901", - "email": "todd@example.com", - "first_name": "Todd", - "last_name": "Rundgren", - "role": {"slug": "admin"}, - "roles": [{"slug": "admin"}], - "groups": ["Engineering", "Admins"], - "custom_attributes": {"key": {}}, - "raw_attributes": {"key": {}}, - }, - } + data = {"token_type": "Bearer", "access_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6InNzby...", "expires_in": 600, "profile": {"object": "profile", "id": "prof_01DMC79VCBZ0NY2099737PSVF1", "organization_id": "org_01EHQMYV6MBK39QC5PZXHY59C3", "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", "connection_type": "GoogleOAuth", "idp_id": "103456789012345678901", "email": "todd@example.com", "first_name": "Todd", "last_name": "Rundgren", "role": {"slug": "admin"}, "roles": [{"slug": "admin"}], "groups": ["Engineering", "Admins"], "custom_attributes": {"key": {}}, "raw_attributes": {"key": {}}}} instance = SSOTokenResponse.from_dict(data) serialized = instance.to_dict() assert serialized["token_type"] == data["token_type"] @@ -14697,27 +7349,7 @@ def test_sso_token_response_minimal_payload(self): assert serialized["profile"] == data["profile"] def test_sso_token_response_omits_absent_optional_non_nullable_fields(self): - data = { - "token_type": "Bearer", - "access_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6InNzby...", - "expires_in": 600, - "profile": { - "object": "profile", - "id": "prof_01DMC79VCBZ0NY2099737PSVF1", - "organization_id": "org_01EHQMYV6MBK39QC5PZXHY59C3", - "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", - "connection_type": "GoogleOAuth", - "idp_id": "103456789012345678901", - "email": "todd@example.com", - "first_name": "Todd", - "last_name": "Rundgren", - "role": {"slug": "admin"}, - "roles": [{"slug": "admin"}], - "groups": ["Engineering", "Admins"], - "custom_attributes": {"key": {}}, - "raw_attributes": {"key": {}}, - }, - } + data = {"token_type": "Bearer", "access_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6InNzby...", "expires_in": 600, "profile": {"object": "profile", "id": "prof_01DMC79VCBZ0NY2099737PSVF1", "organization_id": "org_01EHQMYV6MBK39QC5PZXHY59C3", "connection_id": "conn_01E4ZCR3C56J083X43JQXF3JK5", "connection_type": "GoogleOAuth", "idp_id": "103456789012345678901", "email": "todd@example.com", "first_name": "Todd", "last_name": "Rundgren", "role": {"slug": "admin"}, "roles": [{"slug": "admin"}], "groups": ["Engineering", "Admins"], "custom_attributes": {"key": {}}, "raw_attributes": {"key": {}}}} instance = SSOTokenResponse.from_dict(data) serialized = instance.to_dict() assert "oauth_tokens" not in serialized @@ -14731,10 +7363,7 @@ def test_sso_logout_authorize_response_round_trip(self): assert restored.to_dict() == serialized def test_sso_logout_authorize_response_minimal_payload(self): - data = { - "logout_url": "https://auth.workos.com/sso/logout?token=eyJhbGciOiJSUzI1NiJ9", - "logout_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwcm9maWxlX2lkIjoicHJvZl8wMUdXUTFHMEgyRk02QVNFRjBIUzEzSENXOS0zMDRrZzAzZyIsImV4cCI6IjE1MTYyMzkwMjIifQ.Wru9Qlnf5DpohtGCKhZU4cVOd3zpiu7QQ-XEX--5A_4", - } + data = {"logout_url": "https://auth.workos.com/sso/logout?token=eyJhbGciOiJSUzI1NiJ9", "logout_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwcm9maWxlX2lkIjoicHJvZl8wMUdXUTFHMEgyRk02QVNFRjBIUzEzSENXOS0zMDRrZzAzZyIsImV4cCI6IjE1MTYyMzkwMjIifQ.Wru9Qlnf5DpohtGCKhZU4cVOd3zpiu7QQ-XEX--5A_4"} instance = SSOLogoutAuthorizeResponse.from_dict(data) serialized = instance.to_dict() assert serialized["logout_url"] == data["logout_url"] @@ -14749,20 +7378,7 @@ def test_jwks_response_round_trip(self): assert restored.to_dict() == serialized def test_jwks_response_minimal_payload(self): - data = { - "keys": [ - { - "alg": "RS256", - "kty": "RSA", - "use": "sig", - "x5c": ["MIIDQjCCAiqgAwIBAgIGATz/FuLiMA0GCSqGSIb3DQEBCwUA..."], - "n": "0vx7agoebGc...eKnNs", - "e": "AQAB", - "kid": "key_01HXYZ123456789ABCDEFGHIJ", - "x5t#S256": "ZjQzYjI0OT...NmNjU0", - } - ] - } + data = {"keys": [{"alg": "RS256", "kty": "RSA", "use": "sig", "x5c": ["MIIDQjCCAiqgAwIBAgIGATz/FuLiMA0GCSqGSIb3DQEBCwUA..."], "n": "0vx7agoebGc...eKnNs", "e": "AQAB", "kid": "key_01HXYZ123456789ABCDEFGHIJ", "x5t#S256": "ZjQzYjI0OT...NmNjU0"}]} instance = JwksResponse.from_dict(data) serialized = instance.to_dict() assert serialized["keys"] == data["keys"] @@ -14776,16 +7392,7 @@ def test_jwks_response_keys_round_trip(self): assert restored.to_dict() == serialized def test_jwks_response_keys_minimal_payload(self): - data = { - "alg": "RS256", - "kty": "RSA", - "use": "sig", - "x5c": ["MIIDQjCCAiqgAwIBAgIGATz/FuLiMA0GCSqGSIb3DQEBCwUA..."], - "n": "0vx7agoebGc...eKnNs", - "e": "AQAB", - "kid": "key_01HXYZ123456789ABCDEFGHIJ", - "x5t#S256": "ZjQzYjI0OT...NmNjU0", - } + data = {"alg": "RS256", "kty": "RSA", "use": "sig", "x5c": ["MIIDQjCCAiqgAwIBAgIGATz/FuLiMA0GCSqGSIb3DQEBCwUA..."], "n": "0vx7agoebGc...eKnNs", "e": "AQAB", "kid": "key_01HXYZ123456789ABCDEFGHIJ", "x5t#S256": "ZjQzYjI0OT...NmNjU0"} instance = JwksResponseKeys.from_dict(data) serialized = instance.to_dict() assert serialized["alg"] == data["alg"] @@ -14806,13 +7413,7 @@ def test_sso_token_response_oauth_token_round_trip(self): assert restored.to_dict() == serialized def test_sso_token_response_oauth_token_minimal_payload(self): - data = { - "provider": "GoogleOAuth", - "refresh_token": "1//04g...", - "access_token": "ya29.a0ARrdaM...", - "expires_at": 1735141800, - "scopes": ["profile", "email", "openid"], - } + data = {"provider": "GoogleOAuth", "refresh_token": "1//04g...", "access_token": "ya29.a0ARrdaM...", "expires_at": 1735141800, "scopes": ["profile", "email", "openid"]} instance = SSOTokenResponseOAuthToken.from_dict(data) serialized = instance.to_dict() assert serialized["provider"] == data["provider"] @@ -14851,13 +7452,7 @@ def test_authenticate_response_oauth_token_round_trip(self): assert restored.to_dict() == serialized def test_authenticate_response_oauth_token_minimal_payload(self): - data = { - "provider": "GoogleOAuth", - "refresh_token": "1//04g...", - "access_token": "ya29.a0ARrdaM...", - "expires_at": 1735141800, - "scopes": ["profile", "email", "openid"], - } + data = {"provider": "GoogleOAuth", "refresh_token": "1//04g...", "access_token": "ya29.a0ARrdaM...", "expires_at": 1735141800, "scopes": ["profile", "email", "openid"]} instance = AuthenticateResponseOAuthToken.from_dict(data) serialized = instance.to_dict() assert serialized["provider"] == data["provider"] @@ -14875,20 +7470,7 @@ def test_data_integrations_list_response_data_round_trip(self): assert restored.to_dict() == serialized def test_data_integrations_list_response_data_minimal_payload(self): - data = { - "object": "data_provider", - "id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", - "name": "GitHub", - "description": None, - "slug": "github", - "integration_type": "github", - "credentials_type": "oauth2", - "scopes": None, - "ownership": "userland_user", - "created_at": "2024-01-15T10:30:00.000Z", - "updated_at": "2024-01-15T10:30:00.000Z", - "connected_account": None, - } + data = {"object": "data_provider", "id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", "name": "GitHub", "description": None, "slug": "github", "integration_type": "github", "credentials_type": "oauth2", "scopes": None, "ownership": "userland_user", "created_at": "2024-01-15T10:30:00.000Z", "updated_at": "2024-01-15T10:30:00.000Z", "connected_account": None} instance = DataIntegrationsListResponseData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -14905,20 +7487,7 @@ def test_data_integrations_list_response_data_minimal_payload(self): assert serialized["connected_account"] == data["connected_account"] def test_data_integrations_list_response_data_preserves_nullable_fields(self): - data = { - "object": "data_provider", - "id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", - "name": "GitHub", - "description": None, - "slug": "github", - "integration_type": "github", - "credentials_type": "oauth2", - "scopes": None, - "ownership": "userland_user", - "created_at": "2024-01-15T10:30:00.000Z", - "updated_at": "2024-01-15T10:30:00.000Z", - "connected_account": None, - } + data = {"object": "data_provider", "id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", "name": "GitHub", "description": None, "slug": "github", "integration_type": "github", "credentials_type": "oauth2", "scopes": None, "ownership": "userland_user", "created_at": "2024-01-15T10:30:00.000Z", "updated_at": "2024-01-15T10:30:00.000Z", "connected_account": None} instance = DataIntegrationsListResponseData.from_dict(data) serialized = instance.to_dict() assert serialized["description"] is None @@ -14926,30 +7495,7 @@ def test_data_integrations_list_response_data_preserves_nullable_fields(self): assert serialized["connected_account"] is None def test_data_integrations_list_response_data_round_trips_unknown_enum_values(self): - data = { - "object": "data_provider", - "id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", - "name": "GitHub", - "description": "Connect your GitHub account to access repositories.", - "slug": "github", - "integration_type": "github", - "credentials_type": "oauth2", - "scopes": ["repo", "user:email"], - "ownership": "unexpected_data_integrations_list_response_data_ownership", - "created_at": "2024-01-15T10:30:00.000Z", - "updated_at": "2024-01-15T10:30:00.000Z", - "connected_account": { - "object": "connected_account", - "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", - "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", - "organization_id": None, - "scopes": ["repo", "user:email"], - "state": "connected", - "created_at": "2024-01-16T14:20:00.000Z", - "updated_at": "2024-01-16T14:20:00.000Z", - "userlandUserId": "test_userlandUserId", - }, - } + data = {"object": "data_provider", "id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", "name": "GitHub", "description": "Connect your GitHub account to access repositories.", "slug": "github", "integration_type": "github", "credentials_type": "oauth2", "scopes": ["repo", "user:email"], "ownership": "unexpected_data_integrations_list_response_data_ownership", "created_at": "2024-01-15T10:30:00.000Z", "updated_at": "2024-01-15T10:30:00.000Z", "connected_account": {"object": "connected_account", "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", "organization_id": None, "scopes": ["repo", "user:email"], "state": "connected", "created_at": "2024-01-16T14:20:00.000Z", "updated_at": "2024-01-16T14:20:00.000Z", "userlandUserId": "test_userlandUserId"}} instance = DataIntegrationsListResponseData.from_dict(data) assert instance.to_dict() == data @@ -14962,13 +7508,7 @@ def test_data_integration_access_token_response_access_token_round_trip(self): assert restored.to_dict() == serialized def test_data_integration_access_token_response_access_token_minimal_payload(self): - data = { - "object": "access_token", - "access_token": "gho_16C7e42F292c6912E7710c838347Ae178B4a", - "expires_at": None, - "scopes": ["repo", "user:email"], - "missing_scopes": [], - } + data = {"object": "access_token", "access_token": "gho_16C7e42F292c6912E7710c838347Ae178B4a", "expires_at": None, "scopes": ["repo", "user:email"], "missing_scopes": []} instance = DataIntegrationAccessTokenResponseAccessToken.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -14977,16 +7517,8 @@ def test_data_integration_access_token_response_access_token_minimal_payload(sel assert serialized["scopes"] == data["scopes"] assert serialized["missing_scopes"] == data["missing_scopes"] - def test_data_integration_access_token_response_access_token_preserves_nullable_fields( - self, - ): - data = { - "object": "access_token", - "access_token": "gho_16C7e42F292c6912E7710c838347Ae178B4a", - "expires_at": None, - "scopes": ["repo", "user:email"], - "missing_scopes": [], - } + def test_data_integration_access_token_response_access_token_preserves_nullable_fields(self): + data = {"object": "access_token", "access_token": "gho_16C7e42F292c6912E7710c838347Ae178B4a", "expires_at": None, "scopes": ["repo", "user:email"], "missing_scopes": []} instance = DataIntegrationAccessTokenResponseAccessToken.from_dict(data) serialized = instance.to_dict() assert serialized["expires_at"] is None @@ -15000,13 +7532,7 @@ def test_audit_log_configuration_log_stream_round_trip(self): assert restored.to_dict() == serialized def test_audit_log_configuration_log_stream_minimal_payload(self): - data = { - "id": "als_01EHZNVPK3SFK441A1RGBFSHRT", - "type": "Datadog", - "state": "active", - "last_synced_at": None, - "created_at": "2026-01-15T12:00:00.000Z", - } + data = {"id": "als_01EHZNVPK3SFK441A1RGBFSHRT", "type": "Datadog", "state": "active", "last_synced_at": None, "created_at": "2026-01-15T12:00:00.000Z"} instance = AuditLogConfigurationLogStream.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -15016,25 +7542,13 @@ def test_audit_log_configuration_log_stream_minimal_payload(self): assert serialized["created_at"] == data["created_at"] def test_audit_log_configuration_log_stream_preserves_nullable_fields(self): - data = { - "id": "als_01EHZNVPK3SFK441A1RGBFSHRT", - "type": "Datadog", - "state": "active", - "last_synced_at": None, - "created_at": "2026-01-15T12:00:00.000Z", - } + data = {"id": "als_01EHZNVPK3SFK441A1RGBFSHRT", "type": "Datadog", "state": "active", "last_synced_at": None, "created_at": "2026-01-15T12:00:00.000Z"} instance = AuditLogConfigurationLogStream.from_dict(data) serialized = instance.to_dict() assert serialized["last_synced_at"] is None def test_audit_log_configuration_log_stream_round_trips_unknown_enum_values(self): - data = { - "id": "als_01EHZNVPK3SFK441A1RGBFSHRT", - "type": "unexpected_audit_log_configuration_log_stream_type", - "state": "active", - "last_synced_at": "2026-01-15T12:00:00.000Z", - "created_at": "2026-01-15T12:00:00.000Z", - } + data = {"id": "als_01EHZNVPK3SFK441A1RGBFSHRT", "type": "unexpected_audit_log_configuration_log_stream_type", "state": "active", "last_synced_at": "2026-01-15T12:00:00.000Z", "created_at": "2026-01-15T12:00:00.000Z"} instance = AuditLogConfigurationLogStream.from_dict(data) assert instance.to_dict() == data @@ -15047,14 +7561,7 @@ def test_organization_domain_round_trip(self): assert restored.to_dict() == serialized def test_organization_domain_minimal_payload(self): - data = { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationDomain.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -15065,14 +7572,7 @@ def test_organization_domain_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_organization_domain_omits_absent_optional_non_nullable_fields(self): - data = { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationDomain.from_dict(data) serialized = instance.to_dict() assert "state" not in serialized @@ -15081,18 +7581,7 @@ def test_organization_domain_omits_absent_optional_non_nullable_fields(self): assert "verification_strategy" not in serialized def test_organization_domain_round_trips_unknown_enum_values(self): - data = { - "object": "organization_domain", - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", - "domain": "foo-corp.com", - "state": "unexpected_organization_domain_state", - "verification_prefix": "superapp-domain-verification-z3kjny", - "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", - "verification_strategy": "dns", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization_domain", "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "organization_id": "org_01HE8GSH8FQPASKSY27THRKRBP", "domain": "foo-corp.com", "state": "unexpected_organization_domain_state", "verification_prefix": "superapp-domain-verification-z3kjny", "verification_token": "m5Oztg3jdK4NJLgs8uIlIprMw", "verification_strategy": "dns", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = OrganizationDomain.from_dict(data) assert instance.to_dict() == data @@ -15194,9 +7683,7 @@ def test_event_context_google_analytics_session_minimal_payload(self): serialized = instance.to_dict() assert serialized["containerId"] == data["containerId"] - def test_event_context_google_analytics_session_omits_absent_optional_non_nullable_fields( - self, - ): + def test_event_context_google_analytics_session_omits_absent_optional_non_nullable_fields(self): data = {"containerId": "GTM-ABCDEF"} instance = EventContextGoogleAnalyticsSession.from_dict(data) serialized = instance.to_dict() @@ -15216,9 +7703,7 @@ def test_directory_user_with_groups_email_minimal_payload(self): instance = DirectoryUserWithGroupsEmail.from_dict(data) assert instance.to_dict() is not None - def test_directory_user_with_groups_email_omits_absent_optional_non_nullable_fields( - self, - ): + def test_directory_user_with_groups_email_omits_absent_optional_non_nullable_fields(self): data = {"value": "marcelina.davis@example.com"} instance = DirectoryUserWithGroupsEmail.from_dict(data) serialized = instance.to_dict() @@ -15255,11 +7740,7 @@ def test_connection_domain_round_trip(self): assert restored.to_dict() == serialized def test_connection_domain_minimal_payload(self): - data = { - "id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", - "object": "connection_domain", - "domain": "foo-corp.com", - } + data = {"id": "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A", "object": "connection_domain", "domain": "foo-corp.com"} instance = ConnectionDomain.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -15295,16 +7776,7 @@ def test_user_organization_membership_base_list_data_round_trip(self): assert restored.to_dict() == serialized def test_user_organization_membership_base_list_data_minimal_payload(self): - data = { - "object": "organization_membership", - "id": "om_01HXYZ123456789ABCDEFGHIJ", - "user_id": "user_01EHQTV6MWP9P1F4ZXGXMC8ABB", - "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT", - "status": "active", - "directory_managed": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "organization_membership", "id": "om_01HXYZ123456789ABCDEFGHIJ", "user_id": "user_01EHQTV6MWP9P1F4ZXGXMC8ABB", "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT", "status": "active", "directory_managed": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = UserOrganizationMembershipBaseListData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -15316,43 +7788,15 @@ def test_user_organization_membership_base_list_data_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["updated_at"] == data["updated_at"] - def test_user_organization_membership_base_list_data_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "object": "organization_membership", - "id": "om_01HXYZ123456789ABCDEFGHIJ", - "user_id": "user_01EHQTV6MWP9P1F4ZXGXMC8ABB", - "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT", - "status": "active", - "directory_managed": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + def test_user_organization_membership_base_list_data_omits_absent_optional_non_nullable_fields(self): + data = {"object": "organization_membership", "id": "om_01HXYZ123456789ABCDEFGHIJ", "user_id": "user_01EHQTV6MWP9P1F4ZXGXMC8ABB", "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT", "status": "active", "directory_managed": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = UserOrganizationMembershipBaseListData.from_dict(data) serialized = instance.to_dict() assert "organization_name" not in serialized assert "custom_attributes" not in serialized - def test_user_organization_membership_base_list_data_round_trips_unknown_enum_values( - self, - ): - data = { - "object": "organization_membership", - "id": "om_01HXYZ123456789ABCDEFGHIJ", - "user_id": "user_01EHQTV6MWP9P1F4ZXGXMC8ABB", - "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT", - "status": "unexpected_user_organization_membership_base_list_data_status", - "directory_managed": False, - "organization_name": "Acme Corp", - "custom_attributes": { - "department": "Engineering", - "title": "Developer Experience Engineer", - "location": "Brooklyn", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + def test_user_organization_membership_base_list_data_round_trips_unknown_enum_values(self): + data = {"object": "organization_membership", "id": "om_01HXYZ123456789ABCDEFGHIJ", "user_id": "user_01EHQTV6MWP9P1F4ZXGXMC8ABB", "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT", "status": "unexpected_user_organization_membership_base_list_data_status", "directory_managed": False, "organization_name": "Acme Corp", "custom_attributes": {"department": "Engineering", "title": "Developer Experience Engineer", "location": "Brooklyn"}, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = UserOrganizationMembershipBaseListData.from_dict(data) assert instance.to_dict() == data @@ -15365,11 +7809,7 @@ def test_role_assignment_resource_round_trip(self): assert restored.to_dict() == serialized def test_role_assignment_resource_minimal_payload(self): - data = { - "id": "authz_resource_01HXYZ123456789ABCDEFGH", - "external_id": "proj-456", - "resource_type_slug": "project", - } + data = {"id": "authz_resource_01HXYZ123456789ABCDEFGH", "external_id": "proj-456", "resource_type_slug": "project"} instance = RoleAssignmentResource.from_dict(data) serialized = instance.to_dict() assert serialized["id"] == data["id"] @@ -15428,13 +7868,7 @@ def test_authentication_factor_enrolled_totp_round_trip(self): assert restored.to_dict() == serialized def test_authentication_factor_enrolled_totp_minimal_payload(self): - data = { - "issuer": "WorkOS", - "user": "user@example.com", - "secret": "JBSWY3DPEHPK3PXP", - "qr_code": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUg...", - "uri": "otpauth://totp/WorkOS:user@example.com?secret=JBSWY3DPEHPK3PXP&issuer=WorkOS", - } + data = {"issuer": "WorkOS", "user": "user@example.com", "secret": "JBSWY3DPEHPK3PXP", "qr_code": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUg...", "uri": "otpauth://totp/WorkOS:user@example.com?secret=JBSWY3DPEHPK3PXP&issuer=WorkOS"} instance = AuthenticationFactorEnrolledTotp.from_dict(data) serialized = instance.to_dict() assert serialized["issuer"] == data["issuer"] @@ -15471,9 +7905,7 @@ def test_audit_log_schema_json_target_minimal_payload(self): serialized = instance.to_dict() assert serialized["type"] == data["type"] - def test_audit_log_schema_json_target_omits_absent_optional_non_nullable_fields( - self, - ): + def test_audit_log_schema_json_target_omits_absent_optional_non_nullable_fields(self): data = {"type": "invoice"} instance = AuditLogSchemaJsonTarget.from_dict(data) serialized = instance.to_dict() @@ -15488,23 +7920,7 @@ def test_authorized_connect_application_list_data_round_trip(self): assert restored.to_dict() == serialized def test_authorized_connect_application_list_data_minimal_payload(self): - data = { - "object": "authorized_connect_application", - "id": "authorized_connect_app_01HXYZ123456789ABCDEFGHIJ", - "granted_scopes": ["openid", "profile", "email"], - "application": { - "object": "connect_application", - "id": "conn_app_01HXYZ123456789ABCDEFGHIJ", - "client_id": "client_01HXYZ123456789ABCDEFGHIJ", - "description": "An application for managing user access", - "name": "My Application", - "scopes": ["openid", "profile", "email"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "application_type": "m2m", - "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT", - }, - } + data = {"object": "authorized_connect_application", "id": "authorized_connect_app_01HXYZ123456789ABCDEFGHIJ", "granted_scopes": ["openid", "profile", "email"], "application": {"object": "connect_application", "id": "conn_app_01HXYZ123456789ABCDEFGHIJ", "client_id": "client_01HXYZ123456789ABCDEFGHIJ", "description": "An application for managing user access", "name": "My Application", "scopes": ["openid", "profile", "email"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "application_type": "m2m", "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT"}} instance = AuthorizedConnectApplicationListData.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -15512,26 +7928,8 @@ def test_authorized_connect_application_list_data_minimal_payload(self): assert serialized["granted_scopes"] == data["granted_scopes"] assert serialized["application"] == data["application"] - def test_authorized_connect_application_list_data_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "object": "authorized_connect_application", - "id": "authorized_connect_app_01HXYZ123456789ABCDEFGHIJ", - "granted_scopes": ["openid", "profile", "email"], - "application": { - "object": "connect_application", - "id": "conn_app_01HXYZ123456789ABCDEFGHIJ", - "client_id": "client_01HXYZ123456789ABCDEFGHIJ", - "description": "An application for managing user access", - "name": "My Application", - "scopes": ["openid", "profile", "email"], - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "application_type": "m2m", - "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT", - }, - } + def test_authorized_connect_application_list_data_omits_absent_optional_non_nullable_fields(self): + data = {"object": "authorized_connect_application", "id": "authorized_connect_app_01HXYZ123456789ABCDEFGHIJ", "granted_scopes": ["openid", "profile", "email"], "application": {"object": "connect_application", "id": "conn_app_01HXYZ123456789ABCDEFGHIJ", "client_id": "client_01HXYZ123456789ABCDEFGHIJ", "description": "An application for managing user access", "name": "My Application", "scopes": ["openid", "profile", "email"], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "application_type": "m2m", "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT"}} instance = AuthorizedConnectApplicationListData.from_dict(data) serialized = instance.to_dict() assert "oauth_resource" not in serialized @@ -15580,17 +7978,7 @@ def test_permission_round_trip(self): assert restored.to_dict() == serialized def test_permission_minimal_payload(self): - data = { - "object": "permission", - "id": "perm_01HXYZ123456789ABCDEFGHIJ", - "slug": "documents:read", - "name": "View Documents", - "description": None, - "system": False, - "resource_type_slug": "document", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "permission", "id": "perm_01HXYZ123456789ABCDEFGHIJ", "slug": "documents:read", "name": "View Documents", "description": None, "system": False, "resource_type_slug": "document", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = Permission.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -15604,17 +7992,7 @@ def test_permission_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_permission_preserves_nullable_fields(self): - data = { - "object": "permission", - "id": "perm_01HXYZ123456789ABCDEFGHIJ", - "slug": "documents:read", - "name": "View Documents", - "description": None, - "system": False, - "resource_type_slug": "document", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "permission", "id": "perm_01HXYZ123456789ABCDEFGHIJ", "slug": "documents:read", "name": "View Documents", "description": None, "system": False, "resource_type_slug": "document", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = Permission.from_dict(data) serialized = instance.to_dict() assert serialized["description"] is None @@ -15628,14 +8006,7 @@ def test_application_credentials_list_item_round_trip(self): assert restored.to_dict() == serialized def test_application_credentials_list_item_minimal_payload(self): - data = { - "object": "connect_application_secret", - "id": "secret_01J9Q2Z3X4Y5W6V7U8T9S0R1Q", - "secret_hint": "abc123", - "last_used_at": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "connect_application_secret", "id": "secret_01J9Q2Z3X4Y5W6V7U8T9S0R1Q", "secret_hint": "abc123", "last_used_at": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = ApplicationCredentialsListItem.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -15646,14 +8017,7 @@ def test_application_credentials_list_item_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_application_credentials_list_item_preserves_nullable_fields(self): - data = { - "object": "connect_application_secret", - "id": "secret_01J9Q2Z3X4Y5W6V7U8T9S0R1Q", - "secret_hint": "abc123", - "last_used_at": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "connect_application_secret", "id": "secret_01J9Q2Z3X4Y5W6V7U8T9S0R1Q", "secret_hint": "abc123", "last_used_at": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = ApplicationCredentialsListItem.from_dict(data) serialized = instance.to_dict() assert serialized["last_used_at"] is None @@ -15667,19 +8031,7 @@ def test_feature_flag_round_trip(self): assert restored.to_dict() == serialized def test_feature_flag_minimal_payload(self): - data = { - "object": "feature_flag", - "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT", - "slug": "advanced-analytics", - "name": "Advanced Analytics", - "description": None, - "owner": None, - "tags": ["reports"], - "enabled": False, - "default_value": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "feature_flag", "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT", "slug": "advanced-analytics", "name": "Advanced Analytics", "description": None, "owner": None, "tags": ["reports"], "enabled": False, "default_value": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = FeatureFlag.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -15695,19 +8047,7 @@ def test_feature_flag_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_feature_flag_preserves_nullable_fields(self): - data = { - "object": "feature_flag", - "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT", - "slug": "advanced-analytics", - "name": "Advanced Analytics", - "description": None, - "owner": None, - "tags": ["reports"], - "enabled": False, - "default_value": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "feature_flag", "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT", "slug": "advanced-analytics", "name": "Advanced Analytics", "description": None, "owner": None, "tags": ["reports"], "enabled": False, "default_value": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = FeatureFlag.from_dict(data) serialized = instance.to_dict() assert serialized["description"] is None @@ -15745,22 +8085,7 @@ def test_invitation_round_trip(self): assert restored.to_dict() == serialized def test_invitation_minimal_payload(self): - data = { - "object": "invitation", - "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "state": "accepted", - "accepted_at": None, - "revoked_at": None, - "expires_at": "2026-01-15T12:00:00.000Z", - "organization_id": None, - "inviter_user_id": None, - "accepted_user_id": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "token": "Z1uX3RbwcIl5fIGJJJCXXisdI", - "accept_invitation_url": "https://your-app.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI", - } + data = {"object": "invitation", "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "state": "accepted", "accepted_at": None, "revoked_at": None, "expires_at": "2026-01-15T12:00:00.000Z", "organization_id": None, "inviter_user_id": None, "accepted_user_id": None, "role_slug": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "token": "Z1uX3RbwcIl5fIGJJJCXXisdI", "accept_invitation_url": "https://your-app.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI"} instance = Invitation.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -15773,28 +8098,14 @@ def test_invitation_minimal_payload(self): assert serialized["organization_id"] == data["organization_id"] assert serialized["inviter_user_id"] == data["inviter_user_id"] assert serialized["accepted_user_id"] == data["accepted_user_id"] + assert serialized["role_slug"] == data["role_slug"] assert serialized["created_at"] == data["created_at"] assert serialized["updated_at"] == data["updated_at"] assert serialized["token"] == data["token"] assert serialized["accept_invitation_url"] == data["accept_invitation_url"] def test_invitation_preserves_nullable_fields(self): - data = { - "object": "invitation", - "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "state": "accepted", - "accepted_at": None, - "revoked_at": None, - "expires_at": "2026-01-15T12:00:00.000Z", - "organization_id": None, - "inviter_user_id": None, - "accepted_user_id": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "token": "Z1uX3RbwcIl5fIGJJJCXXisdI", - "accept_invitation_url": "https://your-app.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI", - } + data = {"object": "invitation", "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "state": "accepted", "accepted_at": None, "revoked_at": None, "expires_at": "2026-01-15T12:00:00.000Z", "organization_id": None, "inviter_user_id": None, "accepted_user_id": None, "role_slug": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "token": "Z1uX3RbwcIl5fIGJJJCXXisdI", "accept_invitation_url": "https://your-app.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI"} instance = Invitation.from_dict(data) serialized = instance.to_dict() assert serialized["accepted_at"] is None @@ -15802,24 +8113,10 @@ def test_invitation_preserves_nullable_fields(self): assert serialized["organization_id"] is None assert serialized["inviter_user_id"] is None assert serialized["accepted_user_id"] is None + assert serialized["role_slug"] is None def test_invitation_round_trips_unknown_enum_values(self): - data = { - "object": "invitation", - "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", - "email": "marcelina.davis@example.com", - "state": "unexpected_invitation_state", - "accepted_at": "2026-01-15T12:00:00.000Z", - "revoked_at": None, - "expires_at": "2026-01-15T12:00:00.000Z", - "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", - "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", - "accepted_user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "token": "Z1uX3RbwcIl5fIGJJJCXXisdI", - "accept_invitation_url": "https://your-app.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI", - } + data = {"object": "invitation", "id": "invitation_01E4ZCR3C56J083X43JQXF3JK5", "email": "marcelina.davis@example.com", "state": "unexpected_invitation_state", "accepted_at": "2026-01-15T12:00:00.000Z", "revoked_at": None, "expires_at": "2026-01-15T12:00:00.000Z", "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", "accepted_user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "role_slug": "admin", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "token": "Z1uX3RbwcIl5fIGJJJCXXisdI", "accept_invitation_url": "https://your-app.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI"} instance = Invitation.from_dict(data) assert instance.to_dict() == data @@ -15832,17 +8129,7 @@ def test_organization_membership_round_trip(self): assert restored.to_dict() == serialized def test_organization_membership_minimal_payload(self): - data = { - "object": "organization_membership", - "id": "om_01HXYZ123456789ABCDEFGHIJ", - "user_id": "user_01E4ZCR3C5A4QZ2Z2JQXGKZJ9E", - "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", - "status": "active", - "directory_managed": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "role": {"slug": "admin"}, - } + data = {"object": "organization_membership", "id": "om_01HXYZ123456789ABCDEFGHIJ", "user_id": "user_01E4ZCR3C5A4QZ2Z2JQXGKZJ9E", "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", "status": "active", "directory_managed": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "role": {"slug": "admin"}} instance = OrganizationMembership.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -15856,40 +8143,14 @@ def test_organization_membership_minimal_payload(self): assert serialized["role"] == data["role"] def test_organization_membership_omits_absent_optional_non_nullable_fields(self): - data = { - "object": "organization_membership", - "id": "om_01HXYZ123456789ABCDEFGHIJ", - "user_id": "user_01E4ZCR3C5A4QZ2Z2JQXGKZJ9E", - "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", - "status": "active", - "directory_managed": False, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "role": {"slug": "admin"}, - } + data = {"object": "organization_membership", "id": "om_01HXYZ123456789ABCDEFGHIJ", "user_id": "user_01E4ZCR3C5A4QZ2Z2JQXGKZJ9E", "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", "status": "active", "directory_managed": False, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "role": {"slug": "admin"}} instance = OrganizationMembership.from_dict(data) serialized = instance.to_dict() assert "organization_name" not in serialized assert "custom_attributes" not in serialized def test_organization_membership_round_trips_unknown_enum_values(self): - data = { - "object": "organization_membership", - "id": "om_01HXYZ123456789ABCDEFGHIJ", - "user_id": "user_01E4ZCR3C5A4QZ2Z2JQXGKZJ9E", - "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", - "status": "unexpected_organization_membership_status", - "directory_managed": False, - "organization_name": "Acme Corp", - "custom_attributes": { - "department": "Engineering", - "title": "Developer Experience Engineer", - "location": "Brooklyn", - }, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "role": {"slug": "admin"}, - } + data = {"object": "organization_membership", "id": "om_01HXYZ123456789ABCDEFGHIJ", "user_id": "user_01E4ZCR3C5A4QZ2Z2JQXGKZJ9E", "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", "status": "unexpected_organization_membership_status", "directory_managed": False, "organization_name": "Acme Corp", "custom_attributes": {"department": "Engineering", "title": "Developer Experience Engineer", "location": "Brooklyn"}, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "role": {"slug": "admin"}} instance = OrganizationMembership.from_dict(data) assert instance.to_dict() == data @@ -15902,24 +8163,7 @@ def test_email_change_confirmation_round_trip(self): assert restored.to_dict() == serialized def test_email_change_confirmation_minimal_payload(self): - data = { - "object": "email_change_confirmation", - "user": { - "object": "user", - "id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "first_name": "Marcelina", - "last_name": "Davis", - "profile_picture_url": "https://workoscdn.com/images/v1/123abc", - "email": "new.email@example.com", - "email_verified": True, - "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222", - "metadata": {"timezone": "America/New_York"}, - "last_sign_in_at": "2025-06-25T19:07:33.155Z", - "locale": "en-US", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - }, - } + data = {"object": "email_change_confirmation", "user": {"object": "user", "id": "user_01E4ZCR3C56J083X43JQXF3JK5", "first_name": "Marcelina", "last_name": "Davis", "profile_picture_url": "https://workoscdn.com/images/v1/123abc", "email": "new.email@example.com", "email_verified": True, "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222", "metadata": {"timezone": "America/New_York"}, "last_sign_in_at": "2025-06-25T19:07:33.155Z", "locale": "en-US", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"}} instance = EmailChangeConfirmation.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -15934,19 +8178,7 @@ def test_email_change_confirmation_user_round_trip(self): assert restored.to_dict() == serialized def test_email_change_confirmation_user_minimal_payload(self): - data = { - "object": "user", - "id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "first_name": None, - "last_name": None, - "profile_picture_url": None, - "email": "new.email@example.com", - "email_verified": True, - "external_id": None, - "last_sign_in_at": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "user", "id": "user_01E4ZCR3C56J083X43JQXF3JK5", "first_name": None, "last_name": None, "profile_picture_url": None, "email": "new.email@example.com", "email_verified": True, "external_id": None, "last_sign_in_at": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = EmailChangeConfirmationUser.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -15961,43 +8193,14 @@ def test_email_change_confirmation_user_minimal_payload(self): assert serialized["created_at"] == data["created_at"] assert serialized["updated_at"] == data["updated_at"] - def test_email_change_confirmation_user_omits_absent_optional_non_nullable_fields( - self, - ): - data = { - "object": "user", - "id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "first_name": "Marcelina", - "last_name": "Davis", - "profile_picture_url": "https://workoscdn.com/images/v1/123abc", - "email": "new.email@example.com", - "email_verified": True, - "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222", - "last_sign_in_at": "2025-06-25T19:07:33.155Z", - "locale": "en-US", - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + def test_email_change_confirmation_user_omits_absent_optional_non_nullable_fields(self): + data = {"object": "user", "id": "user_01E4ZCR3C56J083X43JQXF3JK5", "first_name": "Marcelina", "last_name": "Davis", "profile_picture_url": "https://workoscdn.com/images/v1/123abc", "email": "new.email@example.com", "email_verified": True, "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222", "last_sign_in_at": "2025-06-25T19:07:33.155Z", "locale": "en-US", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = EmailChangeConfirmationUser.from_dict(data) serialized = instance.to_dict() assert "metadata" not in serialized def test_email_change_confirmation_user_preserves_nullable_fields(self): - data = { - "object": "user", - "id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "first_name": None, - "last_name": None, - "profile_picture_url": None, - "email": "new.email@example.com", - "email_verified": True, - "external_id": None, - "metadata": {"timezone": "America/New_York"}, - "last_sign_in_at": None, - "locale": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "user", "id": "user_01E4ZCR3C56J083X43JQXF3JK5", "first_name": None, "last_name": None, "profile_picture_url": None, "email": "new.email@example.com", "email_verified": True, "external_id": None, "metadata": {"timezone": "America/New_York"}, "last_sign_in_at": None, "locale": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = EmailChangeConfirmationUser.from_dict(data) serialized = instance.to_dict() assert serialized["first_name"] is None @@ -16016,11 +8219,7 @@ def test_user_identities_get_item_round_trip(self): assert restored.to_dict() == serialized def test_user_identities_get_item_minimal_payload(self): - data = { - "idp_id": "4F42ABDE-1E44-4B66-824A-5F733C037A6D", - "type": "OAuth", - "provider": "MicrosoftOAuth", - } + data = {"idp_id": "4F42ABDE-1E44-4B66-824A-5F733C037A6D", "type": "OAuth", "provider": "MicrosoftOAuth"} instance = UserIdentitiesGetItem.from_dict(data) serialized = instance.to_dict() assert serialized["idp_id"] == data["idp_id"] @@ -16028,11 +8227,7 @@ def test_user_identities_get_item_minimal_payload(self): assert serialized["provider"] == data["provider"] def test_user_identities_get_item_round_trips_unknown_enum_values(self): - data = { - "idp_id": "4F42ABDE-1E44-4B66-824A-5F733C037A6D", - "type": "OAuth", - "provider": "unexpected_user_identities_get_item_provider", - } + data = {"idp_id": "4F42ABDE-1E44-4B66-824A-5F733C037A6D", "type": "OAuth", "provider": "unexpected_user_identities_get_item_provider"} instance = UserIdentitiesGetItem.from_dict(data) assert instance.to_dict() == data @@ -16045,19 +8240,7 @@ def test_user_sessions_list_item_round_trip(self): assert restored.to_dict() == serialized def test_user_sessions_list_item_minimal_payload(self): - data = { - "object": "session", - "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8", - "ip_address": None, - "user_agent": None, - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "auth_method": "sso", - "status": "active", - "expires_at": "2026-01-15T12:00:00.000Z", - "ended_at": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "session", "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8", "ip_address": None, "user_agent": None, "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "auth_method": "sso", "status": "active", "expires_at": "2026-01-15T12:00:00.000Z", "ended_at": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = UserSessionsListItem.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -16073,43 +8256,14 @@ def test_user_sessions_list_item_minimal_payload(self): assert serialized["updated_at"] == data["updated_at"] def test_user_sessions_list_item_omits_absent_optional_non_nullable_fields(self): - data = { - "object": "session", - "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8", - "ip_address": "198.51.100.42", - "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "auth_method": "sso", - "status": "active", - "expires_at": "2026-01-15T12:00:00.000Z", - "ended_at": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "session", "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8", "ip_address": "198.51.100.42", "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "auth_method": "sso", "status": "active", "expires_at": "2026-01-15T12:00:00.000Z", "ended_at": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = UserSessionsListItem.from_dict(data) serialized = instance.to_dict() assert "impersonator" not in serialized assert "organization_id" not in serialized def test_user_sessions_list_item_preserves_nullable_fields(self): - data = { - "object": "session", - "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8", - "impersonator": { - "email": "admin@foocorp.com", - "reason": "Investigating an issue with the customer's account.", - }, - "ip_address": None, - "organization_id": "org_01H945H0YD4F97JN9MATX7BYAG", - "user_agent": None, - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "auth_method": "sso", - "status": "active", - "expires_at": "2026-01-15T12:00:00.000Z", - "ended_at": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "session", "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8", "impersonator": {"email": "admin@foocorp.com", "reason": "Investigating an issue with the customer's account."}, "ip_address": None, "organization_id": "org_01H945H0YD4F97JN9MATX7BYAG", "user_agent": None, "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "auth_method": "sso", "status": "active", "expires_at": "2026-01-15T12:00:00.000Z", "ended_at": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = UserSessionsListItem.from_dict(data) serialized = instance.to_dict() assert serialized["ip_address"] is None @@ -16117,24 +8271,7 @@ def test_user_sessions_list_item_preserves_nullable_fields(self): assert serialized["ended_at"] is None def test_user_sessions_list_item_round_trips_unknown_enum_values(self): - data = { - "object": "session", - "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8", - "impersonator": { - "email": "admin@foocorp.com", - "reason": "Investigating an issue with the customer's account.", - }, - "ip_address": "198.51.100.42", - "organization_id": "org_01H945H0YD4F97JN9MATX7BYAG", - "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36", - "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", - "auth_method": "unexpected_user_sessions_list_item_auth_method", - "status": "active", - "expires_at": "2026-01-15T12:00:00.000Z", - "ended_at": None, - "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - } + data = {"object": "session", "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8", "impersonator": {"email": "admin@foocorp.com", "reason": "Investigating an issue with the customer's account."}, "ip_address": "198.51.100.42", "organization_id": "org_01H945H0YD4F97JN9MATX7BYAG", "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36", "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", "auth_method": "unexpected_user_sessions_list_item_auth_method", "status": "active", "expires_at": "2026-01-15T12:00:00.000Z", "ended_at": None, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z"} instance = UserSessionsListItem.from_dict(data) assert instance.to_dict() == data @@ -16175,31 +8312,15 @@ def test_directory_metadata_user_minimal_payload(self): assert serialized["inactive"] == data["inactive"] def test_data_integrations_list_response_data_connected_account_round_trip(self): - data = load_fixture( - "data_integrations_list_response_data_connected_account.json" - ) + data = load_fixture("data_integrations_list_response_data_connected_account.json") instance = DataIntegrationsListResponseDataConnectedAccount.from_dict(data) serialized = instance.to_dict() assert serialized == data - restored = DataIntegrationsListResponseDataConnectedAccount.from_dict( - serialized - ) - assert restored.to_dict() == serialized - - def test_data_integrations_list_response_data_connected_account_minimal_payload( - self, - ): - data = { - "object": "connected_account", - "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", - "user_id": None, - "organization_id": None, - "scopes": ["repo", "user:email"], - "state": "connected", - "created_at": "2024-01-16T14:20:00.000Z", - "updated_at": "2024-01-16T14:20:00.000Z", - "userlandUserId": None, - } + restored = DataIntegrationsListResponseDataConnectedAccount.from_dict(serialized) + assert restored.to_dict() == serialized + + def test_data_integrations_list_response_data_connected_account_minimal_payload(self): + data = {"object": "connected_account", "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", "user_id": None, "organization_id": None, "scopes": ["repo", "user:email"], "state": "connected", "created_at": "2024-01-16T14:20:00.000Z", "updated_at": "2024-01-16T14:20:00.000Z", "userlandUserId": None} instance = DataIntegrationsListResponseDataConnectedAccount.from_dict(data) serialized = instance.to_dict() assert serialized["object"] == data["object"] @@ -16212,45 +8333,22 @@ def test_data_integrations_list_response_data_connected_account_minimal_payload( assert serialized["updated_at"] == data["updated_at"] assert serialized["userlandUserId"] == data["userlandUserId"] - def test_data_integrations_list_response_data_connected_account_preserves_nullable_fields( - self, - ): - data = { - "object": "connected_account", - "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", - "user_id": None, - "organization_id": None, - "scopes": ["repo", "user:email"], - "state": "connected", - "created_at": "2024-01-16T14:20:00.000Z", - "updated_at": "2024-01-16T14:20:00.000Z", - "userlandUserId": None, - } + def test_data_integrations_list_response_data_connected_account_preserves_nullable_fields(self): + data = {"object": "connected_account", "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", "user_id": None, "organization_id": None, "scopes": ["repo", "user:email"], "state": "connected", "created_at": "2024-01-16T14:20:00.000Z", "updated_at": "2024-01-16T14:20:00.000Z", "userlandUserId": None} instance = DataIntegrationsListResponseDataConnectedAccount.from_dict(data) serialized = instance.to_dict() assert serialized["user_id"] is None assert serialized["organization_id"] is None assert serialized["userlandUserId"] is None - def test_data_integrations_list_response_data_connected_account_round_trips_unknown_enum_values( - self, - ): - data = { - "object": "connected_account", - "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", - "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", - "organization_id": None, - "scopes": ["repo", "user:email"], - "state": "unexpected_data_integrations_list_response_data_connected_account_state", - "created_at": "2024-01-16T14:20:00.000Z", - "updated_at": "2024-01-16T14:20:00.000Z", - "userlandUserId": "test_userlandUserId", - } + def test_data_integrations_list_response_data_connected_account_round_trips_unknown_enum_values(self): + data = {"object": "connected_account", "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", "organization_id": None, "scopes": ["repo", "user:email"], "state": "unexpected_data_integrations_list_response_data_connected_account_state", "created_at": "2024-01-16T14:20:00.000Z", "updated_at": "2024-01-16T14:20:00.000Z", "userlandUserId": "test_userlandUserId"} instance = DataIntegrationsListResponseDataConnectedAccount.from_dict(data) assert instance.to_dict() == data class TestDiscriminatorDispatch: + def test_event_schema_dispatches_known_variant(self): data = load_fixture("action_authentication_denied.json") result = EventSchema.from_dict(data) diff --git a/tests/test_multi_factor_auth.py b/tests/test_multi_factor_auth.py index 146bfb41..f3500012 100644 --- a/tests/test_multi_factor_auth.py +++ b/tests/test_multi_factor_auth.py @@ -7,26 +7,13 @@ from tests.generated_helpers import load_fixture from workos.common.models import AuthenticationFactorsCreateRequestType -from workos.multi_factor_auth.models import ( - AuthenticationChallenge, - AuthenticationChallengeVerifyResponse, - AuthenticationFactor, - AuthenticationFactorEnrolled, - UserAuthenticationFactorEnrollResponse, - UserManagementMultiFactorAuthenticationOrder, -) +from workos.multi_factor_auth.models import AuthenticationChallenge, AuthenticationChallengeVerifyResponse, AuthenticationFactor, AuthenticationFactorEnrolled, UserAuthenticationFactorEnrollResponse, UserManagementMultiFactorAuthenticationOrder from workos._pagination import AsyncPage, SyncPage -from workos._errors import ( - AuthenticationError, - BadRequestError, - NotFoundError, - RateLimitExceededError, - ServerError, - UnprocessableEntityError, -) +from workos._errors import AuthenticationError, BadRequestError, NotFoundError, RateLimitExceededError, ServerError, UnprocessableEntityError class TestMultiFactorAuth: + def test_verify_challenge(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("authentication_challenge_verify_response.json"), @@ -44,9 +31,7 @@ def test_enroll_factor(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("authentication_factor_enrolled.json"), ) - result = workos.multi_factor_auth.enroll_factor( - type=AuthenticationFactorsCreateRequestType("generic_otp") - ) + result = workos.multi_factor_auth.enroll_factor(type=AuthenticationFactorsCreateRequestType("generic_otp")) assert isinstance(result, AuthenticationFactorEnrolled) assert result.object == "authentication_factor" assert result.id == "auth_factor_01FVYZ5QM8N98T9ME5BCB2BBMJ" @@ -105,13 +90,7 @@ def test_list_user_auth_factors_empty_page(self, workos, httpx_mock): def test_list_user_auth_factors_encodes_query_params(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - workos.multi_factor_auth.list_user_auth_factors( - "test_userlandUserId", - limit=10, - before="cursor before", - after="cursor/after", - order=UserManagementMultiFactorAuthenticationOrder("normal"), - ) + workos.multi_factor_auth.list_user_auth_factors("test_userlandUserId", limit=10, before="cursor before", after="cursor/after", order=UserManagementMultiFactorAuthenticationOrder("normal")) request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -122,27 +101,17 @@ def test_create_user_auth_factor(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("user_authentication_factor_enroll_response.json"), ) - result = workos.multi_factor_auth.create_user_auth_factor( - "test_userlandUserId", type="totp" - ) + result = workos.multi_factor_auth.create_user_auth_factor("test_userlandUserId", type="totp") assert isinstance(result, UserAuthenticationFactorEnrollResponse) request = httpx_mock.get_request() assert request.method == "POST" - assert request.url.path.endswith( - "/user_management/users/test_userlandUserId/auth_factors" - ) + assert request.url.path.endswith("/user_management/users/test_userlandUserId/auth_factors") body = json.loads(request.content) assert body["type"] == "totp" def test_verify_challenge_with_request_options(self, workos, httpx_mock): - httpx_mock.add_response( - json=load_fixture("authentication_challenge_verify_response.json") - ) - workos.multi_factor_auth.verify_challenge( - "test_id", - code="test_code", - request_options={"extra_headers": {"X-Custom": "value"}}, - ) + httpx_mock.add_response(json=load_fixture("authentication_challenge_verify_response.json")) + workos.multi_factor_auth.verify_challenge("test_id", code="test_code", request_options={"extra_headers": {"X-Custom": "value"}}) request = httpx_mock.get_request() assert request.headers["X-Custom"] == "value" @@ -155,9 +124,7 @@ def test_verify_challenge_unauthorized(self, workos, httpx_mock): workos.multi_factor_auth.verify_challenge("test_id", code="test_code") def test_verify_challenge_not_found(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=404, json={"message": "Not found"}) with pytest.raises(NotFoundError): @@ -166,24 +133,16 @@ def test_verify_challenge_not_found(self, httpx_mock): workos.close() def test_verify_challenge_rate_limited(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: - httpx_mock.add_response( - status_code=429, - headers={"Retry-After": "0"}, - json={"message": "Slow down"}, - ) + httpx_mock.add_response(status_code=429, headers={"Retry-After": "0"}, json={"message": "Slow down"}) with pytest.raises(RateLimitExceededError): workos.multi_factor_auth.verify_challenge("test_id", code="test_code") finally: workos.close() def test_verify_challenge_server_error(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=500, json={"message": "Server error"}) with pytest.raises(ServerError): @@ -192,9 +151,7 @@ def test_verify_challenge_server_error(self, httpx_mock): workos.close() def test_verify_challenge_bad_request(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) with pytest.raises(BadRequestError): @@ -203,9 +160,7 @@ def test_verify_challenge_bad_request(self, httpx_mock): workos.close() def test_verify_challenge_unprocessable(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) with pytest.raises(UnprocessableEntityError): @@ -215,14 +170,11 @@ def test_verify_challenge_unprocessable(self, httpx_mock): class TestAsyncMultiFactorAuth: + @pytest.mark.asyncio async def test_verify_challenge(self, async_workos, httpx_mock): - httpx_mock.add_response( - json=load_fixture("authentication_challenge_verify_response.json") - ) - result = await async_workos.multi_factor_auth.verify_challenge( - "test_id", code="test_code" - ) + httpx_mock.add_response(json=load_fixture("authentication_challenge_verify_response.json")) + result = await async_workos.multi_factor_auth.verify_challenge("test_id", code="test_code") assert isinstance(result, AuthenticationChallengeVerifyResponse) assert result.valid is True request = httpx_mock.get_request() @@ -231,12 +183,8 @@ async def test_verify_challenge(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_enroll_factor(self, async_workos, httpx_mock): - httpx_mock.add_response( - json=load_fixture("authentication_factor_enrolled.json") - ) - result = await async_workos.multi_factor_auth.enroll_factor( - type=AuthenticationFactorsCreateRequestType("generic_otp") - ) + httpx_mock.add_response(json=load_fixture("authentication_factor_enrolled.json")) + result = await async_workos.multi_factor_auth.enroll_factor(type=AuthenticationFactorsCreateRequestType("generic_otp")) assert isinstance(result, AuthenticationFactorEnrolled) assert result.object == "authentication_factor" assert result.id == "auth_factor_01FVYZ5QM8N98T9ME5BCB2BBMJ" @@ -278,9 +226,7 @@ async def test_challenge_factor(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_list_user_auth_factors(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("list_authentication_factor.json")) - page = await async_workos.multi_factor_auth.list_user_auth_factors( - "test_userlandUserId" - ) + page = await async_workos.multi_factor_auth.list_user_auth_factors("test_userlandUserId") assert isinstance(page, AsyncPage) assert len(page.data) == 1 assert isinstance(page.data[0], AuthenticationFactor) @@ -288,24 +234,14 @@ async def test_list_user_auth_factors(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_list_user_auth_factors_empty_page(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - page = await async_workos.multi_factor_auth.list_user_auth_factors( - "test_userlandUserId" - ) + page = await async_workos.multi_factor_auth.list_user_auth_factors("test_userlandUserId") assert isinstance(page, AsyncPage) assert page.data == [] @pytest.mark.asyncio - async def test_list_user_auth_factors_encodes_query_params( - self, async_workos, httpx_mock - ): + async def test_list_user_auth_factors_encodes_query_params(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - await async_workos.multi_factor_auth.list_user_auth_factors( - "test_userlandUserId", - limit=10, - before="cursor before", - after="cursor/after", - order=UserManagementMultiFactorAuthenticationOrder("normal"), - ) + await async_workos.multi_factor_auth.list_user_auth_factors("test_userlandUserId", limit=10, before="cursor before", after="cursor/after", order=UserManagementMultiFactorAuthenticationOrder("normal")) request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -314,31 +250,17 @@ async def test_list_user_auth_factors_encodes_query_params( @pytest.mark.asyncio async def test_create_user_auth_factor(self, async_workos, httpx_mock): - httpx_mock.add_response( - json=load_fixture("user_authentication_factor_enroll_response.json") - ) - result = await async_workos.multi_factor_auth.create_user_auth_factor( - "test_userlandUserId", type="totp" - ) + httpx_mock.add_response(json=load_fixture("user_authentication_factor_enroll_response.json")) + result = await async_workos.multi_factor_auth.create_user_auth_factor("test_userlandUserId", type="totp") assert isinstance(result, UserAuthenticationFactorEnrollResponse) request = httpx_mock.get_request() assert request.method == "POST" - assert request.url.path.endswith( - "/user_management/users/test_userlandUserId/auth_factors" - ) + assert request.url.path.endswith("/user_management/users/test_userlandUserId/auth_factors") @pytest.mark.asyncio - async def test_verify_challenge_with_request_options( - self, async_workos, httpx_mock - ): - httpx_mock.add_response( - json=load_fixture("authentication_challenge_verify_response.json") - ) - await async_workos.multi_factor_auth.verify_challenge( - "test_id", - code="test_code", - request_options={"extra_headers": {"X-Custom": "value"}}, - ) + async def test_verify_challenge_with_request_options(self, async_workos, httpx_mock): + httpx_mock.add_response(json=load_fixture("authentication_challenge_verify_response.json")) + await async_workos.multi_factor_auth.verify_challenge("test_id", code="test_code", request_options={"extra_headers": {"X-Custom": "value"}}) request = httpx_mock.get_request() assert request.headers["X-Custom"] == "value" @@ -346,80 +268,54 @@ async def test_verify_challenge_with_request_options( async def test_verify_challenge_unauthorized(self, async_workos, httpx_mock): httpx_mock.add_response(status_code=401, json={"message": "Unauthorized"}) with pytest.raises(AuthenticationError): - await async_workos.multi_factor_auth.verify_challenge( - "test_id", code="test_code" - ) + await async_workos.multi_factor_auth.verify_challenge("test_id", code="test_code") @pytest.mark.asyncio async def test_verify_challenge_not_found(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=404, json={"message": "Not found"}) with pytest.raises(NotFoundError): - await workos.multi_factor_auth.verify_challenge( - "test_id", code="test_code" - ) + await workos.multi_factor_auth.verify_challenge("test_id", code="test_code") finally: await workos.close() @pytest.mark.asyncio async def test_verify_challenge_rate_limited(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: - httpx_mock.add_response( - status_code=429, - headers={"Retry-After": "0"}, - json={"message": "Slow down"}, - ) + httpx_mock.add_response(status_code=429, headers={"Retry-After": "0"}, json={"message": "Slow down"}) with pytest.raises(RateLimitExceededError): - await workos.multi_factor_auth.verify_challenge( - "test_id", code="test_code" - ) + await workos.multi_factor_auth.verify_challenge("test_id", code="test_code") finally: await workos.close() @pytest.mark.asyncio async def test_verify_challenge_server_error(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=500, json={"message": "Server error"}) with pytest.raises(ServerError): - await workos.multi_factor_auth.verify_challenge( - "test_id", code="test_code" - ) + await workos.multi_factor_auth.verify_challenge("test_id", code="test_code") finally: await workos.close() @pytest.mark.asyncio async def test_verify_challenge_bad_request(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) with pytest.raises(BadRequestError): - await workos.multi_factor_auth.verify_challenge( - "test_id", code="test_code" - ) + await workos.multi_factor_auth.verify_challenge("test_id", code="test_code") finally: await workos.close() @pytest.mark.asyncio async def test_verify_challenge_unprocessable(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) with pytest.raises(UnprocessableEntityError): - await workos.multi_factor_auth.verify_challenge( - "test_id", code="test_code" - ) + await workos.multi_factor_auth.verify_challenge("test_id", code="test_code") finally: await workos.close() diff --git a/tests/test_organization_domains.py b/tests/test_organization_domains.py index 7ecbbbfd..05cc5596 100644 --- a/tests/test_organization_domains.py +++ b/tests/test_organization_domains.py @@ -6,28 +6,17 @@ from workos import WorkOSClient, AsyncWorkOSClient from tests.generated_helpers import load_fixture -from workos.organization_domains.models import ( - OrganizationDomain, - OrganizationDomainStandAlone, -) -from workos._errors import ( - AuthenticationError, - BadRequestError, - NotFoundError, - RateLimitExceededError, - ServerError, - UnprocessableEntityError, -) +from workos.organization_domains.models import OrganizationDomain, OrganizationDomainStandAlone +from workos._errors import AuthenticationError, BadRequestError, NotFoundError, RateLimitExceededError, ServerError, UnprocessableEntityError class TestOrganizationDomains: + def test_create_organization_domain(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("organization_domain.json"), ) - result = workos.organization_domains.create_organization_domain( - domain="test_domain", organization_id="test_organization_id" - ) + result = workos.organization_domains.create_organization_domain(domain="test_domain", organization_id="test_organization_id") assert isinstance(result, OrganizationDomain) assert result.object == "organization_domain" assert result.id == "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A" @@ -72,11 +61,7 @@ def test_verify_organization_domain(self, workos, httpx_mock): def test_create_organization_domain_with_request_options(self, workos, httpx_mock): httpx_mock.add_response(json=load_fixture("organization_domain.json")) - workos.organization_domains.create_organization_domain( - domain="test_domain", - organization_id="test_organization_id", - request_options={"extra_headers": {"X-Custom": "value"}}, - ) + workos.organization_domains.create_organization_domain(domain="test_domain", organization_id="test_organization_id", request_options={"extra_headers": {"X-Custom": "value"}}) request = httpx_mock.get_request() assert request.headers["X-Custom"] == "value" @@ -86,87 +71,60 @@ def test_create_organization_domain_unauthorized(self, workos, httpx_mock): json={"message": "Unauthorized"}, ) with pytest.raises(AuthenticationError): - workos.organization_domains.create_organization_domain( - domain="test_domain", organization_id="test_organization_id" - ) + workos.organization_domains.create_organization_domain(domain="test_domain", organization_id="test_organization_id") def test_create_organization_domain_not_found(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=404, json={"message": "Not found"}) with pytest.raises(NotFoundError): - workos.organization_domains.create_organization_domain( - domain="test_domain", organization_id="test_organization_id" - ) + workos.organization_domains.create_organization_domain(domain="test_domain", organization_id="test_organization_id") finally: workos.close() def test_create_organization_domain_rate_limited(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: - httpx_mock.add_response( - status_code=429, - headers={"Retry-After": "0"}, - json={"message": "Slow down"}, - ) + httpx_mock.add_response(status_code=429, headers={"Retry-After": "0"}, json={"message": "Slow down"}) with pytest.raises(RateLimitExceededError): - workos.organization_domains.create_organization_domain( - domain="test_domain", organization_id="test_organization_id" - ) + workos.organization_domains.create_organization_domain(domain="test_domain", organization_id="test_organization_id") finally: workos.close() def test_create_organization_domain_server_error(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=500, json={"message": "Server error"}) with pytest.raises(ServerError): - workos.organization_domains.create_organization_domain( - domain="test_domain", organization_id="test_organization_id" - ) + workos.organization_domains.create_organization_domain(domain="test_domain", organization_id="test_organization_id") finally: workos.close() def test_create_organization_domain_bad_request(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) with pytest.raises(BadRequestError): - workos.organization_domains.create_organization_domain( - domain="test_domain", organization_id="test_organization_id" - ) + workos.organization_domains.create_organization_domain(domain="test_domain", organization_id="test_organization_id") finally: workos.close() def test_create_organization_domain_unprocessable(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) with pytest.raises(UnprocessableEntityError): - workos.organization_domains.create_organization_domain( - domain="test_domain", organization_id="test_organization_id" - ) + workos.organization_domains.create_organization_domain(domain="test_domain", organization_id="test_organization_id") finally: workos.close() class TestAsyncOrganizationDomains: + @pytest.mark.asyncio async def test_create_organization_domain(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("organization_domain.json")) - result = await async_workos.organization_domains.create_organization_domain( - domain="test_domain", organization_id="test_organization_id" - ) + result = await async_workos.organization_domains.create_organization_domain(domain="test_domain", organization_id="test_organization_id") assert isinstance(result, OrganizationDomain) assert result.object == "organization_domain" assert result.id == "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A" @@ -176,12 +134,8 @@ async def test_create_organization_domain(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_get_organization_domain(self, async_workos, httpx_mock): - httpx_mock.add_response( - json=load_fixture("organization_domain_stand_alone.json") - ) - result = await async_workos.organization_domains.get_organization_domain( - "test_id" - ) + httpx_mock.add_response(json=load_fixture("organization_domain_stand_alone.json")) + result = await async_workos.organization_domains.get_organization_domain("test_id") assert isinstance(result, OrganizationDomainStandAlone) assert result.object == "organization_domain" assert result.id == "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A" @@ -192,9 +146,7 @@ async def test_get_organization_domain(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_delete_organization_domain(self, async_workos, httpx_mock): httpx_mock.add_response(status_code=204) - result = await async_workos.organization_domains.delete_organization_domain( - "test_id" - ) + result = await async_workos.organization_domains.delete_organization_domain("test_id") assert result is None request = httpx_mock.get_request() assert request.method == "DELETE" @@ -202,12 +154,8 @@ async def test_delete_organization_domain(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_verify_organization_domain(self, async_workos, httpx_mock): - httpx_mock.add_response( - json=load_fixture("organization_domain_stand_alone.json") - ) - result = await async_workos.organization_domains.verify_organization_domain( - "test_id" - ) + httpx_mock.add_response(json=load_fixture("organization_domain_stand_alone.json")) + result = await async_workos.organization_domains.verify_organization_domain("test_id") assert isinstance(result, OrganizationDomainStandAlone) assert result.object == "organization_domain" assert result.id == "org_domain_01EHZNVPK2QXHMVWCEDQEKY69A" @@ -216,98 +164,64 @@ async def test_verify_organization_domain(self, async_workos, httpx_mock): assert request.url.path.endswith("/organization_domains/test_id/verify") @pytest.mark.asyncio - async def test_create_organization_domain_with_request_options( - self, async_workos, httpx_mock - ): + async def test_create_organization_domain_with_request_options(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("organization_domain.json")) - await async_workos.organization_domains.create_organization_domain( - domain="test_domain", - organization_id="test_organization_id", - request_options={"extra_headers": {"X-Custom": "value"}}, - ) + await async_workos.organization_domains.create_organization_domain(domain="test_domain", organization_id="test_organization_id", request_options={"extra_headers": {"X-Custom": "value"}}) request = httpx_mock.get_request() assert request.headers["X-Custom"] == "value" @pytest.mark.asyncio - async def test_create_organization_domain_unauthorized( - self, async_workos, httpx_mock - ): + async def test_create_organization_domain_unauthorized(self, async_workos, httpx_mock): httpx_mock.add_response(status_code=401, json={"message": "Unauthorized"}) with pytest.raises(AuthenticationError): - await async_workos.organization_domains.create_organization_domain( - domain="test_domain", organization_id="test_organization_id" - ) + await async_workos.organization_domains.create_organization_domain(domain="test_domain", organization_id="test_organization_id") @pytest.mark.asyncio async def test_create_organization_domain_not_found(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=404, json={"message": "Not found"}) with pytest.raises(NotFoundError): - await workos.organization_domains.create_organization_domain( - domain="test_domain", organization_id="test_organization_id" - ) + await workos.organization_domains.create_organization_domain(domain="test_domain", organization_id="test_organization_id") finally: await workos.close() @pytest.mark.asyncio async def test_create_organization_domain_rate_limited(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: - httpx_mock.add_response( - status_code=429, - headers={"Retry-After": "0"}, - json={"message": "Slow down"}, - ) + httpx_mock.add_response(status_code=429, headers={"Retry-After": "0"}, json={"message": "Slow down"}) with pytest.raises(RateLimitExceededError): - await workos.organization_domains.create_organization_domain( - domain="test_domain", organization_id="test_organization_id" - ) + await workos.organization_domains.create_organization_domain(domain="test_domain", organization_id="test_organization_id") finally: await workos.close() @pytest.mark.asyncio async def test_create_organization_domain_server_error(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=500, json={"message": "Server error"}) with pytest.raises(ServerError): - await workos.organization_domains.create_organization_domain( - domain="test_domain", organization_id="test_organization_id" - ) + await workos.organization_domains.create_organization_domain(domain="test_domain", organization_id="test_organization_id") finally: await workos.close() @pytest.mark.asyncio async def test_create_organization_domain_bad_request(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) with pytest.raises(BadRequestError): - await workos.organization_domains.create_organization_domain( - domain="test_domain", organization_id="test_organization_id" - ) + await workos.organization_domains.create_organization_domain(domain="test_domain", organization_id="test_organization_id") finally: await workos.close() @pytest.mark.asyncio async def test_create_organization_domain_unprocessable(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) with pytest.raises(UnprocessableEntityError): - await workos.organization_domains.create_organization_domain( - domain="test_domain", organization_id="test_organization_id" - ) + await workos.organization_domains.create_organization_domain(domain="test_domain", organization_id="test_organization_id") finally: await workos.close() diff --git a/tests/test_organizations.py b/tests/test_organizations.py index 9e300cbe..1332865e 100644 --- a/tests/test_organizations.py +++ b/tests/test_organizations.py @@ -6,23 +6,13 @@ from workos import WorkOSClient, AsyncWorkOSClient from tests.generated_helpers import load_fixture -from workos.organizations.models import ( - AuditLogConfiguration, - Organization, - OrganizationsOrder, -) +from workos.organizations.models import AuditLogConfiguration, Organization, OrganizationDomainData, OrganizationsOrder from workos._pagination import AsyncPage, SyncPage -from workos._errors import ( - AuthenticationError, - BadRequestError, - NotFoundError, - RateLimitExceededError, - ServerError, - UnprocessableEntityError, -) +from workos._errors import AuthenticationError, BadRequestError, NotFoundError, RateLimitExceededError, ServerError, UnprocessableEntityError class TestOrganizations: + def test_list_organizations(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("list_organization.json"), @@ -40,14 +30,7 @@ def test_list_organizations_empty_page(self, workos, httpx_mock): def test_list_organizations_encodes_query_params(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - workos.organizations.list_organizations( - limit=10, - before="cursor before", - after="cursor/after", - order=OrganizationsOrder("normal"), - domains=["val1", "val2"], - search="value search/test", - ) + workos.organizations.list_organizations(limit=10, before="cursor before", after="cursor/after", order=OrganizationsOrder("normal"), domains=["val1", "val2"], search="value search/test") request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -74,9 +57,7 @@ def test_get_organization_by_external_id(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("organization.json"), ) - result = workos.organizations.get_organization_by_external_id( - "test_external_id" - ) + result = workos.organizations.get_organization_by_external_id("test_external_id") assert isinstance(result, Organization) assert result.object == "organization" assert result.id == "org_01EHWNCE74X7JSDV0X3SZ3KJNY" @@ -126,15 +107,11 @@ def test_get_audit_log_configuration(self, workos, httpx_mock): assert result.retention_period_in_days == 30 request = httpx_mock.get_request() assert request.method == "GET" - assert request.url.path.endswith( - "/organizations/test_id/audit_log_configuration" - ) + assert request.url.path.endswith("/organizations/test_id/audit_log_configuration") def test_list_organizations_with_request_options(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - workos.organizations.list_organizations( - request_options={"extra_headers": {"X-Custom": "value"}} - ) + workos.organizations.list_organizations(request_options={"extra_headers": {"X-Custom": "value"}}) request = httpx_mock.get_request() assert request.headers["X-Custom"] == "value" @@ -147,9 +124,7 @@ def test_list_organizations_unauthorized(self, workos, httpx_mock): workos.organizations.list_organizations() def test_list_organizations_not_found(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=404, json={"message": "Not found"}) with pytest.raises(NotFoundError): @@ -158,24 +133,16 @@ def test_list_organizations_not_found(self, httpx_mock): workos.close() def test_list_organizations_rate_limited(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: - httpx_mock.add_response( - status_code=429, - headers={"Retry-After": "0"}, - json={"message": "Slow down"}, - ) + httpx_mock.add_response(status_code=429, headers={"Retry-After": "0"}, json={"message": "Slow down"}) with pytest.raises(RateLimitExceededError): workos.organizations.list_organizations() finally: workos.close() def test_list_organizations_server_error(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=500, json={"message": "Server error"}) with pytest.raises(ServerError): @@ -184,9 +151,7 @@ def test_list_organizations_server_error(self, httpx_mock): workos.close() def test_list_organizations_bad_request(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) with pytest.raises(BadRequestError): @@ -195,9 +160,7 @@ def test_list_organizations_bad_request(self, httpx_mock): workos.close() def test_list_organizations_unprocessable(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) with pytest.raises(UnprocessableEntityError): @@ -207,6 +170,7 @@ def test_list_organizations_unprocessable(self, httpx_mock): class TestAsyncOrganizations: + @pytest.mark.asyncio async def test_list_organizations(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("list_organization.json")) @@ -223,18 +187,9 @@ async def test_list_organizations_empty_page(self, async_workos, httpx_mock): assert page.data == [] @pytest.mark.asyncio - async def test_list_organizations_encodes_query_params( - self, async_workos, httpx_mock - ): + async def test_list_organizations_encodes_query_params(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - await async_workos.organizations.list_organizations( - limit=10, - before="cursor before", - after="cursor/after", - order=OrganizationsOrder("normal"), - domains=["val1", "val2"], - search="value search/test", - ) + await async_workos.organizations.list_organizations(limit=10, before="cursor before", after="cursor/after", order=OrganizationsOrder("normal"), domains=["val1", "val2"], search="value search/test") request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -257,9 +212,7 @@ async def test_create_organization(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_get_organization_by_external_id(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("organization.json")) - result = await async_workos.organizations.get_organization_by_external_id( - "test_external_id" - ) + result = await async_workos.organizations.get_organization_by_external_id("test_external_id") assert isinstance(result, Organization) assert result.object == "organization" assert result.id == "org_01EHWNCE74X7JSDV0X3SZ3KJNY" @@ -307,18 +260,12 @@ async def test_get_audit_log_configuration(self, async_workos, httpx_mock): assert result.retention_period_in_days == 30 request = httpx_mock.get_request() assert request.method == "GET" - assert request.url.path.endswith( - "/organizations/test_id/audit_log_configuration" - ) + assert request.url.path.endswith("/organizations/test_id/audit_log_configuration") @pytest.mark.asyncio - async def test_list_organizations_with_request_options( - self, async_workos, httpx_mock - ): + async def test_list_organizations_with_request_options(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - await async_workos.organizations.list_organizations( - request_options={"extra_headers": {"X-Custom": "value"}} - ) + await async_workos.organizations.list_organizations(request_options={"extra_headers": {"X-Custom": "value"}}) request = httpx_mock.get_request() assert request.headers["X-Custom"] == "value" @@ -330,9 +277,7 @@ async def test_list_organizations_unauthorized(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_list_organizations_not_found(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=404, json={"message": "Not found"}) with pytest.raises(NotFoundError): @@ -342,15 +287,9 @@ async def test_list_organizations_not_found(self, httpx_mock): @pytest.mark.asyncio async def test_list_organizations_rate_limited(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: - httpx_mock.add_response( - status_code=429, - headers={"Retry-After": "0"}, - json={"message": "Slow down"}, - ) + httpx_mock.add_response(status_code=429, headers={"Retry-After": "0"}, json={"message": "Slow down"}) with pytest.raises(RateLimitExceededError): await workos.organizations.list_organizations() finally: @@ -358,9 +297,7 @@ async def test_list_organizations_rate_limited(self, httpx_mock): @pytest.mark.asyncio async def test_list_organizations_server_error(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=500, json={"message": "Server error"}) with pytest.raises(ServerError): @@ -370,9 +307,7 @@ async def test_list_organizations_server_error(self, httpx_mock): @pytest.mark.asyncio async def test_list_organizations_bad_request(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) with pytest.raises(BadRequestError): @@ -382,9 +317,7 @@ async def test_list_organizations_bad_request(self, httpx_mock): @pytest.mark.asyncio async def test_list_organizations_unprocessable(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) with pytest.raises(UnprocessableEntityError): diff --git a/tests/test_pipes.py b/tests/test_pipes.py index 5fe3bdad..ca2f03a1 100644 --- a/tests/test_pipes.py +++ b/tests/test_pipes.py @@ -6,35 +6,19 @@ from workos import WorkOSClient, AsyncWorkOSClient from tests.generated_helpers import load_fixture -from workos.pipes.models import ( - ConnectedAccount, - DataIntegrationAccessTokenResponse, - DataIntegrationAuthorizeUrlResponse, - DataIntegrationsListResponse, -) -from workos._errors import ( - AuthenticationError, - BadRequestError, - NotFoundError, - RateLimitExceededError, - ServerError, - UnprocessableEntityError, -) +from workos.pipes.models import ConnectedAccount, DataIntegrationAccessTokenResponse, DataIntegrationAuthorizeUrlResponse, DataIntegrationsListResponse +from workos._errors import AuthenticationError, BadRequestError, NotFoundError, RateLimitExceededError, ServerError, UnprocessableEntityError class TestPipes: + def test_authorize_data_integration(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("data_integration_authorize_url_response.json"), ) - result = workos.pipes.authorize_data_integration( - "test_slug", user_id="test_user_id" - ) + result = workos.pipes.authorize_data_integration("test_slug", user_id="test_user_id") assert isinstance(result, DataIntegrationAuthorizeUrlResponse) - assert ( - result.url - == "https://api.workos.com/data-integrations/q2czJKmVAraSBg8xFpT7M9uR/authorize-redirect" - ) + assert result.url == "https://api.workos.com/data-integrations/q2czJKmVAraSBg8xFpT7M9uR/authorize-redirect" request = httpx_mock.get_request() assert request.method == "POST" assert request.url.path.endswith("/data-integrations/test_slug/authorize") @@ -45,9 +29,7 @@ def test_create_data_integration_token(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("data_integration_access_token_response.json"), ) - result = workos.pipes.create_data_integration_token( - "test_slug", user_id="test_user_id" - ) + result = workos.pipes.create_data_integration_token("test_slug", user_id="test_user_id") assert isinstance(result, DataIntegrationAccessTokenResponse) assert result.active is True assert result.error == "not_installed" @@ -67,15 +49,11 @@ def test_get_user_connected_account(self, workos, httpx_mock): assert result.id == "data_installation_01EHZNVPK3SFK441A1RGBFSHRT" request = httpx_mock.get_request() assert request.method == "GET" - assert request.url.path.endswith( - "/user_management/users/test_user_id/connected_accounts/test_slug" - ) + assert request.url.path.endswith("/user_management/users/test_user_id/connected_accounts/test_slug") def test_get_user_connected_account_encodes_query_params(self, workos, httpx_mock): httpx_mock.add_response(json=load_fixture("connected_account.json")) - workos.pipes.get_user_connected_account( - "test_user_id", "test_slug", organization_id="value organization_id/test" - ) + workos.pipes.get_user_connected_account("test_user_id", "test_slug", organization_id="value organization_id/test") request = httpx_mock.get_request() assert request.url.params["organization_id"] == "value organization_id/test" @@ -85,17 +63,11 @@ def test_delete_user_connected_account(self, workos, httpx_mock): assert result is None request = httpx_mock.get_request() assert request.method == "DELETE" - assert request.url.path.endswith( - "/user_management/users/test_user_id/connected_accounts/test_slug" - ) + assert request.url.path.endswith("/user_management/users/test_user_id/connected_accounts/test_slug") - def test_delete_user_connected_account_encodes_query_params( - self, workos, httpx_mock - ): + def test_delete_user_connected_account_encodes_query_params(self, workos, httpx_mock): httpx_mock.add_response(status_code=204) - workos.pipes.delete_user_connected_account( - "test_user_id", "test_slug", organization_id="value organization_id/test" - ) + workos.pipes.delete_user_connected_account("test_user_id", "test_slug", organization_id="value organization_id/test") request = httpx_mock.get_request() assert request.url.params["organization_id"] == "value organization_id/test" @@ -108,29 +80,17 @@ def test_list_user_data_providers(self, workos, httpx_mock): assert result.object == "list" request = httpx_mock.get_request() assert request.method == "GET" - assert request.url.path.endswith( - "/user_management/users/test_user_id/data_providers" - ) + assert request.url.path.endswith("/user_management/users/test_user_id/data_providers") def test_list_user_data_providers_encodes_query_params(self, workos, httpx_mock): - httpx_mock.add_response( - json=load_fixture("data_integrations_list_response.json") - ) - workos.pipes.list_user_data_providers( - "test_user_id", organization_id="value organization_id/test" - ) + httpx_mock.add_response(json=load_fixture("data_integrations_list_response.json")) + workos.pipes.list_user_data_providers("test_user_id", organization_id="value organization_id/test") request = httpx_mock.get_request() assert request.url.params["organization_id"] == "value organization_id/test" def test_authorize_data_integration_with_request_options(self, workos, httpx_mock): - httpx_mock.add_response( - json=load_fixture("data_integration_authorize_url_response.json") - ) - workos.pipes.authorize_data_integration( - "test_slug", - user_id="test_user_id", - request_options={"extra_headers": {"X-Custom": "value"}}, - ) + httpx_mock.add_response(json=load_fixture("data_integration_authorize_url_response.json")) + workos.pipes.authorize_data_integration("test_slug", user_id="test_user_id", request_options={"extra_headers": {"X-Custom": "value"}}) request = httpx_mock.get_request() assert request.headers["X-Custom"] == "value" @@ -143,101 +103,67 @@ def test_authorize_data_integration_unauthorized(self, workos, httpx_mock): workos.pipes.authorize_data_integration("test_slug", user_id="test_user_id") def test_authorize_data_integration_not_found(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=404, json={"message": "Not found"}) with pytest.raises(NotFoundError): - workos.pipes.authorize_data_integration( - "test_slug", user_id="test_user_id" - ) + workos.pipes.authorize_data_integration("test_slug", user_id="test_user_id") finally: workos.close() def test_authorize_data_integration_rate_limited(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: - httpx_mock.add_response( - status_code=429, - headers={"Retry-After": "0"}, - json={"message": "Slow down"}, - ) + httpx_mock.add_response(status_code=429, headers={"Retry-After": "0"}, json={"message": "Slow down"}) with pytest.raises(RateLimitExceededError): - workos.pipes.authorize_data_integration( - "test_slug", user_id="test_user_id" - ) + workos.pipes.authorize_data_integration("test_slug", user_id="test_user_id") finally: workos.close() def test_authorize_data_integration_server_error(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=500, json={"message": "Server error"}) with pytest.raises(ServerError): - workos.pipes.authorize_data_integration( - "test_slug", user_id="test_user_id" - ) + workos.pipes.authorize_data_integration("test_slug", user_id="test_user_id") finally: workos.close() def test_authorize_data_integration_bad_request(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) with pytest.raises(BadRequestError): - workos.pipes.authorize_data_integration( - "test_slug", user_id="test_user_id" - ) + workos.pipes.authorize_data_integration("test_slug", user_id="test_user_id") finally: workos.close() def test_authorize_data_integration_unprocessable(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) with pytest.raises(UnprocessableEntityError): - workos.pipes.authorize_data_integration( - "test_slug", user_id="test_user_id" - ) + workos.pipes.authorize_data_integration("test_slug", user_id="test_user_id") finally: workos.close() class TestAsyncPipes: + @pytest.mark.asyncio async def test_authorize_data_integration(self, async_workos, httpx_mock): - httpx_mock.add_response( - json=load_fixture("data_integration_authorize_url_response.json") - ) - result = await async_workos.pipes.authorize_data_integration( - "test_slug", user_id="test_user_id" - ) + httpx_mock.add_response(json=load_fixture("data_integration_authorize_url_response.json")) + result = await async_workos.pipes.authorize_data_integration("test_slug", user_id="test_user_id") assert isinstance(result, DataIntegrationAuthorizeUrlResponse) - assert ( - result.url - == "https://api.workos.com/data-integrations/q2czJKmVAraSBg8xFpT7M9uR/authorize-redirect" - ) + assert result.url == "https://api.workos.com/data-integrations/q2czJKmVAraSBg8xFpT7M9uR/authorize-redirect" request = httpx_mock.get_request() assert request.method == "POST" assert request.url.path.endswith("/data-integrations/test_slug/authorize") @pytest.mark.asyncio async def test_create_data_integration_token(self, async_workos, httpx_mock): - httpx_mock.add_response( - json=load_fixture("data_integration_access_token_response.json") - ) - result = await async_workos.pipes.create_data_integration_token( - "test_slug", user_id="test_user_id" - ) + httpx_mock.add_response(json=load_fixture("data_integration_access_token_response.json")) + result = await async_workos.pipes.create_data_integration_token("test_slug", user_id="test_user_id") assert isinstance(result, DataIntegrationAccessTokenResponse) assert result.active is True assert result.error == "not_installed" @@ -248,175 +174,113 @@ async def test_create_data_integration_token(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_get_user_connected_account(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("connected_account.json")) - result = await async_workos.pipes.get_user_connected_account( - "test_user_id", "test_slug" - ) + result = await async_workos.pipes.get_user_connected_account("test_user_id", "test_slug") assert isinstance(result, ConnectedAccount) assert result.object == "connected_account" assert result.id == "data_installation_01EHZNVPK3SFK441A1RGBFSHRT" request = httpx_mock.get_request() assert request.method == "GET" - assert request.url.path.endswith( - "/user_management/users/test_user_id/connected_accounts/test_slug" - ) + assert request.url.path.endswith("/user_management/users/test_user_id/connected_accounts/test_slug") @pytest.mark.asyncio - async def test_get_user_connected_account_encodes_query_params( - self, async_workos, httpx_mock - ): + async def test_get_user_connected_account_encodes_query_params(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("connected_account.json")) - await async_workos.pipes.get_user_connected_account( - "test_user_id", "test_slug", organization_id="value organization_id/test" - ) + await async_workos.pipes.get_user_connected_account("test_user_id", "test_slug", organization_id="value organization_id/test") request = httpx_mock.get_request() assert request.url.params["organization_id"] == "value organization_id/test" @pytest.mark.asyncio async def test_delete_user_connected_account(self, async_workos, httpx_mock): httpx_mock.add_response(status_code=204) - result = await async_workos.pipes.delete_user_connected_account( - "test_user_id", "test_slug" - ) + result = await async_workos.pipes.delete_user_connected_account("test_user_id", "test_slug") assert result is None request = httpx_mock.get_request() assert request.method == "DELETE" - assert request.url.path.endswith( - "/user_management/users/test_user_id/connected_accounts/test_slug" - ) + assert request.url.path.endswith("/user_management/users/test_user_id/connected_accounts/test_slug") @pytest.mark.asyncio - async def test_delete_user_connected_account_encodes_query_params( - self, async_workos, httpx_mock - ): + async def test_delete_user_connected_account_encodes_query_params(self, async_workos, httpx_mock): httpx_mock.add_response(status_code=204) - await async_workos.pipes.delete_user_connected_account( - "test_user_id", "test_slug", organization_id="value organization_id/test" - ) + await async_workos.pipes.delete_user_connected_account("test_user_id", "test_slug", organization_id="value organization_id/test") request = httpx_mock.get_request() assert request.url.params["organization_id"] == "value organization_id/test" @pytest.mark.asyncio async def test_list_user_data_providers(self, async_workos, httpx_mock): - httpx_mock.add_response( - json=load_fixture("data_integrations_list_response.json") - ) + httpx_mock.add_response(json=load_fixture("data_integrations_list_response.json")) result = await async_workos.pipes.list_user_data_providers("test_user_id") assert isinstance(result, DataIntegrationsListResponse) assert result.object == "list" request = httpx_mock.get_request() assert request.method == "GET" - assert request.url.path.endswith( - "/user_management/users/test_user_id/data_providers" - ) + assert request.url.path.endswith("/user_management/users/test_user_id/data_providers") @pytest.mark.asyncio - async def test_list_user_data_providers_encodes_query_params( - self, async_workos, httpx_mock - ): - httpx_mock.add_response( - json=load_fixture("data_integrations_list_response.json") - ) - await async_workos.pipes.list_user_data_providers( - "test_user_id", organization_id="value organization_id/test" - ) + async def test_list_user_data_providers_encodes_query_params(self, async_workos, httpx_mock): + httpx_mock.add_response(json=load_fixture("data_integrations_list_response.json")) + await async_workos.pipes.list_user_data_providers("test_user_id", organization_id="value organization_id/test") request = httpx_mock.get_request() assert request.url.params["organization_id"] == "value organization_id/test" @pytest.mark.asyncio - async def test_authorize_data_integration_with_request_options( - self, async_workos, httpx_mock - ): - httpx_mock.add_response( - json=load_fixture("data_integration_authorize_url_response.json") - ) - await async_workos.pipes.authorize_data_integration( - "test_slug", - user_id="test_user_id", - request_options={"extra_headers": {"X-Custom": "value"}}, - ) + async def test_authorize_data_integration_with_request_options(self, async_workos, httpx_mock): + httpx_mock.add_response(json=load_fixture("data_integration_authorize_url_response.json")) + await async_workos.pipes.authorize_data_integration("test_slug", user_id="test_user_id", request_options={"extra_headers": {"X-Custom": "value"}}) request = httpx_mock.get_request() assert request.headers["X-Custom"] == "value" @pytest.mark.asyncio - async def test_authorize_data_integration_unauthorized( - self, async_workos, httpx_mock - ): + async def test_authorize_data_integration_unauthorized(self, async_workos, httpx_mock): httpx_mock.add_response(status_code=401, json={"message": "Unauthorized"}) with pytest.raises(AuthenticationError): - await async_workos.pipes.authorize_data_integration( - "test_slug", user_id="test_user_id" - ) + await async_workos.pipes.authorize_data_integration("test_slug", user_id="test_user_id") @pytest.mark.asyncio async def test_authorize_data_integration_not_found(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=404, json={"message": "Not found"}) with pytest.raises(NotFoundError): - await workos.pipes.authorize_data_integration( - "test_slug", user_id="test_user_id" - ) + await workos.pipes.authorize_data_integration("test_slug", user_id="test_user_id") finally: await workos.close() @pytest.mark.asyncio async def test_authorize_data_integration_rate_limited(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: - httpx_mock.add_response( - status_code=429, - headers={"Retry-After": "0"}, - json={"message": "Slow down"}, - ) + httpx_mock.add_response(status_code=429, headers={"Retry-After": "0"}, json={"message": "Slow down"}) with pytest.raises(RateLimitExceededError): - await workos.pipes.authorize_data_integration( - "test_slug", user_id="test_user_id" - ) + await workos.pipes.authorize_data_integration("test_slug", user_id="test_user_id") finally: await workos.close() @pytest.mark.asyncio async def test_authorize_data_integration_server_error(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=500, json={"message": "Server error"}) with pytest.raises(ServerError): - await workos.pipes.authorize_data_integration( - "test_slug", user_id="test_user_id" - ) + await workos.pipes.authorize_data_integration("test_slug", user_id="test_user_id") finally: await workos.close() @pytest.mark.asyncio async def test_authorize_data_integration_bad_request(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) with pytest.raises(BadRequestError): - await workos.pipes.authorize_data_integration( - "test_slug", user_id="test_user_id" - ) + await workos.pipes.authorize_data_integration("test_slug", user_id="test_user_id") finally: await workos.close() @pytest.mark.asyncio async def test_authorize_data_integration_unprocessable(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) with pytest.raises(UnprocessableEntityError): - await workos.pipes.authorize_data_integration( - "test_slug", user_id="test_user_id" - ) + await workos.pipes.authorize_data_integration("test_slug", user_id="test_user_id") finally: await workos.close() diff --git a/tests/test_radar.py b/tests/test_radar.py index 02a75abd..fe2686ea 100644 --- a/tests/test_radar.py +++ b/tests/test_radar.py @@ -6,36 +6,18 @@ from workos import WorkOSClient, AsyncWorkOSClient from tests.generated_helpers import load_fixture -from workos.common.models import ( - RadarStandaloneAssessRequestAction, - RadarStandaloneAssessRequestAuthMethod, -) -from workos.radar.models import ( - RadarListEntryAlreadyPresentResponse, - RadarStandaloneResponse, -) -from workos._errors import ( - AuthenticationError, - BadRequestError, - NotFoundError, - RateLimitExceededError, - ServerError, - UnprocessableEntityError, -) +from workos.common.models import RadarStandaloneAssessRequestAction, RadarStandaloneAssessRequestAuthMethod +from workos.radar.models import RadarListEntryAlreadyPresentResponse, RadarStandaloneResponse +from workos._errors import AuthenticationError, BadRequestError, NotFoundError, RateLimitExceededError, ServerError, UnprocessableEntityError class TestRadar: + def test_create_attempt(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("radar_standalone_response.json"), ) - result = workos.radar.create_attempt( - ip_address="test_ip_address", - user_agent="test_user_agent", - email="test_email", - auth_method=RadarStandaloneAssessRequestAuthMethod("Password"), - action=RadarStandaloneAssessRequestAction("login"), - ) + result = workos.radar.create_attempt(ip_address="test_ip_address", user_agent="test_user_agent", email="test_email", auth_method=RadarStandaloneAssessRequestAuthMethod("Password"), action=RadarStandaloneAssessRequestAction("login")) assert isinstance(result, RadarStandaloneResponse) assert result.verdict == "block" assert result.reason == "Detected enabled Radar control" @@ -60,9 +42,7 @@ def test_add_list_entry(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("radar_list_entry_already_present_response.json"), ) - result = workos.radar.add_list_entry( - "test_type", "test_action", entry="test_entry" - ) + result = workos.radar.add_list_entry("test_type", "test_action", entry="test_entry") assert isinstance(result, RadarListEntryAlreadyPresentResponse) assert result.message == "Entry already present in list" request = httpx_mock.get_request() @@ -73,9 +53,7 @@ def test_add_list_entry(self, workos, httpx_mock): def test_remove_list_entry(self, workos, httpx_mock): httpx_mock.add_response(status_code=204) - result = workos.radar.remove_list_entry( - "test_type", "test_action", entry="test_entry" - ) + result = workos.radar.remove_list_entry("test_type", "test_action", entry="test_entry") assert result is None request = httpx_mock.get_request() assert request.method == "DELETE" @@ -83,14 +61,7 @@ def test_remove_list_entry(self, workos, httpx_mock): def test_create_attempt_with_request_options(self, workos, httpx_mock): httpx_mock.add_response(json=load_fixture("radar_standalone_response.json")) - workos.radar.create_attempt( - ip_address="test_ip_address", - user_agent="test_user_agent", - email="test_email", - auth_method=RadarStandaloneAssessRequestAuthMethod("Password"), - action=RadarStandaloneAssessRequestAction("login"), - request_options={"extra_headers": {"X-Custom": "value"}}, - ) + workos.radar.create_attempt(ip_address="test_ip_address", user_agent="test_user_agent", email="test_email", auth_method=RadarStandaloneAssessRequestAuthMethod("Password"), action=RadarStandaloneAssessRequestAction("login"), request_options={"extra_headers": {"X-Custom": "value"}}) request = httpx_mock.get_request() assert request.headers["X-Custom"] == "value" @@ -100,115 +71,60 @@ def test_create_attempt_unauthorized(self, workos, httpx_mock): json={"message": "Unauthorized"}, ) with pytest.raises(AuthenticationError): - workos.radar.create_attempt( - ip_address="test_ip_address", - user_agent="test_user_agent", - email="test_email", - auth_method=RadarStandaloneAssessRequestAuthMethod("Password"), - action=RadarStandaloneAssessRequestAction("login"), - ) + workos.radar.create_attempt(ip_address="test_ip_address", user_agent="test_user_agent", email="test_email", auth_method=RadarStandaloneAssessRequestAuthMethod("Password"), action=RadarStandaloneAssessRequestAction("login")) def test_create_attempt_not_found(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=404, json={"message": "Not found"}) with pytest.raises(NotFoundError): - workos.radar.create_attempt( - ip_address="test_ip_address", - user_agent="test_user_agent", - email="test_email", - auth_method=RadarStandaloneAssessRequestAuthMethod("Password"), - action=RadarStandaloneAssessRequestAction("login"), - ) + workos.radar.create_attempt(ip_address="test_ip_address", user_agent="test_user_agent", email="test_email", auth_method=RadarStandaloneAssessRequestAuthMethod("Password"), action=RadarStandaloneAssessRequestAction("login")) finally: workos.close() def test_create_attempt_rate_limited(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: - httpx_mock.add_response( - status_code=429, - headers={"Retry-After": "0"}, - json={"message": "Slow down"}, - ) + httpx_mock.add_response(status_code=429, headers={"Retry-After": "0"}, json={"message": "Slow down"}) with pytest.raises(RateLimitExceededError): - workos.radar.create_attempt( - ip_address="test_ip_address", - user_agent="test_user_agent", - email="test_email", - auth_method=RadarStandaloneAssessRequestAuthMethod("Password"), - action=RadarStandaloneAssessRequestAction("login"), - ) + workos.radar.create_attempt(ip_address="test_ip_address", user_agent="test_user_agent", email="test_email", auth_method=RadarStandaloneAssessRequestAuthMethod("Password"), action=RadarStandaloneAssessRequestAction("login")) finally: workos.close() def test_create_attempt_server_error(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=500, json={"message": "Server error"}) with pytest.raises(ServerError): - workos.radar.create_attempt( - ip_address="test_ip_address", - user_agent="test_user_agent", - email="test_email", - auth_method=RadarStandaloneAssessRequestAuthMethod("Password"), - action=RadarStandaloneAssessRequestAction("login"), - ) + workos.radar.create_attempt(ip_address="test_ip_address", user_agent="test_user_agent", email="test_email", auth_method=RadarStandaloneAssessRequestAuthMethod("Password"), action=RadarStandaloneAssessRequestAction("login")) finally: workos.close() def test_create_attempt_bad_request(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) with pytest.raises(BadRequestError): - workos.radar.create_attempt( - ip_address="test_ip_address", - user_agent="test_user_agent", - email="test_email", - auth_method=RadarStandaloneAssessRequestAuthMethod("Password"), - action=RadarStandaloneAssessRequestAction("login"), - ) + workos.radar.create_attempt(ip_address="test_ip_address", user_agent="test_user_agent", email="test_email", auth_method=RadarStandaloneAssessRequestAuthMethod("Password"), action=RadarStandaloneAssessRequestAction("login")) finally: workos.close() def test_create_attempt_unprocessable(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) with pytest.raises(UnprocessableEntityError): - workos.radar.create_attempt( - ip_address="test_ip_address", - user_agent="test_user_agent", - email="test_email", - auth_method=RadarStandaloneAssessRequestAuthMethod("Password"), - action=RadarStandaloneAssessRequestAction("login"), - ) + workos.radar.create_attempt(ip_address="test_ip_address", user_agent="test_user_agent", email="test_email", auth_method=RadarStandaloneAssessRequestAuthMethod("Password"), action=RadarStandaloneAssessRequestAction("login")) finally: workos.close() class TestAsyncRadar: + @pytest.mark.asyncio async def test_create_attempt(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("radar_standalone_response.json")) - result = await async_workos.radar.create_attempt( - ip_address="test_ip_address", - user_agent="test_user_agent", - email="test_email", - auth_method=RadarStandaloneAssessRequestAuthMethod("Password"), - action=RadarStandaloneAssessRequestAction("login"), - ) + result = await async_workos.radar.create_attempt(ip_address="test_ip_address", user_agent="test_user_agent", email="test_email", auth_method=RadarStandaloneAssessRequestAuthMethod("Password"), action=RadarStandaloneAssessRequestAction("login")) assert isinstance(result, RadarStandaloneResponse) assert result.verdict == "block" assert result.reason == "Detected enabled Radar control" @@ -226,12 +142,8 @@ async def test_update_attempt(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_add_list_entry(self, async_workos, httpx_mock): - httpx_mock.add_response( - json=load_fixture("radar_list_entry_already_present_response.json") - ) - result = await async_workos.radar.add_list_entry( - "test_type", "test_action", entry="test_entry" - ) + httpx_mock.add_response(json=load_fixture("radar_list_entry_already_present_response.json")) + result = await async_workos.radar.add_list_entry("test_type", "test_action", entry="test_entry") assert isinstance(result, RadarListEntryAlreadyPresentResponse) assert result.message == "Entry already present in list" request = httpx_mock.get_request() @@ -241,9 +153,7 @@ async def test_add_list_entry(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_remove_list_entry(self, async_workos, httpx_mock): httpx_mock.add_response(status_code=204) - result = await async_workos.radar.remove_list_entry( - "test_type", "test_action", entry="test_entry" - ) + result = await async_workos.radar.remove_list_entry("test_type", "test_action", entry="test_entry") assert result is None request = httpx_mock.get_request() assert request.method == "DELETE" @@ -252,14 +162,7 @@ async def test_remove_list_entry(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_create_attempt_with_request_options(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("radar_standalone_response.json")) - await async_workos.radar.create_attempt( - ip_address="test_ip_address", - user_agent="test_user_agent", - email="test_email", - auth_method=RadarStandaloneAssessRequestAuthMethod("Password"), - action=RadarStandaloneAssessRequestAction("login"), - request_options={"extra_headers": {"X-Custom": "value"}}, - ) + await async_workos.radar.create_attempt(ip_address="test_ip_address", user_agent="test_user_agent", email="test_email", auth_method=RadarStandaloneAssessRequestAuthMethod("Password"), action=RadarStandaloneAssessRequestAction("login"), request_options={"extra_headers": {"X-Custom": "value"}}) request = httpx_mock.get_request() assert request.headers["X-Custom"] == "value" @@ -267,104 +170,54 @@ async def test_create_attempt_with_request_options(self, async_workos, httpx_moc async def test_create_attempt_unauthorized(self, async_workos, httpx_mock): httpx_mock.add_response(status_code=401, json={"message": "Unauthorized"}) with pytest.raises(AuthenticationError): - await async_workos.radar.create_attempt( - ip_address="test_ip_address", - user_agent="test_user_agent", - email="test_email", - auth_method=RadarStandaloneAssessRequestAuthMethod("Password"), - action=RadarStandaloneAssessRequestAction("login"), - ) + await async_workos.radar.create_attempt(ip_address="test_ip_address", user_agent="test_user_agent", email="test_email", auth_method=RadarStandaloneAssessRequestAuthMethod("Password"), action=RadarStandaloneAssessRequestAction("login")) @pytest.mark.asyncio async def test_create_attempt_not_found(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=404, json={"message": "Not found"}) with pytest.raises(NotFoundError): - await workos.radar.create_attempt( - ip_address="test_ip_address", - user_agent="test_user_agent", - email="test_email", - auth_method=RadarStandaloneAssessRequestAuthMethod("Password"), - action=RadarStandaloneAssessRequestAction("login"), - ) + await workos.radar.create_attempt(ip_address="test_ip_address", user_agent="test_user_agent", email="test_email", auth_method=RadarStandaloneAssessRequestAuthMethod("Password"), action=RadarStandaloneAssessRequestAction("login")) finally: await workos.close() @pytest.mark.asyncio async def test_create_attempt_rate_limited(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: - httpx_mock.add_response( - status_code=429, - headers={"Retry-After": "0"}, - json={"message": "Slow down"}, - ) + httpx_mock.add_response(status_code=429, headers={"Retry-After": "0"}, json={"message": "Slow down"}) with pytest.raises(RateLimitExceededError): - await workos.radar.create_attempt( - ip_address="test_ip_address", - user_agent="test_user_agent", - email="test_email", - auth_method=RadarStandaloneAssessRequestAuthMethod("Password"), - action=RadarStandaloneAssessRequestAction("login"), - ) + await workos.radar.create_attempt(ip_address="test_ip_address", user_agent="test_user_agent", email="test_email", auth_method=RadarStandaloneAssessRequestAuthMethod("Password"), action=RadarStandaloneAssessRequestAction("login")) finally: await workos.close() @pytest.mark.asyncio async def test_create_attempt_server_error(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=500, json={"message": "Server error"}) with pytest.raises(ServerError): - await workos.radar.create_attempt( - ip_address="test_ip_address", - user_agent="test_user_agent", - email="test_email", - auth_method=RadarStandaloneAssessRequestAuthMethod("Password"), - action=RadarStandaloneAssessRequestAction("login"), - ) + await workos.radar.create_attempt(ip_address="test_ip_address", user_agent="test_user_agent", email="test_email", auth_method=RadarStandaloneAssessRequestAuthMethod("Password"), action=RadarStandaloneAssessRequestAction("login")) finally: await workos.close() @pytest.mark.asyncio async def test_create_attempt_bad_request(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) with pytest.raises(BadRequestError): - await workos.radar.create_attempt( - ip_address="test_ip_address", - user_agent="test_user_agent", - email="test_email", - auth_method=RadarStandaloneAssessRequestAuthMethod("Password"), - action=RadarStandaloneAssessRequestAction("login"), - ) + await workos.radar.create_attempt(ip_address="test_ip_address", user_agent="test_user_agent", email="test_email", auth_method=RadarStandaloneAssessRequestAuthMethod("Password"), action=RadarStandaloneAssessRequestAction("login")) finally: await workos.close() @pytest.mark.asyncio async def test_create_attempt_unprocessable(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) with pytest.raises(UnprocessableEntityError): - await workos.radar.create_attempt( - ip_address="test_ip_address", - user_agent="test_user_agent", - email="test_email", - auth_method=RadarStandaloneAssessRequestAuthMethod("Password"), - action=RadarStandaloneAssessRequestAction("login"), - ) + await workos.radar.create_attempt(ip_address="test_ip_address", user_agent="test_user_agent", email="test_email", auth_method=RadarStandaloneAssessRequestAuthMethod("Password"), action=RadarStandaloneAssessRequestAction("login")) finally: await workos.close() diff --git a/tests/test_sso.py b/tests/test_sso.py index 4f6903d7..4c069108 100644 --- a/tests/test_sso.py +++ b/tests/test_sso.py @@ -6,26 +6,13 @@ from workos import WorkOSClient, AsyncWorkOSClient from tests.generated_helpers import load_fixture -from workos.sso.models import ( - Connection, - Profile, - SSOLogoutAuthorizeResponse, - SSOTokenResponse, - ConnectionsConnectionType, - ConnectionsOrder, -) +from workos.sso.models import Connection, Profile, SSOAuthorizeUrlResponse, SSOLogoutAuthorizeResponse, SSOTokenResponse, ConnectionsConnectionType, ConnectionsOrder, SSOProvider from workos._pagination import AsyncPage, SyncPage -from workos._errors import ( - AuthenticationError, - BadRequestError, - NotFoundError, - RateLimitExceededError, - ServerError, - UnprocessableEntityError, -) +from workos._errors import AuthenticationError, BadRequestError, NotFoundError, RateLimitExceededError, ServerError, UnprocessableEntityError class TestSSO: + def test_list_connections(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("list_connection.json"), @@ -43,16 +30,7 @@ def test_list_connections_empty_page(self, workos, httpx_mock): def test_list_connections_encodes_query_params(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - workos.sso.list_connections( - limit=10, - before="cursor before", - after="cursor/after", - order=ConnectionsOrder("normal"), - connection_type=ConnectionsConnectionType("ADFSSAML"), - domain="value domain/test", - organization_id="value organization_id/test", - search="value search/test", - ) + workos.sso.list_connections(limit=10, before="cursor before", after="cursor/after", order=ConnectionsOrder("normal"), connection_type=ConnectionsConnectionType("ADFSSAML"), domain="value domain/test", organization_id="value organization_id/test", search="value search/test") request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -99,14 +77,8 @@ def test_authorize_logout(self, workos, httpx_mock): ) result = workos.sso.authorize_logout(profile_id="test_profile_id") assert isinstance(result, SSOLogoutAuthorizeResponse) - assert ( - result.logout_url - == "https://auth.workos.com/sso/logout?token=eyJhbGciOiJSUzI1NiJ9" - ) - assert ( - result.logout_token - == "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwcm9maWxlX2lkIjoicHJvZl8wMUdXUTFHMEgyRk02QVNFRjBIUzEzSENXOS0zMDRrZzAzZyIsImV4cCI6IjE1MTYyMzkwMjIifQ.Wru9Qlnf5DpohtGCKhZU4cVOd3zpiu7QQ-XEX--5A_4" - ) + assert result.logout_url == "https://auth.workos.com/sso/logout?token=eyJhbGciOiJSUzI1NiJ9" + assert result.logout_token == "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwcm9maWxlX2lkIjoicHJvZl8wMUdXUTFHMEgyRk02QVNFRjBIUzEzSENXOS0zMDRrZzAzZyIsImV4cCI6IjE1MTYyMzkwMjIifQ.Wru9Qlnf5DpohtGCKhZU4cVOd3zpiu7QQ-XEX--5A_4" request = httpx_mock.get_request() assert request.method == "POST" assert request.url.path.endswith("/sso/logout/authorize") @@ -141,9 +113,7 @@ def test_get_profile_and_token(self, workos, httpx_mock): def test_list_connections_with_request_options(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - workos.sso.list_connections( - request_options={"extra_headers": {"X-Custom": "value"}} - ) + workos.sso.list_connections(request_options={"extra_headers": {"X-Custom": "value"}}) request = httpx_mock.get_request() assert request.headers["X-Custom"] == "value" @@ -156,9 +126,7 @@ def test_list_connections_unauthorized(self, workos, httpx_mock): workos.sso.list_connections() def test_list_connections_not_found(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=404, json={"message": "Not found"}) with pytest.raises(NotFoundError): @@ -167,24 +135,16 @@ def test_list_connections_not_found(self, httpx_mock): workos.close() def test_list_connections_rate_limited(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: - httpx_mock.add_response( - status_code=429, - headers={"Retry-After": "0"}, - json={"message": "Slow down"}, - ) + httpx_mock.add_response(status_code=429, headers={"Retry-After": "0"}, json={"message": "Slow down"}) with pytest.raises(RateLimitExceededError): workos.sso.list_connections() finally: workos.close() def test_list_connections_server_error(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=500, json={"message": "Server error"}) with pytest.raises(ServerError): @@ -193,9 +153,7 @@ def test_list_connections_server_error(self, httpx_mock): workos.close() def test_list_connections_bad_request(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) with pytest.raises(BadRequestError): @@ -204,9 +162,7 @@ def test_list_connections_bad_request(self, httpx_mock): workos.close() def test_list_connections_unprocessable(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) with pytest.raises(UnprocessableEntityError): @@ -216,6 +172,7 @@ def test_list_connections_unprocessable(self, httpx_mock): class TestAsyncSSO: + @pytest.mark.asyncio async def test_list_connections(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("list_connection.json")) @@ -232,20 +189,9 @@ async def test_list_connections_empty_page(self, async_workos, httpx_mock): assert page.data == [] @pytest.mark.asyncio - async def test_list_connections_encodes_query_params( - self, async_workos, httpx_mock - ): + async def test_list_connections_encodes_query_params(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - await async_workos.sso.list_connections( - limit=10, - before="cursor before", - after="cursor/after", - order=ConnectionsOrder("normal"), - connection_type=ConnectionsConnectionType("ADFSSAML"), - domain="value domain/test", - organization_id="value organization_id/test", - search="value search/test", - ) + await async_workos.sso.list_connections(limit=10, before="cursor before", after="cursor/after", order=ConnectionsOrder("normal"), connection_type=ConnectionsConnectionType("ADFSSAML"), domain="value domain/test", organization_id="value organization_id/test", search="value search/test") request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -277,9 +223,7 @@ async def test_delete_connection(self, async_workos, httpx_mock): assert request.url.path.endswith("/connections/test_id") def test_get_authorization_url(self, async_workos): - result = async_workos.sso.get_authorization_url( - redirect_uri="test_redirect_uri" - ) + result = async_workos.sso.get_authorization_url(redirect_uri="test_redirect_uri") assert isinstance(result, str) assert result.startswith("http") @@ -293,14 +237,8 @@ async def test_authorize_logout(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("sso_logout_authorize_response.json")) result = await async_workos.sso.authorize_logout(profile_id="test_profile_id") assert isinstance(result, SSOLogoutAuthorizeResponse) - assert ( - result.logout_url - == "https://auth.workos.com/sso/logout?token=eyJhbGciOiJSUzI1NiJ9" - ) - assert ( - result.logout_token - == "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwcm9maWxlX2lkIjoicHJvZl8wMUdXUTFHMEgyRk02QVNFRjBIUzEzSENXOS0zMDRrZzAzZyIsImV4cCI6IjE1MTYyMzkwMjIifQ.Wru9Qlnf5DpohtGCKhZU4cVOd3zpiu7QQ-XEX--5A_4" - ) + assert result.logout_url == "https://auth.workos.com/sso/logout?token=eyJhbGciOiJSUzI1NiJ9" + assert result.logout_token == "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwcm9maWxlX2lkIjoicHJvZl8wMUdXUTFHMEgyRk02QVNFRjBIUzEzSENXOS0zMDRrZzAzZyIsImV4cCI6IjE1MTYyMzkwMjIifQ.Wru9Qlnf5DpohtGCKhZU4cVOd3zpiu7QQ-XEX--5A_4" request = httpx_mock.get_request() assert request.method == "POST" assert request.url.path.endswith("/sso/logout/authorize") @@ -328,13 +266,9 @@ async def test_get_profile_and_token(self, async_workos, httpx_mock): assert request.url.path.endswith("/sso/token") @pytest.mark.asyncio - async def test_list_connections_with_request_options( - self, async_workos, httpx_mock - ): + async def test_list_connections_with_request_options(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - await async_workos.sso.list_connections( - request_options={"extra_headers": {"X-Custom": "value"}} - ) + await async_workos.sso.list_connections(request_options={"extra_headers": {"X-Custom": "value"}}) request = httpx_mock.get_request() assert request.headers["X-Custom"] == "value" @@ -346,9 +280,7 @@ async def test_list_connections_unauthorized(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_list_connections_not_found(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=404, json={"message": "Not found"}) with pytest.raises(NotFoundError): @@ -358,15 +290,9 @@ async def test_list_connections_not_found(self, httpx_mock): @pytest.mark.asyncio async def test_list_connections_rate_limited(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: - httpx_mock.add_response( - status_code=429, - headers={"Retry-After": "0"}, - json={"message": "Slow down"}, - ) + httpx_mock.add_response(status_code=429, headers={"Retry-After": "0"}, json={"message": "Slow down"}) with pytest.raises(RateLimitExceededError): await workos.sso.list_connections() finally: @@ -374,9 +300,7 @@ async def test_list_connections_rate_limited(self, httpx_mock): @pytest.mark.asyncio async def test_list_connections_server_error(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=500, json={"message": "Server error"}) with pytest.raises(ServerError): @@ -386,9 +310,7 @@ async def test_list_connections_server_error(self, httpx_mock): @pytest.mark.asyncio async def test_list_connections_bad_request(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) with pytest.raises(BadRequestError): @@ -398,9 +320,7 @@ async def test_list_connections_bad_request(self, httpx_mock): @pytest.mark.asyncio async def test_list_connections_unprocessable(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) with pytest.raises(UnprocessableEntityError): diff --git a/tests/test_user_management.py b/tests/test_user_management.py index beb16bb5..44e8af29 100644 --- a/tests/test_user_management.py +++ b/tests/test_user_management.py @@ -6,47 +6,15 @@ from workos import WorkOSClient, AsyncWorkOSClient from tests.generated_helpers import load_fixture -from workos.user_management.models import ( - AuthenticateResponse, - AuthorizedConnectApplicationListData, - CORSOriginResponse, - DeviceAuthorizationResponse, - EmailChange, - EmailChangeConfirmation, - EmailVerification, - Invitation, - JWTTemplateResponse, - JwksResponse, - MagicAuth, - OrganizationMembership, - PasswordReset, - RedirectUri, - ResetPasswordResponse, - SendVerificationEmailResponse, - User, - UserIdentitiesGetItem, - UserInvite, - UserOrganizationMembership, - UserSessionsListItem, - VerifyEmailResponse, - UserManagementInvitationsOrder, - UserManagementOrganizationMembershipOrder, - UserManagementUsersAuthorizedApplicationsOrder, - UserManagementUsersOrder, -) +from workos.common.models import CreateUserInviteOptionsLocale, ResendUserInviteOptionsLocale +from workos.user_management.models import AuthenticateResponse, AuthorizedConnectApplicationListData, CORSOriginResponse, DeviceAuthorizationResponse, EmailChange, EmailChangeConfirmation, EmailVerification, Invitation, JWTTemplateResponse, JwksResponse, MagicAuth, OrganizationMembership, PasswordReset, RedirectUri, ResetPasswordResponse, SendVerificationEmailResponse, User, UserIdentitiesGetItem, UserInvite, UserOrganizationMembership, UserSessionsListItem, VerifyEmailResponse, UserManagementAuthenticationProvider, UserManagementAuthenticationScreenHint, UserManagementInvitationsOrder, UserManagementOrganizationMembershipOrder, UserManagementUsersAuthorizedApplicationsOrder, UserManagementUsersOrder from workos._pagination import AsyncPage, SyncPage -from workos._errors import ( - AuthenticationError, - BadRequestError, - NotFoundError, - RateLimitExceededError, - ServerError, - UnprocessableEntityError, -) -from workos.user_management._resource import PasswordPlaintext, RoleSingle +from workos._errors import AuthenticationError, BadRequestError, NotFoundError, RateLimitExceededError, ServerError, UnprocessableEntityError +from workos.user_management._resource import PasswordPlaintext, PasswordHashed, RoleSingle, RoleMultiple class TestUserManagement: + def test_get_jwks(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("jwks_response.json"), @@ -61,9 +29,7 @@ def test_create_authenticate(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("authenticate_response.json"), ) - result = workos.user_management.create_authenticate( - body=load_fixture("authorization_code_session_authenticate_request.json") - ) + result = workos.user_management.create_authenticate(body=load_fixture("authorization_code_session_authenticate_request.json")) assert isinstance(result, AuthenticateResponse) assert result.organization_id == "org_01H945H0YD4F97JN9MATX7BYAG" assert result.authkit_authorization_code == "authkit_authz_code_abc123" @@ -72,9 +38,7 @@ def test_create_authenticate(self, workos, httpx_mock): assert request.url.path.endswith("/user_management/authenticate") def test_get_authorization_url(self, workos): - result = workos.user_management.get_authorization_url( - redirect_uri="test_redirect_uri" - ) + result = workos.user_management.get_authorization_url(redirect_uri="test_redirect_uri") assert isinstance(result, str) assert result.startswith("http") @@ -84,10 +48,7 @@ def test_create_device(self, workos, httpx_mock): ) result = workos.user_management.create_device(client_id="test_client_id") assert isinstance(result, DeviceAuthorizationResponse) - assert ( - result.device_code - == "CVE2wOfIFK4vhmiDBntpX9s8KT2f0qngpWYL0LGy9HxYgBRXUKIUkZB9BgIFho5h" - ) + assert result.device_code == "CVE2wOfIFK4vhmiDBntpX9s8KT2f0qngpWYL0LGy9HxYgBRXUKIUkZB9BgIFho5h" assert result.user_code == "BCDF-GHJK" request = httpx_mock.get_request() assert request.method == "POST" @@ -151,9 +112,7 @@ def test_confirm_password_reset(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("reset_password_response.json"), ) - result = workos.user_management.confirm_password_reset( - token="test_token", new_password="test_new_password" - ) + result = workos.user_management.confirm_password_reset(token="test_token", new_password="test_new_password") assert isinstance(result, ResetPasswordResponse) request = httpx_mock.get_request() assert request.method == "POST" @@ -191,15 +150,7 @@ def test_list_users_empty_page(self, workos, httpx_mock): def test_list_users_encodes_query_params(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - workos.user_management.list_users( - limit=10, - before="cursor before", - after="cursor/after", - order=UserManagementUsersOrder("normal"), - organization="value organization/test", - organization_id="value organization_id/test", - email="value email/test", - ) + workos.user_management.list_users(limit=10, before="cursor before", after="cursor/after", order=UserManagementUsersOrder("normal"), organization="value organization/test", organization_id="value organization_id/test", email="value email/test") request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -213,9 +164,7 @@ def test_create_user(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("user.json"), ) - result = workos.user_management.create_user( - email="test_email", password=PasswordPlaintext(password="test_value") - ) + result = workos.user_management.create_user(email="test_email", password=PasswordPlaintext(password="test_value")) assert isinstance(result, User) assert result.object == "user" assert result.id == "user_01E4ZCR3C56J083X43JQXF3JK5" @@ -235,9 +184,7 @@ def test_get_user_by_external_id(self, workos, httpx_mock): assert result.id == "user_01E4ZCR3C56J083X43JQXF3JK5" request = httpx_mock.get_request() assert request.method == "GET" - assert request.url.path.endswith( - "/user_management/users/external_id/test_external_id" - ) + assert request.url.path.endswith("/user_management/users/external_id/test_external_id") def test_get_user(self, workos, httpx_mock): httpx_mock.add_response( @@ -255,9 +202,7 @@ def test_update_user(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("user.json"), ) - result = workos.user_management.update_user( - "test_id", password=PasswordPlaintext(password="test_value") - ) + result = workos.user_management.update_user("test_id", password=PasswordPlaintext(password="test_value")) assert isinstance(result, User) assert result.object == "user" assert result.id == "user_01E4ZCR3C56J083X43JQXF3JK5" @@ -277,16 +222,12 @@ def test_confirm_email_change(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("email_change_confirmation.json"), ) - result = workos.user_management.confirm_email_change( - "test_id", code="test_code" - ) + result = workos.user_management.confirm_email_change("test_id", code="test_code") assert isinstance(result, EmailChangeConfirmation) assert result.object == "email_change_confirmation" request = httpx_mock.get_request() assert request.method == "POST" - assert request.url.path.endswith( - "/user_management/users/test_id/email_change/confirm" - ) + assert request.url.path.endswith("/user_management/users/test_id/email_change/confirm") body = json.loads(request.content) assert body["code"] == "test_code" @@ -294,17 +235,13 @@ def test_send_email_change(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("email_change.json"), ) - result = workos.user_management.send_email_change( - "test_id", new_email="test_new_email" - ) + result = workos.user_management.send_email_change("test_id", new_email="test_new_email") assert isinstance(result, EmailChange) assert result.object == "email_change" assert result.new_email == "new.email@example.com" request = httpx_mock.get_request() assert request.method == "POST" - assert request.url.path.endswith( - "/user_management/users/test_id/email_change/send" - ) + assert request.url.path.endswith("/user_management/users/test_id/email_change/send") body = json.loads(request.content) assert body["new_email"] == "test_new_email" @@ -316,9 +253,7 @@ def test_verify_email(self, workos, httpx_mock): assert isinstance(result, VerifyEmailResponse) request = httpx_mock.get_request() assert request.method == "POST" - assert request.url.path.endswith( - "/user_management/users/test_id/email_verification/confirm" - ) + assert request.url.path.endswith("/user_management/users/test_id/email_verification/confirm") body = json.loads(request.content) assert body["code"] == "test_code" @@ -330,9 +265,7 @@ def test_send_verification_email(self, workos, httpx_mock): assert isinstance(result, SendVerificationEmailResponse) request = httpx_mock.get_request() assert request.method == "POST" - assert request.url.path.endswith( - "/user_management/users/test_id/email_verification/send" - ) + assert request.url.path.endswith("/user_management/users/test_id/email_verification/send") def test_get_user_identities(self, workos, httpx_mock): httpx_mock.add_response(json=[load_fixture("user_identities_get_item.json")]) @@ -358,13 +291,7 @@ def test_list_sessions_empty_page(self, workos, httpx_mock): def test_list_sessions_encodes_query_params(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - workos.user_management.list_sessions( - "test_id", - limit=10, - before="cursor before", - after="cursor/after", - order=UserManagementUsersOrder("normal"), - ) + workos.user_management.list_sessions("test_id", limit=10, before="cursor before", after="cursor/after", order=UserManagementUsersOrder("normal")) request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -388,14 +315,7 @@ def test_list_invitations_empty_page(self, workos, httpx_mock): def test_list_invitations_encodes_query_params(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - workos.user_management.list_invitations( - limit=10, - before="cursor before", - after="cursor/after", - order=UserManagementInvitationsOrder("normal"), - organization_id="value organization_id/test", - email="value email/test", - ) + workos.user_management.list_invitations(limit=10, before="cursor before", after="cursor/after", order=UserManagementInvitationsOrder("normal"), organization_id="value organization_id/test", email="value email/test") request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -428,9 +348,7 @@ def test_find_invitation_by_token(self, workos, httpx_mock): assert result.id == "invitation_01E4ZCR3C56J083X43JQXF3JK5" request = httpx_mock.get_request() assert request.method == "GET" - assert request.url.path.endswith( - "/user_management/invitations/by_token/test_token" - ) + assert request.url.path.endswith("/user_management/invitations/by_token/test_token") def test_get_invitation(self, workos, httpx_mock): httpx_mock.add_response( @@ -535,19 +453,9 @@ def test_list_organization_memberships_empty_page(self, workos, httpx_mock): assert isinstance(page, SyncPage) assert page.data == [] - def test_list_organization_memberships_encodes_query_params( - self, workos, httpx_mock - ): + def test_list_organization_memberships_encodes_query_params(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - workos.user_management.list_organization_memberships( - limit=10, - before="cursor before", - after="cursor/after", - order=UserManagementOrganizationMembershipOrder("normal"), - organization_id="value organization_id/test", - statuses=["val1", "val2"], - user_id="value user_id/test", - ) + workos.user_management.list_organization_memberships(limit=10, before="cursor before", after="cursor/after", order=UserManagementOrganizationMembershipOrder("normal"), organization_id="value organization_id/test", statuses=["val1", "val2"], user_id="value user_id/test") request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -561,11 +469,7 @@ def test_create_organization_membership(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("organization_membership.json"), ) - result = workos.user_management.create_organization_membership( - user_id="test_user_id", - organization_id="test_organization_id", - role=RoleSingle(role_slug="test_value"), - ) + result = workos.user_management.create_organization_membership(user_id="test_user_id", organization_id="test_organization_id", role=RoleSingle(role_slug="test_value")) assert isinstance(result, OrganizationMembership) assert result.object == "organization_membership" assert result.id == "om_01HXYZ123456789ABCDEFGHIJ" @@ -586,25 +490,19 @@ def test_get_organization_membership(self, workos, httpx_mock): assert result.id == "om_01HXYZ123456789ABCDEFGHIJ" request = httpx_mock.get_request() assert request.method == "GET" - assert request.url.path.endswith( - "/user_management/organization_memberships/test_id" - ) + assert request.url.path.endswith("/user_management/organization_memberships/test_id") def test_update_organization_membership(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("user_organization_membership.json"), ) - result = workos.user_management.update_organization_membership( - "test_id", role=RoleSingle(role_slug="test_value") - ) + result = workos.user_management.update_organization_membership("test_id", role=RoleSingle(role_slug="test_value")) assert isinstance(result, UserOrganizationMembership) assert result.object == "organization_membership" assert result.id == "om_01HXYZ123456789ABCDEFGHIJ" request = httpx_mock.get_request() assert request.method == "PUT" - assert request.url.path.endswith( - "/user_management/organization_memberships/test_id" - ) + assert request.url.path.endswith("/user_management/organization_memberships/test_id") def test_delete_organization_membership(self, workos, httpx_mock): httpx_mock.add_response(status_code=204) @@ -612,9 +510,7 @@ def test_delete_organization_membership(self, workos, httpx_mock): assert result is None request = httpx_mock.get_request() assert request.method == "DELETE" - assert request.url.path.endswith( - "/user_management/organization_memberships/test_id" - ) + assert request.url.path.endswith("/user_management/organization_memberships/test_id") def test_deactivate_organization_membership(self, workos, httpx_mock): httpx_mock.add_response( @@ -626,9 +522,7 @@ def test_deactivate_organization_membership(self, workos, httpx_mock): assert result.id == "om_01HXYZ123456789ABCDEFGHIJ" request = httpx_mock.get_request() assert request.method == "PUT" - assert request.url.path.endswith( - "/user_management/organization_memberships/test_id/deactivate" - ) + assert request.url.path.endswith("/user_management/organization_memberships/test_id/deactivate") def test_reactivate_organization_membership(self, workos, httpx_mock): httpx_mock.add_response( @@ -640,9 +534,7 @@ def test_reactivate_organization_membership(self, workos, httpx_mock): assert result.id == "om_01HXYZ123456789ABCDEFGHIJ" request = httpx_mock.get_request() assert request.method == "PUT" - assert request.url.path.endswith( - "/user_management/organization_memberships/test_id/reactivate" - ) + assert request.url.path.endswith("/user_management/organization_memberships/test_id/reactivate") def test_create_redirect_uri(self, workos, httpx_mock): httpx_mock.add_response( @@ -673,17 +565,9 @@ def test_list_user_authorized_applications_empty_page(self, workos, httpx_mock): assert isinstance(page, SyncPage) assert page.data == [] - def test_list_user_authorized_applications_encodes_query_params( - self, workos, httpx_mock - ): + def test_list_user_authorized_applications_encodes_query_params(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - workos.user_management.list_user_authorized_applications( - "test_user_id", - limit=10, - before="cursor before", - after="cursor/after", - order=UserManagementUsersAuthorizedApplicationsOrder("normal"), - ) + workos.user_management.list_user_authorized_applications("test_user_id", limit=10, before="cursor before", after="cursor/after", order=UserManagementUsersAuthorizedApplicationsOrder("normal")) request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -692,21 +576,15 @@ def test_list_user_authorized_applications_encodes_query_params( def test_delete_user_authorized_application(self, workos, httpx_mock): httpx_mock.add_response(status_code=204) - result = workos.user_management.delete_user_authorized_application( - "test_application_id", "test_user_id" - ) + result = workos.user_management.delete_user_authorized_application("test_application_id", "test_user_id") assert result is None request = httpx_mock.get_request() assert request.method == "DELETE" - assert request.url.path.endswith( - "/user_management/users/test_user_id/authorized_applications/test_application_id" - ) + assert request.url.path.endswith("/user_management/users/test_user_id/authorized_applications/test_application_id") def test_authenticate_with_password(self, workos, httpx_mock): httpx_mock.add_response(json=load_fixture("authenticate_response.json")) - result = workos.user_management.authenticate_with_password( - email="test_email", password="test_password" - ) + result = workos.user_management.authenticate_with_password(email="test_email", password="test_password") assert isinstance(result, AuthenticateResponse) request = httpx_mock.get_request() assert request.method == "POST" @@ -724,9 +602,7 @@ def test_authenticate_with_code(self, workos, httpx_mock): def test_authenticate_with_refresh_token(self, workos, httpx_mock): httpx_mock.add_response(json=load_fixture("authenticate_response.json")) - result = workos.user_management.authenticate_with_refresh_token( - refresh_token="test_refresh_token" - ) + result = workos.user_management.authenticate_with_refresh_token(refresh_token="test_refresh_token") assert isinstance(result, AuthenticateResponse) request = httpx_mock.get_request() assert request.method == "POST" @@ -735,9 +611,7 @@ def test_authenticate_with_refresh_token(self, workos, httpx_mock): def test_authenticate_with_magic_auth(self, workos, httpx_mock): httpx_mock.add_response(json=load_fixture("authenticate_response.json")) - result = workos.user_management.authenticate_with_magic_auth( - code="test_value", email="test_value" - ) + result = workos.user_management.authenticate_with_magic_auth(code="test_value", email="test_value") assert isinstance(result, AuthenticateResponse) request = httpx_mock.get_request() assert request.method == "POST" @@ -746,24 +620,16 @@ def test_authenticate_with_magic_auth(self, workos, httpx_mock): def test_authenticate_with_email_verification(self, workos, httpx_mock): httpx_mock.add_response(json=load_fixture("authenticate_response.json")) - result = workos.user_management.authenticate_with_email_verification( - code="test_value", pending_authentication_token="test_value" - ) + result = workos.user_management.authenticate_with_email_verification(code="test_value", pending_authentication_token="test_value") assert isinstance(result, AuthenticateResponse) request = httpx_mock.get_request() assert request.method == "POST" body = json.loads(request.content) - assert ( - body["grant_type"] == "urn:workos:oauth:grant-type:email-verification:code" - ) + assert body["grant_type"] == "urn:workos:oauth:grant-type:email-verification:code" def test_authenticate_with_totp(self, workos, httpx_mock): httpx_mock.add_response(json=load_fixture("authenticate_response.json")) - result = workos.user_management.authenticate_with_totp( - code="test_value", - pending_authentication_token="test_value", - authentication_challenge_id="test_value", - ) + result = workos.user_management.authenticate_with_totp(code="test_value", pending_authentication_token="test_value", authentication_challenge_id="test_value") assert isinstance(result, AuthenticateResponse) request = httpx_mock.get_request() assert request.method == "POST" @@ -772,22 +638,16 @@ def test_authenticate_with_totp(self, workos, httpx_mock): def test_authenticate_with_organization_selection(self, workos, httpx_mock): httpx_mock.add_response(json=load_fixture("authenticate_response.json")) - result = workos.user_management.authenticate_with_organization_selection( - pending_authentication_token="test_value", organization_id="test_value" - ) + result = workos.user_management.authenticate_with_organization_selection(pending_authentication_token="test_value", organization_id="test_value") assert isinstance(result, AuthenticateResponse) request = httpx_mock.get_request() assert request.method == "POST" body = json.loads(request.content) - assert ( - body["grant_type"] == "urn:workos:oauth:grant-type:organization-selection" - ) + assert body["grant_type"] == "urn:workos:oauth:grant-type:organization-selection" def test_authenticate_with_device_code(self, workos, httpx_mock): httpx_mock.add_response(json=load_fixture("authenticate_response.json")) - result = workos.user_management.authenticate_with_device_code( - device_code="test_value" - ) + result = workos.user_management.authenticate_with_device_code(device_code="test_value") assert isinstance(result, AuthenticateResponse) request = httpx_mock.get_request() assert request.method == "POST" @@ -796,9 +656,7 @@ def test_authenticate_with_device_code(self, workos, httpx_mock): def test_get_jwks_with_request_options(self, workos, httpx_mock): httpx_mock.add_response(json=load_fixture("jwks_response.json")) - workos.user_management.get_jwks( - "test_clientId", request_options={"extra_headers": {"X-Custom": "value"}} - ) + workos.user_management.get_jwks("test_clientId", request_options={"extra_headers": {"X-Custom": "value"}}) request = httpx_mock.get_request() assert request.headers["X-Custom"] == "value" @@ -811,9 +669,7 @@ def test_get_jwks_unauthorized(self, workos, httpx_mock): workos.user_management.get_jwks("test_clientId") def test_get_jwks_not_found(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=404, json={"message": "Not found"}) with pytest.raises(NotFoundError): @@ -822,24 +678,16 @@ def test_get_jwks_not_found(self, httpx_mock): workos.close() def test_get_jwks_rate_limited(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: - httpx_mock.add_response( - status_code=429, - headers={"Retry-After": "0"}, - json={"message": "Slow down"}, - ) + httpx_mock.add_response(status_code=429, headers={"Retry-After": "0"}, json={"message": "Slow down"}) with pytest.raises(RateLimitExceededError): workos.user_management.get_jwks("test_clientId") finally: workos.close() def test_get_jwks_server_error(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=500, json={"message": "Server error"}) with pytest.raises(ServerError): @@ -848,9 +696,7 @@ def test_get_jwks_server_error(self, httpx_mock): workos.close() def test_get_jwks_bad_request(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) with pytest.raises(BadRequestError): @@ -859,9 +705,7 @@ def test_get_jwks_bad_request(self, httpx_mock): workos.close() def test_get_jwks_unprocessable(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) with pytest.raises(UnprocessableEntityError): @@ -871,6 +715,7 @@ def test_get_jwks_unprocessable(self, httpx_mock): class TestAsyncUserManagement: + @pytest.mark.asyncio async def test_get_jwks(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("jwks_response.json")) @@ -883,9 +728,7 @@ async def test_get_jwks(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_create_authenticate(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("authenticate_response.json")) - result = await async_workos.user_management.create_authenticate( - body=load_fixture("authorization_code_session_authenticate_request.json") - ) + result = await async_workos.user_management.create_authenticate(body=load_fixture("authorization_code_session_authenticate_request.json")) assert isinstance(result, AuthenticateResponse) assert result.organization_id == "org_01H945H0YD4F97JN9MATX7BYAG" assert result.authkit_authorization_code == "authkit_authz_code_abc123" @@ -894,32 +737,23 @@ async def test_create_authenticate(self, async_workos, httpx_mock): assert request.url.path.endswith("/user_management/authenticate") def test_get_authorization_url(self, async_workos): - result = async_workos.user_management.get_authorization_url( - redirect_uri="test_redirect_uri" - ) + result = async_workos.user_management.get_authorization_url(redirect_uri="test_redirect_uri") assert isinstance(result, str) assert result.startswith("http") @pytest.mark.asyncio async def test_create_device(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("device_authorization_response.json")) - result = await async_workos.user_management.create_device( - client_id="test_client_id" - ) + result = await async_workos.user_management.create_device(client_id="test_client_id") assert isinstance(result, DeviceAuthorizationResponse) - assert ( - result.device_code - == "CVE2wOfIFK4vhmiDBntpX9s8KT2f0qngpWYL0LGy9HxYgBRXUKIUkZB9BgIFho5h" - ) + assert result.device_code == "CVE2wOfIFK4vhmiDBntpX9s8KT2f0qngpWYL0LGy9HxYgBRXUKIUkZB9BgIFho5h" assert result.user_code == "BCDF-GHJK" request = httpx_mock.get_request() assert request.method == "POST" assert request.url.path.endswith("/user_management/authorize/device") def test_get_logout_url(self, async_workos): - result = async_workos.user_management.get_logout_url( - session_id="test_session_id" - ) + result = async_workos.user_management.get_logout_url(session_id="test_session_id") assert isinstance(result, str) assert result.startswith("http") @@ -934,9 +768,7 @@ async def test_revoke_session(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_create_cors_origin(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("cors_origin_response.json")) - result = await async_workos.user_management.create_cors_origin( - origin="test_origin" - ) + result = await async_workos.user_management.create_cors_origin(origin="test_origin") assert isinstance(result, CORSOriginResponse) assert result.object == "cors_origin" assert result.id == "cors_origin_01HXYZ123456789ABCDEFGHIJ" @@ -969,9 +801,7 @@ async def test_reset_password(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_confirm_password_reset(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("reset_password_response.json")) - result = await async_workos.user_management.confirm_password_reset( - token="test_token", new_password="test_new_password" - ) + result = await async_workos.user_management.confirm_password_reset(token="test_token", new_password="test_new_password") assert isinstance(result, ResetPasswordResponse) request = httpx_mock.get_request() assert request.method == "POST" @@ -1006,15 +836,7 @@ async def test_list_users_empty_page(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_list_users_encodes_query_params(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - await async_workos.user_management.list_users( - limit=10, - before="cursor before", - after="cursor/after", - order=UserManagementUsersOrder("normal"), - organization="value organization/test", - organization_id="value organization_id/test", - email="value email/test", - ) + await async_workos.user_management.list_users(limit=10, before="cursor before", after="cursor/after", order=UserManagementUsersOrder("normal"), organization="value organization/test", organization_id="value organization_id/test", email="value email/test") request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -1027,9 +849,7 @@ async def test_list_users_encodes_query_params(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_create_user(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("user.json")) - result = await async_workos.user_management.create_user( - email="test_email", password=PasswordPlaintext(password="test_value") - ) + result = await async_workos.user_management.create_user(email="test_email", password=PasswordPlaintext(password="test_value")) assert isinstance(result, User) assert result.object == "user" assert result.id == "user_01E4ZCR3C56J083X43JQXF3JK5" @@ -1040,17 +860,13 @@ async def test_create_user(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_get_user_by_external_id(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("user.json")) - result = await async_workos.user_management.get_user_by_external_id( - "test_external_id" - ) + result = await async_workos.user_management.get_user_by_external_id("test_external_id") assert isinstance(result, User) assert result.object == "user" assert result.id == "user_01E4ZCR3C56J083X43JQXF3JK5" request = httpx_mock.get_request() assert request.method == "GET" - assert request.url.path.endswith( - "/user_management/users/external_id/test_external_id" - ) + assert request.url.path.endswith("/user_management/users/external_id/test_external_id") @pytest.mark.asyncio async def test_get_user(self, async_workos, httpx_mock): @@ -1066,9 +882,7 @@ async def test_get_user(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_update_user(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("user.json")) - result = await async_workos.user_management.update_user( - "test_id", password=PasswordPlaintext(password="test_value") - ) + result = await async_workos.user_management.update_user("test_id", password=PasswordPlaintext(password="test_value")) assert isinstance(result, User) assert result.object == "user" assert result.id == "user_01E4ZCR3C56J083X43JQXF3JK5" @@ -1088,57 +902,41 @@ async def test_delete_user(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_confirm_email_change(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("email_change_confirmation.json")) - result = await async_workos.user_management.confirm_email_change( - "test_id", code="test_code" - ) + result = await async_workos.user_management.confirm_email_change("test_id", code="test_code") assert isinstance(result, EmailChangeConfirmation) assert result.object == "email_change_confirmation" request = httpx_mock.get_request() assert request.method == "POST" - assert request.url.path.endswith( - "/user_management/users/test_id/email_change/confirm" - ) + assert request.url.path.endswith("/user_management/users/test_id/email_change/confirm") @pytest.mark.asyncio async def test_send_email_change(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("email_change.json")) - result = await async_workos.user_management.send_email_change( - "test_id", new_email="test_new_email" - ) + result = await async_workos.user_management.send_email_change("test_id", new_email="test_new_email") assert isinstance(result, EmailChange) assert result.object == "email_change" assert result.new_email == "new.email@example.com" request = httpx_mock.get_request() assert request.method == "POST" - assert request.url.path.endswith( - "/user_management/users/test_id/email_change/send" - ) + assert request.url.path.endswith("/user_management/users/test_id/email_change/send") @pytest.mark.asyncio async def test_verify_email(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("verify_email_response.json")) - result = await async_workos.user_management.verify_email( - "test_id", code="test_code" - ) + result = await async_workos.user_management.verify_email("test_id", code="test_code") assert isinstance(result, VerifyEmailResponse) request = httpx_mock.get_request() assert request.method == "POST" - assert request.url.path.endswith( - "/user_management/users/test_id/email_verification/confirm" - ) + assert request.url.path.endswith("/user_management/users/test_id/email_verification/confirm") @pytest.mark.asyncio async def test_send_verification_email(self, async_workos, httpx_mock): - httpx_mock.add_response( - json=load_fixture("send_verification_email_response.json") - ) + httpx_mock.add_response(json=load_fixture("send_verification_email_response.json")) result = await async_workos.user_management.send_verification_email("test_id") assert isinstance(result, SendVerificationEmailResponse) request = httpx_mock.get_request() assert request.method == "POST" - assert request.url.path.endswith( - "/user_management/users/test_id/email_verification/send" - ) + assert request.url.path.endswith("/user_management/users/test_id/email_verification/send") @pytest.mark.asyncio async def test_get_user_identities(self, async_workos, httpx_mock): @@ -1166,13 +964,7 @@ async def test_list_sessions_empty_page(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_list_sessions_encodes_query_params(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - await async_workos.user_management.list_sessions( - "test_id", - limit=10, - before="cursor before", - after="cursor/after", - order=UserManagementUsersOrder("normal"), - ) + await async_workos.user_management.list_sessions("test_id", limit=10, before="cursor before", after="cursor/after", order=UserManagementUsersOrder("normal")) request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -1195,18 +987,9 @@ async def test_list_invitations_empty_page(self, async_workos, httpx_mock): assert page.data == [] @pytest.mark.asyncio - async def test_list_invitations_encodes_query_params( - self, async_workos, httpx_mock - ): + async def test_list_invitations_encodes_query_params(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - await async_workos.user_management.list_invitations( - limit=10, - before="cursor before", - after="cursor/after", - order=UserManagementInvitationsOrder("normal"), - organization_id="value organization_id/test", - email="value email/test", - ) + await async_workos.user_management.list_invitations(limit=10, before="cursor before", after="cursor/after", order=UserManagementInvitationsOrder("normal"), organization_id="value organization_id/test", email="value email/test") request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -1229,17 +1012,13 @@ async def test_send_invitation(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_find_invitation_by_token(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("user_invite.json")) - result = await async_workos.user_management.find_invitation_by_token( - "test_token" - ) + result = await async_workos.user_management.find_invitation_by_token("test_token") assert isinstance(result, UserInvite) assert result.object == "invitation" assert result.id == "invitation_01E4ZCR3C56J083X43JQXF3JK5" request = httpx_mock.get_request() assert request.method == "GET" - assert request.url.path.endswith( - "/user_management/invitations/by_token/test_token" - ) + assert request.url.path.endswith("/user_management/invitations/by_token/test_token") @pytest.mark.asyncio async def test_get_invitation(self, async_workos, httpx_mock): @@ -1288,9 +1067,7 @@ async def test_revoke_invitation(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_update_jwt_template(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("jwt_template_response.json")) - result = await async_workos.user_management.update_jwt_template( - content="test_content" - ) + result = await async_workos.user_management.update_jwt_template(content="test_content") assert isinstance(result, JWTTemplateResponse) assert result.object == "jwt_template" assert result.created_at == "2026-01-15T12:00:00.000Z" @@ -1301,9 +1078,7 @@ async def test_update_jwt_template(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_create_magic_auth(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("magic_auth.json")) - result = await async_workos.user_management.create_magic_auth( - email="test_email" - ) + result = await async_workos.user_management.create_magic_auth(email="test_email") assert isinstance(result, MagicAuth) assert result.object == "magic_auth" assert result.id == "magic_auth_01HWZBQZY2M3AMQW166Q22K88F" @@ -1324,37 +1099,23 @@ async def test_get_magic_auth(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_list_organization_memberships(self, async_workos, httpx_mock): - httpx_mock.add_response( - json=load_fixture("list_user_organization_membership.json") - ) + httpx_mock.add_response(json=load_fixture("list_user_organization_membership.json")) page = await async_workos.user_management.list_organization_memberships() assert isinstance(page, AsyncPage) assert len(page.data) == 1 assert isinstance(page.data[0], UserOrganizationMembership) @pytest.mark.asyncio - async def test_list_organization_memberships_empty_page( - self, async_workos, httpx_mock - ): + async def test_list_organization_memberships_empty_page(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) page = await async_workos.user_management.list_organization_memberships() assert isinstance(page, AsyncPage) assert page.data == [] @pytest.mark.asyncio - async def test_list_organization_memberships_encodes_query_params( - self, async_workos, httpx_mock - ): + async def test_list_organization_memberships_encodes_query_params(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - await async_workos.user_management.list_organization_memberships( - limit=10, - before="cursor before", - after="cursor/after", - order=UserManagementOrganizationMembershipOrder("normal"), - organization_id="value organization_id/test", - statuses=["val1", "val2"], - user_id="value user_id/test", - ) + await async_workos.user_management.list_organization_memberships(limit=10, before="cursor before", after="cursor/after", order=UserManagementOrganizationMembershipOrder("normal"), organization_id="value organization_id/test", statuses=["val1", "val2"], user_id="value user_id/test") request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -1367,11 +1128,7 @@ async def test_list_organization_memberships_encodes_query_params( @pytest.mark.asyncio async def test_create_organization_membership(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("organization_membership.json")) - result = await async_workos.user_management.create_organization_membership( - user_id="test_user_id", - organization_id="test_organization_id", - role=RoleSingle(role_slug="test_value"), - ) + result = await async_workos.user_management.create_organization_membership(user_id="test_user_id", organization_id="test_organization_id", role=RoleSingle(role_slug="test_value")) assert isinstance(result, OrganizationMembership) assert result.object == "organization_membership" assert result.id == "om_01HXYZ123456789ABCDEFGHIJ" @@ -1382,75 +1139,55 @@ async def test_create_organization_membership(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_get_organization_membership(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("user_organization_membership.json")) - result = await async_workos.user_management.get_organization_membership( - "test_id" - ) + result = await async_workos.user_management.get_organization_membership("test_id") assert isinstance(result, UserOrganizationMembership) assert result.object == "organization_membership" assert result.id == "om_01HXYZ123456789ABCDEFGHIJ" request = httpx_mock.get_request() assert request.method == "GET" - assert request.url.path.endswith( - "/user_management/organization_memberships/test_id" - ) + assert request.url.path.endswith("/user_management/organization_memberships/test_id") @pytest.mark.asyncio async def test_update_organization_membership(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("user_organization_membership.json")) - result = await async_workos.user_management.update_organization_membership( - "test_id", role=RoleSingle(role_slug="test_value") - ) + result = await async_workos.user_management.update_organization_membership("test_id", role=RoleSingle(role_slug="test_value")) assert isinstance(result, UserOrganizationMembership) assert result.object == "organization_membership" assert result.id == "om_01HXYZ123456789ABCDEFGHIJ" request = httpx_mock.get_request() assert request.method == "PUT" - assert request.url.path.endswith( - "/user_management/organization_memberships/test_id" - ) + assert request.url.path.endswith("/user_management/organization_memberships/test_id") @pytest.mark.asyncio async def test_delete_organization_membership(self, async_workos, httpx_mock): httpx_mock.add_response(status_code=204) - result = await async_workos.user_management.delete_organization_membership( - "test_id" - ) + result = await async_workos.user_management.delete_organization_membership("test_id") assert result is None request = httpx_mock.get_request() assert request.method == "DELETE" - assert request.url.path.endswith( - "/user_management/organization_memberships/test_id" - ) + assert request.url.path.endswith("/user_management/organization_memberships/test_id") @pytest.mark.asyncio async def test_deactivate_organization_membership(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("organization_membership.json")) - result = await async_workos.user_management.deactivate_organization_membership( - "test_id" - ) + result = await async_workos.user_management.deactivate_organization_membership("test_id") assert isinstance(result, OrganizationMembership) assert result.object == "organization_membership" assert result.id == "om_01HXYZ123456789ABCDEFGHIJ" request = httpx_mock.get_request() assert request.method == "PUT" - assert request.url.path.endswith( - "/user_management/organization_memberships/test_id/deactivate" - ) + assert request.url.path.endswith("/user_management/organization_memberships/test_id/deactivate") @pytest.mark.asyncio async def test_reactivate_organization_membership(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("user_organization_membership.json")) - result = await async_workos.user_management.reactivate_organization_membership( - "test_id" - ) + result = await async_workos.user_management.reactivate_organization_membership("test_id") assert isinstance(result, UserOrganizationMembership) assert result.object == "organization_membership" assert result.id == "om_01HXYZ123456789ABCDEFGHIJ" request = httpx_mock.get_request() assert request.method == "PUT" - assert request.url.path.endswith( - "/user_management/organization_memberships/test_id/reactivate" - ) + assert request.url.path.endswith("/user_management/organization_memberships/test_id/reactivate") @pytest.mark.asyncio async def test_create_redirect_uri(self, async_workos, httpx_mock): @@ -1465,39 +1202,23 @@ async def test_create_redirect_uri(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_list_user_authorized_applications(self, async_workos, httpx_mock): - httpx_mock.add_response( - json=load_fixture("list_authorized_connect_application_list_data.json") - ) - page = await async_workos.user_management.list_user_authorized_applications( - "test_user_id" - ) + httpx_mock.add_response(json=load_fixture("list_authorized_connect_application_list_data.json")) + page = await async_workos.user_management.list_user_authorized_applications("test_user_id") assert isinstance(page, AsyncPage) assert len(page.data) == 1 assert isinstance(page.data[0], AuthorizedConnectApplicationListData) @pytest.mark.asyncio - async def test_list_user_authorized_applications_empty_page( - self, async_workos, httpx_mock - ): + async def test_list_user_authorized_applications_empty_page(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - page = await async_workos.user_management.list_user_authorized_applications( - "test_user_id" - ) + page = await async_workos.user_management.list_user_authorized_applications("test_user_id") assert isinstance(page, AsyncPage) assert page.data == [] @pytest.mark.asyncio - async def test_list_user_authorized_applications_encodes_query_params( - self, async_workos, httpx_mock - ): + async def test_list_user_authorized_applications_encodes_query_params(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - await async_workos.user_management.list_user_authorized_applications( - "test_user_id", - limit=10, - before="cursor before", - after="cursor/after", - order=UserManagementUsersAuthorizedApplicationsOrder("normal"), - ) + await async_workos.user_management.list_user_authorized_applications("test_user_id", limit=10, before="cursor before", after="cursor/after", order=UserManagementUsersAuthorizedApplicationsOrder("normal")) request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -1507,22 +1228,16 @@ async def test_list_user_authorized_applications_encodes_query_params( @pytest.mark.asyncio async def test_delete_user_authorized_application(self, async_workos, httpx_mock): httpx_mock.add_response(status_code=204) - result = await async_workos.user_management.delete_user_authorized_application( - "test_application_id", "test_user_id" - ) + result = await async_workos.user_management.delete_user_authorized_application("test_application_id", "test_user_id") assert result is None request = httpx_mock.get_request() assert request.method == "DELETE" - assert request.url.path.endswith( - "/user_management/users/test_user_id/authorized_applications/test_application_id" - ) + assert request.url.path.endswith("/user_management/users/test_user_id/authorized_applications/test_application_id") @pytest.mark.asyncio async def test_authenticate_with_password(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("authenticate_response.json")) - result = await async_workos.user_management.authenticate_with_password( - email="test_email", password="test_password" - ) + result = await async_workos.user_management.authenticate_with_password(email="test_email", password="test_password") assert isinstance(result, AuthenticateResponse) request = httpx_mock.get_request() assert request.method == "POST" @@ -1532,9 +1247,7 @@ async def test_authenticate_with_password(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_authenticate_with_code(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("authenticate_response.json")) - result = await async_workos.user_management.authenticate_with_code( - code="test_code" - ) + result = await async_workos.user_management.authenticate_with_code(code="test_code") assert isinstance(result, AuthenticateResponse) request = httpx_mock.get_request() assert request.method == "POST" @@ -1544,9 +1257,7 @@ async def test_authenticate_with_code(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_authenticate_with_refresh_token(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("authenticate_response.json")) - result = await async_workos.user_management.authenticate_with_refresh_token( - refresh_token="test_refresh_token" - ) + result = await async_workos.user_management.authenticate_with_refresh_token(refresh_token="test_refresh_token") assert isinstance(result, AuthenticateResponse) request = httpx_mock.get_request() assert request.method == "POST" @@ -1556,9 +1267,7 @@ async def test_authenticate_with_refresh_token(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_authenticate_with_magic_auth(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("authenticate_response.json")) - result = await async_workos.user_management.authenticate_with_magic_auth( - code="test_value", email="test_value" - ) + result = await async_workos.user_management.authenticate_with_magic_auth(code="test_value", email="test_value") assert isinstance(result, AuthenticateResponse) request = httpx_mock.get_request() assert request.method == "POST" @@ -1568,27 +1277,17 @@ async def test_authenticate_with_magic_auth(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_authenticate_with_email_verification(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("authenticate_response.json")) - result = ( - await async_workos.user_management.authenticate_with_email_verification( - code="test_value", pending_authentication_token="test_value" - ) - ) + result = await async_workos.user_management.authenticate_with_email_verification(code="test_value", pending_authentication_token="test_value") assert isinstance(result, AuthenticateResponse) request = httpx_mock.get_request() assert request.method == "POST" body = json.loads(request.content) - assert ( - body["grant_type"] == "urn:workos:oauth:grant-type:email-verification:code" - ) + assert body["grant_type"] == "urn:workos:oauth:grant-type:email-verification:code" @pytest.mark.asyncio async def test_authenticate_with_totp(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("authenticate_response.json")) - result = await async_workos.user_management.authenticate_with_totp( - code="test_value", - pending_authentication_token="test_value", - authentication_challenge_id="test_value", - ) + result = await async_workos.user_management.authenticate_with_totp(code="test_value", pending_authentication_token="test_value", authentication_challenge_id="test_value") assert isinstance(result, AuthenticateResponse) request = httpx_mock.get_request() assert request.method == "POST" @@ -1596,29 +1295,19 @@ async def test_authenticate_with_totp(self, async_workos, httpx_mock): assert body["grant_type"] == "urn:workos:oauth:grant-type:mfa-totp" @pytest.mark.asyncio - async def test_authenticate_with_organization_selection( - self, async_workos, httpx_mock - ): + async def test_authenticate_with_organization_selection(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("authenticate_response.json")) - result = ( - await async_workos.user_management.authenticate_with_organization_selection( - pending_authentication_token="test_value", organization_id="test_value" - ) - ) + result = await async_workos.user_management.authenticate_with_organization_selection(pending_authentication_token="test_value", organization_id="test_value") assert isinstance(result, AuthenticateResponse) request = httpx_mock.get_request() assert request.method == "POST" body = json.loads(request.content) - assert ( - body["grant_type"] == "urn:workos:oauth:grant-type:organization-selection" - ) + assert body["grant_type"] == "urn:workos:oauth:grant-type:organization-selection" @pytest.mark.asyncio async def test_authenticate_with_device_code(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("authenticate_response.json")) - result = await async_workos.user_management.authenticate_with_device_code( - device_code="test_value" - ) + result = await async_workos.user_management.authenticate_with_device_code(device_code="test_value") assert isinstance(result, AuthenticateResponse) request = httpx_mock.get_request() assert request.method == "POST" @@ -1628,9 +1317,7 @@ async def test_authenticate_with_device_code(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_get_jwks_with_request_options(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("jwks_response.json")) - await async_workos.user_management.get_jwks( - "test_clientId", request_options={"extra_headers": {"X-Custom": "value"}} - ) + await async_workos.user_management.get_jwks("test_clientId", request_options={"extra_headers": {"X-Custom": "value"}}) request = httpx_mock.get_request() assert request.headers["X-Custom"] == "value" @@ -1642,9 +1329,7 @@ async def test_get_jwks_unauthorized(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_get_jwks_not_found(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=404, json={"message": "Not found"}) with pytest.raises(NotFoundError): @@ -1654,15 +1339,9 @@ async def test_get_jwks_not_found(self, httpx_mock): @pytest.mark.asyncio async def test_get_jwks_rate_limited(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: - httpx_mock.add_response( - status_code=429, - headers={"Retry-After": "0"}, - json={"message": "Slow down"}, - ) + httpx_mock.add_response(status_code=429, headers={"Retry-After": "0"}, json={"message": "Slow down"}) with pytest.raises(RateLimitExceededError): await workos.user_management.get_jwks("test_clientId") finally: @@ -1670,9 +1349,7 @@ async def test_get_jwks_rate_limited(self, httpx_mock): @pytest.mark.asyncio async def test_get_jwks_server_error(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=500, json={"message": "Server error"}) with pytest.raises(ServerError): @@ -1682,9 +1359,7 @@ async def test_get_jwks_server_error(self, httpx_mock): @pytest.mark.asyncio async def test_get_jwks_bad_request(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) with pytest.raises(BadRequestError): @@ -1694,9 +1369,7 @@ async def test_get_jwks_bad_request(self, httpx_mock): @pytest.mark.asyncio async def test_get_jwks_unprocessable(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) with pytest.raises(UnprocessableEntityError): diff --git a/tests/test_user_management_organization_membership_groups.py b/tests/test_user_management_organization_membership_groups.py new file mode 100644 index 00000000..9b5f487b --- /dev/null +++ b/tests/test_user_management_organization_membership_groups.py @@ -0,0 +1,189 @@ +# This file is auto-generated by oagen. Do not edit. + +import json + +import pytest +from workos import WorkOSClient, AsyncWorkOSClient +from tests.generated_helpers import load_fixture + +from workos.groups.models import Group +from workos.user_management_organization_membership_groups.models import UserManagementOrganizationMembershipGroupsOrder +from workos._pagination import AsyncPage, SyncPage +from workos._errors import AuthenticationError, BadRequestError, NotFoundError, RateLimitExceededError, ServerError, UnprocessableEntityError + + +class TestUserManagementOrganizationMembershipGroups: + + def test_list_organization_membership_groups(self, workos, httpx_mock): + httpx_mock.add_response( + json=load_fixture("list_group.json"), + ) + page = workos.user_management_organization_membership_groups.list_organization_membership_groups("test_omId") + assert isinstance(page, SyncPage) + assert len(page.data) == 1 + assert isinstance(page.data[0], Group) + + def test_list_organization_membership_groups_empty_page(self, workos, httpx_mock): + httpx_mock.add_response(json={"data": [], "list_metadata": {}}) + page = workos.user_management_organization_membership_groups.list_organization_membership_groups("test_omId") + assert isinstance(page, SyncPage) + assert page.data == [] + + def test_list_organization_membership_groups_encodes_query_params(self, workos, httpx_mock): + httpx_mock.add_response(json={"data": [], "list_metadata": {}}) + workos.user_management_organization_membership_groups.list_organization_membership_groups("test_omId", limit=10, before="cursor before", after="cursor/after", order=UserManagementOrganizationMembershipGroupsOrder("normal")) + request = httpx_mock.get_request() + assert request.url.params["limit"] == "10" + assert request.url.params["before"] == "cursor before" + assert request.url.params["after"] == "cursor/after" + assert request.url.params["order"] == "normal" + + def test_list_organization_membership_groups_with_request_options(self, workos, httpx_mock): + httpx_mock.add_response(json={"data": [], "list_metadata": {}}) + workos.user_management_organization_membership_groups.list_organization_membership_groups("test_omId", request_options={"extra_headers": {"X-Custom": "value"}}) + request = httpx_mock.get_request() + assert request.headers["X-Custom"] == "value" + + def test_list_organization_membership_groups_unauthorized(self, workos, httpx_mock): + httpx_mock.add_response( + status_code=401, + json={"message": "Unauthorized"}, + ) + with pytest.raises(AuthenticationError): + workos.user_management_organization_membership_groups.list_organization_membership_groups("test_omId") + + def test_list_organization_membership_groups_not_found(self, httpx_mock): + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) + try: + httpx_mock.add_response(status_code=404, json={"message": "Not found"}) + with pytest.raises(NotFoundError): + workos.user_management_organization_membership_groups.list_organization_membership_groups("test_omId") + finally: + workos.close() + + def test_list_organization_membership_groups_rate_limited(self, httpx_mock): + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) + try: + httpx_mock.add_response(status_code=429, headers={"Retry-After": "0"}, json={"message": "Slow down"}) + with pytest.raises(RateLimitExceededError): + workos.user_management_organization_membership_groups.list_organization_membership_groups("test_omId") + finally: + workos.close() + + def test_list_organization_membership_groups_server_error(self, httpx_mock): + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) + try: + httpx_mock.add_response(status_code=500, json={"message": "Server error"}) + with pytest.raises(ServerError): + workos.user_management_organization_membership_groups.list_organization_membership_groups("test_omId") + finally: + workos.close() + + def test_list_organization_membership_groups_bad_request(self, httpx_mock): + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) + try: + httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) + with pytest.raises(BadRequestError): + workos.user_management_organization_membership_groups.list_organization_membership_groups("test_omId") + finally: + workos.close() + + def test_list_organization_membership_groups_unprocessable(self, httpx_mock): + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) + try: + httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) + with pytest.raises(UnprocessableEntityError): + workos.user_management_organization_membership_groups.list_organization_membership_groups("test_omId") + finally: + workos.close() + + +class TestAsyncUserManagementOrganizationMembershipGroups: + + @pytest.mark.asyncio + async def test_list_organization_membership_groups(self, async_workos, httpx_mock): + httpx_mock.add_response(json=load_fixture("list_group.json")) + page = await async_workos.user_management_organization_membership_groups.list_organization_membership_groups("test_omId") + assert isinstance(page, AsyncPage) + assert len(page.data) == 1 + assert isinstance(page.data[0], Group) + + @pytest.mark.asyncio + async def test_list_organization_membership_groups_empty_page(self, async_workos, httpx_mock): + httpx_mock.add_response(json={"data": [], "list_metadata": {}}) + page = await async_workos.user_management_organization_membership_groups.list_organization_membership_groups("test_omId") + assert isinstance(page, AsyncPage) + assert page.data == [] + + @pytest.mark.asyncio + async def test_list_organization_membership_groups_encodes_query_params(self, async_workos, httpx_mock): + httpx_mock.add_response(json={"data": [], "list_metadata": {}}) + await async_workos.user_management_organization_membership_groups.list_organization_membership_groups("test_omId", limit=10, before="cursor before", after="cursor/after", order=UserManagementOrganizationMembershipGroupsOrder("normal")) + request = httpx_mock.get_request() + assert request.url.params["limit"] == "10" + assert request.url.params["before"] == "cursor before" + assert request.url.params["after"] == "cursor/after" + assert request.url.params["order"] == "normal" + + @pytest.mark.asyncio + async def test_list_organization_membership_groups_with_request_options(self, async_workos, httpx_mock): + httpx_mock.add_response(json={"data": [], "list_metadata": {}}) + await async_workos.user_management_organization_membership_groups.list_organization_membership_groups("test_omId", request_options={"extra_headers": {"X-Custom": "value"}}) + request = httpx_mock.get_request() + assert request.headers["X-Custom"] == "value" + + @pytest.mark.asyncio + async def test_list_organization_membership_groups_unauthorized(self, async_workos, httpx_mock): + httpx_mock.add_response(status_code=401, json={"message": "Unauthorized"}) + with pytest.raises(AuthenticationError): + await async_workos.user_management_organization_membership_groups.list_organization_membership_groups("test_omId") + + @pytest.mark.asyncio + async def test_list_organization_membership_groups_not_found(self, httpx_mock): + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) + try: + httpx_mock.add_response(status_code=404, json={"message": "Not found"}) + with pytest.raises(NotFoundError): + await workos.user_management_organization_membership_groups.list_organization_membership_groups("test_omId") + finally: + await workos.close() + + @pytest.mark.asyncio + async def test_list_organization_membership_groups_rate_limited(self, httpx_mock): + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) + try: + httpx_mock.add_response(status_code=429, headers={"Retry-After": "0"}, json={"message": "Slow down"}) + with pytest.raises(RateLimitExceededError): + await workos.user_management_organization_membership_groups.list_organization_membership_groups("test_omId") + finally: + await workos.close() + + @pytest.mark.asyncio + async def test_list_organization_membership_groups_server_error(self, httpx_mock): + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) + try: + httpx_mock.add_response(status_code=500, json={"message": "Server error"}) + with pytest.raises(ServerError): + await workos.user_management_organization_membership_groups.list_organization_membership_groups("test_omId") + finally: + await workos.close() + + @pytest.mark.asyncio + async def test_list_organization_membership_groups_bad_request(self, httpx_mock): + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) + try: + httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) + with pytest.raises(BadRequestError): + await workos.user_management_organization_membership_groups.list_organization_membership_groups("test_omId") + finally: + await workos.close() + + @pytest.mark.asyncio + async def test_list_organization_membership_groups_unprocessable(self, httpx_mock): + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) + try: + httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) + with pytest.raises(UnprocessableEntityError): + await workos.user_management_organization_membership_groups.list_organization_membership_groups("test_omId") + finally: + await workos.close() diff --git a/tests/test_webhooks.py b/tests/test_webhooks.py index 8ebfee9a..b4ca0616 100644 --- a/tests/test_webhooks.py +++ b/tests/test_webhooks.py @@ -6,19 +6,14 @@ from workos import WorkOSClient, AsyncWorkOSClient from tests.generated_helpers import load_fixture +from workos.common.models import UpdateWebhookEndpointStatus from workos.webhooks.models import WebhookEndpointJson, WebhooksOrder from workos._pagination import AsyncPage, SyncPage -from workos._errors import ( - AuthenticationError, - BadRequestError, - NotFoundError, - RateLimitExceededError, - ServerError, - UnprocessableEntityError, -) +from workos._errors import AuthenticationError, BadRequestError, NotFoundError, RateLimitExceededError, ServerError, UnprocessableEntityError class TestWebhooks: + def test_list_webhook_endpoints(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("list_webhook_endpoint_json.json"), @@ -36,12 +31,7 @@ def test_list_webhook_endpoints_empty_page(self, workos, httpx_mock): def test_list_webhook_endpoints_encodes_query_params(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - workos.webhooks.list_webhook_endpoints( - limit=10, - before="cursor before", - after="cursor/after", - order=WebhooksOrder("normal"), - ) + workos.webhooks.list_webhook_endpoints(limit=10, before="cursor before", after="cursor/after", order=WebhooksOrder("normal")) request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -52,9 +42,7 @@ def test_create_webhook_endpoint(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("webhook_endpoint_json.json"), ) - result = workos.webhooks.create_webhook_endpoint( - endpoint_url="test_endpoint_url", events=[] - ) + result = workos.webhooks.create_webhook_endpoint(endpoint_url="test_endpoint_url", events=[]) assert isinstance(result, WebhookEndpointJson) assert result.object == "webhook_endpoint" assert result.id == "we_0123456789" @@ -87,9 +75,7 @@ def test_delete_webhook_endpoint(self, workos, httpx_mock): def test_list_webhook_endpoints_with_request_options(self, workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - workos.webhooks.list_webhook_endpoints( - request_options={"extra_headers": {"X-Custom": "value"}} - ) + workos.webhooks.list_webhook_endpoints(request_options={"extra_headers": {"X-Custom": "value"}}) request = httpx_mock.get_request() assert request.headers["X-Custom"] == "value" @@ -102,9 +88,7 @@ def test_list_webhook_endpoints_unauthorized(self, workos, httpx_mock): workos.webhooks.list_webhook_endpoints() def test_list_webhook_endpoints_not_found(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=404, json={"message": "Not found"}) with pytest.raises(NotFoundError): @@ -113,24 +97,16 @@ def test_list_webhook_endpoints_not_found(self, httpx_mock): workos.close() def test_list_webhook_endpoints_rate_limited(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: - httpx_mock.add_response( - status_code=429, - headers={"Retry-After": "0"}, - json={"message": "Slow down"}, - ) + httpx_mock.add_response(status_code=429, headers={"Retry-After": "0"}, json={"message": "Slow down"}) with pytest.raises(RateLimitExceededError): workos.webhooks.list_webhook_endpoints() finally: workos.close() def test_list_webhook_endpoints_server_error(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=500, json={"message": "Server error"}) with pytest.raises(ServerError): @@ -139,9 +115,7 @@ def test_list_webhook_endpoints_server_error(self, httpx_mock): workos.close() def test_list_webhook_endpoints_bad_request(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) with pytest.raises(BadRequestError): @@ -150,9 +124,7 @@ def test_list_webhook_endpoints_bad_request(self, httpx_mock): workos.close() def test_list_webhook_endpoints_unprocessable(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) with pytest.raises(UnprocessableEntityError): @@ -162,6 +134,7 @@ def test_list_webhook_endpoints_unprocessable(self, httpx_mock): class TestAsyncWebhooks: + @pytest.mark.asyncio async def test_list_webhook_endpoints(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("list_webhook_endpoint_json.json")) @@ -178,16 +151,9 @@ async def test_list_webhook_endpoints_empty_page(self, async_workos, httpx_mock) assert page.data == [] @pytest.mark.asyncio - async def test_list_webhook_endpoints_encodes_query_params( - self, async_workos, httpx_mock - ): + async def test_list_webhook_endpoints_encodes_query_params(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - await async_workos.webhooks.list_webhook_endpoints( - limit=10, - before="cursor before", - after="cursor/after", - order=WebhooksOrder("normal"), - ) + await async_workos.webhooks.list_webhook_endpoints(limit=10, before="cursor before", after="cursor/after", order=WebhooksOrder("normal")) request = httpx_mock.get_request() assert request.url.params["limit"] == "10" assert request.url.params["before"] == "cursor before" @@ -197,9 +163,7 @@ async def test_list_webhook_endpoints_encodes_query_params( @pytest.mark.asyncio async def test_create_webhook_endpoint(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("webhook_endpoint_json.json")) - result = await async_workos.webhooks.create_webhook_endpoint( - endpoint_url="test_endpoint_url", events=[] - ) + result = await async_workos.webhooks.create_webhook_endpoint(endpoint_url="test_endpoint_url", events=[]) assert isinstance(result, WebhookEndpointJson) assert result.object == "webhook_endpoint" assert result.id == "we_0123456789" @@ -228,13 +192,9 @@ async def test_delete_webhook_endpoint(self, async_workos, httpx_mock): assert request.url.path.endswith("/webhook_endpoints/test_id") @pytest.mark.asyncio - async def test_list_webhook_endpoints_with_request_options( - self, async_workos, httpx_mock - ): + async def test_list_webhook_endpoints_with_request_options(self, async_workos, httpx_mock): httpx_mock.add_response(json={"data": [], "list_metadata": {}}) - await async_workos.webhooks.list_webhook_endpoints( - request_options={"extra_headers": {"X-Custom": "value"}} - ) + await async_workos.webhooks.list_webhook_endpoints(request_options={"extra_headers": {"X-Custom": "value"}}) request = httpx_mock.get_request() assert request.headers["X-Custom"] == "value" @@ -246,9 +206,7 @@ async def test_list_webhook_endpoints_unauthorized(self, async_workos, httpx_moc @pytest.mark.asyncio async def test_list_webhook_endpoints_not_found(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=404, json={"message": "Not found"}) with pytest.raises(NotFoundError): @@ -258,15 +216,9 @@ async def test_list_webhook_endpoints_not_found(self, httpx_mock): @pytest.mark.asyncio async def test_list_webhook_endpoints_rate_limited(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: - httpx_mock.add_response( - status_code=429, - headers={"Retry-After": "0"}, - json={"message": "Slow down"}, - ) + httpx_mock.add_response(status_code=429, headers={"Retry-After": "0"}, json={"message": "Slow down"}) with pytest.raises(RateLimitExceededError): await workos.webhooks.list_webhook_endpoints() finally: @@ -274,9 +226,7 @@ async def test_list_webhook_endpoints_rate_limited(self, httpx_mock): @pytest.mark.asyncio async def test_list_webhook_endpoints_server_error(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=500, json={"message": "Server error"}) with pytest.raises(ServerError): @@ -286,9 +236,7 @@ async def test_list_webhook_endpoints_server_error(self, httpx_mock): @pytest.mark.asyncio async def test_list_webhook_endpoints_bad_request(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) with pytest.raises(BadRequestError): @@ -298,9 +246,7 @@ async def test_list_webhook_endpoints_bad_request(self, httpx_mock): @pytest.mark.asyncio async def test_list_webhook_endpoints_unprocessable(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) with pytest.raises(UnprocessableEntityError): diff --git a/tests/test_widgets.py b/tests/test_widgets.py index f4102093..9535c1ee 100644 --- a/tests/test_widgets.py +++ b/tests/test_widgets.py @@ -7,17 +7,11 @@ from tests.generated_helpers import load_fixture from workos.widgets.models import WidgetSessionTokenResponse -from workos._errors import ( - AuthenticationError, - BadRequestError, - NotFoundError, - RateLimitExceededError, - ServerError, - UnprocessableEntityError, -) +from workos._errors import AuthenticationError, BadRequestError, NotFoundError, RateLimitExceededError, ServerError, UnprocessableEntityError class TestWidgets: + def test_create_token(self, workos, httpx_mock): httpx_mock.add_response( json=load_fixture("widget_session_token_response.json"), @@ -33,10 +27,7 @@ def test_create_token(self, workos, httpx_mock): def test_create_token_with_request_options(self, workos, httpx_mock): httpx_mock.add_response(json=load_fixture("widget_session_token_response.json")) - workos.widgets.create_token( - organization_id="test_organization_id", - request_options={"extra_headers": {"X-Custom": "value"}}, - ) + workos.widgets.create_token(organization_id="test_organization_id", request_options={"extra_headers": {"X-Custom": "value"}}) request = httpx_mock.get_request() assert request.headers["X-Custom"] == "value" @@ -49,9 +40,7 @@ def test_create_token_unauthorized(self, workos, httpx_mock): workos.widgets.create_token(organization_id="test_organization_id") def test_create_token_not_found(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=404, json={"message": "Not found"}) with pytest.raises(NotFoundError): @@ -60,24 +49,16 @@ def test_create_token_not_found(self, httpx_mock): workos.close() def test_create_token_rate_limited(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: - httpx_mock.add_response( - status_code=429, - headers={"Retry-After": "0"}, - json={"message": "Slow down"}, - ) + httpx_mock.add_response(status_code=429, headers={"Retry-After": "0"}, json={"message": "Slow down"}) with pytest.raises(RateLimitExceededError): workos.widgets.create_token(organization_id="test_organization_id") finally: workos.close() def test_create_token_server_error(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=500, json={"message": "Server error"}) with pytest.raises(ServerError): @@ -86,9 +67,7 @@ def test_create_token_server_error(self, httpx_mock): workos.close() def test_create_token_bad_request(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) with pytest.raises(BadRequestError): @@ -97,9 +76,7 @@ def test_create_token_bad_request(self, httpx_mock): workos.close() def test_create_token_unprocessable(self, httpx_mock): - workos = WorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = WorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) with pytest.raises(UnprocessableEntityError): @@ -109,12 +86,11 @@ def test_create_token_unprocessable(self, httpx_mock): class TestAsyncWidgets: + @pytest.mark.asyncio async def test_create_token(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("widget_session_token_response.json")) - result = await async_workos.widgets.create_token( - organization_id="test_organization_id" - ) + result = await async_workos.widgets.create_token(organization_id="test_organization_id") assert isinstance(result, WidgetSessionTokenResponse) assert result.token == "eyJhbGciOiJSUzI1NiIsImtpZCI6InNlc3Npb24..." request = httpx_mock.get_request() @@ -124,10 +100,7 @@ async def test_create_token(self, async_workos, httpx_mock): @pytest.mark.asyncio async def test_create_token_with_request_options(self, async_workos, httpx_mock): httpx_mock.add_response(json=load_fixture("widget_session_token_response.json")) - await async_workos.widgets.create_token( - organization_id="test_organization_id", - request_options={"extra_headers": {"X-Custom": "value"}}, - ) + await async_workos.widgets.create_token(organization_id="test_organization_id", request_options={"extra_headers": {"X-Custom": "value"}}) request = httpx_mock.get_request() assert request.headers["X-Custom"] == "value" @@ -135,80 +108,54 @@ async def test_create_token_with_request_options(self, async_workos, httpx_mock) async def test_create_token_unauthorized(self, async_workos, httpx_mock): httpx_mock.add_response(status_code=401, json={"message": "Unauthorized"}) with pytest.raises(AuthenticationError): - await async_workos.widgets.create_token( - organization_id="test_organization_id" - ) + await async_workos.widgets.create_token(organization_id="test_organization_id") @pytest.mark.asyncio async def test_create_token_not_found(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=404, json={"message": "Not found"}) with pytest.raises(NotFoundError): - await workos.widgets.create_token( - organization_id="test_organization_id" - ) + await workos.widgets.create_token(organization_id="test_organization_id") finally: await workos.close() @pytest.mark.asyncio async def test_create_token_rate_limited(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: - httpx_mock.add_response( - status_code=429, - headers={"Retry-After": "0"}, - json={"message": "Slow down"}, - ) + httpx_mock.add_response(status_code=429, headers={"Retry-After": "0"}, json={"message": "Slow down"}) with pytest.raises(RateLimitExceededError): - await workos.widgets.create_token( - organization_id="test_organization_id" - ) + await workos.widgets.create_token(organization_id="test_organization_id") finally: await workos.close() @pytest.mark.asyncio async def test_create_token_server_error(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=500, json={"message": "Server error"}) with pytest.raises(ServerError): - await workos.widgets.create_token( - organization_id="test_organization_id" - ) + await workos.widgets.create_token(organization_id="test_organization_id") finally: await workos.close() @pytest.mark.asyncio async def test_create_token_bad_request(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=400, json={"message": "Bad request"}) with pytest.raises(BadRequestError): - await workos.widgets.create_token( - organization_id="test_organization_id" - ) + await workos.widgets.create_token(organization_id="test_organization_id") finally: await workos.close() @pytest.mark.asyncio async def test_create_token_unprocessable(self, httpx_mock): - workos = AsyncWorkOSClient( - api_key="sk_test_123", client_id="client_test", max_retries=0 - ) + workos = AsyncWorkOSClient(api_key="sk_test_123", client_id="client_test", max_retries=0) try: httpx_mock.add_response(status_code=422, json={"message": "Unprocessable"}) with pytest.raises(UnprocessableEntityError): - await workos.widgets.create_token( - organization_id="test_organization_id" - ) + await workos.widgets.create_token(organization_id="test_organization_id") finally: await workos.close()