@unicom-cloud/axios 0.1.1 → 0.1.3

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