export interface IResult { statusCode: number; fromCache: boolean; body: T; } export declare class HTTPError extends Error { readonly status: number; message: string; readonly response: any; readonly code: string; constructor(status: number, message: string, response?: any); } export interface IXHDeleteOptions extends IXHROptions { csrf?: boolean; } export interface IXHRPostPutOptions extends IXHROptions { withCredentials?: boolean; formBinary?: boolean; form?: boolean; csrf?: boolean; sync?: boolean; } export interface IXHRGetOptions extends IXHROptions { allowCache?: boolean; encodeURI?: boolean; delay?: number; } interface IXHROptions { json?: boolean; jsonError?: boolean; } declare class API { private _cache; private _calls; private _url; constructor(); set serverURL(url: string); clearCache(url?: string): void; abortCallSimple(urlPart: string): void; abortAll(): void; isCalling(url: string): boolean; private abortCall; /** * get('/api/users/').then(func).error(func) * @param url * @param data * @param allowCache get data from cache if available * @returns {Promise} */ get: (url: string, data?: any, options?: IXHRGetOptions | null) => Promise>; /** * put('/api/users/', {name:'jelle'}).then(func).error(func) * @param url * @param data * @returns {Promise} */ put: (url: string, data: any, options?: IXHRPostPutOptions | null) => Promise>; post: (url: string, data?: any, options?: IXHRPostPutOptions | null) => Promise>; delete: (url: string, data?: any, options?: IXHDeleteOptions | null) => Promise>; private parseJSON; parseURIParams(params: any, encode: boolean): string; private call; private xhrCall; } /** * @deprecated use axios instead */ export declare const api: API; export {};