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