export_data/
export_data.rs

1use vtiger_client::{ExportFormat, Vtiger};
2
3#[tokio::main]
4async fn main() -> Result<(), Box<dyn std::error::Error>> {
5    let vtiger = Vtiger::new(
6        "https://your-instance.vtiger.com",
7        "your_username",
8        "your_access_key",
9    );
10
11    // Export leads with filtering
12    let prefixes: Vec<String> = vec![
13        "Chicago".to_string(),
14        "Seattle".to_string(),
15        "California".to_string(),
16    ];
17    vtiger
18        .export(
19            "Leads",
20            Some(("location", prefixes)),
21            200,
22            3,
23            vec![ExportFormat::Json, ExportFormat::CSV],
24        )
25        .await?;
26
27    println!("Export completed! Check output.json and output.csv");
28    Ok(())
29}