export type GetApiGatewaysListOptionsArgs = {country_code?: string | undefined}; export type GetApiGatewaysListOptionsOptions = {baseUrl: string, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * List available gateways * * GET /gateways/list_options * * Also accepts auth: API-Key */ export const getApiGatewaysListOptions = async (args: GetApiGatewaysListOptionsArgs, options: GetApiGatewaysListOptionsOptions) => { const {baseUrl, fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.country_code != null) query.append("country_code", String(args.country_code)) if (Bearer !== undefined) headers.set("Authorization", Bearer) const url = `${baseUrl.replace(/\/+$/, '')}/gateways/list_options${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 };