export type UserTicket = {id: string, created_at: unknown, ticket_id?: string | undefined, order_id?: string | undefined, user_id?: string | undefined, name?: unknown | undefined, description?: unknown | undefined, event_id?: string | undefined, event_name?: unknown | undefined, secret: string, used: boolean, updated_at: unknown, approval_status: 'pending' | 'approved' | 'denied', notes?: unknown | undefined}; export type CreateApiUserTicketArgs = {select?: string | undefined, Prefer?: ('return=representation' | 'return=minimal' | 'return=none' | 'resolution=ignore-duplicates' | 'resolution=merge-duplicates') | undefined, body: UserTicket}; export type CreateApiUserTicketOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * POST /user_ticket */ export const createApiUserTicket = async (args: CreateApiUserTicketArgs, options?: CreateApiUserTicketOptions) => { const {baseUrl = "https://vnaabuozknwgxuvnfwjo.supabase.co:443", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.select != null) query.append("select", String(args.select)) if (args.Prefer != null) headers.set("Prefer", String(args.Prefer)) const url = `${baseUrl.replace(/\/+$/, '')}/user_ticket${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };