export type GetApiTicketsTicketIdQrArgs = {ticketId: string}; export type GetApiTicketsTicketIdQrOptions = {baseUrl?: string | undefined, MuseumPlaceholderAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Get ticket QR code * * GET /tickets/{ticketId}/qr */ export const getApiTicketsTicketIdQr = async (args: GetApiTicketsTicketIdQrArgs, options?: GetApiTicketsTicketIdQrOptions) => { const {baseUrl = "https://api.fake-museum-example.com/v1", fetch: fetchFn = fetch, MuseumPlaceholderAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "image/png") if (MuseumPlaceholderAuth !== undefined) headers.set('authorization', `Basic ${btoa(`${MuseumPlaceholderAuth.username}:${MuseumPlaceholderAuth.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/tickets/${encodeURIComponent(String(args.ticketId))}/qr${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };