项目原始demo,不改动
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
Bu depo arşivlendi. Dosyaları görüntüleyebilir ve klonlayabilirsiniz ama işlem gönderemez ve konu/değişiklik isteği açamazsınız.
 
 
 
 

153 satır
3.9 KiB

  1. export interface AxiosTransformer {
  2. (data: any, headers?: any): any;
  3. }
  4. export interface AxiosAdapter {
  5. (config: AxiosRequestConfig): AxiosPromise<any>;
  6. }
  7. export interface AxiosBasicCredentials {
  8. username: string;
  9. password: string;
  10. }
  11. export interface AxiosProxyConfig {
  12. host: string;
  13. port: number;
  14. auth?: {
  15. username: string;
  16. password:string;
  17. };
  18. protocol?: string;
  19. }
  20. export type Method =
  21. | 'get' | 'GET'
  22. | 'delete' | 'DELETE'
  23. | 'head' | 'HEAD'
  24. | 'options' | 'OPTIONS'
  25. | 'post' | 'POST'
  26. | 'put' | 'PUT'
  27. | 'patch' | 'PATCH'
  28. export type ResponseType =
  29. | 'arraybuffer'
  30. | 'blob'
  31. | 'document'
  32. | 'json'
  33. | 'text'
  34. | 'stream'
  35. export interface AxiosRequestConfig {
  36. url?: string;
  37. method?: Method;
  38. baseURL?: string;
  39. transformRequest?: AxiosTransformer | AxiosTransformer[];
  40. transformResponse?: AxiosTransformer | AxiosTransformer[];
  41. headers?: any;
  42. params?: any;
  43. paramsSerializer?: (params: any) => string;
  44. data?: any;
  45. timeout?: number;
  46. withCredentials?: boolean;
  47. adapter?: AxiosAdapter;
  48. auth?: AxiosBasicCredentials;
  49. responseType?: ResponseType;
  50. xsrfCookieName?: string;
  51. xsrfHeaderName?: string;
  52. onUploadProgress?: (progressEvent: any) => void;
  53. onDownloadProgress?: (progressEvent: any) => void;
  54. maxContentLength?: number;
  55. validateStatus?: (status: number) => boolean;
  56. maxRedirects?: number;
  57. socketPath?: string | null;
  58. httpAgent?: any;
  59. httpsAgent?: any;
  60. proxy?: AxiosProxyConfig | false;
  61. cancelToken?: CancelToken;
  62. }
  63. export interface AxiosResponse<T = any> {
  64. data: T;
  65. status: number;
  66. statusText: string;
  67. headers: any;
  68. config: AxiosRequestConfig;
  69. request?: any;
  70. }
  71. export interface AxiosError<T = any> extends Error {
  72. config: AxiosRequestConfig;
  73. code?: string;
  74. request?: any;
  75. response?: AxiosResponse<T>;
  76. isAxiosError: boolean;
  77. }
  78. export interface AxiosPromise<T = any> extends Promise<AxiosResponse<T>> {
  79. }
  80. export interface CancelStatic {
  81. new (message?: string): Cancel;
  82. }
  83. export interface Cancel {
  84. message: string;
  85. }
  86. export interface Canceler {
  87. (message?: string): void;
  88. }
  89. export interface CancelTokenStatic {
  90. new (executor: (cancel: Canceler) => void): CancelToken;
  91. source(): CancelTokenSource;
  92. }
  93. export interface CancelToken {
  94. promise: Promise<Cancel>;
  95. reason?: Cancel;
  96. throwIfRequested(): void;
  97. }
  98. export interface CancelTokenSource {
  99. token: CancelToken;
  100. cancel: Canceler;
  101. }
  102. export interface AxiosInterceptorManager<V> {
  103. use(onFulfilled?: (value: V) => V | Promise<V>, onRejected?: (error: any) => any): number;
  104. eject(id: number): void;
  105. }
  106. export interface AxiosInstance {
  107. (config: AxiosRequestConfig): AxiosPromise;
  108. (url: string, config?: AxiosRequestConfig): AxiosPromise;
  109. defaults: AxiosRequestConfig;
  110. interceptors: {
  111. request: AxiosInterceptorManager<AxiosRequestConfig>;
  112. response: AxiosInterceptorManager<AxiosResponse>;
  113. };
  114. getUri(config?: AxiosRequestConfig): string;
  115. request<T = any, R = AxiosResponse<T>> (config: AxiosRequestConfig): Promise<R>;
  116. get<T = any, R = AxiosResponse<T>>(url: string, config?: AxiosRequestConfig): Promise<R>;
  117. delete<T = any, R = AxiosResponse<T>>(url: string, config?: AxiosRequestConfig): Promise<R>;
  118. head<T = any, R = AxiosResponse<T>>(url: string, config?: AxiosRequestConfig): Promise<R>;
  119. post<T = any, R = AxiosResponse<T>>(url: string, data?: any, config?: AxiosRequestConfig): Promise<R>;
  120. put<T = any, R = AxiosResponse<T>>(url: string, data?: any, config?: AxiosRequestConfig): Promise<R>;
  121. patch<T = any, R = AxiosResponse<T>>(url: string, data?: any, config?: AxiosRequestConfig): Promise<R>;
  122. }
  123. export interface AxiosStatic extends AxiosInstance {
  124. create(config?: AxiosRequestConfig): AxiosInstance;
  125. Cancel: CancelStatic;
  126. CancelToken: CancelTokenStatic;
  127. isCancel(value: any): boolean;
  128. all<T>(values: (T | Promise<T>)[]): Promise<T[]>;
  129. spread<T, R>(callback: (...args: T[]) => R): (array: T[]) => R;
  130. }
  131. declare const Axios: AxiosStatic;
  132. export default Axios;