@ticketlayer/backstage 0.2.1 → 0.3.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.d.ts +990 -635
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +631 -445
- package/dist/generated/types.d.ts +7130 -5148
- package/dist/generated/types.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
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.
|
|
128
|
-
|
|
129
|
-
const response = await this.request(`/
|
|
130
|
-
method: '
|
|
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.
|
|
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.
|
|
184
|
-
|
|
185
|
-
const
|
|
186
|
-
|
|
187
|
-
|
|
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
|
|
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
|
-
|
|
196
|
-
const response = await this.request(`/
|
|
213
|
+
list: async () => {
|
|
214
|
+
const response = await this.request(`/api-keys`, {
|
|
197
215
|
method: 'GET'
|
|
198
216
|
});
|
|
199
|
-
return response.
|
|
217
|
+
return response.apiKeys;
|
|
200
218
|
},
|
|
201
|
-
|
|
202
|
-
const response = await this.request(`/
|
|
203
|
-
method: '
|
|
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
|
|
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.
|
|
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(`/
|
|
290
|
+
const response = await this.request(`/users`, {
|
|
252
291
|
method: 'GET'
|
|
253
292
|
});
|
|
254
|
-
return response
|
|
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,37 @@ class BackstageClient {
|
|
|
320
399
|
return response.assignments;
|
|
321
400
|
}
|
|
322
401
|
};
|
|
323
|
-
this.
|
|
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(`/
|
|
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
|
-
|
|
341
|
-
const response = await this.request(`/
|
|
410
|
+
get: async (id) => {
|
|
411
|
+
const response = await this.request(`/organisations/${id}`, {
|
|
342
412
|
method: 'GET'
|
|
343
413
|
});
|
|
344
|
-
return response.
|
|
414
|
+
return response.organisation;
|
|
345
415
|
},
|
|
346
|
-
|
|
347
|
-
const response = await this.request(`/
|
|
348
|
-
method: '
|
|
349
|
-
});
|
|
350
|
-
return response.apiKey;
|
|
351
|
-
}
|
|
352
|
-
};
|
|
353
|
-
this.embedSessions = {
|
|
354
|
-
create: async (request) => {
|
|
355
|
-
const response = await this.request(`/embed/sessions`, {
|
|
356
|
-
method: 'POST',
|
|
416
|
+
update: async (id, request) => {
|
|
417
|
+
const response = await this.request(`/organisations/${id}`, {
|
|
418
|
+
method: 'PATCH',
|
|
357
419
|
body: JSON.stringify(request)
|
|
358
420
|
});
|
|
359
|
-
return response;
|
|
360
|
-
},
|
|
361
|
-
current: async () => {
|
|
362
|
-
const response = await this.request(`/embed/sessions/current`, {
|
|
363
|
-
method: 'GET'
|
|
364
|
-
});
|
|
365
|
-
return response;
|
|
421
|
+
return response.organisation;
|
|
366
422
|
}
|
|
367
423
|
};
|
|
368
424
|
this.events = Object.assign((eventId) => ({
|
|
369
425
|
occurrences: {
|
|
426
|
+
create: async (request) => {
|
|
427
|
+
const response = await this.request(`/events/${eventId}/occurrences`, {
|
|
428
|
+
method: 'POST',
|
|
429
|
+
body: JSON.stringify(request)
|
|
430
|
+
});
|
|
431
|
+
return response.eventOccurrence;
|
|
432
|
+
},
|
|
370
433
|
list: async (options) => {
|
|
371
434
|
const params = new URLSearchParams();
|
|
372
435
|
if (options?.status !== undefined)
|
|
@@ -388,13 +451,6 @@ class BackstageClient {
|
|
|
388
451
|
});
|
|
389
452
|
return response;
|
|
390
453
|
},
|
|
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
454
|
get: async (occurrenceId) => {
|
|
399
455
|
const response = await this.request(`/events/${eventId}/occurrences/${occurrenceId}`, {
|
|
400
456
|
method: 'GET'
|
|
@@ -416,12 +472,6 @@ class BackstageClient {
|
|
|
416
472
|
}
|
|
417
473
|
},
|
|
418
474
|
priceschemes: {
|
|
419
|
-
list: async () => {
|
|
420
|
-
const response = await this.request(`/events/${eventId}/price-schemes`, {
|
|
421
|
-
method: 'GET'
|
|
422
|
-
});
|
|
423
|
-
return response.priceSchemes;
|
|
424
|
-
},
|
|
425
475
|
create: async (request) => {
|
|
426
476
|
const response = await this.request(`/events/${eventId}/price-schemes`, {
|
|
427
477
|
method: 'POST',
|
|
@@ -429,6 +479,12 @@ class BackstageClient {
|
|
|
429
479
|
});
|
|
430
480
|
return response.priceScheme;
|
|
431
481
|
},
|
|
482
|
+
list: async () => {
|
|
483
|
+
const response = await this.request(`/events/${eventId}/price-schemes`, {
|
|
484
|
+
method: 'GET'
|
|
485
|
+
});
|
|
486
|
+
return response.priceSchemes;
|
|
487
|
+
},
|
|
432
488
|
get: async (priceSchemeId) => {
|
|
433
489
|
const response = await this.request(`/events/${eventId}/price-schemes/${priceSchemeId}`, {
|
|
434
490
|
method: 'GET'
|
|
@@ -450,6 +506,13 @@ class BackstageClient {
|
|
|
450
506
|
}
|
|
451
507
|
}
|
|
452
508
|
}), {
|
|
509
|
+
create: async (request) => {
|
|
510
|
+
const response = await this.request(`/events`, {
|
|
511
|
+
method: 'POST',
|
|
512
|
+
body: JSON.stringify(request)
|
|
513
|
+
});
|
|
514
|
+
return response.event;
|
|
515
|
+
},
|
|
453
516
|
list: async (options) => {
|
|
454
517
|
const params = new URLSearchParams();
|
|
455
518
|
if (options?.search !== undefined)
|
|
@@ -473,13 +536,6 @@ class BackstageClient {
|
|
|
473
536
|
});
|
|
474
537
|
return response;
|
|
475
538
|
},
|
|
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
539
|
get: async (id, options) => {
|
|
484
540
|
const params = new URLSearchParams();
|
|
485
541
|
if (options?.expand !== undefined)
|
|
@@ -503,19 +559,58 @@ class BackstageClient {
|
|
|
503
559
|
method: 'DELETE'
|
|
504
560
|
});
|
|
505
561
|
return response;
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
562
|
+
},
|
|
563
|
+
getLayout: async (eventId) => {
|
|
564
|
+
const response = await this.request(`/events/${eventId}/layout`, {
|
|
565
|
+
method: 'GET'
|
|
566
|
+
});
|
|
567
|
+
return response.layout;
|
|
568
|
+
},
|
|
569
|
+
validateLayoutChanges: async (eventId, request) => {
|
|
570
|
+
const response = await this.request(`/events/${eventId}/layout/validate`, {
|
|
571
|
+
method: 'POST',
|
|
572
|
+
body: JSON.stringify(request)
|
|
573
|
+
});
|
|
574
|
+
return response;
|
|
575
|
+
},
|
|
576
|
+
applyLayoutChanges: async (eventId, request) => {
|
|
577
|
+
const response = await this.request(`/events/${eventId}/layout/apply`, {
|
|
578
|
+
method: 'POST',
|
|
579
|
+
body: JSON.stringify(request)
|
|
580
|
+
});
|
|
581
|
+
return response;
|
|
582
|
+
},
|
|
583
|
+
getLayoutChangeResult: async (eventId, workflowId) => {
|
|
584
|
+
const response = await this.request(`/events/${eventId}/layout/apply/${workflowId}`, {
|
|
585
|
+
method: 'GET'
|
|
586
|
+
});
|
|
587
|
+
return response;
|
|
588
|
+
},
|
|
589
|
+
streamLayoutChangeProgress: async (eventId, workflowId) => {
|
|
590
|
+
const response = await this.request(`/events/${eventId}/layout/apply/${workflowId}/progress`, {
|
|
591
|
+
method: 'GET'
|
|
592
|
+
});
|
|
593
|
+
return response;
|
|
594
|
+
}
|
|
595
|
+
});
|
|
596
|
+
this.venues = Object.assign((id) => ({
|
|
597
|
+
venuelayouts: {
|
|
598
|
+
create: async (request) => {
|
|
599
|
+
const response = await this.request(`/venues/${id}/layouts`, {
|
|
600
|
+
method: 'POST',
|
|
601
|
+
body: JSON.stringify(request)
|
|
602
|
+
});
|
|
603
|
+
return response.venueLayout;
|
|
604
|
+
},
|
|
605
|
+
list: async (options) => {
|
|
606
|
+
const params = new URLSearchParams();
|
|
607
|
+
if (options?.search !== undefined)
|
|
608
|
+
params.append('search', String(options.search));
|
|
609
|
+
if (options?.status !== undefined)
|
|
610
|
+
params.append('status', String(options.status));
|
|
611
|
+
if (options?.accountId !== undefined)
|
|
612
|
+
params.append('accountId', String(options.accountId));
|
|
613
|
+
if (options?.page !== undefined)
|
|
519
614
|
params.append('page', String(options.page));
|
|
520
615
|
if (options?.limit !== undefined)
|
|
521
616
|
params.append('limit', String(options.limit));
|
|
@@ -526,13 +621,6 @@ class BackstageClient {
|
|
|
526
621
|
});
|
|
527
622
|
return response;
|
|
528
623
|
},
|
|
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
624
|
get: async (layoutId) => {
|
|
537
625
|
const response = await this.request(`/venues/${id}/layouts/${layoutId}`, {
|
|
538
626
|
method: 'GET'
|
|
@@ -641,6 +729,13 @@ class BackstageClient {
|
|
|
641
729
|
}
|
|
642
730
|
}
|
|
643
731
|
}), {
|
|
732
|
+
create: async (request) => {
|
|
733
|
+
const response = await this.request(`/venues`, {
|
|
734
|
+
method: 'POST',
|
|
735
|
+
body: JSON.stringify(request)
|
|
736
|
+
});
|
|
737
|
+
return response.venue;
|
|
738
|
+
},
|
|
644
739
|
list: async (options) => {
|
|
645
740
|
const params = new URLSearchParams();
|
|
646
741
|
if (options?.search !== undefined)
|
|
@@ -660,13 +755,6 @@ class BackstageClient {
|
|
|
660
755
|
});
|
|
661
756
|
return response;
|
|
662
757
|
},
|
|
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
758
|
get: async (id) => {
|
|
671
759
|
const response = await this.request(`/venues/${id}`, {
|
|
672
760
|
method: 'GET'
|
|
@@ -694,6 +782,12 @@ class BackstageClient {
|
|
|
694
782
|
});
|
|
695
783
|
return response.packages;
|
|
696
784
|
},
|
|
785
|
+
listAiPackages: async () => {
|
|
786
|
+
const response = await this.request(`/billing/ai/packages`, {
|
|
787
|
+
method: 'GET'
|
|
788
|
+
});
|
|
789
|
+
return response.packages;
|
|
790
|
+
},
|
|
697
791
|
canSell: async (organisationId) => {
|
|
698
792
|
const response = await this.request(`/organisations/${organisationId}/billing/can-sell`, {
|
|
699
793
|
method: 'GET'
|
|
@@ -728,6 +822,32 @@ class BackstageClient {
|
|
|
728
822
|
});
|
|
729
823
|
return response;
|
|
730
824
|
},
|
|
825
|
+
getAiBalance: async () => {
|
|
826
|
+
const response = await this.request(`/billing/ai/balance`, {
|
|
827
|
+
method: 'GET'
|
|
828
|
+
});
|
|
829
|
+
return response.aiBalance;
|
|
830
|
+
},
|
|
831
|
+
listAiTransactions: async (options) => {
|
|
832
|
+
const params = new URLSearchParams();
|
|
833
|
+
if (options?.page !== undefined)
|
|
834
|
+
params.append('page', String(options.page));
|
|
835
|
+
if (options?.limit !== undefined)
|
|
836
|
+
params.append('limit', String(options.limit));
|
|
837
|
+
const queryString = params.toString();
|
|
838
|
+
const requestPath = queryString ? `/billing/ai/transactions?${queryString}` : `/billing/ai/transactions`;
|
|
839
|
+
const response = await this.request(requestPath, {
|
|
840
|
+
method: 'GET'
|
|
841
|
+
});
|
|
842
|
+
return response.transactions;
|
|
843
|
+
},
|
|
844
|
+
createAiTopup: async (request) => {
|
|
845
|
+
const response = await this.request(`/billing/ai-topup`, {
|
|
846
|
+
method: 'POST',
|
|
847
|
+
body: JSON.stringify(request)
|
|
848
|
+
});
|
|
849
|
+
return response;
|
|
850
|
+
},
|
|
731
851
|
listInvoices: async (options) => {
|
|
732
852
|
const params = new URLSearchParams();
|
|
733
853
|
if (options?.page !== undefined)
|
|
@@ -826,38 +946,6 @@ class BackstageClient {
|
|
|
826
946
|
method: 'PUT'
|
|
827
947
|
});
|
|
828
948
|
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
949
|
}
|
|
862
950
|
};
|
|
863
951
|
this.inventory = {
|
|
@@ -1095,6 +1183,85 @@ class BackstageClient {
|
|
|
1095
1183
|
method: 'POST'
|
|
1096
1184
|
});
|
|
1097
1185
|
return response.customer;
|
|
1186
|
+
},
|
|
1187
|
+
listBenefits: async (customerId, options) => {
|
|
1188
|
+
const params = new URLSearchParams();
|
|
1189
|
+
if (options?.includeRevoked !== undefined)
|
|
1190
|
+
params.append('includeRevoked', String(options.includeRevoked));
|
|
1191
|
+
const queryString = params.toString();
|
|
1192
|
+
const requestPath = queryString ? `/customers/${customerId}/benefits?${queryString}` : `/customers/${customerId}/benefits`;
|
|
1193
|
+
const response = await this.request(requestPath, {
|
|
1194
|
+
method: 'GET'
|
|
1195
|
+
});
|
|
1196
|
+
return response.benefits;
|
|
1197
|
+
},
|
|
1198
|
+
grantBenefit: async (customerId, request) => {
|
|
1199
|
+
const response = await this.request(`/customers/${customerId}/benefits`, {
|
|
1200
|
+
method: 'POST',
|
|
1201
|
+
body: JSON.stringify(request)
|
|
1202
|
+
});
|
|
1203
|
+
return response.benefit;
|
|
1204
|
+
},
|
|
1205
|
+
revokeBenefit: async (customerId, benefitId) => {
|
|
1206
|
+
const response = await this.request(`/customers/${customerId}/benefits/${benefitId}/revoke`, {
|
|
1207
|
+
method: 'POST'
|
|
1208
|
+
});
|
|
1209
|
+
return response.benefit;
|
|
1210
|
+
}
|
|
1211
|
+
};
|
|
1212
|
+
this.refundPolicies = {
|
|
1213
|
+
listPolicies: async () => {
|
|
1214
|
+
const response = await this.request(`/refund-policies`, {
|
|
1215
|
+
method: 'GET'
|
|
1216
|
+
});
|
|
1217
|
+
return response.policies;
|
|
1218
|
+
},
|
|
1219
|
+
upsertPolicy: async (request) => {
|
|
1220
|
+
const response = await this.request(`/refund-policies`, {
|
|
1221
|
+
method: 'PUT',
|
|
1222
|
+
body: JSON.stringify(request)
|
|
1223
|
+
});
|
|
1224
|
+
return response.policy;
|
|
1225
|
+
}
|
|
1226
|
+
};
|
|
1227
|
+
this.refundRequests = {
|
|
1228
|
+
listRequests: async (options) => {
|
|
1229
|
+
const params = new URLSearchParams();
|
|
1230
|
+
if (options?.status !== undefined)
|
|
1231
|
+
params.append('status', String(options.status));
|
|
1232
|
+
const queryString = params.toString();
|
|
1233
|
+
const requestPath = queryString ? `/refund-requests?${queryString}` : `/refund-requests`;
|
|
1234
|
+
const response = await this.request(requestPath, {
|
|
1235
|
+
method: 'GET'
|
|
1236
|
+
});
|
|
1237
|
+
return response.requests;
|
|
1238
|
+
},
|
|
1239
|
+
createRequest: async (request) => {
|
|
1240
|
+
const response = await this.request(`/refund-requests`, {
|
|
1241
|
+
method: 'POST',
|
|
1242
|
+
body: JSON.stringify(request)
|
|
1243
|
+
});
|
|
1244
|
+
return response.request;
|
|
1245
|
+
},
|
|
1246
|
+
approveRequest: async (requestId, request) => {
|
|
1247
|
+
const response = await this.request(`/refund-requests/${requestId}/approve`, {
|
|
1248
|
+
method: 'POST',
|
|
1249
|
+
body: JSON.stringify(request)
|
|
1250
|
+
});
|
|
1251
|
+
return response.request;
|
|
1252
|
+
},
|
|
1253
|
+
processRequest: async (requestId) => {
|
|
1254
|
+
const response = await this.request(`/refund-requests/${requestId}/process`, {
|
|
1255
|
+
method: 'POST'
|
|
1256
|
+
});
|
|
1257
|
+
return response;
|
|
1258
|
+
},
|
|
1259
|
+
rejectRequest: async (requestId, request) => {
|
|
1260
|
+
const response = await this.request(`/refund-requests/${requestId}/reject`, {
|
|
1261
|
+
method: 'POST',
|
|
1262
|
+
body: JSON.stringify(request)
|
|
1263
|
+
});
|
|
1264
|
+
return response.request;
|
|
1098
1265
|
}
|
|
1099
1266
|
};
|
|
1100
1267
|
this.orders = {
|
|
@@ -1153,6 +1320,24 @@ class BackstageClient {
|
|
|
1153
1320
|
});
|
|
1154
1321
|
return response.order;
|
|
1155
1322
|
},
|
|
1323
|
+
getPasses: async (orderId) => {
|
|
1324
|
+
const response = await this.request(`/orders/${orderId}/passes`, {
|
|
1325
|
+
method: 'GET'
|
|
1326
|
+
});
|
|
1327
|
+
return response;
|
|
1328
|
+
},
|
|
1329
|
+
getPassPdf: async (orderId, passId) => {
|
|
1330
|
+
const response = await this.request(`/orders/${orderId}/passes/${passId}/ticket.pdf`, {
|
|
1331
|
+
method: 'GET'
|
|
1332
|
+
});
|
|
1333
|
+
return response;
|
|
1334
|
+
},
|
|
1335
|
+
resendConfirmation: async (orderId) => {
|
|
1336
|
+
const response = await this.request(`/orders/${orderId}/resend-confirmation`, {
|
|
1337
|
+
method: 'POST'
|
|
1338
|
+
});
|
|
1339
|
+
return response;
|
|
1340
|
+
},
|
|
1156
1341
|
cancel: async (orderId, request) => {
|
|
1157
1342
|
const response = await this.request(`/orders/${orderId}/cancel`, {
|
|
1158
1343
|
method: 'POST',
|
|
@@ -1207,24 +1392,6 @@ class BackstageClient {
|
|
|
1207
1392
|
});
|
|
1208
1393
|
return response;
|
|
1209
1394
|
},
|
|
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
1395
|
printPass: async (orderId, passId, request) => {
|
|
1229
1396
|
const response = await this.request(`/orders/${orderId}/passes/${passId}/print`, {
|
|
1230
1397
|
method: 'POST',
|
|
@@ -1294,63 +1461,6 @@ class BackstageClient {
|
|
|
1294
1461
|
}
|
|
1295
1462
|
};
|
|
1296
1463
|
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
1464
|
enableTicketlayerPay: async (request) => {
|
|
1355
1465
|
const response = await this.request(`/payment-providers/ticketlayer-pay/enable`, {
|
|
1356
1466
|
method: 'POST',
|
|
@@ -1431,6 +1541,70 @@ class BackstageClient {
|
|
|
1431
1541
|
body: JSON.stringify(request)
|
|
1432
1542
|
});
|
|
1433
1543
|
return response.link;
|
|
1544
|
+
},
|
|
1545
|
+
create: async (request) => {
|
|
1546
|
+
const response = await this.request(`/payment-providers`, {
|
|
1547
|
+
method: 'POST',
|
|
1548
|
+
body: JSON.stringify(request)
|
|
1549
|
+
});
|
|
1550
|
+
return response.provider;
|
|
1551
|
+
},
|
|
1552
|
+
list: async (options) => {
|
|
1553
|
+
const params = new URLSearchParams();
|
|
1554
|
+
if (options?.accountId !== undefined)
|
|
1555
|
+
params.append('accountId', String(options.accountId));
|
|
1556
|
+
if (options?.type !== undefined)
|
|
1557
|
+
params.append('type', String(options.type));
|
|
1558
|
+
if (options?.status !== undefined)
|
|
1559
|
+
params.append('status', String(options.status));
|
|
1560
|
+
if (options?.paymentType !== undefined)
|
|
1561
|
+
params.append('paymentType', String(options.paymentType));
|
|
1562
|
+
if (options?.isDefault !== undefined)
|
|
1563
|
+
params.append('isDefault', String(options.isDefault));
|
|
1564
|
+
if (options?.integrationType !== undefined)
|
|
1565
|
+
params.append('integrationType', String(options.integrationType));
|
|
1566
|
+
if (options?.page !== undefined)
|
|
1567
|
+
params.append('page', String(options.page));
|
|
1568
|
+
if (options?.limit !== undefined)
|
|
1569
|
+
params.append('limit', String(options.limit));
|
|
1570
|
+
const queryString = params.toString();
|
|
1571
|
+
const requestPath = queryString ? `/payment-providers?${queryString}` : `/payment-providers`;
|
|
1572
|
+
const response = await this.request(requestPath, {
|
|
1573
|
+
method: 'GET'
|
|
1574
|
+
});
|
|
1575
|
+
return response;
|
|
1576
|
+
},
|
|
1577
|
+
getDefault: async () => {
|
|
1578
|
+
const response = await this.request(`/payment-providers/default`, {
|
|
1579
|
+
method: 'GET'
|
|
1580
|
+
});
|
|
1581
|
+
return response.provider;
|
|
1582
|
+
},
|
|
1583
|
+
get: async (providerId) => {
|
|
1584
|
+
const response = await this.request(`/payment-providers/${providerId}`, {
|
|
1585
|
+
method: 'GET'
|
|
1586
|
+
});
|
|
1587
|
+
return response.provider;
|
|
1588
|
+
},
|
|
1589
|
+
update: async (providerId, request) => {
|
|
1590
|
+
const response = await this.request(`/payment-providers/${providerId}`, {
|
|
1591
|
+
method: 'PATCH',
|
|
1592
|
+
body: JSON.stringify(request)
|
|
1593
|
+
});
|
|
1594
|
+
return response.provider;
|
|
1595
|
+
},
|
|
1596
|
+
delete: async (providerId) => {
|
|
1597
|
+
const response = await this.request(`/payment-providers/${providerId}`, {
|
|
1598
|
+
method: 'DELETE'
|
|
1599
|
+
});
|
|
1600
|
+
return response;
|
|
1601
|
+
},
|
|
1602
|
+
reportStatus: async (providerId, request) => {
|
|
1603
|
+
const response = await this.request(`/payment-providers/${providerId}/status`, {
|
|
1604
|
+
method: 'POST',
|
|
1605
|
+
body: JSON.stringify(request)
|
|
1606
|
+
});
|
|
1607
|
+
return response.provider;
|
|
1434
1608
|
}
|
|
1435
1609
|
};
|
|
1436
1610
|
this.salesChannels = Object.assign((channelId) => ({
|
|
@@ -1544,224 +1718,73 @@ class BackstageClient {
|
|
|
1544
1718
|
method: 'DELETE'
|
|
1545
1719
|
});
|
|
1546
1720
|
return response.deleted;
|
|
1547
|
-
}
|
|
1548
|
-
});
|
|
1549
|
-
this.presaleCodes = {
|
|
1550
|
-
create: async (request) => {
|
|
1551
|
-
const response = await this.request(`/presale-codes`, {
|
|
1552
|
-
method: 'POST',
|
|
1553
|
-
body: JSON.stringify(request)
|
|
1554
|
-
});
|
|
1555
|
-
return response.presaleCode;
|
|
1556
|
-
},
|
|
1557
|
-
list: async () => {
|
|
1558
|
-
const response = await this.request(`/presale-codes`, {
|
|
1559
|
-
method: 'GET'
|
|
1560
|
-
});
|
|
1561
|
-
return response.presaleCodes;
|
|
1562
|
-
},
|
|
1563
|
-
deactivate: async (codeId) => {
|
|
1564
|
-
const response = await this.request(`/presale-codes/${codeId}/deactivate`, {
|
|
1565
|
-
method: 'POST'
|
|
1566
|
-
});
|
|
1567
|
-
return response.presaleCode;
|
|
1568
|
-
}
|
|
1569
|
-
};
|
|
1570
|
-
this.feeProfiles = {
|
|
1571
|
-
create: async (request) => {
|
|
1572
|
-
const response = await this.request(`/fee-profiles`, {
|
|
1573
|
-
method: 'POST',
|
|
1574
|
-
body: JSON.stringify(request)
|
|
1575
|
-
});
|
|
1576
|
-
return response.feeProfile;
|
|
1577
|
-
},
|
|
1578
|
-
list: async () => {
|
|
1579
|
-
const response = await this.request(`/fee-profiles`, {
|
|
1580
|
-
method: 'GET'
|
|
1581
|
-
});
|
|
1582
|
-
return response.feeProfiles;
|
|
1583
|
-
},
|
|
1584
|
-
get: async (profileId) => {
|
|
1585
|
-
const response = await this.request(`/fee-profiles/${profileId}`, {
|
|
1586
|
-
method: 'GET'
|
|
1587
|
-
});
|
|
1588
|
-
return response.feeProfile;
|
|
1589
|
-
},
|
|
1590
|
-
update: async (profileId, request) => {
|
|
1591
|
-
const response = await this.request(`/fee-profiles/${profileId}`, {
|
|
1592
|
-
method: 'PATCH',
|
|
1593
|
-
body: JSON.stringify(request)
|
|
1594
|
-
});
|
|
1595
|
-
return response.feeProfile;
|
|
1596
|
-
},
|
|
1597
|
-
delete: async (profileId) => {
|
|
1598
|
-
const response = await this.request(`/fee-profiles/${profileId}`, {
|
|
1599
|
-
method: 'DELETE'
|
|
1600
|
-
});
|
|
1601
|
-
return response.deleted;
|
|
1602
|
-
}
|
|
1603
|
-
};
|
|
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
1721
|
},
|
|
1629
|
-
|
|
1630
|
-
const response = await this.request(`/sales
|
|
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}`, {
|
|
1722
|
+
getCatalogue: async (channelId) => {
|
|
1723
|
+
const response = await this.request(`/sales-channels/${channelId}/catalogue`, {
|
|
1646
1724
|
method: 'GET'
|
|
1647
1725
|
});
|
|
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
1726
|
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
1727
|
},
|
|
1686
|
-
|
|
1687
|
-
const response = await this.request(`/sales
|
|
1728
|
+
getCatalogueEvent: async (channelId, eventId) => {
|
|
1729
|
+
const response = await this.request(`/sales-channels/${channelId}/catalogue/events/${eventId}`, {
|
|
1688
1730
|
method: 'GET'
|
|
1689
1731
|
});
|
|
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;
|
|
1732
|
+
return response.event;
|
|
1709
1733
|
}
|
|
1710
|
-
};
|
|
1711
|
-
this.
|
|
1734
|
+
});
|
|
1735
|
+
this.presaleCodes = {
|
|
1712
1736
|
create: async (request) => {
|
|
1713
|
-
const response = await this.request(`/
|
|
1737
|
+
const response = await this.request(`/presale-codes`, {
|
|
1714
1738
|
method: 'POST',
|
|
1715
1739
|
body: JSON.stringify(request)
|
|
1716
1740
|
});
|
|
1717
|
-
return response.
|
|
1741
|
+
return response.presaleCode;
|
|
1718
1742
|
},
|
|
1719
|
-
|
|
1720
|
-
const response = await this.request(`/
|
|
1743
|
+
list: async () => {
|
|
1744
|
+
const response = await this.request(`/presale-codes`, {
|
|
1721
1745
|
method: 'GET'
|
|
1722
1746
|
});
|
|
1723
|
-
return response.
|
|
1747
|
+
return response.presaleCodes;
|
|
1724
1748
|
},
|
|
1725
|
-
|
|
1726
|
-
const response = await this.request(`/
|
|
1727
|
-
method: '
|
|
1728
|
-
body: JSON.stringify(request)
|
|
1749
|
+
deactivate: async (codeId) => {
|
|
1750
|
+
const response = await this.request(`/presale-codes/${codeId}/deactivate`, {
|
|
1751
|
+
method: 'POST'
|
|
1729
1752
|
});
|
|
1730
|
-
return response.
|
|
1753
|
+
return response.presaleCode;
|
|
1731
1754
|
}
|
|
1732
1755
|
};
|
|
1733
|
-
this.
|
|
1734
|
-
|
|
1735
|
-
const response = await this.request(`/
|
|
1756
|
+
this.feeProfiles = {
|
|
1757
|
+
create: async (request) => {
|
|
1758
|
+
const response = await this.request(`/fee-profiles`, {
|
|
1736
1759
|
method: 'POST',
|
|
1737
1760
|
body: JSON.stringify(request)
|
|
1738
1761
|
});
|
|
1739
|
-
return response;
|
|
1740
|
-
}
|
|
1741
|
-
|
|
1742
|
-
|
|
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, {
|
|
1762
|
+
return response.feeProfile;
|
|
1763
|
+
},
|
|
1764
|
+
list: async () => {
|
|
1765
|
+
const response = await this.request(`/fee-profiles`, {
|
|
1750
1766
|
method: 'GET'
|
|
1751
1767
|
});
|
|
1752
|
-
return response;
|
|
1768
|
+
return response.feeProfiles;
|
|
1753
1769
|
},
|
|
1754
|
-
get: async (
|
|
1755
|
-
const response = await this.request(`/
|
|
1770
|
+
get: async (profileId) => {
|
|
1771
|
+
const response = await this.request(`/fee-profiles/${profileId}`, {
|
|
1756
1772
|
method: 'GET'
|
|
1757
1773
|
});
|
|
1758
|
-
return response.
|
|
1774
|
+
return response.feeProfile;
|
|
1759
1775
|
},
|
|
1760
|
-
|
|
1761
|
-
const response = await this.request(`/
|
|
1762
|
-
method: '
|
|
1776
|
+
update: async (profileId, request) => {
|
|
1777
|
+
const response = await this.request(`/fee-profiles/${profileId}`, {
|
|
1778
|
+
method: 'PATCH',
|
|
1779
|
+
body: JSON.stringify(request)
|
|
1763
1780
|
});
|
|
1764
|
-
return response.
|
|
1781
|
+
return response.feeProfile;
|
|
1782
|
+
},
|
|
1783
|
+
delete: async (profileId) => {
|
|
1784
|
+
const response = await this.request(`/fee-profiles/${profileId}`, {
|
|
1785
|
+
method: 'DELETE'
|
|
1786
|
+
});
|
|
1787
|
+
return response.deleted;
|
|
1765
1788
|
}
|
|
1766
1789
|
};
|
|
1767
1790
|
this.themes = {
|
|
@@ -2121,6 +2144,12 @@ class BackstageClient {
|
|
|
2121
2144
|
});
|
|
2122
2145
|
return response;
|
|
2123
2146
|
},
|
|
2147
|
+
getCommand: async (commandId) => {
|
|
2148
|
+
const response = await this.request(`/devices/commands/${commandId}`, {
|
|
2149
|
+
method: 'GET'
|
|
2150
|
+
});
|
|
2151
|
+
return response;
|
|
2152
|
+
},
|
|
2124
2153
|
list: async (options) => {
|
|
2125
2154
|
const params = new URLSearchParams();
|
|
2126
2155
|
if (options?.accountId !== undefined)
|
|
@@ -2192,12 +2221,6 @@ class BackstageClient {
|
|
|
2192
2221
|
});
|
|
2193
2222
|
return response;
|
|
2194
2223
|
},
|
|
2195
|
-
getCommand: async (commandId) => {
|
|
2196
|
-
const response = await this.request(`/devices/commands/${commandId}`, {
|
|
2197
|
-
method: 'GET'
|
|
2198
|
-
});
|
|
2199
|
-
return response;
|
|
2200
|
-
},
|
|
2201
2224
|
listEvents: async (deviceId) => {
|
|
2202
2225
|
const response = await this.request(`/devices/${deviceId}/events`, {
|
|
2203
2226
|
method: 'GET'
|
|
@@ -2442,21 +2465,7 @@ class BackstageClient {
|
|
|
2442
2465
|
return response;
|
|
2443
2466
|
}
|
|
2444
2467
|
};
|
|
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
2468
|
this.webhookDeliveries = {
|
|
2454
|
-
listInbound: async () => {
|
|
2455
|
-
const response = await this.request(`/webhook-inbound`, {
|
|
2456
|
-
method: 'GET'
|
|
2457
|
-
});
|
|
2458
|
-
return response;
|
|
2459
|
-
},
|
|
2460
2469
|
list: async (options) => {
|
|
2461
2470
|
const params = new URLSearchParams();
|
|
2462
2471
|
if (options?.endpointId !== undefined)
|
|
@@ -2475,6 +2484,20 @@ class BackstageClient {
|
|
|
2475
2484
|
method: 'GET'
|
|
2476
2485
|
});
|
|
2477
2486
|
return response;
|
|
2487
|
+
},
|
|
2488
|
+
listInbound: async () => {
|
|
2489
|
+
const response = await this.request(`/webhook-inbound`, {
|
|
2490
|
+
method: 'GET'
|
|
2491
|
+
});
|
|
2492
|
+
return response;
|
|
2493
|
+
}
|
|
2494
|
+
};
|
|
2495
|
+
this.webhookEventTypes = {
|
|
2496
|
+
list: async () => {
|
|
2497
|
+
const response = await this.request(`/webhook-event-types`, {
|
|
2498
|
+
method: 'GET'
|
|
2499
|
+
});
|
|
2500
|
+
return response;
|
|
2478
2501
|
}
|
|
2479
2502
|
};
|
|
2480
2503
|
this.integrations = {
|
|
@@ -2503,6 +2526,169 @@ class BackstageClient {
|
|
|
2503
2526
|
return response;
|
|
2504
2527
|
}
|
|
2505
2528
|
};
|
|
2529
|
+
this.sales = {
|
|
2530
|
+
resolveChannel: async (options) => {
|
|
2531
|
+
const params = new URLSearchParams();
|
|
2532
|
+
if (options?.domain !== undefined)
|
|
2533
|
+
params.append('domain', String(options.domain));
|
|
2534
|
+
const queryString = params.toString();
|
|
2535
|
+
const requestPath = queryString ? `/sales/channel?${queryString}` : `/sales/channel`;
|
|
2536
|
+
const response = await this.request(requestPath, {
|
|
2537
|
+
method: 'GET'
|
|
2538
|
+
});
|
|
2539
|
+
return response;
|
|
2540
|
+
},
|
|
2541
|
+
get: async (eventId) => {
|
|
2542
|
+
const response = await this.request(`/sales/events/${eventId}`, {
|
|
2543
|
+
method: 'GET'
|
|
2544
|
+
});
|
|
2545
|
+
return response.event;
|
|
2546
|
+
},
|
|
2547
|
+
getTheme: async () => {
|
|
2548
|
+
const response = await this.request(`/sales/theme`, {
|
|
2549
|
+
method: 'GET'
|
|
2550
|
+
});
|
|
2551
|
+
return response.theme;
|
|
2552
|
+
}
|
|
2553
|
+
};
|
|
2554
|
+
this.salesCustomerAuth = {
|
|
2555
|
+
magicLink: async (request) => {
|
|
2556
|
+
const response = await this.request(`/sales/customer-auth/magic-link`, {
|
|
2557
|
+
method: 'POST',
|
|
2558
|
+
body: JSON.stringify(request)
|
|
2559
|
+
});
|
|
2560
|
+
return response.sent;
|
|
2561
|
+
}
|
|
2562
|
+
};
|
|
2563
|
+
this.salesCustomerTokens = {
|
|
2564
|
+
create: async (request) => {
|
|
2565
|
+
const response = await this.request(`/sales/customer-tokens`, {
|
|
2566
|
+
method: 'POST',
|
|
2567
|
+
body: JSON.stringify(request)
|
|
2568
|
+
});
|
|
2569
|
+
return response;
|
|
2570
|
+
},
|
|
2571
|
+
refresh: async () => {
|
|
2572
|
+
const response = await this.request(`/sales/customer-tokens/refresh`, {
|
|
2573
|
+
method: 'POST'
|
|
2574
|
+
});
|
|
2575
|
+
return response;
|
|
2576
|
+
}
|
|
2577
|
+
};
|
|
2578
|
+
this.salesListings = {
|
|
2579
|
+
list: async () => {
|
|
2580
|
+
const response = await this.request(`/sales/listings`, {
|
|
2581
|
+
method: 'GET'
|
|
2582
|
+
});
|
|
2583
|
+
return response;
|
|
2584
|
+
}
|
|
2585
|
+
};
|
|
2586
|
+
this.salesCarts = {
|
|
2587
|
+
create: async (request) => {
|
|
2588
|
+
const response = await this.request(`/sales/carts`, {
|
|
2589
|
+
method: 'POST',
|
|
2590
|
+
body: JSON.stringify(request)
|
|
2591
|
+
});
|
|
2592
|
+
return response.cart;
|
|
2593
|
+
},
|
|
2594
|
+
get: async (cartId) => {
|
|
2595
|
+
const response = await this.request(`/sales/carts/${cartId}`, {
|
|
2596
|
+
method: 'GET'
|
|
2597
|
+
});
|
|
2598
|
+
return response.cart;
|
|
2599
|
+
},
|
|
2600
|
+
addItem: async (cartId, request) => {
|
|
2601
|
+
const response = await this.request(`/sales/carts/${cartId}/items`, {
|
|
2602
|
+
method: 'POST',
|
|
2603
|
+
body: JSON.stringify(request)
|
|
2604
|
+
});
|
|
2605
|
+
return response.cart;
|
|
2606
|
+
},
|
|
2607
|
+
removeItem: async (cartId, itemId) => {
|
|
2608
|
+
const response = await this.request(`/sales/carts/${cartId}/items/${itemId}`, {
|
|
2609
|
+
method: 'DELETE'
|
|
2610
|
+
});
|
|
2611
|
+
return response.cart;
|
|
2612
|
+
},
|
|
2613
|
+
checkout: async (cartId, request) => {
|
|
2614
|
+
const response = await this.request(`/sales/carts/${cartId}/checkout`, {
|
|
2615
|
+
method: 'POST',
|
|
2616
|
+
body: JSON.stringify(request)
|
|
2617
|
+
});
|
|
2618
|
+
return response;
|
|
2619
|
+
}
|
|
2620
|
+
};
|
|
2621
|
+
this.salesMyOrders = {
|
|
2622
|
+
list: async () => {
|
|
2623
|
+
const response = await this.request(`/sales/my-orders`, {
|
|
2624
|
+
method: 'GET'
|
|
2625
|
+
});
|
|
2626
|
+
return response.orders;
|
|
2627
|
+
}
|
|
2628
|
+
};
|
|
2629
|
+
this.salesOrders = {
|
|
2630
|
+
get: async (orderId) => {
|
|
2631
|
+
const response = await this.request(`/sales/orders/${orderId}`, {
|
|
2632
|
+
method: 'GET'
|
|
2633
|
+
});
|
|
2634
|
+
return response.order;
|
|
2635
|
+
},
|
|
2636
|
+
ticketPdf: async (orderId, passId) => {
|
|
2637
|
+
const response = await this.request(`/sales/orders/${orderId}/passes/${passId}/ticket.pdf`, {
|
|
2638
|
+
method: 'GET'
|
|
2639
|
+
});
|
|
2640
|
+
return response;
|
|
2641
|
+
}
|
|
2642
|
+
};
|
|
2643
|
+
this.salesOrderPayments = {
|
|
2644
|
+
create: async (orderId, request) => {
|
|
2645
|
+
const response = await this.request(`/sales/orders/${orderId}/payments`, {
|
|
2646
|
+
method: 'POST',
|
|
2647
|
+
body: JSON.stringify(request)
|
|
2648
|
+
});
|
|
2649
|
+
return response.payment;
|
|
2650
|
+
}
|
|
2651
|
+
};
|
|
2652
|
+
this.salesRefundRequests = {
|
|
2653
|
+
create: async (orderId, request) => {
|
|
2654
|
+
const response = await this.request(`/sales/orders/${orderId}/refund-requests`, {
|
|
2655
|
+
method: 'POST',
|
|
2656
|
+
body: JSON.stringify(request)
|
|
2657
|
+
});
|
|
2658
|
+
return response.request;
|
|
2659
|
+
}
|
|
2660
|
+
};
|
|
2661
|
+
this.salesCustomers = {
|
|
2662
|
+
create: async (request) => {
|
|
2663
|
+
const response = await this.request(`/sales/customers`, {
|
|
2664
|
+
method: 'POST',
|
|
2665
|
+
body: JSON.stringify(request)
|
|
2666
|
+
});
|
|
2667
|
+
return response.customer;
|
|
2668
|
+
},
|
|
2669
|
+
get: async (customerId) => {
|
|
2670
|
+
const response = await this.request(`/sales/customers/${customerId}`, {
|
|
2671
|
+
method: 'GET'
|
|
2672
|
+
});
|
|
2673
|
+
return response.customer;
|
|
2674
|
+
},
|
|
2675
|
+
update: async (customerId, request) => {
|
|
2676
|
+
const response = await this.request(`/sales/customers/${customerId}`, {
|
|
2677
|
+
method: 'PATCH',
|
|
2678
|
+
body: JSON.stringify(request)
|
|
2679
|
+
});
|
|
2680
|
+
return response.customer;
|
|
2681
|
+
}
|
|
2682
|
+
};
|
|
2683
|
+
this.salesPresaleCodes = {
|
|
2684
|
+
redeem: async (request) => {
|
|
2685
|
+
const response = await this.request(`/sales/presale-codes/redeem`, {
|
|
2686
|
+
method: 'POST',
|
|
2687
|
+
body: JSON.stringify(request)
|
|
2688
|
+
});
|
|
2689
|
+
return response;
|
|
2690
|
+
}
|
|
2691
|
+
};
|
|
2506
2692
|
this.baseUrl = config.baseUrl.replace(/\/$/, '');
|
|
2507
2693
|
this.authMode = config.authMode || 'bearer';
|
|
2508
2694
|
this.accessToken = config.accessToken;
|