cmem_client.repositories.base.paged_list¤
Repository implementation for paginated API endpoints.
This module provides PagedListRepository, a repository implementation that handles paginated API responses commonly used in Corporate Memory’s DataPlatform (explore) APIs. It automatically fetches all pages of results and provides a unified dictionary-like interface.
The PagedListRepository is typically used for endpoints that return results in a paginated format with metadata about page size, number, and totals.
Classes:
- PageDescription – A description of a paged list.
- PagedListRepository – Repository that uses a paged list endpoint.
PageDescription¤
Bases: Model
A description of a paged list.
Attributes:
- size (
int) – Number of items requested per page.fetch_data()stops paging as soon as a page returns fewer items than this. - number (
int) – Zero based index of this page. - total_elements (
int) – Total number of items across all pages, sent astotalElements. - total_pages (
int) – Total number of pages, sent astotalPages.
model_config¤
number¤
size¤
total_elements¤
total_pages¤
PagedListRepository¤
Bases: Repository
Repository that uses a paged list endpoint.
Attributes:
- _dict (
dict[str, PagedListRepository[ItemType]]) – Cached contents of the repository, mapping the key of each item to the item itself. Backs the Mapping interface and is populated byfetch_data(). - _client (
Client) – Corporate Memory client used for the HTTP requests of this repository. - _config (
RepositoryConfig) – Describes which paged endpoint the repository fetches its data from.
Functions:
- fetch_data – Fetch a paged list from a JSON endpoint via a type adapter.
- items – Get the items of the repository
- keys – Get the keys of the repository
- values – Get the values of the repository
fetch_data¤
Fetch a paged list from a JSON endpoint via a type adapter.
Use this method to fetch data if your result set is a pageable spring endpoint.
items¤
Get the items of the repository
keys¤
Get the keys of the repository
logger¤
Gets the client logger
values¤
Get the values of the repository