workos 1.13.0__py3-none-any.whl → 5.38.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. workos/__about__.py +1 -1
  2. workos/__init__.py +3 -7
  3. workos/_base_client.py +138 -0
  4. workos/_client_configuration.py +10 -0
  5. workos/api_keys.py +53 -0
  6. workos/async_client.py +144 -0
  7. workos/audit_logs.py +125 -0
  8. workos/client.py +105 -20
  9. workos/directory_sync.py +369 -146
  10. workos/events.py +111 -0
  11. workos/exceptions.py +53 -26
  12. workos/fga.py +649 -0
  13. workos/mfa.py +152 -116
  14. workos/organization_domains.py +179 -0
  15. workos/organizations.py +401 -86
  16. workos/passwordless.py +67 -43
  17. workos/pipes.py +93 -0
  18. workos/portal.py +51 -28
  19. workos/session.py +337 -0
  20. workos/sso.py +305 -149
  21. workos/types/__init__.py +4 -0
  22. workos/types/api_keys/__init__.py +1 -0
  23. workos/types/api_keys/api_keys.py +20 -0
  24. workos/types/audit_logs/__init__.py +6 -0
  25. workos/types/audit_logs/audit_log_event.py +16 -0
  26. workos/types/audit_logs/audit_log_event_actor.py +12 -0
  27. workos/types/audit_logs/audit_log_event_context.py +8 -0
  28. workos/types/audit_logs/audit_log_event_target.py +12 -0
  29. workos/types/audit_logs/audit_log_export.py +18 -0
  30. workos/types/audit_logs/audit_log_metadata.py +4 -0
  31. workos/types/directory_sync/__init__.py +5 -0
  32. workos/types/directory_sync/directory.py +31 -0
  33. workos/types/directory_sync/directory_group.py +16 -0
  34. workos/types/directory_sync/directory_state.py +28 -0
  35. workos/types/directory_sync/directory_type.py +24 -0
  36. workos/types/directory_sync/directory_user.py +50 -0
  37. workos/types/directory_sync/list_filters.py +21 -0
  38. workos/types/events/__init__.py +13 -0
  39. workos/types/events/authentication_payload.py +70 -0
  40. workos/types/events/connection_payload_with_legacy_fields.py +5 -0
  41. workos/types/events/directory_group_membership_payload.py +9 -0
  42. workos/types/events/directory_group_with_previous_attributes.py +6 -0
  43. workos/types/events/directory_payload.py +16 -0
  44. workos/types/events/directory_payload_with_legacy_fields.py +29 -0
  45. workos/types/events/directory_user_with_previous_attributes.py +6 -0
  46. workos/types/events/event.py +324 -0
  47. workos/types/events/event_model.py +103 -0
  48. workos/types/events/event_type.py +59 -0
  49. workos/types/events/list_filters.py +10 -0
  50. workos/types/events/organization_domain_verification_failed_payload.py +14 -0
  51. workos/types/events/previous_attributes.py +3 -0
  52. workos/types/events/session_payload.py +27 -0
  53. workos/types/feature_flags/__init__.py +3 -0
  54. workos/types/feature_flags/feature_flag.py +12 -0
  55. workos/types/feature_flags/list_filters.py +5 -0
  56. workos/types/fga/__init__.py +5 -0
  57. workos/types/fga/authorization_resource_types.py +9 -0
  58. workos/types/fga/authorization_resources.py +10 -0
  59. workos/types/fga/check.py +51 -0
  60. workos/types/fga/list_filters.py +24 -0
  61. workos/types/fga/warnings.py +33 -0
  62. workos/types/fga/warrant.py +49 -0
  63. workos/types/list_resource.py +198 -0
  64. workos/types/metadata.py +4 -0
  65. workos/types/mfa/__init__.py +5 -0
  66. workos/types/mfa/authentication_challenge.py +14 -0
  67. workos/types/mfa/authentication_challenge_verification_response.py +9 -0
  68. workos/types/mfa/authentication_factor.py +70 -0
  69. workos/types/mfa/authentication_factor_totp_and_challenge_response.py +10 -0
  70. workos/types/mfa/enroll_authentication_factor_type.py +8 -0
  71. workos/types/organization_domains/__init__.py +1 -0
  72. workos/types/organization_domains/organization_domain.py +18 -0
  73. workos/types/organizations/__init__.py +6 -0
  74. workos/types/organizations/domain_data_input.py +7 -0
  75. workos/types/organizations/list_filters.py +6 -0
  76. workos/types/organizations/organization.py +13 -0
  77. workos/types/organizations/organization_common.py +12 -0
  78. workos/types/passwordless/__init__.py +2 -0
  79. workos/types/passwordless/passwordless_session.py +12 -0
  80. workos/types/passwordless/passwordless_session_type.py +3 -0
  81. workos/types/pipes/__init__.py +6 -0
  82. workos/types/pipes/pipes.py +34 -0
  83. workos/types/portal/__init__.py +2 -0
  84. workos/types/portal/portal_link.py +7 -0
  85. workos/types/portal/portal_link_intent.py +11 -0
  86. workos/types/portal/portal_link_intent_options.py +9 -0
  87. workos/types/roles/__init__.py +0 -0
  88. workos/types/roles/role.py +27 -0
  89. workos/types/sso/__init__.py +4 -0
  90. workos/types/sso/connection.py +70 -0
  91. workos/types/sso/connection_domain.py +8 -0
  92. workos/types/sso/profile.py +35 -0
  93. workos/types/sso/sso_provider_type.py +10 -0
  94. workos/types/user_management/__init__.py +12 -0
  95. workos/types/user_management/authenticate_with_common.py +66 -0
  96. workos/types/user_management/authentication_response.py +53 -0
  97. workos/types/user_management/email_verification.py +18 -0
  98. workos/types/user_management/impersonator.py +8 -0
  99. workos/types/user_management/invitation.py +26 -0
  100. workos/types/user_management/list_filters.py +29 -0
  101. workos/types/user_management/magic_auth.py +18 -0
  102. workos/types/user_management/oauth_tokens.py +21 -0
  103. workos/types/user_management/organization_membership.py +25 -0
  104. workos/types/user_management/password_hash_type.py +4 -0
  105. workos/types/user_management/password_reset.py +18 -0
  106. workos/types/user_management/screen_hint.py +3 -0
  107. workos/types/user_management/session.py +79 -0
  108. workos/types/user_management/user.py +22 -0
  109. workos/types/user_management/user_management_provider_type.py +11 -0
  110. workos/types/vault/__init__.py +2 -0
  111. workos/types/vault/key.py +25 -0
  112. workos/types/vault/object.py +38 -0
  113. workos/types/webhooks/__init__.py +0 -0
  114. workos/types/webhooks/webhook.py +330 -0
  115. workos/types/webhooks/webhook_model.py +14 -0
  116. workos/types/webhooks/webhook_payload.py +4 -0
  117. workos/types/widgets/__init__.py +2 -0
  118. workos/types/widgets/widget_scope.py +4 -0
  119. workos/types/widgets/widget_token_response.py +7 -0
  120. workos/types/workos_model.py +26 -0
  121. workos/typing/__init__.py +1 -0
  122. workos/typing/literals.py +32 -0
  123. workos/typing/sync_or_async.py +5 -0
  124. workos/typing/untyped_literal.py +37 -0
  125. workos/typing/webhooks.py +18 -0
  126. workos/user_management.py +2400 -0
  127. workos/utils/_base_http_client.py +252 -0
  128. workos/utils/crypto_provider.py +39 -0
  129. workos/utils/http_client.py +214 -0
  130. workos/utils/pagination_order.py +4 -0
  131. workos/utils/request_helper.py +27 -0
  132. workos/vault.py +544 -0
  133. workos/webhooks.py +96 -39
  134. workos/widgets.py +55 -0
  135. {workos-1.13.0.dist-info → workos-5.38.0.dist-info}/LICENSE +1 -1
  136. {workos-1.13.0.dist-info → workos-5.38.0.dist-info}/METADATA +47 -22
  137. workos-5.38.0.dist-info/RECORD +141 -0
  138. {workos-1.13.0.dist-info → workos-5.38.0.dist-info}/WHEEL +1 -1
  139. workos/audit_trail.py +0 -179
  140. workos/resources/base.py +0 -36
  141. workos/resources/directory_sync.py +0 -28
  142. workos/resources/event.py +0 -42
  143. workos/resources/event_action.py +0 -11
  144. workos/resources/mfa.py +0 -32
  145. workos/resources/sso.py +0 -53
  146. workos/utils/connection_types.py +0 -35
  147. workos/utils/pagiantion_order.py +0 -6
  148. workos/utils/request.py +0 -100
  149. workos/utils/validation.py +0 -60
  150. workos-1.13.0.dist-info/RECORD +0 -29
  151. /workos/{resources/__init__.py → py.typed} +0 -0
  152. {workos-1.13.0.dist-info → workos-5.38.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,21 @@
1
+ from typing import Literal, Sequence
2
+
3
+ from workos.types.workos_model import WorkOSModel
4
+
5
+ OAuthTokensProvidersType = Literal[
6
+ "AppleOauth",
7
+ "GitHubOauth",
8
+ "GoogleOauth",
9
+ "MicrosoftOauth",
10
+ "SalesforceOauth",
11
+ ]
12
+
13
+
14
+ class OAuthTokens(WorkOSModel):
15
+ """Representation of a WorkOS Dashboard member impersonating a user"""
16
+
17
+ provider: OAuthTokensProvidersType
18
+ access_token: str
19
+ refresh_token: str
20
+ expires_at: int
21
+ scopes: Sequence[str]
@@ -0,0 +1,25 @@
1
+ from typing import Literal, Sequence, Optional
2
+ from typing_extensions import TypedDict
3
+
4
+ from workos.types.workos_model import WorkOSModel
5
+ from workos.typing.literals import LiteralOrUntyped
6
+
7
+ OrganizationMembershipStatus = Literal["active", "inactive", "pending"]
8
+
9
+
10
+ class OrganizationMembershipRole(TypedDict):
11
+ slug: str
12
+
13
+
14
+ class OrganizationMembership(WorkOSModel):
15
+ """Representation of an WorkOS Organization Membership."""
16
+
17
+ object: Literal["organization_membership"]
18
+ id: str
19
+ user_id: str
20
+ organization_id: str
21
+ role: OrganizationMembershipRole
22
+ roles: Optional[Sequence[OrganizationMembershipRole]] = None
23
+ status: LiteralOrUntyped[OrganizationMembershipStatus]
24
+ created_at: str
25
+ updated_at: str
@@ -0,0 +1,4 @@
1
+ from typing import Literal
2
+
3
+
4
+ PasswordHashType = Literal["bcrypt", "firebase-scrypt", "ssha"]
@@ -0,0 +1,18 @@
1
+ from typing import Literal
2
+ from workos.types.workos_model import WorkOSModel
3
+
4
+
5
+ class PasswordResetCommon(WorkOSModel):
6
+ object: Literal["password_reset"]
7
+ id: str
8
+ user_id: str
9
+ email: str
10
+ expires_at: str
11
+ created_at: str
12
+
13
+
14
+ class PasswordReset(PasswordResetCommon):
15
+ """Representation of a WorkOS PasswordReset object."""
16
+
17
+ password_reset_token: str
18
+ password_reset_url: str
@@ -0,0 +1,3 @@
1
+ from typing import Literal
2
+
3
+ ScreenHintType = Literal["sign-up", "sign-in"]
@@ -0,0 +1,79 @@
1
+ from enum import Enum
2
+ from typing import Optional, Sequence, TypedDict, Union
3
+
4
+ from typing_extensions import Literal
5
+
6
+ from workos.types.user_management.impersonator import Impersonator
7
+ from workos.types.user_management.user import User
8
+ from workos.types.workos_model import WorkOSModel
9
+
10
+
11
+ class AuthenticateWithSessionCookieFailureReason(Enum):
12
+ INVALID_JWT = "invalid_jwt"
13
+ INVALID_SESSION_COOKIE = "invalid_session_cookie"
14
+ NO_SESSION_COOKIE_PROVIDED = "no_session_cookie_provided"
15
+
16
+
17
+ class AuthenticateWithSessionCookieSuccessResponse(WorkOSModel):
18
+ authenticated: Literal[True]
19
+ session_id: str
20
+ organization_id: Optional[str] = None
21
+ role: Optional[str] = None
22
+ roles: Optional[Sequence[str]] = None
23
+ permissions: Optional[Sequence[str]] = None
24
+ user: User
25
+ impersonator: Optional[Impersonator] = None
26
+ entitlements: Optional[Sequence[str]] = None
27
+ feature_flags: Optional[Sequence[str]] = None
28
+
29
+
30
+ class AuthenticateWithSessionCookieErrorResponse(WorkOSModel):
31
+ authenticated: Literal[False]
32
+ reason: Union[AuthenticateWithSessionCookieFailureReason, str]
33
+
34
+
35
+ class RefreshWithSessionCookieSuccessResponse(
36
+ AuthenticateWithSessionCookieSuccessResponse
37
+ ):
38
+ sealed_session: str
39
+
40
+
41
+ class RefreshWithSessionCookieErrorResponse(WorkOSModel):
42
+ authenticated: Literal[False]
43
+ reason: Union[AuthenticateWithSessionCookieFailureReason, str]
44
+
45
+
46
+ class SessionConfig(TypedDict, total=False):
47
+ seal_session: bool
48
+ cookie_password: str
49
+
50
+
51
+ AuthMethodType = Literal[
52
+ "external_auth",
53
+ "impersonation",
54
+ "magic_code",
55
+ "migrated_session",
56
+ "oauth",
57
+ "passkey",
58
+ "password",
59
+ "sso",
60
+ "unknown",
61
+ ]
62
+
63
+
64
+ class Session(WorkOSModel):
65
+ """Representation of a WorkOS User Management Session."""
66
+
67
+ object: Literal["session"]
68
+ id: str
69
+ user_id: str
70
+ organization_id: Optional[str] = None
71
+ status: str
72
+ auth_method: AuthMethodType
73
+ impersonator: Optional[Impersonator] = None
74
+ ip_address: Optional[str] = None
75
+ user_agent: Optional[str] = None
76
+ expires_at: str
77
+ ended_at: Optional[str] = None
78
+ created_at: str
79
+ updated_at: str
@@ -0,0 +1,22 @@
1
+ from dataclasses import field
2
+ from typing import Literal, Optional
3
+ from workos.types.metadata import Metadata
4
+ from workos.types.workos_model import WorkOSModel
5
+
6
+
7
+ class User(WorkOSModel):
8
+ """Representation of a WorkOS User."""
9
+
10
+ object: Literal["user"]
11
+ id: str
12
+ email: str
13
+ first_name: Optional[str] = None
14
+ last_name: Optional[str] = None
15
+ email_verified: bool
16
+ profile_picture_url: Optional[str] = None
17
+ last_sign_in_at: Optional[str] = None
18
+ locale: Optional[str] = None
19
+ created_at: str
20
+ updated_at: str
21
+ external_id: Optional[str] = None
22
+ metadata: Metadata = field(default_factory=dict)
@@ -0,0 +1,11 @@
1
+ from typing import Literal
2
+
3
+
4
+ UserManagementProviderType = Literal[
5
+ "authkit",
6
+ "AppleOAuth",
7
+ "GitHubOAuth",
8
+ "GoogleOAuth",
9
+ "MicrosoftOAuth",
10
+ "SalesforceOAuth",
11
+ ]
@@ -0,0 +1,2 @@
1
+ from .key import *
2
+ from .object import *
@@ -0,0 +1,25 @@
1
+ from typing import Dict
2
+ from pydantic import BaseModel, RootModel
3
+ from workos.types.workos_model import WorkOSModel
4
+
5
+
6
+ class KeyContext(RootModel[Dict[str, str]]):
7
+ pass
8
+
9
+
10
+ class DataKey(WorkOSModel):
11
+ id: str
12
+ key: str
13
+
14
+
15
+ class DataKeyPair(WorkOSModel):
16
+ context: KeyContext
17
+ data_key: DataKey
18
+ encrypted_keys: str
19
+
20
+
21
+ class DecodedKeys(BaseModel):
22
+ iv: bytes
23
+ tag: bytes
24
+ keys: str # Base64-encoded string
25
+ ciphertext: bytes
@@ -0,0 +1,38 @@
1
+ from typing import Optional
2
+
3
+ from workos.types.workos_model import WorkOSModel
4
+ from workos.types.vault import KeyContext
5
+
6
+
7
+ class ObjectDigest(WorkOSModel):
8
+ id: str
9
+ name: str
10
+ updated_at: str
11
+
12
+
13
+ class ObjectUpdateBy(WorkOSModel):
14
+ id: str
15
+ name: str
16
+
17
+
18
+ class ObjectMetadata(WorkOSModel):
19
+ context: KeyContext
20
+ environment_id: str
21
+ id: str
22
+ key_id: str
23
+ updated_at: str
24
+ updated_by: ObjectUpdateBy
25
+ version_id: str
26
+
27
+
28
+ class VaultObject(WorkOSModel):
29
+ id: str
30
+ metadata: ObjectMetadata
31
+ name: str
32
+ value: Optional[str] = None
33
+
34
+
35
+ class ObjectVersion(WorkOSModel):
36
+ created_at: str
37
+ current_version: bool
38
+ id: str
File without changes
@@ -0,0 +1,330 @@
1
+ from typing import Literal, Union
2
+
3
+ from pydantic import Field
4
+ from typing_extensions import Annotated
5
+
6
+ from workos.types.directory_sync import DirectoryGroup
7
+ from workos.types.directory_sync.directory_user import DirectoryUser
8
+ from workos.types.events.authentication_payload import (
9
+ AuthenticationEmailVerificationSucceededPayload,
10
+ AuthenticationMagicAuthFailedPayload,
11
+ AuthenticationMagicAuthSucceededPayload,
12
+ AuthenticationMfaSucceededPayload,
13
+ AuthenticationOauthFailedPayload,
14
+ AuthenticationOauthSucceededPayload,
15
+ AuthenticationPasswordFailedPayload,
16
+ AuthenticationPasswordSucceededPayload,
17
+ AuthenticationSsoFailedPayload,
18
+ AuthenticationSsoSucceededPayload,
19
+ )
20
+ from workos.types.events.connection_payload_with_legacy_fields import (
21
+ ConnectionPayloadWithLegacyFields,
22
+ )
23
+ from workos.types.events.directory_group_membership_payload import (
24
+ DirectoryGroupMembershipPayload,
25
+ )
26
+ from workos.types.events.directory_group_with_previous_attributes import (
27
+ DirectoryGroupWithPreviousAttributes,
28
+ )
29
+ from workos.types.events.directory_payload import DirectoryPayload
30
+ from workos.types.events.directory_payload_with_legacy_fields import (
31
+ DirectoryPayloadWithLegacyFields,
32
+ )
33
+ from workos.types.events.directory_user_with_previous_attributes import (
34
+ DirectoryUserWithPreviousAttributes,
35
+ )
36
+ from workos.types.events.organization_domain_verification_failed_payload import (
37
+ OrganizationDomainVerificationFailedPayload,
38
+ )
39
+ from workos.types.events.session_payload import (
40
+ SessionCreatedPayload,
41
+ SessionRevokedPayload,
42
+ )
43
+ from workos.types.organization_domains import OrganizationDomain
44
+ from workos.types.organizations.organization_common import OrganizationCommon
45
+ from workos.types.roles.role import EventRole
46
+ from workos.types.sso.connection import Connection
47
+ from workos.types.user_management import OrganizationMembership, User
48
+ from workos.types.user_management.email_verification import (
49
+ EmailVerificationCommon,
50
+ )
51
+ from workos.types.user_management.invitation import InvitationCommon
52
+ from workos.types.user_management.magic_auth import MagicAuthCommon
53
+ from workos.types.user_management.password_reset import PasswordResetCommon
54
+ from workos.types.webhooks.webhook_model import WebhookModel
55
+
56
+ # README
57
+ # When adding a new webhook event type, ensure the new webhook class is
58
+ # added to the Webhook union type at the bottom of this file.
59
+
60
+
61
+ class AuthenticationEmailVerificationSucceededWebhook(
62
+ WebhookModel[AuthenticationEmailVerificationSucceededPayload,]
63
+ ):
64
+ event: Literal["authentication.email_verification_succeeded"]
65
+
66
+
67
+ class AuthenticationMagicAuthFailedWebhook(
68
+ WebhookModel[AuthenticationMagicAuthFailedPayload,]
69
+ ):
70
+ event: Literal["authentication.magic_auth_failed"]
71
+
72
+
73
+ class AuthenticationMagicAuthSucceededWebhook(
74
+ WebhookModel[AuthenticationMagicAuthSucceededPayload,]
75
+ ):
76
+ event: Literal["authentication.magic_auth_succeeded"]
77
+
78
+
79
+ class AuthenticationMfaSucceededWebhook(
80
+ WebhookModel[AuthenticationMfaSucceededPayload]
81
+ ):
82
+ event: Literal["authentication.mfa_succeeded"]
83
+
84
+
85
+ class AuthenticationOauthFailedWebhook(WebhookModel[AuthenticationOauthFailedPayload]):
86
+ event: Literal["authentication.oauth_failed"]
87
+
88
+
89
+ class AuthenticationOauthSucceededWebhook(
90
+ WebhookModel[AuthenticationOauthSucceededPayload]
91
+ ):
92
+ event: Literal["authentication.oauth_succeeded"]
93
+
94
+
95
+ class AuthenticationPasswordFailedWebhook(
96
+ WebhookModel[AuthenticationPasswordFailedPayload]
97
+ ):
98
+ event: Literal["authentication.password_failed"]
99
+
100
+
101
+ class AuthenticationPasswordSucceededWebhook(
102
+ WebhookModel[AuthenticationPasswordSucceededPayload,]
103
+ ):
104
+ event: Literal["authentication.password_succeeded"]
105
+
106
+
107
+ class AuthenticationSsoFailedWebhook(WebhookModel[AuthenticationSsoFailedPayload]):
108
+ event: Literal["authentication.sso_failed"]
109
+
110
+
111
+ class AuthenticationSsoSucceededWebhook(
112
+ WebhookModel[AuthenticationSsoSucceededPayload]
113
+ ):
114
+ event: Literal["authentication.sso_succeeded"]
115
+
116
+
117
+ class ConnectionActivatedWebhook(WebhookModel[ConnectionPayloadWithLegacyFields]):
118
+ event: Literal["connection.activated"]
119
+
120
+
121
+ class ConnectionDeactivatedWebhook(WebhookModel[ConnectionPayloadWithLegacyFields]):
122
+ event: Literal["connection.deactivated"]
123
+
124
+
125
+ class ConnectionDeletedWebhook(WebhookModel[Connection]):
126
+ event: Literal["connection.deleted"]
127
+
128
+
129
+ class DirectoryActivatedWebhook(WebhookModel[DirectoryPayloadWithLegacyFields]):
130
+ event: Literal["dsync.activated"]
131
+
132
+
133
+ class DirectoryDeletedWebhook(WebhookModel[DirectoryPayload]):
134
+ event: Literal["dsync.deleted"]
135
+
136
+
137
+ class DirectoryGroupCreatedWebhook(WebhookModel[DirectoryGroup]):
138
+ event: Literal["dsync.group.created"]
139
+
140
+
141
+ class DirectoryGroupDeletedWebhook(WebhookModel[DirectoryGroup]):
142
+ event: Literal["dsync.group.deleted"]
143
+
144
+
145
+ class DirectoryGroupUpdatedWebhook(WebhookModel[DirectoryGroupWithPreviousAttributes]):
146
+ event: Literal["dsync.group.updated"]
147
+
148
+
149
+ class DirectoryUserCreatedWebhook(WebhookModel[DirectoryUser]):
150
+ event: Literal["dsync.user.created"]
151
+
152
+
153
+ class DirectoryUserDeletedWebhook(WebhookModel[DirectoryUser]):
154
+ event: Literal["dsync.user.deleted"]
155
+
156
+
157
+ class DirectoryUserUpdatedWebhook(WebhookModel[DirectoryUserWithPreviousAttributes]):
158
+ event: Literal["dsync.user.updated"]
159
+
160
+
161
+ class DirectoryUserAddedToGroupWebhook(WebhookModel[DirectoryGroupMembershipPayload]):
162
+ event: Literal["dsync.group.user_added"]
163
+
164
+
165
+ class DirectoryUserRemovedFromGroupWebhook(
166
+ WebhookModel[DirectoryGroupMembershipPayload]
167
+ ):
168
+ event: Literal["dsync.group.user_removed"]
169
+
170
+
171
+ class EmailVerificationCreatedWebhook(WebhookModel[EmailVerificationCommon]):
172
+ event: Literal["email_verification.created"]
173
+
174
+
175
+ class InvitationAcceptedWebhook(WebhookModel[InvitationCommon]):
176
+ event: Literal["invitation.accepted"]
177
+
178
+
179
+ class InvitationCreatedWebhook(WebhookModel[InvitationCommon]):
180
+ event: Literal["invitation.created"]
181
+
182
+
183
+ class InvitationRevokedWebhook(WebhookModel[InvitationCommon]):
184
+ event: Literal["invitation.revoked"]
185
+
186
+
187
+ class MagicAuthCreatedWebhook(WebhookModel[MagicAuthCommon]):
188
+ event: Literal["magic_auth.created"]
189
+
190
+
191
+ class OrganizationCreatedWebhook(WebhookModel[OrganizationCommon]):
192
+ event: Literal["organization.created"]
193
+
194
+
195
+ class OrganizationDeletedWebhook(WebhookModel[OrganizationCommon]):
196
+ event: Literal["organization.deleted"]
197
+
198
+
199
+ class OrganizationUpdatedWebhook(WebhookModel[OrganizationCommon]):
200
+ event: Literal["organization.updated"]
201
+
202
+
203
+ class OrganizationDomainVerificationFailedWebhook(
204
+ WebhookModel[OrganizationDomainVerificationFailedPayload,]
205
+ ):
206
+ event: Literal["organization_domain.verification_failed"]
207
+
208
+
209
+ class OrganizationDomainVerifiedWebhook(WebhookModel[OrganizationDomain]):
210
+ event: Literal["organization_domain.verified"]
211
+
212
+
213
+ class OrganizationDomainCreatedWebhook(WebhookModel[OrganizationDomain]):
214
+ event: Literal["organization_domain.created"]
215
+
216
+
217
+ class OrganizationDomainUpdatedWebhook(WebhookModel[OrganizationDomain]):
218
+ event: Literal["organization_domain.updated"]
219
+
220
+
221
+ class OrganizationDomainDeletedWebhook(WebhookModel[OrganizationDomain]):
222
+ event: Literal["organization_domain.deleted"]
223
+
224
+
225
+ class OrganizationMembershipCreatedWebhook(WebhookModel[OrganizationMembership]):
226
+ event: Literal["organization_membership.created"]
227
+
228
+
229
+ class OrganizationMembershipDeletedWebhook(WebhookModel[OrganizationMembership]):
230
+ event: Literal["organization_membership.deleted"]
231
+
232
+
233
+ class OrganizationMembershipUpdatedWebhook(WebhookModel[OrganizationMembership]):
234
+ event: Literal["organization_membership.updated"]
235
+
236
+
237
+ class PasswordResetCreatedWebhook(WebhookModel[PasswordResetCommon]):
238
+ event: Literal["password_reset.created"]
239
+
240
+
241
+ class PasswordResetSucceededWebhook(WebhookModel[PasswordResetCommon]):
242
+ event: Literal["password_reset.succeeded"]
243
+
244
+
245
+ class RoleCreatedWebhook(WebhookModel[EventRole]):
246
+ event: Literal["role.created"]
247
+
248
+
249
+ class RoleDeletedWebhook(WebhookModel[EventRole]):
250
+ event: Literal["role.deleted"]
251
+
252
+
253
+ class RoleUpdatedWebhook(WebhookModel[EventRole]):
254
+ event: Literal["role.updated"]
255
+
256
+
257
+ class SessionCreatedWebhook(WebhookModel[SessionCreatedPayload]):
258
+ event: Literal["session.created"]
259
+
260
+
261
+ class SessionRevokedWebhook(WebhookModel[SessionRevokedPayload]):
262
+ event: Literal["session.revoked"]
263
+
264
+
265
+ class UserCreatedWebhook(WebhookModel[User]):
266
+ event: Literal["user.created"]
267
+
268
+
269
+ class UserDeletedWebhook(WebhookModel[User]):
270
+ event: Literal["user.deleted"]
271
+
272
+
273
+ class UserUpdatedWebhook(WebhookModel[User]):
274
+ event: Literal["user.updated"]
275
+
276
+
277
+ Webhook = Annotated[
278
+ Union[
279
+ AuthenticationEmailVerificationSucceededWebhook,
280
+ AuthenticationMagicAuthFailedWebhook,
281
+ AuthenticationMagicAuthSucceededWebhook,
282
+ AuthenticationMfaSucceededWebhook,
283
+ AuthenticationOauthFailedWebhook,
284
+ AuthenticationOauthSucceededWebhook,
285
+ AuthenticationPasswordFailedWebhook,
286
+ AuthenticationPasswordSucceededWebhook,
287
+ AuthenticationSsoFailedWebhook,
288
+ AuthenticationSsoSucceededWebhook,
289
+ ConnectionActivatedWebhook,
290
+ ConnectionDeactivatedWebhook,
291
+ ConnectionDeletedWebhook,
292
+ DirectoryActivatedWebhook,
293
+ DirectoryDeletedWebhook,
294
+ DirectoryGroupCreatedWebhook,
295
+ DirectoryGroupDeletedWebhook,
296
+ DirectoryGroupUpdatedWebhook,
297
+ DirectoryUserCreatedWebhook,
298
+ DirectoryUserDeletedWebhook,
299
+ DirectoryUserUpdatedWebhook,
300
+ DirectoryUserAddedToGroupWebhook,
301
+ DirectoryUserRemovedFromGroupWebhook,
302
+ EmailVerificationCreatedWebhook,
303
+ InvitationAcceptedWebhook,
304
+ InvitationCreatedWebhook,
305
+ InvitationRevokedWebhook,
306
+ MagicAuthCreatedWebhook,
307
+ OrganizationCreatedWebhook,
308
+ OrganizationDeletedWebhook,
309
+ OrganizationUpdatedWebhook,
310
+ OrganizationDomainCreatedWebhook,
311
+ OrganizationDomainDeletedWebhook,
312
+ OrganizationDomainUpdatedWebhook,
313
+ OrganizationDomainVerificationFailedWebhook,
314
+ OrganizationDomainVerifiedWebhook,
315
+ OrganizationMembershipCreatedWebhook,
316
+ OrganizationMembershipDeletedWebhook,
317
+ OrganizationMembershipUpdatedWebhook,
318
+ PasswordResetCreatedWebhook,
319
+ PasswordResetSucceededWebhook,
320
+ RoleCreatedWebhook,
321
+ RoleDeletedWebhook,
322
+ RoleUpdatedWebhook,
323
+ SessionCreatedWebhook,
324
+ SessionRevokedWebhook,
325
+ UserCreatedWebhook,
326
+ UserDeletedWebhook,
327
+ UserUpdatedWebhook,
328
+ ],
329
+ Field(..., discriminator="event"),
330
+ ]
@@ -0,0 +1,14 @@
1
+ from typing import Generic
2
+ from workos.types.events.event_model import EventPayload
3
+ from workos.types.workos_model import WorkOSModel
4
+
5
+
6
+ class WebhookModel(WorkOSModel, Generic[EventPayload]):
7
+ """Representation of an Webhook delivered via Webhook.
8
+ Attributes:
9
+ OBJECT_FIELDS (list): List of fields an Webhook is comprised of.
10
+ """
11
+
12
+ id: str
13
+ data: EventPayload
14
+ created_at: str
@@ -0,0 +1,4 @@
1
+ from typing import Union
2
+
3
+
4
+ WebhookPayload = Union[bytes, bytearray]
@@ -0,0 +1,2 @@
1
+ from .widget_scope import *
2
+ from .widget_token_response import *
@@ -0,0 +1,4 @@
1
+ from typing import Literal
2
+
3
+
4
+ WidgetScope = Literal["widgets:users-table:manage"]
@@ -0,0 +1,7 @@
1
+ from workos.types.workos_model import WorkOSModel
2
+
3
+
4
+ class WidgetTokenResponse(WorkOSModel):
5
+ """Representation of a WorkOS widget token response."""
6
+
7
+ token: str
@@ -0,0 +1,26 @@
1
+ from typing import Any, Dict, Optional
2
+ from typing_extensions import override
3
+ from pydantic import BaseModel
4
+ from pydantic.main import IncEx
5
+
6
+
7
+ class WorkOSModel(BaseModel):
8
+ @override
9
+ def dict(
10
+ self,
11
+ *,
12
+ include: Optional[IncEx] = None,
13
+ exclude: Optional[IncEx] = None,
14
+ by_alias: bool = False,
15
+ exclude_unset: bool = False,
16
+ exclude_defaults: bool = False,
17
+ exclude_none: bool = False
18
+ ) -> Dict[str, Any]:
19
+ return self.model_dump(
20
+ include=include,
21
+ exclude=exclude,
22
+ by_alias=by_alias,
23
+ exclude_unset=exclude_unset,
24
+ exclude_defaults=exclude_defaults,
25
+ exclude_none=exclude_none,
26
+ )
@@ -0,0 +1 @@
1
+ from workos.typing.untyped_literal import is_untyped_literal