import { Result } from 'ahooks/lib/useRequest/src/types';
import { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
export interface ActionParams {
filterByTk?: any;
[key: string]: any;
}
declare type ResourceActionOptions
= {
resource?: string;
resourceOf?: any;
action?: string;
params?: P;
};
export interface IResource {
list?: (params?: ActionParams) => Promise;
get?: (params?: ActionParams) => Promise;
create?: (params?: ActionParams) => Promise;
update?: (params?: ActionParams) => Promise;
destroy?: (params?: ActionParams) => Promise;
[key: string]: (params?: ActionParams) => Promise;
}
export declare class APIClient {
axios: AxiosInstance;
services: Record>;
tokenKey: string;
constructor(instance?: AxiosInstance | AxiosRequestConfig);
qsMiddleware(): void;
authMiddleware(): void;
setBearerToken(token: any): void;
service(uid: string): Result;
request, D = any>(config: AxiosRequestConfig | ResourceActionOptions): Promise;
resource(name: string, of?: any): IResource;
}
export {};