DataPage<T>

Data transfer object that is used to pass the results of a paginated query. This object contains items of the retrieved page.

Description

The DataPage class allows you to create a data transfer object that can be used to pass the results of a paginated query. This object contains items of the retrieved page.

Important points

  • Most often, this object type is used to send responses to paginated queries.
  • Pagination parameters are defined by a PagingParams object.
  • The skip parameter in the PagingParams indicates how many items to skip.
  • The takes parameter sets number of items to return in the page.
  • An optional total paramter allows you to specify the total number of items returned from a request. However, not all implementations support the total parameter because its generation may lead to severe performance implications.

Constructors

Creates a new instance of DataPage and assigns its values.

public constructor(data: T[] = null, total: number = null)

  • data: T[] - list of items from the retrieved page.
  • total: number - total amount of items in a request.

Fields

data

Items of the retrieved page.

public data: T[]

total

Total amount of items in a request.

public total: number

Examples

let page = await myDataClient.getDataByFilter(
    "123",
    FilterParams.fromTuples("completed": true),
    new PagingParams(0, 100, true)
);

See also