ticketnation-sdk 1.0.5 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +420 -1
- package/dist/index.d.ts +420 -1
- package/dist/index.js +370 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +369 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -291,44 +291,212 @@ interface ApiErrorResponse {
|
|
|
291
291
|
requestId: string;
|
|
292
292
|
}
|
|
293
293
|
|
|
294
|
+
/**
|
|
295
|
+
* Manage events on the Ticketnation marketplace.
|
|
296
|
+
*
|
|
297
|
+
* @example
|
|
298
|
+
* ```ts
|
|
299
|
+
* // Create and publish in one call
|
|
300
|
+
* const event = await tn.events.createAndPublish({
|
|
301
|
+
* name: 'Summer Fest',
|
|
302
|
+
* dateTime: '2026-06-15T18:00:00Z',
|
|
303
|
+
* tickets: [{ name: 'GA', price: 1000, quantity: 500, published: true }],
|
|
304
|
+
* });
|
|
305
|
+
* ```
|
|
306
|
+
*/
|
|
294
307
|
declare class EventsResource {
|
|
295
308
|
private readonly client;
|
|
296
309
|
constructor(client: HttpClient);
|
|
310
|
+
/**
|
|
311
|
+
* Create a new event in DRAFT status.
|
|
312
|
+
* Optionally include inline ticket types, gallery images, and venue.
|
|
313
|
+
*
|
|
314
|
+
* @param params - Event creation parameters
|
|
315
|
+
* @returns The created event (status: DRAFT)
|
|
316
|
+
*
|
|
317
|
+
* @example
|
|
318
|
+
* ```ts
|
|
319
|
+
* const event = await tn.events.create({
|
|
320
|
+
* name: 'Summer Music Fest',
|
|
321
|
+
* dateTime: '2026-06-15T18:00:00Z',
|
|
322
|
+
* venueId: 'uuid',
|
|
323
|
+
* imageUrl: 'https://example.com/banner.jpg',
|
|
324
|
+
* galleryUrls: ['https://example.com/photo1.jpg'],
|
|
325
|
+
* tickets: [
|
|
326
|
+
* { name: 'GA', price: 1000, quantity: 500, published: true },
|
|
327
|
+
* { name: 'VIP', price: 3500, quantity: 50, published: true },
|
|
328
|
+
* ],
|
|
329
|
+
* });
|
|
330
|
+
* ```
|
|
331
|
+
*/
|
|
297
332
|
create(params: CreateEventParams): Promise<Event>;
|
|
333
|
+
/**
|
|
334
|
+
* Create an event and immediately publish it.
|
|
335
|
+
* Convenience method that calls create() then publish().
|
|
336
|
+
*
|
|
337
|
+
* @returns The published event (status: PUBLISHED)
|
|
338
|
+
*/
|
|
339
|
+
createAndPublish(params: CreateEventParams): Promise<Event>;
|
|
340
|
+
/**
|
|
341
|
+
* List events for your organization (paginated).
|
|
342
|
+
*
|
|
343
|
+
* @example
|
|
344
|
+
* ```ts
|
|
345
|
+
* const { data, meta } = await tn.events.list({ status: 'PUBLISHED', page: 1 });
|
|
346
|
+
* console.log(`${meta.total} published events`);
|
|
347
|
+
* ```
|
|
348
|
+
*/
|
|
298
349
|
list(params?: ListEventsParams): Promise<PaginatedResponse<Event>>;
|
|
350
|
+
/**
|
|
351
|
+
* Get a single event by UUID or slug.
|
|
352
|
+
*
|
|
353
|
+
* @example
|
|
354
|
+
* ```ts
|
|
355
|
+
* const event = await tn.events.get('summer-music-fest');
|
|
356
|
+
* // or
|
|
357
|
+
* const event = await tn.events.get('uuid-event-id');
|
|
358
|
+
* ```
|
|
359
|
+
*/
|
|
299
360
|
get(idOrSlug: string): Promise<Event>;
|
|
361
|
+
/**
|
|
362
|
+
* Update event fields. Only provided fields are changed.
|
|
363
|
+
* Cannot update inline tickets — use `tn.tickets` methods instead.
|
|
364
|
+
*/
|
|
300
365
|
update(eventId: string, params: UpdateEventParams): Promise<Event>;
|
|
366
|
+
/**
|
|
367
|
+
* Publish a DRAFT event to the marketplace.
|
|
368
|
+
* The event becomes visible to buyers on ticketnation.ph.
|
|
369
|
+
*/
|
|
301
370
|
publish(eventId: string): Promise<Event>;
|
|
371
|
+
/**
|
|
372
|
+
* Revert a PUBLISHED event back to DRAFT.
|
|
373
|
+
* Removes it from the public marketplace.
|
|
374
|
+
*/
|
|
302
375
|
unpublish(eventId: string): Promise<Event>;
|
|
376
|
+
/**
|
|
377
|
+
* Archive an event. Hidden from marketplace but data is preserved.
|
|
378
|
+
*/
|
|
303
379
|
archive(eventId: string): Promise<Event>;
|
|
380
|
+
/**
|
|
381
|
+
* Delete a DRAFT event. Only works if no tickets have been sold.
|
|
382
|
+
* Published or archived events must be unpublished first.
|
|
383
|
+
*/
|
|
304
384
|
delete(eventId: string): Promise<DeletedResponse>;
|
|
305
385
|
}
|
|
306
386
|
|
|
387
|
+
/**
|
|
388
|
+
* Manage ticket types for events.
|
|
389
|
+
* Prices are in whole pesos (e.g., 1000 = ₱1,000).
|
|
390
|
+
*
|
|
391
|
+
* @example
|
|
392
|
+
* ```ts
|
|
393
|
+
* const ticket = await tn.tickets.create(eventId, {
|
|
394
|
+
* name: 'VIP Pass',
|
|
395
|
+
* price: 3500, // ₱3,500
|
|
396
|
+
* quantity: 100,
|
|
397
|
+
* published: true, // immediately available for sale
|
|
398
|
+
* });
|
|
399
|
+
* ```
|
|
400
|
+
*/
|
|
307
401
|
declare class TicketsResource {
|
|
308
402
|
private readonly client;
|
|
309
403
|
constructor(client: HttpClient);
|
|
404
|
+
/**
|
|
405
|
+
* Create a ticket type for an event.
|
|
406
|
+
* Individual ticket inventory is auto-generated based on quantity.
|
|
407
|
+
*
|
|
408
|
+
* @param eventId - The event UUID
|
|
409
|
+
* @param params - Ticket type details
|
|
410
|
+
* @returns The created ticket type
|
|
411
|
+
*/
|
|
310
412
|
create(eventId: string, params: CreateTicketParams): Promise<Ticket>;
|
|
413
|
+
/**
|
|
414
|
+
* List all ticket types for an event.
|
|
415
|
+
*/
|
|
311
416
|
list(eventId: string): Promise<Ticket[]>;
|
|
417
|
+
/**
|
|
418
|
+
* Get a single ticket type by ID.
|
|
419
|
+
*/
|
|
312
420
|
get(eventId: string, ticketId: string): Promise<Ticket>;
|
|
421
|
+
/**
|
|
422
|
+
* Update a ticket type. Price and quantity changes are validated
|
|
423
|
+
* against business rules (e.g., can't reduce below sold count).
|
|
424
|
+
*/
|
|
313
425
|
update(eventId: string, ticketId: string, params: UpdateTicketParams): Promise<Ticket>;
|
|
426
|
+
/**
|
|
427
|
+
* Make a ticket type available for purchase.
|
|
428
|
+
* The parent event must also be published for tickets to appear.
|
|
429
|
+
*/
|
|
314
430
|
publish(eventId: string, ticketId: string): Promise<Ticket>;
|
|
431
|
+
/**
|
|
432
|
+
* Mark a ticket type as sold out (sets remainingQuantity to 0).
|
|
433
|
+
* To restore availability, use update() to set a new quantity.
|
|
434
|
+
*/
|
|
315
435
|
markSoldOut(eventId: string, ticketId: string): Promise<Ticket>;
|
|
436
|
+
/**
|
|
437
|
+
* Delete a ticket type. Only works if no tickets have been sold.
|
|
438
|
+
*/
|
|
316
439
|
delete(eventId: string, ticketId: string): Promise<DeletedResponse>;
|
|
317
440
|
}
|
|
318
441
|
|
|
442
|
+
/**
|
|
443
|
+
* Read-only access to orders for your events.
|
|
444
|
+
* Orders are created when buyers purchase tickets on ticketnation.ph.
|
|
445
|
+
*
|
|
446
|
+
* @example
|
|
447
|
+
* ```ts
|
|
448
|
+
* const { data: orders } = await tn.orders.list(eventId, { status: 'COMPLETED' });
|
|
449
|
+
* for (const order of orders) {
|
|
450
|
+
* console.log(`#${order.orderNumber}: ${order.user.firstName} — ₱${order.total}`);
|
|
451
|
+
* }
|
|
452
|
+
* ```
|
|
453
|
+
*/
|
|
319
454
|
declare class OrdersResource {
|
|
320
455
|
private readonly client;
|
|
321
456
|
constructor(client: HttpClient);
|
|
457
|
+
/**
|
|
458
|
+
* List orders for an event (paginated).
|
|
459
|
+
* Filter by status to get only completed, pending, or refunded orders.
|
|
460
|
+
*
|
|
461
|
+
* @param eventId - The event UUID
|
|
462
|
+
* @param params - Pagination and filter options
|
|
463
|
+
*/
|
|
322
464
|
list(eventId: string, params?: ListOrdersParams): Promise<PaginatedResponse<Order>>;
|
|
465
|
+
/**
|
|
466
|
+
* Get a single order by ID. Includes line items and payment details.
|
|
467
|
+
*
|
|
468
|
+
* @param orderId - The order UUID
|
|
469
|
+
*/
|
|
323
470
|
get(orderId: string): Promise<Order>;
|
|
324
471
|
}
|
|
325
472
|
|
|
473
|
+
/**
|
|
474
|
+
* Search public venues on Ticketnation.
|
|
475
|
+
* Use the returned venue ID when creating events with a physical location.
|
|
476
|
+
*
|
|
477
|
+
* @example
|
|
478
|
+
* ```ts
|
|
479
|
+
* const { data: venues } = await tn.venues.search({ query: 'Mall of Asia' });
|
|
480
|
+
* const event = await tn.events.create({
|
|
481
|
+
* name: 'Concert',
|
|
482
|
+
* dateTime: '2026-06-15T18:00:00Z',
|
|
483
|
+
* venueId: venues[0].id, // ← link the venue
|
|
484
|
+
* });
|
|
485
|
+
* ```
|
|
486
|
+
*/
|
|
326
487
|
declare class VenuesResource {
|
|
327
488
|
private readonly client;
|
|
328
489
|
constructor(client: HttpClient);
|
|
490
|
+
/**
|
|
491
|
+
* Search venues by name (case-insensitive substring match).
|
|
492
|
+
*
|
|
493
|
+
* @param params - Search query and pagination
|
|
494
|
+
* @returns Paginated list of matching venues with address and coordinates
|
|
495
|
+
*/
|
|
329
496
|
search(params: SearchVenuesParams): Promise<PaginatedResponse<Venue>>;
|
|
330
497
|
}
|
|
331
498
|
|
|
499
|
+
/** Delivery record for a webhook event. */
|
|
332
500
|
interface WebhookDelivery {
|
|
333
501
|
id: string;
|
|
334
502
|
eventType: string;
|
|
@@ -337,34 +505,75 @@ interface WebhookDelivery {
|
|
|
337
505
|
attempts: number;
|
|
338
506
|
createdAt: string;
|
|
339
507
|
}
|
|
508
|
+
/** Result of testing a webhook endpoint. */
|
|
340
509
|
interface WebhookTestResult {
|
|
341
510
|
success: boolean;
|
|
342
511
|
statusCode: number | null;
|
|
343
512
|
message: string;
|
|
344
513
|
}
|
|
514
|
+
/**
|
|
515
|
+
* Manage webhook endpoints for real-time notifications.
|
|
516
|
+
*
|
|
517
|
+
* @example
|
|
518
|
+
* ```ts
|
|
519
|
+
* // Create a webhook — store the secret securely!
|
|
520
|
+
* const webhook = await tn.webhooks.create({
|
|
521
|
+
* url: 'https://api.example.com/webhooks/ticketnation',
|
|
522
|
+
* events: ['order.completed', 'event.sold_out'],
|
|
523
|
+
* });
|
|
524
|
+
* console.log(webhook.secret); // whsec_... (only shown once)
|
|
525
|
+
*
|
|
526
|
+
* // Test it
|
|
527
|
+
* const result = await tn.webhooks.test(webhook.id);
|
|
528
|
+
* console.log(result.success); // true
|
|
529
|
+
* ```
|
|
530
|
+
*/
|
|
345
531
|
declare class WebhooksResource {
|
|
346
532
|
private readonly client;
|
|
347
533
|
constructor(client: HttpClient);
|
|
534
|
+
/**
|
|
535
|
+
* Create a webhook endpoint.
|
|
536
|
+
* The response includes a `secret` field for HMAC signature verification.
|
|
537
|
+
*
|
|
538
|
+
* **Important:** The secret is only returned on creation. Store it securely.
|
|
539
|
+
*/
|
|
348
540
|
create(params: CreateWebhookParams): Promise<WebhookWithSecret>;
|
|
541
|
+
/** List all webhooks for your API key. */
|
|
349
542
|
list(): Promise<Webhook[]>;
|
|
543
|
+
/** Update a webhook's URL, events, or active status. */
|
|
350
544
|
update(webhookId: string, params: UpdateWebhookParams): Promise<Webhook>;
|
|
545
|
+
/** Delete a webhook and its delivery history. */
|
|
351
546
|
delete(webhookId: string): Promise<DeletedResponse>;
|
|
547
|
+
/** Send a test payload to verify your webhook endpoint works. */
|
|
352
548
|
test(webhookId: string): Promise<WebhookTestResult>;
|
|
549
|
+
/**
|
|
550
|
+
* View delivery history for a webhook (paginated).
|
|
551
|
+
* Useful for debugging failed deliveries.
|
|
552
|
+
*/
|
|
353
553
|
deliveries(webhookId: string, params?: {
|
|
354
554
|
page?: number;
|
|
355
555
|
take?: number;
|
|
356
556
|
}): Promise<PaginatedResponse<WebhookDelivery>>;
|
|
357
557
|
}
|
|
358
558
|
|
|
559
|
+
/** Parameters for creating a performer. */
|
|
359
560
|
interface CreatePerformerParams {
|
|
561
|
+
/** Performer/artist name */
|
|
360
562
|
name: string;
|
|
563
|
+
/** Bio or description */
|
|
361
564
|
description?: string;
|
|
565
|
+
/** Performer type */
|
|
362
566
|
type?: 'SOLO' | 'GROUP' | 'DJ' | 'BAND' | 'SPEAKER' | 'HOST' | 'COMEDIAN' | 'OTHER';
|
|
567
|
+
/** Public URL to performer image (hosted on your end) */
|
|
363
568
|
imageUrl?: string;
|
|
569
|
+
/** Facebook profile URL */
|
|
364
570
|
facebook?: string;
|
|
571
|
+
/** YouTube channel URL */
|
|
365
572
|
youtube?: string;
|
|
573
|
+
/** Instagram profile URL */
|
|
366
574
|
instagram?: string;
|
|
367
575
|
}
|
|
576
|
+
/** Performer details. */
|
|
368
577
|
interface Performer {
|
|
369
578
|
id: string;
|
|
370
579
|
name: string;
|
|
@@ -379,24 +588,60 @@ interface Performer {
|
|
|
379
588
|
url: string | null;
|
|
380
589
|
} | null;
|
|
381
590
|
}
|
|
591
|
+
/**
|
|
592
|
+
* Manage performers/artists/speakers for events.
|
|
593
|
+
*
|
|
594
|
+
* @example
|
|
595
|
+
* ```ts
|
|
596
|
+
* await tn.performers.create(eventId, {
|
|
597
|
+
* name: 'DJ Shadow',
|
|
598
|
+
* type: 'SOLO',
|
|
599
|
+
* imageUrl: 'https://example.com/dj-shadow.jpg',
|
|
600
|
+
* });
|
|
601
|
+
*
|
|
602
|
+
* const performers = await tn.performers.list(eventId);
|
|
603
|
+
* ```
|
|
604
|
+
*/
|
|
382
605
|
declare class PerformersResource {
|
|
383
606
|
private readonly client;
|
|
384
607
|
constructor(client: HttpClient);
|
|
608
|
+
/**
|
|
609
|
+
* Add a performer to an event.
|
|
610
|
+
* If `imageUrl` is provided, it will be displayed on the event page.
|
|
611
|
+
*
|
|
612
|
+
* @param eventId - The event UUID
|
|
613
|
+
* @param params - Performer details
|
|
614
|
+
*/
|
|
385
615
|
create(eventId: string, params: CreatePerformerParams): Promise<Performer>;
|
|
616
|
+
/** List all performers for an event. */
|
|
386
617
|
list(eventId: string): Promise<Performer[]>;
|
|
618
|
+
/**
|
|
619
|
+
* Remove a performer from an event.
|
|
620
|
+
* This unlinks the performer — it doesn't delete the performer record.
|
|
621
|
+
*/
|
|
387
622
|
remove(eventId: string, performerId: string): Promise<DeletedResponse>;
|
|
388
623
|
}
|
|
389
624
|
|
|
625
|
+
/** Parameters for creating a schedule item. */
|
|
390
626
|
interface CreateScheduleParams {
|
|
627
|
+
/** Schedule item title (e.g., "Doors Open", "DJ Shadow Live") */
|
|
391
628
|
title: string;
|
|
629
|
+
/** Description of this schedule block */
|
|
392
630
|
description?: string;
|
|
631
|
+
/** Start time (ISO 8601) */
|
|
393
632
|
startTime: string;
|
|
633
|
+
/** End time (ISO 8601) */
|
|
394
634
|
endTime: string;
|
|
635
|
+
/** Emoji or icon name */
|
|
395
636
|
icon?: string;
|
|
637
|
+
/** Hex color code (e.g., "#4f46e5") */
|
|
396
638
|
color?: string;
|
|
639
|
+
/** Sort position (auto-assigned if not provided) */
|
|
397
640
|
sortOrder?: number;
|
|
641
|
+
/** Link this schedule item to a performer */
|
|
398
642
|
performerId?: string;
|
|
399
643
|
}
|
|
644
|
+
/** Parameters for updating a schedule item. All fields optional. */
|
|
400
645
|
interface UpdateScheduleParams {
|
|
401
646
|
title?: string;
|
|
402
647
|
description?: string;
|
|
@@ -407,6 +652,7 @@ interface UpdateScheduleParams {
|
|
|
407
652
|
sortOrder?: number;
|
|
408
653
|
performerId?: string;
|
|
409
654
|
}
|
|
655
|
+
/** Schedule item details. */
|
|
410
656
|
interface Schedule {
|
|
411
657
|
id: string;
|
|
412
658
|
title: string;
|
|
@@ -424,22 +670,59 @@ interface Schedule {
|
|
|
424
670
|
createdAt: string;
|
|
425
671
|
updatedAt: string;
|
|
426
672
|
}
|
|
673
|
+
/**
|
|
674
|
+
* Manage event schedule / timeline items.
|
|
675
|
+
*
|
|
676
|
+
* @example
|
|
677
|
+
* ```ts
|
|
678
|
+
* // Create a full event schedule
|
|
679
|
+
* await tn.schedules.create(eventId, {
|
|
680
|
+
* title: 'Doors Open',
|
|
681
|
+
* startTime: '2026-09-15T19:00:00Z',
|
|
682
|
+
* endTime: '2026-09-15T19:30:00Z',
|
|
683
|
+
* icon: '🎵',
|
|
684
|
+
* });
|
|
685
|
+
*
|
|
686
|
+
* await tn.schedules.create(eventId, {
|
|
687
|
+
* title: 'DJ Shadow Live',
|
|
688
|
+
* startTime: '2026-09-15T21:00:00Z',
|
|
689
|
+
* endTime: '2026-09-15T23:00:00Z',
|
|
690
|
+
* performerId: performer.id, // link to a performer
|
|
691
|
+
* });
|
|
692
|
+
* ```
|
|
693
|
+
*/
|
|
427
694
|
declare class SchedulesResource {
|
|
428
695
|
private readonly client;
|
|
429
696
|
constructor(client: HttpClient);
|
|
697
|
+
/**
|
|
698
|
+
* Add a schedule item to an event.
|
|
699
|
+
*
|
|
700
|
+
* @param eventId - The event UUID
|
|
701
|
+
* @param params - Schedule item details
|
|
702
|
+
*/
|
|
430
703
|
create(eventId: string, params: CreateScheduleParams): Promise<Schedule>;
|
|
704
|
+
/** List all schedule items for an event, ordered by sortOrder. */
|
|
431
705
|
list(eventId: string): Promise<Schedule[]>;
|
|
706
|
+
/** Update a schedule item. Only provided fields are changed. */
|
|
432
707
|
update(eventId: string, scheduleId: string, params: UpdateScheduleParams): Promise<Schedule>;
|
|
708
|
+
/** Delete a schedule item. */
|
|
433
709
|
remove(eventId: string, scheduleId: string): Promise<DeletedResponse>;
|
|
434
710
|
}
|
|
435
711
|
|
|
712
|
+
/** Parameters for creating a brand partner. */
|
|
436
713
|
interface CreateBrandParams {
|
|
714
|
+
/** Brand/sponsor name */
|
|
437
715
|
name: string;
|
|
716
|
+
/** Brand description */
|
|
438
717
|
description?: string;
|
|
718
|
+
/** Brand website URL */
|
|
439
719
|
url?: string;
|
|
720
|
+
/** Public URL to brand logo (hosted on your end) */
|
|
440
721
|
imageUrl?: string;
|
|
722
|
+
/** Display position (lower = first) */
|
|
441
723
|
position?: number;
|
|
442
724
|
}
|
|
725
|
+
/** Brand partner details. */
|
|
443
726
|
interface Brand {
|
|
444
727
|
id: string;
|
|
445
728
|
name: string;
|
|
@@ -452,22 +735,69 @@ interface Brand {
|
|
|
452
735
|
} | null;
|
|
453
736
|
position: number | null;
|
|
454
737
|
}
|
|
738
|
+
/**
|
|
739
|
+
* Manage brand partners / sponsors for events.
|
|
740
|
+
*
|
|
741
|
+
* @example
|
|
742
|
+
* ```ts
|
|
743
|
+
* await tn.brands.create(eventId, {
|
|
744
|
+
* name: 'Red Bull',
|
|
745
|
+
* url: 'https://redbull.com',
|
|
746
|
+
* imageUrl: 'https://example.com/redbull-logo.png',
|
|
747
|
+
* });
|
|
748
|
+
* ```
|
|
749
|
+
*/
|
|
455
750
|
declare class BrandsResource {
|
|
456
751
|
private readonly client;
|
|
457
752
|
constructor(client: HttpClient);
|
|
753
|
+
/**
|
|
754
|
+
* Add a brand partner to an event.
|
|
755
|
+
* If a brand with the same name already exists in your org, it will be reused.
|
|
756
|
+
*
|
|
757
|
+
* @param eventId - The event UUID
|
|
758
|
+
* @param params - Brand details
|
|
759
|
+
*/
|
|
458
760
|
create(eventId: string, params: CreateBrandParams): Promise<Brand>;
|
|
761
|
+
/** List all brand partners for an event. */
|
|
459
762
|
list(eventId: string): Promise<Brand[]>;
|
|
763
|
+
/**
|
|
764
|
+
* Remove a brand from an event.
|
|
765
|
+
* This unlinks the brand — it doesn't delete the brand record.
|
|
766
|
+
*/
|
|
460
767
|
remove(eventId: string, brandId: string): Promise<DeletedResponse>;
|
|
461
768
|
}
|
|
462
769
|
|
|
770
|
+
/**
|
|
771
|
+
* Error thrown by the Ticketnation SDK for all API and network errors.
|
|
772
|
+
*
|
|
773
|
+
* @example
|
|
774
|
+
* ```ts
|
|
775
|
+
* try {
|
|
776
|
+
* await tn.events.get('nonexistent');
|
|
777
|
+
* } catch (error) {
|
|
778
|
+
* if (error instanceof TicketnationError) {
|
|
779
|
+
* console.log(error.code); // 'NOT_FOUND'
|
|
780
|
+
* console.log(error.status); // 404
|
|
781
|
+
* console.log(error.message); // 'Event not found: nonexistent'
|
|
782
|
+
* console.log(error.requestId); // 'req_abc123' (for support)
|
|
783
|
+
* }
|
|
784
|
+
* }
|
|
785
|
+
* ```
|
|
786
|
+
*/
|
|
463
787
|
declare class TicketnationError extends Error {
|
|
788
|
+
/** Machine-readable error code (e.g., 'NOT_FOUND', 'VALIDATION_ERROR', 'RATE_LIMITED') */
|
|
464
789
|
readonly code: string;
|
|
790
|
+
/** HTTP status code (0 for network/timeout errors) */
|
|
465
791
|
readonly status: number;
|
|
792
|
+
/** Unique request ID for debugging (include in support tickets) */
|
|
466
793
|
readonly requestId: string | null;
|
|
794
|
+
/** Field-level validation errors (only for VALIDATION_ERROR) */
|
|
467
795
|
readonly details: Array<{
|
|
468
796
|
field: string;
|
|
469
797
|
message: string;
|
|
470
798
|
}> | undefined;
|
|
799
|
+
/** Suggested fix for common errors */
|
|
800
|
+
readonly hint: string | null;
|
|
471
801
|
constructor(message: string, opts: {
|
|
472
802
|
code: string;
|
|
473
803
|
status: number;
|
|
@@ -481,6 +811,8 @@ declare class TicketnationError extends Error {
|
|
|
481
811
|
error: ApiErrorBody;
|
|
482
812
|
requestId?: string;
|
|
483
813
|
}): TicketnationError;
|
|
814
|
+
private static getHint;
|
|
815
|
+
/** Serialize error for logging or API responses. */
|
|
484
816
|
toJSON(): {
|
|
485
817
|
name: string;
|
|
486
818
|
code: string;
|
|
@@ -491,24 +823,111 @@ declare class TicketnationError extends Error {
|
|
|
491
823
|
field: string;
|
|
492
824
|
message: string;
|
|
493
825
|
}[] | undefined;
|
|
826
|
+
hint: string | null;
|
|
494
827
|
};
|
|
828
|
+
/** Human-readable error summary. */
|
|
829
|
+
toString(): string;
|
|
495
830
|
}
|
|
496
831
|
|
|
497
832
|
declare function paginate<T>(fetchPage: (params: PaginationParams) => Promise<PaginatedResponse<T>>, initialParams?: PaginationParams): AsyncGenerator<T[], void, undefined>;
|
|
498
833
|
declare function fetchAllPages<T>(fetchPage: (params: PaginationParams) => Promise<PaginatedResponse<T>>, initialParams?: PaginationParams): Promise<T[]>;
|
|
499
834
|
|
|
835
|
+
/**
|
|
836
|
+
* Format a price value to a human-readable Philippine Peso string.
|
|
837
|
+
*
|
|
838
|
+
* @example
|
|
839
|
+
* ```ts
|
|
840
|
+
* formatPeso(1000) // "₱1,000.00"
|
|
841
|
+
* formatPeso(3500) // "₱3,500.00"
|
|
842
|
+
* formatPeso(0) // "Free"
|
|
843
|
+
* ```
|
|
844
|
+
*/
|
|
845
|
+
declare function formatPeso(amount: number): string;
|
|
846
|
+
/**
|
|
847
|
+
* Validate that a price is a non-negative integer.
|
|
848
|
+
* Ticketnation prices are whole pesos (e.g., 1000 = ₱1,000).
|
|
849
|
+
*
|
|
850
|
+
* @throws Error if price is invalid
|
|
851
|
+
*/
|
|
852
|
+
declare function validatePrice(price: number, fieldName?: string): void;
|
|
853
|
+
|
|
854
|
+
/**
|
|
855
|
+
* Ticketnation SDK — publish events, manage tickets, and receive orders programmatically.
|
|
856
|
+
*
|
|
857
|
+
* @example
|
|
858
|
+
* ```ts
|
|
859
|
+
* import { Ticketnation } from 'ticketnation-sdk';
|
|
860
|
+
*
|
|
861
|
+
* const tn = new Ticketnation({ apiKey: 'tn_live_...' });
|
|
862
|
+
*
|
|
863
|
+
* // Create and publish an event in one call
|
|
864
|
+
* const event = await tn.events.createAndPublish({
|
|
865
|
+
* name: 'Summer Fest 2026',
|
|
866
|
+
* dateTime: '2026-06-15T18:00:00Z',
|
|
867
|
+
* imageUrl: 'https://example.com/banner.jpg',
|
|
868
|
+
* tickets: [
|
|
869
|
+
* { name: 'GA', price: 1000, quantity: 500, published: true },
|
|
870
|
+
* ],
|
|
871
|
+
* });
|
|
872
|
+
*
|
|
873
|
+
* // Add performers and schedule
|
|
874
|
+
* const dj = await tn.performers.create(event.id, { name: 'DJ Shadow', type: 'SOLO' });
|
|
875
|
+
* await tn.schedules.create(event.id, {
|
|
876
|
+
* title: 'DJ Shadow Live',
|
|
877
|
+
* startTime: '2026-06-15T21:00:00Z',
|
|
878
|
+
* endTime: '2026-06-15T23:00:00Z',
|
|
879
|
+
* performerId: dj.id,
|
|
880
|
+
* });
|
|
881
|
+
*
|
|
882
|
+
* // Check orders
|
|
883
|
+
* const { data: orders } = await tn.orders.list(event.id);
|
|
884
|
+
* ```
|
|
885
|
+
*
|
|
886
|
+
* @see https://docs.ticketnation.ph/developers/overview
|
|
887
|
+
*/
|
|
500
888
|
declare class Ticketnation {
|
|
889
|
+
/** Create, list, update, publish, and delete events. */
|
|
501
890
|
readonly events: EventsResource;
|
|
891
|
+
/** Create, list, update, and manage ticket types. Prices are in whole pesos. */
|
|
502
892
|
readonly tickets: TicketsResource;
|
|
893
|
+
/** Read-only access to orders placed by buyers. */
|
|
503
894
|
readonly orders: OrdersResource;
|
|
895
|
+
/** Search public venues by name. */
|
|
504
896
|
readonly venues: VenuesResource;
|
|
897
|
+
/** Manage webhook endpoints for real-time notifications. */
|
|
505
898
|
readonly webhooks: WebhooksResource;
|
|
899
|
+
/** Add and manage performers/artists/speakers for events. */
|
|
506
900
|
readonly performers: PerformersResource;
|
|
901
|
+
/** Create event schedule / timeline items. */
|
|
507
902
|
readonly schedules: SchedulesResource;
|
|
903
|
+
/** Add brand partners / sponsors to events. */
|
|
508
904
|
readonly brands: BrandsResource;
|
|
509
905
|
private readonly client;
|
|
906
|
+
/**
|
|
907
|
+
* Create a new Ticketnation SDK instance.
|
|
908
|
+
*
|
|
909
|
+
* @param config - SDK configuration
|
|
910
|
+
* @param config.apiKey - Your API key from Organizer Dashboard > Settings > API Keys
|
|
911
|
+
* @param config.baseUrl - API base URL (default: https://api.ticketnation.ph)
|
|
912
|
+
* @param config.timeout - Request timeout in ms (default: 30000)
|
|
913
|
+
* @param config.retries - Retry count on 5xx errors (default: 2)
|
|
914
|
+
* @param config.debug - Log requests with redacted API key (default: false)
|
|
915
|
+
*/
|
|
510
916
|
constructor(config: TicketnationConfig);
|
|
917
|
+
/**
|
|
918
|
+
* Get information about your API key and organization.
|
|
919
|
+
* Useful for verifying your key is correctly configured.
|
|
920
|
+
*
|
|
921
|
+
* @returns API key details (name, scopes, expiry) and organization info
|
|
922
|
+
*
|
|
923
|
+
* @example
|
|
924
|
+
* ```ts
|
|
925
|
+
* const info = await tn.me();
|
|
926
|
+
* console.log(`Org: ${info.organization.name}`);
|
|
927
|
+
* console.log(`Scopes: ${info.apiKey.scopes.join(', ')}`);
|
|
928
|
+
* ```
|
|
929
|
+
*/
|
|
511
930
|
me(): Promise<AccountInfo>;
|
|
512
931
|
}
|
|
513
932
|
|
|
514
|
-
export { type AccountInfo, type ApiErrorBody, type ApiErrorResponse, type ApiKeyInfo, type Brand, type CreateBrandParams, type CreateEventParams, type CreatePerformerParams, type CreateScheduleParams, type CreateTicketParams, type CreateWebhookParams, type DataResponse, type DeletedResponse, type Event, type EventJourneyType, type EventLocationType, type EventStatus, type EventType, type EventVisibility, type ListEventsParams, type ListOrdersParams, type Order, type OrderItem, type OrderItemTicket, type OrderPayment, type OrderStatus, type OrderUser, type OrganizationInfo, type PaginatedResponse, type PaginationMeta, type PaginationParams, type Performer, type Schedule, type SearchVenuesParams, type Ticket, type TicketSeatType, type TicketStatus, Ticketnation, type TicketnationConfig, TicketnationError, type UpdateEventParams, type UpdateScheduleParams, type UpdateTicketParams, type UpdateWebhookParams, type Venue, type VenueRef, type Webhook, type WebhookEventType, type WebhookWithSecret, fetchAllPages, paginate };
|
|
933
|
+
export { type AccountInfo, type ApiErrorBody, type ApiErrorResponse, type ApiKeyInfo, type Brand, type CreateBrandParams, type CreateEventParams, type CreatePerformerParams, type CreateScheduleParams, type CreateTicketParams, type CreateWebhookParams, type DataResponse, type DeletedResponse, type Event, type EventJourneyType, type EventLocationType, type EventStatus, type EventType, type EventVisibility, type ListEventsParams, type ListOrdersParams, type Order, type OrderItem, type OrderItemTicket, type OrderPayment, type OrderStatus, type OrderUser, type OrganizationInfo, type PaginatedResponse, type PaginationMeta, type PaginationParams, type Performer, type Schedule, type SearchVenuesParams, type Ticket, type TicketSeatType, type TicketStatus, Ticketnation, type TicketnationConfig, TicketnationError, type UpdateEventParams, type UpdateScheduleParams, type UpdateTicketParams, type UpdateWebhookParams, type Venue, type VenueRef, type Webhook, type WebhookDelivery, type WebhookEventType, type WebhookTestResult, type WebhookWithSecret, fetchAllPages, formatPeso, paginate, validatePrice };
|