workos 5.33.0__tar.gz → 5.35.0__tar.gz
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-5.33.0 → workos-5.35.0}/PKG-INFO +1 -1
- workos-5.35.0/tests/test_api_keys.py +50 -0
- {workos-5.33.0 → workos-5.35.0}/tests/test_client.py +6 -0
- {workos-5.33.0 → workos-5.35.0}/tests/test_sso.py +1 -0
- {workos-5.33.0 → workos-5.35.0}/workos/__about__.py +1 -1
- {workos-5.33.0 → workos-5.35.0}/workos/_base_client.py +10 -6
- workos-5.35.0/workos/api_keys.py +53 -0
- {workos-5.33.0 → workos-5.35.0}/workos/async_client.py +7 -0
- {workos-5.33.0 → workos-5.35.0}/workos/client.py +7 -0
- workos-5.35.0/workos/types/api_keys/__init__.py +1 -0
- workos-5.35.0/workos/types/api_keys/api_keys.py +20 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/directory_sync/directory_user.py +1 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/sso/profile.py +1 -0
- {workos-5.33.0 → workos-5.35.0}/workos.egg-info/PKG-INFO +1 -1
- {workos-5.33.0 → workos-5.35.0}/workos.egg-info/SOURCES.txt +4 -0
- {workos-5.33.0 → workos-5.35.0}/LICENSE +0 -0
- {workos-5.33.0 → workos-5.35.0}/README.md +0 -0
- {workos-5.33.0 → workos-5.35.0}/setup.cfg +0 -0
- {workos-5.33.0 → workos-5.35.0}/setup.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/tests/test_async_http_client.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/tests/test_audit_logs.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/tests/test_directory_sync.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/tests/test_events.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/tests/test_fga.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/tests/test_mfa.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/tests/test_organization_domains.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/tests/test_organizations.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/tests/test_passwordless.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/tests/test_portal.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/tests/test_session.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/tests/test_sync_http_client.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/tests/test_user_management.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/tests/test_user_management_list_sessions.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/tests/test_user_management_revoke_session.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/tests/test_vault.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/tests/test_webhooks.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/tests/test_widgets.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/__init__.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/_client_configuration.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/audit_logs.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/directory_sync.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/events.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/exceptions.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/fga.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/mfa.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/organization_domains.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/organizations.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/passwordless.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/portal.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/py.typed +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/session.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/sso.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/__init__.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/audit_logs/__init__.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/audit_logs/audit_log_event.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/audit_logs/audit_log_event_actor.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/audit_logs/audit_log_event_context.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/audit_logs/audit_log_event_target.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/audit_logs/audit_log_export.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/audit_logs/audit_log_metadata.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/directory_sync/__init__.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/directory_sync/directory.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/directory_sync/directory_group.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/directory_sync/directory_state.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/directory_sync/directory_type.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/directory_sync/list_filters.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/events/__init__.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/events/authentication_payload.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/events/connection_payload_with_legacy_fields.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/events/directory_group_membership_payload.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/events/directory_group_with_previous_attributes.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/events/directory_payload.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/events/directory_payload_with_legacy_fields.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/events/directory_user_with_previous_attributes.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/events/event.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/events/event_model.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/events/event_type.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/events/list_filters.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/events/organization_domain_verification_failed_payload.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/events/previous_attributes.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/events/session_created_payload.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/feature_flags/__init__.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/feature_flags/feature_flag.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/feature_flags/list_filters.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/fga/__init__.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/fga/authorization_resource_types.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/fga/authorization_resources.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/fga/check.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/fga/list_filters.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/fga/warnings.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/fga/warrant.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/list_resource.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/metadata.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/mfa/__init__.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/mfa/authentication_challenge.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/mfa/authentication_challenge_verification_response.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/mfa/authentication_factor.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/mfa/authentication_factor_totp_and_challenge_response.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/mfa/enroll_authentication_factor_type.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/organization_domains/__init__.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/organization_domains/organization_domain.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/organizations/__init__.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/organizations/domain_data_input.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/organizations/list_filters.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/organizations/organization.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/organizations/organization_common.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/passwordless/__init__.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/passwordless/passwordless_session.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/passwordless/passwordless_session_type.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/portal/__init__.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/portal/portal_link.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/portal/portal_link_intent.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/portal/portal_link_intent_options.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/roles/__init__.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/roles/role.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/sso/__init__.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/sso/connection.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/sso/connection_domain.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/sso/sso_provider_type.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/user_management/__init__.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/user_management/authenticate_with_common.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/user_management/authentication_response.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/user_management/email_verification.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/user_management/impersonator.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/user_management/invitation.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/user_management/list_filters.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/user_management/magic_auth.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/user_management/oauth_tokens.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/user_management/organization_membership.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/user_management/password_hash_type.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/user_management/password_reset.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/user_management/screen_hint.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/user_management/session.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/user_management/user.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/user_management/user_management_provider_type.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/vault/__init__.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/vault/key.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/vault/object.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/webhooks/__init__.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/webhooks/webhook.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/webhooks/webhook_model.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/webhooks/webhook_payload.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/widgets/__init__.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/widgets/widget_scope.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/widgets/widget_token_response.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/types/workos_model.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/typing/__init__.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/typing/literals.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/typing/sync_or_async.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/typing/untyped_literal.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/typing/webhooks.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/user_management.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/utils/__init__.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/utils/_base_http_client.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/utils/crypto_provider.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/utils/http_client.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/utils/pagination_order.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/utils/request_helper.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/vault.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/webhooks.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos/widgets.py +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos.egg-info/dependency_links.txt +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos.egg-info/not-zip-safe +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos.egg-info/requires.txt +0 -0
- {workos-5.33.0 → workos-5.35.0}/workos.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# type: ignore
|
|
2
|
+
import pytest
|
|
3
|
+
|
|
4
|
+
from tests.utils.fixtures.mock_api_key import MockApiKey
|
|
5
|
+
from tests.utils.syncify import syncify
|
|
6
|
+
from workos.api_keys import API_KEY_VALIDATION_PATH, ApiKeys, AsyncApiKeys
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@pytest.mark.sync_and_async(ApiKeys, AsyncApiKeys)
|
|
10
|
+
class TestApiKeys:
|
|
11
|
+
@pytest.fixture
|
|
12
|
+
def mock_api_key(self):
|
|
13
|
+
return MockApiKey().dict()
|
|
14
|
+
|
|
15
|
+
@pytest.fixture
|
|
16
|
+
def api_key(self):
|
|
17
|
+
return "sk_my_api_key"
|
|
18
|
+
|
|
19
|
+
def test_validate_api_key_with_valid_key(
|
|
20
|
+
self,
|
|
21
|
+
module_instance,
|
|
22
|
+
api_key,
|
|
23
|
+
mock_api_key,
|
|
24
|
+
capture_and_mock_http_client_request,
|
|
25
|
+
):
|
|
26
|
+
response_body = {"api_key": mock_api_key}
|
|
27
|
+
request_kwargs = capture_and_mock_http_client_request(
|
|
28
|
+
module_instance._http_client, response_body, 200
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
api_key_details = syncify(module_instance.validate_api_key(value=api_key))
|
|
32
|
+
|
|
33
|
+
assert request_kwargs["url"].endswith(API_KEY_VALIDATION_PATH)
|
|
34
|
+
assert request_kwargs["method"] == "post"
|
|
35
|
+
assert api_key_details.id == mock_api_key["id"]
|
|
36
|
+
assert api_key_details.name == mock_api_key["name"]
|
|
37
|
+
assert api_key_details.object == "api_key"
|
|
38
|
+
|
|
39
|
+
def test_validate_api_key_with_invalid_key(
|
|
40
|
+
self,
|
|
41
|
+
module_instance,
|
|
42
|
+
mock_http_client_with_response,
|
|
43
|
+
):
|
|
44
|
+
mock_http_client_with_response(
|
|
45
|
+
module_instance._http_client,
|
|
46
|
+
{"api_key": None},
|
|
47
|
+
200,
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
assert syncify(module_instance.validate_api_key(value="invalid-key")) is None
|
|
@@ -37,6 +37,9 @@ class TestClient:
|
|
|
37
37
|
os.environ.pop("WORKOS_API_KEY")
|
|
38
38
|
os.environ.pop("WORKOS_CLIENT_ID")
|
|
39
39
|
|
|
40
|
+
def test_initialize_api_keys(self, default_client):
|
|
41
|
+
assert bool(default_client.api_keys)
|
|
42
|
+
|
|
40
43
|
def test_initialize_sso(self, default_client):
|
|
41
44
|
assert bool(default_client.sso)
|
|
42
45
|
|
|
@@ -112,6 +115,9 @@ class TestAsyncClient:
|
|
|
112
115
|
os.environ.pop("WORKOS_API_KEY")
|
|
113
116
|
os.environ.pop("WORKOS_CLIENT_ID")
|
|
114
117
|
|
|
118
|
+
def test_initialize_api_keys(self, default_client):
|
|
119
|
+
assert bool(default_client.api_keys)
|
|
120
|
+
|
|
115
121
|
def test_initialize_directory_sync(self, default_client):
|
|
116
122
|
assert bool(default_client.directory_sync)
|
|
117
123
|
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
from abc import abstractmethod
|
|
2
1
|
import os
|
|
2
|
+
from abc import abstractmethod
|
|
3
3
|
from typing import Optional
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
from workos._client_configuration import ClientConfiguration
|
|
6
|
-
from workos.
|
|
7
|
-
from workos.utils._base_http_client import DEFAULT_REQUEST_TIMEOUT
|
|
8
|
-
from workos.utils.http_client import HTTPClient
|
|
6
|
+
from workos.api_keys import ApiKeysModule
|
|
9
7
|
from workos.audit_logs import AuditLogsModule
|
|
10
8
|
from workos.directory_sync import DirectorySyncModule
|
|
11
9
|
from workos.events import EventsModule
|
|
10
|
+
from workos.fga import FGAModule
|
|
12
11
|
from workos.mfa import MFAModule
|
|
13
|
-
from workos.organizations import OrganizationsModule
|
|
14
12
|
from workos.organization_domains import OrganizationDomainsModule
|
|
13
|
+
from workos.organizations import OrganizationsModule
|
|
15
14
|
from workos.passwordless import PasswordlessModule
|
|
16
15
|
from workos.portal import PortalModule
|
|
17
16
|
from workos.sso import SSOModule
|
|
18
17
|
from workos.user_management import UserManagementModule
|
|
18
|
+
from workos.utils._base_http_client import DEFAULT_REQUEST_TIMEOUT
|
|
19
19
|
from workos.webhooks import WebhooksModule
|
|
20
20
|
|
|
21
21
|
|
|
@@ -65,6 +65,10 @@ class BaseClient(ClientConfiguration):
|
|
|
65
65
|
else int(os.getenv("WORKOS_REQUEST_TIMEOUT", DEFAULT_REQUEST_TIMEOUT))
|
|
66
66
|
)
|
|
67
67
|
|
|
68
|
+
@property
|
|
69
|
+
@abstractmethod
|
|
70
|
+
def api_keys(self) -> ApiKeysModule: ...
|
|
71
|
+
|
|
68
72
|
@property
|
|
69
73
|
@abstractmethod
|
|
70
74
|
def audit_logs(self) -> AuditLogsModule: ...
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
from typing import Optional, Protocol
|
|
2
|
+
|
|
3
|
+
from workos.types.api_keys import ApiKey
|
|
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 REQUEST_METHOD_POST
|
|
7
|
+
|
|
8
|
+
API_KEY_VALIDATION_PATH = "api_keys/validations"
|
|
9
|
+
RESOURCE_OBJECT_ATTRIBUTE_NAME = "api_key"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ApiKeysModule(Protocol):
|
|
13
|
+
def validate_api_key(self, *, value: str) -> SyncOrAsync[Optional[ApiKey]]:
|
|
14
|
+
"""Validate an API key.
|
|
15
|
+
|
|
16
|
+
Kwargs:
|
|
17
|
+
value (str): API key value
|
|
18
|
+
|
|
19
|
+
Returns:
|
|
20
|
+
Optional[ApiKey]: Returns ApiKey resource object
|
|
21
|
+
if supplied value was valid, None if it was not
|
|
22
|
+
"""
|
|
23
|
+
...
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class ApiKeys(ApiKeysModule):
|
|
27
|
+
_http_client: SyncHTTPClient
|
|
28
|
+
|
|
29
|
+
def __init__(self, http_client: SyncHTTPClient):
|
|
30
|
+
self._http_client = http_client
|
|
31
|
+
|
|
32
|
+
def validate_api_key(self, *, value: str) -> Optional[ApiKey]:
|
|
33
|
+
response = self._http_client.request(
|
|
34
|
+
API_KEY_VALIDATION_PATH, method=REQUEST_METHOD_POST, json={"value": value}
|
|
35
|
+
)
|
|
36
|
+
if response.get(RESOURCE_OBJECT_ATTRIBUTE_NAME) is None:
|
|
37
|
+
return None
|
|
38
|
+
return ApiKey.model_validate(response[RESOURCE_OBJECT_ATTRIBUTE_NAME])
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class AsyncApiKeys(ApiKeysModule):
|
|
42
|
+
_http_client: AsyncHTTPClient
|
|
43
|
+
|
|
44
|
+
def __init__(self, http_client: AsyncHTTPClient):
|
|
45
|
+
self._http_client = http_client
|
|
46
|
+
|
|
47
|
+
async def validate_api_key(self, *, value: str) -> Optional[ApiKey]:
|
|
48
|
+
response = await self._http_client.request(
|
|
49
|
+
API_KEY_VALIDATION_PATH, method=REQUEST_METHOD_POST, json={"value": value}
|
|
50
|
+
)
|
|
51
|
+
if response.get(RESOURCE_OBJECT_ATTRIBUTE_NAME) is None:
|
|
52
|
+
return None
|
|
53
|
+
return ApiKey.model_validate(response[RESOURCE_OBJECT_ATTRIBUTE_NAME])
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from typing import Optional
|
|
2
2
|
from workos.__about__ import __version__
|
|
3
3
|
from workos._base_client import BaseClient
|
|
4
|
+
from workos.api_keys import AsyncApiKeys
|
|
4
5
|
from workos.audit_logs import AuditLogsModule
|
|
5
6
|
from workos.directory_sync import AsyncDirectorySync
|
|
6
7
|
from workos.events import AsyncEvents
|
|
@@ -45,6 +46,12 @@ class AsyncClient(BaseClient):
|
|
|
45
46
|
timeout=self.request_timeout,
|
|
46
47
|
)
|
|
47
48
|
|
|
49
|
+
@property
|
|
50
|
+
def api_keys(self) -> AsyncApiKeys:
|
|
51
|
+
if not getattr(self, "_api_keys", None):
|
|
52
|
+
self._api_keys = AsyncApiKeys(self._http_client)
|
|
53
|
+
return self._api_keys
|
|
54
|
+
|
|
48
55
|
@property
|
|
49
56
|
def sso(self) -> AsyncSSO:
|
|
50
57
|
if not getattr(self, "_sso", None):
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from typing import Optional
|
|
2
2
|
from workos.__about__ import __version__
|
|
3
3
|
from workos._base_client import BaseClient
|
|
4
|
+
from workos.api_keys import ApiKeys
|
|
4
5
|
from workos.audit_logs import AuditLogs
|
|
5
6
|
from workos.directory_sync import DirectorySync
|
|
6
7
|
from workos.fga import FGA
|
|
@@ -45,6 +46,12 @@ class SyncClient(BaseClient):
|
|
|
45
46
|
timeout=self.request_timeout,
|
|
46
47
|
)
|
|
47
48
|
|
|
49
|
+
@property
|
|
50
|
+
def api_keys(self) -> ApiKeys:
|
|
51
|
+
if not getattr(self, "_api_keys", None):
|
|
52
|
+
self._api_keys = ApiKeys(self._http_client)
|
|
53
|
+
return self._api_keys
|
|
54
|
+
|
|
48
55
|
@property
|
|
49
56
|
def sso(self) -> SSO:
|
|
50
57
|
if not getattr(self, "_sso", None):
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .api_keys import ApiKey as ApiKey # noqa: F401
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from typing import Literal, Optional, Sequence
|
|
2
|
+
|
|
3
|
+
from workos.types.workos_model import WorkOSModel
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ApiKeyOwner(WorkOSModel):
|
|
7
|
+
type: str
|
|
8
|
+
id: str
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class ApiKey(WorkOSModel):
|
|
12
|
+
object: Literal["api_key"]
|
|
13
|
+
id: str
|
|
14
|
+
owner: ApiKeyOwner
|
|
15
|
+
name: str
|
|
16
|
+
obfuscated_value: str
|
|
17
|
+
last_used_at: Optional[str] = None
|
|
18
|
+
permissions: Sequence[str]
|
|
19
|
+
created_at: str
|
|
20
|
+
updated_at: str
|
|
@@ -38,6 +38,7 @@ class DirectoryUser(WorkOSModel):
|
|
|
38
38
|
created_at: str
|
|
39
39
|
updated_at: str
|
|
40
40
|
role: Optional[InlineRole] = None
|
|
41
|
+
roles: Optional[Sequence[InlineRole]] = None
|
|
41
42
|
|
|
42
43
|
def primary_email(self) -> Union[DirectoryUserEmail, None]:
|
|
43
44
|
return next((email for email in self.emails if email.primary), None)
|
|
@@ -22,6 +22,7 @@ class Profile(WorkOSModel):
|
|
|
22
22
|
last_name: Optional[str] = None
|
|
23
23
|
idp_id: str
|
|
24
24
|
role: Optional[ProfileRole] = None
|
|
25
|
+
roles: Optional[Sequence[ProfileRole]] = None
|
|
25
26
|
groups: Optional[Sequence[str]] = None
|
|
26
27
|
custom_attributes: Optional[Mapping[str, Any]] = None
|
|
27
28
|
raw_attributes: Optional[Mapping[str, Any]] = None
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
LICENSE
|
|
2
2
|
README.md
|
|
3
3
|
setup.py
|
|
4
|
+
tests/test_api_keys.py
|
|
4
5
|
tests/test_async_http_client.py
|
|
5
6
|
tests/test_audit_logs.py
|
|
6
7
|
tests/test_client.py
|
|
@@ -25,6 +26,7 @@ workos/__about__.py
|
|
|
25
26
|
workos/__init__.py
|
|
26
27
|
workos/_base_client.py
|
|
27
28
|
workos/_client_configuration.py
|
|
29
|
+
workos/api_keys.py
|
|
28
30
|
workos/async_client.py
|
|
29
31
|
workos/audit_logs.py
|
|
30
32
|
workos/client.py
|
|
@@ -54,6 +56,8 @@ workos/types/__init__.py
|
|
|
54
56
|
workos/types/list_resource.py
|
|
55
57
|
workos/types/metadata.py
|
|
56
58
|
workos/types/workos_model.py
|
|
59
|
+
workos/types/api_keys/__init__.py
|
|
60
|
+
workos/types/api_keys/api_keys.py
|
|
57
61
|
workos/types/audit_logs/__init__.py
|
|
58
62
|
workos/types/audit_logs/audit_log_event.py
|
|
59
63
|
workos/types/audit_logs/audit_log_event_actor.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{workos-5.33.0 → workos-5.35.0}/workos/types/events/connection_payload_with_legacy_fields.py
RENAMED
|
File without changes
|
|
File without changes
|
{workos-5.33.0 → workos-5.35.0}/workos/types/events/directory_group_with_previous_attributes.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{workos-5.33.0 → workos-5.35.0}/workos/types/events/directory_user_with_previous_attributes.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{workos-5.33.0 → workos-5.35.0}/workos/types/mfa/authentication_challenge_verification_response.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{workos-5.33.0 → workos-5.35.0}/workos/types/user_management/user_management_provider_type.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|