workos 1.5.1__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 (150) 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 +110 -18
  9. workos/directory_sync.py +379 -99
  10. workos/events.py +111 -0
  11. workos/exceptions.py +53 -26
  12. workos/fga.py +649 -0
  13. workos/mfa.py +205 -0
  14. workos/organization_domains.py +179 -0
  15. workos/organizations.py +403 -73
  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 +311 -101
  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.5.1.dist-info → workos-5.38.0.dist-info}/LICENSE +1 -1
  136. workos-5.38.0.dist-info/METADATA +107 -0
  137. workos-5.38.0.dist-info/RECORD +141 -0
  138. {workos-1.5.1.dist-info → workos-5.38.0.dist-info}/WHEEL +1 -1
  139. workos/audit_trail.py +0 -172
  140. workos/resources/base.py +0 -36
  141. workos/resources/event.py +0 -42
  142. workos/resources/event_action.py +0 -11
  143. workos/resources/sso.py +0 -53
  144. workos/utils/connection_types.py +0 -17
  145. workos/utils/request.py +0 -95
  146. workos/utils/validation.py +0 -45
  147. workos-1.5.1.dist-info/METADATA +0 -77
  148. workos-1.5.1.dist-info/RECORD +0 -25
  149. /workos/{resources/__init__.py → py.typed} +0 -0
  150. {workos-1.5.1.dist-info → workos-5.38.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,70 @@
1
+ from typing import Literal, Optional, Union
2
+
3
+ from workos.types.workos_model import WorkOSModel
4
+ from workos.types.mfa.enroll_authentication_factor_type import (
5
+ SmsAuthenticationFactorType,
6
+ TotpAuthenticationFactorType,
7
+ )
8
+ from workos.typing.literals import LiteralOrUntyped
9
+
10
+
11
+ AuthenticationFactorType = Literal[
12
+ "generic_otp", SmsAuthenticationFactorType, TotpAuthenticationFactorType
13
+ ]
14
+
15
+
16
+ class TotpFactor(WorkOSModel):
17
+ """Representation of a TOTP factor when returned in list resources and sessions."""
18
+
19
+ issuer: str
20
+ user: str
21
+
22
+
23
+ class ExtendedTotpFactor(TotpFactor):
24
+ """Representation of a TOTP factor when returned when enrolling an authentication factor."""
25
+
26
+ qr_code: str
27
+ secret: str
28
+ uri: str
29
+
30
+
31
+ class SmsFactor(WorkOSModel):
32
+ phone_number: str
33
+
34
+
35
+ class AuthenticationFactorBase(WorkOSModel):
36
+ """Representation of a MFA Authentication Factor Response as returned by WorkOS through the MFA feature."""
37
+
38
+ object: Literal["authentication_factor"]
39
+ id: str
40
+ created_at: str
41
+ updated_at: str
42
+ type: LiteralOrUntyped[AuthenticationFactorType]
43
+ user_id: Optional[str] = None
44
+
45
+
46
+ class AuthenticationFactorTotp(AuthenticationFactorBase):
47
+ """Representation of a MFA Authentication Factor Response as returned by WorkOS through the MFA feature."""
48
+
49
+ type: TotpAuthenticationFactorType
50
+ totp: TotpFactor
51
+
52
+
53
+ class AuthenticationFactorTotpExtended(AuthenticationFactorBase):
54
+ """Representation of a MFA Authentication Factor Response when enrolling an authentication factor."""
55
+
56
+ type: TotpAuthenticationFactorType
57
+ totp: ExtendedTotpFactor
58
+
59
+
60
+ class AuthenticationFactorSms(AuthenticationFactorBase):
61
+ """Representation of a SMS Authentication Factor Response as returned by WorkOS through the MFA feature."""
62
+
63
+ type: SmsAuthenticationFactorType
64
+ sms: SmsFactor
65
+
66
+
67
+ AuthenticationFactor = Union[AuthenticationFactorTotp, AuthenticationFactorSms]
68
+ AuthenticationFactorExtended = Union[
69
+ AuthenticationFactorTotpExtended, AuthenticationFactorSms
70
+ ]
@@ -0,0 +1,10 @@
1
+ from workos.types.workos_model import WorkOSModel
2
+ from workos.types.mfa.authentication_challenge import AuthenticationChallenge
3
+ from workos.types.mfa.authentication_factor import AuthenticationFactorTotpExtended
4
+
5
+
6
+ class AuthenticationFactorTotpAndChallengeResponse(WorkOSModel):
7
+ """Representation of an authentication factor and authentication challenge response as returned by WorkOS through User Management features."""
8
+
9
+ authentication_factor: AuthenticationFactorTotpExtended
10
+ authentication_challenge: AuthenticationChallenge
@@ -0,0 +1,8 @@
1
+ from typing import Literal
2
+
3
+ SmsAuthenticationFactorType = Literal["sms"]
4
+ TotpAuthenticationFactorType = Literal["totp"]
5
+
6
+ EnrollAuthenticationFactorType = Literal[
7
+ SmsAuthenticationFactorType, TotpAuthenticationFactorType
8
+ ]
@@ -0,0 +1 @@
1
+ from .organization_domain import *
@@ -0,0 +1,18 @@
1
+ from typing import Literal, Optional
2
+ from workos.types.workos_model import WorkOSModel
3
+ from workos.typing.literals import LiteralOrUntyped
4
+
5
+
6
+ class OrganizationDomain(WorkOSModel):
7
+ id: str
8
+ organization_id: str
9
+ object: Literal["organization_domain"]
10
+ domain: str
11
+ state: Optional[
12
+ LiteralOrUntyped[Literal["failed", "pending", "legacy_verified", "verified"]]
13
+ ] = None
14
+ verification_strategy: Optional[LiteralOrUntyped[Literal["manual", "dns"]]] = None
15
+ verification_token: Optional[str] = None
16
+ verification_prefix: Optional[str] = None
17
+ created_at: str
18
+ updated_at: str
@@ -0,0 +1,6 @@
1
+ from .domain_data_input import *
2
+ from .organization_common import *
3
+ from .organization import *
4
+
5
+ # re-exported for backwards compatibility, can be removed after version 6.0.0
6
+ from workos.types.organization_domains import OrganizationDomain
@@ -0,0 +1,7 @@
1
+ from typing import Literal
2
+ from typing_extensions import TypedDict
3
+
4
+
5
+ class DomainDataInput(TypedDict):
6
+ domain: str
7
+ state: Literal["verified", "pending"]
@@ -0,0 +1,6 @@
1
+ from typing import Optional, Sequence
2
+ from workos.types.list_resource import ListArgs
3
+
4
+
5
+ class OrganizationListFilters(ListArgs, total=False):
6
+ domains: Optional[Sequence[str]]
@@ -0,0 +1,13 @@
1
+ from dataclasses import field
2
+ from typing import Optional, Sequence
3
+ from workos.types.metadata import Metadata
4
+ from workos.types.organizations.organization_common import OrganizationCommon
5
+ from workos.types.organization_domains import OrganizationDomain
6
+
7
+
8
+ class Organization(OrganizationCommon):
9
+ allow_profiles_outside_organization: bool
10
+ domains: Sequence[OrganizationDomain]
11
+ stripe_customer_id: Optional[str] = None
12
+ external_id: Optional[str] = None
13
+ metadata: Metadata = field(default_factory=dict)
@@ -0,0 +1,12 @@
1
+ from typing import Literal, Sequence
2
+ from workos.types.workos_model import WorkOSModel
3
+ from workos.types.organization_domains import OrganizationDomain
4
+
5
+
6
+ class OrganizationCommon(WorkOSModel):
7
+ id: str
8
+ object: Literal["organization"]
9
+ name: str
10
+ domains: Sequence[OrganizationDomain]
11
+ created_at: str
12
+ updated_at: str
@@ -0,0 +1,2 @@
1
+ from .passwordless_session_type import *
2
+ from .passwordless_session import *
@@ -0,0 +1,12 @@
1
+ from typing import Literal
2
+ from workos.types.workos_model import WorkOSModel
3
+
4
+
5
+ class PasswordlessSession(WorkOSModel):
6
+ """Representation of a WorkOS Passwordless Session Response."""
7
+
8
+ object: Literal["passwordless_session"]
9
+ id: str
10
+ email: str
11
+ expires_at: str
12
+ link: str
@@ -0,0 +1,3 @@
1
+ from typing import Literal
2
+
3
+ PasswordlessSessionType = Literal["MagicLink"]
@@ -0,0 +1,6 @@
1
+ from workos.types.pipes.pipes import (
2
+ AccessToken as AccessToken,
3
+ GetAccessTokenFailureResponse as GetAccessTokenFailureResponse,
4
+ GetAccessTokenResponse as GetAccessTokenResponse,
5
+ GetAccessTokenSuccessResponse as GetAccessTokenSuccessResponse,
6
+ )
@@ -0,0 +1,34 @@
1
+ from datetime import datetime
2
+ from typing import Literal, Optional, Sequence, Union
3
+
4
+ from workos.types.workos_model import WorkOSModel
5
+
6
+
7
+ class AccessToken(WorkOSModel):
8
+ """Represents an OAuth access token for a third-party provider."""
9
+
10
+ object: Literal["access_token"]
11
+ access_token: str
12
+ expires_at: Optional[datetime] = None
13
+ scopes: Sequence[str]
14
+ missing_scopes: Sequence[str]
15
+
16
+
17
+ class GetAccessTokenSuccessResponse(WorkOSModel):
18
+ """Successful response containing the access token."""
19
+
20
+ active: Literal[True]
21
+ access_token: AccessToken
22
+
23
+
24
+ class GetAccessTokenFailureResponse(WorkOSModel):
25
+ """Failed response indicating why the token couldn't be retrieved."""
26
+
27
+ active: Literal[False]
28
+ error: Literal["not_installed", "needs_reauthorization"]
29
+
30
+
31
+ GetAccessTokenResponse = Union[
32
+ GetAccessTokenSuccessResponse,
33
+ GetAccessTokenFailureResponse,
34
+ ]
@@ -0,0 +1,2 @@
1
+ from .portal_link_intent import *
2
+ from .portal_link import *
@@ -0,0 +1,7 @@
1
+ from workos.types.workos_model import WorkOSModel
2
+
3
+
4
+ class PortalLink(WorkOSModel):
5
+ """Representation of an WorkOS generate portal link response."""
6
+
7
+ link: str
@@ -0,0 +1,11 @@
1
+ from typing import Literal
2
+
3
+
4
+ PortalLinkIntent = Literal[
5
+ "audit_logs",
6
+ "certificate_renewal",
7
+ "domain_verification",
8
+ "dsync",
9
+ "log_streams",
10
+ "sso",
11
+ ]
@@ -0,0 +1,9 @@
1
+ from typing import TypedDict
2
+
3
+
4
+ class SsoIntentOptions(TypedDict):
5
+ bookmark_slug: str
6
+
7
+
8
+ class IntentOptions(TypedDict):
9
+ sso: SsoIntentOptions
File without changes
@@ -0,0 +1,27 @@
1
+ from typing import Literal, Optional, Sequence
2
+ from workos.types.workos_model import WorkOSModel
3
+
4
+ RoleType = Literal["EnvironmentRole", "OrganizationRole"]
5
+
6
+
7
+ class RoleCommon(WorkOSModel):
8
+ object: Literal["role"]
9
+ slug: str
10
+
11
+
12
+ class EventRole(RoleCommon):
13
+ permissions: Optional[Sequence[str]] = None
14
+
15
+
16
+ class Role(RoleCommon):
17
+ id: str
18
+ name: str
19
+ description: Optional[str] = None
20
+ type: RoleType
21
+ created_at: str
22
+ updated_at: str
23
+
24
+
25
+ class RoleList(WorkOSModel):
26
+ object: Literal["list"]
27
+ data: Sequence[Role]
@@ -0,0 +1,4 @@
1
+ from .connection_domain import *
2
+ from .connection import *
3
+ from .profile import *
4
+ from .sso_provider_type import *
@@ -0,0 +1,70 @@
1
+ from typing import Literal, Sequence, Optional
2
+ from workos.types.sso.connection_domain import ConnectionDomain
3
+ from workos.types.workos_model import WorkOSModel
4
+ from workos.typing.literals import LiteralOrUntyped
5
+
6
+ ConnectionState = Literal[
7
+ "active", "deleting", "inactive", "requires_type", "validating"
8
+ ]
9
+
10
+ ConnectionType = Literal[
11
+ "ADFSSAML",
12
+ "AdpOidc",
13
+ "AppleOAuth",
14
+ "Auth0SAML",
15
+ "AzureSAML",
16
+ "CasSAML",
17
+ "CloudflareSAML",
18
+ "ClassLinkSAML",
19
+ "CyberArkSAML",
20
+ "DuoSAML",
21
+ "GenericOIDC",
22
+ "GenericSAML",
23
+ "GitHubOAuth",
24
+ "GoogleOAuth",
25
+ "GoogleSAML",
26
+ "JumpCloudSAML",
27
+ "KeycloakSAML",
28
+ "LastPassSAML",
29
+ "LoginGovOidc",
30
+ "MagicLink",
31
+ "MicrosoftOAuth",
32
+ "MiniOrangeSAML",
33
+ "NetIqSAML",
34
+ "OktaSAML",
35
+ "OneLoginSAML",
36
+ "OracleSAML",
37
+ "PingFederateSAML",
38
+ "PingOneSAML",
39
+ "RipplingSAML",
40
+ "SalesforceOAuth",
41
+ "SalesforceSAML",
42
+ "ShibbolethGenericSAML",
43
+ "ShibbolethSAML",
44
+ "SimpleSamlPhpSAML",
45
+ "VMwareSAML",
46
+ ]
47
+
48
+
49
+ class SamlConnectionOptions(WorkOSModel):
50
+ """Representation of options payload of a Connection Response."""
51
+
52
+ signing_cert: Optional[str]
53
+
54
+
55
+ class Connection(WorkOSModel):
56
+ object: Literal["connection"]
57
+ id: str
58
+ organization_id: Optional[str] = None
59
+ connection_type: LiteralOrUntyped[ConnectionType]
60
+ name: str
61
+ state: LiteralOrUntyped[ConnectionState]
62
+ created_at: str
63
+ updated_at: str
64
+ options: Optional[SamlConnectionOptions] = None
65
+
66
+
67
+ class ConnectionWithDomains(Connection):
68
+ """Representation of a Connection Response as returned by WorkOS through the SSO feature."""
69
+
70
+ domains: Sequence[ConnectionDomain]
@@ -0,0 +1,8 @@
1
+ from typing import Literal
2
+ from workos.types.workos_model import WorkOSModel
3
+
4
+
5
+ class ConnectionDomain(WorkOSModel):
6
+ object: Literal["connection_domain"]
7
+ id: str
8
+ domain: str
@@ -0,0 +1,35 @@
1
+ from typing import Any, Literal, Mapping, Optional, Sequence
2
+ from workos.types.sso.connection import ConnectionType
3
+ from workos.types.workos_model import WorkOSModel
4
+ from workos.typing.literals import LiteralOrUntyped
5
+ from typing_extensions import TypedDict
6
+
7
+
8
+ class ProfileRole(TypedDict):
9
+ slug: str
10
+
11
+
12
+ class Profile(WorkOSModel):
13
+ """Representation of a User Profile as returned by WorkOS through the SSO feature."""
14
+
15
+ object: Literal["profile"]
16
+ id: str
17
+ connection_id: str
18
+ connection_type: LiteralOrUntyped[ConnectionType]
19
+ organization_id: Optional[str] = None
20
+ email: str
21
+ first_name: Optional[str] = None
22
+ last_name: Optional[str] = None
23
+ idp_id: str
24
+ role: Optional[ProfileRole] = None
25
+ roles: Optional[Sequence[ProfileRole]] = None
26
+ groups: Optional[Sequence[str]] = None
27
+ custom_attributes: Optional[Mapping[str, Any]] = None
28
+ raw_attributes: Optional[Mapping[str, Any]] = None
29
+
30
+
31
+ class ProfileAndToken(WorkOSModel):
32
+ """Representation of a User Profile and Access Token as returned by WorkOS through the SSO feature."""
33
+
34
+ access_token: str
35
+ profile: Profile
@@ -0,0 +1,10 @@
1
+ from typing import Literal
2
+
3
+
4
+ SsoProviderType = Literal[
5
+ "AppleOAuth",
6
+ "GitHubOAuth",
7
+ "GoogleOAuth",
8
+ "MicrosoftOAuth",
9
+ "SalesforceOAuth",
10
+ ]
@@ -0,0 +1,12 @@
1
+ from .authenticate_with_common import *
2
+ from .authentication_response import *
3
+ from .email_verification import *
4
+ from .impersonator import *
5
+ from .invitation import *
6
+ from .magic_auth import *
7
+ from .organization_membership import *
8
+ from .password_hash_type import *
9
+ from .password_reset import *
10
+ from .user_management_provider_type import *
11
+ from .user import *
12
+ from .session import *
@@ -0,0 +1,66 @@
1
+ from typing import Literal, Union
2
+ from typing_extensions import TypedDict
3
+ from workos.types.user_management.session import SessionConfig
4
+
5
+
6
+ class AuthenticateWithBaseParameters(TypedDict):
7
+ ip_address: Union[str, None]
8
+ user_agent: Union[str, None]
9
+
10
+
11
+ class AuthenticateWithPasswordParameters(AuthenticateWithBaseParameters):
12
+ email: str
13
+ password: str
14
+ grant_type: Literal["password"]
15
+
16
+
17
+ class AuthenticateWithCodeParameters(AuthenticateWithBaseParameters):
18
+ code: str
19
+ code_verifier: Union[str, None]
20
+ grant_type: Literal["authorization_code"]
21
+ session: Union[SessionConfig, None]
22
+ invitation_token: Union[str, None]
23
+
24
+
25
+ class AuthenticateWithMagicAuthParameters(AuthenticateWithBaseParameters):
26
+ code: str
27
+ email: str
28
+ link_authorization_code: Union[str, None]
29
+ grant_type: Literal["urn:workos:oauth:grant-type:magic-auth:code"]
30
+
31
+
32
+ class AuthenticateWithEmailVerificationParameters(AuthenticateWithBaseParameters):
33
+ code: str
34
+ pending_authentication_token: str
35
+ grant_type: Literal["urn:workos:oauth:grant-type:email-verification:code"]
36
+
37
+
38
+ class AuthenticateWithTotpParameters(AuthenticateWithBaseParameters):
39
+ code: str
40
+ authentication_challenge_id: str
41
+ pending_authentication_token: str
42
+ grant_type: Literal["urn:workos:oauth:grant-type:mfa-totp"]
43
+
44
+
45
+ class AuthenticateWithOrganizationSelectionParameters(AuthenticateWithBaseParameters):
46
+ organization_id: str
47
+ pending_authentication_token: str
48
+ grant_type: Literal["urn:workos:oauth:grant-type:organization-selection"]
49
+
50
+
51
+ class AuthenticateWithRefreshTokenParameters(AuthenticateWithBaseParameters):
52
+ refresh_token: str
53
+ organization_id: Union[str, None]
54
+ grant_type: Literal["refresh_token"]
55
+ session: Union[SessionConfig, None]
56
+
57
+
58
+ AuthenticateWithParameters = Union[
59
+ AuthenticateWithPasswordParameters,
60
+ AuthenticateWithCodeParameters,
61
+ AuthenticateWithMagicAuthParameters,
62
+ AuthenticateWithEmailVerificationParameters,
63
+ AuthenticateWithTotpParameters,
64
+ AuthenticateWithOrganizationSelectionParameters,
65
+ AuthenticateWithRefreshTokenParameters,
66
+ ]
@@ -0,0 +1,53 @@
1
+ from typing import Literal, Optional, TypeVar
2
+ from workos.types.user_management.impersonator import Impersonator
3
+ from workos.types.user_management.oauth_tokens import OAuthTokens
4
+ from workos.types.user_management.user import User
5
+ from workos.types.workos_model import WorkOSModel
6
+
7
+
8
+ AuthenticationMethod = Literal[
9
+ "SSO",
10
+ "Password",
11
+ "Passkey",
12
+ "AppleOAuth",
13
+ "GitHubOAuth",
14
+ "GoogleOAuth",
15
+ "MicrosoftOAuth",
16
+ "SalesforceOAuth",
17
+ "MagicAuth",
18
+ "Impersonation",
19
+ ]
20
+
21
+
22
+ class _AuthenticationResponseBase(WorkOSModel):
23
+ access_token: str
24
+ refresh_token: str
25
+
26
+
27
+ class AuthenticationResponse(_AuthenticationResponseBase):
28
+ """Representation of a WorkOS User and Organization ID response."""
29
+
30
+ authentication_method: Optional[AuthenticationMethod] = None
31
+ impersonator: Optional[Impersonator] = None
32
+ organization_id: Optional[str] = None
33
+ user: User
34
+ sealed_session: Optional[str] = None
35
+
36
+
37
+ class AuthKitAuthenticationResponse(AuthenticationResponse):
38
+ """Representation of a WorkOS User and Organization ID response."""
39
+
40
+ impersonator: Optional[Impersonator] = None
41
+ oauth_tokens: Optional[OAuthTokens] = None
42
+
43
+
44
+ class RefreshTokenAuthenticationResponse(AuthenticationResponse):
45
+ """Representation of a WorkOS refresh token authentication response."""
46
+
47
+ pass
48
+
49
+
50
+ AuthenticationResponseType = TypeVar(
51
+ "AuthenticationResponseType",
52
+ bound=_AuthenticationResponseBase,
53
+ )
@@ -0,0 +1,18 @@
1
+ from typing import Literal
2
+ from workos.types.workos_model import WorkOSModel
3
+
4
+
5
+ class EmailVerificationCommon(WorkOSModel):
6
+ object: Literal["email_verification"]
7
+ id: str
8
+ user_id: str
9
+ email: str
10
+ expires_at: str
11
+ created_at: str
12
+ updated_at: str
13
+
14
+
15
+ class EmailVerification(EmailVerificationCommon):
16
+ """Representation of a WorkOS EmailVerification object."""
17
+
18
+ code: str
@@ -0,0 +1,8 @@
1
+ from workos.types.workos_model import WorkOSModel
2
+
3
+
4
+ class Impersonator(WorkOSModel):
5
+ """Representation of a WorkOS Dashboard member impersonating a user"""
6
+
7
+ email: str
8
+ reason: str
@@ -0,0 +1,26 @@
1
+ from typing import Literal, Optional
2
+ from workos.types.workos_model import WorkOSModel
3
+ from workos.typing.literals import LiteralOrUntyped
4
+
5
+ InvitationState = Literal["accepted", "expired", "pending", "revoked"]
6
+
7
+
8
+ class InvitationCommon(WorkOSModel):
9
+ object: Literal["invitation"]
10
+ id: str
11
+ email: str
12
+ state: LiteralOrUntyped[InvitationState]
13
+ accepted_at: Optional[str] = None
14
+ revoked_at: Optional[str] = None
15
+ expires_at: str
16
+ organization_id: Optional[str] = None
17
+ inviter_user_id: Optional[str] = None
18
+ created_at: str
19
+ updated_at: str
20
+
21
+
22
+ class Invitation(InvitationCommon):
23
+ """Representation of a WorkOS Invitation as returned."""
24
+
25
+ token: str
26
+ accept_invitation_url: str
@@ -0,0 +1,29 @@
1
+ from typing import Optional, Sequence
2
+ from workos.types.list_resource import ListArgs
3
+ from workos.types.user_management.organization_membership import (
4
+ OrganizationMembershipStatus,
5
+ )
6
+
7
+
8
+ class UsersListFilters(ListArgs, total=False):
9
+ email: Optional[str]
10
+ organization_id: Optional[str]
11
+
12
+
13
+ class InvitationsListFilters(ListArgs, total=False):
14
+ email: Optional[str]
15
+ organization_id: Optional[str]
16
+
17
+
18
+ class OrganizationMembershipsListFilters(ListArgs, total=False):
19
+ user_id: Optional[str]
20
+ organization_id: Optional[str]
21
+ statuses: Optional[Sequence[OrganizationMembershipStatus]]
22
+
23
+
24
+ class AuthenticationFactorsListFilters(ListArgs, total=False):
25
+ user_id: str
26
+
27
+
28
+ class SessionsListFilters(ListArgs, total=False):
29
+ user_id: str
@@ -0,0 +1,18 @@
1
+ from typing import Literal
2
+ from workos.types.workos_model import WorkOSModel
3
+
4
+
5
+ class MagicAuthCommon(WorkOSModel):
6
+ object: Literal["magic_auth"]
7
+ id: str
8
+ user_id: str
9
+ email: str
10
+ expires_at: str
11
+ created_at: str
12
+ updated_at: str
13
+
14
+
15
+ class MagicAuth(MagicAuthCommon):
16
+ """Representation of a WorkOS MagicAuth object."""
17
+
18
+ code: str