export type GetApiV1CheckinsActiveFacilityFacilityCodeArgs = {facilityCode: string}; export type GetApiV1CheckinsActiveFacilityFacilityCodeOptions = {baseUrl: string, https?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Get the count of active checkins for a specific facility. Active checkins are defined as customers who have checked in but not checked out in the current day. * * GET /v1/checkins/active/facility/{facilityCode} */ export const getApiV1CheckinsActiveFacilityFacilityCode = async (args: GetApiV1CheckinsActiveFacilityFacilityCodeArgs, options: GetApiV1CheckinsActiveFacilityFacilityCodeOptions) => { const {baseUrl, fetch: fetchFn = fetch, https} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (https !== undefined) headers.set('authorization', `Basic ${btoa(`${https.username}:${https.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/checkins/active/facility/${encodeURIComponent(String(args.facilityCode))}${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 undefined };