use legnext_rust_sdk::apis::configuration::Configuration;
use legnext_rust_sdk::apis::image_api;
use std::env;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Configure API client
let mut config = Configuration::new();
config.base_path = "https://api.legnext.ai".to_string();
let api_key = env::var("LEGNEXT_API_KEY")?;
// Generate image
let mut request = std::collections::HashMap::new();
request.insert("text".to_string(), serde_json::json!("a beautiful sunset over mountains"));
match image_api::api_v1_diffusion_post(&config, Some(&api_key), Some(request)).await {
Ok(response) => {
println!("Response: {:?}", response);
}
Err(e) => {
eprintln!("Error: {:?}", e);
}
}
Ok(())
}