Reference for hub_sdk/base/paginated_list.py
Note
This file is available at https://github.com/ultralytics/hub-sdk/blob/main/hub_sdk/base/paginated_list.py. If you spot a problem please help fix it by contributing a Pull Request 🛠️. Thank you 🙏!
hub_sdk.base.paginated_list.PaginatedList
Bases: APIClient
Handles pagination for list endpoints on the API while managing retrieval, navigation, and updating of data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
base_endpoint
|
str
|
The base API endpoint for the paginated resource. |
required |
name
|
str
|
A descriptive name for the paginated resource. |
required |
page_size
|
int
|
The number of items per page. |
None
|
headers
|
dict
|
Additional headers to include in API requests. |
None
|
Source code in hub_sdk/base/paginated_list.py
__update_data
Update the internal data with the response from the API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
resp
|
Response
|
API response data. |
required |
Source code in hub_sdk/base/paginated_list.py
list
Retrieve a list of items from the API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
page_size
|
int
|
The number of items per page. |
10
|
last_record
|
str
|
ID of the last record from the previous page. |
None
|
query
|
dict
|
Additional query parameters for the API request. |
None
|
Returns:
Type | Description |
---|---|
Optional[Response]
|
Response object from the list request, or None if it fails. |
Source code in hub_sdk/base/paginated_list.py
next
Move to the next page of results if available.
Source code in hub_sdk/base/paginated_list.py
previous
Move to the previous page of results if available.