ltfi-wsap 2.0.2

LTFI-WSAP (Layered Transformer Framework Intelligence - Web System Alignment Protocol) Rust SDK
Documentation
use ltfi_wsap::{Client, CreateEntityRequest, UpdateEntityRequest, EntityType, ListParams};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    dotenv::dotenv().ok();
    let client = Client::from_env()?;
    
    // Create a new entity
    let new_entity = client.create_entity(&CreateEntityRequest {
        display_name: "Test Company".to_string(),
        legal_name: Some("Test Company Inc.".to_string()),
        entity_type: EntityType::Company,
        description: Some("A test company for SDK demonstration".to_string()),
        domains: Some(vec!["example.com".to_string()]),
        profile: None,
    }).await?;
    
    println!("Created entity: {}", new_entity.slug);
    
    // Get the entity
    let entity = client.get_entity(&new_entity.slug).await?;
    println!("Retrieved: {} (verified: {})", entity.display_name, entity.is_verified);
    
    // Update the entity
    let updated = client.update_entity(&new_entity.slug, &UpdateEntityRequest {
        description: Some("Updated description".to_string()),
        ..Default::default()
    }).await?;
    
    println!("Updated description: {:?}", updated.description);
    
    // List entities with filters
    let companies = client.list_entities(Some(ListParams {
        entity_type: Some(EntityType::Company),
        is_active: Some(true),
        page_size: Some(10),
        ..Default::default()
    })).await?;
    
    println!("\nActive companies:");
    for company in &companies.results {
        println!("- {}", company.display_name);
    }
    
    Ok(())
}