export type GetApiTicketRefundsArgs = {date_from?: string | undefined, date_to?: string | undefined, user_id?: number | undefined, 'pagination[limit]'?: number | undefined, 'pagination[page]'?: number | undefined}; export type GetApiTicketRefundsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * List refunds * * GET /ticket_refunds */ export const getApiTicketRefunds = async (args: GetApiTicketRefundsArgs, options?: GetApiTicketRefundsOptions) => { const {baseUrl = "http://api.gostarmartbus.com/api", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.date_from != null) query.append("date_from", String(args.date_from)) if (args.date_to != null) query.append("date_to", String(args.date_to)) if (args.user_id != null) query.append("user_id", String(args.user_id)) if (args['pagination[limit]'] != null) query.append("pagination[limit]", String(args['pagination[limit]'])) if (args['pagination[page]'] != null) query.append("pagination[page]", String(args['pagination[page]'])) const url = `${baseUrl.replace(/\/+$/, '')}/ticket_refunds${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 };