export type CreateApiRiveterV1RunArgs = {run_key?: string | undefined, body: {input: Record, output: Record}}; export type CreateApiRiveterV1RunOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Copy link Define the structure of your output directly in the API request. This endpoint allows you to define both your input data and output configuration in a single request. * * POST /riveter/v1/run */ export const createApiRiveterV1Run = async (args: CreateApiRiveterV1RunArgs, options?: CreateApiRiveterV1RunOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.run_key != null) query.append("run_key", String(args.run_key)) const url = `${baseUrl.replace(/\/+$/, '')}/riveter/v1/run${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };