@izak0s/spacebring-api 0.1.0

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.cjs ADDED
@@ -0,0 +1,2098 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ Spacebring: () => Spacebring,
24
+ SpacebringError: () => SpacebringError
25
+ });
26
+ module.exports = __toCommonJS(index_exports);
27
+
28
+ // node_modules/openapi-fetch/dist/index.mjs
29
+ var PATH_PARAM_RE = /\{[^{}]+\}/g;
30
+ var supportsRequestInitExt = () => {
31
+ return typeof process === "object" && Number.parseInt(process?.versions?.node?.substring(0, 2)) >= 18 && process.versions.undici;
32
+ };
33
+ function randomID() {
34
+ return Math.random().toString(36).slice(2, 11);
35
+ }
36
+ function createClient(clientOptions) {
37
+ let {
38
+ baseUrl = "",
39
+ Request: CustomRequest = globalThis.Request,
40
+ fetch: baseFetch = globalThis.fetch,
41
+ querySerializer: globalQuerySerializer,
42
+ bodySerializer: globalBodySerializer,
43
+ headers: baseHeaders,
44
+ requestInitExt = void 0,
45
+ ...baseOptions
46
+ } = { ...clientOptions };
47
+ requestInitExt = supportsRequestInitExt() ? requestInitExt : void 0;
48
+ baseUrl = removeTrailingSlash(baseUrl);
49
+ const middlewares = [];
50
+ async function coreFetch(schemaPath, fetchOptions) {
51
+ const {
52
+ baseUrl: localBaseUrl,
53
+ fetch = baseFetch,
54
+ Request = CustomRequest,
55
+ headers,
56
+ params = {},
57
+ parseAs = "json",
58
+ querySerializer: requestQuerySerializer,
59
+ bodySerializer = globalBodySerializer ?? defaultBodySerializer,
60
+ body,
61
+ ...init
62
+ } = fetchOptions || {};
63
+ let finalBaseUrl = baseUrl;
64
+ if (localBaseUrl) {
65
+ finalBaseUrl = removeTrailingSlash(localBaseUrl) ?? baseUrl;
66
+ }
67
+ let querySerializer = typeof globalQuerySerializer === "function" ? globalQuerySerializer : createQuerySerializer(globalQuerySerializer);
68
+ if (requestQuerySerializer) {
69
+ querySerializer = typeof requestQuerySerializer === "function" ? requestQuerySerializer : createQuerySerializer({
70
+ ...typeof globalQuerySerializer === "object" ? globalQuerySerializer : {},
71
+ ...requestQuerySerializer
72
+ });
73
+ }
74
+ const serializedBody = body === void 0 ? void 0 : bodySerializer(
75
+ body,
76
+ // Note: we declare mergeHeaders() both here and below because it’s a bit of a chicken-or-egg situation:
77
+ // bodySerializer() needs all headers so we aren’t dropping ones set by the user, however,
78
+ // the result of this ALSO sets the lowest-priority content-type header. So we re-merge below,
79
+ // setting the content-type at the very beginning to be overwritten.
80
+ // Lastly, based on the way headers work, it’s not a simple “present-or-not” check becauase null intentionally un-sets headers.
81
+ mergeHeaders(baseHeaders, headers, params.header)
82
+ );
83
+ const finalHeaders = mergeHeaders(
84
+ // with no body, we should not to set Content-Type
85
+ serializedBody === void 0 || // if serialized body is FormData; browser will correctly set Content-Type & boundary expression
86
+ serializedBody instanceof FormData ? {} : {
87
+ "Content-Type": "application/json"
88
+ },
89
+ baseHeaders,
90
+ headers,
91
+ params.header
92
+ );
93
+ const requestInit = {
94
+ redirect: "follow",
95
+ ...baseOptions,
96
+ ...init,
97
+ body: serializedBody,
98
+ headers: finalHeaders
99
+ };
100
+ let id;
101
+ let options;
102
+ let request = new Request(
103
+ createFinalURL(schemaPath, { baseUrl: finalBaseUrl, params, querySerializer }),
104
+ requestInit
105
+ );
106
+ let response;
107
+ for (const key in init) {
108
+ if (!(key in request)) {
109
+ request[key] = init[key];
110
+ }
111
+ }
112
+ if (middlewares.length) {
113
+ id = randomID();
114
+ options = Object.freeze({
115
+ baseUrl: finalBaseUrl,
116
+ fetch,
117
+ parseAs,
118
+ querySerializer,
119
+ bodySerializer
120
+ });
121
+ for (const m of middlewares) {
122
+ if (m && typeof m === "object" && typeof m.onRequest === "function") {
123
+ const result = await m.onRequest({
124
+ request,
125
+ schemaPath,
126
+ params,
127
+ options,
128
+ id
129
+ });
130
+ if (result) {
131
+ if (result instanceof Request) {
132
+ request = result;
133
+ } else if (result instanceof Response) {
134
+ response = result;
135
+ break;
136
+ } else {
137
+ throw new Error("onRequest: must return new Request() or Response() when modifying the request");
138
+ }
139
+ }
140
+ }
141
+ }
142
+ }
143
+ if (!response) {
144
+ try {
145
+ response = await fetch(request, requestInitExt);
146
+ } catch (error2) {
147
+ let errorAfterMiddleware = error2;
148
+ if (middlewares.length) {
149
+ for (let i = middlewares.length - 1; i >= 0; i--) {
150
+ const m = middlewares[i];
151
+ if (m && typeof m === "object" && typeof m.onError === "function") {
152
+ const result = await m.onError({
153
+ request,
154
+ error: errorAfterMiddleware,
155
+ schemaPath,
156
+ params,
157
+ options,
158
+ id
159
+ });
160
+ if (result) {
161
+ if (result instanceof Response) {
162
+ errorAfterMiddleware = void 0;
163
+ response = result;
164
+ break;
165
+ }
166
+ if (result instanceof Error) {
167
+ errorAfterMiddleware = result;
168
+ continue;
169
+ }
170
+ throw new Error("onError: must return new Response() or instance of Error");
171
+ }
172
+ }
173
+ }
174
+ }
175
+ if (errorAfterMiddleware) {
176
+ throw errorAfterMiddleware;
177
+ }
178
+ }
179
+ if (middlewares.length) {
180
+ for (let i = middlewares.length - 1; i >= 0; i--) {
181
+ const m = middlewares[i];
182
+ if (m && typeof m === "object" && typeof m.onResponse === "function") {
183
+ const result = await m.onResponse({
184
+ request,
185
+ response,
186
+ schemaPath,
187
+ params,
188
+ options,
189
+ id
190
+ });
191
+ if (result) {
192
+ if (!(result instanceof Response)) {
193
+ throw new Error("onResponse: must return new Response() when modifying the response");
194
+ }
195
+ response = result;
196
+ }
197
+ }
198
+ }
199
+ }
200
+ }
201
+ if (response.status === 204 || request.method === "HEAD" || response.headers.get("Content-Length") === "0") {
202
+ return response.ok ? { data: void 0, response } : { error: void 0, response };
203
+ }
204
+ if (response.ok) {
205
+ if (parseAs === "stream") {
206
+ return { data: response.body, response };
207
+ }
208
+ return { data: await response[parseAs](), response };
209
+ }
210
+ let error = await response.text();
211
+ try {
212
+ error = JSON.parse(error);
213
+ } catch {
214
+ }
215
+ return { error, response };
216
+ }
217
+ return {
218
+ request(method, url, init) {
219
+ return coreFetch(url, { ...init, method: method.toUpperCase() });
220
+ },
221
+ /** Call a GET endpoint */
222
+ GET(url, init) {
223
+ return coreFetch(url, { ...init, method: "GET" });
224
+ },
225
+ /** Call a PUT endpoint */
226
+ PUT(url, init) {
227
+ return coreFetch(url, { ...init, method: "PUT" });
228
+ },
229
+ /** Call a POST endpoint */
230
+ POST(url, init) {
231
+ return coreFetch(url, { ...init, method: "POST" });
232
+ },
233
+ /** Call a DELETE endpoint */
234
+ DELETE(url, init) {
235
+ return coreFetch(url, { ...init, method: "DELETE" });
236
+ },
237
+ /** Call a OPTIONS endpoint */
238
+ OPTIONS(url, init) {
239
+ return coreFetch(url, { ...init, method: "OPTIONS" });
240
+ },
241
+ /** Call a HEAD endpoint */
242
+ HEAD(url, init) {
243
+ return coreFetch(url, { ...init, method: "HEAD" });
244
+ },
245
+ /** Call a PATCH endpoint */
246
+ PATCH(url, init) {
247
+ return coreFetch(url, { ...init, method: "PATCH" });
248
+ },
249
+ /** Call a TRACE endpoint */
250
+ TRACE(url, init) {
251
+ return coreFetch(url, { ...init, method: "TRACE" });
252
+ },
253
+ /** Register middleware */
254
+ use(...middleware) {
255
+ for (const m of middleware) {
256
+ if (!m) {
257
+ continue;
258
+ }
259
+ if (typeof m !== "object" || !("onRequest" in m || "onResponse" in m || "onError" in m)) {
260
+ throw new Error("Middleware must be an object with one of `onRequest()`, `onResponse() or `onError()`");
261
+ }
262
+ middlewares.push(m);
263
+ }
264
+ },
265
+ /** Unregister middleware */
266
+ eject(...middleware) {
267
+ for (const m of middleware) {
268
+ const i = middlewares.indexOf(m);
269
+ if (i !== -1) {
270
+ middlewares.splice(i, 1);
271
+ }
272
+ }
273
+ }
274
+ };
275
+ }
276
+ function serializePrimitiveParam(name, value, options) {
277
+ if (value === void 0 || value === null) {
278
+ return "";
279
+ }
280
+ if (typeof value === "object") {
281
+ throw new Error(
282
+ "Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these."
283
+ );
284
+ }
285
+ return `${name}=${options?.allowReserved === true ? value : encodeURIComponent(value)}`;
286
+ }
287
+ function serializeObjectParam(name, value, options) {
288
+ if (!value || typeof value !== "object") {
289
+ return "";
290
+ }
291
+ const values = [];
292
+ const joiner = {
293
+ simple: ",",
294
+ label: ".",
295
+ matrix: ";"
296
+ }[options.style] || "&";
297
+ if (options.style !== "deepObject" && options.explode === false) {
298
+ for (const k in value) {
299
+ values.push(k, options.allowReserved === true ? value[k] : encodeURIComponent(value[k]));
300
+ }
301
+ const final2 = values.join(",");
302
+ switch (options.style) {
303
+ case "form": {
304
+ return `${name}=${final2}`;
305
+ }
306
+ case "label": {
307
+ return `.${final2}`;
308
+ }
309
+ case "matrix": {
310
+ return `;${name}=${final2}`;
311
+ }
312
+ default: {
313
+ return final2;
314
+ }
315
+ }
316
+ }
317
+ for (const k in value) {
318
+ const finalName = options.style === "deepObject" ? `${name}[${k}]` : k;
319
+ values.push(serializePrimitiveParam(finalName, value[k], options));
320
+ }
321
+ const final = values.join(joiner);
322
+ return options.style === "label" || options.style === "matrix" ? `${joiner}${final}` : final;
323
+ }
324
+ function serializeArrayParam(name, value, options) {
325
+ if (!Array.isArray(value)) {
326
+ return "";
327
+ }
328
+ if (options.explode === false) {
329
+ const joiner2 = { form: ",", spaceDelimited: "%20", pipeDelimited: "|" }[options.style] || ",";
330
+ const final = (options.allowReserved === true ? value : value.map((v) => encodeURIComponent(v))).join(joiner2);
331
+ switch (options.style) {
332
+ case "simple": {
333
+ return final;
334
+ }
335
+ case "label": {
336
+ return `.${final}`;
337
+ }
338
+ case "matrix": {
339
+ return `;${name}=${final}`;
340
+ }
341
+ // case "spaceDelimited":
342
+ // case "pipeDelimited":
343
+ default: {
344
+ return `${name}=${final}`;
345
+ }
346
+ }
347
+ }
348
+ const joiner = { simple: ",", label: ".", matrix: ";" }[options.style] || "&";
349
+ const values = [];
350
+ for (const v of value) {
351
+ if (options.style === "simple" || options.style === "label") {
352
+ values.push(options.allowReserved === true ? v : encodeURIComponent(v));
353
+ } else {
354
+ values.push(serializePrimitiveParam(name, v, options));
355
+ }
356
+ }
357
+ return options.style === "label" || options.style === "matrix" ? `${joiner}${values.join(joiner)}` : values.join(joiner);
358
+ }
359
+ function createQuerySerializer(options) {
360
+ return function querySerializer(queryParams) {
361
+ const search = [];
362
+ if (queryParams && typeof queryParams === "object") {
363
+ for (const name in queryParams) {
364
+ const value = queryParams[name];
365
+ if (value === void 0 || value === null) {
366
+ continue;
367
+ }
368
+ if (Array.isArray(value)) {
369
+ if (value.length === 0) {
370
+ continue;
371
+ }
372
+ search.push(
373
+ serializeArrayParam(name, value, {
374
+ style: "form",
375
+ explode: true,
376
+ ...options?.array,
377
+ allowReserved: options?.allowReserved || false
378
+ })
379
+ );
380
+ continue;
381
+ }
382
+ if (typeof value === "object") {
383
+ search.push(
384
+ serializeObjectParam(name, value, {
385
+ style: "deepObject",
386
+ explode: true,
387
+ ...options?.object,
388
+ allowReserved: options?.allowReserved || false
389
+ })
390
+ );
391
+ continue;
392
+ }
393
+ search.push(serializePrimitiveParam(name, value, options));
394
+ }
395
+ }
396
+ return search.join("&");
397
+ };
398
+ }
399
+ function defaultPathSerializer(pathname, pathParams) {
400
+ let nextURL = pathname;
401
+ for (const match of pathname.match(PATH_PARAM_RE) ?? []) {
402
+ let name = match.substring(1, match.length - 1);
403
+ let explode = false;
404
+ let style = "simple";
405
+ if (name.endsWith("*")) {
406
+ explode = true;
407
+ name = name.substring(0, name.length - 1);
408
+ }
409
+ if (name.startsWith(".")) {
410
+ style = "label";
411
+ name = name.substring(1);
412
+ } else if (name.startsWith(";")) {
413
+ style = "matrix";
414
+ name = name.substring(1);
415
+ }
416
+ if (!pathParams || pathParams[name] === void 0 || pathParams[name] === null) {
417
+ continue;
418
+ }
419
+ const value = pathParams[name];
420
+ if (Array.isArray(value)) {
421
+ nextURL = nextURL.replace(match, serializeArrayParam(name, value, { style, explode }));
422
+ continue;
423
+ }
424
+ if (typeof value === "object") {
425
+ nextURL = nextURL.replace(match, serializeObjectParam(name, value, { style, explode }));
426
+ continue;
427
+ }
428
+ if (style === "matrix") {
429
+ nextURL = nextURL.replace(match, `;${serializePrimitiveParam(name, value)}`);
430
+ continue;
431
+ }
432
+ nextURL = nextURL.replace(match, style === "label" ? `.${encodeURIComponent(value)}` : encodeURIComponent(value));
433
+ }
434
+ return nextURL;
435
+ }
436
+ function defaultBodySerializer(body, headers) {
437
+ if (body instanceof FormData) {
438
+ return body;
439
+ }
440
+ if (headers) {
441
+ const contentType = headers.get instanceof Function ? headers.get("Content-Type") ?? headers.get("content-type") : headers["Content-Type"] ?? headers["content-type"];
442
+ if (contentType === "application/x-www-form-urlencoded") {
443
+ return new URLSearchParams(body).toString();
444
+ }
445
+ }
446
+ return JSON.stringify(body);
447
+ }
448
+ function createFinalURL(pathname, options) {
449
+ let finalURL = `${options.baseUrl}${pathname}`;
450
+ if (options.params?.path) {
451
+ finalURL = defaultPathSerializer(finalURL, options.params.path);
452
+ }
453
+ let search = options.querySerializer(options.params.query ?? {});
454
+ if (search.startsWith("?")) {
455
+ search = search.substring(1);
456
+ }
457
+ if (search) {
458
+ finalURL += `?${search}`;
459
+ }
460
+ return finalURL;
461
+ }
462
+ function mergeHeaders(...allHeaders) {
463
+ const finalHeaders = new Headers();
464
+ for (const h of allHeaders) {
465
+ if (!h || typeof h !== "object") {
466
+ continue;
467
+ }
468
+ const iterator = h instanceof Headers ? h.entries() : Object.entries(h);
469
+ for (const [k, v] of iterator) {
470
+ if (v === null) {
471
+ finalHeaders.delete(k);
472
+ } else if (Array.isArray(v)) {
473
+ for (const v2 of v) {
474
+ finalHeaders.append(k, v2);
475
+ }
476
+ } else if (v !== void 0) {
477
+ finalHeaders.set(k, v);
478
+ }
479
+ }
480
+ }
481
+ return finalHeaders;
482
+ }
483
+ function removeTrailingSlash(url) {
484
+ if (url.endsWith("/")) {
485
+ return url.substring(0, url.length - 1);
486
+ }
487
+ return url;
488
+ }
489
+
490
+ // src/error.ts
491
+ var SpacebringError = class extends Error {
492
+ /** HTTP status code of the failed response. */
493
+ status;
494
+ /** Parsed error body returned by the API, if any. */
495
+ body;
496
+ constructor(status, body) {
497
+ const parsed = isErrorBody(body) ? body : void 0;
498
+ super(parsed?.message ?? `Spacebring API request failed with status ${status}`);
499
+ this.name = "SpacebringError";
500
+ this.status = status;
501
+ this.body = parsed;
502
+ }
503
+ };
504
+ function isErrorBody(body) {
505
+ return typeof body === "object" && body !== null;
506
+ }
507
+
508
+ // src/core.ts
509
+ function unwrap(result) {
510
+ if (result.error !== void 0 || !result.response.ok) {
511
+ throw new SpacebringError(result.response.status, result.error);
512
+ }
513
+ return result.data;
514
+ }
515
+ function unwrapProp(result, key) {
516
+ const value = unwrap(result)?.[key];
517
+ if (value === void 0 || value === null) {
518
+ throw new SpacebringError(result.response.status, {
519
+ message: `Response is missing the "${String(key)}" property`
520
+ });
521
+ }
522
+ return value;
523
+ }
524
+ async function* paginate(fetchPage, itemsKey) {
525
+ let token;
526
+ do {
527
+ const page = await fetchPage(token);
528
+ const items = page[itemsKey] ?? [];
529
+ yield* items;
530
+ const next = page.nextPageToken;
531
+ if (next !== void 0 && next === token) {
532
+ throw new Error("Pagination did not advance: the API returned the same nextPageToken twice");
533
+ }
534
+ token = next;
535
+ } while (token);
536
+ }
537
+
538
+ // src/generated/resources/altCurrencies.ts
539
+ function createAltcurrencies(client, defaults) {
540
+ return {
541
+ /**
542
+ * Retrieve alt currencies
543
+ *
544
+ * Retrieve all alt currencies in the location.
545
+ */
546
+ async list(query) {
547
+ return unwrap(await client.GET("/alt_currencies/v1", { params: { query } }));
548
+ },
549
+ /**
550
+ * Retrieve alt currencies — iterates every item across all pages.
551
+ *
552
+ * Retrieve all alt currencies in the location.
553
+ */
554
+ iterate(query) {
555
+ return paginate(
556
+ async (nextPageToken) => unwrap(await client.GET("/alt_currencies/v1", { params: { query: { ...query, nextPageToken } } })),
557
+ "altCurrencies"
558
+ );
559
+ },
560
+ /** Create an alt currency */
561
+ async create(body) {
562
+ return unwrapProp(await client.POST("/alt_currencies/v1", { body }), "altCurrency");
563
+ },
564
+ /** Update an alt currency */
565
+ async update(id, body) {
566
+ return unwrap(await client.PATCH("/alt_currencies/v1/{id}", { params: { path: { id } }, body }));
567
+ },
568
+ /** Delete an alt currency */
569
+ async delete(id) {
570
+ return unwrap(await client.DELETE("/alt_currencies/v1/{id}", { params: { path: { id } } }));
571
+ }
572
+ };
573
+ }
574
+
575
+ // src/generated/resources/benefits.ts
576
+ function createBenefits(client, defaults) {
577
+ return {
578
+ /**
579
+ * Retrieve benefits
580
+ *
581
+ * Retrieve all benefits in the location.
582
+ */
583
+ async list(query) {
584
+ return unwrap(await client.GET("/benefits/v1", { params: { query } }));
585
+ },
586
+ /**
587
+ * Retrieve benefits — iterates every item across all pages.
588
+ *
589
+ * Retrieve all benefits in the location.
590
+ */
591
+ iterate(query) {
592
+ return paginate(
593
+ async (nextPageToken) => unwrap(await client.GET("/benefits/v1", { params: { query: { ...query, nextPageToken } } })),
594
+ "benefits"
595
+ );
596
+ },
597
+ /** Retrieve a benefit */
598
+ async get(benefitId) {
599
+ return unwrapProp(await client.GET("/benefits/v1/{benefitId}", { params: { path: { benefitId } } }), "benefit");
600
+ },
601
+ /** Create a benefit */
602
+ async create(body) {
603
+ return unwrap(await client.POST("/benefits/v1", { body }));
604
+ },
605
+ /** Update a benefit */
606
+ async update(benefitId, body) {
607
+ return unwrapProp(await client.PUT("/benefits/v1/{benefitId}", { params: { path: { benefitId } }, body }), "benefit");
608
+ },
609
+ /** Delete a benefit */
610
+ async delete(benefitId) {
611
+ return unwrap(await client.DELETE("/benefits/v1/{benefitId}", { params: { path: { benefitId } } }));
612
+ },
613
+ applications: {
614
+ /**
615
+ * Retrieve applications
616
+ *
617
+ * Retrieve all benefit applications in the location or for certain benefit.
618
+ */
619
+ async list(query) {
620
+ return unwrap(await client.GET("/benefits/applications/v1", { params: { query } }));
621
+ },
622
+ /**
623
+ * Retrieve applications — iterates every item across all pages.
624
+ *
625
+ * Retrieve all benefit applications in the location or for certain benefit.
626
+ */
627
+ iterate(query) {
628
+ return paginate(
629
+ async (nextPageToken) => unwrap(await client.GET("/benefits/applications/v1", { params: { query: { ...query, nextPageToken } } })),
630
+ "applications"
631
+ );
632
+ },
633
+ /**
634
+ * Retrieve an application
635
+ *
636
+ * Retrieve a benefit application by id.
637
+ */
638
+ async get(benefitApplicationId) {
639
+ return unwrapProp(await client.GET("/benefits/applications/v1/{benefitApplicationId}", { params: { path: { benefitApplicationId } } }), "application");
640
+ },
641
+ /** Apply for a benefit */
642
+ async create(body) {
643
+ return unwrapProp(await client.POST("/benefits/applications/v1", { body }), "application");
644
+ }
645
+ },
646
+ categories: {
647
+ /**
648
+ * Retrieve categories
649
+ *
650
+ * Retrieve all benefit categories in the location.
651
+ */
652
+ async list(query) {
653
+ return unwrapProp(await client.GET("/benefits/categories/v1", { params: { query } }), "categories");
654
+ },
655
+ /**
656
+ * Get a category
657
+ *
658
+ * Get a benefit category.
659
+ */
660
+ async get(categoryId) {
661
+ return unwrapProp(await client.GET("/benefits/categories/v1/{categoryId}", { params: { path: { categoryId } } }), "category");
662
+ },
663
+ /**
664
+ * Create a category
665
+ *
666
+ * Create a benefit category.
667
+ */
668
+ async create(body) {
669
+ return unwrapProp(await client.POST("/benefits/categories/v1", { body }), "category");
670
+ },
671
+ /**
672
+ * Update a category
673
+ *
674
+ * Update a benefit category.
675
+ */
676
+ async update(categoryId, body) {
677
+ return unwrapProp(await client.PUT("/benefits/categories/v1/{categoryId}", { params: { path: { categoryId } }, body }), "category");
678
+ },
679
+ /**
680
+ * Delete a category
681
+ *
682
+ * Delete a benefit category.
683
+ */
684
+ async delete(categoryId) {
685
+ return unwrap(await client.DELETE("/benefits/categories/v1/{categoryId}", { params: { path: { categoryId } } }));
686
+ }
687
+ }
688
+ };
689
+ }
690
+
691
+ // src/generated/resources/billing.ts
692
+ function createBilling(client, defaults) {
693
+ return {
694
+ creditNotes: {
695
+ /**
696
+ * Retrieve credit notes
697
+ *
698
+ * Retrieve all credit notes for a specific invoice or location. One of invoiceRef or locationRef is required.
699
+ */
700
+ async list(query) {
701
+ return unwrap(await client.GET("/billing/credit_notes/v1", { params: { query } }));
702
+ },
703
+ /**
704
+ * Retrieve credit notes — iterates every item across all pages.
705
+ *
706
+ * Retrieve all credit notes for a specific invoice or location. One of invoiceRef or locationRef is required.
707
+ */
708
+ iterate(query) {
709
+ return paginate(
710
+ async (nextPageToken) => unwrap(await client.GET("/billing/credit_notes/v1", { params: { query: { ...query, nextPageToken } } })),
711
+ "creditNotes"
712
+ );
713
+ },
714
+ /**
715
+ * Retrieve a credit note
716
+ *
717
+ * Retrieve a specific credit note.
718
+ */
719
+ async get(id) {
720
+ return unwrapProp(await client.GET("/billing/credit_notes/v1/{id}", { params: { path: { id } } }), "creditNote");
721
+ },
722
+ /**
723
+ * Create a credit note
724
+ *
725
+ * Create a credit note for an invoice.
726
+ */
727
+ async create(body) {
728
+ return unwrapProp(await client.POST("/billing/credit_notes/v1", { body }), "creditNote");
729
+ },
730
+ /** Update a credit note */
731
+ async update(id, body) {
732
+ return unwrap(await client.PATCH("/billing/credit_notes/v1/{id}", { params: { path: { id } }, body }));
733
+ },
734
+ /**
735
+ * Preview a credit note
736
+ *
737
+ * Preview a credit note for an invoice without creating it.
738
+ */
739
+ async preview(body) {
740
+ return unwrapProp(await client.POST("/billing/credit_notes/v1/preview", { body }), "creditNote");
741
+ }
742
+ },
743
+ invoices: {
744
+ /**
745
+ * Retrieve invoices
746
+ *
747
+ * Retrieve all invoices based on certain parameters.
748
+ */
749
+ async list(query) {
750
+ return unwrap(await client.GET("/billing/invoices/v1", { params: { query } }));
751
+ },
752
+ /**
753
+ * Retrieve invoices — iterates every item across all pages.
754
+ *
755
+ * Retrieve all invoices based on certain parameters.
756
+ */
757
+ iterate(query) {
758
+ return paginate(
759
+ async (nextPageToken) => unwrap(await client.GET("/billing/invoices/v1", { params: { query: { ...query, nextPageToken } } })),
760
+ "invoices"
761
+ );
762
+ },
763
+ /**
764
+ * Retrieve an invoice
765
+ *
766
+ * Retrieve a certain invoice.
767
+ */
768
+ async get(invoiceId) {
769
+ return unwrapProp(await client.GET("/billing/invoices/v1/{invoiceId}", { params: { path: { invoiceId } } }), "invoice");
770
+ },
771
+ /**
772
+ * Create an invoice
773
+ *
774
+ * Create an invoice for a member or a company.
775
+ */
776
+ async create(body) {
777
+ return unwrapProp(await client.POST("/billing/invoices/v1", { body }), "invoice");
778
+ },
779
+ /**
780
+ * Update an invoice
781
+ *
782
+ * Update a draft invoice.
783
+ */
784
+ async update(invoiceId, body) {
785
+ return unwrap(await client.PATCH("/billing/invoices/v1/{invoiceId}", { params: { path: { invoiceId } }, body }));
786
+ },
787
+ /**
788
+ * Delete an invoice
789
+ *
790
+ * Delete a draft invoice.
791
+ */
792
+ async delete(invoiceId) {
793
+ return unwrap(await client.DELETE("/billing/invoices/v1/{invoiceId}", { params: { path: { invoiceId } } }));
794
+ },
795
+ /**
796
+ * Cancel a payment
797
+ *
798
+ * Cancel a payment on an invoice.
799
+ */
800
+ async cancelPayment(invoiceId) {
801
+ return unwrap(await client.POST("/billing/invoices/v1/{invoiceId}/cancel_payment", { params: { path: { invoiceId } } }));
802
+ },
803
+ /**
804
+ * Duplicate an invoice
805
+ *
806
+ * Duplicate an invoice, creating a new draft invoice with the same items.
807
+ */
808
+ async duplicate(invoiceId) {
809
+ return unwrapProp(await client.POST("/billing/invoices/v1/{invoiceId}/duplicate", { params: { path: { invoiceId } } }), "invoice");
810
+ },
811
+ /**
812
+ * List invoice items
813
+ *
814
+ * List all items for a specific invoice.
815
+ */
816
+ async getItems(invoiceId) {
817
+ return unwrap(await client.GET("/billing/invoices/v1/{invoiceId}/items", { params: { path: { invoiceId } } }));
818
+ },
819
+ /**
820
+ * Retrieve the upcoming invoice
821
+ *
822
+ * Retrieve the upcoming invoice preview for a membership or subscription.
823
+ */
824
+ async getUpcoming(query) {
825
+ return unwrap(await client.GET("/billing/invoices/v1/upcoming", { params: { query } }));
826
+ },
827
+ /**
828
+ * Issue an invoice
829
+ *
830
+ * Issue (finalize) a draft invoice, making it ready for payment.
831
+ */
832
+ async issue(invoiceId, body) {
833
+ return unwrap(await client.POST("/billing/invoices/v1/{invoiceId}/issue", { params: { path: { invoiceId } }, body }));
834
+ },
835
+ /**
836
+ * Pay an invoice
837
+ *
838
+ * Mark an invoice as paid by `External Payment`.
839
+ */
840
+ async pay(invoiceId, body) {
841
+ return unwrap(await client.POST("/billing/invoices/v1/{invoiceId}/pay", { params: { path: { invoiceId } }, body }));
842
+ },
843
+ /**
844
+ * Resend an invoice
845
+ *
846
+ * Resend an issued invoice notification to the customer.
847
+ */
848
+ async resend(invoiceId) {
849
+ return unwrap(await client.POST("/billing/invoices/v1/{invoiceId}/resend", { params: { path: { invoiceId } } }));
850
+ },
851
+ /**
852
+ * Void an invoice
853
+ *
854
+ * Void an issued invoice.
855
+ */
856
+ async void(invoiceId) {
857
+ return unwrap(await client.PATCH("/billing/invoices/v1/{invoiceId}/void", { params: { path: { invoiceId } } }));
858
+ },
859
+ items: {
860
+ /**
861
+ * Retrieve an invoice item
862
+ *
863
+ * Retrieve a specific invoice item.
864
+ */
865
+ async get(id) {
866
+ return unwrapProp(await client.GET("/billing/invoices/v1/items/{id}", { params: { path: { id } } }), "invoiceItem");
867
+ },
868
+ /**
869
+ * Create an invoice item
870
+ *
871
+ * Create an item in an invoice.
872
+ */
873
+ async create(body) {
874
+ return unwrapProp(await client.POST("/billing/invoices/v1/items", { body }), "invoiceItem");
875
+ },
876
+ /**
877
+ * Update an invoice item
878
+ *
879
+ * Update an invoice item on a draft invoice.
880
+ */
881
+ async update(id, body) {
882
+ return unwrap(await client.PATCH("/billing/invoices/v1/items/{id}", { params: { path: { id } }, body }));
883
+ },
884
+ /**
885
+ * Delete an invoice item
886
+ *
887
+ * Delete an invoice item from a draft invoice.
888
+ */
889
+ async delete(id) {
890
+ return unwrap(await client.DELETE("/billing/invoices/v1/items/{id}", { params: { path: { id } } }));
891
+ },
892
+ /** List upcoming invoice items */
893
+ async getUpcoming(query) {
894
+ return unwrapProp(await client.GET("/billing/invoices/v1/items/upcoming", { params: { query } }), "invoiceItems");
895
+ }
896
+ }
897
+ }
898
+ };
899
+ }
900
+
901
+ // src/generated/resources/community.ts
902
+ function createCommunity(client, defaults) {
903
+ return {
904
+ companies: {
905
+ /**
906
+ * Retrieve companies
907
+ *
908
+ * Retrieve all companies.
909
+ */
910
+ async list(query) {
911
+ return unwrap(await client.GET("/community/companies/v1", { params: { query } }));
912
+ },
913
+ /**
914
+ * Retrieve companies — iterates every item across all pages.
915
+ *
916
+ * Retrieve all companies.
917
+ */
918
+ iterate(query) {
919
+ return paginate(
920
+ async (nextPageToken) => unwrap(await client.GET("/community/companies/v1", { params: { query: { ...query, nextPageToken } } })),
921
+ "companies"
922
+ );
923
+ },
924
+ /**
925
+ * Retrieve a company
926
+ *
927
+ * Retrieve a certain company.
928
+ */
929
+ async get(id) {
930
+ return unwrapProp(await client.GET("/community/companies/v1/{id}", { params: { path: { id } } }), "company");
931
+ },
932
+ /** Create a company */
933
+ async create(body) {
934
+ return unwrapProp(await client.POST("/community/companies/v1", { body }), "company");
935
+ },
936
+ /**
937
+ * Update a company
938
+ *
939
+ * Update a certain company.
940
+ */
941
+ async update(id, body) {
942
+ return unwrapProp(await client.PUT("/community/companies/v1/{id}", { params: { path: { id } }, body }), "company");
943
+ }
944
+ },
945
+ memberships: {
946
+ /**
947
+ * Retrieve memberships
948
+ *
949
+ * Retrieve all memberships.
950
+ */
951
+ async list(query) {
952
+ return unwrap(await client.GET("/community/memberships/v1", { params: { query } }));
953
+ },
954
+ /**
955
+ * Retrieve memberships — iterates every item across all pages.
956
+ *
957
+ * Retrieve all memberships.
958
+ */
959
+ iterate(query) {
960
+ return paginate(
961
+ async (nextPageToken) => unwrap(await client.GET("/community/memberships/v1", { params: { query: { ...query, nextPageToken } } })),
962
+ "memberships"
963
+ );
964
+ },
965
+ /**
966
+ * Retrieve a membership
967
+ *
968
+ * Retrieve a certain membership.
969
+ */
970
+ async get(id) {
971
+ return unwrapProp(await client.GET("/community/memberships/v1/{id}", { params: { path: { id } } }), "membership");
972
+ },
973
+ /**
974
+ * Create a membership
975
+ *
976
+ * Create a membership and send an email invitation to join if type is member.
977
+ */
978
+ async create(body) {
979
+ return unwrapProp(await client.POST("/community/memberships/v1", { body }), "membership");
980
+ },
981
+ /**
982
+ * Update a membership
983
+ *
984
+ * Update a certain membership.
985
+ */
986
+ async update(id, body) {
987
+ return unwrapProp(await client.PUT("/community/memberships/v1/{id}", { params: { path: { id } }, body }), "membership");
988
+ },
989
+ /**
990
+ * Delete a membership
991
+ *
992
+ * Delete a certain membership.
993
+ */
994
+ async delete(id) {
995
+ return unwrap(await client.DELETE("/community/memberships/v1/{id}", { params: { path: { id } } }));
996
+ },
997
+ /**
998
+ * Retrieve deleted memberships — iterates every item across all pages.
999
+ *
1000
+ * Retrieve all deleted memberships.
1001
+ */
1002
+ iterateDeleted(query) {
1003
+ return paginate(
1004
+ async (nextPageToken) => unwrap(await client.GET("/community/memberships/v1/deleted", { params: { query: { ...query, nextPageToken } } })),
1005
+ "memberships"
1006
+ );
1007
+ },
1008
+ /**
1009
+ * Retrieve deleted memberships
1010
+ *
1011
+ * Retrieve all deleted memberships.
1012
+ */
1013
+ async listDeleted(query) {
1014
+ return unwrap(await client.GET("/community/memberships/v1/deleted", { params: { query } }));
1015
+ }
1016
+ }
1017
+ };
1018
+ }
1019
+
1020
+ // src/generated/resources/contracts.ts
1021
+ function createContracts(client, defaults) {
1022
+ return {
1023
+ /**
1024
+ * Retrieve contracts
1025
+ *
1026
+ * Retrieve all contracts in the location.
1027
+ */
1028
+ async list(query) {
1029
+ return unwrap(await client.GET("/contracts/v1", { params: { query } }));
1030
+ },
1031
+ /**
1032
+ * Retrieve contracts — iterates every item across all pages.
1033
+ *
1034
+ * Retrieve all contracts in the location.
1035
+ */
1036
+ iterate(query) {
1037
+ return paginate(
1038
+ async (nextPageToken) => unwrap(await client.GET("/contracts/v1", { params: { query: { ...query, nextPageToken } } })),
1039
+ "contracts"
1040
+ );
1041
+ },
1042
+ /** Get a contract */
1043
+ async get(contractId) {
1044
+ return unwrapProp(await client.GET("/contracts/v1/{contractId}", { params: { path: { contractId } } }), "contract");
1045
+ },
1046
+ /** Create a contract */
1047
+ async create(body) {
1048
+ return unwrapProp(await client.POST("/contracts/v1", { body }), "contract");
1049
+ },
1050
+ /** Delete a contract */
1051
+ async delete(contractId) {
1052
+ return unwrap(await client.DELETE("/contracts/v1/{contractId}", { params: { path: { contractId } } }));
1053
+ },
1054
+ /** Issue a contract */
1055
+ async issue(contractId, body) {
1056
+ return unwrapProp(await client.POST("/contracts/v1/{contractId}/issue", { params: { path: { contractId } }, body }), "contract");
1057
+ },
1058
+ /** Terminate a contract */
1059
+ async terminate(contractId, body) {
1060
+ return unwrap(await client.PATCH("/contracts/v1/{contractId}/terminate", { params: { path: { contractId } }, body }));
1061
+ }
1062
+ };
1063
+ }
1064
+
1065
+ // src/generated/resources/discounts.ts
1066
+ function createDiscounts(client, defaults) {
1067
+ return {
1068
+ coupons: {
1069
+ /**
1070
+ * Retrieve coupons
1071
+ *
1072
+ * Retrieve all coupons in the location.
1073
+ */
1074
+ async list(query) {
1075
+ return unwrap(await client.GET("/discounts/coupons/v1", { params: { query } }));
1076
+ },
1077
+ /**
1078
+ * Retrieve coupons — iterates every item across all pages.
1079
+ *
1080
+ * Retrieve all coupons in the location.
1081
+ */
1082
+ iterate(query) {
1083
+ return paginate(
1084
+ async (nextPageToken) => unwrap(await client.GET("/discounts/coupons/v1", { params: { query: { ...query, nextPageToken } } })),
1085
+ "coupons"
1086
+ );
1087
+ },
1088
+ /** Get a coupon */
1089
+ async get(id) {
1090
+ return unwrapProp(await client.GET("/discounts/coupons/v1/{id}", { params: { path: { id } } }), "coupon");
1091
+ },
1092
+ /** Create a coupon */
1093
+ async create(body) {
1094
+ return unwrapProp(await client.POST("/discounts/coupons/v1", { body }), "coupon");
1095
+ },
1096
+ /** Update a coupon */
1097
+ async update(id, body) {
1098
+ return unwrap(await client.PATCH("/discounts/coupons/v1/{id}", { params: { path: { id } }, body }));
1099
+ },
1100
+ /** Delete a coupon */
1101
+ async delete(id) {
1102
+ return unwrap(await client.DELETE("/discounts/coupons/v1/{id}", { params: { path: { id } } }));
1103
+ }
1104
+ },
1105
+ promocodes: {
1106
+ /**
1107
+ * Retrieve promocodes
1108
+ *
1109
+ * Retrieve all promocodes.
1110
+ */
1111
+ async list(query) {
1112
+ return unwrapProp(await client.GET("/discounts/promocodes/v1", { params: { query } }), "promocodes");
1113
+ },
1114
+ /** Get a promocode */
1115
+ async get(id) {
1116
+ return unwrapProp(await client.GET("/discounts/promocodes/v1/{id}", { params: { path: { id } } }), "promocode");
1117
+ },
1118
+ /** Create a promocode */
1119
+ async create(body) {
1120
+ return unwrapProp(await client.POST("/discounts/promocodes/v1", { body }), "promocode");
1121
+ },
1122
+ /** Archive a promocode */
1123
+ async archive(id) {
1124
+ return unwrapProp(await client.PUT("/discounts/promocodes/v1/{id}/archive", { params: { path: { id } } }), "promocode");
1125
+ }
1126
+ },
1127
+ redemptions: {
1128
+ /**
1129
+ * Retrieve redemptions
1130
+ *
1131
+ * Retrieve all discount redemptions. Either couponRef or promocodeRef is required.
1132
+ */
1133
+ async list(query) {
1134
+ return unwrap(await client.GET("/discounts/redemptions/v1", { params: { query } }));
1135
+ },
1136
+ /**
1137
+ * Retrieve redemptions — iterates every item across all pages.
1138
+ *
1139
+ * Retrieve all discount redemptions. Either couponRef or promocodeRef is required.
1140
+ */
1141
+ iterate(query) {
1142
+ return paginate(
1143
+ async (nextPageToken) => unwrap(await client.GET("/discounts/redemptions/v1", { params: { query: { ...query, nextPageToken } } })),
1144
+ "redemptions"
1145
+ );
1146
+ }
1147
+ }
1148
+ };
1149
+ }
1150
+
1151
+ // src/generated/resources/events.ts
1152
+ function createEvents(client, defaults) {
1153
+ return {
1154
+ /** Retrieve events */
1155
+ async list(query) {
1156
+ return unwrap(await client.GET("/events/v1", { params: { query } }));
1157
+ },
1158
+ /** Retrieve an event */
1159
+ async get(id) {
1160
+ return unwrapProp(await client.GET("/events/v1/{id}", { params: { header: { "spacebring-network-id": defaults.networkId }, path: { id } } }), "event");
1161
+ },
1162
+ /** Create an event */
1163
+ async create(body) {
1164
+ return unwrapProp(await client.POST("/events/v1", { body }), "event");
1165
+ },
1166
+ /** Delete an event */
1167
+ async delete(id) {
1168
+ return unwrap(await client.DELETE("/events/v1/{id}", { params: { path: { id } } }));
1169
+ },
1170
+ /** Cancel an event */
1171
+ async cancel(id) {
1172
+ return unwrapProp(await client.PUT("/events/v1/{id}/cancel", { params: { path: { id } } }), "event");
1173
+ },
1174
+ /** Copy an event */
1175
+ async copy(id) {
1176
+ return unwrapProp(await client.POST("/events/v1/{id}/copy", { params: { path: { id } } }), "event");
1177
+ },
1178
+ tickets: {
1179
+ /**
1180
+ * Retrieve tickets
1181
+ *
1182
+ * Retrieve all event tickets.
1183
+ */
1184
+ async list(query) {
1185
+ return unwrap(await client.GET("/events/tickets/v1", { params: { query } }));
1186
+ },
1187
+ /**
1188
+ * Retrieve tickets — iterates every item across all pages.
1189
+ *
1190
+ * Retrieve all event tickets.
1191
+ */
1192
+ iterate(query) {
1193
+ return paginate(
1194
+ async (nextPageToken) => unwrap(await client.GET("/events/tickets/v1", { params: { query: { ...query, nextPageToken } } })),
1195
+ "tickets"
1196
+ );
1197
+ },
1198
+ /**
1199
+ * Retrieve a ticket
1200
+ *
1201
+ * Retrieve an event ticket.
1202
+ */
1203
+ async get(id) {
1204
+ return unwrapProp(await client.GET("/events/tickets/v1/{id}", { params: { path: { id } } }), "ticket");
1205
+ }
1206
+ }
1207
+ };
1208
+ }
1209
+
1210
+ // src/generated/resources/feed.ts
1211
+ function createFeed(client, defaults) {
1212
+ return {
1213
+ comments: {
1214
+ /**
1215
+ * Create a post comment
1216
+ *
1217
+ * Create a feed post comment.
1218
+ */
1219
+ async create(body) {
1220
+ return unwrapProp(await client.POST("/feed/comments/v1", { body }), "comment");
1221
+ },
1222
+ /** Delete a post comment */
1223
+ async delete(id) {
1224
+ return unwrap(await client.DELETE("/feed/comments/v1/{id}", { params: { path: { id } } }));
1225
+ },
1226
+ /** Create a like for a post comment */
1227
+ async createLike(id) {
1228
+ return unwrapProp(await client.POST("/feed/comments/v1/{id}/likes", { params: { path: { id } } }), "like");
1229
+ },
1230
+ /** Delete a like for a post comment */
1231
+ async deleteLike(id) {
1232
+ return unwrap(await client.DELETE("/feed/comments/v1/{id}/likes", { params: { path: { id } } }));
1233
+ }
1234
+ },
1235
+ posts: {
1236
+ /**
1237
+ * Get posts
1238
+ *
1239
+ * Get feed posts.
1240
+ */
1241
+ async list(query) {
1242
+ return unwrap(await client.GET("/feed/posts/v1", { params: { query } }));
1243
+ },
1244
+ /**
1245
+ * Get posts — iterates every item across all pages.
1246
+ *
1247
+ * Get feed posts.
1248
+ */
1249
+ iterate(query) {
1250
+ return paginate(
1251
+ async (nextPageToken) => unwrap(await client.GET("/feed/posts/v1", { params: { query: { ...query, nextPageToken } } })),
1252
+ "posts"
1253
+ );
1254
+ },
1255
+ /**
1256
+ * Get a post
1257
+ *
1258
+ * Get a feed post.
1259
+ */
1260
+ async get(id) {
1261
+ return unwrapProp(await client.GET("/feed/posts/v1/{id}", { params: { path: { id } } }), "post");
1262
+ },
1263
+ /**
1264
+ * Create a post
1265
+ *
1266
+ * Create a feed post.
1267
+ */
1268
+ async create(body) {
1269
+ return unwrapProp(await client.POST("/feed/posts/v1", { body }), "post");
1270
+ },
1271
+ /**
1272
+ * Update a post
1273
+ *
1274
+ * Update a feed post.
1275
+ */
1276
+ async update(id, body) {
1277
+ return unwrapProp(await client.PUT("/feed/posts/v1/{id}", { params: { path: { id } }, body }), "post");
1278
+ },
1279
+ /**
1280
+ * Delete a post
1281
+ *
1282
+ * Delete a feed post.
1283
+ */
1284
+ async delete(id) {
1285
+ return unwrap(await client.DELETE("/feed/posts/v1/{id}", { params: { path: { id } } }));
1286
+ },
1287
+ /** Create a like for a post */
1288
+ async createLike(id) {
1289
+ return unwrapProp(await client.POST("/feed/posts/v1/{id}/likes", { params: { path: { id } } }), "like");
1290
+ },
1291
+ /** Delete a like for a post */
1292
+ async deleteLike(id) {
1293
+ return unwrap(await client.DELETE("/feed/posts/v1/{id}/likes", { params: { path: { id } } }));
1294
+ },
1295
+ /** Get comments for a post */
1296
+ async getComments(id) {
1297
+ return unwrapProp(await client.GET("/feed/posts/v1/{id}/comments", { params: { path: { id } } }), "comments");
1298
+ },
1299
+ /** Get likes for a post */
1300
+ async getLikes(id) {
1301
+ return unwrapProp(await client.GET("/feed/posts/v1/{id}/likes", { params: { path: { id } } }), "likes");
1302
+ }
1303
+ }
1304
+ };
1305
+ }
1306
+
1307
+ // src/generated/resources/floors.ts
1308
+ function createFloors(client, defaults) {
1309
+ return {
1310
+ /** Get floors */
1311
+ async list(query) {
1312
+ return unwrap(await client.GET("/floors/v1", { params: { query } }));
1313
+ },
1314
+ /** Delete a floor */
1315
+ async delete(id) {
1316
+ return unwrap(await client.DELETE("/floors/v1/{id}", { params: { path: { id } } }));
1317
+ }
1318
+ };
1319
+ }
1320
+
1321
+ // src/generated/resources/guides.ts
1322
+ function createGuides(client, defaults) {
1323
+ return {
1324
+ /**
1325
+ * Retrieve guides
1326
+ *
1327
+ * Retrieve all guides for an organization. Requires locationRef. When using bearer token (non-basic auth), results are filtered by the user's access.
1328
+ */
1329
+ async list(query) {
1330
+ return unwrap(await client.GET("/guides/v1", { params: { query } }));
1331
+ },
1332
+ /**
1333
+ * Retrieve guides — iterates every item across all pages.
1334
+ *
1335
+ * Retrieve all guides for an organization. Requires locationRef. When using bearer token (non-basic auth), results are filtered by the user's access.
1336
+ */
1337
+ iterate(query) {
1338
+ return paginate(
1339
+ async (nextPageToken) => unwrap(await client.GET("/guides/v1", { params: { query: { ...query, nextPageToken } } })),
1340
+ "guides"
1341
+ );
1342
+ },
1343
+ /**
1344
+ * Retrieve a guide
1345
+ *
1346
+ * Retrieve a guide by id.
1347
+ */
1348
+ async get(guideId) {
1349
+ return unwrapProp(await client.GET("/guides/v1/{guideId}", { params: { path: { guideId } } }), "guide");
1350
+ },
1351
+ /**
1352
+ * Create a guide
1353
+ *
1354
+ * Create a guide in an organization.
1355
+ */
1356
+ async create(body) {
1357
+ return unwrapProp(await client.POST("/guides/v1", { body }), "guide");
1358
+ },
1359
+ /**
1360
+ * Update a guide
1361
+ *
1362
+ * Update a guide. At least one guide property must be provided.
1363
+ */
1364
+ async update(guideId, body) {
1365
+ return unwrapProp(await client.PATCH("/guides/v1/{guideId}", { params: { path: { guideId } }, body }), "guide");
1366
+ },
1367
+ /** Delete a guide */
1368
+ async delete(guideId) {
1369
+ return unwrap(await client.DELETE("/guides/v1/{guideId}", { params: { path: { guideId } } }));
1370
+ }
1371
+ };
1372
+ }
1373
+
1374
+ // src/generated/resources/locations.ts
1375
+ function createLocations(client, defaults) {
1376
+ return {
1377
+ /** Retrieve all locations */
1378
+ async list() {
1379
+ return unwrapProp(await client.GET("/locations/v1", {}), "locations");
1380
+ },
1381
+ /** Get a location */
1382
+ async get(locationId) {
1383
+ return unwrapProp(await client.GET("/locations/v1/{locationId}", { params: { path: { locationId } } }), "location");
1384
+ }
1385
+ };
1386
+ }
1387
+
1388
+ // src/generated/resources/networks.ts
1389
+ function createNetworks(client, defaults) {
1390
+ return {
1391
+ /**
1392
+ * Retrieve networks
1393
+ *
1394
+ * Retrieve all networks you are in.
1395
+ */
1396
+ async list() {
1397
+ return unwrapProp(await client.GET("/networks/v1", {}), "networks");
1398
+ }
1399
+ };
1400
+ }
1401
+
1402
+ // src/generated/resources/plans.ts
1403
+ function createPlans(client, defaults) {
1404
+ return {
1405
+ /**
1406
+ * Retrieve plans
1407
+ *
1408
+ * Retrieve all plans.
1409
+ */
1410
+ async list(query) {
1411
+ return unwrap(await client.GET("/plans/v1", { params: { query } }));
1412
+ },
1413
+ /**
1414
+ * Retrieve plans — iterates every item across all pages.
1415
+ *
1416
+ * Retrieve all plans.
1417
+ */
1418
+ iterate(query) {
1419
+ return paginate(
1420
+ async (nextPageToken) => unwrap(await client.GET("/plans/v1", { params: { query: { ...query, nextPageToken } } })),
1421
+ "plans"
1422
+ );
1423
+ },
1424
+ /**
1425
+ * Retrieve a plan
1426
+ *
1427
+ * Retrieve a certain plan.
1428
+ */
1429
+ async get(planId) {
1430
+ return unwrapProp(await client.GET("/plans/v1/{planId}", { params: { path: { planId } } }), "plan");
1431
+ },
1432
+ /** Create a plan */
1433
+ async create(body) {
1434
+ return unwrapProp(await client.POST("/plans/v1", { body }), "plan");
1435
+ },
1436
+ /**
1437
+ * Update a plan
1438
+ *
1439
+ * Update a certain plan.
1440
+ */
1441
+ async update(planId, body) {
1442
+ return unwrap(await client.PATCH("/plans/v1/{planId}", { params: { path: { planId } }, body }));
1443
+ },
1444
+ /**
1445
+ * Delete a plan
1446
+ *
1447
+ * Delete a certain plan.
1448
+ */
1449
+ async delete(planId) {
1450
+ return unwrap(await client.DELETE("/plans/v1/{planId}", { params: { path: { planId } } }));
1451
+ }
1452
+ };
1453
+ }
1454
+
1455
+ // src/generated/resources/registrations.ts
1456
+ function createRegistrations(client, defaults) {
1457
+ return {
1458
+ /**
1459
+ * Retrieve registrations
1460
+ *
1461
+ * Retrieve all registrations in network.
1462
+ */
1463
+ async list(query) {
1464
+ return unwrap(await client.GET("/registrations/v1", { params: { query } }));
1465
+ },
1466
+ /**
1467
+ * Retrieve registrations — iterates every item across all pages.
1468
+ *
1469
+ * Retrieve all registrations in network.
1470
+ */
1471
+ iterate(query) {
1472
+ return paginate(
1473
+ async (nextPageToken) => unwrap(await client.GET("/registrations/v1", { params: { query: { ...query, nextPageToken } } })),
1474
+ "registrations"
1475
+ );
1476
+ }
1477
+ };
1478
+ }
1479
+
1480
+ // src/generated/resources/resources.ts
1481
+ function createResources(client, defaults) {
1482
+ return {
1483
+ /**
1484
+ * Retrieve resources
1485
+ *
1486
+ * Retrieve resources in the location. Resources represent all kind of bookable items like rooms, hot desks, dedicated desks, parking lots.
1487
+ */
1488
+ async list(query) {
1489
+ return unwrap(await client.GET("/resources/v1", { params: { query } }));
1490
+ },
1491
+ /**
1492
+ * Retrieve resources — iterates every item across all pages.
1493
+ *
1494
+ * Retrieve resources in the location. Resources represent all kind of bookable items like rooms, hot desks, dedicated desks, parking lots.
1495
+ */
1496
+ iterate(query) {
1497
+ return paginate(
1498
+ async (nextPageToken) => unwrap(await client.GET("/resources/v1", { params: { query: { ...query, nextPageToken } } })),
1499
+ "resources"
1500
+ );
1501
+ },
1502
+ /**
1503
+ * Get a resource
1504
+ *
1505
+ * Get a certain resource.
1506
+ */
1507
+ async get(id) {
1508
+ return unwrapProp(await client.GET("/resources/v1/{id}", { params: { path: { id } } }), "resource");
1509
+ },
1510
+ /**
1511
+ * Create a resource
1512
+ *
1513
+ * Create a new resource in a location. The request body must match the schema exactly—unknown properties are rejected.
1514
+ */
1515
+ async create(body) {
1516
+ return unwrapProp(await client.POST("/resources/v1", { body }), "resource");
1517
+ },
1518
+ /**
1519
+ * Patch a resource
1520
+ *
1521
+ * Patch a certain resource.
1522
+ */
1523
+ async update(id, body) {
1524
+ return unwrap(await client.PATCH("/resources/v1/{id}", { params: { path: { id } }, body }));
1525
+ },
1526
+ bookings: {
1527
+ /**
1528
+ * Retrieve bookings
1529
+ *
1530
+ * Retrieve all bookings of resources.
1531
+ */
1532
+ async list(query) {
1533
+ return unwrap(await client.GET("/resources/bookings/v1", { params: { query } }));
1534
+ },
1535
+ /**
1536
+ * Retrieve bookings — iterates every item across all pages.
1537
+ *
1538
+ * Retrieve all bookings of resources.
1539
+ */
1540
+ iterate(query) {
1541
+ return paginate(
1542
+ async (nextPageToken) => unwrap(await client.GET("/resources/bookings/v1", { params: { query: { ...query, nextPageToken } } })),
1543
+ "bookings"
1544
+ );
1545
+ },
1546
+ /** Get a booking */
1547
+ async get(id) {
1548
+ return unwrapProp(await client.GET("/resources/bookings/v1/{id}", { params: { path: { id } } }), "booking");
1549
+ },
1550
+ /** Create a booking */
1551
+ async create(body) {
1552
+ return unwrapProp(await client.POST("/resources/bookings/v1", { body }), "booking");
1553
+ },
1554
+ /** Delete a booking */
1555
+ async delete(id) {
1556
+ return unwrap(await client.DELETE("/resources/bookings/v1/{id}", { params: { path: { id } } }));
1557
+ }
1558
+ }
1559
+ };
1560
+ }
1561
+
1562
+ // src/generated/resources/shop.ts
1563
+ function createShop(client, defaults) {
1564
+ return {
1565
+ categories: {
1566
+ /**
1567
+ * Retrieve categories
1568
+ *
1569
+ * Retrieve all shop categories in the location.
1570
+ */
1571
+ async list(query) {
1572
+ return unwrapProp(await client.GET("/shop/categories/v1", { params: { query } }), "categories");
1573
+ },
1574
+ /**
1575
+ * Get a category
1576
+ *
1577
+ * Get a shop category.
1578
+ */
1579
+ async get(categoryId) {
1580
+ return unwrapProp(await client.GET("/shop/categories/v1/{categoryId}", { params: { path: { categoryId } } }), "category");
1581
+ },
1582
+ /**
1583
+ * Create a category
1584
+ *
1585
+ * Create a shop category.
1586
+ */
1587
+ async create(body) {
1588
+ return unwrapProp(await client.POST("/shop/categories/v1", { body }), "category");
1589
+ },
1590
+ /**
1591
+ * Update a category
1592
+ *
1593
+ * Update a shop category.
1594
+ */
1595
+ async update(categoryId, body) {
1596
+ return unwrapProp(await client.PUT("/shop/categories/v1/{categoryId}", { params: { path: { categoryId } }, body }), "category");
1597
+ },
1598
+ /**
1599
+ * Delete a category
1600
+ *
1601
+ * Delete a shop category.
1602
+ */
1603
+ async delete(categoryId) {
1604
+ return unwrap(await client.DELETE("/shop/categories/v1/{categoryId}", { params: { path: { categoryId } } }));
1605
+ }
1606
+ },
1607
+ orders: {
1608
+ /**
1609
+ * Retrieve orders
1610
+ *
1611
+ * Retrieve all orders of products from shop.
1612
+ */
1613
+ async list(query) {
1614
+ return unwrap(await client.GET("/shop/orders/v1", { params: { query } }));
1615
+ },
1616
+ /**
1617
+ * Retrieve orders — iterates every item across all pages.
1618
+ *
1619
+ * Retrieve all orders of products from shop.
1620
+ */
1621
+ iterate(query) {
1622
+ return paginate(
1623
+ async (nextPageToken) => unwrap(await client.GET("/shop/orders/v1", { params: { query: { ...query, nextPageToken } } })),
1624
+ "orders"
1625
+ );
1626
+ },
1627
+ /**
1628
+ * Get an order
1629
+ *
1630
+ * Get a certain order.
1631
+ */
1632
+ async get(orderId) {
1633
+ return unwrapProp(await client.GET("/shop/orders/v1/{orderId}", { params: { path: { orderId } } }), "order");
1634
+ }
1635
+ },
1636
+ products: {
1637
+ /**
1638
+ * Retrieve products
1639
+ *
1640
+ * Retrieve products from shop.
1641
+ */
1642
+ async list(query) {
1643
+ return unwrap(await client.GET("/shop/products/v1", { params: { query } }));
1644
+ },
1645
+ /**
1646
+ * Retrieve products — iterates every item across all pages.
1647
+ *
1648
+ * Retrieve products from shop.
1649
+ */
1650
+ iterate(query) {
1651
+ return paginate(
1652
+ async (nextPageToken) => unwrap(await client.GET("/shop/products/v1", { params: { query: { ...query, nextPageToken } } })),
1653
+ "products"
1654
+ );
1655
+ },
1656
+ /**
1657
+ * Get a product
1658
+ *
1659
+ * Get a certain product.
1660
+ */
1661
+ async get(productId) {
1662
+ return unwrapProp(await client.GET("/shop/products/v1/{productId}", { params: { path: { productId } } }), "product");
1663
+ },
1664
+ /**
1665
+ * Create a product
1666
+ *
1667
+ * Create a product in shop.
1668
+ */
1669
+ async create(body) {
1670
+ return unwrapProp(await client.POST("/shop/products/v1", { body }), "product");
1671
+ },
1672
+ /**
1673
+ * Update a product
1674
+ *
1675
+ * Update a certain product.
1676
+ */
1677
+ async update(productId, body) {
1678
+ return unwrapProp(await client.PUT("/shop/products/v1/{productId}", { params: { path: { productId } }, body }), "product");
1679
+ },
1680
+ /**
1681
+ * Delete a product
1682
+ *
1683
+ * Delete a certain product.
1684
+ */
1685
+ async delete(productId) {
1686
+ return unwrap(await client.DELETE("/shop/products/v1/{productId}", { params: { path: { productId } } }));
1687
+ }
1688
+ }
1689
+ };
1690
+ }
1691
+
1692
+ // src/generated/resources/subscriptions.ts
1693
+ function createSubscriptions(client, defaults) {
1694
+ return {
1695
+ /** Retrieve subscriptions */
1696
+ async list(query) {
1697
+ return unwrap(await client.GET("/subscriptions/v1", { params: { query } }));
1698
+ },
1699
+ /** Retrieve subscriptions — iterates every item across all pages. */
1700
+ iterate(query) {
1701
+ return paginate(
1702
+ async (nextPageToken) => unwrap(await client.GET("/subscriptions/v1", { params: { query: { ...query, nextPageToken } } })),
1703
+ "subscriptions"
1704
+ );
1705
+ },
1706
+ /**
1707
+ * Retrieve a subscription
1708
+ *
1709
+ * Retrieve a certain subscription.
1710
+ */
1711
+ async get(id) {
1712
+ return unwrapProp(await client.GET("/subscriptions/v1/{id}", { params: { path: { id } } }), "subscription");
1713
+ },
1714
+ /**
1715
+ * Create a subscription
1716
+ *
1717
+ * Create a subscription for a membership or company.
1718
+ */
1719
+ async create(body) {
1720
+ return unwrapProp(await client.POST("/subscriptions/v1", { body }), "subscription");
1721
+ },
1722
+ /**
1723
+ * Update a subscription
1724
+ *
1725
+ * Update a certain subscription.
1726
+ */
1727
+ async update(id, body) {
1728
+ return unwrap(await client.PATCH("/subscriptions/v1/{id}", { params: { path: { id } }, body }));
1729
+ },
1730
+ /**
1731
+ * Delete a subscription
1732
+ *
1733
+ * Delete a certain subscription.
1734
+ */
1735
+ async delete(id) {
1736
+ return unwrap(await client.DELETE("/subscriptions/v1/{id}", { params: { path: { id } } }));
1737
+ },
1738
+ /** Create a subscription item */
1739
+ async createItem(id, body) {
1740
+ return unwrapProp(await client.POST("/subscriptions/v1/{id}/items", { params: { path: { id } }, body }), "subscription");
1741
+ },
1742
+ /** Delete a subscription item */
1743
+ async deleteItem(id, itemId) {
1744
+ return unwrap(await client.DELETE("/subscriptions/v1/{id}/items/{itemId}", { params: { path: { id, itemId } } }));
1745
+ },
1746
+ /** Update a subscription item */
1747
+ async updateItem(id, itemId, body) {
1748
+ return unwrap(await client.PATCH("/subscriptions/v1/{id}/items/{itemId}", { params: { path: { id, itemId } }, body }));
1749
+ }
1750
+ };
1751
+ }
1752
+
1753
+ // src/generated/resources/support.ts
1754
+ function createSupport(client, defaults) {
1755
+ return {
1756
+ tickets: {
1757
+ /**
1758
+ * Retrieve tickets
1759
+ *
1760
+ * Retrieve all support tickets.
1761
+ */
1762
+ async list(query) {
1763
+ return unwrap(await client.GET("/support/tickets/v1", { params: { query } }));
1764
+ },
1765
+ /**
1766
+ * Retrieve tickets — iterates every item across all pages.
1767
+ *
1768
+ * Retrieve all support tickets.
1769
+ */
1770
+ iterate(query) {
1771
+ return paginate(
1772
+ async (nextPageToken) => unwrap(await client.GET("/support/tickets/v1", { params: { query: { ...query, nextPageToken } } })),
1773
+ "tickets"
1774
+ );
1775
+ },
1776
+ /**
1777
+ * Retrieve a ticket
1778
+ *
1779
+ * Retrieve a support ticket.
1780
+ */
1781
+ async get(id) {
1782
+ return unwrap(await client.GET("/support/tickets/v1/{id}", { params: { path: { id } } }));
1783
+ },
1784
+ /**
1785
+ * Create a ticket
1786
+ *
1787
+ * Create a support ticket.
1788
+ */
1789
+ async create(body) {
1790
+ return unwrap(await client.POST("/support/tickets/v1", { body }));
1791
+ },
1792
+ /**
1793
+ * Update a ticket's assignee
1794
+ *
1795
+ * Update support ticket assignee.
1796
+ */
1797
+ async updateAssignee(id, body) {
1798
+ return unwrap(await client.PUT("/support/tickets/v1/{id}/assignee", { params: { path: { id } }, body }));
1799
+ },
1800
+ /**
1801
+ * Update a ticket's status
1802
+ *
1803
+ * Update support ticket status.
1804
+ */
1805
+ async updateStatus(id, body) {
1806
+ return unwrap(await client.PUT("/support/tickets/v1/{id}/status", { params: { path: { id } }, body }));
1807
+ },
1808
+ /**
1809
+ * Update a ticket's type
1810
+ *
1811
+ * Update a support ticket type.
1812
+ */
1813
+ async updateType(id, body) {
1814
+ return unwrap(await client.PATCH("/support/tickets/v1/{id}/type", { params: { path: { id } }, body }));
1815
+ },
1816
+ comment: {
1817
+ /**
1818
+ * Create a ticket comment
1819
+ *
1820
+ * Create a support ticket comment.
1821
+ */
1822
+ async create(body) {
1823
+ return unwrapProp(await client.POST("/support/tickets/v1/comment", { body }), "activity");
1824
+ },
1825
+ /**
1826
+ * Delete a ticket comment
1827
+ *
1828
+ * Delete a support ticket comment.
1829
+ */
1830
+ async delete(id) {
1831
+ return unwrap(await client.DELETE("/support/tickets/v1/comment/{id}", { params: { path: { id } } }));
1832
+ }
1833
+ }
1834
+ }
1835
+ };
1836
+ }
1837
+
1838
+ // src/generated/resources/transactions.ts
1839
+ function createTransactions(client, defaults) {
1840
+ return {
1841
+ balances: {
1842
+ /**
1843
+ * Retrieve credit balance
1844
+ *
1845
+ * Retrieve credits balance.
1846
+ */
1847
+ async getCredits(id) {
1848
+ return unwrapProp(await client.GET("/transactions/v1/balances/{id}/credits", { params: { path: { id } } }), "balances");
1849
+ },
1850
+ /** Retrieve day passes balance */
1851
+ async getDayPasses(id) {
1852
+ return unwrapProp(await client.GET("/transactions/v1/balances/{id}/day_passes", { params: { path: { id } } }), "balances");
1853
+ }
1854
+ },
1855
+ credits: {
1856
+ /**
1857
+ * Retrieve credit transactions
1858
+ *
1859
+ * Retrieve credits transactions.
1860
+ */
1861
+ async list(query) {
1862
+ return unwrap(await client.GET("/transactions/credits/v1", { params: { query } }));
1863
+ },
1864
+ /**
1865
+ * Retrieve credit transactions — iterates every item across all pages.
1866
+ *
1867
+ * Retrieve credits transactions.
1868
+ */
1869
+ iterate(query) {
1870
+ return paginate(
1871
+ async (nextPageToken) => unwrap(await client.GET("/transactions/credits/v1", { params: { query: { ...query, nextPageToken } } })),
1872
+ "transactions"
1873
+ );
1874
+ },
1875
+ /**
1876
+ * Create a credit transaction
1877
+ *
1878
+ * Create a credits transaction.
1879
+ */
1880
+ async create(body) {
1881
+ return unwrapProp(await client.POST("/transactions/credits/v1", { body }), "transaction");
1882
+ }
1883
+ },
1884
+ dayPasses: {
1885
+ /**
1886
+ * Retrieve day pass transactions
1887
+ *
1888
+ * Retrieve day passes transactions.
1889
+ */
1890
+ async list(query) {
1891
+ return unwrap(await client.GET("/transactions/day_passes/v1", { params: { query } }));
1892
+ },
1893
+ /**
1894
+ * Retrieve day pass transactions — iterates every item across all pages.
1895
+ *
1896
+ * Retrieve day passes transactions.
1897
+ */
1898
+ iterate(query) {
1899
+ return paginate(
1900
+ async (nextPageToken) => unwrap(await client.GET("/transactions/day_passes/v1", { params: { query: { ...query, nextPageToken } } })),
1901
+ "transactions"
1902
+ );
1903
+ },
1904
+ /**
1905
+ * Create a day pass transaction
1906
+ *
1907
+ * Create a day passes transaction.
1908
+ */
1909
+ async create(body) {
1910
+ return unwrapProp(await client.POST("/transactions/day_passes/v1", { body }), "transaction");
1911
+ }
1912
+ },
1913
+ money: {
1914
+ /** Retrieve money transactions */
1915
+ async list(query) {
1916
+ return unwrap(await client.GET("/transactions/money/v1", { params: { query } }));
1917
+ },
1918
+ /** Retrieve money transactions — iterates every item across all pages. */
1919
+ iterate(query) {
1920
+ return paginate(
1921
+ async (nextPageToken) => unwrap(await client.GET("/transactions/money/v1", { params: { query: { ...query, nextPageToken } } })),
1922
+ "transactions"
1923
+ );
1924
+ },
1925
+ /** Retrieve a money transaction */
1926
+ async get(id) {
1927
+ return unwrapProp(await client.GET("/transactions/money/v1/{id}", { params: { path: { id } } }), "transaction");
1928
+ }
1929
+ }
1930
+ };
1931
+ }
1932
+
1933
+ // src/generated/resources/visitors.ts
1934
+ function createVisitors(client, defaults) {
1935
+ return {
1936
+ contacts: {
1937
+ /** Get contacts */
1938
+ async list(query) {
1939
+ return unwrap(await client.GET("/visitors/contacts/v1", { params: { query } }));
1940
+ },
1941
+ /** Get contacts — iterates every item across all pages. */
1942
+ iterate(query) {
1943
+ return paginate(
1944
+ async (nextPageToken) => unwrap(await client.GET("/visitors/contacts/v1", { params: { query: { ...query, nextPageToken } } })),
1945
+ "contacts"
1946
+ );
1947
+ },
1948
+ /** Get a contact */
1949
+ async get(contactId) {
1950
+ return unwrapProp(await client.GET("/visitors/contacts/v1/{contactId}", { params: { path: { contactId } } }), "contact");
1951
+ },
1952
+ /** Create a contact */
1953
+ async create(body) {
1954
+ return unwrapProp(await client.POST("/visitors/contacts/v1", { body }), "contact");
1955
+ }
1956
+ },
1957
+ requests: {
1958
+ /** Get requests */
1959
+ async list(query) {
1960
+ return unwrap(await client.GET("/visitors/requests/v1", { params: { query } }));
1961
+ },
1962
+ /** Get requests — iterates every item across all pages. */
1963
+ iterate(query) {
1964
+ return paginate(
1965
+ async (nextPageToken) => unwrap(await client.GET("/visitors/requests/v1", { params: { query: { ...query, nextPageToken } } })),
1966
+ "requests"
1967
+ );
1968
+ },
1969
+ /** Retrieve a request */
1970
+ async get(id) {
1971
+ return unwrapProp(await client.GET("/visitors/requests/v1/{id}", { params: { path: { id } } }), "request");
1972
+ },
1973
+ /** Create a request */
1974
+ async create(body) {
1975
+ return unwrapProp(await client.POST("/visitors/requests/v1", { body }), "request");
1976
+ },
1977
+ /** Approve a request */
1978
+ async approve(id) {
1979
+ return unwrapProp(await client.POST("/visitors/requests/v1/{id}/approve", { params: { path: { id } } }), "visit");
1980
+ },
1981
+ /** Reject a request */
1982
+ async reject(id) {
1983
+ return unwrap(await client.POST("/visitors/requests/v1/{id}/reject", { params: { path: { id } } }));
1984
+ }
1985
+ },
1986
+ visits: {
1987
+ /** Retrieve visits */
1988
+ async list(query) {
1989
+ return unwrap(await client.GET("/visitors/visits/v1", { params: { query } }));
1990
+ },
1991
+ /** Retrieve visits — iterates every item across all pages. */
1992
+ iterate(query) {
1993
+ return paginate(
1994
+ async (nextPageToken) => unwrap(await client.GET("/visitors/visits/v1", { params: { query: { ...query, nextPageToken } } })),
1995
+ "visits"
1996
+ );
1997
+ },
1998
+ /**
1999
+ * Retrieve a visit
2000
+ *
2001
+ * Retrieve a visit by id.
2002
+ */
2003
+ async get(id) {
2004
+ return unwrapProp(await client.GET("/visitors/visits/v1/{id}", { params: { path: { id } } }), "visit");
2005
+ },
2006
+ /** Create a visit */
2007
+ async create(body) {
2008
+ return unwrapProp(await client.POST("/visitors/visits/v1", { body }), "visit");
2009
+ },
2010
+ /**
2011
+ * Update a visit
2012
+ *
2013
+ * Update a visit by id.
2014
+ */
2015
+ async update(id, body) {
2016
+ return unwrapProp(await client.PUT("/visitors/visits/v1/{id}", { params: { path: { id } }, body }), "visit");
2017
+ },
2018
+ /**
2019
+ * Delete a visit
2020
+ *
2021
+ * Delete a visit by id.
2022
+ */
2023
+ async delete(id) {
2024
+ return unwrap(await client.DELETE("/visitors/visits/v1/{id}", { params: { path: { id } } }));
2025
+ },
2026
+ /** Check in a visit */
2027
+ async checkIn(body) {
2028
+ return unwrapProp(await client.POST("/visitors/visits/v1/checkin", { body }), "visit");
2029
+ },
2030
+ /** Check out a visit */
2031
+ async checkOut(body) {
2032
+ return unwrapProp(await client.POST("/visitors/visits/v1/checkout", { body }), "visit");
2033
+ }
2034
+ }
2035
+ };
2036
+ }
2037
+
2038
+ // src/generated/resources/index.ts
2039
+ function createResources2(client, defaults) {
2040
+ return {
2041
+ altCurrencies: createAltcurrencies(client, defaults),
2042
+ benefits: createBenefits(client, defaults),
2043
+ billing: createBilling(client, defaults),
2044
+ community: createCommunity(client, defaults),
2045
+ contracts: createContracts(client, defaults),
2046
+ discounts: createDiscounts(client, defaults),
2047
+ events: createEvents(client, defaults),
2048
+ feed: createFeed(client, defaults),
2049
+ floors: createFloors(client, defaults),
2050
+ guides: createGuides(client, defaults),
2051
+ locations: createLocations(client, defaults),
2052
+ networks: createNetworks(client, defaults),
2053
+ plans: createPlans(client, defaults),
2054
+ registrations: createRegistrations(client, defaults),
2055
+ resources: createResources(client, defaults),
2056
+ shop: createShop(client, defaults),
2057
+ subscriptions: createSubscriptions(client, defaults),
2058
+ support: createSupport(client, defaults),
2059
+ transactions: createTransactions(client, defaults),
2060
+ visitors: createVisitors(client, defaults)
2061
+ };
2062
+ }
2063
+
2064
+ // src/client.ts
2065
+ var Spacebring = class {
2066
+ /** Typed openapi-fetch client — escape hatch for endpoints or options the facade does not cover. */
2067
+ raw;
2068
+ constructor(config) {
2069
+ const headers = {
2070
+ Authorization: `Basic ${toBase64(`${config.clientId}:${config.clientSecret}`)}`
2071
+ };
2072
+ if (config.networkId) {
2073
+ headers["spacebring-network-id"] = config.networkId;
2074
+ }
2075
+ this.raw = createClient({
2076
+ baseUrl: config.baseUrl ?? "https://api.spacebring.com",
2077
+ headers,
2078
+ fetch: config.fetch
2079
+ });
2080
+ Object.assign(this, createResources2(this.raw, { networkId: config.networkId }));
2081
+ }
2082
+ };
2083
+ function toBase64(value) {
2084
+ if (typeof Buffer !== "undefined") {
2085
+ return Buffer.from(value, "utf8").toString("base64");
2086
+ }
2087
+ let binary = "";
2088
+ for (const byte of new TextEncoder().encode(value)) {
2089
+ binary += String.fromCharCode(byte);
2090
+ }
2091
+ return btoa(binary);
2092
+ }
2093
+ // Annotate the CommonJS export names for ESM import in node:
2094
+ 0 && (module.exports = {
2095
+ Spacebring,
2096
+ SpacebringError
2097
+ });
2098
+ //# sourceMappingURL=index.cjs.map