import {PlainObject} from "../types"; export declare type ApiMethod = 'get' | 'post' | 'put' | 'patch' | 'delete' | 'download' | 'post-json' | 'post-file' | 'invoke' | 'sql' | string; export declare type ApiDataType = 'json' | 'form-data' | 'form'; export interface ApiObject { url: string; param: PlainObject; method: ApiMethod; data?: object; args: any[]; db?: string; headers?: PlainObject; filterModel?: { [key: string]: any; }; sortModel?: { colId: string | undefined; sort: string | null | undefined; }[]; config?: { withCredentials?: boolean; cancelExecutor?: (cancel: Function) => void; }; dataType?: ApiDataType; /** * 下载文件名 */ fileName?: string; /** * 上传文件(如果需要的话) */ file?: any; } export declare type ApiFunction = (api: ApiObject) => Promise; /** * 组件中 Api 的声明 */ export declare type Api = ApiFunction | ApiObject; export interface ApiResult { rawData: object; status: number; headers: object; data?: any; pagination?: any; success: boolean; msg: string; errors?: { [propName: string]: string; }; } export interface CreateAjaxOption { baseUrl: string; timeout: number; } /** * 创建一个 Ajax 客户端 */ export declare function createAjax(createOption: CreateAjaxOption): ApiFunction; export declare function downLoad(downLoadUrl: string, filename: string, data: any, header: any, isJson?: boolean): void;