Skip to content

Paging with directory sync is broken... #511

@barp

Description

@barp

it seems that the python library to list groups by directory id is broken:

TypeError: DirectorySync.list_groups() got an unexpected keyword argument 'directory'. Did you mean 'directory_id'?

while the call to it looks like:

    for group in workos_client.directory_sync.list_groups(
        directory_id=directory_id, after=after
    ):

I suspect the issue is in:

    def list_groups(
        self,
        *,
        directory_id: Optional[str] = None,
        user_id: Optional[str] = None,
        limit: int = DEFAULT_LIST_RESPONSE_LIMIT,
        before: Optional[str] = None,
        after: Optional[str] = None,
        order: PaginationOrder = "desc",
    ) -> DirectoryGroupsListResource:
        list_params: DirectoryGroupListFilters = {
            "limit": limit,
            "before": before,
            "after": after,
            "order": order,
        }

        if user_id is not None:
            list_params["user"] = user_id
        if directory_id is not None:
            list_params["directory"] = directory_id

        response = self._http_client.request(
            "directory_groups",
            method=REQUEST_METHOD_GET,
            params=list_params,
        )

the line

list_params["directory"] = directory_id

should be

list_params["directory_id"] = directory_id

This issue seems to repeat in many places in the directory_sync.py file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions