UNPKG

1.7 kBTypeScriptView Raw
1/** @module data */
2/**
3 * Data transfer object that is used to pass results of paginated queries.
4 * It contains items of retrieved page and optional total number of items.
5 *
6 * Most often this object type is used to send responses to paginated queries.
7 * Pagination parameters are defined by [[PagingParams]] object.
8 * The <code>skip</code> parameter in the PagingParams there means how many items to skip.
9 * The <code>takes</code> parameter sets number of items to return in the page.
10 * And the optional <code>total</code> parameter tells to return total number of items in the query.
11 *
12 * Remember: not all implementations support the <code>total</code> parameter
13 * because its generation may lead to severe performance implications.
14 *
15 * @see [[PagingParams]]
16 *
17 * ### Example ###
18 *
19 * myDataClient.getDataByFilter(
20 * "123",
21 * FilterParams.fromTuples("completed": true),
22 * new PagingParams(0, 100, true),
23 * (err: any, page: DataPage<MyData>) => {
24 * if (err == null) {
25 * console.log("Items: ");
26 * for (let item of page.Data) {
27 * console.log(item);
28 * }
29 * console.log("Total items: " + page.total);
30 * }
31 * };
32 * );
33 */
34export declare class DataPage<T> {
35 /** The items of the retrieved page. */
36 data: T[];
37 /** The total amount of items in a request. */
38 total: number;
39 /**
40 * Creates a new instance of data page and assigns its values.
41 *
42 * @param data a list of items from the retrieved page.
43 * @param total (optional) .
44 */
45 constructor(data?: T[], total?: number);
46}