@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
78 lines (77 loc) • 2.72 kB
TypeScript
import { GenerateRule, Request, IRequest } from "../request";
import { RequestInfo } from "../interchange";
import { Header } from "../utils/headers";
export declare class UapiRequest extends Request {
/**
* Add a custom HTTP header to the request
*
* @param name Name of a column
* @return Updated Request object.
*/
addHeader(header: Header): Request;
/**
* Build a fragment of the parameter list based on the list of name/value pairs.
*
* @param params Parameters to serialize.
* @param encoder Encoder to use to serialize the each parameter.
* @return Fragment with the serialized parameters
*/
private _build;
/**
* Generates the arguments for the request.
*
* @param params List of parameters to adjust based on the sort rules in the Request.
*/
private _generateArguments;
/**
* Generates the sort parameters for the request.
*
* @param params List of parameters to adjust based on the sort rules in the Request.
*/
private _generateSorts;
/**
* Look up the correct name for the filter operator
*
* @param operator Type of filter operator to use to filter the items
* @returns The string counter part for the filter operator.
* @throws Will throw an error if an unrecognized FilterOperator is provided.
*/
private _lookupFilterOperator;
/**
* Generate the filter parameters if any.
*
* @param params List of parameters to adjust based on the filter rules provided.
*/
private _generateFilters;
/**
* In UAPI, we request the starting record, not the starting page. This translates
* the page and page size into the correct starting record.
*/
private _traslatePageToStart;
/**
* Generate the pager request parameters, if any.
*
* @param params List of parameters to adjust based on the pagination rules.
*/
private _generatePagination;
/**
* Generate any additional parameters from the configuration data.
*
* @param params List of parameters to adjust based on the configuration.
*/
private _generateConfiguration;
/**
* Create a new uapi request.
*
* @param init Optional request objects used to initialize this object.
*/
constructor(init?: IRequest);
/**
* Generate the interchange object that has the pre-encoded
* request using UAPI formatting.
*
* @param rule Optional parameter to specify a specific Rule we want the Request to be generated for.
* @return Request information ready to be used by a remoting layer
*/
generate(rule?: GenerateRule): RequestInfo;
}