export type GetApiReportsUserCheckInArgs = {start_date: string, end_date: string, checked_in_by_id?: number | undefined, counter_id?: number | undefined}; export type GetApiReportsUserCheckInOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Report by user check-in. Need permission: user_check_in_report * * GET /reports/user_check_in */ export const getApiReportsUserCheckIn = async (args: GetApiReportsUserCheckInArgs, options?: GetApiReportsUserCheckInOptions) => { const {baseUrl = "http://api.gostarmartbus.com/api", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.start_date != null) query.append("start_date", String(args.start_date)) if (args.end_date != null) query.append("end_date", String(args.end_date)) if (args.checked_in_by_id != null) query.append("checked_in_by_id", String(args.checked_in_by_id)) if (args.counter_id != null) query.append("counter_id", String(args.counter_id)) const url = `${baseUrl.replace(/\/+$/, '')}/reports/user_check_in${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 };