ticketnation-sdk 1.1.0 → 1.1.1
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/llms.txt +178 -0
- package/package.json +3 -2
package/llms.txt
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# ticketnation-sdk
|
|
2
|
+
|
|
3
|
+
> Official TypeScript SDK for the Ticketnation Open API. Publish events, manage tickets, receive orders, and search venues programmatically.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
npm install ticketnation-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { Ticketnation } from 'ticketnation-sdk';
|
|
15
|
+
|
|
16
|
+
const tn = new Ticketnation({ apiKey: 'tn_live_...' });
|
|
17
|
+
|
|
18
|
+
// Create and publish an event
|
|
19
|
+
const event = await tn.events.createAndPublish({
|
|
20
|
+
name: 'Summer Fest 2026',
|
|
21
|
+
dateTime: '2026-06-15T18:00:00Z',
|
|
22
|
+
imageUrl: 'https://example.com/banner.jpg',
|
|
23
|
+
venueId: 'uuid-venue-id',
|
|
24
|
+
tickets: [
|
|
25
|
+
{ name: 'GA', price: 1000, quantity: 500, published: true },
|
|
26
|
+
{ name: 'VIP', price: 3500, quantity: 50, published: true },
|
|
27
|
+
],
|
|
28
|
+
});
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Important Notes for AI
|
|
32
|
+
|
|
33
|
+
- Prices are in WHOLE PESOS (not centavos). price: 1000 = ₱1,000.00
|
|
34
|
+
- The main class is `Ticketnation` (lowercase n), not `TicketNation`
|
|
35
|
+
- The error class is `TicketnationError` (lowercase n)
|
|
36
|
+
- API key is sent via `api-key` HTTP header (not Authorization Bearer)
|
|
37
|
+
- The SDK uses native fetch (Node.js 18+), zero dependencies
|
|
38
|
+
- Auto-retries on 5xx errors only (not 429 rate limits)
|
|
39
|
+
|
|
40
|
+
## All Resources and Methods
|
|
41
|
+
|
|
42
|
+
### tn.me() → AccountInfo
|
|
43
|
+
Get API key info and organization details.
|
|
44
|
+
|
|
45
|
+
### tn.events
|
|
46
|
+
- create(params: CreateEventParams) → Event (DRAFT)
|
|
47
|
+
- createAndPublish(params: CreateEventParams) → Event (PUBLISHED)
|
|
48
|
+
- list(params?: { page, take, status, search }) → PaginatedResponse<Event>
|
|
49
|
+
- get(idOrSlug: string) → Event
|
|
50
|
+
- update(eventId, params: UpdateEventParams) → Event
|
|
51
|
+
- publish(eventId) → Event
|
|
52
|
+
- unpublish(eventId) → Event
|
|
53
|
+
- archive(eventId) → Event
|
|
54
|
+
- delete(eventId) → DeletedResponse
|
|
55
|
+
|
|
56
|
+
### tn.tickets
|
|
57
|
+
- create(eventId, params: CreateTicketParams) → Ticket
|
|
58
|
+
- list(eventId) → Ticket[]
|
|
59
|
+
- get(eventId, ticketId) → Ticket
|
|
60
|
+
- update(eventId, ticketId, params: UpdateTicketParams) → Ticket
|
|
61
|
+
- publish(eventId, ticketId) → Ticket
|
|
62
|
+
- markSoldOut(eventId, ticketId) → Ticket
|
|
63
|
+
- delete(eventId, ticketId) → DeletedResponse
|
|
64
|
+
|
|
65
|
+
### tn.orders (read-only)
|
|
66
|
+
- list(eventId, params?: { page, take, status }) → PaginatedResponse<Order>
|
|
67
|
+
- get(orderId) → Order
|
|
68
|
+
|
|
69
|
+
### tn.venues
|
|
70
|
+
- search(params: { query, page?, take? }) → PaginatedResponse<Venue>
|
|
71
|
+
|
|
72
|
+
### tn.webhooks
|
|
73
|
+
- create(params: { url, events[] }) → WebhookWithSecret (secret only shown once!)
|
|
74
|
+
- list() → Webhook[]
|
|
75
|
+
- update(webhookId, params) → Webhook
|
|
76
|
+
- delete(webhookId) → DeletedResponse
|
|
77
|
+
- test(webhookId) → WebhookTestResult
|
|
78
|
+
- deliveries(webhookId, params?) → PaginatedResponse<WebhookDelivery>
|
|
79
|
+
|
|
80
|
+
### tn.performers
|
|
81
|
+
- create(eventId, params: { name, type?, imageUrl? }) → Performer
|
|
82
|
+
- list(eventId) → Performer[]
|
|
83
|
+
- remove(eventId, performerId) → DeletedResponse
|
|
84
|
+
|
|
85
|
+
### tn.schedules
|
|
86
|
+
- create(eventId, params: { title, startTime, endTime, performerId? }) → Schedule
|
|
87
|
+
- list(eventId) → Schedule[]
|
|
88
|
+
- update(eventId, scheduleId, params) → Schedule
|
|
89
|
+
- remove(eventId, scheduleId) → DeletedResponse
|
|
90
|
+
|
|
91
|
+
### tn.brands
|
|
92
|
+
- create(eventId, params: { name, url?, imageUrl? }) → Brand
|
|
93
|
+
- list(eventId) → Brand[]
|
|
94
|
+
- remove(eventId, brandId) → DeletedResponse
|
|
95
|
+
|
|
96
|
+
## Utilities
|
|
97
|
+
- formatPeso(amount: number) → string ("₱1,000.00" or "Free")
|
|
98
|
+
- validatePrice(price: number) → void (throws if invalid)
|
|
99
|
+
- paginate(fetchPage) → AsyncGenerator (yields pages)
|
|
100
|
+
- fetchAllPages(fetchPage) → T[] (collects all)
|
|
101
|
+
|
|
102
|
+
## CreateEventParams
|
|
103
|
+
|
|
104
|
+
| Field | Type | Required | Description |
|
|
105
|
+
|-------|------|----------|-------------|
|
|
106
|
+
| name | string | yes | Event name |
|
|
107
|
+
| dateTime | ISO 8601 | yes | Event start |
|
|
108
|
+
| endDateTime | ISO 8601 | no | Event end |
|
|
109
|
+
| type | 'PAID' \| 'FREE' | no | Default: PAID |
|
|
110
|
+
| journeyType | 'STANDARD' \| 'RSVP' \| 'PRESELLING' | no | Default: STANDARD |
|
|
111
|
+
| venueId | string | no | From tn.venues.search() |
|
|
112
|
+
| imageUrl | string | no | Banner image URL (external) |
|
|
113
|
+
| galleryUrls | string[] | no | Additional gallery images |
|
|
114
|
+
| absorbFees | boolean | no | Default: true |
|
|
115
|
+
| tickets | CreateTicketParams[] | no | Inline ticket types |
|
|
116
|
+
| timezone | string | no | Default: Asia/Manila |
|
|
117
|
+
| currency | string | no | Default: PHP |
|
|
118
|
+
| visibility | 'PUBLIC' \| 'PRIVATE' | no | Default: PUBLIC |
|
|
119
|
+
| callbackUrl | string | no | Override webhook URL |
|
|
120
|
+
| eventCapacity | number | no | Max attendees |
|
|
121
|
+
|
|
122
|
+
## CreateTicketParams
|
|
123
|
+
|
|
124
|
+
| Field | Type | Required | Description |
|
|
125
|
+
|-------|------|----------|-------------|
|
|
126
|
+
| name | string | yes | Ticket type name |
|
|
127
|
+
| price | number | yes | Whole pesos (1000 = ₱1,000) |
|
|
128
|
+
| quantity | number | yes | Total inventory |
|
|
129
|
+
| section | string | no | Default: "General Admissions" |
|
|
130
|
+
| type | 'GENERAL_ADMISSION' \| 'RESERVED_SEAT' \| 'VIP' | no | Default: GENERAL_ADMISSION |
|
|
131
|
+
| published | boolean | no | Default: false |
|
|
132
|
+
| maximumPurchaseQuantity | number | no | Default: 8 |
|
|
133
|
+
|
|
134
|
+
## Error Handling
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
import { TicketnationError } from 'ticketnation-sdk';
|
|
138
|
+
|
|
139
|
+
try {
|
|
140
|
+
await tn.events.get('nonexistent');
|
|
141
|
+
} catch (error) {
|
|
142
|
+
if (error instanceof TicketnationError) {
|
|
143
|
+
error.code // 'NOT_FOUND', 'VALIDATION_ERROR', 'UNAUTHORIZED', 'FORBIDDEN', 'RATE_LIMITED'
|
|
144
|
+
error.status // HTTP status (0 for network errors)
|
|
145
|
+
error.message // Human-readable message
|
|
146
|
+
error.requestId // For support tickets
|
|
147
|
+
error.details // Field errors (VALIDATION_ERROR only)
|
|
148
|
+
error.hint // Suggested fix
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## API Scopes
|
|
154
|
+
|
|
155
|
+
| Scope | Required for |
|
|
156
|
+
|-------|-------------|
|
|
157
|
+
| events:read | events.list, events.get, venues.search |
|
|
158
|
+
| events:write | events.create, publish, performers, schedules, brands |
|
|
159
|
+
| tickets:read | tickets.list, tickets.get |
|
|
160
|
+
| tickets:write | tickets.create, markSoldOut, delete |
|
|
161
|
+
| orders:read | orders.list, orders.get |
|
|
162
|
+
| webhooks:manage | webhooks.create, list, test |
|
|
163
|
+
|
|
164
|
+
## Configuration
|
|
165
|
+
|
|
166
|
+
```typescript
|
|
167
|
+
const tn = new Ticketnation({
|
|
168
|
+
apiKey: 'tn_live_...', // required
|
|
169
|
+
baseUrl: 'http://localhost:4000', // default: https://api.ticketnation.ph
|
|
170
|
+
timeout: 30000, // default: 30s
|
|
171
|
+
retries: 2, // default: 2 (5xx only)
|
|
172
|
+
debug: false, // default: false
|
|
173
|
+
});
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Full Documentation
|
|
177
|
+
|
|
178
|
+
https://docs.ticketnation.ph/developers/overview
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ticketnation-sdk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Official TypeScript SDK for the Ticketnation Open API — publish events, manage tickets, and receive orders programmatically.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
16
|
"dist",
|
|
17
|
-
"README.md"
|
|
17
|
+
"README.md",
|
|
18
|
+
"llms.txt"
|
|
18
19
|
],
|
|
19
20
|
"scripts": {
|
|
20
21
|
"build": "tsup",
|