-
Notifications
You must be signed in to change notification settings - Fork 25
Correct params for list_groups and list_users
#512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -184,9 +184,9 @@ def list_users( | |||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| if group_id is not None: | ||||||||||||||||||
| list_params["group"] = group_id | ||||||||||||||||||
| list_params["group_id"] = group_id | ||||||||||||||||||
| if directory_id is not None: | ||||||||||||||||||
| list_params["directory"] = directory_id | ||||||||||||||||||
| list_params["directory_id"] = directory_id | ||||||||||||||||||
|
|
||||||||||||||||||
| response = self._http_client.request( | ||||||||||||||||||
| "directory_users", | ||||||||||||||||||
|
|
@@ -218,9 +218,9 @@ def list_groups( | |||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| if user_id is not None: | ||||||||||||||||||
| list_params["user"] = user_id | ||||||||||||||||||
| list_params["user_id"] = user_id | ||||||||||||||||||
| if directory_id is not None: | ||||||||||||||||||
| list_params["directory"] = directory_id | ||||||||||||||||||
| list_params["directory_id"] = directory_id | ||||||||||||||||||
|
Comment on lines
+221
to
+223
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. logic: The WorkOS API expects
Suggested change
Prompt To Fix With AIThis is a comment left during a code review.
Path: src/workos/directory_sync.py
Line: 221:223
Comment:
**logic:** The WorkOS API expects `user` and `directory` not `user_id` and `directory_id`. The type definition in `src/workos/types/directory_sync/list_filters.py:20-21` defines `DirectoryGroupListFilters` with `user: Optional[str]` and `directory: Optional[str]`, and tests at `tests/test_directory_sync.py:184,202` verify this. This change will break API calls.
```suggestion
if user_id is not None:
list_params["user"] = user_id
if directory_id is not None:
list_params["directory"] = directory_id
```
How can I resolve this? If you propose a fix, please make it concise. |
||||||||||||||||||
|
|
||||||||||||||||||
| response = self._http_client.request( | ||||||||||||||||||
| "directory_groups", | ||||||||||||||||||
|
|
@@ -322,9 +322,9 @@ async def list_users( | |||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| if group_id is not None: | ||||||||||||||||||
| list_params["group"] = group_id | ||||||||||||||||||
| list_params["group_id"] = group_id | ||||||||||||||||||
| if directory_id is not None: | ||||||||||||||||||
| list_params["directory"] = directory_id | ||||||||||||||||||
| list_params["directory_id"] = directory_id | ||||||||||||||||||
|
Comment on lines
+325
to
+327
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. logic: Same issue in async version: API expects
Suggested change
Prompt To Fix With AIThis is a comment left during a code review.
Path: src/workos/directory_sync.py
Line: 325:327
Comment:
**logic:** Same issue in async version: API expects `group` and `directory` not `group_id` and `directory_id`. This will break async API calls.
```suggestion
if group_id is not None:
list_params["group"] = group_id
if directory_id is not None:
list_params["directory"] = directory_id
```
How can I resolve this? If you propose a fix, please make it concise. |
||||||||||||||||||
|
|
||||||||||||||||||
| response = await self._http_client.request( | ||||||||||||||||||
| "directory_users", | ||||||||||||||||||
|
|
@@ -355,9 +355,9 @@ async def list_groups( | |||||||||||||||||
| "order": order, | ||||||||||||||||||
| } | ||||||||||||||||||
| if user_id is not None: | ||||||||||||||||||
| list_params["user"] = user_id | ||||||||||||||||||
| list_params["user_id"] = user_id | ||||||||||||||||||
| if directory_id is not None: | ||||||||||||||||||
| list_params["directory"] = directory_id | ||||||||||||||||||
| list_params["directory_id"] = directory_id | ||||||||||||||||||
|
Comment on lines
+358
to
+360
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. logic: Same issue in async version: API expects
Suggested change
Prompt To Fix With AIThis is a comment left during a code review.
Path: src/workos/directory_sync.py
Line: 358:360
Comment:
**logic:** Same issue in async version: API expects `user` and `directory` not `user_id` and `directory_id`. This will break async API calls.
```suggestion
if user_id is not None:
list_params["user"] = user_id
if directory_id is not None:
list_params["directory"] = directory_id
```
How can I resolve this? If you propose a fix, please make it concise. |
||||||||||||||||||
|
|
||||||||||||||||||
| response = await self._http_client.request( | ||||||||||||||||||
| "directory_groups", | ||||||||||||||||||
|
|
||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: The WorkOS API expects
groupnotgroup_id. The type definition insrc/workos/types/directory_sync/list_filters.py:15definesDirectoryUserListFilterswithgroup: Optional[str], and tests attests/test_directory_sync.py:166verify this. This change will break API calls.Prompt To Fix With AI