Skip to content

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¤

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 as totalElements.
  • total_pages (int) – Total number of pages, sent as totalPages.

model_config¤

model_config = ConfigDict(extra='allow', populate_by_name=True)

number¤

number: int

size¤

size: int

total_elements¤

total_elements: int = Field(alias='totalElements')

total_pages¤

total_pages: int = Field(alias='totalPages')

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 by fetch_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_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¤

items()

Get the items of the repository

keys¤

keys()

Get the keys of the repository

logger¤

logger: logging.Logger

Gets the client logger

values¤

values()

Get the values of the repository

Comments