pip_services3_commons.data.TokenizedPagingParams module

class pip_services3_commons.data.TokenizedPagingParams.TokenizedPagingParams(token: str = None, take: int = None, total: bool = None)

Bases: object

Data transfer object to pass tokenized paging parameters for queries. It can be used for complex paging scenarios, like paging across multiple databases where the previous state is encoded in a token. The token is usually retrieved from the previous response. The initial request shall go with token == None

The page is defined by two parameters: - the token token that defines a starting point for the search. - the take parameter sets how many items to return in a page. - additionally, the optional total parameter tells to return total number of items in the query.

Remember: not all implementations support the total parameter because its generation may lead to severe performance implications.

Example:

filter = FilterParams.from_tuples("type", "Type1");
paging = TokenizedPagingParams(None, 100);

result = my_data_client.get_data_by_filter(filter, paging)
static from_map(map: pip_services3_commons.data.AnyValueMap.AnyValueMap)pip_services3_commons.data.TokenizedPagingParams.TokenizedPagingParams

Creates a new TokenizedPagingParams and sets it parameters from the specified map

Parameters

map – a AnyValueMap or StringValueMap to initialize this TokenizedPagingParams

Returns

a newly created PagingParams.

static from_tuple(*tuples: Any)pip_services3_commons.data.TokenizedPagingParams.TokenizedPagingParams

Creates a new TokenizedPagingParams from a list of key-value pairs called tuples.

Parameters

tuples – a list of values where odd elements are keys and the following even elements are values

Returns

a newly created TokenizedPagingParams.

static from_value(value: Any)pip_services3_commons.data.TokenizedPagingParams.TokenizedPagingParams

Converts specified value into TokenizedPagingParams.

Parameters

value – value to be converted

Returns

a newly created PagingParams.

get_take(max_take: int)int

Gets the number of items to return in a page.

Parameters

max_take – the maximum number of items to return.

Returns

the number of items to return.