/// import { RequestOptions } from 'https'; import { URL } from 'url'; import { CentraResponse } from './CentraResponse'; export declare type HTTPMethod = 'GET' | 'POST' | 'PATCH' | 'DELETE' | 'PUT'; export declare class CentraRequest { httpMethod: HTTPMethod; url: URL; data: string | Buffer | null; sendDataAs: 'form' | 'json' | 'buffer' | null; reqHeaders: { [header: string]: string; }; coreOptions: RequestOptions; /** * Creates an instance of CentraRequest. * @param {(string | URL)} url * @param {HTTPMethod} [httpMethod='GET'] * @memberof CentraRequest */ constructor(url: string | URL, httpMethod?: HTTPMethod); /** * * * @param {string} key * @param {*} value * @return {*} {this} * @memberof CentraRequest */ query(key: string, value: any): this; /** * * * @param {string} relativePath * @return {*} {this} * @memberof CentraRequest */ path(relativePath: string): this; /** * * * @param {*} data * @param {('json' | 'buffer' | 'form')} [sendAs] * @return {*} {this} * @memberof CentraRequest */ body(data: any, sendAs?: 'json' | 'buffer' | 'form'): this; /** * * * @param {(string | { [k: string]: string })} header * @param {string} [value] * @return {*} {this} * @memberof CentraRequest */ header(header: string | { [k: string]: string; }, value?: string): this; /** * * * @param {HTTPMethod} method * @return {*} {this} * @memberof CentraRequest */ method(method: HTTPMethod): this; /** * * * @param {number} timeout * @return {*} {this} * @memberof CentraRequest */ timeout(timeout: number): this; /** * * * @template T * @param {T} key * @param {RequestOptions[T]} value * @return {*} {this} * @memberof CentraRequest */ option(key: T, value: RequestOptions[T]): this; /** * * * @return {*} {Promise} * @memberof CentraRequest */ json(): Promise; /** * * * @return {*} {Promise} * @memberof CentraRequest */ raw(): Promise; /** * * * @return {*} {Promise} * @memberof CentraRequest */ text(): Promise; /** * * * @return {*} {Promise} * @memberof CentraRequest */ send(): Promise; }