export type CreateApiApiWorkflowWorkflowIdRestartArgs = {workflowId: string, useLatestDefinitions?: boolean | undefined}; export type CreateApiApiWorkflowWorkflowIdRestartOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Restarts a completed workflow * * POST /api/workflow/{workflowId}/restart */ export const createApiApiWorkflowWorkflowIdRestart = async (args: CreateApiApiWorkflowWorkflowIdRestartArgs, options?: CreateApiApiWorkflowWorkflowIdRestartOptions) => { const {baseUrl = "https://developer.orkescloud.com", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.useLatestDefinitions != null) query.append("useLatestDefinitions", String(args.useLatestDefinitions)) if (apiKey !== undefined) headers.set("X-Authorization", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/api/workflow/${encodeURIComponent(String(args.workflowId))}/restart${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };