Rust
Get AI workflow by ID
fetch_workflow
pub async fn fetch_workflow(workflow_id: &str) -> Result<AiWorkflow>
Result<AiWorkflow>
use wacht::api::workflows::*; let workflow = fetch_workflow("52057194421551105").await?; println!("Workflow: {} ({})", workflow.name, workflow.id); println!("Description: {}", workflow.description); println!("Steps: {}", workflow.steps.len()); println!("Active: {}", workflow.is_active);
match fetch_workflow("52057194421551105").await { Ok(workflow) => { println!("Found workflow: {}", workflow.name); println!("Trigger type: {}", workflow.trigger_type); println!("Number of steps: {}", workflow.steps.len()); for (i, step) in workflow.steps.iter().enumerate() { println!(" Step {}: {} ({})", i + 1, step.name, step.type_); } } Err(Error::Api { status, message, .. }) => { match status.as_u16() { 404 => println!("Workflow not found"), 403 => println!("Access denied: {}", message), _ => println!("API error {}: {}", status, message), } } Err(e) => println!("Request failed: {}", e), }