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.
- workos/__about__.py +1 -1
- workos/__init__.py +3 -7
- workos/_base_client.py +138 -0
- workos/_client_configuration.py +10 -0
- workos/api_keys.py +53 -0
- workos/async_client.py +144 -0
- workos/audit_logs.py +125 -0
- workos/client.py +110 -18
- workos/directory_sync.py +379 -99
- workos/events.py +111 -0
- workos/exceptions.py +53 -26
- workos/fga.py +649 -0
- workos/mfa.py +205 -0
- workos/organization_domains.py +179 -0
- workos/organizations.py +403 -73
- workos/passwordless.py +67 -43
- workos/pipes.py +93 -0
- workos/portal.py +51 -28
- workos/session.py +337 -0
- workos/sso.py +311 -101
- workos/types/__init__.py +4 -0
- workos/types/api_keys/__init__.py +1 -0
- workos/types/api_keys/api_keys.py +20 -0
- workos/types/audit_logs/__init__.py +6 -0
- workos/types/audit_logs/audit_log_event.py +16 -0
- workos/types/audit_logs/audit_log_event_actor.py +12 -0
- workos/types/audit_logs/audit_log_event_context.py +8 -0
- workos/types/audit_logs/audit_log_event_target.py +12 -0
- workos/types/audit_logs/audit_log_export.py +18 -0
- workos/types/audit_logs/audit_log_metadata.py +4 -0
- workos/types/directory_sync/__init__.py +5 -0
- workos/types/directory_sync/directory.py +31 -0
- workos/types/directory_sync/directory_group.py +16 -0
- workos/types/directory_sync/directory_state.py +28 -0
- workos/types/directory_sync/directory_type.py +24 -0
- workos/types/directory_sync/directory_user.py +50 -0
- workos/types/directory_sync/list_filters.py +21 -0
- workos/types/events/__init__.py +13 -0
- workos/types/events/authentication_payload.py +70 -0
- workos/types/events/connection_payload_with_legacy_fields.py +5 -0
- workos/types/events/directory_group_membership_payload.py +9 -0
- workos/types/events/directory_group_with_previous_attributes.py +6 -0
- workos/types/events/directory_payload.py +16 -0
- workos/types/events/directory_payload_with_legacy_fields.py +29 -0
- workos/types/events/directory_user_with_previous_attributes.py +6 -0
- workos/types/events/event.py +324 -0
- workos/types/events/event_model.py +103 -0
- workos/types/events/event_type.py +59 -0
- workos/types/events/list_filters.py +10 -0
- workos/types/events/organization_domain_verification_failed_payload.py +14 -0
- workos/types/events/previous_attributes.py +3 -0
- workos/types/events/session_payload.py +27 -0
- workos/types/feature_flags/__init__.py +3 -0
- workos/types/feature_flags/feature_flag.py +12 -0
- workos/types/feature_flags/list_filters.py +5 -0
- workos/types/fga/__init__.py +5 -0
- workos/types/fga/authorization_resource_types.py +9 -0
- workos/types/fga/authorization_resources.py +10 -0
- workos/types/fga/check.py +51 -0
- workos/types/fga/list_filters.py +24 -0
- workos/types/fga/warnings.py +33 -0
- workos/types/fga/warrant.py +49 -0
- workos/types/list_resource.py +198 -0
- workos/types/metadata.py +4 -0
- workos/types/mfa/__init__.py +5 -0
- workos/types/mfa/authentication_challenge.py +14 -0
- workos/types/mfa/authentication_challenge_verification_response.py +9 -0
- workos/types/mfa/authentication_factor.py +70 -0
- workos/types/mfa/authentication_factor_totp_and_challenge_response.py +10 -0
- workos/types/mfa/enroll_authentication_factor_type.py +8 -0
- workos/types/organization_domains/__init__.py +1 -0
- workos/types/organization_domains/organization_domain.py +18 -0
- workos/types/organizations/__init__.py +6 -0
- workos/types/organizations/domain_data_input.py +7 -0
- workos/types/organizations/list_filters.py +6 -0
- workos/types/organizations/organization.py +13 -0
- workos/types/organizations/organization_common.py +12 -0
- workos/types/passwordless/__init__.py +2 -0
- workos/types/passwordless/passwordless_session.py +12 -0
- workos/types/passwordless/passwordless_session_type.py +3 -0
- workos/types/pipes/__init__.py +6 -0
- workos/types/pipes/pipes.py +34 -0
- workos/types/portal/__init__.py +2 -0
- workos/types/portal/portal_link.py +7 -0
- workos/types/portal/portal_link_intent.py +11 -0
- workos/types/portal/portal_link_intent_options.py +9 -0
- workos/types/roles/__init__.py +0 -0
- workos/types/roles/role.py +27 -0
- workos/types/sso/__init__.py +4 -0
- workos/types/sso/connection.py +70 -0
- workos/types/sso/connection_domain.py +8 -0
- workos/types/sso/profile.py +35 -0
- workos/types/sso/sso_provider_type.py +10 -0
- workos/types/user_management/__init__.py +12 -0
- workos/types/user_management/authenticate_with_common.py +66 -0
- workos/types/user_management/authentication_response.py +53 -0
- workos/types/user_management/email_verification.py +18 -0
- workos/types/user_management/impersonator.py +8 -0
- workos/types/user_management/invitation.py +26 -0
- workos/types/user_management/list_filters.py +29 -0
- workos/types/user_management/magic_auth.py +18 -0
- workos/types/user_management/oauth_tokens.py +21 -0
- workos/types/user_management/organization_membership.py +25 -0
- workos/types/user_management/password_hash_type.py +4 -0
- workos/types/user_management/password_reset.py +18 -0
- workos/types/user_management/screen_hint.py +3 -0
- workos/types/user_management/session.py +79 -0
- workos/types/user_management/user.py +22 -0
- workos/types/user_management/user_management_provider_type.py +11 -0
- workos/types/vault/__init__.py +2 -0
- workos/types/vault/key.py +25 -0
- workos/types/vault/object.py +38 -0
- workos/types/webhooks/__init__.py +0 -0
- workos/types/webhooks/webhook.py +330 -0
- workos/types/webhooks/webhook_model.py +14 -0
- workos/types/webhooks/webhook_payload.py +4 -0
- workos/types/widgets/__init__.py +2 -0
- workos/types/widgets/widget_scope.py +4 -0
- workos/types/widgets/widget_token_response.py +7 -0
- workos/types/workos_model.py +26 -0
- workos/typing/__init__.py +1 -0
- workos/typing/literals.py +32 -0
- workos/typing/sync_or_async.py +5 -0
- workos/typing/untyped_literal.py +37 -0
- workos/typing/webhooks.py +18 -0
- workos/user_management.py +2400 -0
- workos/utils/_base_http_client.py +252 -0
- workos/utils/crypto_provider.py +39 -0
- workos/utils/http_client.py +214 -0
- workos/utils/pagination_order.py +4 -0
- workos/utils/request_helper.py +27 -0
- workos/vault.py +544 -0
- workos/webhooks.py +96 -39
- workos/widgets.py +55 -0
- {workos-1.5.1.dist-info → workos-5.38.0.dist-info}/LICENSE +1 -1
- workos-5.38.0.dist-info/METADATA +107 -0
- workos-5.38.0.dist-info/RECORD +141 -0
- {workos-1.5.1.dist-info → workos-5.38.0.dist-info}/WHEEL +1 -1
- workos/audit_trail.py +0 -172
- workos/resources/base.py +0 -36
- workos/resources/event.py +0 -42
- workos/resources/event_action.py +0 -11
- workos/resources/sso.py +0 -53
- workos/utils/connection_types.py +0 -17
- workos/utils/request.py +0 -95
- workos/utils/validation.py +0 -45
- workos-1.5.1.dist-info/METADATA +0 -77
- workos-1.5.1.dist-info/RECORD +0 -25
- /workos/{resources/__init__.py → py.typed} +0 -0
- {workos-1.5.1.dist-info → workos-5.38.0.dist-info}/top_level.txt +0 -0
workos/mfa.py
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
from typing import Optional, Protocol
|
|
2
|
+
|
|
3
|
+
from workos.types.mfa.enroll_authentication_factor_type import (
|
|
4
|
+
EnrollAuthenticationFactorType,
|
|
5
|
+
)
|
|
6
|
+
from workos.utils.http_client import SyncHTTPClient
|
|
7
|
+
from workos.utils.request_helper import (
|
|
8
|
+
REQUEST_METHOD_POST,
|
|
9
|
+
REQUEST_METHOD_DELETE,
|
|
10
|
+
REQUEST_METHOD_GET,
|
|
11
|
+
RequestHelper,
|
|
12
|
+
)
|
|
13
|
+
from workos.types.mfa import (
|
|
14
|
+
AuthenticationChallenge,
|
|
15
|
+
AuthenticationChallengeVerificationResponse,
|
|
16
|
+
AuthenticationFactor,
|
|
17
|
+
AuthenticationFactorExtended,
|
|
18
|
+
AuthenticationFactorSms,
|
|
19
|
+
AuthenticationFactorTotp,
|
|
20
|
+
AuthenticationFactorTotpExtended,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class MFAModule(Protocol):
|
|
25
|
+
"""Offers methods through the WorkOS MFA service."""
|
|
26
|
+
|
|
27
|
+
def enroll_factor(
|
|
28
|
+
self,
|
|
29
|
+
*,
|
|
30
|
+
type: EnrollAuthenticationFactorType,
|
|
31
|
+
totp_issuer: Optional[str] = None,
|
|
32
|
+
totp_user: Optional[str] = None,
|
|
33
|
+
phone_number: Optional[str] = None,
|
|
34
|
+
) -> AuthenticationFactorExtended:
|
|
35
|
+
"""
|
|
36
|
+
Defines the type of MFA authorization factor to be used. Possible values are sms or totp.
|
|
37
|
+
|
|
38
|
+
Kwargs:
|
|
39
|
+
type (str): The type of factor to be enrolled (sms or totp).
|
|
40
|
+
totp_issuer (str): Name of the Organization. Required when type is totp, ignored otherwise.
|
|
41
|
+
totp_user (str): email of user. Required when type is totp, ignored otherwise.
|
|
42
|
+
phone_number (str): phone number of the user. (Optional)
|
|
43
|
+
|
|
44
|
+
Returns:
|
|
45
|
+
AuthenticationFactor:
|
|
46
|
+
"""
|
|
47
|
+
...
|
|
48
|
+
|
|
49
|
+
def get_factor(self, authentication_factor_id: str) -> AuthenticationFactor:
|
|
50
|
+
"""
|
|
51
|
+
Returns an authorization factor from its ID.
|
|
52
|
+
|
|
53
|
+
Args:
|
|
54
|
+
authentication_factor_id (str): The ID of the factor to be obtained.
|
|
55
|
+
|
|
56
|
+
Returns:
|
|
57
|
+
AuthenticationFactor: AuthenticationFactor response from WorkOS.
|
|
58
|
+
"""
|
|
59
|
+
...
|
|
60
|
+
|
|
61
|
+
def delete_factor(self, authentication_factor_id: str) -> None:
|
|
62
|
+
"""
|
|
63
|
+
Deletes an MFA authorization factor.
|
|
64
|
+
|
|
65
|
+
Args:
|
|
66
|
+
authentication_factor_id (str): The ID of the authorization factor to be deleted.
|
|
67
|
+
|
|
68
|
+
Returns:
|
|
69
|
+
None
|
|
70
|
+
"""
|
|
71
|
+
...
|
|
72
|
+
|
|
73
|
+
def challenge_factor(
|
|
74
|
+
self, *, authentication_factor_id: str, sms_template: Optional[str] = None
|
|
75
|
+
) -> AuthenticationChallenge:
|
|
76
|
+
"""
|
|
77
|
+
Initiates the authentication process for the newly created MFA authorization factor, referred to as a challenge.
|
|
78
|
+
|
|
79
|
+
Kwargs:
|
|
80
|
+
authentication_factor_id (str): ID of the authorization factor
|
|
81
|
+
sms_template (str): Optional parameter to customize the message for sms type factors. Must include "{{code}}" if used. (Optional)
|
|
82
|
+
|
|
83
|
+
Returns:
|
|
84
|
+
AuthenticationChallenge: AuthenticationChallenge response from WorkOS.
|
|
85
|
+
"""
|
|
86
|
+
...
|
|
87
|
+
|
|
88
|
+
def verify_challenge(
|
|
89
|
+
self, *, authentication_challenge_id: str, code: str
|
|
90
|
+
) -> AuthenticationChallengeVerificationResponse:
|
|
91
|
+
"""
|
|
92
|
+
Verifies the one time password provided by the end-user.
|
|
93
|
+
|
|
94
|
+
Kwargs:
|
|
95
|
+
authentication_challenge_id (str): The ID of the authentication challenge that provided the user the verification code.
|
|
96
|
+
code (str): The verification code sent to and provided by the end user.
|
|
97
|
+
|
|
98
|
+
Returns:
|
|
99
|
+
AuthenticationChallengeVerificationResponse: AuthenticationChallengeVerificationResponse response from WorkOS.
|
|
100
|
+
"""
|
|
101
|
+
...
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
class Mfa(MFAModule):
|
|
105
|
+
"""Methods to assist in creating, challenging, and verifying Authentication Factors through the WorkOS MFA service."""
|
|
106
|
+
|
|
107
|
+
_http_client: SyncHTTPClient
|
|
108
|
+
|
|
109
|
+
def __init__(self, http_client: SyncHTTPClient):
|
|
110
|
+
self._http_client = http_client
|
|
111
|
+
|
|
112
|
+
def enroll_factor(
|
|
113
|
+
self,
|
|
114
|
+
*,
|
|
115
|
+
type: EnrollAuthenticationFactorType,
|
|
116
|
+
totp_issuer: Optional[str] = None,
|
|
117
|
+
totp_user: Optional[str] = None,
|
|
118
|
+
phone_number: Optional[str] = None,
|
|
119
|
+
) -> AuthenticationFactorExtended:
|
|
120
|
+
json = {
|
|
121
|
+
"type": type,
|
|
122
|
+
"totp_issuer": totp_issuer,
|
|
123
|
+
"totp_user": totp_user,
|
|
124
|
+
"phone_number": phone_number,
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if type == "totp" and (totp_issuer is None or totp_user is None):
|
|
128
|
+
raise ValueError(
|
|
129
|
+
"Incomplete arguments. Need to specify both totp_issuer and totp_user when type is totp"
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
if type == "sms" and phone_number is None:
|
|
133
|
+
raise ValueError(
|
|
134
|
+
"Incomplete arguments. Need to specify phone_number when type is sms"
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
response = self._http_client.request(
|
|
138
|
+
"auth/factors/enroll", method=REQUEST_METHOD_POST, json=json
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
if type == "totp":
|
|
142
|
+
return AuthenticationFactorTotpExtended.model_validate(response)
|
|
143
|
+
|
|
144
|
+
return AuthenticationFactorSms.model_validate(response)
|
|
145
|
+
|
|
146
|
+
def get_factor(self, authentication_factor_id: str) -> AuthenticationFactor:
|
|
147
|
+
response = self._http_client.request(
|
|
148
|
+
RequestHelper.build_parameterized_url(
|
|
149
|
+
"auth/factors/{authentication_factor_id}",
|
|
150
|
+
authentication_factor_id=authentication_factor_id,
|
|
151
|
+
),
|
|
152
|
+
method=REQUEST_METHOD_GET,
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
if response["type"] == "totp":
|
|
156
|
+
return AuthenticationFactorTotp.model_validate(response)
|
|
157
|
+
|
|
158
|
+
return AuthenticationFactorSms.model_validate(response)
|
|
159
|
+
|
|
160
|
+
def delete_factor(self, authentication_factor_id: str) -> None:
|
|
161
|
+
self._http_client.request(
|
|
162
|
+
RequestHelper.build_parameterized_url(
|
|
163
|
+
"auth/factors/{authentication_factor_id}",
|
|
164
|
+
authentication_factor_id=authentication_factor_id,
|
|
165
|
+
),
|
|
166
|
+
method=REQUEST_METHOD_DELETE,
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
def challenge_factor(
|
|
170
|
+
self,
|
|
171
|
+
*,
|
|
172
|
+
authentication_factor_id: str,
|
|
173
|
+
sms_template: Optional[str] = None,
|
|
174
|
+
) -> AuthenticationChallenge:
|
|
175
|
+
json = {
|
|
176
|
+
"sms_template": sms_template,
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
response = self._http_client.request(
|
|
180
|
+
RequestHelper.build_parameterized_url(
|
|
181
|
+
"auth/factors/{factor_id}/challenge", factor_id=authentication_factor_id
|
|
182
|
+
),
|
|
183
|
+
method=REQUEST_METHOD_POST,
|
|
184
|
+
json=json,
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
return AuthenticationChallenge.model_validate(response)
|
|
188
|
+
|
|
189
|
+
def verify_challenge(
|
|
190
|
+
self, *, authentication_challenge_id: str, code: str
|
|
191
|
+
) -> AuthenticationChallengeVerificationResponse:
|
|
192
|
+
json = {
|
|
193
|
+
"code": code,
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
response = self._http_client.request(
|
|
197
|
+
RequestHelper.build_parameterized_url(
|
|
198
|
+
"auth/challenges/{challenge_id}/verify",
|
|
199
|
+
challenge_id=authentication_challenge_id,
|
|
200
|
+
),
|
|
201
|
+
method=REQUEST_METHOD_POST,
|
|
202
|
+
json=json,
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
return AuthenticationChallengeVerificationResponse.model_validate(response)
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
from typing import Protocol
|
|
2
|
+
from workos._client_configuration import ClientConfiguration
|
|
3
|
+
from workos.types.organization_domains import OrganizationDomain
|
|
4
|
+
from workos.typing.sync_or_async import SyncOrAsync
|
|
5
|
+
from workos.utils.http_client import AsyncHTTPClient, SyncHTTPClient
|
|
6
|
+
from workos.utils.request_helper import (
|
|
7
|
+
REQUEST_METHOD_DELETE,
|
|
8
|
+
REQUEST_METHOD_GET,
|
|
9
|
+
REQUEST_METHOD_POST,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class OrganizationDomainsModule(Protocol):
|
|
14
|
+
"""Offers methods for managing organization domains."""
|
|
15
|
+
|
|
16
|
+
_client_configuration: ClientConfiguration
|
|
17
|
+
|
|
18
|
+
def get_organization_domain(
|
|
19
|
+
self, organization_domain_id: str
|
|
20
|
+
) -> SyncOrAsync[OrganizationDomain]:
|
|
21
|
+
"""Gets a single Organization Domain
|
|
22
|
+
|
|
23
|
+
Args:
|
|
24
|
+
organization_domain_id (str): Organization Domain unique identifier
|
|
25
|
+
|
|
26
|
+
Returns:
|
|
27
|
+
OrganizationDomain: Organization Domain response from WorkOS
|
|
28
|
+
"""
|
|
29
|
+
...
|
|
30
|
+
|
|
31
|
+
def create_organization_domain(
|
|
32
|
+
self,
|
|
33
|
+
organization_id: str,
|
|
34
|
+
domain: str,
|
|
35
|
+
) -> SyncOrAsync[OrganizationDomain]:
|
|
36
|
+
"""Creates an Organization Domain
|
|
37
|
+
|
|
38
|
+
Args:
|
|
39
|
+
organization_id (str): Organization unique identifier
|
|
40
|
+
domain (str): Domain to be added to the organization
|
|
41
|
+
|
|
42
|
+
Returns:
|
|
43
|
+
OrganizationDomain: Organization Domain response from WorkOS
|
|
44
|
+
"""
|
|
45
|
+
...
|
|
46
|
+
|
|
47
|
+
def verify_organization_domain(
|
|
48
|
+
self, organization_domain_id: str
|
|
49
|
+
) -> SyncOrAsync[OrganizationDomain]:
|
|
50
|
+
"""Verifies an Organization Domain
|
|
51
|
+
|
|
52
|
+
Args:
|
|
53
|
+
organization_domain_id (str): Organization Domain unique identifier
|
|
54
|
+
|
|
55
|
+
Returns:
|
|
56
|
+
OrganizationDomain: Organization Domain response from WorkOS
|
|
57
|
+
"""
|
|
58
|
+
...
|
|
59
|
+
|
|
60
|
+
def delete_organization_domain(
|
|
61
|
+
self, organization_domain_id: str
|
|
62
|
+
) -> SyncOrAsync[None]:
|
|
63
|
+
"""Deletes a single Organization Domain
|
|
64
|
+
|
|
65
|
+
Args:
|
|
66
|
+
organization_domain_id (str): Organization Domain unique identifier
|
|
67
|
+
|
|
68
|
+
Returns:
|
|
69
|
+
None
|
|
70
|
+
"""
|
|
71
|
+
...
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
class OrganizationDomains:
|
|
75
|
+
"""Offers methods for managing organization domains."""
|
|
76
|
+
|
|
77
|
+
_http_client: SyncHTTPClient
|
|
78
|
+
_client_configuration: ClientConfiguration
|
|
79
|
+
|
|
80
|
+
def __init__(
|
|
81
|
+
self,
|
|
82
|
+
http_client: SyncHTTPClient,
|
|
83
|
+
client_configuration: ClientConfiguration,
|
|
84
|
+
):
|
|
85
|
+
self._http_client = http_client
|
|
86
|
+
self._client_configuration = client_configuration
|
|
87
|
+
|
|
88
|
+
def get_organization_domain(
|
|
89
|
+
self, organization_domain_id: str
|
|
90
|
+
) -> OrganizationDomain:
|
|
91
|
+
response = self._http_client.request(
|
|
92
|
+
f"organization_domains/{organization_domain_id}",
|
|
93
|
+
method=REQUEST_METHOD_GET,
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
return OrganizationDomain.model_validate(response)
|
|
97
|
+
|
|
98
|
+
def create_organization_domain(
|
|
99
|
+
self,
|
|
100
|
+
organization_id: str,
|
|
101
|
+
domain: str,
|
|
102
|
+
) -> OrganizationDomain:
|
|
103
|
+
response = self._http_client.request(
|
|
104
|
+
"organization_domains",
|
|
105
|
+
method=REQUEST_METHOD_POST,
|
|
106
|
+
json={"organization_id": organization_id, "domain": domain},
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
return OrganizationDomain.model_validate(response)
|
|
110
|
+
|
|
111
|
+
def verify_organization_domain(
|
|
112
|
+
self, organization_domain_id: str
|
|
113
|
+
) -> OrganizationDomain:
|
|
114
|
+
response = self._http_client.request(
|
|
115
|
+
f"organization_domains/{organization_domain_id}/verify",
|
|
116
|
+
method=REQUEST_METHOD_POST,
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
return OrganizationDomain.model_validate(response)
|
|
120
|
+
|
|
121
|
+
def delete_organization_domain(self, organization_domain_id: str) -> None:
|
|
122
|
+
self._http_client.request(
|
|
123
|
+
f"organization_domains/{organization_domain_id}",
|
|
124
|
+
method=REQUEST_METHOD_DELETE,
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
class AsyncOrganizationDomains:
|
|
129
|
+
"""Offers async methods for managing organization domains."""
|
|
130
|
+
|
|
131
|
+
_http_client: AsyncHTTPClient
|
|
132
|
+
_client_configuration: ClientConfiguration
|
|
133
|
+
|
|
134
|
+
def __init__(
|
|
135
|
+
self,
|
|
136
|
+
http_client: AsyncHTTPClient,
|
|
137
|
+
client_configuration: ClientConfiguration,
|
|
138
|
+
):
|
|
139
|
+
self._http_client = http_client
|
|
140
|
+
self._client_configuration = client_configuration
|
|
141
|
+
|
|
142
|
+
async def get_organization_domain(
|
|
143
|
+
self, organization_domain_id: str
|
|
144
|
+
) -> OrganizationDomain:
|
|
145
|
+
response = await self._http_client.request(
|
|
146
|
+
f"organization_domains/{organization_domain_id}",
|
|
147
|
+
method=REQUEST_METHOD_GET,
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
return OrganizationDomain.model_validate(response)
|
|
151
|
+
|
|
152
|
+
async def create_organization_domain(
|
|
153
|
+
self,
|
|
154
|
+
organization_id: str,
|
|
155
|
+
domain: str,
|
|
156
|
+
) -> OrganizationDomain:
|
|
157
|
+
response = await self._http_client.request(
|
|
158
|
+
"organization_domains",
|
|
159
|
+
method=REQUEST_METHOD_POST,
|
|
160
|
+
json={"organization_id": organization_id, "domain": domain},
|
|
161
|
+
)
|
|
162
|
+
|
|
163
|
+
return OrganizationDomain.model_validate(response)
|
|
164
|
+
|
|
165
|
+
async def verify_organization_domain(
|
|
166
|
+
self, organization_domain_id: str
|
|
167
|
+
) -> OrganizationDomain:
|
|
168
|
+
response = await self._http_client.request(
|
|
169
|
+
f"organization_domains/{organization_domain_id}/verify",
|
|
170
|
+
method=REQUEST_METHOD_POST,
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
return OrganizationDomain.model_validate(response)
|
|
174
|
+
|
|
175
|
+
async def delete_organization_domain(self, organization_domain_id: str) -> None:
|
|
176
|
+
await self._http_client.request(
|
|
177
|
+
f"organization_domains/{organization_domain_id}",
|
|
178
|
+
method=REQUEST_METHOD_DELETE,
|
|
179
|
+
)
|