export type AddUpdateWorkflowConditionRequest = {type: string}; export type UpdateApiWorkflowsWorkflowIdConditionsWorkflowConditionIdArgs = {workflowId: string, workflowConditionId: string, body: AddUpdateWorkflowConditionRequest}; export type UpdateApiWorkflowsWorkflowIdConditionsWorkflowConditionIdOptions = {baseUrl: string, OAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update a workflow condition * * PUT /workflows/{workflowId}/conditions/{workflowConditionId} * * Also accepts auth: ApiSecretKey */ export const updateApiWorkflowsWorkflowIdConditionsWorkflowConditionId = async (args: UpdateApiWorkflowsWorkflowIdConditionsWorkflowConditionIdArgs, options: UpdateApiWorkflowsWorkflowIdConditionsWorkflowConditionIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, OAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (OAuth !== undefined) headers.set('authorization', `Bearer ${OAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/workflows/${encodeURIComponent(String(args.workflowId))}/conditions/${encodeURIComponent(String(args.workflowConditionId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };