import { ApiRequestOptions } from './client.js'; import { Result } from './result.js'; import { Event, AvailableTicket, EventPerformersResponse, SeriesOccurrencesResponse, PublicCollectionData, ResolvedEntity } from './types.js'; /** * Fetch event details, discriminating a real 404 from a transient failure. * * The SSR loader (`[id]/[slug]/+page.js`) gates its HTTP status on this: only an * upstream 404 (`errNotFound`) becomes a page 404. A 5xx, a network error, or a * timeout is `err(...)` (transient) so the loader can answer 503/retry instead * of rendering a permanent-looking 404 to a buyer or crawler on a backend blip. * * @param eventId - The event ID * @param customFetch - Optional custom fetch function (for SSR) * @param password - Optional password for gated events * @returns `ok(event)`, `errNotFound(...)` for a real 404, or `err(...)` transient */ export declare function fetchEventDetailsResult(eventId: string | number, customFetch?: typeof fetch, password?: string, req?: Pick): Promise>; /** * Fetch event details * * Gets full event information including venue and ticket data. * * Fail-open adapter over {@link fetchEventDetailsResult}: existing in-widget * callers (Checkout, CartView, EventPage) keep degrading to `null` on any * failure. SSR loaders that need to answer 404-vs-503 use the Result variant. * * @param eventId - The event ID * @param customFetch - Optional custom fetch function (for SSR) * @returns Event details or null on error */ export declare function fetchEventDetails(eventId: string | number, customFetch?: typeof fetch, password?: string, req?: Pick): Promise; /** * Fetch available tickets for an event * * Returns all ticket types that are currently available for sale. * * @param eventId - The event ID * @returns Array of available tickets */ export declare function fetchEventTicketsResult(eventId: string | number, promoCode?: string, req?: Pick): Promise>; export declare function fetchEventTickets(eventId: string | number, promoCode?: string, req?: Pick): Promise; /** * Fetch performers for an event * * Returns the lineup with pre-resolved avatar URLs. * * @param eventId - The event ID * @returns Performers list and visibility flag */ export declare function fetchEventPerformersResult(eventId: string | number, req?: Pick): Promise>; export declare function fetchEventPerformers(eventId: string | number, req?: Pick): Promise; /** * Fetch all venues for an organization * * @param orgId - The organization ID * @returns Array of venues */ export declare function fetchAllVenuesResult(orgId: string | number, req?: Pick): Promise>; export declare function fetchAllVenues(orgId: string | number, req?: Pick): Promise; /** * Fetch events for a venue * * @param venueId - The venue ID * @returns Array of events */ export declare function fetchVenueEventsResult(venueId: string | number, req?: Pick): Promise>; export declare function fetchVenueEvents(venueId: string | number, req?: Pick): Promise; /** * Options for a month read. * * `fresh` means "this caller must not be handed an answer that was already on * the wire". It exists for the live status stream: when the backend says a show * was canceled or postponed, CalendarContainer force-refreshes that month, and * an in-flight response may have been snapshotted by the server BEFORE the * change that triggered the refresh. Joining it would leave a canceled show * drawn as on-sale until the next envelope — the exact staleness * CalendarContainer's own force path exists to prevent. * * A fresh read also REPLACES the shared entry, so anyone joining afterwards * waits on the post-change request rather than the one it superseded. Two * instances that both force on the same envelope still share, because both of * their requests are post-change. */ export interface MonthReadOptions { fresh?: boolean; } export declare function getMonthEventsResult(venueId: string | number, year: number, month: number, options?: MonthReadOptions, req?: Pick): Promise>; export declare function getMonthEvents(venueId: string | number, year: number, month: number, req?: Pick): Promise; /** * Get events for an organization for a specific month * * @param orgId - The organization ID * @param year - The year (e.g., 2024) * @param month - The month (1-12) * @returns Array of events for the month */ export declare function getOrgMonthEventsResult(orgId: string | number, year: number, month: number, options?: MonthReadOptions, req?: Pick): Promise>; export declare function getOrgMonthEvents(orgId: string | number, year: number, month: number, req?: Pick): Promise; /** * Get series occurrences for date selector * * Returns all instances of a recurring event series. * * @param eventSeriesId - The series ID * @returns Series occurrences */ export declare function getSeriesOccurrencesResult(eventSeriesId: number, req?: Pick): Promise>; export declare function getSeriesOccurrences(eventSeriesId: number, req?: Pick): Promise; /** * Fetch series occurrences with CTA state * * Returns full series data including availability status. * * @param eventSeriesId - The series ID * @param venueId - The venue ID * @returns Series occurrences with CTA state */ export declare function fetchSeriesOccurrencesResult(eventSeriesId: number, venueId: string | number, req?: Pick): Promise>; export declare function fetchSeriesOccurrences(eventSeriesId: number, venueId: string | number, req?: Pick): Promise; /** * Resolve an entity-agnostic public id to its concrete type + data. * * The embed deep-link (`#{id}-{slug}`) carries no type prefix, so a cold * deep link (the show isn't in the loaded calendar month) needs the backend * to say whether the id is an event, series, or collection before the widget * can render the right view. This is the same `/api/v2/public/resolve/{id}` * endpoint get-micdrop.com's `/e/{slugId}` page resolves server-side; here we * call it cross-origin from the venue's page (the public API already serves * the calendar cross-origin, so CORS is in place). * * @param id - The entity id (numeric, type-agnostic) * @param slug - Optional slug hint (lets the backend canonicalize) * @returns `{ type, id, title, data }` or null on failure */ export declare function resolvePublicEntity(id: string | number, slug?: string, req?: Pick): Promise; /** * Fetch public collection data * * Returns collection info including events list. * For password-protected collections, pass the password to authenticate. * * @param collectionId - The collection ID * @param password - Optional password for protected collections * @returns Collection data or null on error */ export declare function fetchPublicCollection(collectionId: string | number, password?: string, req?: Pick): Promise; /** * Check collection password * * Validates password for password-protected collections. * * @param collectionId - The collection ID * @param password - The password to check * @returns Whether the password is valid */ export declare function checkCollectionPassword(collectionId: string | number, password: string, req?: Pick): Promise; /** * Check event password * * Validates password for password-protected events. * * @param eventId - The event ID * @param password - The password to check * @returns Whether the password is valid */ export declare function checkEventPassword(eventId: string | number, password: string, req?: Pick): Promise<{ valid: boolean; }>; /** * Test network connection * * Asks whether the public API is reachable. * * THE QUESTION IS "DID THE ROUTER ANSWER", NOT "DID THE RESOURCE EXIST" — the * same distinction route-manifest.ts is built on. Under the old `response.ok` * rule this probe reported the API DOWN on a healthy backend on EVERY branch, * for EVERY input, always. Measured against production: HEAD answers 405 on * every route the backend serves — including `HEAD /events/venue/42` for a venue * that EXISTS — and the old `HEAD /health` branch answered 404, because the * router does not serve /health at all. None of those are `ok`. A liveness check * that always fails is worse than none. * * Two changes fix two different things, and they are separable: * * 1. THE STATUS RULE is what fixes liveness. Reachable means ANSWERED, not * `response.ok`. A 400, a 404 or a 405 is the backend talking: it is up. * Only a transport failure (DNS, TLS, CORS, offline) or a 5xx means it is * not serving. This rule alone would have made liveness report up, even on * the old /health probe (404 < 500). * 2. THE REPOINT is what stops this naming a route the router does not serve — * the name-resolution gate, and #444. Every branch now names a route the * backend actually SERVES. There is no id-free public route, so the no-ids * branch asks a served route about an id that cannot exist: we do not care * what it says about the venue, only that it said anything at all. This is * not what fixes liveness. * * Do not "simplify" `status < 500` back to `response.ok`. That is the bug. * * @param orgId - Optional org ID * @param venueId - Optional venue ID * @returns Whether the API answered */ export declare function testNetworkConnection(orgId?: string | number, venueId?: string | number): Promise;