Add a new download client integration (e.g., Deluge, Aria2)
You are adding a new download client integration for $ARGUMENTS to pir9.
Read these first to understand existing patterns:
src/core/download/clients.rs — trait definition and existing implementationssrc/core/download/ — directory listing for all client modulessrc/api/v5/download_client.rs — API endpoints for client managementCreate a new module in src/core/download/ for the client:
#[async_trait::async_trait]
pub trait DownloadClient: Send + Sync {
fn name(&self) -> &str;
fn protocol(&self) -> DownloadProtocol; // Usenet or Torrent
async fn test(&self) -> Result<()>;
async fn add_from_url(&self, url: &str, category: &str) -> Result<String>;
async fn add_from_file(&self, data: &[u8], filename: &str, category: &str) -> Result<String>;
async fn get_downloads(&self) -> Result<Vec<DownloadStatus>>;
async fn remove(&self, id: &str) -> Result<()>;
}
In clients.rs, add the new variant:
pub enum DownloadClientType {
// ... existing variants ...
$ARGUMENTS,
}
Wire up the new client in the factory/builder function that maps DownloadClientType to concrete implementations.
Ensure the download client settings endpoint can configure the new client's connection details (host, port, API key, etc.).
reqwest for HTTP client calls (already a dependency)anyhow for error handlingDownloadState variants