Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions linkedin_api/clients/restli/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def __init__(
start: Optional[int] = None,
count: Optional[int] = None,
total: Optional[int] = None,
next_page_token: Optional[str] = None,
):
self.start = start
"""
Expand All @@ -26,6 +27,12 @@ def __init__(
The total number of results available.
"""

self.next_page_token = next_page_token
"""
An opaque cursor string for cursor-based pagination, returned by versioned APIs (202404+).
Pass this value as the `pageToken` query parameter to retrieve the next page.
"""


class BaseRestliResponse(BaseResponse):
pass
Expand Down
3 changes: 2 additions & 1 deletion linkedin_api/clients/restli/response_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,11 @@ def format_response(cls, response: Response) -> CollectionResponse:
paging.get("start", None),
paging.get("count", None),
paging.get("total", None),
paging.get("nextPageToken", None),
)
if paging
else Paging(),
metadata=getattr(json_data, "metadata", None),
metadata=json_data.get("metadata", None),
)


Expand Down
4 changes: 2 additions & 2 deletions tests/clients/restli/client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@
"checked_headers": {"X-RestLi-Method": RESTLI_METHODS.GET_ALL.value},
"response_properties": {
"elements": [{"name": "A"}, {"name": "B"}],
"paging": {"start": 0, "count": 2, "total": 10},
"paging": {"start": 0, "count": 2, "total": 10, "next_page_token": None},
},
},
),
Expand Down Expand Up @@ -336,7 +336,7 @@
"checked_headers": {"X-RestLi-Method": RESTLI_METHODS.FINDER.value},
"response_properties": {
"elements": [{"name": "A"}, {"name": "B"}],
"paging": {"start": 0, "count": 2, "total": 10},
"paging": {"start": 0, "count": 2, "total": 10, "next_page_token": None},
},
},
),
Expand Down