@layer-drone/protocol 0.0.9-alpha → 0.0.9-alpha.2
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/index.d.mts +41 -165
- package/dist/index.d.ts +41 -165
- package/dist/index.js +35 -574
- package/dist/index.mjs +34 -573
- package/package.json +3 -3
- package/src/client/client.gen.ts +3 -2
- package/src/client/index.ts +2 -2
- package/src/client/sdk.gen.ts +98 -129
- package/src/client/transformers.gen.ts +1 -1
- package/src/client/client/client.ts +0 -181
- package/src/client/client/index.ts +0 -22
- package/src/client/client/types.ts +0 -215
- package/src/client/client/utils.ts +0 -415
- package/src/client/core/auth.ts +0 -40
- package/src/client/core/bodySerializer.ts +0 -84
- package/src/client/core/params.ts +0 -141
- package/src/client/core/pathSerializer.ts +0 -179
- package/src/client/core/types.ts +0 -98
package/src/client/client.gen.ts
CHANGED
|
@@ -4,8 +4,9 @@ import {
|
|
|
4
4
|
type ClientOptions as DefaultClientOptions,
|
|
5
5
|
createClient,
|
|
6
6
|
createConfig,
|
|
7
|
-
} from "
|
|
8
|
-
|
|
7
|
+
} from "@hey-api/client-fetch";
|
|
8
|
+
|
|
9
|
+
import type { ClientOptions } from "./types.gen";
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* The `createClientConfig()` function will be called on client initialization
|
package/src/client/index.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
-
export * from "./types.gen
|
|
3
|
-
export * from "./sdk.gen
|
|
2
|
+
export * from "./types.gen";
|
|
3
|
+
export * from "./sdk.gen";
|
package/src/client/sdk.gen.ts
CHANGED
|
@@ -1,77 +1,57 @@
|
|
|
1
1
|
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
-
import { client as _heyApiClient } from "./client.gen.js";
|
|
3
2
|
import type {
|
|
4
3
|
Client,
|
|
5
4
|
Options as ClientOptions,
|
|
6
5
|
TDataShape,
|
|
7
|
-
} from "
|
|
6
|
+
} from "@hey-api/client-fetch";
|
|
7
|
+
|
|
8
|
+
import { client as _heyApiClient } from "./client.gen";
|
|
9
|
+
import {
|
|
10
|
+
apiTokenControllerUpdateTokenResponseTransformer,
|
|
11
|
+
conditionsControllerGetSunAltitudeTimeLimitsResponseTransformer,
|
|
12
|
+
} from "./transformers.gen";
|
|
8
13
|
import type {
|
|
9
14
|
ApiTokenControllerCreateTokenData,
|
|
10
|
-
|
|
11
|
-
ApiTokenControllerCreateTokenResponses,
|
|
15
|
+
ApiTokenControllerCreateTokenResponse,
|
|
12
16
|
ApiTokenControllerDeleteTokenData,
|
|
13
|
-
ApiTokenControllerDeleteTokenErrors,
|
|
14
|
-
ApiTokenControllerDeleteTokenResponses,
|
|
15
17
|
ApiTokenControllerGetTokenData,
|
|
16
|
-
ApiTokenControllerGetTokenErrors,
|
|
17
|
-
ApiTokenControllerGetTokenResponses,
|
|
18
18
|
ApiTokenControllerUpdateTokenData,
|
|
19
|
-
|
|
20
|
-
ApiTokenControllerUpdateTokenResponses,
|
|
19
|
+
ApiTokenControllerUpdateTokenResponse,
|
|
21
20
|
AppControllerGetHelloData,
|
|
22
|
-
AppControllerGetHelloResponses,
|
|
23
21
|
ConditionsControllerGetSunAltitudeTimeLimitsData,
|
|
24
|
-
|
|
22
|
+
ConditionsControllerGetSunAltitudeTimeLimitsResponse,
|
|
25
23
|
FlightsControllerCreatePresignedUrlsData,
|
|
26
|
-
|
|
27
|
-
FlightsControllerCreatePresignedUrlsResponses,
|
|
24
|
+
FlightsControllerCreatePresignedUrlsResponse,
|
|
28
25
|
FlightsControllerGenerateFlightIdData,
|
|
29
|
-
|
|
30
|
-
FlightsControllerGenerateFlightIdResponses,
|
|
26
|
+
FlightsControllerGenerateFlightIdResponse,
|
|
31
27
|
FlightsControllerValidateFlightData,
|
|
32
|
-
|
|
33
|
-
FlightsControllerValidateFlightResponses,
|
|
28
|
+
FlightsControllerValidateFlightResponse,
|
|
34
29
|
KeysControllerGetProvenanceCryptoKeyData,
|
|
35
|
-
|
|
30
|
+
KeysControllerGetProvenanceCryptoKeyResponse,
|
|
36
31
|
QuotesControllerCreateQuoteData,
|
|
37
|
-
QuotesControllerCreateQuoteErrors,
|
|
38
|
-
QuotesControllerCreateQuoteResponses,
|
|
39
32
|
QuotesControllerGetQuoteData,
|
|
40
|
-
QuotesControllerGetQuoteErrors,
|
|
41
|
-
QuotesControllerGetQuoteResponses,
|
|
42
33
|
RewardsControllerDepositRewardsData,
|
|
43
|
-
|
|
44
|
-
RewardsControllerDepositRewardsResponses,
|
|
34
|
+
RewardsControllerDepositRewardsResponse,
|
|
45
35
|
RewardsControllerDistributeRewardsData,
|
|
46
|
-
|
|
47
|
-
RewardsControllerDistributeRewardsResponses,
|
|
36
|
+
RewardsControllerDistributeRewardsResponse,
|
|
48
37
|
SchemaControllerGetEventSchemaData,
|
|
49
|
-
SchemaControllerGetEventSchemaResponses,
|
|
50
38
|
WebhooksControllerCreateData,
|
|
51
|
-
|
|
52
|
-
WebhooksControllerCreateResponses,
|
|
39
|
+
WebhooksControllerCreateResponse,
|
|
53
40
|
WebhooksControllerDeleteData,
|
|
54
|
-
|
|
55
|
-
WebhooksControllerDeleteResponses,
|
|
41
|
+
WebhooksControllerDeleteResponse,
|
|
56
42
|
WebhooksControllerGetData,
|
|
57
|
-
WebhooksControllerGetErrors,
|
|
58
43
|
WebhooksControllerGetManyData,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
WebhooksControllerGetResponses,
|
|
44
|
+
WebhooksControllerGetManyResponse,
|
|
45
|
+
WebhooksControllerGetResponse,
|
|
62
46
|
WebhooksControllerGetStatusData,
|
|
63
|
-
|
|
64
|
-
WebhooksControllerGetStatusResponses,
|
|
47
|
+
WebhooksControllerGetStatusResponse,
|
|
65
48
|
WebhooksControllerRegenerateSecretData,
|
|
66
|
-
|
|
67
|
-
WebhooksControllerRegenerateSecretResponses,
|
|
49
|
+
WebhooksControllerRegenerateSecretResponse,
|
|
68
50
|
WebhooksControllerTestData,
|
|
69
|
-
|
|
70
|
-
WebhooksControllerTestResponses,
|
|
51
|
+
WebhooksControllerTestResponse,
|
|
71
52
|
WebhooksControllerUpdateData,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
} from "./types.gen.js";
|
|
53
|
+
WebhooksControllerUpdateResponse,
|
|
54
|
+
} from "./types.gen";
|
|
75
55
|
|
|
76
56
|
export type Options<
|
|
77
57
|
TData extends TDataShape = TDataShape,
|
|
@@ -93,14 +73,12 @@ export type Options<
|
|
|
93
73
|
export const appControllerGetHello = <ThrowOnError extends boolean = false>(
|
|
94
74
|
options?: Options<AppControllerGetHelloData, ThrowOnError>,
|
|
95
75
|
) => {
|
|
96
|
-
return (options?.client ?? _heyApiClient).get<
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
...options,
|
|
103
|
-
});
|
|
76
|
+
return (options?.client ?? _heyApiClient).get<unknown, unknown, ThrowOnError>(
|
|
77
|
+
{
|
|
78
|
+
url: "/",
|
|
79
|
+
...options,
|
|
80
|
+
},
|
|
81
|
+
);
|
|
104
82
|
};
|
|
105
83
|
|
|
106
84
|
export const keysControllerGetProvenanceCryptoKey = <
|
|
@@ -109,7 +87,7 @@ export const keysControllerGetProvenanceCryptoKey = <
|
|
|
109
87
|
options?: Options<KeysControllerGetProvenanceCryptoKeyData, ThrowOnError>,
|
|
110
88
|
) => {
|
|
111
89
|
return (options?.client ?? _heyApiClient).get<
|
|
112
|
-
|
|
90
|
+
KeysControllerGetProvenanceCryptoKeyResponse,
|
|
113
91
|
unknown,
|
|
114
92
|
ThrowOnError
|
|
115
93
|
>({
|
|
@@ -124,8 +102,8 @@ export const rewardsControllerDepositRewards = <
|
|
|
124
102
|
options: Options<RewardsControllerDepositRewardsData, ThrowOnError>,
|
|
125
103
|
) => {
|
|
126
104
|
return (options.client ?? _heyApiClient).post<
|
|
127
|
-
|
|
128
|
-
|
|
105
|
+
RewardsControllerDepositRewardsResponse,
|
|
106
|
+
unknown,
|
|
129
107
|
ThrowOnError
|
|
130
108
|
>({
|
|
131
109
|
security: [
|
|
@@ -138,7 +116,7 @@ export const rewardsControllerDepositRewards = <
|
|
|
138
116
|
...options,
|
|
139
117
|
headers: {
|
|
140
118
|
"Content-Type": "application/json",
|
|
141
|
-
...options
|
|
119
|
+
...options?.headers,
|
|
142
120
|
},
|
|
143
121
|
});
|
|
144
122
|
};
|
|
@@ -149,8 +127,8 @@ export const rewardsControllerDistributeRewards = <
|
|
|
149
127
|
options: Options<RewardsControllerDistributeRewardsData, ThrowOnError>,
|
|
150
128
|
) => {
|
|
151
129
|
return (options.client ?? _heyApiClient).post<
|
|
152
|
-
|
|
153
|
-
|
|
130
|
+
RewardsControllerDistributeRewardsResponse,
|
|
131
|
+
unknown,
|
|
154
132
|
ThrowOnError
|
|
155
133
|
>({
|
|
156
134
|
security: [
|
|
@@ -163,7 +141,7 @@ export const rewardsControllerDistributeRewards = <
|
|
|
163
141
|
...options,
|
|
164
142
|
headers: {
|
|
165
143
|
"Content-Type": "application/json",
|
|
166
|
-
...options
|
|
144
|
+
...options?.headers,
|
|
167
145
|
},
|
|
168
146
|
});
|
|
169
147
|
};
|
|
@@ -174,8 +152,8 @@ export const apiTokenControllerCreateToken = <
|
|
|
174
152
|
options: Options<ApiTokenControllerCreateTokenData, ThrowOnError>,
|
|
175
153
|
) => {
|
|
176
154
|
return (options.client ?? _heyApiClient).post<
|
|
177
|
-
|
|
178
|
-
|
|
155
|
+
ApiTokenControllerCreateTokenResponse,
|
|
156
|
+
unknown,
|
|
179
157
|
ThrowOnError
|
|
180
158
|
>({
|
|
181
159
|
security: [
|
|
@@ -188,7 +166,7 @@ export const apiTokenControllerCreateToken = <
|
|
|
188
166
|
...options,
|
|
189
167
|
headers: {
|
|
190
168
|
"Content-Type": "application/json",
|
|
191
|
-
...options
|
|
169
|
+
...options?.headers,
|
|
192
170
|
},
|
|
193
171
|
});
|
|
194
172
|
};
|
|
@@ -199,8 +177,8 @@ export const apiTokenControllerDeleteToken = <
|
|
|
199
177
|
options: Options<ApiTokenControllerDeleteTokenData, ThrowOnError>,
|
|
200
178
|
) => {
|
|
201
179
|
return (options.client ?? _heyApiClient).delete<
|
|
202
|
-
|
|
203
|
-
|
|
180
|
+
unknown,
|
|
181
|
+
unknown,
|
|
204
182
|
ThrowOnError
|
|
205
183
|
>({
|
|
206
184
|
security: [
|
|
@@ -219,11 +197,7 @@ export const apiTokenControllerGetToken = <
|
|
|
219
197
|
>(
|
|
220
198
|
options: Options<ApiTokenControllerGetTokenData, ThrowOnError>,
|
|
221
199
|
) => {
|
|
222
|
-
return (options.client ?? _heyApiClient).get<
|
|
223
|
-
ApiTokenControllerGetTokenResponses,
|
|
224
|
-
ApiTokenControllerGetTokenErrors,
|
|
225
|
-
ThrowOnError
|
|
226
|
-
>({
|
|
200
|
+
return (options.client ?? _heyApiClient).get<unknown, unknown, ThrowOnError>({
|
|
227
201
|
security: [
|
|
228
202
|
{
|
|
229
203
|
name: "x-api-token",
|
|
@@ -241,8 +215,8 @@ export const apiTokenControllerUpdateToken = <
|
|
|
241
215
|
options: Options<ApiTokenControllerUpdateTokenData, ThrowOnError>,
|
|
242
216
|
) => {
|
|
243
217
|
return (options.client ?? _heyApiClient).patch<
|
|
244
|
-
|
|
245
|
-
|
|
218
|
+
ApiTokenControllerUpdateTokenResponse,
|
|
219
|
+
unknown,
|
|
246
220
|
ThrowOnError
|
|
247
221
|
>({
|
|
248
222
|
security: [
|
|
@@ -251,11 +225,12 @@ export const apiTokenControllerUpdateToken = <
|
|
|
251
225
|
type: "apiKey",
|
|
252
226
|
},
|
|
253
227
|
],
|
|
228
|
+
responseTransformer: apiTokenControllerUpdateTokenResponseTransformer,
|
|
254
229
|
url: "/tokens/{id}",
|
|
255
230
|
...options,
|
|
256
231
|
headers: {
|
|
257
232
|
"Content-Type": "application/json",
|
|
258
|
-
...options
|
|
233
|
+
...options?.headers,
|
|
259
234
|
},
|
|
260
235
|
});
|
|
261
236
|
};
|
|
@@ -265,34 +240,28 @@ export const quotesControllerCreateQuote = <
|
|
|
265
240
|
>(
|
|
266
241
|
options: Options<QuotesControllerCreateQuoteData, ThrowOnError>,
|
|
267
242
|
) => {
|
|
268
|
-
return (options.client ?? _heyApiClient).post<
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
243
|
+
return (options.client ?? _heyApiClient).post<unknown, unknown, ThrowOnError>(
|
|
244
|
+
{
|
|
245
|
+
security: [
|
|
246
|
+
{
|
|
247
|
+
name: "x-api-token",
|
|
248
|
+
type: "apiKey",
|
|
249
|
+
},
|
|
250
|
+
],
|
|
251
|
+
url: "/quotes",
|
|
252
|
+
...options,
|
|
253
|
+
headers: {
|
|
254
|
+
"Content-Type": "application/json",
|
|
255
|
+
...options?.headers,
|
|
277
256
|
},
|
|
278
|
-
],
|
|
279
|
-
url: "/quotes",
|
|
280
|
-
...options,
|
|
281
|
-
headers: {
|
|
282
|
-
"Content-Type": "application/json",
|
|
283
|
-
...options.headers,
|
|
284
257
|
},
|
|
285
|
-
|
|
258
|
+
);
|
|
286
259
|
};
|
|
287
260
|
|
|
288
261
|
export const quotesControllerGetQuote = <ThrowOnError extends boolean = false>(
|
|
289
262
|
options: Options<QuotesControllerGetQuoteData, ThrowOnError>,
|
|
290
263
|
) => {
|
|
291
|
-
return (options.client ?? _heyApiClient).get<
|
|
292
|
-
QuotesControllerGetQuoteResponses,
|
|
293
|
-
QuotesControllerGetQuoteErrors,
|
|
294
|
-
ThrowOnError
|
|
295
|
-
>({
|
|
264
|
+
return (options.client ?? _heyApiClient).get<unknown, unknown, ThrowOnError>({
|
|
296
265
|
security: [
|
|
297
266
|
{
|
|
298
267
|
name: "x-api-token",
|
|
@@ -310,8 +279,8 @@ export const flightsControllerGenerateFlightId = <
|
|
|
310
279
|
options: Options<FlightsControllerGenerateFlightIdData, ThrowOnError>,
|
|
311
280
|
) => {
|
|
312
281
|
return (options.client ?? _heyApiClient).get<
|
|
313
|
-
|
|
314
|
-
|
|
282
|
+
FlightsControllerGenerateFlightIdResponse,
|
|
283
|
+
unknown,
|
|
315
284
|
ThrowOnError
|
|
316
285
|
>({
|
|
317
286
|
security: [
|
|
@@ -331,8 +300,8 @@ export const flightsControllerCreatePresignedUrls = <
|
|
|
331
300
|
options: Options<FlightsControllerCreatePresignedUrlsData, ThrowOnError>,
|
|
332
301
|
) => {
|
|
333
302
|
return (options.client ?? _heyApiClient).post<
|
|
334
|
-
|
|
335
|
-
|
|
303
|
+
FlightsControllerCreatePresignedUrlsResponse,
|
|
304
|
+
unknown,
|
|
336
305
|
ThrowOnError
|
|
337
306
|
>({
|
|
338
307
|
security: [
|
|
@@ -345,7 +314,7 @@ export const flightsControllerCreatePresignedUrls = <
|
|
|
345
314
|
...options,
|
|
346
315
|
headers: {
|
|
347
316
|
"Content-Type": "application/json",
|
|
348
|
-
...options
|
|
317
|
+
...options?.headers,
|
|
349
318
|
},
|
|
350
319
|
});
|
|
351
320
|
};
|
|
@@ -356,8 +325,8 @@ export const flightsControllerValidateFlight = <
|
|
|
356
325
|
options: Options<FlightsControllerValidateFlightData, ThrowOnError>,
|
|
357
326
|
) => {
|
|
358
327
|
return (options.client ?? _heyApiClient).post<
|
|
359
|
-
|
|
360
|
-
|
|
328
|
+
FlightsControllerValidateFlightResponse,
|
|
329
|
+
unknown,
|
|
361
330
|
ThrowOnError
|
|
362
331
|
>({
|
|
363
332
|
security: [
|
|
@@ -370,7 +339,7 @@ export const flightsControllerValidateFlight = <
|
|
|
370
339
|
...options,
|
|
371
340
|
headers: {
|
|
372
341
|
"Content-Type": "application/json",
|
|
373
|
-
...options
|
|
342
|
+
...options?.headers,
|
|
374
343
|
},
|
|
375
344
|
});
|
|
376
345
|
};
|
|
@@ -384,10 +353,12 @@ export const conditionsControllerGetSunAltitudeTimeLimits = <
|
|
|
384
353
|
>,
|
|
385
354
|
) => {
|
|
386
355
|
return (options.client ?? _heyApiClient).get<
|
|
387
|
-
|
|
356
|
+
ConditionsControllerGetSunAltitudeTimeLimitsResponse,
|
|
388
357
|
unknown,
|
|
389
358
|
ThrowOnError
|
|
390
359
|
>({
|
|
360
|
+
responseTransformer:
|
|
361
|
+
conditionsControllerGetSunAltitudeTimeLimitsResponseTransformer,
|
|
391
362
|
url: "/conditions/sun-altitude",
|
|
392
363
|
...options,
|
|
393
364
|
});
|
|
@@ -398,22 +369,20 @@ export const schemaControllerGetEventSchema = <
|
|
|
398
369
|
>(
|
|
399
370
|
options?: Options<SchemaControllerGetEventSchemaData, ThrowOnError>,
|
|
400
371
|
) => {
|
|
401
|
-
return (options?.client ?? _heyApiClient).get<
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
...options,
|
|
408
|
-
});
|
|
372
|
+
return (options?.client ?? _heyApiClient).get<unknown, unknown, ThrowOnError>(
|
|
373
|
+
{
|
|
374
|
+
url: "/schema/event",
|
|
375
|
+
...options,
|
|
376
|
+
},
|
|
377
|
+
);
|
|
409
378
|
};
|
|
410
379
|
|
|
411
380
|
export const webhooksControllerGetMany = <ThrowOnError extends boolean = false>(
|
|
412
381
|
options: Options<WebhooksControllerGetManyData, ThrowOnError>,
|
|
413
382
|
) => {
|
|
414
383
|
return (options.client ?? _heyApiClient).get<
|
|
415
|
-
|
|
416
|
-
|
|
384
|
+
WebhooksControllerGetManyResponse,
|
|
385
|
+
unknown,
|
|
417
386
|
ThrowOnError
|
|
418
387
|
>({
|
|
419
388
|
security: [
|
|
@@ -431,8 +400,8 @@ export const webhooksControllerCreate = <ThrowOnError extends boolean = false>(
|
|
|
431
400
|
options: Options<WebhooksControllerCreateData, ThrowOnError>,
|
|
432
401
|
) => {
|
|
433
402
|
return (options.client ?? _heyApiClient).post<
|
|
434
|
-
|
|
435
|
-
|
|
403
|
+
WebhooksControllerCreateResponse,
|
|
404
|
+
unknown,
|
|
436
405
|
ThrowOnError
|
|
437
406
|
>({
|
|
438
407
|
security: [
|
|
@@ -445,7 +414,7 @@ export const webhooksControllerCreate = <ThrowOnError extends boolean = false>(
|
|
|
445
414
|
...options,
|
|
446
415
|
headers: {
|
|
447
416
|
"Content-Type": "application/json",
|
|
448
|
-
...options
|
|
417
|
+
...options?.headers,
|
|
449
418
|
},
|
|
450
419
|
});
|
|
451
420
|
};
|
|
@@ -454,8 +423,8 @@ export const webhooksControllerDelete = <ThrowOnError extends boolean = false>(
|
|
|
454
423
|
options: Options<WebhooksControllerDeleteData, ThrowOnError>,
|
|
455
424
|
) => {
|
|
456
425
|
return (options.client ?? _heyApiClient).delete<
|
|
457
|
-
|
|
458
|
-
|
|
426
|
+
WebhooksControllerDeleteResponse,
|
|
427
|
+
unknown,
|
|
459
428
|
ThrowOnError
|
|
460
429
|
>({
|
|
461
430
|
security: [
|
|
@@ -473,8 +442,8 @@ export const webhooksControllerGet = <ThrowOnError extends boolean = false>(
|
|
|
473
442
|
options: Options<WebhooksControllerGetData, ThrowOnError>,
|
|
474
443
|
) => {
|
|
475
444
|
return (options.client ?? _heyApiClient).get<
|
|
476
|
-
|
|
477
|
-
|
|
445
|
+
WebhooksControllerGetResponse,
|
|
446
|
+
unknown,
|
|
478
447
|
ThrowOnError
|
|
479
448
|
>({
|
|
480
449
|
security: [
|
|
@@ -492,8 +461,8 @@ export const webhooksControllerUpdate = <ThrowOnError extends boolean = false>(
|
|
|
492
461
|
options: Options<WebhooksControllerUpdateData, ThrowOnError>,
|
|
493
462
|
) => {
|
|
494
463
|
return (options.client ?? _heyApiClient).put<
|
|
495
|
-
|
|
496
|
-
|
|
464
|
+
WebhooksControllerUpdateResponse,
|
|
465
|
+
unknown,
|
|
497
466
|
ThrowOnError
|
|
498
467
|
>({
|
|
499
468
|
security: [
|
|
@@ -506,7 +475,7 @@ export const webhooksControllerUpdate = <ThrowOnError extends boolean = false>(
|
|
|
506
475
|
...options,
|
|
507
476
|
headers: {
|
|
508
477
|
"Content-Type": "application/json",
|
|
509
|
-
...options
|
|
478
|
+
...options?.headers,
|
|
510
479
|
},
|
|
511
480
|
});
|
|
512
481
|
};
|
|
@@ -517,8 +486,8 @@ export const webhooksControllerRegenerateSecret = <
|
|
|
517
486
|
options: Options<WebhooksControllerRegenerateSecretData, ThrowOnError>,
|
|
518
487
|
) => {
|
|
519
488
|
return (options.client ?? _heyApiClient).post<
|
|
520
|
-
|
|
521
|
-
|
|
489
|
+
WebhooksControllerRegenerateSecretResponse,
|
|
490
|
+
unknown,
|
|
522
491
|
ThrowOnError
|
|
523
492
|
>({
|
|
524
493
|
security: [
|
|
@@ -536,8 +505,8 @@ export const webhooksControllerTest = <ThrowOnError extends boolean = false>(
|
|
|
536
505
|
options: Options<WebhooksControllerTestData, ThrowOnError>,
|
|
537
506
|
) => {
|
|
538
507
|
return (options.client ?? _heyApiClient).post<
|
|
539
|
-
|
|
540
|
-
|
|
508
|
+
WebhooksControllerTestResponse,
|
|
509
|
+
unknown,
|
|
541
510
|
ThrowOnError
|
|
542
511
|
>({
|
|
543
512
|
security: [
|
|
@@ -557,8 +526,8 @@ export const webhooksControllerGetStatus = <
|
|
|
557
526
|
options: Options<WebhooksControllerGetStatusData, ThrowOnError>,
|
|
558
527
|
) => {
|
|
559
528
|
return (options.client ?? _heyApiClient).get<
|
|
560
|
-
|
|
561
|
-
|
|
529
|
+
WebhooksControllerGetStatusResponse,
|
|
530
|
+
unknown,
|
|
562
531
|
ThrowOnError
|
|
563
532
|
>({
|
|
564
533
|
security: [
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import type {
|
|
3
3
|
ApiTokenControllerUpdateTokenResponse,
|
|
4
4
|
ConditionsControllerGetSunAltitudeTimeLimitsResponse,
|
|
5
|
-
} from "./types.gen
|
|
5
|
+
} from "./types.gen";
|
|
6
6
|
|
|
7
7
|
const updateApiTokenResponseDtoSchemaResponseTransformer = (data: any) => {
|
|
8
8
|
data.deleted_at = new Date(data.deleted_at);
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import type { Client, Config, RequestOptions } from "./types.js";
|
|
2
|
-
import {
|
|
3
|
-
buildUrl,
|
|
4
|
-
createConfig,
|
|
5
|
-
createInterceptors,
|
|
6
|
-
getParseAs,
|
|
7
|
-
mergeConfigs,
|
|
8
|
-
mergeHeaders,
|
|
9
|
-
setAuthParams,
|
|
10
|
-
} from "./utils.js";
|
|
11
|
-
|
|
12
|
-
type ReqInit = Omit<RequestInit, "body" | "headers"> & {
|
|
13
|
-
body?: any;
|
|
14
|
-
headers: ReturnType<typeof mergeHeaders>;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const createClient = (config: Config = {}): Client => {
|
|
18
|
-
let _config = mergeConfigs(createConfig(), config);
|
|
19
|
-
|
|
20
|
-
const getConfig = (): Config => ({ ..._config });
|
|
21
|
-
|
|
22
|
-
const setConfig = (config: Config): Config => {
|
|
23
|
-
_config = mergeConfigs(_config, config);
|
|
24
|
-
return getConfig();
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const interceptors = createInterceptors<
|
|
28
|
-
Request,
|
|
29
|
-
Response,
|
|
30
|
-
unknown,
|
|
31
|
-
RequestOptions
|
|
32
|
-
>();
|
|
33
|
-
|
|
34
|
-
const request: Client["request"] = async (options) => {
|
|
35
|
-
const opts = {
|
|
36
|
-
..._config,
|
|
37
|
-
...options,
|
|
38
|
-
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
|
39
|
-
headers: mergeHeaders(_config.headers, options.headers),
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
if (opts.security) {
|
|
43
|
-
await setAuthParams({
|
|
44
|
-
...opts,
|
|
45
|
-
security: opts.security,
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (opts.body && opts.bodySerializer) {
|
|
50
|
-
opts.body = opts.bodySerializer(opts.body);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// remove Content-Type header if body is empty to avoid sending invalid requests
|
|
54
|
-
if (opts.body === undefined || opts.body === "") {
|
|
55
|
-
opts.headers.delete("Content-Type");
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const url = buildUrl(opts);
|
|
59
|
-
const requestInit: ReqInit = {
|
|
60
|
-
redirect: "follow",
|
|
61
|
-
...opts,
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
let request = new Request(url, requestInit);
|
|
65
|
-
|
|
66
|
-
for (const fn of interceptors.request._fns) {
|
|
67
|
-
if (fn) {
|
|
68
|
-
request = await fn(request, opts);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// fetch must be assigned here, otherwise it would throw the error:
|
|
73
|
-
// TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation
|
|
74
|
-
const _fetch = opts.fetch!;
|
|
75
|
-
let response = await _fetch(request);
|
|
76
|
-
|
|
77
|
-
for (const fn of interceptors.response._fns) {
|
|
78
|
-
if (fn) {
|
|
79
|
-
response = await fn(response, request, opts);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const result = {
|
|
84
|
-
request,
|
|
85
|
-
response,
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
if (response.ok) {
|
|
89
|
-
if (
|
|
90
|
-
response.status === 204 ||
|
|
91
|
-
response.headers.get("Content-Length") === "0"
|
|
92
|
-
) {
|
|
93
|
-
return opts.responseStyle === "data"
|
|
94
|
-
? {}
|
|
95
|
-
: {
|
|
96
|
-
data: {},
|
|
97
|
-
...result,
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const parseAs =
|
|
102
|
-
(opts.parseAs === "auto"
|
|
103
|
-
? getParseAs(response.headers.get("Content-Type"))
|
|
104
|
-
: opts.parseAs) ?? "json";
|
|
105
|
-
|
|
106
|
-
if (parseAs === "stream") {
|
|
107
|
-
return opts.responseStyle === "data"
|
|
108
|
-
? response.body
|
|
109
|
-
: {
|
|
110
|
-
data: response.body,
|
|
111
|
-
...result,
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
let data = await response[parseAs]();
|
|
116
|
-
if (parseAs === "json") {
|
|
117
|
-
if (opts.responseValidator) {
|
|
118
|
-
await opts.responseValidator(data);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
if (opts.responseTransformer) {
|
|
122
|
-
data = await opts.responseTransformer(data);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return opts.responseStyle === "data"
|
|
127
|
-
? data
|
|
128
|
-
: {
|
|
129
|
-
data,
|
|
130
|
-
...result,
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
let error = await response.text();
|
|
135
|
-
|
|
136
|
-
try {
|
|
137
|
-
error = JSON.parse(error);
|
|
138
|
-
} catch {
|
|
139
|
-
// noop
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
let finalError = error;
|
|
143
|
-
|
|
144
|
-
for (const fn of interceptors.error._fns) {
|
|
145
|
-
if (fn) {
|
|
146
|
-
finalError = (await fn(error, response, request, opts)) as string;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
finalError = finalError || ({} as string);
|
|
151
|
-
|
|
152
|
-
if (opts.throwOnError) {
|
|
153
|
-
throw finalError;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
// TODO: we probably want to return error and improve types
|
|
157
|
-
return opts.responseStyle === "data"
|
|
158
|
-
? undefined
|
|
159
|
-
: {
|
|
160
|
-
error: finalError,
|
|
161
|
-
...result,
|
|
162
|
-
};
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
return {
|
|
166
|
-
buildUrl,
|
|
167
|
-
connect: (options) => request({ ...options, method: "CONNECT" }),
|
|
168
|
-
delete: (options) => request({ ...options, method: "DELETE" }),
|
|
169
|
-
get: (options) => request({ ...options, method: "GET" }),
|
|
170
|
-
getConfig,
|
|
171
|
-
head: (options) => request({ ...options, method: "HEAD" }),
|
|
172
|
-
interceptors,
|
|
173
|
-
options: (options) => request({ ...options, method: "OPTIONS" }),
|
|
174
|
-
patch: (options) => request({ ...options, method: "PATCH" }),
|
|
175
|
-
post: (options) => request({ ...options, method: "POST" }),
|
|
176
|
-
put: (options) => request({ ...options, method: "PUT" }),
|
|
177
|
-
request,
|
|
178
|
-
setConfig,
|
|
179
|
-
trace: (options) => request({ ...options, method: "TRACE" }),
|
|
180
|
-
};
|
|
181
|
-
};
|