new lib version [CI SKIP]

This commit is contained in:
2020-12-13 18:49:21 +00:00
parent 55cdf79f9c
commit 823fb926a5
87 changed files with 859 additions and 0 deletions

8
dist/core/ApiError.d.ts vendored Normal file
View File

@@ -0,0 +1,8 @@
import type { ApiResult } from './ApiResult';
export declare class ApiError extends Error {
readonly url: string;
readonly status: number;
readonly statusText: string;
readonly body: any;
constructor(response: ApiResult, message: string);
}

11
dist/core/ApiRequestOptions.d.ts vendored Normal file
View File

@@ -0,0 +1,11 @@
export declare type ApiRequestOptions = {
readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH';
readonly path: string;
readonly cookies?: Record<string, any>;
readonly headers?: Record<string, any>;
readonly query?: Record<string, any>;
readonly formData?: Record<string, any>;
readonly body?: any;
readonly responseHeader?: string;
readonly errors?: Record<number, string>;
};

7
dist/core/ApiResult.d.ts vendored Normal file
View File

@@ -0,0 +1,7 @@
export declare type ApiResult = {
readonly url: string;
readonly ok: boolean;
readonly status: number;
readonly statusText: string;
readonly body: any;
};

13
dist/core/OpenAPI.d.ts vendored Normal file
View File

@@ -0,0 +1,13 @@
declare type Resolver<T> = () => Promise<T>;
declare type Headers = Record<string, string>;
declare type Config = {
BASE: string;
VERSION: string;
WITH_CREDENTIALS: boolean;
TOKEN?: string | Resolver<string>;
USERNAME?: string | Resolver<string>;
PASSWORD?: string | Resolver<string>;
HEADERS?: Headers | Resolver<Headers>;
};
export declare const OpenAPI: Config;
export {};

9
dist/core/request.d.ts vendored Normal file
View File

@@ -0,0 +1,9 @@
import type { ApiRequestOptions } from './ApiRequestOptions';
import type { ApiResult } from './ApiResult';
/**
* Request using node-fetch client
* @param options The request options from the the service
* @result ApiResult
* @throws ApiError
*/
export declare function request(options: ApiRequestOptions): Promise<ApiResult>;