UNPKG

2.53 kBTypeScriptView Raw
1/**
2 * Data transfer object to pass paging parameters for queries.
3 *
4 * The page is defined by two parameters:
5 * - the <code>skip</code> parameter defines number of items to skip.
6 * - the <code>take</code> parameter sets how many items to return in a page.
7 * - additionally, the optional <code>total</code> parameter tells to return total number of items in the query.
8 *
9 * Remember: not all implementations support the <code>total</code> parameter
10 * because its generation may lead to severe performance implications.
11 *
12 * ### Example ###
13 *
14 * let filter = FilterParams.fromTuples("type", "Type1");
15 * let paging = new PagingParams(0, 100);
16 *
17 * myDataClient.getDataByFilter(filter, paging, (err, page) => {...});
18 */
19export declare class PagingParams {
20 /** The number of items to skip. */
21 skip: number;
22 /** The number of items to return. */
23 take: number;
24 /** The flag to return the total number of items. */
25 total: boolean;
26 /**
27 * Creates a new instance and sets its values.
28 *
29 * @param skip the number of items to skip.
30 * @param take the number of items to return.
31 * @param total true to return the total number of items.
32 */
33 constructor(skip?: any, take?: any, total?: any);
34 /**
35 * Gets the number of items to skip.
36 *
37 * @param minSkip the minimum number of items to skip.
38 * @returns the number of items to skip.
39 */
40 getSkip(minSkip: number): number;
41 /**
42 * Gets the number of items to return in a page.
43 *
44 * @param maxTake the maximum number of items to return.
45 * @returns the number of items to return.
46 */
47 getTake(maxTake: number): number;
48 /**
49 * Converts specified value into PagingParams.
50 *
51 * @param value value to be converted
52 * @returns a newly created PagingParams.
53 */
54 static fromValue(value: any): PagingParams;
55 /**
56 * Creates a new PagingParams from a list of key-value pairs called tuples.
57 *
58 * @param tuples a list of values where odd elements are keys and the following even elements are values
59 * @returns a newly created PagingParams.
60 */
61 static fromTuples(...tuples: any[]): PagingParams;
62 /**
63 * Creates a new PagingParams and sets it parameters from the specified map
64 *
65 * @param map a AnyValueMap or StringValueMap to initialize this PagingParams
66 * @returns a newly created PagingParams.
67 */
68 static fromMap(map: any): PagingParams;
69}