(eventId: string)
| 272 | * Get all guests/registrations for an event |
| 273 | */ |
| 274 | export async function getEventGuests(eventId: string): Promise<LumaGuest[]> { |
| 275 | try { |
| 276 | const guests: LumaGuest[] = []; |
| 277 | let cursor: string | null = null; |
| 278 | |
| 279 | // Paginate through all guests |
| 280 | do { |
| 281 | const urlParams = new URLSearchParams({ |
| 282 | event_api_id: eventId, |
| 283 | ...(cursor && { pagination_cursor: cursor }), |
| 284 | }); |
| 285 | |
| 286 | const response: { |
| 287 | entries: Array<{ guest: LumaGuest }>; |
| 288 | has_more: boolean; |
| 289 | next_cursor: string | null; |
| 290 | } = await lumaFetch(`/event/get-guests?${urlParams}`); |
| 291 | |
| 292 | for (const entry of response.entries) { |
| 293 | guests.push(entry.guest); |
| 294 | } |
| 295 | |
| 296 | cursor = response.has_more ? response.next_cursor : null; |
| 297 | } while (cursor); |
| 298 | |
| 299 | logger.debug({ eventId, count: guests.length }, 'Fetched Luma event guests'); |
| 300 | return guests; |
| 301 | } catch (error) { |
| 302 | logger.error({ err: error, eventId }, 'Error fetching Luma event guests'); |
| 303 | return []; |
| 304 | } |
| 305 | } |
| 306 | |
| 307 | /** |
| 308 | * Get hosts for an event. |
no test coverage detected