1 | import { AxiosRequestConfig, AxiosResponse } from 'axios';
|
2 | import { FactoryProvider, Logger, LoggerService } from '@nestjs/common';
|
3 | export declare enum ParameterStyle {
|
4 | SNAKE_TO_CAMEL = "SnakeToCamel",
|
5 | CAMEL_TO_SNAKE = "CamelToSnake"
|
6 | }
|
7 | export interface RequestConfig {
|
8 | protocol?: 'http' | 'https' | 'http2';
|
9 | timeout?: number;
|
10 | timeoutErrorMessage?: string;
|
11 | withCredentials?: boolean;
|
12 | xsrfCookieName?: string;
|
13 | xsrfHeaderName?: string;
|
14 | maxContentLength?: number;
|
15 | maxRedirects?: number;
|
16 | socketPath?: string | null;
|
17 | httpAgent?: any;
|
18 | httpsAgent?: any;
|
19 | parameterStyle?: 'SnakeToCamel' | 'CamelToSnake';
|
20 | logger?: Logger | LoggerService;
|
21 | requestInterceptors?: Array<{
|
22 | onFulfilled?: (value: AxiosRequestConfig) => AxiosRequestConfig | Promise<AxiosRequestConfig>;
|
23 | onRejected?: (error: any) => any;
|
24 | }>;
|
25 | responseInterceptors?: Array<{
|
26 | onFulfilled?: (value: AxiosResponse) => AxiosResponse | Promise<AxiosResponse>;
|
27 | onRejected?: (error: any) => any;
|
28 | }>;
|
29 | }
|
30 | export interface RequestAsyncConfig {
|
31 | name?: string;
|
32 | useFactory: (...args: any[]) => Promise<RequestConfig> | RequestConfig;
|
33 | inject?: FactoryProvider['inject'];
|
34 | }
|
35 | export interface ResponseSchema<T> {
|
36 | code: number;
|
37 | msg: string;
|
38 | data: T | null;
|
39 | success: boolean;
|
40 | }
|