@cpanel/api
Version:
cPanel API JavaScript and TypeScript interface libraries. This library provides a set of classes for calling cPanel WHM API 1 and UAPI calls. The classes hide much of the complexity of these APIs behind classes the abstract the underlying variances betwee
47 lines (46 loc) • 1.69 kB
TypeScript
export declare const DEFAULT_PAGE_SIZE = 20;
/**
* When passed in the pageSize, will request all available records in a single page. Note: The backend process may not honor this request.
*/
export declare const ALL: number;
/**
* Interface for a pagination request.
*/
export interface IPager {
/**
* One-based index of the pages of data.
*/
page: number;
/**
* Number of elements a page of data is composed of. This is the requested page size, if there are less than this number of records in the set, only the remaining records are returned.
*/
pageSize: number;
}
/**
* Defines a pagination request for an API.
*/
export declare class Pager implements IPager {
/**
* One-based index of the pages of data.
*/
page: number;
/**
* Number of elements a page of data is composed of. This is the requested page size, if there are less than this number of records in the set, only the remaining records are returned.
*/
pageSize: number;
/**
* Create a new pagination object.
*
* @param page Page to request. From 1 .. n where n is the set.length % pageSize. Defaults to 1.
* @param pageSize Number of records to request in a page of data. Defaults to DEFAULT_PAGE_SIZE.
* If the string 'all' is passed, then all the records are requested. Note: The backend
* system may still impose page size limits in this case.
*/
constructor(page?: number, pageSize?: number);
/**
* Check if the pagesize is set to ALL.
*
* @return true if requesting all records, false otherwise.
*/
all(): boolean;
}