@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
81 lines (80 loc) • 2.4 kB
TypeScript
import { IMetaData } from "../metadata";
import { Response, ResponseOptions } from "../response";
/**
* This class will extract the available metadata from the UAPI format into a standard format for JavaScript developers.
*/
export declare class UapiMetaData implements IMetaData {
/**
* Indicates if the data is paged.
*/
isPaged: boolean;
/**
* The record number of the first record of a page.
*/
record: number;
/**
* The current page.
*/
page: number;
/**
* The page size of the returned set.
*/
pageSize: number;
/**
* The total number of records available on the backend.
*/
totalRecords: number;
/**
* The total number of pages of records on the backend.
*/
totalPages: number;
/**
* Indicates if the data set if filtered.
*/
isFiltered: boolean;
/**
* Number of records available before the filter was processed.
*/
recordsBeforeFilter: number;
/**
* Indicates the response was the result of a batch API.
*/
batch: boolean;
/**
* A collection of the other less common or custom UAPI metadata properties.
*/
properties: {
[index: string]: any;
};
/**
* Build a new MetaData object from the metadata response from the server.
*
* @param meta UAPI metadata object.
*/
constructor(meta: any);
}
/**
* Parser that will convert a UAPI wire-formated object into a standard response object for JavaScript developers.
*/
export declare class UapiResponse extends Response {
/**
* Parse out the status from the response.
*
* @param response Raw response object from the backend. Already passed through JSON.parse().
* @return Number indicating success or failure. > 1 success, 0 failure.
*/
private _parseStatus;
/**
* Parse out the messages from the response.
*
* @param response The response object sent by the API method.
*/
private _parseMessages;
/**
* Parse out the status, data and metadata from a UAPI response into the abstract Response and IMetaData structures.
*
* @param response Raw response from the server. It's just been JSON.parse() at this point.
* @param Options on how to handle parsing of the response.
*/
constructor(response: any, options?: ResponseOptions);
}