export type GetApiReportsAgentSalesSummaryListArgs = {transaction_start_date: string, transaction_end_date: string, currency?: ('MYR' | 'SGD' | '') | undefined}; export type GetApiReportsAgentSalesSummaryListOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Agent sales summary list * * GET /reports/agent_sales/summary_list */ export const getApiReportsAgentSalesSummaryList = async (args: GetApiReportsAgentSalesSummaryListArgs, options?: GetApiReportsAgentSalesSummaryListOptions) => { const {baseUrl = "http://api.gostarmartbus.com/api", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.transaction_start_date != null) query.append("transaction_start_date", String(args.transaction_start_date)) if (args.transaction_end_date != null) query.append("transaction_end_date", String(args.transaction_end_date)) if (args.currency != null) query.append("currency", String(args.currency)) const url = `${baseUrl.replace(/\/+$/, '')}/reports/agent_sales/summary_list${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 };