import nodeFetch from 'node-fetch'; export declare type HttpClient> = (opts?: Partial>) => HttpClientObject; export declare type Res = readonly [Error, null] | readonly [null, T]; export interface HttpClientObject { pipe(...pipes: Pipe[]): HttpClientObject; get(url?: string, params?: BaseObject): Promise>; post(url?: string, body?: BaseObject): Promise>; patch(url?: string, body?: BaseObject): Promise>; put(url?: string, body?: BaseObject): Promise>; delete(url?: string, params?: BaseObject): Promise>; run(): Promise>; } export interface Options> { url: string; middlewares: Pipe[]; responseType: 'json' | 'blob' | 'text' | 'arrayBuffer' | 'formData' | 'clone'; /** * This is automatically inferred from responseType now * * @deprecated */ json?: boolean; headers: Record; params: URLSearchParams; preResolvers: ((res: Response, value: T) => unknown)[]; resolvers: ResponsePiper[]; catchers: ErrorPiper[]; fetchOptions: RequestInit; fetchInstance: typeof fetch | typeof nodeFetch; } export declare type ResponsePiper = (res: HttpResponse) => YourResponse; export declare type ErrorPiper = (err: HttpError) => YourError; export declare type Pipe = (options: Options) => Options; export declare type Piper = (params: T) => Pipe; export declare type ArgumentlessPiper = () => Pipe; export declare type BaseObject = Record; export declare type Method = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';