TokenizedPagingParams!

Data transfer object used to pass tokenized paging parameters for queries.

TODO: this class is not realized yet for this language

Description

The TokenizedPagingParams allows you to create data transfer objects used to pass tokenized parameters for queries.

Important points

  • 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 the total number of items in the query.
  • However, not all implementations support the total parameter because its generation may lead to severe performance implications.
  • In general, this class 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

Constructors

Creates a new instance and sets its values.

public constructor(token: string = null, take: number = null, total: boolean = null)

  • token: string - token that defines a starting point for the search.
  • take: number - the number of items to return.
  • total: boolean - true to return the total number of items.

Fields

token

The start token

public token: string

take

The number of items to return.

public take: number

total

The flag to return the total number of items.

public total: boolean

Instance methods

getTake

Gets the number of items to return in a page.

public getTake(maxTake: number): number

  • maxTake: number - the maximum number of items to return.
  • returns: number - the number of items to return.

Static methods

fromMap

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

public static fromMap(map: AnyValueMap): TokenizedPagingParams

fromTuples

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

public static fromTuples(…tuples: any[]): TokenizedPagingParams

  • tuples: any[] - a list of values where odd elements are keys and the following even elements are values
  • returns: TokenizedPagingParams - a newly created TokenizedPagingParams.

fromValue

Converts specified value into TokenizedPagingParams.

public static fromValue(value: any): TokenizedPagingParams

Examples

let filter = FilterParams.fromTuples("type", "Type1");
let paging = new TokenizedPagingParams(null, 100);
     
myDataClient.getDataByFilter(filter, paging, (err, page) => {...});