export type GetApiPaymentGatewaysListArgs = {filter?: unknown | undefined}; export type GetApiPaymentGatewaysListOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Filter payment gateways * * GET /payment_gateways/list */ export const getApiPaymentGatewaysList = async (args: GetApiPaymentGatewaysListArgs, options: GetApiPaymentGatewaysListOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.filter != null) query.append("filter", String(args.filter)) const url = `${baseUrl.replace(/\/+$/, '')}/payment_gateways/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 };