import { AxiosRequestConfig, Method } from "axios"; import fs from "fs"; declare class PresetMixin { /** * 存储预置参数 */ protected presets: Record; /** * 存储预置headers数据 */ protected prependHeaders: Record; /** * 存储预置数据 */ protected prependData: Record; /** * 存储预置文件数据 */ protected prependFiles: Record; /** * 设置预置参数 * @param presets * @returns */ setPresets(presets: Record): this; /** * 设置单个预置header * @param key * @param value * @returns */ withHeader(key: string, value: any): this; /** * 批量设置预置headers * @param headers * @returns */ withHeaders(headers: Record): this; /** * 设置预置数据 * @param key 参数名 * @param value 参数值,不设置则尝试从预置参数中获取 * @returns */ with(key: string | string[] | Record, value?: string): this; /** * 预设置app_id(因nodejs不支持魔术方法,只好预先设置几个常用的方法) * @param new_appid * @returns */ withAppId(new_appid?: string): this; /** * 预设置app_id的别名(因nodejs不支持魔术方法,只好预先设置几个常用的方法) * @param new_alias * @returns */ withAppIdAs(new_alias: string): this; /** * 预设置secret(因nodejs不支持魔术方法,只好预先设置几个常用的方法) * @param new_secret * @returns */ withSecret(new_secret?: string): this; /** * 预设置文件 * @param file 文件路径或可读文件流 * @param key 参数名,默认:'file' * @returns */ withFile(file: string | fs.ReadStream, key?: string): this; /** * 预设置多个文件 * @param files 键名:文件名,键值:文件路径或可读文件流 * @returns */ withFiles(files: Record): this; /** * 合并预置参数并清空预置数据 * @param payload * @param method * @returns */ mergeThenResetPrepends(payload: AxiosRequestConfig, method?: Method): AxiosRequestConfig; } export = PresetMixin;