UNPKG

filestack-js

Version:

Official JavaScript library for Filestack

153 lines (152 loc) 3.82 kB
import { FsRequestOptions, FsResponse } from './types'; /** * Main isomorphic Filestack request library * * @export * @class FsRequest */ export declare class FsRequest { /** * Request static instance * * @private * @static * @type {FsRequest} * @memberof FsRequest */ private static instance; /** * Default request options * * @private * @type {RequestOptions} * @memberof FsRequest */ private defaults; /** * Request Dispatcher * * @private * @type {Dispatch} * @memberof FsRequest */ private dispatcher; /** * Creates an instance of Request. * * @param {RequestOptions} [config] * @memberof FsRequest */ constructor(config?: FsRequestOptions); /** * Returns static FsRequest instance * * @private * @static * @returns * @memberof FsRequest */ private static getInstance; /** * Run request with given adapter * * @param {RequestOptions} config * @returns * @memberof Request */ dispatch(config: FsRequestOptions): Promise<FsResponse>; /** * Dispatch request * * @static * @param {string} url * @param {FsRequestOptions} config * @returns {Promise<FsResponse>} * @memberof FsRequest */ static dispatch(url: string, config: FsRequestOptions): Promise<FsResponse>; /** * Dispatch GET request * * @static * @param {string} url * @param {FsRequestOptions} config * @returns {Promise<FsResponse>} * @memberof FsRequest */ static get(url: string, config?: FsRequestOptions): Promise<FsResponse>; /** * Dispatch HEAD request * * @static * @param {string} url * @param {FsRequestOptions} config * @returns {Promise<FsResponse>} * @memberof FsRequest */ static head(url: string, config?: FsRequestOptions): Promise<FsResponse>; /** * Dispatch OPTIONS request * * @static * @param {string} url * @param {FsRequestOptions} config * @returns {Promise<FsResponse>} * @memberof FsRequest */ static options(url: string, config?: FsRequestOptions): Promise<FsResponse>; /** * Dispatch PURGE request * * @static * @param {string} url * @param {FsRequestOptions} config * @returns {Promise<FsResponse>} * @memberof FsRequest */ static purge(url: string, config?: FsRequestOptions): Promise<FsResponse>; /** * Dispatch DELETE request * * @static * @param {string} url * @param {FsRequestOptions} config * @returns {Promise<FsResponse>} * @memberof FsRequest */ static delete(url: string, config?: FsRequestOptions): Promise<FsResponse>; /** * Dispatch POST request * * @static * @param {string} url * @param {*} [data] * @param {FsRequestOptions} [config] * @returns {Promise<FsResponse>} * @memberof FsRequest */ static post(url: string, data?: any, config?: FsRequestOptions): Promise<FsResponse>; /** * Dispatch PUT request * * @static * @param {string} url * @param {*} [data] * @param {FsRequestOptions} [config] * @returns {Promise<FsResponse>} * @memberof FsRequest */ static put(url: string, data?: any, config?: FsRequestOptions): Promise<FsResponse>; /** * Dispatch PATCH request * * @static * @param {string} url * @param {*} [data] * @param {FsRequestOptions} [config] * @returns {Promise<FsResponse>} * @memberof FsRequest */ static path(url: string, data?: any, config?: FsRequestOptions): Promise<FsResponse>; } export default FsRequest;