@unicom-cloud/axios 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts ADDED
@@ -0,0 +1,793 @@
1
+ // TypeScript Version: 4.7
2
+ type StringLiteralsOrString<Literals extends string> = Literals | (string & {});
3
+
4
+ export type AxiosHeaderValue =
5
+ | AxiosHeaders
6
+ | string
7
+ | string[]
8
+ | number
9
+ | boolean
10
+ | null;
11
+
12
+ interface RawAxiosHeaders {
13
+ [key: string]: AxiosHeaderValue;
14
+ }
15
+
16
+ type MethodsHeaders = Partial<
17
+ {
18
+ [Key in Method as Lowercase<Key>]: AxiosHeaders;
19
+ } & { common: AxiosHeaders }
20
+ >;
21
+
22
+ type AxiosHeaderMatcher =
23
+ | string
24
+ | RegExp
25
+ | ((this: AxiosHeaders, value: string, name: string) => boolean);
26
+
27
+ type AxiosHeaderParser = (
28
+ this: AxiosHeaders,
29
+ value: AxiosHeaderValue,
30
+ header: string,
31
+ ) => any;
32
+
33
+ export class AxiosHeaders {
34
+ constructor(headers?: RawAxiosHeaders | AxiosHeaders | string);
35
+
36
+ [key: string]: any;
37
+
38
+ set(
39
+ headerName?: string,
40
+ value?: AxiosHeaderValue,
41
+ rewrite?: boolean | AxiosHeaderMatcher,
42
+ ): AxiosHeaders;
43
+ set(
44
+ headers?: RawAxiosHeaders | AxiosHeaders | string,
45
+ rewrite?: boolean,
46
+ ): AxiosHeaders;
47
+
48
+ get(headerName: string, parser: RegExp): RegExpExecArray | null;
49
+ get(headerName: string, matcher?: true | AxiosHeaderParser): AxiosHeaderValue;
50
+
51
+ has(header: string, matcher?: AxiosHeaderMatcher): boolean;
52
+
53
+ delete(header: string | string[], matcher?: AxiosHeaderMatcher): boolean;
54
+
55
+ clear(matcher?: AxiosHeaderMatcher): boolean;
56
+
57
+ normalize(format: boolean): AxiosHeaders;
58
+
59
+ concat(
60
+ ...targets: Array<
61
+ AxiosHeaders | RawAxiosHeaders | string | undefined | null
62
+ >
63
+ ): AxiosHeaders;
64
+
65
+ toJSON(asStrings?: boolean): RawAxiosHeaders;
66
+
67
+ static from(thing?: AxiosHeaders | RawAxiosHeaders | string): AxiosHeaders;
68
+
69
+ static accessor(header: string | string[]): AxiosHeaders;
70
+
71
+ static concat(
72
+ ...targets: Array<
73
+ AxiosHeaders | RawAxiosHeaders | string | undefined | null
74
+ >
75
+ ): AxiosHeaders;
76
+
77
+ setContentType(
78
+ value: ContentType,
79
+ rewrite?: boolean | AxiosHeaderMatcher,
80
+ ): AxiosHeaders;
81
+ getContentType(parser?: RegExp): RegExpExecArray | null;
82
+ getContentType(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
83
+ hasContentType(matcher?: AxiosHeaderMatcher): boolean;
84
+
85
+ setContentLength(
86
+ value: AxiosHeaderValue,
87
+ rewrite?: boolean | AxiosHeaderMatcher,
88
+ ): AxiosHeaders;
89
+ getContentLength(parser?: RegExp): RegExpExecArray | null;
90
+ getContentLength(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
91
+ hasContentLength(matcher?: AxiosHeaderMatcher): boolean;
92
+
93
+ setAccept(
94
+ value: AxiosHeaderValue,
95
+ rewrite?: boolean | AxiosHeaderMatcher,
96
+ ): AxiosHeaders;
97
+ getAccept(parser?: RegExp): RegExpExecArray | null;
98
+ getAccept(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
99
+ hasAccept(matcher?: AxiosHeaderMatcher): boolean;
100
+
101
+ setUserAgent(
102
+ value: AxiosHeaderValue,
103
+ rewrite?: boolean | AxiosHeaderMatcher,
104
+ ): AxiosHeaders;
105
+ getUserAgent(parser?: RegExp): RegExpExecArray | null;
106
+ getUserAgent(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
107
+ hasUserAgent(matcher?: AxiosHeaderMatcher): boolean;
108
+
109
+ setContentEncoding(
110
+ value: AxiosHeaderValue,
111
+ rewrite?: boolean | AxiosHeaderMatcher,
112
+ ): AxiosHeaders;
113
+ getContentEncoding(parser?: RegExp): RegExpExecArray | null;
114
+ getContentEncoding(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
115
+ hasContentEncoding(matcher?: AxiosHeaderMatcher): boolean;
116
+
117
+ setAuthorization(
118
+ value: AxiosHeaderValue,
119
+ rewrite?: boolean | AxiosHeaderMatcher,
120
+ ): AxiosHeaders;
121
+ getAuthorization(parser?: RegExp): RegExpExecArray | null;
122
+ getAuthorization(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
123
+ hasAuthorization(matcher?: AxiosHeaderMatcher): boolean;
124
+
125
+ getSetCookie(): string[];
126
+
127
+ [Symbol.iterator](): IterableIterator<[string, AxiosHeaderValue]>;
128
+ }
129
+
130
+ type CommonRequestHeadersList =
131
+ | 'Accept'
132
+ | 'Content-Length'
133
+ | 'User-Agent'
134
+ | 'Content-Encoding'
135
+ | 'Authorization';
136
+
137
+ type ContentType =
138
+ | AxiosHeaderValue
139
+ | 'text/html'
140
+ | 'text/plain'
141
+ | 'multipart/form-data'
142
+ | 'application/json'
143
+ | 'application/x-www-form-urlencoded'
144
+ | 'application/octet-stream';
145
+
146
+ export type RawAxiosRequestHeaders = Partial<
147
+ RawAxiosHeaders & {
148
+ [Key in CommonRequestHeadersList]: AxiosHeaderValue;
149
+ } & {
150
+ 'Content-Type': ContentType;
151
+ }
152
+ >;
153
+
154
+ export type AxiosRequestHeaders = RawAxiosRequestHeaders & AxiosHeaders;
155
+
156
+ type CommonResponseHeadersList =
157
+ | 'Server'
158
+ | 'Content-Type'
159
+ | 'Content-Length'
160
+ | 'Cache-Control'
161
+ | 'Content-Encoding';
162
+
163
+ type RawCommonResponseHeaders = {
164
+ [Key in CommonResponseHeadersList]: AxiosHeaderValue;
165
+ } & {
166
+ 'set-cookie': string[];
167
+ };
168
+
169
+ export type RawAxiosResponseHeaders = Partial<
170
+ RawAxiosHeaders & RawCommonResponseHeaders
171
+ >;
172
+
173
+ export type AxiosResponseHeaders = RawAxiosResponseHeaders & AxiosHeaders;
174
+
175
+ export interface AxiosRequestTransformer {
176
+ (
177
+ this: InternalAxiosRequestConfig,
178
+ data: any,
179
+ headers: AxiosRequestHeaders,
180
+ ): any;
181
+ }
182
+
183
+ export interface AxiosResponseTransformer {
184
+ (
185
+ this: InternalAxiosRequestConfig,
186
+ data: any,
187
+ headers: AxiosResponseHeaders,
188
+ status?: number,
189
+ ): any;
190
+ }
191
+
192
+ export interface AxiosAdapter {
193
+ (config: InternalAxiosRequestConfig): AxiosPromise;
194
+ }
195
+
196
+ export interface AxiosBasicCredentials {
197
+ username: string;
198
+ password: string;
199
+ }
200
+
201
+ export interface AxiosProxyConfig {
202
+ host: string;
203
+ port: number;
204
+ auth?: AxiosBasicCredentials;
205
+ protocol?: string;
206
+ }
207
+
208
+ export enum HttpStatusCode {
209
+ Continue = 100,
210
+ SwitchingProtocols = 101,
211
+ Processing = 102,
212
+ EarlyHints = 103,
213
+ Ok = 200,
214
+ Created = 201,
215
+ Accepted = 202,
216
+ NonAuthoritativeInformation = 203,
217
+ NoContent = 204,
218
+ ResetContent = 205,
219
+ PartialContent = 206,
220
+ MultiStatus = 207,
221
+ AlreadyReported = 208,
222
+ ImUsed = 226,
223
+ MultipleChoices = 300,
224
+ MovedPermanently = 301,
225
+ Found = 302,
226
+ SeeOther = 303,
227
+ NotModified = 304,
228
+ UseProxy = 305,
229
+ Unused = 306,
230
+ TemporaryRedirect = 307,
231
+ PermanentRedirect = 308,
232
+ BadRequest = 400,
233
+ Unauthorized = 401,
234
+ PaymentRequired = 402,
235
+ Forbidden = 403,
236
+ NotFound = 404,
237
+ MethodNotAllowed = 405,
238
+ NotAcceptable = 406,
239
+ ProxyAuthenticationRequired = 407,
240
+ RequestTimeout = 408,
241
+ Conflict = 409,
242
+ Gone = 410,
243
+ LengthRequired = 411,
244
+ PreconditionFailed = 412,
245
+ PayloadTooLarge = 413,
246
+ UriTooLong = 414,
247
+ UnsupportedMediaType = 415,
248
+ RangeNotSatisfiable = 416,
249
+ ExpectationFailed = 417,
250
+ ImATeapot = 418,
251
+ MisdirectedRequest = 421,
252
+ UnprocessableEntity = 422,
253
+ Locked = 423,
254
+ FailedDependency = 424,
255
+ TooEarly = 425,
256
+ UpgradeRequired = 426,
257
+ PreconditionRequired = 428,
258
+ TooManyRequests = 429,
259
+ RequestHeaderFieldsTooLarge = 431,
260
+ UnavailableForLegalReasons = 451,
261
+ InternalServerError = 500,
262
+ NotImplemented = 501,
263
+ BadGateway = 502,
264
+ ServiceUnavailable = 503,
265
+ GatewayTimeout = 504,
266
+ HttpVersionNotSupported = 505,
267
+ VariantAlsoNegotiates = 506,
268
+ InsufficientStorage = 507,
269
+ LoopDetected = 508,
270
+ NotExtended = 510,
271
+ NetworkAuthenticationRequired = 511,
272
+ }
273
+
274
+ export type Method =
275
+ | 'get'
276
+ | 'GET'
277
+ | 'delete'
278
+ | 'DELETE'
279
+ | 'head'
280
+ | 'HEAD'
281
+ | 'options'
282
+ | 'OPTIONS'
283
+ | 'post'
284
+ | 'POST'
285
+ | 'put'
286
+ | 'PUT'
287
+ | 'patch'
288
+ | 'PATCH'
289
+ | 'purge'
290
+ | 'PURGE'
291
+ | 'link'
292
+ | 'LINK'
293
+ | 'unlink'
294
+ | 'UNLINK';
295
+
296
+ export type ResponseType =
297
+ | 'arraybuffer'
298
+ | 'blob'
299
+ | 'document'
300
+ | 'json'
301
+ | 'text'
302
+ | 'stream'
303
+ | 'formdata';
304
+
305
+ export type responseEncoding =
306
+ | 'ascii'
307
+ | 'ASCII'
308
+ | 'ansi'
309
+ | 'ANSI'
310
+ | 'binary'
311
+ | 'BINARY'
312
+ | 'base64'
313
+ | 'BASE64'
314
+ | 'base64url'
315
+ | 'BASE64URL'
316
+ | 'hex'
317
+ | 'HEX'
318
+ | 'latin1'
319
+ | 'LATIN1'
320
+ | 'ucs-2'
321
+ | 'UCS-2'
322
+ | 'ucs2'
323
+ | 'UCS2'
324
+ | 'utf-8'
325
+ | 'UTF-8'
326
+ | 'utf8'
327
+ | 'UTF8'
328
+ | 'utf16le'
329
+ | 'UTF16LE';
330
+
331
+ export interface TransitionalOptions {
332
+ silentJSONParsing?: boolean;
333
+ forcedJSONParsing?: boolean;
334
+ clarifyTimeoutError?: boolean;
335
+ }
336
+
337
+ export interface GenericAbortSignal {
338
+ readonly aborted: boolean;
339
+ onabort?: ((...args: any) => any) | null;
340
+ addEventListener?: (...args: any) => any;
341
+ removeEventListener?: (...args: any) => any;
342
+ }
343
+
344
+ export interface FormDataVisitorHelpers {
345
+ defaultVisitor: SerializerVisitor;
346
+ convertValue: (value: any) => any;
347
+ isVisitable: (value: any) => boolean;
348
+ }
349
+
350
+ export interface SerializerVisitor {
351
+ (
352
+ this: GenericFormData,
353
+ value: any,
354
+ key: string | number,
355
+ path: null | Array<string | number>,
356
+ helpers: FormDataVisitorHelpers,
357
+ ): boolean;
358
+ }
359
+
360
+ export interface SerializerOptions {
361
+ visitor?: SerializerVisitor;
362
+ dots?: boolean;
363
+ metaTokens?: boolean;
364
+ indexes?: boolean | null;
365
+ }
366
+
367
+ // tslint:disable-next-line
368
+ export interface FormSerializerOptions extends SerializerOptions {}
369
+
370
+ export interface ParamEncoder {
371
+ (value: any, defaultEncoder: (value: any) => any): any;
372
+ }
373
+
374
+ export interface CustomParamsSerializer {
375
+ (params: Record<string, any>, options?: ParamsSerializerOptions): string;
376
+ }
377
+
378
+ export interface ParamsSerializerOptions extends SerializerOptions {
379
+ encode?: ParamEncoder;
380
+ serialize?: CustomParamsSerializer;
381
+ }
382
+
383
+ type MaxUploadRate = number;
384
+
385
+ type MaxDownloadRate = number;
386
+
387
+ type BrowserProgressEvent = any;
388
+
389
+ export interface AxiosProgressEvent {
390
+ loaded: number;
391
+ total?: number;
392
+ progress?: number;
393
+ bytes: number;
394
+ rate?: number;
395
+ estimated?: number;
396
+ upload?: boolean;
397
+ download?: boolean;
398
+ event?: BrowserProgressEvent;
399
+ lengthComputable: boolean;
400
+ }
401
+
402
+ type Milliseconds = number;
403
+
404
+ type AxiosAdapterName = StringLiteralsOrString<'xhr' | 'http' | 'fetch'>;
405
+
406
+ type AxiosAdapterConfig = AxiosAdapter | AxiosAdapterName;
407
+
408
+ export type AddressFamily = 4 | 6 | undefined;
409
+
410
+ export interface LookupAddressEntry {
411
+ address: string;
412
+ family?: AddressFamily;
413
+ }
414
+
415
+ export type LookupAddress = string | LookupAddressEntry;
416
+
417
+ export interface AxiosRequestConfig<D = any> {
418
+ url?: string;
419
+ method?: StringLiteralsOrString<Method>;
420
+ baseURL?: string;
421
+ allowAbsoluteUrls?: boolean;
422
+ transformRequest?: AxiosRequestTransformer | AxiosRequestTransformer[];
423
+ transformResponse?: AxiosResponseTransformer | AxiosResponseTransformer[];
424
+ headers?: (RawAxiosRequestHeaders & MethodsHeaders) | AxiosHeaders;
425
+ params?: any;
426
+ paramsSerializer?: ParamsSerializerOptions | CustomParamsSerializer;
427
+ data?: D;
428
+ timeout?: Milliseconds;
429
+ timeoutErrorMessage?: string;
430
+ withCredentials?: boolean;
431
+ adapter?: AxiosAdapterConfig | AxiosAdapterConfig[];
432
+ auth?: AxiosBasicCredentials;
433
+ responseType?: ResponseType;
434
+ responseEncoding?: StringLiteralsOrString<responseEncoding>;
435
+ xsrfCookieName?: string;
436
+ xsrfHeaderName?: string;
437
+ onUploadProgress?: (progressEvent: AxiosProgressEvent) => void;
438
+ onDownloadProgress?: (progressEvent: AxiosProgressEvent) => void;
439
+ maxContentLength?: number;
440
+ validateStatus?: ((status: number) => boolean) | null;
441
+ maxBodyLength?: number;
442
+ maxRedirects?: number;
443
+ maxRate?: number | [MaxUploadRate, MaxDownloadRate];
444
+ beforeRedirect?: (
445
+ options: Record<string, any>,
446
+ responseDetails: {
447
+ headers: Record<string, string>;
448
+ statusCode: HttpStatusCode;
449
+ },
450
+ ) => void;
451
+ socketPath?: string | null;
452
+ transport?: any;
453
+ httpAgent?: any;
454
+ httpsAgent?: any;
455
+ proxy?: AxiosProxyConfig | false;
456
+ cancelToken?: CancelToken | undefined;
457
+ decompress?: boolean;
458
+ transitional?: TransitionalOptions;
459
+ signal?: GenericAbortSignal;
460
+ insecureHTTPParser?: boolean;
461
+ env?: {
462
+ FormData?: new (...args: any[]) => object;
463
+ fetch?: (
464
+ input: URL | Request | string,
465
+ init?: RequestInit,
466
+ ) => Promise<Response>;
467
+ Request?: new (
468
+ input: URL | Request | string,
469
+ init?: RequestInit,
470
+ ) => Request;
471
+ Response?: new (
472
+ body?:
473
+ | ArrayBuffer
474
+ | ArrayBufferView
475
+ | Blob
476
+ | FormData
477
+ | URLSearchParams
478
+ | string
479
+ | null,
480
+ init?: ResponseInit,
481
+ ) => Response;
482
+ };
483
+ formSerializer?: FormSerializerOptions;
484
+ family?: AddressFamily;
485
+ lookup?:
486
+ | ((
487
+ hostname: string,
488
+ options: object,
489
+ cb: (
490
+ err: Error | null,
491
+ address: LookupAddress | LookupAddress[],
492
+ family?: AddressFamily,
493
+ ) => void,
494
+ ) => void)
495
+ | ((
496
+ hostname: string,
497
+ options: object,
498
+ ) => Promise<
499
+ | [
500
+ address: LookupAddressEntry | LookupAddressEntry[],
501
+ family?: AddressFamily,
502
+ ]
503
+ | LookupAddress
504
+ >);
505
+ withXSRFToken?:
506
+ | boolean
507
+ | ((config: InternalAxiosRequestConfig) => boolean | undefined);
508
+ parseReviver?: (this: any, key: string, value: any) => any;
509
+ fetchOptions?:
510
+ | Omit<RequestInit, 'body' | 'headers' | 'method' | 'signal'>
511
+ | Record<string, any>;
512
+ httpVersion?: 1 | 2;
513
+ http2Options?: Record<string, any> & {
514
+ sessionTimeout?: number;
515
+ };
516
+ }
517
+
518
+ // Alias
519
+ export type RawAxiosRequestConfig<D = any> = AxiosRequestConfig<D>;
520
+
521
+ export interface InternalAxiosRequestConfig<D = any>
522
+ extends AxiosRequestConfig<D> {
523
+ headers: AxiosRequestHeaders;
524
+ }
525
+
526
+ export interface HeadersDefaults {
527
+ common: RawAxiosRequestHeaders;
528
+ delete: RawAxiosRequestHeaders;
529
+ get: RawAxiosRequestHeaders;
530
+ head: RawAxiosRequestHeaders;
531
+ post: RawAxiosRequestHeaders;
532
+ put: RawAxiosRequestHeaders;
533
+ patch: RawAxiosRequestHeaders;
534
+ options?: RawAxiosRequestHeaders;
535
+ purge?: RawAxiosRequestHeaders;
536
+ link?: RawAxiosRequestHeaders;
537
+ unlink?: RawAxiosRequestHeaders;
538
+ }
539
+
540
+ export interface AxiosDefaults<D = any>
541
+ extends Omit<AxiosRequestConfig<D>, 'headers'> {
542
+ headers: HeadersDefaults;
543
+ }
544
+
545
+ export interface CreateAxiosDefaults<D = any>
546
+ extends Omit<AxiosRequestConfig<D>, 'headers'> {
547
+ headers?: RawAxiosRequestHeaders | AxiosHeaders | Partial<HeadersDefaults>;
548
+ }
549
+
550
+ export interface AxiosResponse<T = any, D = any, H = {}> {
551
+ data: T;
552
+ status: number;
553
+ statusText: string;
554
+ headers: (H & RawAxiosResponseHeaders) | AxiosResponseHeaders;
555
+ config: InternalAxiosRequestConfig<D>;
556
+ request?: any;
557
+ }
558
+
559
+ export class AxiosError<T = unknown, D = any> extends Error {
560
+ constructor(
561
+ message?: string,
562
+ code?: string,
563
+ config?: InternalAxiosRequestConfig<D>,
564
+ request?: any,
565
+ response?: AxiosResponse<T, D>,
566
+ );
567
+
568
+ config?: InternalAxiosRequestConfig<D>;
569
+ code?: string;
570
+ request?: any;
571
+ response?: AxiosResponse<T, D>;
572
+ isAxiosError: boolean;
573
+ status?: number;
574
+ toJSON: () => object;
575
+ cause?: unknown;
576
+ event?: BrowserProgressEvent;
577
+ static from<T = unknown, D = any>(
578
+ error: Error | unknown,
579
+ code?: string,
580
+ config?: InternalAxiosRequestConfig<D>,
581
+ request?: any,
582
+ response?: AxiosResponse<T, D>,
583
+ customProps?: object,
584
+ ): AxiosError<T, D>;
585
+ static readonly ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
586
+ static readonly ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
587
+ static readonly ERR_BAD_OPTION = 'ERR_BAD_OPTION';
588
+ static readonly ERR_NETWORK = 'ERR_NETWORK';
589
+ static readonly ERR_DEPRECATED = 'ERR_DEPRECATED';
590
+ static readonly ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
591
+ static readonly ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
592
+ static readonly ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
593
+ static readonly ERR_INVALID_URL = 'ERR_INVALID_URL';
594
+ static readonly ERR_CANCELED = 'ERR_CANCELED';
595
+ static readonly ECONNABORTED = 'ECONNABORTED';
596
+ static readonly ETIMEDOUT = 'ETIMEDOUT';
597
+ }
598
+
599
+ export class CanceledError<T> extends AxiosError<T> {
600
+ readonly name: 'CanceledError';
601
+ }
602
+
603
+ export type AxiosPromise<T = any> = Promise<AxiosResponse<T>>;
604
+
605
+ export interface CancelStatic {
606
+ new (message?: string): Cancel;
607
+ }
608
+
609
+ export interface Cancel {
610
+ message: string | undefined;
611
+ }
612
+
613
+ export interface Canceler {
614
+ (message?: string, config?: AxiosRequestConfig, request?: any): void;
615
+ }
616
+
617
+ export interface CancelTokenStatic {
618
+ new (executor: (cancel: Canceler) => void): CancelToken;
619
+ source(): CancelTokenSource;
620
+ }
621
+
622
+ export interface CancelToken {
623
+ promise: Promise<Cancel>;
624
+ reason?: Cancel;
625
+ throwIfRequested(): void;
626
+ }
627
+
628
+ export interface CancelTokenSource {
629
+ token: CancelToken;
630
+ cancel: Canceler;
631
+ }
632
+
633
+ export interface AxiosInterceptorOptions {
634
+ synchronous?: boolean;
635
+ runWhen?: (config: InternalAxiosRequestConfig) => boolean;
636
+ }
637
+
638
+ type AxiosRequestInterceptorUse<T> = (
639
+ onFulfilled?: ((value: T) => T | Promise<T>) | null,
640
+ onRejected?: ((error: any) => any) | null,
641
+ options?: AxiosInterceptorOptions,
642
+ ) => number;
643
+
644
+ type AxiosResponseInterceptorUse<T> = (
645
+ onFulfilled?: ((value: T) => T | Promise<T>) | null,
646
+ onRejected?: ((error: any) => any) | null,
647
+ ) => number;
648
+
649
+ export interface AxiosInterceptorManager<V> {
650
+ use: V extends AxiosResponse
651
+ ? AxiosResponseInterceptorUse<V>
652
+ : AxiosRequestInterceptorUse<V>;
653
+ eject(id: number): void;
654
+ clear(): void;
655
+ }
656
+
657
+ export class Axios {
658
+ constructor(config?: AxiosRequestConfig);
659
+ defaults: AxiosDefaults;
660
+ interceptors: {
661
+ request: AxiosInterceptorManager<InternalAxiosRequestConfig>;
662
+ response: AxiosInterceptorManager<AxiosResponse>;
663
+ };
664
+ getUri(config?: AxiosRequestConfig): string;
665
+ request<T = any, R = AxiosResponse<T>, D = any>(
666
+ config: AxiosRequestConfig<D>,
667
+ ): Promise<R>;
668
+ get<T = any, R = AxiosResponse<T>, D = any>(
669
+ url: string,
670
+ config?: AxiosRequestConfig<D>,
671
+ ): Promise<R>;
672
+ delete<T = any, R = AxiosResponse<T>, D = any>(
673
+ url: string,
674
+ config?: AxiosRequestConfig<D>,
675
+ ): Promise<R>;
676
+ head<T = any, R = AxiosResponse<T>, D = any>(
677
+ url: string,
678
+ config?: AxiosRequestConfig<D>,
679
+ ): Promise<R>;
680
+ options<T = any, R = AxiosResponse<T>, D = any>(
681
+ url: string,
682
+ config?: AxiosRequestConfig<D>,
683
+ ): Promise<R>;
684
+ post<T = any, R = AxiosResponse<T>, D = any>(
685
+ url: string,
686
+ data?: D,
687
+ config?: AxiosRequestConfig<D>,
688
+ ): Promise<R>;
689
+ put<T = any, R = AxiosResponse<T>, D = any>(
690
+ url: string,
691
+ data?: D,
692
+ config?: AxiosRequestConfig<D>,
693
+ ): Promise<R>;
694
+ patch<T = any, R = AxiosResponse<T>, D = any>(
695
+ url: string,
696
+ data?: D,
697
+ config?: AxiosRequestConfig<D>,
698
+ ): Promise<R>;
699
+ postForm<T = any, R = AxiosResponse<T>, D = any>(
700
+ url: string,
701
+ data?: D,
702
+ config?: AxiosRequestConfig<D>,
703
+ ): Promise<R>;
704
+ putForm<T = any, R = AxiosResponse<T>, D = any>(
705
+ url: string,
706
+ data?: D,
707
+ config?: AxiosRequestConfig<D>,
708
+ ): Promise<R>;
709
+ patchForm<T = any, R = AxiosResponse<T>, D = any>(
710
+ url: string,
711
+ data?: D,
712
+ config?: AxiosRequestConfig<D>,
713
+ ): Promise<R>;
714
+ }
715
+
716
+ export interface AxiosInstance extends Axios {
717
+ <T = any, R = AxiosResponse<T>, D = any>(
718
+ config: AxiosRequestConfig<D>,
719
+ ): Promise<R>;
720
+ <T = any, R = AxiosResponse<T>, D = any>(
721
+ url: string,
722
+ config?: AxiosRequestConfig<D>,
723
+ ): Promise<R>;
724
+
725
+ create(config?: CreateAxiosDefaults): AxiosInstance;
726
+ defaults: Omit<AxiosDefaults, 'headers'> & {
727
+ headers: HeadersDefaults & {
728
+ [key: string]: AxiosHeaderValue;
729
+ };
730
+ };
731
+ }
732
+
733
+ export interface GenericFormData {
734
+ append(name: string, value: any, options?: any): any;
735
+ }
736
+
737
+ export interface GenericHTMLFormElement {
738
+ name: string;
739
+ method: string;
740
+ submit(): void;
741
+ }
742
+
743
+ export function getAdapter(
744
+ adapters: AxiosAdapterConfig | AxiosAdapterConfig[] | undefined,
745
+ ): AxiosAdapter;
746
+
747
+ export function toFormData(
748
+ sourceObj: object,
749
+ targetFormData?: GenericFormData,
750
+ options?: FormSerializerOptions,
751
+ ): GenericFormData;
752
+
753
+ export function formToJSON(
754
+ form: GenericFormData | GenericHTMLFormElement,
755
+ ): object;
756
+
757
+ export function isAxiosError<T = any, D = any>(
758
+ payload: any,
759
+ ): payload is AxiosError<T, D>;
760
+
761
+ export function spread<T, R>(callback: (...args: T[]) => R): (array: T[]) => R;
762
+
763
+ export function isCancel<T = any>(value: any): value is CanceledError<T>;
764
+
765
+ export function all<T>(values: Array<T | Promise<T>>): Promise<T[]>;
766
+
767
+ export function mergeConfig<D = any>(
768
+ config1: AxiosRequestConfig<D>,
769
+ config2: AxiosRequestConfig<D>,
770
+ ): AxiosRequestConfig<D>;
771
+
772
+ export interface AxiosStatic extends AxiosInstance {
773
+ Cancel: CancelStatic;
774
+ CancelToken: CancelTokenStatic;
775
+ Axios: typeof Axios;
776
+ AxiosError: typeof AxiosError;
777
+ HttpStatusCode: typeof HttpStatusCode;
778
+ readonly VERSION: string;
779
+ isCancel: typeof isCancel;
780
+ all: typeof all;
781
+ spread: typeof spread;
782
+ isAxiosError: typeof isAxiosError;
783
+ toFormData: typeof toFormData;
784
+ formToJSON: typeof formToJSON;
785
+ getAdapter: typeof getAdapter;
786
+ CanceledError: typeof CanceledError;
787
+ AxiosHeaders: typeof AxiosHeaders;
788
+ mergeConfig: typeof mergeConfig;
789
+ }
790
+
791
+ declare const axios: AxiosStatic;
792
+
793
+ export default axios;