export type GetApiV1CheckinsFacilityFacilityCodeArgs = {facilityCode: string, startId?: number | undefined, customerGuid?: string | undefined, customerDetails?: boolean | undefined, remoteOnly?: boolean | undefined, startDateTime?: string | undefined, endDateTime?: string | undefined, limit?: number | undefined, page?: number | undefined}; export type GetApiV1CheckinsFacilityFacilityCodeOptions = {baseUrl: string, https?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Get checkins for a specific facility * * GET /v1/checkins/facility/{facilityCode} */ export const getApiV1CheckinsFacilityFacilityCode = async (args: GetApiV1CheckinsFacilityFacilityCodeArgs, options: GetApiV1CheckinsFacilityFacilityCodeOptions) => { const {baseUrl, fetch: fetchFn = fetch, https} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.startId != null) query.append("startId", String(args.startId)) if (args.customerGuid != null) query.append("customerGuid", String(args.customerGuid)) if (args.customerDetails != null) query.append("customerDetails", String(args.customerDetails)) if (args.remoteOnly != null) query.append("remoteOnly", String(args.remoteOnly)) if (args.startDateTime != null) query.append("startDateTime", String(args.startDateTime)) if (args.endDateTime != null) query.append("endDateTime", String(args.endDateTime)) if (args.limit != null) query.append("limit", String(args.limit)) if (args.page != null) query.append("page", String(args.page)) if (https !== undefined) headers.set('authorization', `Basic ${btoa(`${https.username}:${https.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/checkins/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 };