# Navidrome Host Function Wrappers for RustThis directory contains auto-generated Rust wrappers for Navidrome's host services.These wrappers provide idiomatic Rust APIs for interacting with Navidrome from WASM plugins.## ⚠️ Auto-Generated Code**Do not edit these files manually.** They are generated by the `ndpgen` tool.To regenerate:```bashmake gen```## UsageAdd this crate as a dependency in your plugin's `Cargo.toml`:```toml[dependencies]nd-host = { path = "../../pdk/rust/host" }```Then import the services you need:```rustuse nd_host::{cache, scheduler, library};use nd_host::library::Library; // Import the typed struct#[plugin_fn]pub fn my_callback(input: String) -> FnResult<String> {// Use the cache servicecache::set("my_key", b"my_value", 3600)?;// Schedule a recurring taskscheduler::schedule_recurring("@every 5m", "payload", "task_id")?;// Access library data with typed structslet libraries: Vec<Library> = library::get_all_libraries()?;for lib in &libraries {info!("Library: {} with {} songs", lib.name, lib.total_songs);}Ok("done".to_string())}```## Typed StructsServices that work with domain objects provide typed Rust structs instead of`serde_json::Value`. This enables compile-time type checking and IDEautocompletion.For example, the `library` module provides a `Library` struct:```rustuse nd_host::library::Library;let libs: Vec<Library> = library::get_all_libraries()?;println!("First library: {} ({} songs)", libs[0].name, libs[0].total_songs);```All structs derive `Debug`, `Clone`, `Serialize`, and `Deserialize` forconvenient use with logging and serialization.## Available Services| Module | Description ||---------------|----------------------------------------------------|| `artwork` | Access album and artist artwork || `cache` | Temporary key-value storage with TTL || `kvstore` | Persistent key-value storage || `library` | Access the music library (albums, artists, tracks) || `scheduler` | Schedule one-time and recurring tasks || `subsonicapi` | Make Subsonic API calls || `websocket` | Send real-time messages to clients |## Building PluginsRust plugins must be compiled to WebAssembly:```bashcargo build --target wasm32-wasip1 --release```See the [webhook-rs](../../examples/webhook-rs/) example for a complete plugin implementation.