@ingram-tech/luma 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -27,25 +27,32 @@ import { LumaClient } from "@ingram-tech/luma";
27
27
  const luma = new LumaClient({ apiKey: process.env.LUMA_API_KEY! });
28
28
  // or: const luma = LumaClient.fromEnv(); // reads LUMA_API_KEY
29
29
 
30
- // Iterate every event on a calendar (auto-paginates).
31
- for await (const entry of luma.calendar.listEvents({ calendarApiId })) {
32
- console.log(entry.event?.name);
30
+ // Iterate every event the calendar manages (auto-paginates). The calendar is
31
+ // inferred from the API key — no calendar id needed.
32
+ for await (const event of luma.calendar.listEvents()) {
33
+ console.log(event.id, event.name);
33
34
  }
34
35
 
35
36
  // …or collect them into an array.
36
- const events = await luma.calendar.listAllEvents({ calendarApiId });
37
+ const events = await luma.calendar.listAllEvents();
37
38
 
38
39
  // Guests of an event.
39
- const guests = await luma.events.listAllGuests({ eventApiId });
40
+ const guests = await luma.events.listAllGuests({ eventId });
40
41
 
41
- // A single guest, by email.
42
- const guest = await luma.events.getGuest({ eventApiId, email: "a@b.com" });
42
+ // A single guest (with order detail), by guest id.
43
+ const guest = await luma.events.getGuest({ eventId, guestId: "gst-…" });
43
44
 
44
45
  // Approve a guest.
45
- await luma.events.updateGuestStatus({
46
- eventApiId,
47
- guestApiId: guest.api_id,
48
- status: "approved",
46
+ await luma.events.updateGuestStatus({ eventId, guestId: guest.id, status: "approved" });
47
+
48
+ // Ticket types, including prices (cents / currency).
49
+ const tiers = await luma.events.listTicketTypes({ eventId });
50
+
51
+ // Register a guest (host-side — does NOT take payment; Luma owns checkout).
52
+ await luma.events.addGuests({
53
+ eventId,
54
+ guests: [{ email: "a@b.com", name: "Ada Lovelace" }],
55
+ ticketTypeId: tiers[0]?.id,
49
56
  });
50
57
 
51
58
  // Coupons.
@@ -58,21 +65,25 @@ const coupon = await luma.calendar.createCoupon({
58
65
 
59
66
  ### Pagination
60
67
 
61
- Cursor-paginated methods (`listEvents`, `listPeople`, `listGuests`,
68
+ Cursor-paginated methods (`listEvents`, `listContacts`, `listGuests`,
62
69
  `listCoupons`) return an `AsyncGenerator` that follows `next_cursor`
63
70
  automatically. Each has a `listAll…` sibling that drains it into an array.
64
71
  `collect()` is exported for draining any async iterable.
65
72
 
66
73
  ### Escape hatches
67
74
 
68
- The typed methods cover the endpoints this client is built around. For
69
- anything not modelled, call the API directly both methods are public:
75
+ The typed methods cover the common endpoints. For anything else, call the API
76
+ directly `request` and `paginate` are public, and the `ResponseOf` /
77
+ `QueryOf` / `BodyOf` helpers type *any* endpoint straight from the spec:
70
78
 
71
79
  ```ts
72
- // Any endpoint, typed by you.
73
- const data = await luma.request<MyType>("/v1/event/get", {
74
- query: { api_id: eventApiId },
75
- });
80
+ import type { ResponseOf } from "@ingram-tech/luma";
81
+
82
+ // `data` is typed as the endpoint's real response — no hand-written type.
83
+ const data = await luma.request<ResponseOf<"/v1/events/get", "get">>(
84
+ "/v1/events/get",
85
+ { query: { event_id: eventId } },
86
+ );
76
87
 
77
88
  // Any cursor-paginated endpoint.
78
89
  for await (const entry of luma.paginate<MyEntry>("/v1/some/list", { foo: "bar" })) {
@@ -84,8 +95,7 @@ for await (const entry of luma.paginate<MyEntry>("/v1/some/list", { foo: "bar" }
84
95
  options, e.g. Next.js cache hints:
85
96
 
86
97
  ```ts
87
- await luma.request("/v1/calendar/list-events", {
88
- query: { calendar_api_id },
98
+ await luma.request("/v1/calendars/events/list", {
89
99
  fetchInit: { next: { revalidate: 300 } },
90
100
  });
91
101
  ```
@@ -114,22 +124,28 @@ try {
114
124
  | Area | Methods |
115
125
  | --- | --- |
116
126
  | Calendar events | `calendar.listEvents`, `calendar.listAllEvents` |
117
- | Calendar people | `calendar.listPeople`, `calendar.listAllPeople` |
127
+ | Calendar contacts | `calendar.listContacts`, `calendar.listAllContacts` |
118
128
  | Coupons | `calendar.listCoupons`, `calendar.findCouponByCode`, `calendar.createCoupon` |
119
129
  | Events | `events.get` |
120
- | Guests | `events.listGuests`, `events.listAllGuests`, `events.getGuest`, `events.updateGuestStatus` |
121
- | Anything else | `request`, `paginate` |
130
+ | Guests | `events.listGuests`, `events.listAllGuests`, `events.getGuest`, `events.updateGuestStatus`, `events.addGuests` |
131
+ | Ticket types | `events.listTicketTypes`, `events.getTicketType`, `events.createTicketType`, `events.updateTicketType`, `events.deleteTicketType` |
132
+ | Anything else | `request`, `paginate` (typed via `ResponseOf`/`QueryOf`/`BodyOf`) |
133
+
134
+ Types are generated from Luma's published OpenAPI
135
+ (`https://public-api.luma.com/openapi.json`) — run `bun run generate` to refresh
136
+ `src/generated/openapi.ts` when the API changes. The convenience methods and
137
+ their camelCase option objects are the only hand-written surface.
122
138
 
123
- Luma does not publish a machine-readable schema. The calendar-events and
124
- coupon paths are exercised in production; the guest and people paths are
125
- modelled from Luma's public API documentation. Response objects carry an index
126
- signature, so unmodelled fields are always reachable. PRs welcome.
139
+ Note the API has **no checkout/payment endpoint** `addGuests` registers a
140
+ guest host-side but never takes payment; ticket purchase happens on Luma's own
141
+ hosted checkout.
127
142
 
128
143
  ## Development
129
144
 
130
145
  ```sh
131
146
  bun install
132
147
  bun run ci # type-check, lint, test, build
148
+ bun run generate # regenerate types from Luma's OpenAPI
133
149
  bun run test # watch mode
134
150
  ```
135
151