@layer-drone/protocol 0.0.16 → 0.0.18-alpha
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/README.md +43 -0
- package/dist/index.d.mts +427 -255
- package/dist/index.d.ts +427 -255
- package/dist/index.js +125 -93
- package/dist/index.mjs +123 -90
- package/package.json +7 -2
- package/src/client/client/client.ts +5 -1
- package/src/client/sdk.gen.ts +119 -143
- package/src/client/transformers.gen.ts +13 -0
- package/src/client/types.gen.ts +231 -269
- package/src/event/types.gen.ts +57 -21
|
@@ -55,7 +55,11 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
55
55
|
opts.headers.delete("Content-Type");
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
const url = buildUrl(
|
|
58
|
+
const url = buildUrl({
|
|
59
|
+
...opts,
|
|
60
|
+
baseUrl: opts.baseUrl ?? _config?.baseUrl ?? "https://api.layerdrone.org",
|
|
61
|
+
url: opts.url ?? "",
|
|
62
|
+
});
|
|
59
63
|
const requestInit: ReqInit = {
|
|
60
64
|
redirect: "follow",
|
|
61
65
|
...opts,
|
package/src/client/sdk.gen.ts
CHANGED
|
@@ -8,8 +8,11 @@ import type {
|
|
|
8
8
|
import {
|
|
9
9
|
apiTokenControllerUpdateTokenResponseTransformer,
|
|
10
10
|
conditionsControllerGetSunAltitudeTimeLimitsResponseTransformer,
|
|
11
|
+
flightsControllerValidateFlightResponseTransformer,
|
|
11
12
|
} from "./transformers.gen.js";
|
|
12
13
|
import type {
|
|
14
|
+
ApiControllerGetHelloData,
|
|
15
|
+
ApiControllerGetHelloResponses,
|
|
13
16
|
ApiTokenControllerCreateTokenData,
|
|
14
17
|
ApiTokenControllerCreateTokenErrors,
|
|
15
18
|
ApiTokenControllerCreateTokenResponses,
|
|
@@ -22,16 +25,14 @@ import type {
|
|
|
22
25
|
ApiTokenControllerUpdateTokenData,
|
|
23
26
|
ApiTokenControllerUpdateTokenErrors,
|
|
24
27
|
ApiTokenControllerUpdateTokenResponses,
|
|
25
|
-
AppControllerGetHelloData,
|
|
26
|
-
AppControllerGetHelloResponses,
|
|
27
28
|
ConditionsControllerGetSunAltitudeTimeLimitsData,
|
|
28
29
|
ConditionsControllerGetSunAltitudeTimeLimitsResponses,
|
|
29
30
|
FlightsControllerCreatePresignedUrlsData,
|
|
30
31
|
FlightsControllerCreatePresignedUrlsErrors,
|
|
31
32
|
FlightsControllerCreatePresignedUrlsResponses,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
FlightsControllerGenerateStorageKeyData,
|
|
34
|
+
FlightsControllerGenerateStorageKeyErrors,
|
|
35
|
+
FlightsControllerGenerateStorageKeyResponses,
|
|
35
36
|
FlightsControllerGetFlightData,
|
|
36
37
|
FlightsControllerGetFlightErrors,
|
|
37
38
|
FlightsControllerGetFlightResponses,
|
|
@@ -40,9 +41,6 @@ import type {
|
|
|
40
41
|
FlightsControllerValidateFlightResponses,
|
|
41
42
|
KeysControllerGetProvenanceCryptoKeyData,
|
|
42
43
|
KeysControllerGetProvenanceCryptoKeyResponses,
|
|
43
|
-
MissionsControllerClaimRewardsData,
|
|
44
|
-
MissionsControllerClaimRewardsErrors,
|
|
45
|
-
MissionsControllerClaimRewardsResponses,
|
|
46
44
|
MissionsControllerCreateMissionsData,
|
|
47
45
|
MissionsControllerCreateMissionsErrors,
|
|
48
46
|
MissionsControllerCreateMissionsResponses,
|
|
@@ -99,11 +97,11 @@ export type Options<
|
|
|
99
97
|
meta?: Record<string, unknown>;
|
|
100
98
|
};
|
|
101
99
|
|
|
102
|
-
export const
|
|
103
|
-
options?: Options<
|
|
100
|
+
export const apiControllerGetHello = <ThrowOnError extends boolean = false>(
|
|
101
|
+
options?: Options<ApiControllerGetHelloData, ThrowOnError>,
|
|
104
102
|
) => {
|
|
105
103
|
return (options?.client ?? _heyApiClient).get<
|
|
106
|
-
|
|
104
|
+
ApiControllerGetHelloResponses,
|
|
107
105
|
unknown,
|
|
108
106
|
ThrowOnError
|
|
109
107
|
>({
|
|
@@ -112,65 +110,6 @@ export const appControllerGetHello = <ThrowOnError extends boolean = false>(
|
|
|
112
110
|
});
|
|
113
111
|
};
|
|
114
112
|
|
|
115
|
-
export const keysControllerGetProvenanceCryptoKey = <
|
|
116
|
-
ThrowOnError extends boolean = false,
|
|
117
|
-
>(
|
|
118
|
-
options?: Options<KeysControllerGetProvenanceCryptoKeyData, ThrowOnError>,
|
|
119
|
-
) => {
|
|
120
|
-
return (options?.client ?? _heyApiClient).get<
|
|
121
|
-
KeysControllerGetProvenanceCryptoKeyResponses,
|
|
122
|
-
unknown,
|
|
123
|
-
ThrowOnError
|
|
124
|
-
>({
|
|
125
|
-
url: "/keys",
|
|
126
|
-
...options,
|
|
127
|
-
});
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
export const quotesControllerCreateQuote = <
|
|
131
|
-
ThrowOnError extends boolean = false,
|
|
132
|
-
>(
|
|
133
|
-
options: Options<QuotesControllerCreateQuoteData, ThrowOnError>,
|
|
134
|
-
) => {
|
|
135
|
-
return (options.client ?? _heyApiClient).post<
|
|
136
|
-
QuotesControllerCreateQuoteResponses,
|
|
137
|
-
QuotesControllerCreateQuoteErrors,
|
|
138
|
-
ThrowOnError
|
|
139
|
-
>({
|
|
140
|
-
security: [
|
|
141
|
-
{
|
|
142
|
-
name: "x-api-token",
|
|
143
|
-
type: "apiKey",
|
|
144
|
-
},
|
|
145
|
-
],
|
|
146
|
-
url: "/quotes",
|
|
147
|
-
...options,
|
|
148
|
-
headers: {
|
|
149
|
-
"Content-Type": "application/json",
|
|
150
|
-
...options.headers,
|
|
151
|
-
},
|
|
152
|
-
});
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
export const quotesControllerGetQuote = <ThrowOnError extends boolean = false>(
|
|
156
|
-
options: Options<QuotesControllerGetQuoteData, ThrowOnError>,
|
|
157
|
-
) => {
|
|
158
|
-
return (options.client ?? _heyApiClient).get<
|
|
159
|
-
QuotesControllerGetQuoteResponses,
|
|
160
|
-
QuotesControllerGetQuoteErrors,
|
|
161
|
-
ThrowOnError
|
|
162
|
-
>({
|
|
163
|
-
security: [
|
|
164
|
-
{
|
|
165
|
-
name: "x-api-token",
|
|
166
|
-
type: "apiKey",
|
|
167
|
-
},
|
|
168
|
-
],
|
|
169
|
-
url: "/quotes/{id}",
|
|
170
|
-
...options,
|
|
171
|
-
});
|
|
172
|
-
};
|
|
173
|
-
|
|
174
113
|
export const apiTokenControllerCreateToken = <
|
|
175
114
|
ThrowOnError extends boolean = false,
|
|
176
115
|
>(
|
|
@@ -264,83 +203,34 @@ export const apiTokenControllerUpdateToken = <
|
|
|
264
203
|
});
|
|
265
204
|
};
|
|
266
205
|
|
|
267
|
-
|
|
268
|
-
* Create new missions
|
|
269
|
-
* Create missions for specified zones and mission types.
|
|
270
|
-
*/
|
|
271
|
-
export const missionsControllerCreateMissions = <
|
|
206
|
+
export const conditionsControllerGetSunAltitudeTimeLimits = <
|
|
272
207
|
ThrowOnError extends boolean = false,
|
|
273
208
|
>(
|
|
274
|
-
options: Options<
|
|
275
|
-
|
|
276
|
-
return (options.client ?? _heyApiClient).post<
|
|
277
|
-
MissionsControllerCreateMissionsResponses,
|
|
278
|
-
MissionsControllerCreateMissionsErrors,
|
|
209
|
+
options: Options<
|
|
210
|
+
ConditionsControllerGetSunAltitudeTimeLimitsData,
|
|
279
211
|
ThrowOnError
|
|
280
|
-
|
|
281
|
-
url: "/missions",
|
|
282
|
-
...options,
|
|
283
|
-
headers: {
|
|
284
|
-
"Content-Type": "application/json",
|
|
285
|
-
...options.headers,
|
|
286
|
-
},
|
|
287
|
-
});
|
|
288
|
-
};
|
|
289
|
-
|
|
290
|
-
/**
|
|
291
|
-
* Update missions
|
|
292
|
-
* Update missions' rewards or cancel them altogether
|
|
293
|
-
*/
|
|
294
|
-
export const missionsControllerUpdateMissions = <
|
|
295
|
-
ThrowOnError extends boolean = false,
|
|
296
|
-
>(
|
|
297
|
-
options: Options<MissionsControllerUpdateMissionsData, ThrowOnError>,
|
|
212
|
+
>,
|
|
298
213
|
) => {
|
|
299
|
-
return (options.client ?? _heyApiClient).
|
|
300
|
-
|
|
214
|
+
return (options.client ?? _heyApiClient).get<
|
|
215
|
+
ConditionsControllerGetSunAltitudeTimeLimitsResponses,
|
|
301
216
|
unknown,
|
|
302
217
|
ThrowOnError
|
|
303
218
|
>({
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
"Content-Type": "application/json",
|
|
308
|
-
...options.headers,
|
|
309
|
-
},
|
|
310
|
-
});
|
|
311
|
-
};
|
|
312
|
-
|
|
313
|
-
/**
|
|
314
|
-
* Claim rewards for a mission
|
|
315
|
-
* Claim rewards for a completed flight within a mission
|
|
316
|
-
*/
|
|
317
|
-
export const missionsControllerClaimRewards = <
|
|
318
|
-
ThrowOnError extends boolean = false,
|
|
319
|
-
>(
|
|
320
|
-
options: Options<MissionsControllerClaimRewardsData, ThrowOnError>,
|
|
321
|
-
) => {
|
|
322
|
-
return (options.client ?? _heyApiClient).post<
|
|
323
|
-
MissionsControllerClaimRewardsResponses,
|
|
324
|
-
MissionsControllerClaimRewardsErrors,
|
|
325
|
-
ThrowOnError
|
|
326
|
-
>({
|
|
327
|
-
url: "/missions/{id}/rewards",
|
|
219
|
+
responseTransformer:
|
|
220
|
+
conditionsControllerGetSunAltitudeTimeLimitsResponseTransformer,
|
|
221
|
+
url: "/conditions/sun-altitude",
|
|
328
222
|
...options,
|
|
329
|
-
headers: {
|
|
330
|
-
"Content-Type": "application/json",
|
|
331
|
-
...options.headers,
|
|
332
|
-
},
|
|
333
223
|
});
|
|
334
224
|
};
|
|
335
225
|
|
|
336
|
-
export const
|
|
226
|
+
export const flightsControllerGenerateStorageKey = <
|
|
337
227
|
ThrowOnError extends boolean = false,
|
|
338
228
|
>(
|
|
339
|
-
options: Options<
|
|
229
|
+
options: Options<FlightsControllerGenerateStorageKeyData, ThrowOnError>,
|
|
340
230
|
) => {
|
|
341
231
|
return (options.client ?? _heyApiClient).get<
|
|
342
|
-
|
|
343
|
-
|
|
232
|
+
FlightsControllerGenerateStorageKeyResponses,
|
|
233
|
+
FlightsControllerGenerateStorageKeyErrors,
|
|
344
234
|
ThrowOnError
|
|
345
235
|
>({
|
|
346
236
|
security: [
|
|
@@ -349,7 +239,7 @@ export const flightsControllerGenerateFlightId = <
|
|
|
349
239
|
type: "apiKey",
|
|
350
240
|
},
|
|
351
241
|
],
|
|
352
|
-
url: "/flights/
|
|
242
|
+
url: "/flights/storage-key",
|
|
353
243
|
...options,
|
|
354
244
|
});
|
|
355
245
|
};
|
|
@@ -391,7 +281,7 @@ export const flightsControllerCreatePresignedUrls = <
|
|
|
391
281
|
type: "apiKey",
|
|
392
282
|
},
|
|
393
283
|
],
|
|
394
|
-
url: "/flights/
|
|
284
|
+
url: "/flights/files",
|
|
395
285
|
...options,
|
|
396
286
|
headers: {
|
|
397
287
|
"Content-Type": "application/json",
|
|
@@ -416,6 +306,7 @@ export const flightsControllerValidateFlight = <
|
|
|
416
306
|
type: "apiKey",
|
|
417
307
|
},
|
|
418
308
|
],
|
|
309
|
+
responseTransformer: flightsControllerValidateFlightResponseTransformer,
|
|
419
310
|
url: "/flights",
|
|
420
311
|
...options,
|
|
421
312
|
headers: {
|
|
@@ -425,22 +316,107 @@ export const flightsControllerValidateFlight = <
|
|
|
425
316
|
});
|
|
426
317
|
};
|
|
427
318
|
|
|
428
|
-
export const
|
|
319
|
+
export const keysControllerGetProvenanceCryptoKey = <
|
|
429
320
|
ThrowOnError extends boolean = false,
|
|
430
321
|
>(
|
|
431
|
-
options
|
|
432
|
-
|
|
322
|
+
options?: Options<KeysControllerGetProvenanceCryptoKeyData, ThrowOnError>,
|
|
323
|
+
) => {
|
|
324
|
+
return (options?.client ?? _heyApiClient).get<
|
|
325
|
+
KeysControllerGetProvenanceCryptoKeyResponses,
|
|
326
|
+
unknown,
|
|
433
327
|
ThrowOnError
|
|
434
|
-
|
|
328
|
+
>({
|
|
329
|
+
url: "/keys",
|
|
330
|
+
...options,
|
|
331
|
+
});
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Create new missions
|
|
336
|
+
* Create missions for specified zones and mission types.
|
|
337
|
+
*/
|
|
338
|
+
export const missionsControllerCreateMissions = <
|
|
339
|
+
ThrowOnError extends boolean = false,
|
|
340
|
+
>(
|
|
341
|
+
options: Options<MissionsControllerCreateMissionsData, ThrowOnError>,
|
|
435
342
|
) => {
|
|
436
|
-
return (options.client ?? _heyApiClient).
|
|
437
|
-
|
|
343
|
+
return (options.client ?? _heyApiClient).post<
|
|
344
|
+
MissionsControllerCreateMissionsResponses,
|
|
345
|
+
MissionsControllerCreateMissionsErrors,
|
|
346
|
+
ThrowOnError
|
|
347
|
+
>({
|
|
348
|
+
url: "/missions",
|
|
349
|
+
...options,
|
|
350
|
+
headers: {
|
|
351
|
+
"Content-Type": "application/json",
|
|
352
|
+
...options.headers,
|
|
353
|
+
},
|
|
354
|
+
});
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Update missions
|
|
359
|
+
* Update missions' rewards or cancel them altogether
|
|
360
|
+
*/
|
|
361
|
+
export const missionsControllerUpdateMissions = <
|
|
362
|
+
ThrowOnError extends boolean = false,
|
|
363
|
+
>(
|
|
364
|
+
options: Options<MissionsControllerUpdateMissionsData, ThrowOnError>,
|
|
365
|
+
) => {
|
|
366
|
+
return (options.client ?? _heyApiClient).put<
|
|
367
|
+
MissionsControllerUpdateMissionsResponses,
|
|
438
368
|
unknown,
|
|
439
369
|
ThrowOnError
|
|
440
370
|
>({
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
371
|
+
url: "/missions",
|
|
372
|
+
...options,
|
|
373
|
+
headers: {
|
|
374
|
+
"Content-Type": "application/json",
|
|
375
|
+
...options.headers,
|
|
376
|
+
},
|
|
377
|
+
});
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
export const quotesControllerCreateQuote = <
|
|
381
|
+
ThrowOnError extends boolean = false,
|
|
382
|
+
>(
|
|
383
|
+
options: Options<QuotesControllerCreateQuoteData, ThrowOnError>,
|
|
384
|
+
) => {
|
|
385
|
+
return (options.client ?? _heyApiClient).post<
|
|
386
|
+
QuotesControllerCreateQuoteResponses,
|
|
387
|
+
QuotesControllerCreateQuoteErrors,
|
|
388
|
+
ThrowOnError
|
|
389
|
+
>({
|
|
390
|
+
security: [
|
|
391
|
+
{
|
|
392
|
+
name: "x-api-token",
|
|
393
|
+
type: "apiKey",
|
|
394
|
+
},
|
|
395
|
+
],
|
|
396
|
+
url: "/quotes",
|
|
397
|
+
...options,
|
|
398
|
+
headers: {
|
|
399
|
+
"Content-Type": "application/json",
|
|
400
|
+
...options.headers,
|
|
401
|
+
},
|
|
402
|
+
});
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
export const quotesControllerGetQuote = <ThrowOnError extends boolean = false>(
|
|
406
|
+
options: Options<QuotesControllerGetQuoteData, ThrowOnError>,
|
|
407
|
+
) => {
|
|
408
|
+
return (options.client ?? _heyApiClient).get<
|
|
409
|
+
QuotesControllerGetQuoteResponses,
|
|
410
|
+
QuotesControllerGetQuoteErrors,
|
|
411
|
+
ThrowOnError
|
|
412
|
+
>({
|
|
413
|
+
security: [
|
|
414
|
+
{
|
|
415
|
+
name: "x-api-token",
|
|
416
|
+
type: "apiKey",
|
|
417
|
+
},
|
|
418
|
+
],
|
|
419
|
+
url: "/quotes/{id}",
|
|
444
420
|
...options,
|
|
445
421
|
});
|
|
446
422
|
};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import type {
|
|
3
3
|
ApiTokenControllerUpdateTokenResponse,
|
|
4
4
|
ConditionsControllerGetSunAltitudeTimeLimitsResponse,
|
|
5
|
+
FlightsControllerValidateFlightResponse,
|
|
5
6
|
} from "./types.gen.js";
|
|
6
7
|
|
|
7
8
|
const updateApiTokenResponseDtoSchemaResponseTransformer = (data: any) => {
|
|
@@ -38,3 +39,15 @@ export const conditionsControllerGetSunAltitudeTimeLimitsResponseTransformer =
|
|
|
38
39
|
data = getTimeLimitsForSunAltitudeResponseSchemaResponseTransformer(data);
|
|
39
40
|
return data;
|
|
40
41
|
};
|
|
42
|
+
|
|
43
|
+
const validateFlightResponseDtoSchemaResponseTransformer = (data: any) => {
|
|
44
|
+
data.flightId = BigInt(data.flightId.toString());
|
|
45
|
+
return data;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const flightsControllerValidateFlightResponseTransformer = async (
|
|
49
|
+
data: any,
|
|
50
|
+
): Promise<FlightsControllerValidateFlightResponse> => {
|
|
51
|
+
data = validateFlightResponseDtoSchemaResponseTransformer(data);
|
|
52
|
+
return data;
|
|
53
|
+
};
|