pdstools.infinity.internal._pagination¶
Attributes¶
Classes¶
A lazy slice view over a |
|
Abstracts pagination of Pega API |
|
Async variant of |
Module Contents¶
- T¶
- class _Slice(the_list: PaginatedList[T], the_slice: slice)¶
Bases:
Generic[T]A lazy slice view over a
PaginatedList.- Parameters:
the_list (PaginatedList[T])
the_slice (slice)
- _list¶
- _start¶
- _stop¶
- _step¶
- __iter__() collections.abc.Iterator[T]¶
- Return type:
- as_df() polars.DataFrame¶
- Return type:
polars.DataFrame
- class PaginatedList(content_class: Any, client: Any, request_method: str, url: str, extra_attribs: dict[str, Any] | None = None, _root: str | None = None, **kwargs: Any)¶
Bases:
Generic[T]Abstracts pagination of Pega API
Currently supports format where a ‘nextToken’ is supplied and the next page is retrieved by supplying that token as the ‘pageToken’ of the next call to the same URL.
Can be iterated, indexed or sliced.
- Parameters:
- _client¶
- _content_class¶
- _url¶
- _first_params¶
- _next_params¶
- _extra_attribs¶
- _request_method¶
- _root = None¶
- get(__key: int | str, __default: str | None) T¶
- get(__key: slice, __default: str | None) _Slice[T]
Returns the specified key or default.
If string type provided as key, the content_class needs to be a Pydantic class, with an attribute called ‘id’.
- __iter__() collections.abc.Iterator[T]¶
- Return type:
- class AsyncPaginatedList(content_class: Any, client: Any, request_method: str, url: str, extra_attribs: dict[str, Any] | None = None, _root: str | None = None, **kwargs: Any)¶
Bases:
Generic[T]Async variant of
PaginatedList.Same constructor interface. Uses
await client.request(...)and exposesasync foriteration via__aiter__.- Parameters:
- _client¶
- _content_class¶
- _url¶
- _first_params¶
- _next_params¶
- _extra_attribs¶
- _request_method¶
- _root = None¶
- async __aiter__() collections.abc.AsyncIterator[T]¶
- Return type:
- async get(__key: int | slice | str | None = None, __default: str | None = None, **kwargs: Any) T | None¶
Async version of PaginatedList.get().
- async as_df() polars.DataFrame¶
Collect all pages into a polars DataFrame.
- Return type:
polars.DataFrame