import { AxiosError, AxiosInstance, AxiosRequestConfig } from 'axios'; import * as t from 'io-ts'; import * as O from 'fp-ts/lib/Option'; import { AppError, TaskEitherError } from './types'; import { Option } from 'fp-ts/Option'; /** * Type to convert AxiosError to some other type (for example AppError) */ export declare type AxiosErrorReader = (error: AxiosError) => AppError; export declare type CustomBodyContent = { readonly type: 'FORM-DATA'; readonly data: FormData; } | { readonly type: 'BINARY'; readonly contentType: string; readonly data: unknown; }; export declare const binaryData: (contentType: string, data: unknown) => CustomBodyContent; export declare const formData: (data: FormData) => CustomBodyContent; export declare const createAxiosClient: (axios: T, axiosErrorReader: AxiosErrorReader) => { setupSessionIdHeader: (sessionId: O.Option) => void; get: >(url: string, decoder: A, config?: AxiosRequestConfig | undefined) => TaskEitherError; post: >(url: string, decoder: A_1, body?: B | undefined, config?: AxiosRequestConfig | undefined) => TaskEitherError; delete: >(url: string, decoder: A_2, config?: AxiosRequestConfig | undefined) => TaskEitherError; put: >(url: string, decoder: A_3, body?: B_1 | undefined, config?: AxiosRequestConfig | undefined) => TaskEitherError; postBinary: >(url: string, decoder: A_4, body: CustomBodyContent) => TaskEitherError; };