feat(readarr): fetch the Readarr system status and expose it on the CLI
Add ReadarrEvent::GetStatus, mapped to GET /system/status, and get_readarr_status in the new readarr_network/system module. It stores the version and start time on ReadarrData so the system view and the tick refresh can read them. Surface it as `managarr readarr get system-status`, matching the Radarr, Sonarr, and Lidarr spelling of the same call. A `list status` spelling would have made the same command a different verb on the fourth servarr, which is a difference the user would have to remember for no benefit. Readarr instances answer /system/status with thirty keys; SystemStatus models the two that are used and serde ignores the rest, as it does for the other three servarrs. This is the first ReadarrCommand variant, so ReadarrCliHandler now reads its app and network fields.
This commit is contained in:
7 files changed
+248
-2
No files matched your search
@@ -5,12 +5,15 @@ use super::{NetworkEvent, NetworkResource};
|
||||
use crate::models::readarr_models::ReadarrSerdeable;
|
||||
use crate::network::{Network, RequestMethod};
|
||||
|
||||
mod system;
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "readarr_network_tests.rs"]
|
||||
mod readarr_network_tests;
|
||||
|
||||
#[derive(Debug, Eq, PartialEq, Clone)]
|
||||
pub enum ReadarrEvent {
|
||||
GetStatus,
|
||||
HealthCheck,
|
||||
}
|
||||
|
||||
@@ -18,6 +21,7 @@ impl NetworkResource for ReadarrEvent {
|
||||
fn resource(&self) -> &'static str {
|
||||
match &self {
|
||||
ReadarrEvent::HealthCheck => "/health",
|
||||
ReadarrEvent::GetStatus => "/system/status",
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,6 +38,7 @@ impl Network<'_, '_> {
|
||||
readarr_event: ReadarrEvent,
|
||||
) -> Result<ReadarrSerdeable> {
|
||||
match readarr_event {
|
||||
ReadarrEvent::GetStatus => self.get_readarr_status().await.map(ReadarrSerdeable::from),
|
||||
ReadarrEvent::HealthCheck => self
|
||||
.get_readarr_healthcheck()
|
||||
.await
|
||||
|
||||
Reference in new issue
Block a user