@avalabs/glacier-sdk 2.5.0-alpha.0 → 2.5.0-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/src/V1.d.ts DELETED
@@ -1,113 +0,0 @@
1
- import { ChainInfoDto, ChainsDto, Erc20BalancesDto, Erc721BalancesDto, ListTransactionDetailsDto, NativeBalanceDto, TransactionDetailsDto } from './data-contracts';
2
- import { HttpClient, RequestParams } from './http-client';
3
- export declare class V1<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
4
- /**
5
- * No description
6
- *
7
- * @name HealthCheck
8
- * @summary Get the health of the service.
9
- * @request GET:/v1/health-check
10
- * @response `200` `{ status?: string, info?: Record<string, { status?: string }>, error?: Record<string, { status?: string }>, details?: Record<string, { status?: string }> }` The Health Check is successful
11
- * @response `503` `{ status?: string, info?: Record<string, { status?: string }>, error?: Record<string, { status?: string }>, details?: Record<string, { status?: string }> }` The Health Check is not successful
12
- */
13
- healthCheck: (params?: RequestParams) => Promise<import("./http-client").HttpResponse<{
14
- status?: string | undefined;
15
- info?: Record<string, {
16
- status?: string | undefined;
17
- }> | undefined;
18
- error?: Record<string, {
19
- status?: string | undefined;
20
- }> | undefined;
21
- details?: Record<string, {
22
- status?: string | undefined;
23
- }> | undefined;
24
- }, {
25
- status?: string | undefined;
26
- info?: Record<string, {
27
- status?: string | undefined;
28
- }> | undefined;
29
- error?: Record<string, {
30
- status?: string | undefined;
31
- }> | undefined;
32
- details?: Record<string, {
33
- status?: string | undefined;
34
- }> | undefined;
35
- }>>;
36
- /**
37
- * No description
38
- *
39
- * @name GetNativeBalance
40
- * @summary Get native token balance of a wallet address for a given chain.
41
- * @request GET:/v1/chains/{chainId}/addresses/{address}/balances:getNative
42
- * @response `200` `NativeBalanceDto`
43
- */
44
- getNativeBalance: (chainId: string, address: string, query?: {
45
- currency?: "usd" | "eur" | "aud" | "cad" | "chf" | "clp" | "czk" | "dkk" | "gbp" | "hkd" | "huf" | undefined;
46
- } | undefined, params?: RequestParams) => Promise<import("./http-client").HttpResponse<NativeBalanceDto, any>>;
47
- /**
48
- * No description
49
- *
50
- * @name ListErc20Balances
51
- * @summary Get erc-20 token balances of a wallet address for a given chain.
52
- * @request GET:/v1/chains/{chainId}/addresses/{address}/balances:listErc20
53
- * @response `200` `Erc20BalancesDto`
54
- */
55
- listErc20Balances: (chainId: string, address: string, query?: {
56
- pageSize?: number | undefined;
57
- pageToken?: string | undefined;
58
- currency?: "usd" | "eur" | "aud" | "cad" | "chf" | "clp" | "czk" | "dkk" | "gbp" | "hkd" | "huf" | undefined;
59
- } | undefined, params?: RequestParams) => Promise<import("./http-client").HttpResponse<Erc20BalancesDto, any>>;
60
- /**
61
- * No description
62
- *
63
- * @name ListErc721Balances
64
- * @summary Get erc-721 token balances of a wallet address for a given chain.
65
- * @request GET:/v1/chains/{chainId}/addresses/{address}/balances:listErc721
66
- * @response `200` `Erc721BalancesDto`
67
- */
68
- listErc721Balances: (chainId: string, address: string, query?: {
69
- pageSize?: number | undefined;
70
- pageToken?: string | undefined;
71
- currency?: "usd" | "eur" | "aud" | "cad" | "chf" | "clp" | "czk" | "dkk" | "gbp" | "hkd" | "huf" | undefined;
72
- } | undefined, params?: RequestParams) => Promise<import("./http-client").HttpResponse<Erc721BalancesDto, any>>;
73
- /**
74
- * @description Gets a list of transactions where the given wallet address had an on-chain interaction for a given chain. The erc20 transfers, erc721 transfers, and internal transactions returned as part of the native transactions are only those where the address had an interaction. Therefore the transactions returned from this list may not be complete representations of the on-chain data. For a complete view of a transaction use the `/chains/:chainId/transactions/:txHash` endpoint.
75
- *
76
- * @name ListTransactions
77
- * @summary Gets a list of transactions for a wallet address and chain.
78
- * @request GET:/v1/chains/{chainId}/addresses/{address}/transactions
79
- * @response `200` `ListTransactionDetailsDto`
80
- */
81
- listTransactions: (chainId: string, address: string, query?: {
82
- pageSize?: number | undefined;
83
- pageToken?: string | undefined;
84
- } | undefined, params?: RequestParams) => Promise<import("./http-client").HttpResponse<ListTransactionDetailsDto, any>>;
85
- /**
86
- * No description
87
- *
88
- * @name GetTransaction
89
- * @summary Gets the details of a single transaction.
90
- * @request GET:/v1/chains/{chainId}/transactions/{txHash}
91
- * @response `200` `TransactionDetailsDto`
92
- */
93
- getTransaction: (chainId: string, txHash: string, params?: RequestParams) => Promise<import("./http-client").HttpResponse<TransactionDetailsDto, any>>;
94
- /**
95
- * No description
96
- *
97
- * @name SupportedChains
98
- * @summary Gets the list of chains supported by the api.
99
- * @request GET:/v1/chains
100
- * @response `200` `ChainsDto`
101
- */
102
- supportedChains: (params?: RequestParams) => Promise<import("./http-client").HttpResponse<ChainsDto, any>>;
103
- /**
104
- * No description
105
- *
106
- * @name GetChainInfo
107
- * @summary Gets chain information by chain id.
108
- * @request GET:/v1/chains/{chainId}
109
- * @response `200` `ChainInfoDto`
110
- */
111
- getChainInfo: (chainId: string, params?: RequestParams) => Promise<import("./http-client").HttpResponse<ChainInfoDto, any>>;
112
- }
113
- //# sourceMappingURL=V1.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"V1.d.ts","sourceRoot":"","sources":["../../src/V1.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,yBAAyB,EACzB,gBAAgB,EAChB,qBAAqB,EACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE1D,qBAAa,EAAE,CACb,gBAAgB,GAAG,OAAO,CAC1B,SAAQ,UAAU,CAAC,gBAAgB,CAAC;IACpC;;;;;;;;OAQG;IACH,WAAW,YAAY,aAAa;;;;;;;;;;;;;;;;;;;;;;QAmB/B;IACL;;;;;;;OAOG;IACH,gBAAgB,YACL,MAAM,WACN,MAAM;;4BAeP,aAAa,0EAQlB;IACL;;;;;;;OAOG;IACH,iBAAiB,YACN,MAAM,WACN,MAAM;;;;4BAiBP,aAAa,0EAQlB;IACL;;;;;;;OAOG;IACH,kBAAkB,YACP,MAAM,WACN,MAAM;;;;4BAiBP,aAAa,2EAQlB;IACL;;;;;;;OAOG;IACH,gBAAgB,YACL,MAAM,WACN,MAAM;;;4BAEP,aAAa,mFAQlB;IACL;;;;;;;OAOG;IACH,cAAc,YACH,MAAM,UACP,MAAM,WACN,aAAa,+EAOlB;IACL;;;;;;;OAOG;IACH,eAAe,YAAY,aAAa,mEAMnC;IACL;;;;;;;OAOG;IACH,YAAY,YAAa,MAAM,WAAU,aAAa,sEAMjD;CACN"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"data-contracts.d.ts","sourceRoot":"","sources":["../../src/data-contracts.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,QAAQ;IACvB;;;OAGG;IACH,YAAY,EACR,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,CAAC;IAEV;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,QAAQ,CAAC;CACzB;AAED,MAAM,WAAW,gBAAgB;IAC/B,kBAAkB,EAAE,qBAAqB,CAAC;CAC3C;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,EAA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AY,EAAE,CAAC;CACxB"}
@@ -1,59 +0,0 @@
1
- export declare type QueryParamsType = Record<string | number, any>;
2
- export declare type ResponseFormat = keyof Omit<Body, 'body' | 'bodyUsed'>;
3
- export interface FullRequestParams extends Omit<RequestInit, 'body'> {
4
- /** set parameter to `true` for call `securityWorker` for this request */
5
- secure?: boolean;
6
- /** request path */
7
- path: string;
8
- /** content type of request body */
9
- type?: ContentType;
10
- /** query params */
11
- query?: QueryParamsType;
12
- /** format of response (i.e. response.json() -> format: "json") */
13
- format?: ResponseFormat;
14
- /** request body */
15
- body?: unknown;
16
- /** base url */
17
- baseUrl?: string;
18
- /** request cancellation token */
19
- cancelToken?: CancelToken;
20
- }
21
- export declare type RequestParams = Omit<FullRequestParams, 'body' | 'method' | 'query' | 'path'>;
22
- export interface ApiConfig<SecurityDataType = unknown> {
23
- baseUrl?: string;
24
- baseApiParams?: Omit<RequestParams, 'baseUrl' | 'cancelToken' | 'signal'>;
25
- securityWorker?: (securityData: SecurityDataType | null) => Promise<RequestParams | void> | RequestParams | void;
26
- customFetch?: typeof fetch;
27
- }
28
- export interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
29
- data: D;
30
- error: E;
31
- }
32
- declare type CancelToken = Symbol | string | number;
33
- export declare enum ContentType {
34
- Json = "application/json",
35
- FormData = "multipart/form-data",
36
- UrlEncoded = "application/x-www-form-urlencoded"
37
- }
38
- export declare class HttpClient<SecurityDataType = unknown> {
39
- baseUrl: string;
40
- private securityData;
41
- private securityWorker?;
42
- private abortControllers;
43
- private customFetch;
44
- private baseApiParams;
45
- constructor(apiConfig?: ApiConfig<SecurityDataType>);
46
- setSecurityData: (data: SecurityDataType | null) => void;
47
- private encodeQueryParam;
48
- private addQueryParam;
49
- private addArrayQueryParam;
50
- protected toQueryString(rawQuery?: QueryParamsType): string;
51
- protected addQueryParams(rawQuery?: QueryParamsType): string;
52
- private contentFormatters;
53
- private mergeRequestParams;
54
- private createAbortSignal;
55
- abortRequest: (cancelToken: CancelToken) => void;
56
- request: <T = any, E = any>({ body, secure, path, type, query, format, baseUrl, cancelToken, ...params }: FullRequestParams) => Promise<HttpResponse<T, E>>;
57
- }
58
- export {};
59
- //# sourceMappingURL=http-client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"http-client.d.ts","sourceRoot":"","sources":["../../src/http-client.ts"],"names":[],"mappings":"AAWA,oBAAY,eAAe,GAAG,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,CAAC;AAC3D,oBAAY,cAAc,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC,CAAC;AAEnE,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC;IAClE,yEAAyE;IACzE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,mBAAmB;IACnB,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,kEAAkE;IAClE,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,mBAAmB;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,eAAe;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iCAAiC;IACjC,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,oBAAY,aAAa,GAAG,IAAI,CAC9B,iBAAiB,EACjB,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CACrC,CAAC;AAEF,MAAM,WAAW,SAAS,CAAC,gBAAgB,GAAG,OAAO;IACnD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,IAAI,CAAC,aAAa,EAAE,SAAS,GAAG,aAAa,GAAG,QAAQ,CAAC,CAAC;IAC1E,cAAc,CAAC,EAAE,CACf,YAAY,EAAE,gBAAgB,GAAG,IAAI,KAClC,OAAO,CAAC,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------------------------------
5
- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
6
- * ## ##
7
- * ## AUTHOR: acacode ##
8
- * ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
9
- * ---------------------------------------------------------------
10
- */
11
-
12
- import {
13
- ChainInfoDto,
14
- ChainsDto,
15
- Erc20BalancesDto,
16
- Erc721BalancesDto,
17
- ListTransactionDetailsDto,
18
- NativeBalanceDto,
19
- TransactionDetailsDto,
20
- } from './data-contracts';
21
- import { HttpClient, RequestParams } from './http-client';
22
-
23
- export class V1<
24
- SecurityDataType = unknown
25
- > extends HttpClient<SecurityDataType> {
26
- /**
27
- * No description
28
- *
29
- * @name HealthCheck
30
- * @summary Get the health of the service.
31
- * @request GET:/v1/health-check
32
- * @response `200` `{ status?: string, info?: Record<string, { status?: string }>, error?: Record<string, { status?: string }>, details?: Record<string, { status?: string }> }` The Health Check is successful
33
- * @response `503` `{ status?: string, info?: Record<string, { status?: string }>, error?: Record<string, { status?: string }>, details?: Record<string, { status?: string }> }` The Health Check is not successful
34
- */
35
- healthCheck = (params: RequestParams = {}) =>
36
- this.request<
37
- {
38
- status?: string;
39
- info?: Record<string, { status?: string }>;
40
- error?: Record<string, { status?: string }>;
41
- details?: Record<string, { status?: string }>;
42
- },
43
- {
44
- status?: string;
45
- info?: Record<string, { status?: string }>;
46
- error?: Record<string, { status?: string }>;
47
- details?: Record<string, { status?: string }>;
48
- }
49
- >({
50
- path: `/v1/health-check`,
51
- method: 'GET',
52
- format: 'json',
53
- ...params,
54
- });
55
- /**
56
- * No description
57
- *
58
- * @name GetNativeBalance
59
- * @summary Get native token balance of a wallet address for a given chain.
60
- * @request GET:/v1/chains/{chainId}/addresses/{address}/balances:getNative
61
- * @response `200` `NativeBalanceDto`
62
- */
63
- getNativeBalance = (
64
- chainId: string,
65
- address: string,
66
- query?: {
67
- currency?:
68
- | 'usd'
69
- | 'eur'
70
- | 'aud'
71
- | 'cad'
72
- | 'chf'
73
- | 'clp'
74
- | 'czk'
75
- | 'dkk'
76
- | 'gbp'
77
- | 'hkd'
78
- | 'huf';
79
- },
80
- params: RequestParams = {}
81
- ) =>
82
- this.request<NativeBalanceDto, any>({
83
- path: `/v1/chains/${chainId}/addresses/${address}/balances:getNative`,
84
- method: 'GET',
85
- query: query,
86
- format: 'json',
87
- ...params,
88
- });
89
- /**
90
- * No description
91
- *
92
- * @name ListErc20Balances
93
- * @summary Get erc-20 token balances of a wallet address for a given chain.
94
- * @request GET:/v1/chains/{chainId}/addresses/{address}/balances:listErc20
95
- * @response `200` `Erc20BalancesDto`
96
- */
97
- listErc20Balances = (
98
- chainId: string,
99
- address: string,
100
- query?: {
101
- pageSize?: number;
102
- pageToken?: string;
103
- currency?:
104
- | 'usd'
105
- | 'eur'
106
- | 'aud'
107
- | 'cad'
108
- | 'chf'
109
- | 'clp'
110
- | 'czk'
111
- | 'dkk'
112
- | 'gbp'
113
- | 'hkd'
114
- | 'huf';
115
- },
116
- params: RequestParams = {}
117
- ) =>
118
- this.request<Erc20BalancesDto, any>({
119
- path: `/v1/chains/${chainId}/addresses/${address}/balances:listErc20`,
120
- method: 'GET',
121
- query: query,
122
- format: 'json',
123
- ...params,
124
- });
125
- /**
126
- * No description
127
- *
128
- * @name ListErc721Balances
129
- * @summary Get erc-721 token balances of a wallet address for a given chain.
130
- * @request GET:/v1/chains/{chainId}/addresses/{address}/balances:listErc721
131
- * @response `200` `Erc721BalancesDto`
132
- */
133
- listErc721Balances = (
134
- chainId: string,
135
- address: string,
136
- query?: {
137
- pageSize?: number;
138
- pageToken?: string;
139
- currency?:
140
- | 'usd'
141
- | 'eur'
142
- | 'aud'
143
- | 'cad'
144
- | 'chf'
145
- | 'clp'
146
- | 'czk'
147
- | 'dkk'
148
- | 'gbp'
149
- | 'hkd'
150
- | 'huf';
151
- },
152
- params: RequestParams = {}
153
- ) =>
154
- this.request<Erc721BalancesDto, any>({
155
- path: `/v1/chains/${chainId}/addresses/${address}/balances:listErc721`,
156
- method: 'GET',
157
- query: query,
158
- format: 'json',
159
- ...params,
160
- });
161
- /**
162
- * @description Gets a list of transactions where the given wallet address had an on-chain interaction for a given chain. The erc20 transfers, erc721 transfers, and internal transactions returned as part of the native transactions are only those where the address had an interaction. Therefore the transactions returned from this list may not be complete representations of the on-chain data. For a complete view of a transaction use the `/chains/:chainId/transactions/:txHash` endpoint.
163
- *
164
- * @name ListTransactions
165
- * @summary Gets a list of transactions for a wallet address and chain.
166
- * @request GET:/v1/chains/{chainId}/addresses/{address}/transactions
167
- * @response `200` `ListTransactionDetailsDto`
168
- */
169
- listTransactions = (
170
- chainId: string,
171
- address: string,
172
- query?: { pageSize?: number; pageToken?: string },
173
- params: RequestParams = {}
174
- ) =>
175
- this.request<ListTransactionDetailsDto, any>({
176
- path: `/v1/chains/${chainId}/addresses/${address}/transactions`,
177
- method: 'GET',
178
- query: query,
179
- format: 'json',
180
- ...params,
181
- });
182
- /**
183
- * No description
184
- *
185
- * @name GetTransaction
186
- * @summary Gets the details of a single transaction.
187
- * @request GET:/v1/chains/{chainId}/transactions/{txHash}
188
- * @response `200` `TransactionDetailsDto`
189
- */
190
- getTransaction = (
191
- chainId: string,
192
- txHash: string,
193
- params: RequestParams = {}
194
- ) =>
195
- this.request<TransactionDetailsDto, any>({
196
- path: `/v1/chains/${chainId}/transactions/${txHash}`,
197
- method: 'GET',
198
- format: 'json',
199
- ...params,
200
- });
201
- /**
202
- * No description
203
- *
204
- * @name SupportedChains
205
- * @summary Gets the list of chains supported by the api.
206
- * @request GET:/v1/chains
207
- * @response `200` `ChainsDto`
208
- */
209
- supportedChains = (params: RequestParams = {}) =>
210
- this.request<ChainsDto, any>({
211
- path: `/v1/chains`,
212
- method: 'GET',
213
- format: 'json',
214
- ...params,
215
- });
216
- /**
217
- * No description
218
- *
219
- * @name GetChainInfo
220
- * @summary Gets chain information by chain id.
221
- * @request GET:/v1/chains/{chainId}
222
- * @response `200` `ChainInfoDto`
223
- */
224
- getChainInfo = (chainId: string, params: RequestParams = {}) =>
225
- this.request<ChainInfoDto, any>({
226
- path: `/v1/chains/${chainId}`,
227
- method: 'GET',
228
- format: 'json',
229
- ...params,
230
- });
231
- }
@@ -1,250 +0,0 @@
1
- /* eslint-disable */
2
- /* tslint:disable */
3
- /*
4
- * ---------------------------------------------------------------
5
- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
6
- * ## ##
7
- * ## AUTHOR: acacode ##
8
- * ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
9
- * ---------------------------------------------------------------
10
- */
11
-
12
- export type QueryParamsType = Record<string | number, any>;
13
- export type ResponseFormat = keyof Omit<Body, 'body' | 'bodyUsed'>;
14
-
15
- export interface FullRequestParams extends Omit<RequestInit, 'body'> {
16
- /** set parameter to `true` for call `securityWorker` for this request */
17
- secure?: boolean;
18
- /** request path */
19
- path: string;
20
- /** content type of request body */
21
- type?: ContentType;
22
- /** query params */
23
- query?: QueryParamsType;
24
- /** format of response (i.e. response.json() -> format: "json") */
25
- format?: ResponseFormat;
26
- /** request body */
27
- body?: unknown;
28
- /** base url */
29
- baseUrl?: string;
30
- /** request cancellation token */
31
- cancelToken?: CancelToken;
32
- }
33
-
34
- export type RequestParams = Omit<
35
- FullRequestParams,
36
- 'body' | 'method' | 'query' | 'path'
37
- >;
38
-
39
- export interface ApiConfig<SecurityDataType = unknown> {
40
- baseUrl?: string;
41
- baseApiParams?: Omit<RequestParams, 'baseUrl' | 'cancelToken' | 'signal'>;
42
- securityWorker?: (
43
- securityData: SecurityDataType | null
44
- ) => Promise<RequestParams | void> | RequestParams | void;
45
- customFetch?: typeof fetch;
46
- }
47
-
48
- export interface HttpResponse<D extends unknown, E extends unknown = unknown>
49
- extends Response {
50
- data: D;
51
- error: E;
52
- }
53
-
54
- type CancelToken = Symbol | string | number;
55
-
56
- export enum ContentType {
57
- Json = 'application/json',
58
- FormData = 'multipart/form-data',
59
- UrlEncoded = 'application/x-www-form-urlencoded',
60
- }
61
-
62
- export class HttpClient<SecurityDataType = unknown> {
63
- public baseUrl: string = '';
64
- private securityData: SecurityDataType | null = null;
65
- private securityWorker?: ApiConfig<SecurityDataType>['securityWorker'];
66
- private abortControllers = new Map<CancelToken, AbortController>();
67
- private customFetch = (...fetchParams: Parameters<typeof fetch>) =>
68
- fetch(...fetchParams);
69
-
70
- private baseApiParams: RequestParams = {
71
- credentials: 'same-origin',
72
- headers: {},
73
- redirect: 'follow',
74
- referrerPolicy: 'no-referrer',
75
- };
76
-
77
- constructor(apiConfig: ApiConfig<SecurityDataType> = {}) {
78
- Object.assign(this, apiConfig);
79
- }
80
-
81
- public setSecurityData = (data: SecurityDataType | null) => {
82
- this.securityData = data;
83
- };
84
-
85
- private encodeQueryParam(key: string, value: any) {
86
- const encodedKey = encodeURIComponent(key);
87
- return `${encodedKey}=${encodeURIComponent(
88
- typeof value === 'number' ? value : `${value}`
89
- )}`;
90
- }
91
-
92
- private addQueryParam(query: QueryParamsType, key: string) {
93
- return this.encodeQueryParam(key, query[key]);
94
- }
95
-
96
- private addArrayQueryParam(query: QueryParamsType, key: string) {
97
- const value = query[key];
98
- return value.map((v: any) => this.encodeQueryParam(key, v)).join('&');
99
- }
100
-
101
- protected toQueryString(rawQuery?: QueryParamsType): string {
102
- const query = rawQuery || {};
103
- const keys = Object.keys(query).filter(
104
- (key) => 'undefined' !== typeof query[key]
105
- );
106
- return keys
107
- .map((key) =>
108
- Array.isArray(query[key])
109
- ? this.addArrayQueryParam(query, key)
110
- : this.addQueryParam(query, key)
111
- )
112
- .join('&');
113
- }
114
-
115
- protected addQueryParams(rawQuery?: QueryParamsType): string {
116
- const queryString = this.toQueryString(rawQuery);
117
- return queryString ? `?${queryString}` : '';
118
- }
119
-
120
- private contentFormatters: Record<ContentType, (input: any) => any> = {
121
- [ContentType.Json]: (input: any) =>
122
- input !== null && (typeof input === 'object' || typeof input === 'string')
123
- ? JSON.stringify(input)
124
- : input,
125
- [ContentType.FormData]: (input: any) =>
126
- Object.keys(input || {}).reduce((formData, key) => {
127
- const property = input[key];
128
- formData.append(
129
- key,
130
- property instanceof Blob
131
- ? property
132
- : typeof property === 'object' && property !== null
133
- ? JSON.stringify(property)
134
- : `${property}`
135
- );
136
- return formData;
137
- }, new FormData()),
138
- [ContentType.UrlEncoded]: (input: any) => this.toQueryString(input),
139
- };
140
-
141
- private mergeRequestParams(
142
- params1: RequestParams,
143
- params2?: RequestParams
144
- ): RequestParams {
145
- return {
146
- ...this.baseApiParams,
147
- ...params1,
148
- ...(params2 || {}),
149
- headers: {
150
- ...(this.baseApiParams.headers || {}),
151
- ...(params1.headers || {}),
152
- ...((params2 && params2.headers) || {}),
153
- },
154
- };
155
- }
156
-
157
- private createAbortSignal = (
158
- cancelToken: CancelToken
159
- ): AbortSignal | undefined => {
160
- if (this.abortControllers.has(cancelToken)) {
161
- const abortController = this.abortControllers.get(cancelToken);
162
- if (abortController) {
163
- return abortController.signal;
164
- }
165
- return void 0;
166
- }
167
-
168
- const abortController = new AbortController();
169
- this.abortControllers.set(cancelToken, abortController);
170
- return abortController.signal;
171
- };
172
-
173
- public abortRequest = (cancelToken: CancelToken) => {
174
- const abortController = this.abortControllers.get(cancelToken);
175
-
176
- if (abortController) {
177
- abortController.abort();
178
- this.abortControllers.delete(cancelToken);
179
- }
180
- };
181
-
182
- public request = async <T = any, E = any>({
183
- body,
184
- secure,
185
- path,
186
- type,
187
- query,
188
- format,
189
- baseUrl,
190
- cancelToken,
191
- ...params
192
- }: FullRequestParams): Promise<HttpResponse<T, E>> => {
193
- const secureParams =
194
- ((typeof secure === 'boolean' ? secure : this.baseApiParams.secure) &&
195
- this.securityWorker &&
196
- (await this.securityWorker(this.securityData))) ||
197
- {};
198
- const requestParams = this.mergeRequestParams(params, secureParams);
199
- const queryString = query && this.toQueryString(query);
200
- const payloadFormatter = this.contentFormatters[type || ContentType.Json];
201
- const responseFormat = format || requestParams.format;
202
-
203
- return this.customFetch(
204
- `${baseUrl || this.baseUrl || ''}${path}${
205
- queryString ? `?${queryString}` : ''
206
- }`,
207
- {
208
- ...requestParams,
209
- headers: {
210
- ...(type && type !== ContentType.FormData
211
- ? { 'Content-Type': type }
212
- : {}),
213
- ...(requestParams.headers || {}),
214
- },
215
- signal: cancelToken ? this.createAbortSignal(cancelToken) : void 0,
216
- body:
217
- typeof body === 'undefined' || body === null
218
- ? null
219
- : payloadFormatter(body),
220
- }
221
- ).then(async (response) => {
222
- const r = response as HttpResponse<T, E>;
223
- r.data = null as unknown as T;
224
- r.error = null as unknown as E;
225
-
226
- const data = !responseFormat
227
- ? r
228
- : await response[responseFormat]()
229
- .then((data) => {
230
- if (r.ok) {
231
- r.data = data;
232
- } else {
233
- r.error = data;
234
- }
235
- return r;
236
- })
237
- .catch((e) => {
238
- r.error = e;
239
- return r;
240
- });
241
-
242
- if (cancelToken) {
243
- this.abortControllers.delete(cancelToken);
244
- }
245
-
246
- if (!response.ok) throw data;
247
- return data;
248
- });
249
- };
250
- }