import Resource, { ListResponse } from './index'; import { AxiosPromise, AxiosRequestConfig, AxiosResponse, AxiosError, AxiosInstance } from 'axios'; export * from 'axios'; export interface RequestConfig extends AxiosRequestConfig { useCache?: boolean; query?: any; } export interface ResourceResponse extends Record { response: AxiosResponse; resources: T[]; count?: () => number; pages?: () => number; currentPage?: () => number; perPage?: () => number; next?: () => Promise>; previous?: () => Promise>; } export declare type ExtractorFunction = (result: ResourceResponse['response']) => ResourceResponse; export declare class BaseClient { axios: AxiosInstance; config: AxiosRequestConfig; constructor(baseURL: string, config?: AxiosRequestConfig); hostname: string; static extend(this: U, classProps: T): U & T; negotiateContent(ResourceClass: T): ExtractorFunction>; /** * Client.prototype.list() and Client.prototype.detail() are the primary purpose of defining these here. Simply runs a GET on the list route path (eg. /users) and negotiates the content * @param ResourceClass * @param options */ list(ResourceClass: T, options?: RequestConfig): ListResponse; /** * Client.prototype.detail() and Client.prototype.list() are the primary purpose of defining these here. Simply runs a GET on the detail route path (eg. /users/123) and negotiates the content * @param ResourceClass * @param options */ detail(ResourceClass: T, id: string, options?: RequestConfig): Promise, any>>; get(path: string, options?: AxiosRequestConfig): AxiosPromise; put(path: string, body?: any, options?: AxiosRequestConfig): AxiosPromise; post(path: string, body?: any, options?: AxiosRequestConfig): AxiosPromise; patch(path: string, body?: any, options?: AxiosRequestConfig): AxiosPromise; delete(path: string, options?: AxiosRequestConfig): AxiosPromise; head(path: string, options?: AxiosRequestConfig): AxiosPromise; options(path: string, options?: AxiosRequestConfig): AxiosPromise; bindMethodsToPath(relativePath: string): { get: (options?: AxiosRequestConfig) => AxiosPromise<{}>; post: (body?: any, options?: AxiosRequestConfig) => AxiosPromise<{}>; put: (body?: any, options?: AxiosRequestConfig) => AxiosPromise<{}>; patch: (body?: any, options?: AxiosRequestConfig) => AxiosPromise<{}>; head: (options?: AxiosRequestConfig) => AxiosPromise<{}>; options: (options?: AxiosRequestConfig) => AxiosPromise<{}>; delete: (options?: AxiosRequestConfig) => AxiosPromise<{}>; }; onError(exception: Error | AxiosError): any; } export declare class DefaultClient extends BaseClient { } export declare class JWTBearerClient extends BaseClient { token: string; constructor(baseURL: string, token?: string, options?: RequestConfig); getTokenPayload(): any; tokenIsExpired(): boolean; tokenIsValid(): boolean; }