Utility Functions

async o2a_registry.utils.pagination.paginated_get_all(request: Callable[[str, List[str], int, int], Awaitable[List[T]]], *args: Any, hits=100, **kwargs: Any) List[T]

Returns all entries of a paginated endpoint.

Parameters:
  • request – Paginated endpoint request

  • where – RSQL QUERY (e.g. “id==90”).

  • sorts – List of field names to sort by.

  • offset – Number of records to skip before returning data.

  • hits – Number of records to return.

Returns:

List of entries of the endpoint.

Raises:

aiohttp.ClientResponseError – If the request fails.

async o2a_registry.utils.pagination.paginated_iter(request: Callable[[str, List[str], int, int], Awaitable[List[T]]], *args: Any, hits=100, **kwargs: Any) AsyncGenerator[T, None]

Returns a generator over all entries of a paginated endpoint. Generator only loads the next page if the previous page was processed.

Parameters:
  • request – Paginated endpoint request

  • where – RSQL QUERY (e.g. “id==90”).

  • sorts – List of field names to sort by.

  • offset – Number of records to skip before returning data.

  • hits – Number of records to return.

Returns:

Generator over all entries of a paginated endpoint.

Raises:

aiohttp.ClientResponseError – If the request fails.