export type GetApiV1GuestsGuestIdGuestpassArgs = {guest_id?: string | undefined, instrument_id?: string | undefined, instrument_type?: number | undefined, credit_type?: '' | undefined, list_type?: number | undefined, expand?: Array | undefined}; export type GetApiV1GuestsGuestIdGuestpassOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Retrieve a list of all the guest passes sent from or received by a user * * GET /v1/guests/{guest_id}/guestpass */ export const getApiV1GuestsGuestIdGuestpass = async (args: GetApiV1GuestsGuestIdGuestpassArgs, options?: GetApiV1GuestsGuestIdGuestpassOptions) => { const {baseUrl = "https://api.zenoti.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (args.guest_id != null) query.append("guest_id", String(args.guest_id)) if (args.instrument_id != null) query.append("instrument_id", String(args.instrument_id)) if (args.instrument_type != null) query.append("instrument_type", String(args.instrument_type)) if (args.credit_type != null) query.append("credit_type", String(args.credit_type)) if (args.list_type != null) query.append("list_type", String(args.list_type)) for (const item of args.expand ?? []) query.append("expand", String(item)) const url = `${baseUrl.replace(/\/+$/, '')}/v1/guests/${encodeURIComponent(String(args.guest_id))}/guestpass${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 (await res.json()) as unknown };