// TypeScript Version: 3.0 export type AxiosRequestHeaders = Record; export type AxiosResponseHeaders = Record & { "set-cookie"?: string[] }; export interface AxiosRequestTransformer { (data: any, headers?: AxiosRequestHeaders): any; } export interface AxiosResponseTransformer { (data: any, headers?: AxiosResponseHeaders): any; } export interface AxiosAdapter { (config: AxiosRequestConfig): AxiosPromise; } export interface AxiosBasicCredentials { username: string; password: string; } export interface AxiosProxyConfig { host: string; port: number; auth?: { username: string; password: string; }; protocol?: string; } export type Method = | 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK'; export type ResponseType = | 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream'; export type responseEncoding = | 'ascii' | 'ASCII' | 'ansi' | 'ANSI' | 'binary' | 'BINARY' | 'base64' | 'BASE64' | 'base64url' | 'BASE64URL' | 'hex' | 'HEX' | 'latin1' | 'LATIN1' | 'ucs-2' | 'UCS-2' | 'ucs2' | 'UCS2' | 'utf-8' | 'UTF-8' | 'utf8' | 'UTF8' | 'utf16le' | 'UTF16LE'; export interface TransitionalOptions { silentJSONParsing?: boolean; forcedJSONParsing?: boolean; clarifyTimeoutError?: boolean; } export interface AxiosRequestConfig { url?: string; method?: Method | string; baseURL?: string; transformRequest?: AxiosRequestTransformer | AxiosRequestTransformer[]; transformResponse?: AxiosResponseTransformer | AxiosResponseTransformer[]; headers?: AxiosRequestHeaders; params?: any; paramsSerializer?: (params: any) => string; data?: D; timeout?: number; timeoutErrorMessage?: string; withCredentials?: boolean; adapter?: AxiosAdapter; auth?: AxiosBasicCredentials; responseType?: ResponseType; responseEncoding?: responseEncoding | string; xsrfCookieName?: string; xsrfHeaderName?: string; onUploadProgress?: (progressEvent: any) => void; onDownloadProgress?: (progressEvent: any) => void; maxContentLength?: number; validateStatus?: ((status: number) => boolean) | null; maxBodyLength?: number; maxRedirects?: number; beforeRedirect?: (options: Record, responseDetails: {headers: Record}) => void; socketPath?: string | null; httpAgent?: any; httpsAgent?: any; proxy?: AxiosProxyConfig | false; cancelToken?: CancelToken; decompress?: boolean; transitional?: TransitionalOptions; signal?: AbortSignal; insecureHTTPParser?: boolean; env?: { FormData?: new (...args: any[]) => object; }; } export interface HeadersDefaults { common: AxiosRequestHeaders; delete: AxiosRequestHeaders; get: AxiosRequestHeaders; head: AxiosRequestHeaders; post: AxiosRequestHeaders; put: AxiosRequestHeaders; patch: AxiosRequestHeaders; options?: AxiosRequestHeaders; purge?: AxiosRequestHeaders; link?: AxiosRequestHeaders; unlink?: AxiosRequestHeaders; } export interface AxiosDefaults extends Omit, 'headers'> { headers: HeadersDefaults; } export interface AxiosResponse { data: T; status: number; statusText: string; headers: AxiosResponseHeaders; config: AxiosRequestConfig; request?: any; } export class AxiosError extends Error { constructor( message?: string, code?: string, config?: AxiosRequestConfig, request?: any, response?: AxiosResponse ); config: AxiosRequestConfig; code?: string; request?: any; response?: AxiosResponse; isAxiosError: boolean; status?: string; toJSON: () => object; static readonly ERR_FR_TOO_MANY_REDIRECTS = "ERR_FR_TOO_MANY_REDIRECTS"; static readonly ERR_BAD_OPTION_VALUE = "ERR_BAD_OPTION_VALUE"; static readonly ERR_BAD_OPTION = "ERR_BAD_OPTION"; static readonly ERR_NETWORK = "ERR_NETWORK"; static readonly ERR_DEPRECATED = "ERR_DEPRECATED"; static readonly ERR_BAD_RESPONSE = "ERR_BAD_RESPONSE"; static readonly ERR_BAD_REQUEST = "ERR_BAD_REQUEST"; static readonly ERR_CANCELED = "ERR_CANCELED"; static readonly ECONNABORTED = "ECONNABORTED"; static readonly ETIMEDOUT = "ETIMEDOUT"; } export class CanceledError extends AxiosError { } export interface AxiosPromise extends Promise> { } export interface CancelStatic { new (message?: string): Cancel; } export interface Cancel { message: string | undefined; } export interface Canceler { (message?: string): void; } export interface CancelTokenStatic { new (executor: (cancel: Canceler) => void): CancelToken; source(): CancelTokenSource; } export interface CancelToken { promise: Promise; reason?: Cancel; throwIfRequested(): void; } export interface CancelTokenSource { token: CancelToken; cancel: Canceler; } export interface AxiosInterceptorOptions { synchronous?: boolean; runWhen?: (config: AxiosRequestConfig) => boolean; } export interface AxiosInterceptorManager { use(onFulfilled?: (value: V) => T | Promise, onRejected?: (error: any) => any, options?: AxiosInterceptorOptions): number; eject(id: number): void; } export class Axios { constructor(config?: AxiosRequestConfig); defaults: AxiosDefaults; interceptors: { request: AxiosInterceptorManager; response: AxiosInterceptorManager; }; getUri(config?: AxiosRequestConfig): string; request, D = any>(config: AxiosRequestConfig): Promise; get, D = any>(url: string, config?: AxiosRequestConfig): Promise; delete, D = any>(url: string, config?: AxiosRequestConfig): Promise; head, D = any>(url: string, config?: AxiosRequestConfig): Promise; options, D = any>(url: string, config?: AxiosRequestConfig): Promise; post, D = any>(url: string, data?: D, config?: AxiosRequestConfig): Promise; put, D = any>(url: string, data?: D, config?: AxiosRequestConfig): Promise; patch, D = any>(url: string, data?: D, config?: AxiosRequestConfig): Promise; postForm, D = any>(url: string, data?: D, config?: AxiosRequestConfig): Promise; putForm, D = any>(url: string, data?: D, config?: AxiosRequestConfig): Promise; patchForm, D = any>(url: string, data?: D, config?: AxiosRequestConfig): Promise; } export interface AxiosInstance extends Axios { (config: AxiosRequestConfig): AxiosPromise; (url: string, config?: AxiosRequestConfig): AxiosPromise; } export interface AxiosStatic extends AxiosInstance { create(config?: AxiosRequestConfig): AxiosInstance; Cancel: CancelStatic; CancelToken: CancelTokenStatic; Axios: typeof Axios; readonly VERSION: string; isCancel(value: any): boolean; all(values: Array>): Promise; spread(callback: (...args: T[]) => R): (array: T[]) => R; isAxiosError(payload: any): payload is AxiosError; } declare const axios: AxiosStatic; export default axios;