export type CreateApiWorkflowIdUpdateUpdateArgs = {id: string, update: string, body: {payload?: Record | undefined}}; export type CreateApiWorkflowIdUpdateUpdateOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Execute an update on an workflow * * POST /workflow/{id}/update/{update} */ export const createApiWorkflowIdUpdateUpdate = async (args: CreateApiWorkflowIdUpdateUpdateArgs, options?: CreateApiWorkflowIdUpdateUpdateOptions) => { const {baseUrl = "http://localhost:3001", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/workflow/${encodeURIComponent(String(args.id))}/update/${encodeURIComponent(String(args.update))}${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 };