@ticketlayer/backstage 0.2.1 → 1.0.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/client.js CHANGED
@@ -42,6 +42,43 @@ function describeRuntime() {
42
42
  exports.SDK_CLIENT_HEADER = `${version_1.SDK_NAME.replace(/^@/, '').replace('/', '-')}/${version_1.SDK_VERSION} (${describeRuntime()})`;
43
43
  class BackstageClient {
44
44
  constructor(config) {
45
+ this.identityProviders = {
46
+ discover: async (options) => {
47
+ const params = new URLSearchParams();
48
+ if (options?.org !== undefined)
49
+ params.append('org', String(options.org));
50
+ const queryString = params.toString();
51
+ const requestPath = queryString ? `/.well-known/identity-provider?${queryString}` : `/.well-known/identity-provider`;
52
+ const response = await this.request(requestPath, {
53
+ method: 'GET'
54
+ });
55
+ return response;
56
+ },
57
+ list: async (options) => {
58
+ const params = new URLSearchParams();
59
+ if (options?.organisationId !== undefined)
60
+ params.append('organisationId', String(options.organisationId));
61
+ const queryString = params.toString();
62
+ const requestPath = queryString ? `/identity-providers?${queryString}` : `/identity-providers`;
63
+ const response = await this.request(requestPath, {
64
+ method: 'GET'
65
+ });
66
+ return response.providers;
67
+ },
68
+ get: async (id) => {
69
+ const response = await this.request(`/identity-providers/${id}`, {
70
+ method: 'GET'
71
+ });
72
+ return response.provider;
73
+ },
74
+ update: async (id, request) => {
75
+ const response = await this.request(`/identity-providers/${id}`, {
76
+ method: 'PATCH',
77
+ body: JSON.stringify(request)
78
+ });
79
+ return response.provider;
80
+ }
81
+ };
45
82
  this.meta = {
46
83
  versions: async () => {
47
84
  const response = await this.request(`/meta/versions`, {
@@ -80,15 +117,6 @@ class BackstageClient {
80
117
  this.setAccessToken(response.accessToken);
81
118
  this.setRefreshToken(response.refreshToken);
82
119
  return response;
83
- },
84
- federate: async (request) => {
85
- const response = await this.request(`/auth/federate`, {
86
- method: 'POST',
87
- body: JSON.stringify(request)
88
- });
89
- this.setAccessToken(response.accessToken);
90
- this.setRefreshToken(response.refreshToken);
91
- return response;
92
120
  }
93
121
  };
94
122
  this.me = {
@@ -124,22 +152,14 @@ class BackstageClient {
124
152
  return response;
125
153
  }
126
154
  };
127
- this.organisations = {
128
- get: async (id) => {
129
- const response = await this.request(`/organisations/${id}`, {
130
- method: 'GET'
131
- });
132
- return response.organisation;
133
- },
134
- update: async (id, request) => {
135
- const response = await this.request(`/organisations/${id}`, {
136
- method: 'PATCH',
155
+ this.accounts = {
156
+ create: async (request) => {
157
+ const response = await this.request(`/accounts`, {
158
+ method: 'POST',
137
159
  body: JSON.stringify(request)
138
160
  });
139
- return response.organisation;
140
- }
141
- };
142
- this.accounts = {
161
+ return response.account;
162
+ },
143
163
  list: async (options) => {
144
164
  const params = new URLSearchParams();
145
165
  if (options?.search !== undefined)
@@ -153,13 +173,6 @@ class BackstageClient {
153
173
  });
154
174
  return response.accounts;
155
175
  },
156
- create: async (request) => {
157
- const response = await this.request(`/accounts`, {
158
- method: 'POST',
159
- body: JSON.stringify(request)
160
- });
161
- return response.account;
162
- },
163
176
  get: async (id) => {
164
177
  const response = await this.request(`/accounts/${id}`, {
165
178
  method: 'GET'
@@ -180,30 +193,49 @@ class BackstageClient {
180
193
  return response;
181
194
  }
182
195
  };
183
- this.identityProviders = {
184
- list: async (options) => {
185
- const params = new URLSearchParams();
186
- if (options?.organisationId !== undefined)
187
- params.append('organisationId', String(options.organisationId));
188
- const queryString = params.toString();
189
- const requestPath = queryString ? `/identity-providers?${queryString}` : `/identity-providers`;
190
- const response = await this.request(requestPath, {
191
- method: 'GET'
196
+ this.partners = {
197
+ createAccount: async (request) => {
198
+ const response = await this.request(`/partners/accounts`, {
199
+ method: 'POST',
200
+ body: JSON.stringify(request)
192
201
  });
193
- return response.providers;
202
+ return response;
203
+ }
204
+ };
205
+ this.apiKeys = {
206
+ create: async (request) => {
207
+ const response = await this.request(`/api-keys`, {
208
+ method: 'POST',
209
+ body: JSON.stringify(request)
210
+ });
211
+ return response;
194
212
  },
195
- get: async (id) => {
196
- const response = await this.request(`/identity-providers/${id}`, {
213
+ list: async () => {
214
+ const response = await this.request(`/api-keys`, {
197
215
  method: 'GET'
198
216
  });
199
- return response.provider;
217
+ return response.apiKeys;
200
218
  },
201
- update: async (id, request) => {
202
- const response = await this.request(`/identity-providers/${id}`, {
203
- method: 'PATCH',
219
+ revoke: async (id) => {
220
+ const response = await this.request(`/api-keys/${id}`, {
221
+ method: 'DELETE'
222
+ });
223
+ return response.apiKey;
224
+ }
225
+ };
226
+ this.embedSessions = {
227
+ create: async (request) => {
228
+ const response = await this.request(`/embed/sessions`, {
229
+ method: 'POST',
204
230
  body: JSON.stringify(request)
205
231
  });
206
- return response.provider;
232
+ return response;
233
+ },
234
+ current: async () => {
235
+ const response = await this.request(`/embed/sessions/current`, {
236
+ method: 'GET'
237
+ });
238
+ return response;
207
239
  }
208
240
  };
209
241
  this.userInvitations = {
@@ -246,13 +278,54 @@ class BackstageClient {
246
278
  return response.invitation;
247
279
  }
248
280
  };
249
- this.roles = {
281
+ this.users = {
282
+ create: async (request) => {
283
+ const response = await this.request(`/users`, {
284
+ method: 'POST',
285
+ body: JSON.stringify(request)
286
+ });
287
+ return response;
288
+ },
250
289
  list: async () => {
251
- const response = await this.request(`/roles`, {
290
+ const response = await this.request(`/users`, {
252
291
  method: 'GET'
253
292
  });
254
- return response.roles;
293
+ return response;
294
+ },
295
+ get: async (id) => {
296
+ const response = await this.request(`/users/${id}`, {
297
+ method: 'GET'
298
+ });
299
+ return response;
300
+ },
301
+ update: async (id, request) => {
302
+ const response = await this.request(`/users/${id}`, {
303
+ method: 'PATCH',
304
+ body: JSON.stringify(request)
305
+ });
306
+ return response;
307
+ },
308
+ delete: async (id) => {
309
+ const response = await this.request(`/users/${id}`, {
310
+ method: 'DELETE'
311
+ });
312
+ return response;
313
+ },
314
+ addRole: async (usrId, request) => {
315
+ const response = await this.request(`/users/${usrId}/roles`, {
316
+ method: 'POST',
317
+ body: JSON.stringify(request)
318
+ });
319
+ return response;
255
320
  },
321
+ removeRole: async (usrId, rolId) => {
322
+ const response = await this.request(`/users/${usrId}/roles/${rolId}`, {
323
+ method: 'DELETE'
324
+ });
325
+ return response;
326
+ }
327
+ };
328
+ this.roles = {
256
329
  create: async (request) => {
257
330
  const response = await this.request(`/roles`, {
258
331
  method: 'POST',
@@ -260,6 +333,12 @@ class BackstageClient {
260
333
  });
261
334
  return response;
262
335
  },
336
+ list: async () => {
337
+ const response = await this.request(`/roles`, {
338
+ method: 'GET'
339
+ });
340
+ return response.roles;
341
+ },
263
342
  get: async (id) => {
264
343
  const response = await this.request(`/roles/${id}`, {
265
344
  method: 'GET'
@@ -320,53 +399,45 @@ class BackstageClient {
320
399
  return response.assignments;
321
400
  }
322
401
  };
323
- this.partners = {
324
- createAccount: async (request) => {
325
- const response = await this.request(`/partners/accounts`, {
326
- method: 'POST',
327
- body: JSON.stringify(request)
328
- });
329
- return response;
330
- }
331
- };
332
- this.apiKeys = {
402
+ this.organisations = {
333
403
  create: async (request) => {
334
- const response = await this.request(`/api-keys`, {
404
+ const response = await this.request(`/organisations`, {
335
405
  method: 'POST',
336
406
  body: JSON.stringify(request)
337
407
  });
338
408
  return response;
339
409
  },
340
- list: async () => {
341
- const response = await this.request(`/api-keys`, {
410
+ get: async (id) => {
411
+ const response = await this.request(`/organisations/${id}`, {
342
412
  method: 'GET'
343
413
  });
344
- return response.apiKeys;
414
+ return response.organisation;
345
415
  },
346
- revoke: async (id) => {
347
- const response = await this.request(`/api-keys/${id}`, {
348
- method: 'DELETE'
416
+ update: async (id, request) => {
417
+ const response = await this.request(`/organisations/${id}`, {
418
+ method: 'PATCH',
419
+ body: JSON.stringify(request)
349
420
  });
350
- return response.apiKey;
421
+ return response.organisation;
351
422
  }
352
423
  };
353
- this.embedSessions = {
354
- create: async (request) => {
355
- const response = await this.request(`/embed/sessions`, {
356
- method: 'POST',
357
- body: JSON.stringify(request)
358
- });
359
- return response;
360
- },
361
- current: async () => {
362
- const response = await this.request(`/embed/sessions/current`, {
424
+ this.plan = {
425
+ get: async () => {
426
+ const response = await this.request(`/plan`, {
363
427
  method: 'GET'
364
428
  });
365
- return response;
429
+ return response.plan;
366
430
  }
367
431
  };
368
432
  this.events = Object.assign((eventId) => ({
369
433
  occurrences: {
434
+ create: async (request) => {
435
+ const response = await this.request(`/events/${eventId}/occurrences`, {
436
+ method: 'POST',
437
+ body: JSON.stringify(request)
438
+ });
439
+ return response.eventOccurrence;
440
+ },
370
441
  list: async (options) => {
371
442
  const params = new URLSearchParams();
372
443
  if (options?.status !== undefined)
@@ -388,13 +459,6 @@ class BackstageClient {
388
459
  });
389
460
  return response;
390
461
  },
391
- create: async (request) => {
392
- const response = await this.request(`/events/${eventId}/occurrences`, {
393
- method: 'POST',
394
- body: JSON.stringify(request)
395
- });
396
- return response.eventOccurrence;
397
- },
398
462
  get: async (occurrenceId) => {
399
463
  const response = await this.request(`/events/${eventId}/occurrences/${occurrenceId}`, {
400
464
  method: 'GET'
@@ -416,12 +480,6 @@ class BackstageClient {
416
480
  }
417
481
  },
418
482
  priceschemes: {
419
- list: async () => {
420
- const response = await this.request(`/events/${eventId}/price-schemes`, {
421
- method: 'GET'
422
- });
423
- return response.priceSchemes;
424
- },
425
483
  create: async (request) => {
426
484
  const response = await this.request(`/events/${eventId}/price-schemes`, {
427
485
  method: 'POST',
@@ -429,6 +487,12 @@ class BackstageClient {
429
487
  });
430
488
  return response.priceScheme;
431
489
  },
490
+ list: async () => {
491
+ const response = await this.request(`/events/${eventId}/price-schemes`, {
492
+ method: 'GET'
493
+ });
494
+ return response.priceSchemes;
495
+ },
432
496
  get: async (priceSchemeId) => {
433
497
  const response = await this.request(`/events/${eventId}/price-schemes/${priceSchemeId}`, {
434
498
  method: 'GET'
@@ -450,6 +514,13 @@ class BackstageClient {
450
514
  }
451
515
  }
452
516
  }), {
517
+ create: async (request) => {
518
+ const response = await this.request(`/events`, {
519
+ method: 'POST',
520
+ body: JSON.stringify(request)
521
+ });
522
+ return response.event;
523
+ },
453
524
  list: async (options) => {
454
525
  const params = new URLSearchParams();
455
526
  if (options?.search !== undefined)
@@ -473,13 +544,6 @@ class BackstageClient {
473
544
  });
474
545
  return response;
475
546
  },
476
- create: async (request) => {
477
- const response = await this.request(`/events`, {
478
- method: 'POST',
479
- body: JSON.stringify(request)
480
- });
481
- return response.event;
482
- },
483
547
  get: async (id, options) => {
484
548
  const params = new URLSearchParams();
485
549
  if (options?.expand !== undefined)
@@ -503,21 +567,60 @@ class BackstageClient {
503
567
  method: 'DELETE'
504
568
  });
505
569
  return response;
506
- }
507
- });
508
- this.venues = Object.assign((id) => ({
509
- venuelayouts: {
510
- list: async (options) => {
511
- const params = new URLSearchParams();
512
- if (options?.search !== undefined)
513
- params.append('search', String(options.search));
514
- if (options?.status !== undefined)
515
- params.append('status', String(options.status));
516
- if (options?.accountId !== undefined)
517
- params.append('accountId', String(options.accountId));
518
- if (options?.page !== undefined)
519
- params.append('page', String(options.page));
520
- if (options?.limit !== undefined)
570
+ },
571
+ getLayout: async (eventId) => {
572
+ const response = await this.request(`/events/${eventId}/layout`, {
573
+ method: 'GET'
574
+ });
575
+ return response.layout;
576
+ },
577
+ validateLayoutChanges: async (eventId, request) => {
578
+ const response = await this.request(`/events/${eventId}/layout/validate`, {
579
+ method: 'POST',
580
+ body: JSON.stringify(request)
581
+ });
582
+ return response;
583
+ },
584
+ applyLayoutChanges: async (eventId, request) => {
585
+ const response = await this.request(`/events/${eventId}/layout/apply`, {
586
+ method: 'POST',
587
+ body: JSON.stringify(request)
588
+ });
589
+ return response;
590
+ },
591
+ getLayoutChangeResult: async (eventId, workflowId) => {
592
+ const response = await this.request(`/events/${eventId}/layout/apply/${workflowId}`, {
593
+ method: 'GET'
594
+ });
595
+ return response;
596
+ },
597
+ streamLayoutChangeProgress: async (eventId, workflowId) => {
598
+ const response = await this.request(`/events/${eventId}/layout/apply/${workflowId}/progress`, {
599
+ method: 'GET'
600
+ });
601
+ return response;
602
+ }
603
+ });
604
+ this.venues = Object.assign((id) => ({
605
+ venuelayouts: {
606
+ create: async (request) => {
607
+ const response = await this.request(`/venues/${id}/layouts`, {
608
+ method: 'POST',
609
+ body: JSON.stringify(request)
610
+ });
611
+ return response.venueLayout;
612
+ },
613
+ list: async (options) => {
614
+ const params = new URLSearchParams();
615
+ if (options?.search !== undefined)
616
+ params.append('search', String(options.search));
617
+ if (options?.status !== undefined)
618
+ params.append('status', String(options.status));
619
+ if (options?.accountId !== undefined)
620
+ params.append('accountId', String(options.accountId));
621
+ if (options?.page !== undefined)
622
+ params.append('page', String(options.page));
623
+ if (options?.limit !== undefined)
521
624
  params.append('limit', String(options.limit));
522
625
  const queryString = params.toString();
523
626
  const requestPath = queryString ? `/venues/${id}/layouts?${queryString}` : `/venues/${id}/layouts`;
@@ -526,13 +629,6 @@ class BackstageClient {
526
629
  });
527
630
  return response;
528
631
  },
529
- create: async (request) => {
530
- const response = await this.request(`/venues/${id}/layouts`, {
531
- method: 'POST',
532
- body: JSON.stringify(request)
533
- });
534
- return response.venueLayout;
535
- },
536
632
  get: async (layoutId) => {
537
633
  const response = await this.request(`/venues/${id}/layouts/${layoutId}`, {
538
634
  method: 'GET'
@@ -641,6 +737,13 @@ class BackstageClient {
641
737
  }
642
738
  }
643
739
  }), {
740
+ create: async (request) => {
741
+ const response = await this.request(`/venues`, {
742
+ method: 'POST',
743
+ body: JSON.stringify(request)
744
+ });
745
+ return response.venue;
746
+ },
644
747
  list: async (options) => {
645
748
  const params = new URLSearchParams();
646
749
  if (options?.search !== undefined)
@@ -660,13 +763,6 @@ class BackstageClient {
660
763
  });
661
764
  return response;
662
765
  },
663
- create: async (request) => {
664
- const response = await this.request(`/venues`, {
665
- method: 'POST',
666
- body: JSON.stringify(request)
667
- });
668
- return response.venue;
669
- },
670
766
  get: async (id) => {
671
767
  const response = await this.request(`/venues/${id}`, {
672
768
  method: 'GET'
@@ -694,6 +790,12 @@ class BackstageClient {
694
790
  });
695
791
  return response.packages;
696
792
  },
793
+ listAiPackages: async () => {
794
+ const response = await this.request(`/billing/ai/packages`, {
795
+ method: 'GET'
796
+ });
797
+ return response.packages;
798
+ },
697
799
  canSell: async (organisationId) => {
698
800
  const response = await this.request(`/organisations/${organisationId}/billing/can-sell`, {
699
801
  method: 'GET'
@@ -728,6 +830,32 @@ class BackstageClient {
728
830
  });
729
831
  return response;
730
832
  },
833
+ getAiBalance: async () => {
834
+ const response = await this.request(`/billing/ai/balance`, {
835
+ method: 'GET'
836
+ });
837
+ return response.aiBalance;
838
+ },
839
+ listAiTransactions: async (options) => {
840
+ const params = new URLSearchParams();
841
+ if (options?.page !== undefined)
842
+ params.append('page', String(options.page));
843
+ if (options?.limit !== undefined)
844
+ params.append('limit', String(options.limit));
845
+ const queryString = params.toString();
846
+ const requestPath = queryString ? `/billing/ai/transactions?${queryString}` : `/billing/ai/transactions`;
847
+ const response = await this.request(requestPath, {
848
+ method: 'GET'
849
+ });
850
+ return response.transactions;
851
+ },
852
+ createAiTopup: async (request) => {
853
+ const response = await this.request(`/billing/ai-topup`, {
854
+ method: 'POST',
855
+ body: JSON.stringify(request)
856
+ });
857
+ return response;
858
+ },
731
859
  listInvoices: async (options) => {
732
860
  const params = new URLSearchParams();
733
861
  if (options?.page !== undefined)
@@ -826,38 +954,6 @@ class BackstageClient {
826
954
  method: 'PUT'
827
955
  });
828
956
  return response.paymentMethod;
829
- },
830
- listAiPackages: async () => {
831
- const response = await this.request(`/billing/ai/packages`, {
832
- method: 'GET'
833
- });
834
- return response.packages;
835
- },
836
- getAiBalance: async () => {
837
- const response = await this.request(`/billing/ai/balance`, {
838
- method: 'GET'
839
- });
840
- return response.aiBalance;
841
- },
842
- listAiTransactions: async (options) => {
843
- const params = new URLSearchParams();
844
- if (options?.page !== undefined)
845
- params.append('page', String(options.page));
846
- if (options?.limit !== undefined)
847
- params.append('limit', String(options.limit));
848
- const queryString = params.toString();
849
- const requestPath = queryString ? `/billing/ai/transactions?${queryString}` : `/billing/ai/transactions`;
850
- const response = await this.request(requestPath, {
851
- method: 'GET'
852
- });
853
- return response.transactions;
854
- },
855
- createAiTopup: async (request) => {
856
- const response = await this.request(`/billing/ai-topup`, {
857
- method: 'POST',
858
- body: JSON.stringify(request)
859
- });
860
- return response;
861
957
  }
862
958
  };
863
959
  this.inventory = {
@@ -1095,6 +1191,85 @@ class BackstageClient {
1095
1191
  method: 'POST'
1096
1192
  });
1097
1193
  return response.customer;
1194
+ },
1195
+ listBenefits: async (customerId, options) => {
1196
+ const params = new URLSearchParams();
1197
+ if (options?.includeRevoked !== undefined)
1198
+ params.append('includeRevoked', String(options.includeRevoked));
1199
+ const queryString = params.toString();
1200
+ const requestPath = queryString ? `/customers/${customerId}/benefits?${queryString}` : `/customers/${customerId}/benefits`;
1201
+ const response = await this.request(requestPath, {
1202
+ method: 'GET'
1203
+ });
1204
+ return response.benefits;
1205
+ },
1206
+ grantBenefit: async (customerId, request) => {
1207
+ const response = await this.request(`/customers/${customerId}/benefits`, {
1208
+ method: 'POST',
1209
+ body: JSON.stringify(request)
1210
+ });
1211
+ return response.benefit;
1212
+ },
1213
+ revokeBenefit: async (customerId, benefitId) => {
1214
+ const response = await this.request(`/customers/${customerId}/benefits/${benefitId}/revoke`, {
1215
+ method: 'POST'
1216
+ });
1217
+ return response.benefit;
1218
+ }
1219
+ };
1220
+ this.refundPolicies = {
1221
+ listPolicies: async () => {
1222
+ const response = await this.request(`/refund-policies`, {
1223
+ method: 'GET'
1224
+ });
1225
+ return response.policies;
1226
+ },
1227
+ upsertPolicy: async (request) => {
1228
+ const response = await this.request(`/refund-policies`, {
1229
+ method: 'PUT',
1230
+ body: JSON.stringify(request)
1231
+ });
1232
+ return response.policy;
1233
+ }
1234
+ };
1235
+ this.refundRequests = {
1236
+ listRequests: async (options) => {
1237
+ const params = new URLSearchParams();
1238
+ if (options?.status !== undefined)
1239
+ params.append('status', String(options.status));
1240
+ const queryString = params.toString();
1241
+ const requestPath = queryString ? `/refund-requests?${queryString}` : `/refund-requests`;
1242
+ const response = await this.request(requestPath, {
1243
+ method: 'GET'
1244
+ });
1245
+ return response.requests;
1246
+ },
1247
+ createRequest: async (request) => {
1248
+ const response = await this.request(`/refund-requests`, {
1249
+ method: 'POST',
1250
+ body: JSON.stringify(request)
1251
+ });
1252
+ return response.request;
1253
+ },
1254
+ approveRequest: async (requestId, request) => {
1255
+ const response = await this.request(`/refund-requests/${requestId}/approve`, {
1256
+ method: 'POST',
1257
+ body: JSON.stringify(request)
1258
+ });
1259
+ return response.request;
1260
+ },
1261
+ processRequest: async (requestId) => {
1262
+ const response = await this.request(`/refund-requests/${requestId}/process`, {
1263
+ method: 'POST'
1264
+ });
1265
+ return response;
1266
+ },
1267
+ rejectRequest: async (requestId, request) => {
1268
+ const response = await this.request(`/refund-requests/${requestId}/reject`, {
1269
+ method: 'POST',
1270
+ body: JSON.stringify(request)
1271
+ });
1272
+ return response.request;
1098
1273
  }
1099
1274
  };
1100
1275
  this.orders = {
@@ -1153,6 +1328,24 @@ class BackstageClient {
1153
1328
  });
1154
1329
  return response.order;
1155
1330
  },
1331
+ getPasses: async (orderId) => {
1332
+ const response = await this.request(`/orders/${orderId}/passes`, {
1333
+ method: 'GET'
1334
+ });
1335
+ return response;
1336
+ },
1337
+ getPassPdf: async (orderId, passId) => {
1338
+ const response = await this.request(`/orders/${orderId}/passes/${passId}/ticket.pdf`, {
1339
+ method: 'GET'
1340
+ });
1341
+ return response;
1342
+ },
1343
+ resendConfirmation: async (orderId) => {
1344
+ const response = await this.request(`/orders/${orderId}/resend-confirmation`, {
1345
+ method: 'POST'
1346
+ });
1347
+ return response;
1348
+ },
1156
1349
  cancel: async (orderId, request) => {
1157
1350
  const response = await this.request(`/orders/${orderId}/cancel`, {
1158
1351
  method: 'POST',
@@ -1207,24 +1400,6 @@ class BackstageClient {
1207
1400
  });
1208
1401
  return response;
1209
1402
  },
1210
- getPassPdf: async (orderId, passId) => {
1211
- const response = await this.request(`/orders/${orderId}/passes/${passId}/ticket.pdf`, {
1212
- method: 'GET'
1213
- });
1214
- return response;
1215
- },
1216
- resendConfirmation: async (orderId) => {
1217
- const response = await this.request(`/orders/${orderId}/resend-confirmation`, {
1218
- method: 'POST'
1219
- });
1220
- return response;
1221
- },
1222
- getPasses: async (orderId) => {
1223
- const response = await this.request(`/orders/${orderId}/passes`, {
1224
- method: 'GET'
1225
- });
1226
- return response;
1227
- },
1228
1403
  printPass: async (orderId, passId, request) => {
1229
1404
  const response = await this.request(`/orders/${orderId}/passes/${passId}/print`, {
1230
1405
  method: 'POST',
@@ -1294,63 +1469,6 @@ class BackstageClient {
1294
1469
  }
1295
1470
  };
1296
1471
  this.paymentProviders = {
1297
- create: async (request) => {
1298
- const response = await this.request(`/payment-providers`, {
1299
- method: 'POST',
1300
- body: JSON.stringify(request)
1301
- });
1302
- return response.provider;
1303
- },
1304
- list: async (options) => {
1305
- const params = new URLSearchParams();
1306
- if (options?.accountId !== undefined)
1307
- params.append('accountId', String(options.accountId));
1308
- if (options?.type !== undefined)
1309
- params.append('type', String(options.type));
1310
- if (options?.status !== undefined)
1311
- params.append('status', String(options.status));
1312
- if (options?.paymentType !== undefined)
1313
- params.append('paymentType', String(options.paymentType));
1314
- if (options?.isDefault !== undefined)
1315
- params.append('isDefault', String(options.isDefault));
1316
- if (options?.integrationType !== undefined)
1317
- params.append('integrationType', String(options.integrationType));
1318
- if (options?.page !== undefined)
1319
- params.append('page', String(options.page));
1320
- if (options?.limit !== undefined)
1321
- params.append('limit', String(options.limit));
1322
- const queryString = params.toString();
1323
- const requestPath = queryString ? `/payment-providers?${queryString}` : `/payment-providers`;
1324
- const response = await this.request(requestPath, {
1325
- method: 'GET'
1326
- });
1327
- return response;
1328
- },
1329
- getDefault: async () => {
1330
- const response = await this.request(`/payment-providers/default`, {
1331
- method: 'GET'
1332
- });
1333
- return response.provider;
1334
- },
1335
- get: async (providerId) => {
1336
- const response = await this.request(`/payment-providers/${providerId}`, {
1337
- method: 'GET'
1338
- });
1339
- return response.provider;
1340
- },
1341
- update: async (providerId, request) => {
1342
- const response = await this.request(`/payment-providers/${providerId}`, {
1343
- method: 'PATCH',
1344
- body: JSON.stringify(request)
1345
- });
1346
- return response.provider;
1347
- },
1348
- delete: async (providerId) => {
1349
- const response = await this.request(`/payment-providers/${providerId}`, {
1350
- method: 'DELETE'
1351
- });
1352
- return response;
1353
- },
1354
1472
  enableTicketlayerPay: async (request) => {
1355
1473
  const response = await this.request(`/payment-providers/ticketlayer-pay/enable`, {
1356
1474
  method: 'POST',
@@ -1431,6 +1549,70 @@ class BackstageClient {
1431
1549
  body: JSON.stringify(request)
1432
1550
  });
1433
1551
  return response.link;
1552
+ },
1553
+ create: async (request) => {
1554
+ const response = await this.request(`/payment-providers`, {
1555
+ method: 'POST',
1556
+ body: JSON.stringify(request)
1557
+ });
1558
+ return response.provider;
1559
+ },
1560
+ list: async (options) => {
1561
+ const params = new URLSearchParams();
1562
+ if (options?.accountId !== undefined)
1563
+ params.append('accountId', String(options.accountId));
1564
+ if (options?.type !== undefined)
1565
+ params.append('type', String(options.type));
1566
+ if (options?.status !== undefined)
1567
+ params.append('status', String(options.status));
1568
+ if (options?.paymentType !== undefined)
1569
+ params.append('paymentType', String(options.paymentType));
1570
+ if (options?.isDefault !== undefined)
1571
+ params.append('isDefault', String(options.isDefault));
1572
+ if (options?.integrationType !== undefined)
1573
+ params.append('integrationType', String(options.integrationType));
1574
+ if (options?.page !== undefined)
1575
+ params.append('page', String(options.page));
1576
+ if (options?.limit !== undefined)
1577
+ params.append('limit', String(options.limit));
1578
+ const queryString = params.toString();
1579
+ const requestPath = queryString ? `/payment-providers?${queryString}` : `/payment-providers`;
1580
+ const response = await this.request(requestPath, {
1581
+ method: 'GET'
1582
+ });
1583
+ return response;
1584
+ },
1585
+ getDefault: async () => {
1586
+ const response = await this.request(`/payment-providers/default`, {
1587
+ method: 'GET'
1588
+ });
1589
+ return response.provider;
1590
+ },
1591
+ get: async (providerId) => {
1592
+ const response = await this.request(`/payment-providers/${providerId}`, {
1593
+ method: 'GET'
1594
+ });
1595
+ return response.provider;
1596
+ },
1597
+ update: async (providerId, request) => {
1598
+ const response = await this.request(`/payment-providers/${providerId}`, {
1599
+ method: 'PATCH',
1600
+ body: JSON.stringify(request)
1601
+ });
1602
+ return response.provider;
1603
+ },
1604
+ delete: async (providerId) => {
1605
+ const response = await this.request(`/payment-providers/${providerId}`, {
1606
+ method: 'DELETE'
1607
+ });
1608
+ return response;
1609
+ },
1610
+ reportStatus: async (providerId, request) => {
1611
+ const response = await this.request(`/payment-providers/${providerId}/status`, {
1612
+ method: 'POST',
1613
+ body: JSON.stringify(request)
1614
+ });
1615
+ return response.provider;
1434
1616
  }
1435
1617
  };
1436
1618
  this.salesChannels = Object.assign((channelId) => ({
@@ -1544,6 +1726,18 @@ class BackstageClient {
1544
1726
  method: 'DELETE'
1545
1727
  });
1546
1728
  return response.deleted;
1729
+ },
1730
+ getCatalogue: async (channelId) => {
1731
+ const response = await this.request(`/sales-channels/${channelId}/catalogue`, {
1732
+ method: 'GET'
1733
+ });
1734
+ return response;
1735
+ },
1736
+ getCatalogueEvent: async (channelId, eventId) => {
1737
+ const response = await this.request(`/sales-channels/${channelId}/catalogue/events/${eventId}`, {
1738
+ method: 'GET'
1739
+ });
1740
+ return response.event;
1547
1741
  }
1548
1742
  });
1549
1743
  this.presaleCodes = {
@@ -1601,207 +1795,44 @@ class BackstageClient {
1601
1795
  return response.deleted;
1602
1796
  }
1603
1797
  };
1604
- this.salesListings = {
1605
- list: async () => {
1606
- const response = await this.request(`/sales/listings`, {
1607
- method: 'GET'
1608
- });
1609
- return response;
1610
- }
1611
- };
1612
- this.salesCustomerAuth = {
1613
- magicLink: async (request) => {
1614
- const response = await this.request(`/sales/customer-auth/magic-link`, {
1615
- method: 'POST',
1616
- body: JSON.stringify(request)
1617
- });
1618
- return response.sent;
1619
- }
1620
- };
1621
- this.salesCustomerTokens = {
1622
- create: async (request) => {
1623
- const response = await this.request(`/sales/customer-tokens`, {
1624
- method: 'POST',
1625
- body: JSON.stringify(request)
1626
- });
1627
- return response;
1628
- },
1629
- refresh: async () => {
1630
- const response = await this.request(`/sales/customer-tokens/refresh`, {
1631
- method: 'POST'
1632
- });
1633
- return response;
1634
- }
1635
- };
1636
- this.salesCarts = {
1637
- create: async (request) => {
1638
- const response = await this.request(`/sales/carts`, {
1639
- method: 'POST',
1640
- body: JSON.stringify(request)
1641
- });
1642
- return response.cart;
1643
- },
1644
- get: async (cartId) => {
1645
- const response = await this.request(`/sales/carts/${cartId}`, {
1646
- method: 'GET'
1647
- });
1648
- return response.cart;
1649
- },
1650
- addItem: async (cartId, request) => {
1651
- const response = await this.request(`/sales/carts/${cartId}/items`, {
1652
- method: 'POST',
1653
- body: JSON.stringify(request)
1654
- });
1655
- return response.cart;
1656
- },
1657
- removeItem: async (cartId, itemId) => {
1658
- const response = await this.request(`/sales/carts/${cartId}/items/${itemId}`, {
1659
- method: 'DELETE'
1660
- });
1661
- return response.cart;
1662
- },
1663
- checkout: async (cartId, request) => {
1664
- const response = await this.request(`/sales/carts/${cartId}/checkout`, {
1665
- method: 'POST',
1666
- body: JSON.stringify(request)
1667
- });
1668
- return response;
1669
- }
1670
- };
1671
- this.salesMyOrders = {
1672
- list: async () => {
1673
- const response = await this.request(`/sales/my-orders`, {
1674
- method: 'GET'
1675
- });
1676
- return response.orders;
1677
- }
1678
- };
1679
- this.salesOrders = {
1680
- get: async (orderId) => {
1681
- const response = await this.request(`/sales/orders/${orderId}`, {
1682
- method: 'GET'
1683
- });
1684
- return response.order;
1685
- },
1686
- ticketPdf: async (orderId, passId) => {
1687
- const response = await this.request(`/sales/orders/${orderId}/passes/${passId}/ticket.pdf`, {
1688
- method: 'GET'
1689
- });
1690
- return response;
1691
- }
1692
- };
1693
- this.salesOrderPayments = {
1694
- create: async (orderId, request) => {
1695
- const response = await this.request(`/sales/orders/${orderId}/payments`, {
1696
- method: 'POST',
1697
- body: JSON.stringify(request)
1698
- });
1699
- return response.payment;
1700
- }
1701
- };
1702
- this.salesRefundRequests = {
1703
- create: async (orderId, request) => {
1704
- const response = await this.request(`/sales/orders/${orderId}/refund-requests`, {
1705
- method: 'POST',
1706
- body: JSON.stringify(request)
1707
- });
1708
- return response.request;
1709
- }
1710
- };
1711
- this.salesCustomers = {
1712
- create: async (request) => {
1713
- const response = await this.request(`/sales/customers`, {
1714
- method: 'POST',
1715
- body: JSON.stringify(request)
1716
- });
1717
- return response.customer;
1718
- },
1719
- get: async (customerId) => {
1720
- const response = await this.request(`/sales/customers/${customerId}`, {
1721
- method: 'GET'
1722
- });
1723
- return response.customer;
1724
- },
1725
- update: async (customerId, request) => {
1726
- const response = await this.request(`/sales/customers/${customerId}`, {
1727
- method: 'PATCH',
1728
- body: JSON.stringify(request)
1729
- });
1730
- return response.customer;
1731
- }
1732
- };
1733
- this.salesPresaleCodes = {
1734
- redeem: async (request) => {
1735
- const response = await this.request(`/sales/presale-codes/redeem`, {
1736
- method: 'POST',
1737
- body: JSON.stringify(request)
1738
- });
1739
- return response;
1740
- }
1741
- };
1742
- this.sales = {
1743
- resolveChannel: async (options) => {
1744
- const params = new URLSearchParams();
1745
- if (options?.domain !== undefined)
1746
- params.append('domain', String(options.domain));
1747
- const queryString = params.toString();
1748
- const requestPath = queryString ? `/sales/channel?${queryString}` : `/sales/channel`;
1749
- const response = await this.request(requestPath, {
1750
- method: 'GET'
1751
- });
1752
- return response;
1753
- },
1754
- get: async (eventId) => {
1755
- const response = await this.request(`/sales/events/${eventId}`, {
1756
- method: 'GET'
1757
- });
1758
- return response.event;
1759
- },
1760
- getTheme: async () => {
1761
- const response = await this.request(`/sales/theme`, {
1762
- method: 'GET'
1763
- });
1764
- return response.theme;
1765
- }
1766
- };
1767
- this.themes = {
1798
+ this.brands = {
1768
1799
  list: async () => {
1769
- const response = await this.request(`/themes`, {
1800
+ const response = await this.request(`/brands`, {
1770
1801
  method: 'GET'
1771
1802
  });
1772
- return response.themes;
1803
+ return response.brands;
1773
1804
  },
1774
1805
  create: async (request) => {
1775
- const response = await this.request(`/themes`, {
1806
+ const response = await this.request(`/brands`, {
1776
1807
  method: 'POST',
1777
1808
  body: JSON.stringify(request)
1778
1809
  });
1779
- return response.theme;
1810
+ return response.brand;
1780
1811
  },
1781
1812
  get: async (id) => {
1782
- const response = await this.request(`/themes/${id}`, {
1813
+ const response = await this.request(`/brands/${id}`, {
1783
1814
  method: 'GET'
1784
1815
  });
1785
- return response.theme;
1816
+ return response.brand;
1786
1817
  },
1787
1818
  update: async (id, request) => {
1788
- const response = await this.request(`/themes/${id}`, {
1819
+ const response = await this.request(`/brands/${id}`, {
1789
1820
  method: 'PATCH',
1790
1821
  body: JSON.stringify(request)
1791
1822
  });
1792
- return response.theme;
1823
+ return response.brand;
1793
1824
  },
1794
1825
  delete: async (id) => {
1795
- const response = await this.request(`/themes/${id}`, {
1826
+ const response = await this.request(`/brands/${id}`, {
1796
1827
  method: 'DELETE'
1797
1828
  });
1798
1829
  return response.deleted;
1799
1830
  },
1800
1831
  resolved: async (id) => {
1801
- const response = await this.request(`/themes/${id}/resolved`, {
1832
+ const response = await this.request(`/brands/${id}/resolved`, {
1802
1833
  method: 'GET'
1803
1834
  });
1804
- return response.theme;
1835
+ return response.brand;
1805
1836
  }
1806
1837
  };
1807
1838
  this.passes = Object.assign((passeId) => ({
@@ -1955,48 +1986,46 @@ class BackstageClient {
1955
1986
  return response;
1956
1987
  }
1957
1988
  };
1958
- this.assets = Object.assign((assetId) => ({
1959
- assets: {
1960
- list: async (options) => {
1961
- const params = new URLSearchParams();
1962
- if (options?.q !== undefined)
1963
- params.append('q', String(options.q));
1964
- if (options?.purpose !== undefined)
1965
- params.append('purpose', String(options.purpose));
1966
- if (options?.ownerType !== undefined)
1967
- params.append('ownerType', String(options.ownerType));
1968
- if (options?.ownerId !== undefined)
1969
- params.append('ownerId', String(options.ownerId));
1970
- if (options?.accountId !== undefined)
1971
- params.append('accountId', String(options.accountId));
1972
- const queryString = params.toString();
1973
- const requestPath = queryString ? `/assets?${queryString}` : `/assets`;
1974
- const response = await this.request(requestPath, {
1975
- method: 'GET'
1976
- });
1977
- return response.assets;
1978
- },
1979
- upload: async (request) => {
1980
- const response = await this.request(`/assets`, {
1981
- method: 'POST',
1982
- body: JSON.stringify(request)
1983
- });
1984
- return response.asset;
1985
- },
1986
- get: async (id) => {
1987
- const response = await this.request(`/assets/${id}`, {
1988
- method: 'GET'
1989
- });
1990
- return response.asset;
1991
- },
1992
- delete: async (id) => {
1993
- const response = await this.request(`/assets/${id}`, {
1994
- method: 'DELETE'
1995
- });
1996
- return response.deleted;
1997
- }
1989
+ this.assets = {
1990
+ list: async (options) => {
1991
+ const params = new URLSearchParams();
1992
+ if (options?.q !== undefined)
1993
+ params.append('q', String(options.q));
1994
+ if (options?.purpose !== undefined)
1995
+ params.append('purpose', String(options.purpose));
1996
+ if (options?.ownerType !== undefined)
1997
+ params.append('ownerType', String(options.ownerType));
1998
+ if (options?.ownerId !== undefined)
1999
+ params.append('ownerId', String(options.ownerId));
2000
+ if (options?.accountId !== undefined)
2001
+ params.append('accountId', String(options.accountId));
2002
+ const queryString = params.toString();
2003
+ const requestPath = queryString ? `/assets?${queryString}` : `/assets`;
2004
+ const response = await this.request(requestPath, {
2005
+ method: 'GET'
2006
+ });
2007
+ return response.assets;
2008
+ },
2009
+ upload: async (request) => {
2010
+ const response = await this.request(`/assets`, {
2011
+ method: 'POST',
2012
+ body: JSON.stringify(request)
2013
+ });
2014
+ return response.asset;
2015
+ },
2016
+ get: async (id) => {
2017
+ const response = await this.request(`/assets/${id}`, {
2018
+ method: 'GET'
2019
+ });
2020
+ return response.asset;
2021
+ },
2022
+ delete: async (id) => {
2023
+ const response = await this.request(`/assets/${id}`, {
2024
+ method: 'DELETE'
2025
+ });
2026
+ return response.deleted;
1998
2027
  }
1999
- }), {});
2028
+ };
2000
2029
  this.devicePairing = {
2001
2030
  start: async (request) => {
2002
2031
  const response = await this.request(`/devices/pairing`, {
@@ -2121,6 +2150,12 @@ class BackstageClient {
2121
2150
  });
2122
2151
  return response;
2123
2152
  },
2153
+ getCommand: async (commandId) => {
2154
+ const response = await this.request(`/devices/commands/${commandId}`, {
2155
+ method: 'GET'
2156
+ });
2157
+ return response;
2158
+ },
2124
2159
  list: async (options) => {
2125
2160
  const params = new URLSearchParams();
2126
2161
  if (options?.accountId !== undefined)
@@ -2192,12 +2227,6 @@ class BackstageClient {
2192
2227
  });
2193
2228
  return response;
2194
2229
  },
2195
- getCommand: async (commandId) => {
2196
- const response = await this.request(`/devices/commands/${commandId}`, {
2197
- method: 'GET'
2198
- });
2199
- return response;
2200
- },
2201
2230
  listEvents: async (deviceId) => {
2202
2231
  const response = await this.request(`/devices/${deviceId}/events`, {
2203
2232
  method: 'GET'
@@ -2442,21 +2471,7 @@ class BackstageClient {
2442
2471
  return response;
2443
2472
  }
2444
2473
  };
2445
- this.webhookEventTypes = {
2446
- list: async () => {
2447
- const response = await this.request(`/webhook-event-types`, {
2448
- method: 'GET'
2449
- });
2450
- return response;
2451
- }
2452
- };
2453
2474
  this.webhookDeliveries = {
2454
- listInbound: async () => {
2455
- const response = await this.request(`/webhook-inbound`, {
2456
- method: 'GET'
2457
- });
2458
- return response;
2459
- },
2460
2475
  list: async (options) => {
2461
2476
  const params = new URLSearchParams();
2462
2477
  if (options?.endpointId !== undefined)
@@ -2475,6 +2490,20 @@ class BackstageClient {
2475
2490
  method: 'GET'
2476
2491
  });
2477
2492
  return response;
2493
+ },
2494
+ listInbound: async () => {
2495
+ const response = await this.request(`/webhook-inbound`, {
2496
+ method: 'GET'
2497
+ });
2498
+ return response;
2499
+ }
2500
+ };
2501
+ this.webhookEventTypes = {
2502
+ list: async () => {
2503
+ const response = await this.request(`/webhook-event-types`, {
2504
+ method: 'GET'
2505
+ });
2506
+ return response;
2478
2507
  }
2479
2508
  };
2480
2509
  this.integrations = {
@@ -2503,6 +2532,184 @@ class BackstageClient {
2503
2532
  return response;
2504
2533
  }
2505
2534
  };
2535
+ this.clientVersions = {
2536
+ list: async (options) => {
2537
+ const params = new URLSearchParams();
2538
+ if (options?.days !== undefined)
2539
+ params.append('days', String(options.days));
2540
+ const queryString = params.toString();
2541
+ const requestPath = queryString ? `/client-versions?${queryString}` : `/client-versions`;
2542
+ const response = await this.request(requestPath, {
2543
+ method: 'GET'
2544
+ });
2545
+ return response.clientVersions;
2546
+ }
2547
+ };
2548
+ this.sales = {
2549
+ resolveChannel: async (options) => {
2550
+ const params = new URLSearchParams();
2551
+ if (options?.domain !== undefined)
2552
+ params.append('domain', String(options.domain));
2553
+ if (options?.key !== undefined)
2554
+ params.append('key', String(options.key));
2555
+ const queryString = params.toString();
2556
+ const requestPath = queryString ? `/sales/channel?${queryString}` : `/sales/channel`;
2557
+ const response = await this.request(requestPath, {
2558
+ method: 'GET'
2559
+ });
2560
+ return response;
2561
+ },
2562
+ get: async (eventId) => {
2563
+ const response = await this.request(`/sales/events/${eventId}`, {
2564
+ method: 'GET'
2565
+ });
2566
+ return response.event;
2567
+ },
2568
+ getTheme: async () => {
2569
+ const response = await this.request(`/sales/theme`, {
2570
+ method: 'GET'
2571
+ });
2572
+ return response.theme;
2573
+ }
2574
+ };
2575
+ this.salesCustomerAuth = {
2576
+ magicLink: async (request) => {
2577
+ const response = await this.request(`/sales/customer-auth/magic-link`, {
2578
+ method: 'POST',
2579
+ body: JSON.stringify(request)
2580
+ });
2581
+ return response.sent;
2582
+ }
2583
+ };
2584
+ this.salesCustomerTokens = {
2585
+ create: async (request) => {
2586
+ const response = await this.request(`/sales/customer-tokens`, {
2587
+ method: 'POST',
2588
+ body: JSON.stringify(request)
2589
+ });
2590
+ return response;
2591
+ },
2592
+ refresh: async () => {
2593
+ const response = await this.request(`/sales/customer-tokens/refresh`, {
2594
+ method: 'POST'
2595
+ });
2596
+ return response;
2597
+ }
2598
+ };
2599
+ this.salesListings = {
2600
+ list: async () => {
2601
+ const response = await this.request(`/sales/listings`, {
2602
+ method: 'GET'
2603
+ });
2604
+ return response;
2605
+ }
2606
+ };
2607
+ this.salesCarts = {
2608
+ create: async (request) => {
2609
+ const response = await this.request(`/sales/carts`, {
2610
+ method: 'POST',
2611
+ body: JSON.stringify(request)
2612
+ });
2613
+ return response.cart;
2614
+ },
2615
+ get: async (cartId) => {
2616
+ const response = await this.request(`/sales/carts/${cartId}`, {
2617
+ method: 'GET'
2618
+ });
2619
+ return response.cart;
2620
+ },
2621
+ addItem: async (cartId, request) => {
2622
+ const response = await this.request(`/sales/carts/${cartId}/items`, {
2623
+ method: 'POST',
2624
+ body: JSON.stringify(request)
2625
+ });
2626
+ return response.cart;
2627
+ },
2628
+ removeItem: async (cartId, itemId) => {
2629
+ const response = await this.request(`/sales/carts/${cartId}/items/${itemId}`, {
2630
+ method: 'DELETE'
2631
+ });
2632
+ return response.cart;
2633
+ },
2634
+ checkout: async (cartId, request) => {
2635
+ const response = await this.request(`/sales/carts/${cartId}/checkout`, {
2636
+ method: 'POST',
2637
+ body: JSON.stringify(request)
2638
+ });
2639
+ return response;
2640
+ }
2641
+ };
2642
+ this.salesMyOrders = {
2643
+ list: async () => {
2644
+ const response = await this.request(`/sales/my-orders`, {
2645
+ method: 'GET'
2646
+ });
2647
+ return response.orders;
2648
+ }
2649
+ };
2650
+ this.salesOrders = {
2651
+ get: async (orderId) => {
2652
+ const response = await this.request(`/sales/orders/${orderId}`, {
2653
+ method: 'GET'
2654
+ });
2655
+ return response.order;
2656
+ },
2657
+ ticketPdf: async (orderId, passId) => {
2658
+ const response = await this.request(`/sales/orders/${orderId}/passes/${passId}/ticket.pdf`, {
2659
+ method: 'GET'
2660
+ });
2661
+ return response;
2662
+ }
2663
+ };
2664
+ this.salesOrderPayments = {
2665
+ create: async (orderId, request) => {
2666
+ const response = await this.request(`/sales/orders/${orderId}/payments`, {
2667
+ method: 'POST',
2668
+ body: JSON.stringify(request)
2669
+ });
2670
+ return response.payment;
2671
+ }
2672
+ };
2673
+ this.salesRefundRequests = {
2674
+ create: async (orderId, request) => {
2675
+ const response = await this.request(`/sales/orders/${orderId}/refund-requests`, {
2676
+ method: 'POST',
2677
+ body: JSON.stringify(request)
2678
+ });
2679
+ return response.request;
2680
+ }
2681
+ };
2682
+ this.salesCustomers = {
2683
+ create: async (request) => {
2684
+ const response = await this.request(`/sales/customers`, {
2685
+ method: 'POST',
2686
+ body: JSON.stringify(request)
2687
+ });
2688
+ return response.customer;
2689
+ },
2690
+ get: async (customerId) => {
2691
+ const response = await this.request(`/sales/customers/${customerId}`, {
2692
+ method: 'GET'
2693
+ });
2694
+ return response.customer;
2695
+ },
2696
+ update: async (customerId, request) => {
2697
+ const response = await this.request(`/sales/customers/${customerId}`, {
2698
+ method: 'PATCH',
2699
+ body: JSON.stringify(request)
2700
+ });
2701
+ return response.customer;
2702
+ }
2703
+ };
2704
+ this.salesPresaleCodes = {
2705
+ redeem: async (request) => {
2706
+ const response = await this.request(`/sales/presale-codes/redeem`, {
2707
+ method: 'POST',
2708
+ body: JSON.stringify(request)
2709
+ });
2710
+ return response;
2711
+ }
2712
+ };
2506
2713
  this.baseUrl = config.baseUrl.replace(/\/$/, '');
2507
2714
  this.authMode = config.authMode || 'bearer';
2508
2715
  this.accessToken = config.accessToken;