- Add docker/podman-compose.yml for Immich server (no ML) - Add test-data/sample-photos/ with 3 public domain images - Add scripts/start-immich.sh for container startup + admin/API key creation - Add scripts/seed-data.sh for uploading test photos and creating albums - Add scripts/stop-immich.sh for cleanup with volume destruction - Add scripts/run-example.sh wrapper (fixed env var export) - Update examples to use IMMICH_URL and IMMICH_API_KEY env vars - Add .github/workflows/integration-test.yml for CI - Update assets.list() to use /search/metadata endpoint - Update AGENTS.md with example running instructions - Add 5 new examples: search_metadata, album_management, timeline_browsing, delete_assets, server_info
44 lines
1.5 KiB
Rust
44 lines
1.5 KiB
Rust
//! Example: Server information
|
|
//!
|
|
//! This example demonstrates how to check server health and capabilities
|
|
|
|
use immich_sdk::Client;
|
|
|
|
#[tokio::main]
|
|
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
// 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);
|
|
|
|
Ok(())
|
|
}
|