This repository has been archived by the owner on May 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
72 lines (65 loc) · 2.16 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// This file is part of the @egomobile/api-utils distribution.
// Copyright (c) Next.e.GO Mobile SE, Aachen, Germany (https://e-go-mobile.com/)
//
// @egomobile/api-utils is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, version 3.
//
// @egomobile/api-utils is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import type { AxiosInstance } from "axios";
import type { IncomingMessage, ServerResponse } from "node:http";
import type { ApiResponseBuilder } from "../responses";
import type { Nilable } from "./internal";
/**
* A function, that provides an `AxiosInstance`.
*
* @returns {Promise<AxiosInstance>} The promise with the new instance.
*/
export type AxiosClientProvider =
() => Promise<AxiosInstance>;
/**
* A function, which creates a new `ApiResponseBuilder` instance.
*
* @param {IApiResponseBuilderFactoryOptions} options The options.
*/
export type ApiResponseBuilderFactory =
(options: IApiResponseBuilderFactoryOptions) => ApiResponseBuilder;
/**
* A debug action.
*
* @param {string} message The message text.
* @param {string} icon The icon.
* @param {Nilable<string>} [source] The name of the optional source.
*/
export type DebugAction =
(message: string, icon: DebugIcon, source?: Nilable<string>) => any;
/**
* A possible value for a known debug icon.
*
* 🐞: debug
* ✅: success
* ℹ️: info
* ❌: error
* ⚠️: warning
*/
export type DebugIcon = "🐞" | "✅" | "ℹ️" | "❌" | "⚠️";
/**
* Options for an `ApiResponseBuilderFactory` function.
*/
export interface IApiResponseBuilderFactoryOptions {
/**
* The request context.
*/
request: IncomingMessage;
/**
* The response context.
*/
response: ServerResponse;
}
export * from "./errors";