[d565449] | 1 | // TypeScript Version: 4.7
|
---|
| 2 | export type AxiosHeaderValue = AxiosHeaders | string | string[] | number | boolean | null;
|
---|
| 3 |
|
---|
| 4 | interface RawAxiosHeaders {
|
---|
| 5 | [key: string]: AxiosHeaderValue;
|
---|
| 6 | }
|
---|
| 7 |
|
---|
| 8 | type MethodsHeaders = Partial<{
|
---|
| 9 | [Key in Method as Lowercase<Key>]: AxiosHeaders;
|
---|
| 10 | } & {common: AxiosHeaders}>;
|
---|
| 11 |
|
---|
| 12 | type AxiosHeaderMatcher = string | RegExp | ((this: AxiosHeaders, value: string, name: string) => boolean);
|
---|
| 13 |
|
---|
| 14 | type AxiosHeaderParser = (this: AxiosHeaders, value: AxiosHeaderValue, header: string) => any;
|
---|
| 15 |
|
---|
| 16 | export class AxiosHeaders {
|
---|
| 17 | constructor(
|
---|
| 18 | headers?: RawAxiosHeaders | AxiosHeaders | string
|
---|
| 19 | );
|
---|
| 20 |
|
---|
| 21 | [key: string]: any;
|
---|
| 22 |
|
---|
| 23 | set(headerName?: string, value?: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
---|
| 24 | set(headers?: RawAxiosHeaders | AxiosHeaders | string, rewrite?: boolean): AxiosHeaders;
|
---|
| 25 |
|
---|
| 26 | get(headerName: string, parser: RegExp): RegExpExecArray | null;
|
---|
| 27 | get(headerName: string, matcher?: true | AxiosHeaderParser): AxiosHeaderValue;
|
---|
| 28 |
|
---|
| 29 | has(header: string, matcher?: AxiosHeaderMatcher): boolean;
|
---|
| 30 |
|
---|
| 31 | delete(header: string | string[], matcher?: AxiosHeaderMatcher): boolean;
|
---|
| 32 |
|
---|
| 33 | clear(matcher?: AxiosHeaderMatcher): boolean;
|
---|
| 34 |
|
---|
| 35 | normalize(format: boolean): AxiosHeaders;
|
---|
| 36 |
|
---|
| 37 | concat(...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>): AxiosHeaders;
|
---|
| 38 |
|
---|
| 39 | toJSON(asStrings?: boolean): RawAxiosHeaders;
|
---|
| 40 |
|
---|
| 41 | static from(thing?: AxiosHeaders | RawAxiosHeaders | string): AxiosHeaders;
|
---|
| 42 |
|
---|
| 43 | static accessor(header: string | string[]): AxiosHeaders;
|
---|
| 44 |
|
---|
| 45 | static concat(...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>): AxiosHeaders;
|
---|
| 46 |
|
---|
| 47 | setContentType(value: ContentType, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
---|
| 48 | getContentType(parser?: RegExp): RegExpExecArray | null;
|
---|
| 49 | getContentType(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
|
---|
| 50 | hasContentType(matcher?: AxiosHeaderMatcher): boolean;
|
---|
| 51 |
|
---|
| 52 | setContentLength(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
---|
| 53 | getContentLength(parser?: RegExp): RegExpExecArray | null;
|
---|
| 54 | getContentLength(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
|
---|
| 55 | hasContentLength(matcher?: AxiosHeaderMatcher): boolean;
|
---|
| 56 |
|
---|
| 57 | setAccept(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
---|
| 58 | getAccept(parser?: RegExp): RegExpExecArray | null;
|
---|
| 59 | getAccept(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
|
---|
| 60 | hasAccept(matcher?: AxiosHeaderMatcher): boolean;
|
---|
| 61 |
|
---|
| 62 | setUserAgent(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
---|
| 63 | getUserAgent(parser?: RegExp): RegExpExecArray | null;
|
---|
| 64 | getUserAgent(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
|
---|
| 65 | hasUserAgent(matcher?: AxiosHeaderMatcher): boolean;
|
---|
| 66 |
|
---|
| 67 | setContentEncoding(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
---|
| 68 | getContentEncoding(parser?: RegExp): RegExpExecArray | null;
|
---|
| 69 | getContentEncoding(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
|
---|
| 70 | hasContentEncoding(matcher?: AxiosHeaderMatcher): boolean;
|
---|
| 71 |
|
---|
| 72 | setAuthorization(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
---|
| 73 | getAuthorization(parser?: RegExp): RegExpExecArray | null;
|
---|
| 74 | getAuthorization(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
|
---|
| 75 | hasAuthorization(matcher?: AxiosHeaderMatcher): boolean;
|
---|
| 76 |
|
---|
| 77 | [Symbol.iterator](): IterableIterator<[string, AxiosHeaderValue]>;
|
---|
| 78 | }
|
---|
| 79 |
|
---|
| 80 | type CommonRequestHeadersList = 'Accept' | 'Content-Length' | 'User-Agent' | 'Content-Encoding' | 'Authorization';
|
---|
| 81 |
|
---|
| 82 | type ContentType = AxiosHeaderValue | 'text/html' | 'text/plain' | 'multipart/form-data' | 'application/json' | 'application/x-www-form-urlencoded' | 'application/octet-stream';
|
---|
| 83 |
|
---|
| 84 | export type RawAxiosRequestHeaders = Partial<RawAxiosHeaders & {
|
---|
| 85 | [Key in CommonRequestHeadersList]: AxiosHeaderValue;
|
---|
| 86 | } & {
|
---|
| 87 | 'Content-Type': ContentType
|
---|
| 88 | }>;
|
---|
| 89 |
|
---|
| 90 | export type AxiosRequestHeaders = RawAxiosRequestHeaders & AxiosHeaders;
|
---|
| 91 |
|
---|
| 92 | type CommonResponseHeadersList = 'Server' | 'Content-Type' | 'Content-Length' | 'Cache-Control'| 'Content-Encoding';
|
---|
| 93 |
|
---|
| 94 | type RawCommonResponseHeaders = {
|
---|
| 95 | [Key in CommonResponseHeadersList]: AxiosHeaderValue;
|
---|
| 96 | } & {
|
---|
| 97 | "set-cookie": string[];
|
---|
| 98 | };
|
---|
| 99 |
|
---|
| 100 | export type RawAxiosResponseHeaders = Partial<RawAxiosHeaders & RawCommonResponseHeaders>;
|
---|
| 101 |
|
---|
| 102 | export type AxiosResponseHeaders = RawAxiosResponseHeaders & AxiosHeaders;
|
---|
| 103 |
|
---|
| 104 | export interface AxiosRequestTransformer {
|
---|
| 105 | (this: InternalAxiosRequestConfig, data: any, headers: AxiosRequestHeaders): any;
|
---|
| 106 | }
|
---|
| 107 |
|
---|
| 108 | export interface AxiosResponseTransformer {
|
---|
| 109 | (this: InternalAxiosRequestConfig, data: any, headers: AxiosResponseHeaders, status?: number): any;
|
---|
| 110 | }
|
---|
| 111 |
|
---|
| 112 | export interface AxiosAdapter {
|
---|
| 113 | (config: InternalAxiosRequestConfig): AxiosPromise;
|
---|
| 114 | }
|
---|
| 115 |
|
---|
| 116 | export interface AxiosBasicCredentials {
|
---|
| 117 | username: string;
|
---|
| 118 | password: string;
|
---|
| 119 | }
|
---|
| 120 |
|
---|
| 121 | export interface AxiosProxyConfig {
|
---|
| 122 | host: string;
|
---|
| 123 | port: number;
|
---|
| 124 | auth?: AxiosBasicCredentials;
|
---|
| 125 | protocol?: string;
|
---|
| 126 | }
|
---|
| 127 |
|
---|
| 128 | export enum HttpStatusCode {
|
---|
| 129 | Continue = 100,
|
---|
| 130 | SwitchingProtocols = 101,
|
---|
| 131 | Processing = 102,
|
---|
| 132 | EarlyHints = 103,
|
---|
| 133 | Ok = 200,
|
---|
| 134 | Created = 201,
|
---|
| 135 | Accepted = 202,
|
---|
| 136 | NonAuthoritativeInformation = 203,
|
---|
| 137 | NoContent = 204,
|
---|
| 138 | ResetContent = 205,
|
---|
| 139 | PartialContent = 206,
|
---|
| 140 | MultiStatus = 207,
|
---|
| 141 | AlreadyReported = 208,
|
---|
| 142 | ImUsed = 226,
|
---|
| 143 | MultipleChoices = 300,
|
---|
| 144 | MovedPermanently = 301,
|
---|
| 145 | Found = 302,
|
---|
| 146 | SeeOther = 303,
|
---|
| 147 | NotModified = 304,
|
---|
| 148 | UseProxy = 305,
|
---|
| 149 | Unused = 306,
|
---|
| 150 | TemporaryRedirect = 307,
|
---|
| 151 | PermanentRedirect = 308,
|
---|
| 152 | BadRequest = 400,
|
---|
| 153 | Unauthorized = 401,
|
---|
| 154 | PaymentRequired = 402,
|
---|
| 155 | Forbidden = 403,
|
---|
| 156 | NotFound = 404,
|
---|
| 157 | MethodNotAllowed = 405,
|
---|
| 158 | NotAcceptable = 406,
|
---|
| 159 | ProxyAuthenticationRequired = 407,
|
---|
| 160 | RequestTimeout = 408,
|
---|
| 161 | Conflict = 409,
|
---|
| 162 | Gone = 410,
|
---|
| 163 | LengthRequired = 411,
|
---|
| 164 | PreconditionFailed = 412,
|
---|
| 165 | PayloadTooLarge = 413,
|
---|
| 166 | UriTooLong = 414,
|
---|
| 167 | UnsupportedMediaType = 415,
|
---|
| 168 | RangeNotSatisfiable = 416,
|
---|
| 169 | ExpectationFailed = 417,
|
---|
| 170 | ImATeapot = 418,
|
---|
| 171 | MisdirectedRequest = 421,
|
---|
| 172 | UnprocessableEntity = 422,
|
---|
| 173 | Locked = 423,
|
---|
| 174 | FailedDependency = 424,
|
---|
| 175 | TooEarly = 425,
|
---|
| 176 | UpgradeRequired = 426,
|
---|
| 177 | PreconditionRequired = 428,
|
---|
| 178 | TooManyRequests = 429,
|
---|
| 179 | RequestHeaderFieldsTooLarge = 431,
|
---|
| 180 | UnavailableForLegalReasons = 451,
|
---|
| 181 | InternalServerError = 500,
|
---|
| 182 | NotImplemented = 501,
|
---|
| 183 | BadGateway = 502,
|
---|
| 184 | ServiceUnavailable = 503,
|
---|
| 185 | GatewayTimeout = 504,
|
---|
| 186 | HttpVersionNotSupported = 505,
|
---|
| 187 | VariantAlsoNegotiates = 506,
|
---|
| 188 | InsufficientStorage = 507,
|
---|
| 189 | LoopDetected = 508,
|
---|
| 190 | NotExtended = 510,
|
---|
| 191 | NetworkAuthenticationRequired = 511,
|
---|
| 192 | }
|
---|
| 193 |
|
---|
| 194 | export type Method =
|
---|
| 195 | | 'get' | 'GET'
|
---|
| 196 | | 'delete' | 'DELETE'
|
---|
| 197 | | 'head' | 'HEAD'
|
---|
| 198 | | 'options' | 'OPTIONS'
|
---|
| 199 | | 'post' | 'POST'
|
---|
| 200 | | 'put' | 'PUT'
|
---|
| 201 | | 'patch' | 'PATCH'
|
---|
| 202 | | 'purge' | 'PURGE'
|
---|
| 203 | | 'link' | 'LINK'
|
---|
| 204 | | 'unlink' | 'UNLINK';
|
---|
| 205 |
|
---|
| 206 | export type ResponseType =
|
---|
| 207 | | 'arraybuffer'
|
---|
| 208 | | 'blob'
|
---|
| 209 | | 'document'
|
---|
| 210 | | 'json'
|
---|
| 211 | | 'text'
|
---|
| 212 | | 'stream'
|
---|
| 213 | | 'formdata';
|
---|
| 214 |
|
---|
| 215 | export type responseEncoding =
|
---|
| 216 | | 'ascii' | 'ASCII'
|
---|
| 217 | | 'ansi' | 'ANSI'
|
---|
| 218 | | 'binary' | 'BINARY'
|
---|
| 219 | | 'base64' | 'BASE64'
|
---|
| 220 | | 'base64url' | 'BASE64URL'
|
---|
| 221 | | 'hex' | 'HEX'
|
---|
| 222 | | 'latin1' | 'LATIN1'
|
---|
| 223 | | 'ucs-2' | 'UCS-2'
|
---|
| 224 | | 'ucs2' | 'UCS2'
|
---|
| 225 | | 'utf-8' | 'UTF-8'
|
---|
| 226 | | 'utf8' | 'UTF8'
|
---|
| 227 | | 'utf16le' | 'UTF16LE';
|
---|
| 228 |
|
---|
| 229 | export interface TransitionalOptions {
|
---|
| 230 | silentJSONParsing?: boolean;
|
---|
| 231 | forcedJSONParsing?: boolean;
|
---|
| 232 | clarifyTimeoutError?: boolean;
|
---|
| 233 | }
|
---|
| 234 |
|
---|
| 235 | export interface GenericAbortSignal {
|
---|
| 236 | readonly aborted: boolean;
|
---|
| 237 | onabort?: ((...args: any) => any) | null;
|
---|
| 238 | addEventListener?: (...args: any) => any;
|
---|
| 239 | removeEventListener?: (...args: any) => any;
|
---|
| 240 | }
|
---|
| 241 |
|
---|
| 242 | export interface FormDataVisitorHelpers {
|
---|
| 243 | defaultVisitor: SerializerVisitor;
|
---|
| 244 | convertValue: (value: any) => any;
|
---|
| 245 | isVisitable: (value: any) => boolean;
|
---|
| 246 | }
|
---|
| 247 |
|
---|
| 248 | export interface SerializerVisitor {
|
---|
| 249 | (
|
---|
| 250 | this: GenericFormData,
|
---|
| 251 | value: any,
|
---|
| 252 | key: string | number,
|
---|
| 253 | path: null | Array<string | number>,
|
---|
| 254 | helpers: FormDataVisitorHelpers
|
---|
| 255 | ): boolean;
|
---|
| 256 | }
|
---|
| 257 |
|
---|
| 258 | export interface SerializerOptions {
|
---|
| 259 | visitor?: SerializerVisitor;
|
---|
| 260 | dots?: boolean;
|
---|
| 261 | metaTokens?: boolean;
|
---|
| 262 | indexes?: boolean | null;
|
---|
| 263 | }
|
---|
| 264 |
|
---|
| 265 | // tslint:disable-next-line
|
---|
| 266 | export interface FormSerializerOptions extends SerializerOptions {
|
---|
| 267 | }
|
---|
| 268 |
|
---|
| 269 | export interface ParamEncoder {
|
---|
| 270 | (value: any, defaultEncoder: (value: any) => any): any;
|
---|
| 271 | }
|
---|
| 272 |
|
---|
| 273 | export interface CustomParamsSerializer {
|
---|
| 274 | (params: Record<string, any>, options?: ParamsSerializerOptions): string;
|
---|
| 275 | }
|
---|
| 276 |
|
---|
| 277 | export interface ParamsSerializerOptions extends SerializerOptions {
|
---|
| 278 | encode?: ParamEncoder;
|
---|
| 279 | serialize?: CustomParamsSerializer;
|
---|
| 280 | }
|
---|
| 281 |
|
---|
| 282 | type MaxUploadRate = number;
|
---|
| 283 |
|
---|
| 284 | type MaxDownloadRate = number;
|
---|
| 285 |
|
---|
| 286 | type BrowserProgressEvent = any;
|
---|
| 287 |
|
---|
| 288 | export interface AxiosProgressEvent {
|
---|
| 289 | loaded: number;
|
---|
| 290 | total?: number;
|
---|
| 291 | progress?: number;
|
---|
| 292 | bytes: number;
|
---|
| 293 | rate?: number;
|
---|
| 294 | estimated?: number;
|
---|
| 295 | upload?: boolean;
|
---|
| 296 | download?: boolean;
|
---|
| 297 | event?: BrowserProgressEvent;
|
---|
| 298 | lengthComputable: boolean;
|
---|
| 299 | }
|
---|
| 300 |
|
---|
| 301 | type Milliseconds = number;
|
---|
| 302 |
|
---|
| 303 | type AxiosAdapterName = 'fetch' | 'xhr' | 'http' | string;
|
---|
| 304 |
|
---|
| 305 | type AxiosAdapterConfig = AxiosAdapter | AxiosAdapterName;
|
---|
| 306 |
|
---|
| 307 | export type AddressFamily = 4 | 6 | undefined;
|
---|
| 308 |
|
---|
| 309 | export interface LookupAddressEntry {
|
---|
| 310 | address: string;
|
---|
| 311 | family?: AddressFamily;
|
---|
| 312 | }
|
---|
| 313 |
|
---|
| 314 | export type LookupAddress = string | LookupAddressEntry;
|
---|
| 315 |
|
---|
| 316 | export interface AxiosRequestConfig<D = any> {
|
---|
| 317 | url?: string;
|
---|
| 318 | method?: Method | string;
|
---|
| 319 | baseURL?: string;
|
---|
| 320 | transformRequest?: AxiosRequestTransformer | AxiosRequestTransformer[];
|
---|
| 321 | transformResponse?: AxiosResponseTransformer | AxiosResponseTransformer[];
|
---|
| 322 | headers?: (RawAxiosRequestHeaders & MethodsHeaders) | AxiosHeaders;
|
---|
| 323 | params?: any;
|
---|
| 324 | paramsSerializer?: ParamsSerializerOptions | CustomParamsSerializer;
|
---|
| 325 | data?: D;
|
---|
| 326 | timeout?: Milliseconds;
|
---|
| 327 | timeoutErrorMessage?: string;
|
---|
| 328 | withCredentials?: boolean;
|
---|
| 329 | adapter?: AxiosAdapterConfig | AxiosAdapterConfig[];
|
---|
| 330 | auth?: AxiosBasicCredentials;
|
---|
| 331 | responseType?: ResponseType;
|
---|
| 332 | responseEncoding?: responseEncoding | string;
|
---|
| 333 | xsrfCookieName?: string;
|
---|
| 334 | xsrfHeaderName?: string;
|
---|
| 335 | onUploadProgress?: (progressEvent: AxiosProgressEvent) => void;
|
---|
| 336 | onDownloadProgress?: (progressEvent: AxiosProgressEvent) => void;
|
---|
| 337 | maxContentLength?: number;
|
---|
| 338 | validateStatus?: ((status: number) => boolean) | null;
|
---|
| 339 | maxBodyLength?: number;
|
---|
| 340 | maxRedirects?: number;
|
---|
| 341 | maxRate?: number | [MaxUploadRate, MaxDownloadRate];
|
---|
| 342 | beforeRedirect?: (options: Record<string, any>, responseDetails: {headers: Record<string, string>, statusCode: HttpStatusCode}) => void;
|
---|
| 343 | socketPath?: string | null;
|
---|
| 344 | transport?: any;
|
---|
| 345 | httpAgent?: any;
|
---|
| 346 | httpsAgent?: any;
|
---|
| 347 | proxy?: AxiosProxyConfig | false;
|
---|
| 348 | cancelToken?: CancelToken;
|
---|
| 349 | decompress?: boolean;
|
---|
| 350 | transitional?: TransitionalOptions;
|
---|
| 351 | signal?: GenericAbortSignal;
|
---|
| 352 | insecureHTTPParser?: boolean;
|
---|
| 353 | env?: {
|
---|
| 354 | FormData?: new (...args: any[]) => object;
|
---|
| 355 | };
|
---|
| 356 | formSerializer?: FormSerializerOptions;
|
---|
| 357 | family?: AddressFamily;
|
---|
| 358 | lookup?: ((hostname: string, options: object, cb: (err: Error | null, address: LookupAddress | LookupAddress[], family?: AddressFamily) => void) => void) |
|
---|
| 359 | ((hostname: string, options: object) => Promise<[address: LookupAddressEntry | LookupAddressEntry[], family?: AddressFamily] | LookupAddress>);
|
---|
| 360 | withXSRFToken?: boolean | ((config: InternalAxiosRequestConfig) => boolean | undefined);
|
---|
| 361 | fetchOptions?: Record<string, any>;
|
---|
| 362 | }
|
---|
| 363 |
|
---|
| 364 | // Alias
|
---|
| 365 | export type RawAxiosRequestConfig<D = any> = AxiosRequestConfig<D>;
|
---|
| 366 |
|
---|
| 367 | export interface InternalAxiosRequestConfig<D = any> extends AxiosRequestConfig<D> {
|
---|
| 368 | headers: AxiosRequestHeaders;
|
---|
| 369 | }
|
---|
| 370 |
|
---|
| 371 | export interface HeadersDefaults {
|
---|
| 372 | common: RawAxiosRequestHeaders;
|
---|
| 373 | delete: RawAxiosRequestHeaders;
|
---|
| 374 | get: RawAxiosRequestHeaders;
|
---|
| 375 | head: RawAxiosRequestHeaders;
|
---|
| 376 | post: RawAxiosRequestHeaders;
|
---|
| 377 | put: RawAxiosRequestHeaders;
|
---|
| 378 | patch: RawAxiosRequestHeaders;
|
---|
| 379 | options?: RawAxiosRequestHeaders;
|
---|
| 380 | purge?: RawAxiosRequestHeaders;
|
---|
| 381 | link?: RawAxiosRequestHeaders;
|
---|
| 382 | unlink?: RawAxiosRequestHeaders;
|
---|
| 383 | }
|
---|
| 384 |
|
---|
| 385 | export interface AxiosDefaults<D = any> extends Omit<AxiosRequestConfig<D>, 'headers'> {
|
---|
| 386 | headers: HeadersDefaults;
|
---|
| 387 | }
|
---|
| 388 |
|
---|
| 389 | export interface CreateAxiosDefaults<D = any> extends Omit<AxiosRequestConfig<D>, 'headers'> {
|
---|
| 390 | headers?: RawAxiosRequestHeaders | AxiosHeaders | Partial<HeadersDefaults>;
|
---|
| 391 | }
|
---|
| 392 |
|
---|
| 393 | export interface AxiosResponse<T = any, D = any> {
|
---|
| 394 | data: T;
|
---|
| 395 | status: number;
|
---|
| 396 | statusText: string;
|
---|
| 397 | headers: RawAxiosResponseHeaders | AxiosResponseHeaders;
|
---|
| 398 | config: InternalAxiosRequestConfig<D>;
|
---|
| 399 | request?: any;
|
---|
| 400 | }
|
---|
| 401 |
|
---|
| 402 | export class AxiosError<T = unknown, D = any> extends Error {
|
---|
| 403 | constructor(
|
---|
| 404 | message?: string,
|
---|
| 405 | code?: string,
|
---|
| 406 | config?: InternalAxiosRequestConfig<D>,
|
---|
| 407 | request?: any,
|
---|
| 408 | response?: AxiosResponse<T, D>
|
---|
| 409 | );
|
---|
| 410 |
|
---|
| 411 | config?: InternalAxiosRequestConfig<D>;
|
---|
| 412 | code?: string;
|
---|
| 413 | request?: any;
|
---|
| 414 | response?: AxiosResponse<T, D>;
|
---|
| 415 | isAxiosError: boolean;
|
---|
| 416 | status?: number;
|
---|
| 417 | toJSON: () => object;
|
---|
| 418 | cause?: Error;
|
---|
| 419 | static from<T = unknown, D = any>(
|
---|
| 420 | error: Error | unknown,
|
---|
| 421 | code?: string,
|
---|
| 422 | config?: InternalAxiosRequestConfig<D>,
|
---|
| 423 | request?: any,
|
---|
| 424 | response?: AxiosResponse<T, D>,
|
---|
| 425 | customProps?: object,
|
---|
| 426 | ): AxiosError<T, D>;
|
---|
| 427 | static readonly ERR_FR_TOO_MANY_REDIRECTS = "ERR_FR_TOO_MANY_REDIRECTS";
|
---|
| 428 | static readonly ERR_BAD_OPTION_VALUE = "ERR_BAD_OPTION_VALUE";
|
---|
| 429 | static readonly ERR_BAD_OPTION = "ERR_BAD_OPTION";
|
---|
| 430 | static readonly ERR_NETWORK = "ERR_NETWORK";
|
---|
| 431 | static readonly ERR_DEPRECATED = "ERR_DEPRECATED";
|
---|
| 432 | static readonly ERR_BAD_RESPONSE = "ERR_BAD_RESPONSE";
|
---|
| 433 | static readonly ERR_BAD_REQUEST = "ERR_BAD_REQUEST";
|
---|
| 434 | static readonly ERR_NOT_SUPPORT = "ERR_NOT_SUPPORT";
|
---|
| 435 | static readonly ERR_INVALID_URL = "ERR_INVALID_URL";
|
---|
| 436 | static readonly ERR_CANCELED = "ERR_CANCELED";
|
---|
| 437 | static readonly ECONNABORTED = "ECONNABORTED";
|
---|
| 438 | static readonly ETIMEDOUT = "ETIMEDOUT";
|
---|
| 439 | }
|
---|
| 440 |
|
---|
| 441 | export class CanceledError<T> extends AxiosError<T> {
|
---|
| 442 | }
|
---|
| 443 |
|
---|
| 444 | export type AxiosPromise<T = any> = Promise<AxiosResponse<T>>;
|
---|
| 445 |
|
---|
| 446 | export interface CancelStatic {
|
---|
| 447 | new (message?: string): Cancel;
|
---|
| 448 | }
|
---|
| 449 |
|
---|
| 450 | export interface Cancel {
|
---|
| 451 | message: string | undefined;
|
---|
| 452 | }
|
---|
| 453 |
|
---|
| 454 | export interface Canceler {
|
---|
| 455 | (message?: string, config?: AxiosRequestConfig, request?: any): void;
|
---|
| 456 | }
|
---|
| 457 |
|
---|
| 458 | export interface CancelTokenStatic {
|
---|
| 459 | new (executor: (cancel: Canceler) => void): CancelToken;
|
---|
| 460 | source(): CancelTokenSource;
|
---|
| 461 | }
|
---|
| 462 |
|
---|
| 463 | export interface CancelToken {
|
---|
| 464 | promise: Promise<Cancel>;
|
---|
| 465 | reason?: Cancel;
|
---|
| 466 | throwIfRequested(): void;
|
---|
| 467 | }
|
---|
| 468 |
|
---|
| 469 | export interface CancelTokenSource {
|
---|
| 470 | token: CancelToken;
|
---|
| 471 | cancel: Canceler;
|
---|
| 472 | }
|
---|
| 473 |
|
---|
| 474 | export interface AxiosInterceptorOptions {
|
---|
| 475 | synchronous?: boolean;
|
---|
| 476 | runWhen?: (config: InternalAxiosRequestConfig) => boolean;
|
---|
| 477 | }
|
---|
| 478 |
|
---|
| 479 | export interface AxiosInterceptorManager<V> {
|
---|
| 480 | use(onFulfilled?: ((value: V) => V | Promise<V>) | null, onRejected?: ((error: any) => any) | null, options?: AxiosInterceptorOptions): number;
|
---|
| 481 | eject(id: number): void;
|
---|
| 482 | clear(): void;
|
---|
| 483 | }
|
---|
| 484 |
|
---|
| 485 | export class Axios {
|
---|
| 486 | constructor(config?: AxiosRequestConfig);
|
---|
| 487 | defaults: AxiosDefaults;
|
---|
| 488 | interceptors: {
|
---|
| 489 | request: AxiosInterceptorManager<InternalAxiosRequestConfig>;
|
---|
| 490 | response: AxiosInterceptorManager<AxiosResponse>;
|
---|
| 491 | };
|
---|
| 492 | getUri(config?: AxiosRequestConfig): string;
|
---|
| 493 | request<T = any, R = AxiosResponse<T>, D = any>(config: AxiosRequestConfig<D>): Promise<R>;
|
---|
| 494 | get<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
|
---|
| 495 | delete<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
|
---|
| 496 | head<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
|
---|
| 497 | options<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
|
---|
| 498 | post<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
|
---|
| 499 | put<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
|
---|
| 500 | patch<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
|
---|
| 501 | postForm<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
|
---|
| 502 | putForm<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
|
---|
| 503 | patchForm<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
|
---|
| 504 | }
|
---|
| 505 |
|
---|
| 506 | export interface AxiosInstance extends Axios {
|
---|
| 507 | <T = any, R = AxiosResponse<T>, D = any>(config: AxiosRequestConfig<D>): Promise<R>;
|
---|
| 508 | <T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
|
---|
| 509 |
|
---|
| 510 | defaults: Omit<AxiosDefaults, 'headers'> & {
|
---|
| 511 | headers: HeadersDefaults & {
|
---|
| 512 | [key: string]: AxiosHeaderValue
|
---|
| 513 | }
|
---|
| 514 | };
|
---|
| 515 | }
|
---|
| 516 |
|
---|
| 517 | export interface GenericFormData {
|
---|
| 518 | append(name: string, value: any, options?: any): any;
|
---|
| 519 | }
|
---|
| 520 |
|
---|
| 521 | export interface GenericHTMLFormElement {
|
---|
| 522 | name: string;
|
---|
| 523 | method: string;
|
---|
| 524 | submit(): void;
|
---|
| 525 | }
|
---|
| 526 |
|
---|
| 527 | export function getAdapter(adapters: AxiosAdapterConfig | AxiosAdapterConfig[] | undefined): AxiosAdapter;
|
---|
| 528 |
|
---|
| 529 | export function toFormData(sourceObj: object, targetFormData?: GenericFormData, options?: FormSerializerOptions): GenericFormData;
|
---|
| 530 |
|
---|
| 531 | export function formToJSON(form: GenericFormData|GenericHTMLFormElement): object;
|
---|
| 532 |
|
---|
| 533 | export function isAxiosError<T = any, D = any>(payload: any): payload is AxiosError<T, D>;
|
---|
| 534 |
|
---|
| 535 | export function spread<T, R>(callback: (...args: T[]) => R): (array: T[]) => R;
|
---|
| 536 |
|
---|
| 537 | export function isCancel(value: any): value is Cancel;
|
---|
| 538 |
|
---|
| 539 | export function all<T>(values: Array<T | Promise<T>>): Promise<T[]>;
|
---|
| 540 |
|
---|
| 541 | export interface AxiosStatic extends AxiosInstance {
|
---|
| 542 | create(config?: CreateAxiosDefaults): AxiosInstance;
|
---|
| 543 | Cancel: CancelStatic;
|
---|
| 544 | CancelToken: CancelTokenStatic;
|
---|
| 545 | Axios: typeof Axios;
|
---|
| 546 | AxiosError: typeof AxiosError;
|
---|
| 547 | HttpStatusCode: typeof HttpStatusCode;
|
---|
| 548 | readonly VERSION: string;
|
---|
| 549 | isCancel: typeof isCancel;
|
---|
| 550 | all: typeof all;
|
---|
| 551 | spread: typeof spread;
|
---|
| 552 | isAxiosError: typeof isAxiosError;
|
---|
| 553 | toFormData: typeof toFormData;
|
---|
| 554 | formToJSON: typeof formToJSON;
|
---|
| 555 | getAdapter: typeof getAdapter;
|
---|
| 556 | CanceledError: typeof CanceledError;
|
---|
| 557 | AxiosHeaders: typeof AxiosHeaders;
|
---|
| 558 | }
|
---|
| 559 |
|
---|
| 560 | declare const axios: AxiosStatic;
|
---|
| 561 |
|
---|
| 562 | export default axios;
|
---|