Overview

The update_workflow function updates an existing AI workflow’s configuration.

Function Signature

pub async fn update_workflow(
    workflow_id: &str,
    request: UpdateAiWorkflowRequest
) -> Result<AiWorkflow>

Parameters

workflow_id
&str
required
The unique identifier of the workflow to update
request
UpdateAiWorkflowRequest
required
The workflow fields to update (all optional):
  • name: Workflow name
  • description: Workflow description
  • steps: Array of workflow steps
  • is_active: Whether workflow is active

Return Value

Returns Result<AiWorkflow> containing the updated workflow details.

Basic Usage

use wacht::api::workflows::*;

let update = UpdateAiWorkflowRequest {
    name: Some("Updated Workflow Name".to_string()),
    description: Some("Updated description".to_string()),
    is_active: Some(false),
    ..Default::default()
};

let updated_workflow = update_workflow("52057194421551105", update).await?;
println!("Updated workflow: {}", updated_workflow.name);

Error Handling

match update_workflow("52057194421551105", request).await {
    Ok(workflow) => {
        println!("Successfully updated workflow: {}", workflow.name);
        println!("Last updated: {}", workflow.updated_at);
        println!("Active status: {}", workflow.is_active);
    }
    Err(Error::Api { status, message, .. }) => {
        match status.as_u16() {
            404 => println!("Workflow not found"),
            400 => println!("Invalid request: {}", message),
            403 => println!("Access denied: {}", message),
            _ => println!("API error {}: {}", status, message),
        }
    }
    Err(e) => println!("Request failed: {}", e),
}

Rate Limits

  • Update operations: 100 requests per minute
  • Burst limit: 10 requests per second