pdstools.infinity.internal._pagination

Attributes

T

Classes

PaginatedList

Abstracts pagination of Pega API

Module Contents

T
class PaginatedList(content_class, client, request_method, url, extra_attribs=None, _root=None, **kwargs)

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.

_elements = []
_client
_content_class
_url
_first_params
_next_token = True
_next_params
_extra_attribs
_request_method
_root = None
__getitem__(key: str | int) T
__getitem__(index: slice) _Slice[T]
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’.

Parameters:
  • __key (int | slice | str) – Can be a int (index), slice (start:end), or string (id attribute)

  • __default (str | None, optional) – The value to return if none found, by default None

Returns:

The element, or slice of elements. If not found, returns default

Return type:

Any

__iter__() Iterator[T]
Return type:

Iterator[T]

__repr__()
_get_next_page()
_get_up_to_index(index)
_grow()
_has_next()
_is_larger_than(index)
class _Slice(the_list: PaginatedList, the_slice: slice)

Bases: Generic[T]

Abstract base class for generic types.

A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:

class Mapping(Generic[KT, VT]):
    def __getitem__(self, key: KT) -> VT:
        ...
    # Etc.

This class can then be used as follows:

def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:
    try:
        return mapping[key]
    except KeyError:
        return default
Parameters:
_list
_start
_stop
_step
__iter__() Iterator[T]
Return type:

Iterator[T]

__getitem__(index: int)
Parameters:

index (int)

_finished(index)
as_df()