export type GetApiApiWorkflowWorkflowIdArgs = {workflowId: string, includeTasks?: boolean | undefined, summarize?: boolean | undefined}; export type GetApiApiWorkflowWorkflowIdOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Gets the workflow by workflow (execution) id * * GET /api/workflow/{workflowId} */ export const getApiApiWorkflowWorkflowId = async (args: GetApiApiWorkflowWorkflowIdArgs, options?: GetApiApiWorkflowWorkflowIdOptions) => { const {baseUrl = "https://developer.orkescloud.com", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.includeTasks != null) query.append("includeTasks", String(args.includeTasks)) if (args.summarize != null) query.append("summarize", String(args.summarize)) if (apiKey !== undefined) headers.set("X-Authorization", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/api/workflow/${encodeURIComponent(String(args.workflowId))}${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 res.blob() };