import { AxiosInstance, AxiosRequestConfig, AxiosResponse, AxiosError, InternalAxiosRequestConfig } from 'axios'; export interface RequestConfig extends AxiosRequestConfig { showError?: boolean; retry?: number; retryDelay?: number; } export interface ApiResponse { code: number; message: string; data: T; success: boolean; } export interface RequestError { code: number; message: string; details?: any; } export interface RequestInterceptor { onRequest?: (config: InternalAxiosRequestConfig) => InternalAxiosRequestConfig | Promise; onRequestError?: (error: AxiosError) => Promise; } export interface ResponseInterceptor { onResponse?: (response: AxiosResponse>) => AxiosResponse> | Promise>>; onResponseError?: (error: AxiosError) => Promise; } export interface CreateRequestConfig { baseURL?: string; timeout?: number; headers?: Record; requestInterceptor?: RequestInterceptor; responseInterceptor?: ResponseInterceptor; onError?: (error: RequestError) => void; } /** * 创建请求实例 */ export declare function createRequest(config?: CreateRequestConfig): AxiosInstance; /** * 通用 GET 请求 */ export declare function get(url: string, params?: any, config?: RequestConfig): Promise>; /** * 通用 POST 请求 */ export declare function post(url: string, data?: any, config?: RequestConfig): Promise>; /** * 通用 PUT 请求 */ export declare function put(url: string, data?: any, config?: RequestConfig): Promise>; /** * 通用 DELETE 请求 */ export declare function del(url: string, config?: RequestConfig): Promise>; /** * 通用 PATCH 请求 */ export declare function patch(url: string, data?: any, config?: RequestConfig): Promise>; /** * 文件上传 */ export declare function upload(url: string, file: File, onProgress?: (progress: number) => void, config?: RequestConfig): Promise>; /** * 下载文件 */ export declare function download(url: string, filename?: string, config?: RequestConfig): Promise; export declare const request: AxiosInstance; declare const _default: { createRequest: typeof createRequest; get: typeof get; post: typeof post; put: typeof put; del: typeof del; patch: typeof patch; upload: typeof upload; download: typeof download; request: AxiosInstance; }; export default _default;