export type GetApiReportsReprintedArgs = {start_date: string, end_date: string, date_type: 'departure_date' | 'sales_date', filter_sales_by_id?: number | undefined, filter_reprinted_by_id?: number | undefined}; export type GetApiReportsReprintedOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Reprinted Report * * GET /reports/reprinted */ export const getApiReportsReprinted = async (args: GetApiReportsReprintedArgs, options?: GetApiReportsReprintedOptions) => { 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.date_type != null) query.append("date_type", String(args.date_type)) if (args.filter_sales_by_id != null) query.append("filter_sales_by_id", String(args.filter_sales_by_id)) if (args.filter_reprinted_by_id != null) query.append("filter_reprinted_by_id", String(args.filter_reprinted_by_id)) const url = `${baseUrl.replace(/\/+$/, '')}/reports/reprinted${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 };