Add integration testing infrastructure with Podman Compose
- 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
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
//! Example: Download asset thumbnails
|
||||
//!
|
||||
//! This example uses environment variables for configuration:
|
||||
//! - IMMICH_URL: The Immich server URL (defaults to http://localhost:2283)
|
||||
//! - IMMICH_API_KEY: Your API key (required)
|
||||
|
||||
use image::GenericImageView;
|
||||
use immich_sdk::Client;
|
||||
@@ -7,11 +11,21 @@ use std::fs;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Create a client
|
||||
let client = Client::from_url("https://immich.example.com")?.with_api_key("your-api-key");
|
||||
// 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");
|
||||
|
||||
// Asset ID to download thumbnail for
|
||||
let asset_id = "your-asset-id-here".parse()?;
|
||||
// Create a client
|
||||
let client = Client::from_url(&url)?.with_api_key(api_key);
|
||||
|
||||
// Get first asset from the server
|
||||
let assets = client.assets().list().execute().await?;
|
||||
if assets.is_empty() {
|
||||
println!("No assets found. Run upload_photos example first.");
|
||||
return Ok(());
|
||||
}
|
||||
let asset_id = assets[0].id;
|
||||
|
||||
// Download thumbnail (small size, default)
|
||||
println!("Downloading thumbnail...");
|
||||
|
||||
Reference in New Issue
Block a user