export type GetApiGetGatewaysArgs = {filter?: unknown | undefined}; export type GetApiGetGatewaysOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Get gateways details * * GET /get_gateways */ export const getApiGetGateways = async (args: GetApiGetGatewaysArgs, options: GetApiGetGatewaysOptions) => { 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(/\/+$/, '')}/get_gateways${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 };