UNPKG

jswagger

Version:
101 lines 3.28 kB
/// <reference types="node" /> import { AxiosRequestConfig, AxiosResponse, AxiosError } from 'axios'; import { OpenAPI2 } from 'jswagger-common'; import * as http from 'http'; import * as https from 'https'; export interface ISwaggerClientConfig { spec: OpenAPI2; protocol?: string; host?: string; baseUrl?: string; httpAgent?: http.Agent; httpsAgent?: https.Agent; securityContext?: IApiSecurityContext; } export interface ISwaggerApiOptions { securityContext?: IApiSecurityContext; } export interface ApiRequestOptions<T, P> extends AxiosRequestConfig { securityContext?: IApiSecurityContext; queries?: Record<string, any>; } export interface ApiRequestOptionsRX<T, P> extends ApiRequestOptions<T, P> { data: T; } export interface ApiRequestOptionsRO<T, P> extends ApiRequestOptions<T, P> { data: T; params?: P; } export interface ApiRequestOptionsRR<T, P> extends ApiRequestOptions<T, P> { data: T; params: P; } export interface ApiRequestOptionsOX<T, P> extends ApiRequestOptions<T, P> { data?: T; } export interface ApiRequestOptionsOO<T, P> extends ApiRequestOptions<T, P> { data?: T; params?: P; } export interface ApiRequestOptionsOR<T, P> extends ApiRequestOptions<T, P> { data?: T; params: P; } export interface ApiRequestOptionsXX<T, P> extends ApiRequestOptions<T, P> { } export interface ApiRequestOptionsXO<T, P> extends ApiRequestOptions<T, P> { params?: P; } export interface ApiRequestOptionsXR<T, P> extends ApiRequestOptions<T, P> { params: P; } export interface ApiResponse<T, H> extends AxiosResponse<T> { data: T; headers: H; } export declare type AnyKeyValueType = { [key: string]: any; }; export interface IApiSecurityContext { headerReplacer?: (input: AnyKeyValueType) => AnyKeyValueType; queryReplacer?: (input: AnyKeyValueType) => AnyKeyValueType; } declare const S_API_ERROR: unique symbol; export declare class ApiError extends Error { readonly [S_API_ERROR]: boolean; readonly code: string; readonly data: any; readonly headers: AnyKeyValueType; readonly axiosError: AxiosError; readonly axiosConfig: AxiosRequestConfig; readonly axiosRequest?: any; readonly axiosResponse?: AxiosResponse; constructor(params: { message: string; code: string; status: number; data: any; headers: AnyKeyValueType; axiosError: AxiosError; axiosConfig: AxiosRequestConfig; axiosRequest?: any; axiosResponse?: AxiosResponse; }); static isInstance(o: any): boolean; } declare type IsSwaggerDefinitionFunctionType = (o: any) => boolean; declare type GetSwaggerDefinitionName = (o: any) => string; declare type SwaggerDefinitionToJson = (o: any) => any; export interface ISpecMetadata { isSwaggerDefinition: IsSwaggerDefinitionFunctionType; getSwaggerDefinitionName: GetSwaggerDefinitionName; swaggerDefinitionToJson: SwaggerDefinitionToJson; classes: readonly any[]; definitions: Record<string, any>; } export interface IApiMetadata { tag: string; specMetadata: ISpecMetadata; } export {}; //# sourceMappingURL=types.d.ts.map