import { Plugin } from '../types';
/**
 * RequestPlugin 接口定义
 */
export interface RequestPlugin extends Plugin {
    /**
     * 发起 GET 请求
     * @param url 请求地址
     * @param options 请求选项
     */
    get: <T = any>(url: string, data?: any, options?: RequestOptions) => Promise<T>;
    /**
     * 发起 POST 请求
     * @param url 请求地址
     * @param data 请求数据
     * @param options 请求选项
     */
    post: <T = any>(url: string, data?: any, options?: RequestOptions) => Promise<T>;
    /**
     * 发起 PUT 请求
     * @param url 请求地址
     * @param data 请求数据
     * @param options 请求选项
     */
    put: <T = any>(url: string, data?: any, options?: RequestOptions) => Promise<T>;
    /**
     * 发起 DELETE 请求
     * @param url 请求地址
     * @param options 请求选项
     */
    delete: <T = any>(url: string, options?: RequestOptions) => Promise<T>;
    /**
     * 通用请求方法
     * @param options 完整的请求选项
     */
    request: <T = any>(options: RequestOptions) => Promise<T>;
}
export declare enum RequestModeENUM {
    LOCAL = "local",
    REMOTE = "remote",
    LOCAL_REMOTE = "local_remote",
    REMOTE_LOCAL = "remote_local",
    OS_SERVER = "os_server"
}
export type RequestModeType = RequestModeENUM.LOCAL | RequestModeENUM.REMOTE | RequestModeENUM.LOCAL_REMOTE | RequestModeENUM.REMOTE_LOCAL | RequestModeENUM.OS_SERVER;
export type CacheType = 'memory' | 'storage' | 'indexDB';
export interface CacheProps {
    key?: string;
    type?: CacheType;
    updateCache?: boolean;
    cacheUpdateChange?: (data: any) => void;
    mode?: RequestModeType;
    cacheKeyData?: any;
}
/**
 * 请求配置
 */
export interface RequestOptions {
    url?: string;
    method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
    headers?: Record<string, string>;
    data?: any;
    body?: any;
    params?: Record<string, string | number | boolean>;
    timeout?: number;
    responseType?: 'json' | 'text' | 'arraybuffer' | 'blob';
    withCredentials?: boolean;
    useCache?: boolean;
    customToast?: () => void;
    cache?: CacheProps;
    osServer?: boolean;
    callback?: (res: any) => void;
    subscriberId?: string;
}
/**
 * 响应接口
 */
export interface Response<T = any> {
    data: T;
    status: number;
    statusText: string;
    headers: Record<string, string>;
    config: RequestOptions;
}
/**
 * 请求错误
 */
export declare class RequestError extends Error {
    response?: Response;
    request?: any;
    config?: RequestOptions;
    constructor(message: string, config?: RequestOptions, request?: any, response?: Response);
}
/**
 * RequestPlugin 实现
 */
declare class RequestPluginImpl implements RequestPlugin {
    name: string;
    version: string;
    private core;
    /**
     * 默认请求选项
     */
    private defaultOptions;
    /**
     * 全局拦截器
     */
    private interceptors;
    initialize(): void;
    destroy(): void;
    /**
     * 添加请求拦截器
     */
    addRequestInterceptor(interceptor: (config: RequestOptions) => RequestOptions | Promise<RequestOptions>): void;
    /**
     * 添加响应拦截器
     */
    addResponseInterceptor(interceptor: (response: Response) => Response | Promise<Response>): void;
    /**
     * 添加错误拦截器
     */
    addErrorInterceptor(interceptor: (error: RequestError) => RequestError | Promise<RequestError>): void;
    /**
     * GET 请求
     */
    get<T = any>(url: string, options?: RequestOptions): Promise<T>;
    /**
     * POST 请求
     */
    post<T = any>(url: string, data?: any, options?: RequestOptions): Promise<T>;
    /**
     * PUT 请求
     */
    put<T = any>(url: string, data?: any, options?: RequestOptions): Promise<T>;
    /**
     * DELETE 请求
     */
    delete<T = any>(url: string, options?: RequestOptions): Promise<T>;
    /**
     * 通用请求方法
     */
    request<T = any>(options: RequestOptions): Promise<T>;
    /**
     * 执行实际的请求
     * 这里实现了一个基于 fetch API 的请求
     */
    private performRequest;
}
declare const _default: RequestPluginImpl;
export default _default;
