forked from workos/workos-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.py
More file actions
164 lines (142 loc) · 5.19 KB
/
client.py
File metadata and controls
164 lines (142 loc) · 5.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
from importlib.metadata import version
from typing import Optional
from workos._base_client import BaseClient
from workos.api_keys import ApiKeys
from workos.audit_logs import AuditLogs
from workos.authorization import Authorization
from workos.connect import Connect
from workos.directory_sync import DirectorySync
from workos.fga import FGA
from workos.organizations import Organizations
from workos.organization_domains import OrganizationDomains
from workos.passwordless import Passwordless
from workos.pipes import Pipes
from workos.portal import Portal
from workos.sso import SSO
from workos.webhooks import Webhooks
from workos.mfa import Mfa
from workos.events import Events
from workos.user_management import UserManagement
from workos.utils.http_client import SyncHTTPClient
from workos.widgets import Widgets
from workos.vault import Vault
class SyncClient(BaseClient):
"""Client for a convenient way to access the WorkOS feature set."""
_http_client: SyncHTTPClient
def __init__(
self,
*,
api_key: Optional[str] = None,
client_id: Optional[str] = None,
base_url: Optional[str] = None,
request_timeout: Optional[int] = None,
jwt_leeway: float = 0,
):
super().__init__(
api_key=api_key,
client_id=client_id,
base_url=base_url,
request_timeout=request_timeout,
jwt_leeway=jwt_leeway,
)
self._http_client = SyncHTTPClient(
api_key=self._api_key,
base_url=self.base_url,
client_id=self._client_id,
version=version("workos"),
timeout=self.request_timeout,
)
@property
def connect(self) -> Connect:
if not getattr(self, "_connect", None):
self._connect = Connect(self._http_client)
return self._connect
@property
def api_keys(self) -> ApiKeys:
if not getattr(self, "_api_keys", None):
self._api_keys = ApiKeys(self._http_client)
return self._api_keys
@property
def authorization(self) -> Authorization:
if not getattr(self, "_authorization", None):
self._authorization = Authorization(self._http_client)
return self._authorization
@property
def sso(self) -> SSO:
if not getattr(self, "_sso", None):
self._sso = SSO(http_client=self._http_client, client_configuration=self)
return self._sso
@property
def audit_logs(self) -> AuditLogs:
if not getattr(self, "_audit_logs", None):
self._audit_logs = AuditLogs(self._http_client)
return self._audit_logs
@property
def directory_sync(self) -> DirectorySync:
if not getattr(self, "_directory_sync", None):
self._directory_sync = DirectorySync(self._http_client)
return self._directory_sync
@property
def events(self) -> Events:
if not getattr(self, "_events", None):
self._events = Events(self._http_client)
return self._events
@property
def fga(self) -> FGA:
if not getattr(self, "_fga", None):
self._fga = FGA(self._http_client)
return self._fga
@property
def organizations(self) -> Organizations:
if not getattr(self, "_organizations", None):
self._organizations = Organizations(self._http_client)
return self._organizations
@property
def organization_domains(self) -> OrganizationDomains:
if not getattr(self, "_organization_domains", None):
self._organization_domains = OrganizationDomains(
http_client=self._http_client, client_configuration=self
)
return self._organization_domains
@property
def passwordless(self) -> Passwordless:
if not getattr(self, "_passwordless", None):
self._passwordless = Passwordless(self._http_client)
return self._passwordless
@property
def pipes(self) -> Pipes:
if not getattr(self, "_pipes", None):
self._pipes = Pipes(self._http_client)
return self._pipes
@property
def portal(self) -> Portal:
if not getattr(self, "_portal", None):
self._portal = Portal(self._http_client)
return self._portal
@property
def webhooks(self) -> Webhooks:
if not getattr(self, "_webhooks", None):
self._webhooks = Webhooks()
return self._webhooks
@property
def mfa(self) -> Mfa:
if not getattr(self, "_mfa", None):
self._mfa = Mfa(self._http_client)
return self._mfa
@property
def user_management(self) -> UserManagement:
if not getattr(self, "_user_management", None):
self._user_management = UserManagement(
http_client=self._http_client, client_configuration=self
)
return self._user_management
@property
def widgets(self) -> Widgets:
if not getattr(self, "_widgets", None):
self._widgets = Widgets(http_client=self._http_client)
return self._widgets
@property
def vault(self) -> Vault:
if not getattr(self, "_vault", None):
self._vault = Vault(http_client=self._http_client)
return self._vault