export type GetApiV1ReportingRefundsArgs = {startDate?: unknown | undefined, endDate?: unknown | undefined, size?: number | undefined, page?: number | undefined}; export type GetApiV1ReportingRefundsOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get refunds * * GET /v1/reporting/refunds */ export const getApiV1ReportingRefunds = async (args: GetApiV1ReportingRefundsArgs, options?: GetApiV1ReportingRefundsOptions) => { const {baseUrl = "https://integration.api.scalapay.com", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (args.startDate != null) query.append("startDate", String(args.startDate)) if (args.endDate != null) query.append("endDate", String(args.endDate)) if (args.size != null) query.append("size", String(args.size)) if (args.page != null) query.append("page", String(args.page)) if (ApiKeyAuth !== undefined) headers.set("Authorization", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/v1/reporting/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 (await res.json()) as unknown };