@checkoutpage/sdk 0.1.14 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -0
- package/dist/index.d.mts +15240 -731
- package/dist/index.d.ts +15240 -731
- package/dist/index.js +749 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +749 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -3
package/dist/index.js
CHANGED
|
@@ -70,14 +70,18 @@ var CheckoutPageApiClient = class {
|
|
|
70
70
|
const url = this.buildUrl(options.path, options.query);
|
|
71
71
|
const headers = {
|
|
72
72
|
Authorization: `Bearer ${this.apiKey}`,
|
|
73
|
-
"Content-Type": "application/json",
|
|
74
73
|
"User-Agent": "@checkoutpage/sdk/0.1.0"
|
|
75
74
|
};
|
|
75
|
+
if (!options.formData) {
|
|
76
|
+
headers["Content-Type"] = "application/json";
|
|
77
|
+
}
|
|
76
78
|
const fetchOptions = {
|
|
77
79
|
method: options.method,
|
|
78
80
|
headers
|
|
79
81
|
};
|
|
80
|
-
if (options.
|
|
82
|
+
if (options.formData) {
|
|
83
|
+
fetchOptions.body = options.formData;
|
|
84
|
+
} else if (options.body) {
|
|
81
85
|
fetchOptions.body = JSON.stringify(options.body);
|
|
82
86
|
}
|
|
83
87
|
const response = await fetch(url, fetchOptions);
|
|
@@ -199,6 +203,9 @@ var CouponResource = class {
|
|
|
199
203
|
if (params.pageIds !== void 0) {
|
|
200
204
|
body.pageIds = params.pageIds;
|
|
201
205
|
}
|
|
206
|
+
if (params.ticketTypeIds !== void 0) {
|
|
207
|
+
body.ticketTypeIds = params.ticketTypeIds;
|
|
208
|
+
}
|
|
202
209
|
if (params.maxRedemptions !== void 0) {
|
|
203
210
|
body.maxRedemptions = params.maxRedemptions;
|
|
204
211
|
}
|
|
@@ -229,6 +236,13 @@ var PaymentResource = class {
|
|
|
229
236
|
search: args.search,
|
|
230
237
|
status: args.status,
|
|
231
238
|
pageId: args.pageId,
|
|
239
|
+
customerId: args.customerId,
|
|
240
|
+
orderId: args.orderId,
|
|
241
|
+
couponCode: args.couponCode,
|
|
242
|
+
productId: args.productId,
|
|
243
|
+
createdAfter: args.createdAfter,
|
|
244
|
+
createdBefore: args.createdBefore,
|
|
245
|
+
abandonmentStatus: args.abandonmentStatus,
|
|
232
246
|
limit: args.limit?.toString(),
|
|
233
247
|
starting_after: args.starting_after,
|
|
234
248
|
ending_before: args.ending_before
|
|
@@ -271,11 +285,17 @@ var BookingResource = class {
|
|
|
271
285
|
async list(args = {}) {
|
|
272
286
|
const query = {
|
|
273
287
|
search: args.search,
|
|
288
|
+
status: args.status,
|
|
289
|
+
pageId: args.pageId,
|
|
290
|
+
customerId: args.customerId,
|
|
291
|
+
orderId: args.orderId,
|
|
292
|
+
couponCode: args.couponCode,
|
|
293
|
+
createdAfter: args.createdAfter,
|
|
294
|
+
createdBefore: args.createdBefore,
|
|
295
|
+
abandonmentStatus: args.abandonmentStatus,
|
|
274
296
|
limit: args.limit?.toString(),
|
|
275
297
|
starting_after: args.starting_after,
|
|
276
|
-
ending_before: args.ending_before
|
|
277
|
-
status: args.status,
|
|
278
|
-
pageId: args.pageId
|
|
298
|
+
ending_before: args.ending_before
|
|
279
299
|
};
|
|
280
300
|
return this.client.request({
|
|
281
301
|
method: "GET",
|
|
@@ -285,6 +305,714 @@ var BookingResource = class {
|
|
|
285
305
|
}
|
|
286
306
|
};
|
|
287
307
|
|
|
308
|
+
// src/resources/tickets/tickets.ts
|
|
309
|
+
var TicketResource = class {
|
|
310
|
+
constructor(client) {
|
|
311
|
+
this.client = client;
|
|
312
|
+
}
|
|
313
|
+
async validate(qrCode, params) {
|
|
314
|
+
const body = params || {};
|
|
315
|
+
const response = await this.client.request({
|
|
316
|
+
method: "POST",
|
|
317
|
+
path: `/v1/tickets/validate/${qrCode}`,
|
|
318
|
+
body
|
|
319
|
+
});
|
|
320
|
+
return response.data;
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
// src/resources/products/products.ts
|
|
325
|
+
var ProductResource = class {
|
|
326
|
+
constructor(client) {
|
|
327
|
+
this.client = client;
|
|
328
|
+
}
|
|
329
|
+
async get(productId) {
|
|
330
|
+
if (!productId) {
|
|
331
|
+
throw new Error("Product ID is required");
|
|
332
|
+
}
|
|
333
|
+
return this.client.request({
|
|
334
|
+
method: "GET",
|
|
335
|
+
path: `/v1/products/${productId}`
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
async update(productId, params) {
|
|
339
|
+
if (!productId) {
|
|
340
|
+
throw new Error("Product ID is required");
|
|
341
|
+
}
|
|
342
|
+
const body = {};
|
|
343
|
+
if (params.title !== void 0) {
|
|
344
|
+
body.title = params.title;
|
|
345
|
+
}
|
|
346
|
+
if (params.description !== void 0) {
|
|
347
|
+
body.description = params.description;
|
|
348
|
+
}
|
|
349
|
+
if (params.price !== void 0) {
|
|
350
|
+
body.price = params.price;
|
|
351
|
+
}
|
|
352
|
+
if (params.sku !== void 0) {
|
|
353
|
+
body.sku = params.sku;
|
|
354
|
+
}
|
|
355
|
+
if (params.hasUnlimitedStock !== void 0) {
|
|
356
|
+
body.hasUnlimitedStock = params.hasUnlimitedStock;
|
|
357
|
+
}
|
|
358
|
+
if (params.stock !== void 0) {
|
|
359
|
+
body.stock = params.stock;
|
|
360
|
+
}
|
|
361
|
+
if (params.taxBehavior !== void 0) {
|
|
362
|
+
body.taxBehavior = params.taxBehavior;
|
|
363
|
+
}
|
|
364
|
+
if (params.taxCode !== void 0) {
|
|
365
|
+
body.taxCode = params.taxCode;
|
|
366
|
+
}
|
|
367
|
+
if (params.imageIds !== void 0) {
|
|
368
|
+
body.imageIds = params.imageIds;
|
|
369
|
+
}
|
|
370
|
+
if (params.fileIds !== void 0) {
|
|
371
|
+
body.fileIds = params.fileIds;
|
|
372
|
+
}
|
|
373
|
+
if (params.variantsRequired !== void 0) {
|
|
374
|
+
body.variantsRequired = params.variantsRequired;
|
|
375
|
+
}
|
|
376
|
+
if (params.variants !== void 0) {
|
|
377
|
+
body.variants = params.variants;
|
|
378
|
+
}
|
|
379
|
+
if (params.discounts !== void 0) {
|
|
380
|
+
body.discounts = params.discounts;
|
|
381
|
+
}
|
|
382
|
+
if (params.limitSubscriptions !== void 0) {
|
|
383
|
+
body.limitSubscriptions = params.limitSubscriptions;
|
|
384
|
+
}
|
|
385
|
+
if (params.generateLicenseKeys !== void 0) {
|
|
386
|
+
body.generateLicenseKeys = params.generateLicenseKeys;
|
|
387
|
+
}
|
|
388
|
+
return this.client.request({
|
|
389
|
+
method: "PATCH",
|
|
390
|
+
path: `/v1/products/${productId}`,
|
|
391
|
+
body
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
// src/resources/files/files.ts
|
|
397
|
+
var FileResource = class {
|
|
398
|
+
constructor(client) {
|
|
399
|
+
this.client = client;
|
|
400
|
+
}
|
|
401
|
+
async upload(params) {
|
|
402
|
+
if (!params.file) {
|
|
403
|
+
throw new Error("File is required");
|
|
404
|
+
}
|
|
405
|
+
if (!params.purpose) {
|
|
406
|
+
throw new Error("Purpose is required");
|
|
407
|
+
}
|
|
408
|
+
const formData = new FormData();
|
|
409
|
+
formData.append("file", params.file);
|
|
410
|
+
formData.append("purpose", params.purpose);
|
|
411
|
+
return this.client.request({
|
|
412
|
+
method: "POST",
|
|
413
|
+
path: "/v1/files/upload",
|
|
414
|
+
formData
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
async delete(fileId) {
|
|
418
|
+
if (!fileId) {
|
|
419
|
+
throw new Error("File ID is required");
|
|
420
|
+
}
|
|
421
|
+
return this.client.request({
|
|
422
|
+
method: "DELETE",
|
|
423
|
+
path: `/v1/files/${fileId}`
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
async download(fileId) {
|
|
427
|
+
if (!fileId) {
|
|
428
|
+
throw new Error("File ID is required");
|
|
429
|
+
}
|
|
430
|
+
return this.client.request({
|
|
431
|
+
method: "GET",
|
|
432
|
+
path: `/v1/files/${fileId}/download`
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
};
|
|
436
|
+
|
|
437
|
+
// src/resources/checkout-pages/checkout-pages.ts
|
|
438
|
+
var CheckoutPageFieldsResource = class {
|
|
439
|
+
constructor(client) {
|
|
440
|
+
this.client = client;
|
|
441
|
+
}
|
|
442
|
+
async list(pageId) {
|
|
443
|
+
if (!pageId) {
|
|
444
|
+
throw new Error("Page ID is required");
|
|
445
|
+
}
|
|
446
|
+
return this.client.request({
|
|
447
|
+
method: "GET",
|
|
448
|
+
path: `/v1/checkout-pages/${pageId}/fields`
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
async create(pageId, params) {
|
|
452
|
+
if (!pageId) {
|
|
453
|
+
throw new Error("Page ID is required");
|
|
454
|
+
}
|
|
455
|
+
return this.client.request({
|
|
456
|
+
method: "POST",
|
|
457
|
+
path: `/v1/checkout-pages/${pageId}/fields`,
|
|
458
|
+
body: params
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
async get(pageId, fieldId) {
|
|
462
|
+
if (!pageId) {
|
|
463
|
+
throw new Error("Page ID is required");
|
|
464
|
+
}
|
|
465
|
+
if (!fieldId) {
|
|
466
|
+
throw new Error("Field ID is required");
|
|
467
|
+
}
|
|
468
|
+
return this.client.request({
|
|
469
|
+
method: "GET",
|
|
470
|
+
path: `/v1/checkout-pages/${pageId}/fields/${fieldId}`
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
async update(pageId, fieldId, params) {
|
|
474
|
+
if (!pageId) {
|
|
475
|
+
throw new Error("Page ID is required");
|
|
476
|
+
}
|
|
477
|
+
if (!fieldId) {
|
|
478
|
+
throw new Error("Field ID is required");
|
|
479
|
+
}
|
|
480
|
+
return this.client.request({
|
|
481
|
+
method: "PATCH",
|
|
482
|
+
path: `/v1/checkout-pages/${pageId}/fields/${fieldId}`,
|
|
483
|
+
body: params
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
async delete(pageId, fieldId) {
|
|
487
|
+
if (!pageId) {
|
|
488
|
+
throw new Error("Page ID is required");
|
|
489
|
+
}
|
|
490
|
+
if (!fieldId) {
|
|
491
|
+
throw new Error("Field ID is required");
|
|
492
|
+
}
|
|
493
|
+
const response = await this.client.request({
|
|
494
|
+
method: "DELETE",
|
|
495
|
+
path: `/v1/checkout-pages/${pageId}/fields/${fieldId}`
|
|
496
|
+
});
|
|
497
|
+
return response;
|
|
498
|
+
}
|
|
499
|
+
};
|
|
500
|
+
var CheckoutPagesResource = class {
|
|
501
|
+
fields;
|
|
502
|
+
client;
|
|
503
|
+
constructor(client) {
|
|
504
|
+
this.client = client;
|
|
505
|
+
this.fields = new CheckoutPageFieldsResource(client);
|
|
506
|
+
}
|
|
507
|
+
async list(args = {}) {
|
|
508
|
+
const query = {
|
|
509
|
+
limit: args.limit?.toString(),
|
|
510
|
+
starting_after: args.starting_after,
|
|
511
|
+
ending_before: args.ending_before,
|
|
512
|
+
status: args.status,
|
|
513
|
+
search: args.search
|
|
514
|
+
};
|
|
515
|
+
return this.client.request({
|
|
516
|
+
method: "GET",
|
|
517
|
+
path: "/v1/checkout-pages/",
|
|
518
|
+
query
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
async create(params) {
|
|
522
|
+
return this.client.request({
|
|
523
|
+
method: "POST",
|
|
524
|
+
path: "/v1/checkout-pages/",
|
|
525
|
+
body: params
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
async get(pageId) {
|
|
529
|
+
if (!pageId) {
|
|
530
|
+
throw new Error("Page ID is required");
|
|
531
|
+
}
|
|
532
|
+
return this.client.request({
|
|
533
|
+
method: "GET",
|
|
534
|
+
path: `/v1/checkout-pages/${pageId}`
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
async update(pageId, params) {
|
|
538
|
+
if (!pageId) {
|
|
539
|
+
throw new Error("Page ID is required");
|
|
540
|
+
}
|
|
541
|
+
return this.client.request({
|
|
542
|
+
method: "PATCH",
|
|
543
|
+
path: `/v1/checkout-pages/${pageId}`,
|
|
544
|
+
body: params
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
async delete(pageId) {
|
|
548
|
+
if (!pageId) {
|
|
549
|
+
throw new Error("Page ID is required");
|
|
550
|
+
}
|
|
551
|
+
return this.client.request({
|
|
552
|
+
method: "DELETE",
|
|
553
|
+
path: `/v1/checkout-pages/${pageId}`
|
|
554
|
+
});
|
|
555
|
+
}
|
|
556
|
+
};
|
|
557
|
+
|
|
558
|
+
// src/resources/events/events.ts
|
|
559
|
+
var EventFieldsResource = class {
|
|
560
|
+
constructor(client) {
|
|
561
|
+
this.client = client;
|
|
562
|
+
}
|
|
563
|
+
async list(pageId) {
|
|
564
|
+
if (!pageId) {
|
|
565
|
+
throw new Error("Page ID is required");
|
|
566
|
+
}
|
|
567
|
+
return this.client.request({
|
|
568
|
+
method: "GET",
|
|
569
|
+
path: `/v1/events/${pageId}/fields`
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
async create(pageId, params) {
|
|
573
|
+
if (!pageId) {
|
|
574
|
+
throw new Error("Page ID is required");
|
|
575
|
+
}
|
|
576
|
+
return this.client.request({
|
|
577
|
+
method: "POST",
|
|
578
|
+
path: `/v1/events/${pageId}/fields`,
|
|
579
|
+
body: params
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
async get(pageId, fieldId) {
|
|
583
|
+
if (!pageId) {
|
|
584
|
+
throw new Error("Page ID is required");
|
|
585
|
+
}
|
|
586
|
+
if (!fieldId) {
|
|
587
|
+
throw new Error("Field ID is required");
|
|
588
|
+
}
|
|
589
|
+
return this.client.request({
|
|
590
|
+
method: "GET",
|
|
591
|
+
path: `/v1/events/${pageId}/fields/${fieldId}`
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
async update(pageId, fieldId, params) {
|
|
595
|
+
if (!pageId) {
|
|
596
|
+
throw new Error("Page ID is required");
|
|
597
|
+
}
|
|
598
|
+
if (!fieldId) {
|
|
599
|
+
throw new Error("Field ID is required");
|
|
600
|
+
}
|
|
601
|
+
return this.client.request({
|
|
602
|
+
method: "PATCH",
|
|
603
|
+
path: `/v1/events/${pageId}/fields/${fieldId}`,
|
|
604
|
+
body: params
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
async delete(pageId, fieldId) {
|
|
608
|
+
if (!pageId) {
|
|
609
|
+
throw new Error("Page ID is required");
|
|
610
|
+
}
|
|
611
|
+
if (!fieldId) {
|
|
612
|
+
throw new Error("Field ID is required");
|
|
613
|
+
}
|
|
614
|
+
return this.client.request({
|
|
615
|
+
method: "DELETE",
|
|
616
|
+
path: `/v1/events/${pageId}/fields/${fieldId}`
|
|
617
|
+
});
|
|
618
|
+
}
|
|
619
|
+
};
|
|
620
|
+
var EventTicketTypesResource = class {
|
|
621
|
+
constructor(client) {
|
|
622
|
+
this.client = client;
|
|
623
|
+
}
|
|
624
|
+
async list(pageId, ticketGroupId) {
|
|
625
|
+
if (!pageId) {
|
|
626
|
+
throw new Error("Page ID is required");
|
|
627
|
+
}
|
|
628
|
+
if (!ticketGroupId) {
|
|
629
|
+
throw new Error("Ticket group ID is required");
|
|
630
|
+
}
|
|
631
|
+
return this.client.request({
|
|
632
|
+
method: "GET",
|
|
633
|
+
path: `/v1/events/${pageId}/ticket-groups/${ticketGroupId}/ticket-types`
|
|
634
|
+
});
|
|
635
|
+
}
|
|
636
|
+
async create(pageId, ticketGroupId, params) {
|
|
637
|
+
if (!pageId) {
|
|
638
|
+
throw new Error("Page ID is required");
|
|
639
|
+
}
|
|
640
|
+
if (!ticketGroupId) {
|
|
641
|
+
throw new Error("Ticket group ID is required");
|
|
642
|
+
}
|
|
643
|
+
return this.client.request({
|
|
644
|
+
method: "POST",
|
|
645
|
+
path: `/v1/events/${pageId}/ticket-groups/${ticketGroupId}/ticket-types`,
|
|
646
|
+
body: params
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
async get(pageId, ticketGroupId, ticketTypeId) {
|
|
650
|
+
if (!pageId) {
|
|
651
|
+
throw new Error("Page ID is required");
|
|
652
|
+
}
|
|
653
|
+
if (!ticketGroupId) {
|
|
654
|
+
throw new Error("Ticket group ID is required");
|
|
655
|
+
}
|
|
656
|
+
if (!ticketTypeId) {
|
|
657
|
+
throw new Error("Ticket type ID is required");
|
|
658
|
+
}
|
|
659
|
+
return this.client.request({
|
|
660
|
+
method: "GET",
|
|
661
|
+
path: `/v1/events/${pageId}/ticket-groups/${ticketGroupId}/ticket-types/${ticketTypeId}`
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
async update(pageId, ticketGroupId, ticketTypeId, params) {
|
|
665
|
+
if (!pageId) {
|
|
666
|
+
throw new Error("Page ID is required");
|
|
667
|
+
}
|
|
668
|
+
if (!ticketGroupId) {
|
|
669
|
+
throw new Error("Ticket group ID is required");
|
|
670
|
+
}
|
|
671
|
+
if (!ticketTypeId) {
|
|
672
|
+
throw new Error("Ticket type ID is required");
|
|
673
|
+
}
|
|
674
|
+
return this.client.request({
|
|
675
|
+
method: "PATCH",
|
|
676
|
+
path: `/v1/events/${pageId}/ticket-groups/${ticketGroupId}/ticket-types/${ticketTypeId}`,
|
|
677
|
+
body: params
|
|
678
|
+
});
|
|
679
|
+
}
|
|
680
|
+
async delete(pageId, ticketGroupId, ticketTypeId) {
|
|
681
|
+
if (!pageId) {
|
|
682
|
+
throw new Error("Page ID is required");
|
|
683
|
+
}
|
|
684
|
+
if (!ticketGroupId) {
|
|
685
|
+
throw new Error("Ticket group ID is required");
|
|
686
|
+
}
|
|
687
|
+
if (!ticketTypeId) {
|
|
688
|
+
throw new Error("Ticket type ID is required");
|
|
689
|
+
}
|
|
690
|
+
return this.client.request({
|
|
691
|
+
method: "DELETE",
|
|
692
|
+
path: `/v1/events/${pageId}/ticket-groups/${ticketGroupId}/ticket-types/${ticketTypeId}`
|
|
693
|
+
});
|
|
694
|
+
}
|
|
695
|
+
};
|
|
696
|
+
var EventTicketGroupsResource = class {
|
|
697
|
+
constructor(client) {
|
|
698
|
+
this.client = client;
|
|
699
|
+
this.ticketTypes = new EventTicketTypesResource(client);
|
|
700
|
+
}
|
|
701
|
+
ticketTypes;
|
|
702
|
+
async list(pageId) {
|
|
703
|
+
if (!pageId) {
|
|
704
|
+
throw new Error("Page ID is required");
|
|
705
|
+
}
|
|
706
|
+
return this.client.request({
|
|
707
|
+
method: "GET",
|
|
708
|
+
path: `/v1/events/${pageId}/ticket-groups`
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
async create(pageId, params) {
|
|
712
|
+
if (!pageId) {
|
|
713
|
+
throw new Error("Page ID is required");
|
|
714
|
+
}
|
|
715
|
+
return this.client.request({
|
|
716
|
+
method: "POST",
|
|
717
|
+
path: `/v1/events/${pageId}/ticket-groups`,
|
|
718
|
+
body: params
|
|
719
|
+
});
|
|
720
|
+
}
|
|
721
|
+
async get(pageId, ticketGroupId) {
|
|
722
|
+
if (!pageId) {
|
|
723
|
+
throw new Error("Page ID is required");
|
|
724
|
+
}
|
|
725
|
+
if (!ticketGroupId) {
|
|
726
|
+
throw new Error("Ticket group ID is required");
|
|
727
|
+
}
|
|
728
|
+
return this.client.request({
|
|
729
|
+
method: "GET",
|
|
730
|
+
path: `/v1/events/${pageId}/ticket-groups/${ticketGroupId}`
|
|
731
|
+
});
|
|
732
|
+
}
|
|
733
|
+
async update(pageId, ticketGroupId, params) {
|
|
734
|
+
if (!pageId) {
|
|
735
|
+
throw new Error("Page ID is required");
|
|
736
|
+
}
|
|
737
|
+
if (!ticketGroupId) {
|
|
738
|
+
throw new Error("Ticket group ID is required");
|
|
739
|
+
}
|
|
740
|
+
return this.client.request({
|
|
741
|
+
method: "PATCH",
|
|
742
|
+
path: `/v1/events/${pageId}/ticket-groups/${ticketGroupId}`,
|
|
743
|
+
body: params
|
|
744
|
+
});
|
|
745
|
+
}
|
|
746
|
+
async delete(pageId, ticketGroupId) {
|
|
747
|
+
if (!pageId) {
|
|
748
|
+
throw new Error("Page ID is required");
|
|
749
|
+
}
|
|
750
|
+
if (!ticketGroupId) {
|
|
751
|
+
throw new Error("Ticket group ID is required");
|
|
752
|
+
}
|
|
753
|
+
return this.client.request({
|
|
754
|
+
method: "DELETE",
|
|
755
|
+
path: `/v1/events/${pageId}/ticket-groups/${ticketGroupId}`
|
|
756
|
+
});
|
|
757
|
+
}
|
|
758
|
+
};
|
|
759
|
+
var EventsResource = class {
|
|
760
|
+
constructor(client) {
|
|
761
|
+
this.client = client;
|
|
762
|
+
this.ticketGroups = new EventTicketGroupsResource(client);
|
|
763
|
+
this.fields = new EventFieldsResource(client);
|
|
764
|
+
}
|
|
765
|
+
ticketGroups;
|
|
766
|
+
fields;
|
|
767
|
+
async list(args = {}) {
|
|
768
|
+
const query = {
|
|
769
|
+
limit: args.limit?.toString(),
|
|
770
|
+
starting_after: args.starting_after,
|
|
771
|
+
ending_before: args.ending_before,
|
|
772
|
+
status: args.status,
|
|
773
|
+
search: args.search
|
|
774
|
+
};
|
|
775
|
+
return this.client.request({
|
|
776
|
+
method: "GET",
|
|
777
|
+
path: "/v1/events/",
|
|
778
|
+
query
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
async create(params) {
|
|
782
|
+
return this.client.request({
|
|
783
|
+
method: "POST",
|
|
784
|
+
path: "/v1/events/",
|
|
785
|
+
body: params
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
async get(pageId) {
|
|
789
|
+
if (!pageId) {
|
|
790
|
+
throw new Error("Page ID is required");
|
|
791
|
+
}
|
|
792
|
+
return this.client.request({
|
|
793
|
+
method: "GET",
|
|
794
|
+
path: `/v1/events/${pageId}`
|
|
795
|
+
});
|
|
796
|
+
}
|
|
797
|
+
async update(pageId, params) {
|
|
798
|
+
if (!pageId) {
|
|
799
|
+
throw new Error("Page ID is required");
|
|
800
|
+
}
|
|
801
|
+
return this.client.request({
|
|
802
|
+
method: "PATCH",
|
|
803
|
+
path: `/v1/events/${pageId}`,
|
|
804
|
+
body: params
|
|
805
|
+
});
|
|
806
|
+
}
|
|
807
|
+
async delete(pageId) {
|
|
808
|
+
if (!pageId) {
|
|
809
|
+
throw new Error("Page ID is required");
|
|
810
|
+
}
|
|
811
|
+
return this.client.request({
|
|
812
|
+
method: "DELETE",
|
|
813
|
+
path: `/v1/events/${pageId}`
|
|
814
|
+
});
|
|
815
|
+
}
|
|
816
|
+
};
|
|
817
|
+
|
|
818
|
+
// src/resources/forms/forms.ts
|
|
819
|
+
var FormFieldsResource = class {
|
|
820
|
+
constructor(client) {
|
|
821
|
+
this.client = client;
|
|
822
|
+
}
|
|
823
|
+
async list(pageId) {
|
|
824
|
+
if (!pageId) {
|
|
825
|
+
throw new Error("Page ID is required");
|
|
826
|
+
}
|
|
827
|
+
return this.client.request({
|
|
828
|
+
method: "GET",
|
|
829
|
+
path: `/v1/forms/${pageId}/fields`
|
|
830
|
+
});
|
|
831
|
+
}
|
|
832
|
+
async create(pageId, params) {
|
|
833
|
+
if (!pageId) {
|
|
834
|
+
throw new Error("Page ID is required");
|
|
835
|
+
}
|
|
836
|
+
return this.client.request({
|
|
837
|
+
method: "POST",
|
|
838
|
+
path: `/v1/forms/${pageId}/fields`,
|
|
839
|
+
body: params
|
|
840
|
+
});
|
|
841
|
+
}
|
|
842
|
+
async get(pageId, fieldId) {
|
|
843
|
+
if (!pageId) {
|
|
844
|
+
throw new Error("Page ID is required");
|
|
845
|
+
}
|
|
846
|
+
if (!fieldId) {
|
|
847
|
+
throw new Error("Field ID is required");
|
|
848
|
+
}
|
|
849
|
+
return this.client.request({
|
|
850
|
+
method: "GET",
|
|
851
|
+
path: `/v1/forms/${pageId}/fields/${fieldId}`
|
|
852
|
+
});
|
|
853
|
+
}
|
|
854
|
+
async update(pageId, fieldId, params) {
|
|
855
|
+
if (!pageId) {
|
|
856
|
+
throw new Error("Page ID is required");
|
|
857
|
+
}
|
|
858
|
+
if (!fieldId) {
|
|
859
|
+
throw new Error("Field ID is required");
|
|
860
|
+
}
|
|
861
|
+
return this.client.request({
|
|
862
|
+
method: "PATCH",
|
|
863
|
+
path: `/v1/forms/${pageId}/fields/${fieldId}`,
|
|
864
|
+
body: params
|
|
865
|
+
});
|
|
866
|
+
}
|
|
867
|
+
async delete(pageId, fieldId) {
|
|
868
|
+
if (!pageId) {
|
|
869
|
+
throw new Error("Page ID is required");
|
|
870
|
+
}
|
|
871
|
+
if (!fieldId) {
|
|
872
|
+
throw new Error("Field ID is required");
|
|
873
|
+
}
|
|
874
|
+
return this.client.request({
|
|
875
|
+
method: "DELETE",
|
|
876
|
+
path: `/v1/forms/${pageId}/fields/${fieldId}`
|
|
877
|
+
});
|
|
878
|
+
}
|
|
879
|
+
};
|
|
880
|
+
var FormsResource = class {
|
|
881
|
+
constructor(client) {
|
|
882
|
+
this.client = client;
|
|
883
|
+
this.fields = new FormFieldsResource(client);
|
|
884
|
+
}
|
|
885
|
+
fields;
|
|
886
|
+
async list(args = {}) {
|
|
887
|
+
const query = {
|
|
888
|
+
limit: args.limit?.toString(),
|
|
889
|
+
starting_after: args.starting_after,
|
|
890
|
+
ending_before: args.ending_before,
|
|
891
|
+
status: args.status,
|
|
892
|
+
search: args.search
|
|
893
|
+
};
|
|
894
|
+
return this.client.request({
|
|
895
|
+
method: "GET",
|
|
896
|
+
path: "/v1/forms/",
|
|
897
|
+
query
|
|
898
|
+
});
|
|
899
|
+
}
|
|
900
|
+
async create(params) {
|
|
901
|
+
return this.client.request({
|
|
902
|
+
method: "POST",
|
|
903
|
+
path: "/v1/forms/",
|
|
904
|
+
body: params
|
|
905
|
+
});
|
|
906
|
+
}
|
|
907
|
+
async get(pageId) {
|
|
908
|
+
if (!pageId) {
|
|
909
|
+
throw new Error("Page ID is required");
|
|
910
|
+
}
|
|
911
|
+
return this.client.request({
|
|
912
|
+
method: "GET",
|
|
913
|
+
path: `/v1/forms/${pageId}`
|
|
914
|
+
});
|
|
915
|
+
}
|
|
916
|
+
async update(pageId, params) {
|
|
917
|
+
if (!pageId) {
|
|
918
|
+
throw new Error("Page ID is required");
|
|
919
|
+
}
|
|
920
|
+
return this.client.request({
|
|
921
|
+
method: "PATCH",
|
|
922
|
+
path: `/v1/forms/${pageId}`,
|
|
923
|
+
body: params
|
|
924
|
+
});
|
|
925
|
+
}
|
|
926
|
+
async delete(pageId) {
|
|
927
|
+
if (!pageId) {
|
|
928
|
+
throw new Error("Page ID is required");
|
|
929
|
+
}
|
|
930
|
+
return this.client.request({
|
|
931
|
+
method: "DELETE",
|
|
932
|
+
path: `/v1/forms/${pageId}`
|
|
933
|
+
});
|
|
934
|
+
}
|
|
935
|
+
};
|
|
936
|
+
|
|
937
|
+
// src/resources/submissions/submissions.ts
|
|
938
|
+
var SubmissionResource = class {
|
|
939
|
+
constructor(client) {
|
|
940
|
+
this.client = client;
|
|
941
|
+
}
|
|
942
|
+
async get(submissionId) {
|
|
943
|
+
if (!submissionId) {
|
|
944
|
+
throw new Error("Submission ID is required");
|
|
945
|
+
}
|
|
946
|
+
return this.client.request({
|
|
947
|
+
method: "GET",
|
|
948
|
+
path: `/v1/submissions/${submissionId}`
|
|
949
|
+
});
|
|
950
|
+
}
|
|
951
|
+
async list(args = {}) {
|
|
952
|
+
const query = {
|
|
953
|
+
search: args.search,
|
|
954
|
+
pageId: args.pageId,
|
|
955
|
+
customerId: args.customerId,
|
|
956
|
+
status: args.status,
|
|
957
|
+
createdAfter: args.createdAfter,
|
|
958
|
+
createdBefore: args.createdBefore,
|
|
959
|
+
limit: args.limit?.toString(),
|
|
960
|
+
starting_after: args.starting_after,
|
|
961
|
+
ending_before: args.ending_before
|
|
962
|
+
};
|
|
963
|
+
return this.client.request({
|
|
964
|
+
method: "GET",
|
|
965
|
+
path: "/v1/submissions/",
|
|
966
|
+
query
|
|
967
|
+
});
|
|
968
|
+
}
|
|
969
|
+
};
|
|
970
|
+
|
|
971
|
+
// src/resources/tax-rates/tax-rates.ts
|
|
972
|
+
var TaxRateResource = class {
|
|
973
|
+
constructor(client) {
|
|
974
|
+
this.client = client;
|
|
975
|
+
}
|
|
976
|
+
async list() {
|
|
977
|
+
return this.client.request({
|
|
978
|
+
method: "GET",
|
|
979
|
+
path: "/v1/tax-rates/"
|
|
980
|
+
});
|
|
981
|
+
}
|
|
982
|
+
async create(params) {
|
|
983
|
+
const body = {
|
|
984
|
+
displayName: params.displayName,
|
|
985
|
+
inclusive: params.inclusive,
|
|
986
|
+
percentage: params.percentage
|
|
987
|
+
};
|
|
988
|
+
if (params.default !== void 0) {
|
|
989
|
+
body.default = params.default;
|
|
990
|
+
}
|
|
991
|
+
return this.client.request({
|
|
992
|
+
method: "POST",
|
|
993
|
+
path: "/v1/tax-rates/",
|
|
994
|
+
body
|
|
995
|
+
});
|
|
996
|
+
}
|
|
997
|
+
async update(taxRateId, params) {
|
|
998
|
+
if (!taxRateId) {
|
|
999
|
+
throw new Error("Tax rate ID is required");
|
|
1000
|
+
}
|
|
1001
|
+
const body = {};
|
|
1002
|
+
if (params.displayName !== void 0) {
|
|
1003
|
+
body.displayName = params.displayName;
|
|
1004
|
+
}
|
|
1005
|
+
if (params.default !== void 0) {
|
|
1006
|
+
body.default = params.default;
|
|
1007
|
+
}
|
|
1008
|
+
return this.client.request({
|
|
1009
|
+
method: "PATCH",
|
|
1010
|
+
path: `/v1/tax-rates/${taxRateId}`,
|
|
1011
|
+
body
|
|
1012
|
+
});
|
|
1013
|
+
}
|
|
1014
|
+
};
|
|
1015
|
+
|
|
288
1016
|
// src/index.ts
|
|
289
1017
|
var CheckoutPageClient = class {
|
|
290
1018
|
customers;
|
|
@@ -292,6 +1020,14 @@ var CheckoutPageClient = class {
|
|
|
292
1020
|
payments;
|
|
293
1021
|
subscriptions;
|
|
294
1022
|
bookings;
|
|
1023
|
+
tickets;
|
|
1024
|
+
products;
|
|
1025
|
+
files;
|
|
1026
|
+
checkoutPages;
|
|
1027
|
+
events;
|
|
1028
|
+
forms;
|
|
1029
|
+
submissions;
|
|
1030
|
+
taxRates;
|
|
295
1031
|
client;
|
|
296
1032
|
constructor(options) {
|
|
297
1033
|
this.client = new CheckoutPageApiClient(options);
|
|
@@ -300,6 +1036,14 @@ var CheckoutPageClient = class {
|
|
|
300
1036
|
this.payments = new PaymentResource(this.client);
|
|
301
1037
|
this.subscriptions = new SubscriptionResource(this.client);
|
|
302
1038
|
this.bookings = new BookingResource(this.client);
|
|
1039
|
+
this.tickets = new TicketResource(this.client);
|
|
1040
|
+
this.products = new ProductResource(this.client);
|
|
1041
|
+
this.files = new FileResource(this.client);
|
|
1042
|
+
this.checkoutPages = new CheckoutPagesResource(this.client);
|
|
1043
|
+
this.events = new EventsResource(this.client);
|
|
1044
|
+
this.forms = new FormsResource(this.client);
|
|
1045
|
+
this.submissions = new SubmissionResource(this.client);
|
|
1046
|
+
this.taxRates = new TaxRateResource(this.client);
|
|
303
1047
|
}
|
|
304
1048
|
};
|
|
305
1049
|
var createCheckoutPageClient = (options) => {
|