UNPKG

1.27 kBTypeScriptView Raw
1import { AxiosResponse, AxiosRequestConfig } from "axios";
2import { Readable } from "node:stream";
3interface httpClientConfig extends Partial<AxiosRequestConfig> {
4 baseURL?: string;
5 defaultHeaders?: any;
6 responseParser?: <T>(res: AxiosResponse) => T;
7}
8export default class HTTPClient {
9 private instance;
10 private readonly config;
11 constructor(config?: httpClientConfig);
12 get<T>(url: string, params?: any): Promise<T>;
13 getStream(url: string, params?: any): Promise<Readable>;
14 post<T>(url: string, body?: any, config?: Partial<AxiosRequestConfig>): Promise<T>;
15 private responseParse;
16 put<T>(url: string, body?: any, config?: Partial<AxiosRequestConfig>): Promise<T>;
17 postForm<T>(url: string, body?: any): Promise<T>;
18 postFormMultipart<T>(url: string, form: FormData): Promise<T>;
19 putFormMultipart<T>(url: string, form: FormData, config?: Partial<AxiosRequestConfig>): Promise<T>;
20 toBuffer(data: Buffer | Readable): Promise<Buffer>;
21 postBinary<T>(url: string, data: Buffer | Readable, contentType?: string): Promise<T>;
22 postBinaryContent<T>(url: string, body: Blob): Promise<T>;
23 delete<T>(url: string, params?: any): Promise<T>;
24 private wrapError;
25}
26export {};
27//# sourceMappingURL=http-axios.d.ts.map
\No newline at end of file