export type GetApiPipelineGatewayRouteArgs = {id?: string | undefined, origin?: ('ui' | 'system') | undefined}; export type GetApiPipelineGatewayRouteOptions = {baseUrl?: string | undefined, PipelineServiceKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * List all gateway routes * * GET /pipeline/gateway-route */ export const getApiPipelineGatewayRoute = async (args: GetApiPipelineGatewayRouteArgs, options?: GetApiPipelineGatewayRouteOptions) => { const {baseUrl = "https://api.mezmo.com/v3", fetch: fetchFn = fetch, PipelineServiceKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.id != null) query.append("id", String(args.id)) if (args.origin != null) query.append("origin", String(args.origin)) if (PipelineServiceKey !== undefined) headers.set("Authorization", PipelineServiceKey) const url = `${baseUrl.replace(/\/+$/, '')}/pipeline/gateway-route${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 };