Crates.io | syno-download-station |
lib.rs | syno-download-station |
version | |
source | src |
created_at | 2025-04-13 14:22:33.931561+00 |
updated_at | 2025-04-13 14:22:33.931561+00 |
description | Rust client library for the Synology Download Station API |
homepage | |
repository | https://github.com/artemy/syno-download-station |
max_upload_size | |
id | 1631844 |
Cargo.toml error: | TOML parse error at line 25, column 1 | 25 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
A Rust client library for interacting with the Synology Download Station API. Manage your downloads programmatically with a strongly-typed interface.
cargo add syno-download-station
use anyhow::Result;
use syno_download_station::client::SynoDS;
#[tokio::main]
async fn main() -> Result<()> {
// Create a new client
let mut synods = SynoDS::new(
"https://your-synology-nas.local:5001".to_string(),
"username".to_string(),
"password".to_string(),
)?;
// Authenticate
synods.authorize().await?;
// List all tasks
let tasks = synods.get_tasks().await?;
for task in tasks.task {
println!(
"Task: {}, Status: {:?}, Progress: {}%, {}",
task.title,
task.status,
task.calculate_progress(),
task.calculate_speed()
);
// Get more detailed information if needed
if let Some(additional) = &task.additional {
if let Some(detail) = &additional.detail {
println!(" Created: {}", detail.created_time);
println!(" Destination: {}", detail.destination);
}
}
}
// Create a new download task from URL
synods.create_task(
"https://example.com/large-file.zip",
"downloads"
).await?;
// Other operations
synods.pause("task-id").await?;
synods.resume("task-id").await?;
synods.complete("task-id").await?;
synods.clear_completed().await?;
Ok(())
}
An example CLI application is included in the examples directory. To run it:
SYNOLOGY_HOST="https://your-synology-nas.local:1234" \
SYNOLOGY_USERNAME="your-username" \
SYNOLOGY_PASSWORD="your-password" \
cargo run --example cli
This project is licensed under the MIT License — see the LICENSE.md file for details