export type GetApiReportsSalesSummaryCountersArgs = {counter_group_id?: number | undefined, start_date: string, end_date: string, start_time: string, end_time: string}; export type GetApiReportsSalesSummaryCountersOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get counter list. Need permission: sales_summary_report * * GET /reports/sales_summary/counters */ export const getApiReportsSalesSummaryCounters = async (args: GetApiReportsSalesSummaryCountersArgs, options?: GetApiReportsSalesSummaryCountersOptions) => { const {baseUrl = "http://api.gostarmartbus.com/api", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.counter_group_id != null) query.append("counter_group_id", String(args.counter_group_id)) 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.start_time != null) query.append("start_time", String(args.start_time)) if (args.end_time != null) query.append("end_time", String(args.end_time)) const url = `${baseUrl.replace(/\/+$/, '')}/reports/sales_summary/counters${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 };