//! Example: Server information //! //! This example demonstrates how to check server health and capabilities use immich_sdk::Client; #[tokio::main] async fn main() -> Result<(), Box> { // Configure the client from environment variables let url = std::env::var("IMMICH_URL").unwrap_or_else(|_| "http://localhost:2283".to_string()); let api_key = std::env::var("IMMICH_API_KEY").expect("IMMICH_API_KEY environment variable not set"); let client = Client::from_url(&url)?.with_api_key(api_key); // Health check (ping) println!("Checking server health..."); match client.server().ping().await { Ok(response) => println!("Server is healthy! Response: {}", response), Err(e) => println!("Health check failed: {}", e), } // Get version println!("\nServer Version:"); let version = client.server().version().await?; println!(" Version: {}", version); // Get features println!("\nServer Features:"); let features = client.server().features().await?; println!(" OAuth enabled: {}", features.oauth); println!(" OAuth auto launch: {}", features.oauth_auto_launch); println!(" Password login: {}", features.password_login); println!(" Config file: {}", features.config_file); // Get about info println!("\nServer About:"); let about = client.server().about().await?; println!(" Version: {}", about.version); println!(" Version URL: {}", about.version_url); println!(" Licensed: {}", about.licensed); if let Some(ref build) = about.build { println!(" Build: {}", build); } if let Some(ref repository) = about.repository { println!(" Repository: {}", repository); } Ok(()) }