feat(readarr): trigger Readarr tasks and expose the command on the CLI

The task name is sent as the shared CommandBody, matching the Radarr, Sonarr, and Lidarr implementations. The response is returned verbatim and no app state is mutated.
This commit is contained in:
Dark-Alex-17 committed 2026-08-20 21:49:28 -06:00
1 parent bd0274411c
commit ab3992c372
6 files changed
+182 -3

No files matched your search

+7 -1
View File
@@ -2,7 +2,7 @@ use anyhow::Result;
use log::info;
use super::{NetworkEvent, NetworkResource};
use crate::models::readarr_models::ReadarrSerdeable;
use crate::models::readarr_models::{ReadarrSerdeable, ReadarrTaskName};
use crate::network::{Network, RequestMethod};
mod system;
@@ -21,11 +21,13 @@ pub enum ReadarrEvent {
GetTasks,
GetUpdates,
HealthCheck,
StartTask(ReadarrTaskName),
}
impl NetworkResource for ReadarrEvent {
fn resource(&self) -> &'static str {
match &self {
ReadarrEvent::StartTask(_) => "/command",
ReadarrEvent::GetHostConfig | ReadarrEvent::GetSecurityConfig => "/config/host",
ReadarrEvent::GetDiskSpace => "/diskspace",
ReadarrEvent::HealthCheck => "/health",
@@ -72,6 +74,10 @@ impl Network<'_, '_> {
.get_readarr_healthcheck()
.await
.map(ReadarrSerdeable::from),
ReadarrEvent::StartTask(task_name) => self
.start_readarr_task(task_name)
.await
.map(ReadarrSerdeable::from),
}
}