workos 5.39.0__py3-none-any.whl → 5.39.1__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/directory_sync.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import Optional, Protocol
|
|
1
|
+
from typing import Any, Dict, Optional, Protocol, Union
|
|
2
2
|
|
|
3
3
|
from workos.types.directory_sync.list_filters import (
|
|
4
4
|
DirectoryGroupListFilters,
|
|
@@ -32,6 +32,24 @@ DirectoriesListResource = WorkOSListResource[
|
|
|
32
32
|
Directory, DirectoryListFilters, ListMetadata
|
|
33
33
|
]
|
|
34
34
|
|
|
35
|
+
# Mapping from SDK parameter names to API parameter names
|
|
36
|
+
PARAM_KEY_MAPPING = {
|
|
37
|
+
"directory_id": "directory",
|
|
38
|
+
"group_id": "group",
|
|
39
|
+
"user_id": "user",
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def _prepare_request_params(
|
|
44
|
+
list_params: Union[DirectoryUserListFilters, DirectoryGroupListFilters],
|
|
45
|
+
) -> Dict[str, Any]:
|
|
46
|
+
"""Convert list_params to API request params by renaming keys."""
|
|
47
|
+
request_params: Dict[str, Any] = dict(list_params)
|
|
48
|
+
for sdk_key, api_key in PARAM_KEY_MAPPING.items():
|
|
49
|
+
if sdk_key in request_params:
|
|
50
|
+
request_params[api_key] = request_params.pop(sdk_key)
|
|
51
|
+
return request_params
|
|
52
|
+
|
|
35
53
|
|
|
36
54
|
class DirectorySyncModule(Protocol):
|
|
37
55
|
"""Offers methods through the WorkOS Directory Sync service."""
|
|
@@ -191,7 +209,7 @@ class DirectorySync(DirectorySyncModule):
|
|
|
191
209
|
response = self._http_client.request(
|
|
192
210
|
"directory_users",
|
|
193
211
|
method=REQUEST_METHOD_GET,
|
|
194
|
-
params=list_params,
|
|
212
|
+
params=_prepare_request_params(list_params),
|
|
195
213
|
)
|
|
196
214
|
|
|
197
215
|
return WorkOSListResource(
|
|
@@ -225,7 +243,7 @@ class DirectorySync(DirectorySyncModule):
|
|
|
225
243
|
response = self._http_client.request(
|
|
226
244
|
"directory_groups",
|
|
227
245
|
method=REQUEST_METHOD_GET,
|
|
228
|
-
params=list_params,
|
|
246
|
+
params=_prepare_request_params(list_params),
|
|
229
247
|
)
|
|
230
248
|
|
|
231
249
|
return WorkOSListResource[
|
|
@@ -329,7 +347,7 @@ class AsyncDirectorySync(DirectorySyncModule):
|
|
|
329
347
|
response = await self._http_client.request(
|
|
330
348
|
"directory_users",
|
|
331
349
|
method=REQUEST_METHOD_GET,
|
|
332
|
-
params=list_params,
|
|
350
|
+
params=_prepare_request_params(list_params),
|
|
333
351
|
)
|
|
334
352
|
|
|
335
353
|
return WorkOSListResource(
|
|
@@ -354,6 +372,7 @@ class AsyncDirectorySync(DirectorySyncModule):
|
|
|
354
372
|
"after": after,
|
|
355
373
|
"order": order,
|
|
356
374
|
}
|
|
375
|
+
|
|
357
376
|
if user_id is not None:
|
|
358
377
|
list_params["user_id"] = user_id
|
|
359
378
|
if directory_id is not None:
|
|
@@ -362,7 +381,7 @@ class AsyncDirectorySync(DirectorySyncModule):
|
|
|
362
381
|
response = await self._http_client.request(
|
|
363
382
|
"directory_groups",
|
|
364
383
|
method=REQUEST_METHOD_GET,
|
|
365
|
-
params=list_params,
|
|
384
|
+
params=_prepare_request_params(list_params),
|
|
366
385
|
)
|
|
367
386
|
|
|
368
387
|
return WorkOSListResource[
|
|
@@ -5,7 +5,7 @@ workos/api_keys.py,sha256=3AljcqAO1uJYP315AZymX184eJ9X_gH7xa_rKU6rMjw,1817
|
|
|
5
5
|
workos/async_client.py,sha256=CHK_4rHxQ88D5_BJsj_5EeSWbcKj_FqGq-CsfIRTSBw,4879
|
|
6
6
|
workos/audit_logs.py,sha256=bYoAoNO4FRSaT34UxiVkgTXCVH8givcS2YGhH_9O3NA,3983
|
|
7
7
|
workos/client.py,sha256=WFDREJnzpxu6_Cz-Vd1GfCudQsk1KOeHLiuac_jWgKw,4836
|
|
8
|
-
workos/directory_sync.py,sha256=
|
|
8
|
+
workos/directory_sync.py,sha256=mo3NZ8aPGghav2JB73HTtG1uejihfN-9dN41J3OjNFg,15345
|
|
9
9
|
workos/events.py,sha256=b4JIzMbd5LlVtpOMKVojC70RCHAgmLN3nJ62_2U0GwI,3892
|
|
10
10
|
workos/exceptions.py,sha256=wYDlbMLVxrKQTF0M6ExFlxS5YEkvNZ4BeWLryRxcAFs,2335
|
|
11
11
|
workos/fga.py,sha256=qjZrdkXKwJDLVTMMrOADxyXRDkswto4kGIdtTjtS3hw,21008
|
|
@@ -133,6 +133,6 @@ workos/utils/request_helper.py,sha256=9FgeDfz_hiHlbCkuo6bcBjSpdDM5ObRok9-G_jFedd
|
|
|
133
133
|
workos/vault.py,sha256=fe2OkFLVV1U4x9E78baWGksPIxg32decAuawEaJ63w4,16417
|
|
134
134
|
workos/webhooks.py,sha256=CuwBxh6va9VZFVSXOknveGt6CCGDF3em07a-J12DbXI,4790
|
|
135
135
|
workos/widgets.py,sha256=YAjiffcewHXcPx2kjScGs2-xZpmYsed33UQ6xDTqjJM,1720
|
|
136
|
-
workos-5.39.
|
|
137
|
-
workos-5.39.
|
|
138
|
-
workos-5.39.
|
|
136
|
+
workos-5.39.1.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
|
|
137
|
+
workos-5.39.1.dist-info/METADATA,sha256=9QrcsQwmzvuLNItbr64khE15oFI_jPNwq2UaLfmLm3o,3348
|
|
138
|
+
workos-5.39.1.dist-info/RECORD,,
|
|
File without changes
|