feat(readarr): toggle book monitoring and expose the command on the CLI

The PUT body round-trips through serde_json::Value rather than the typed
Book, so the fields Readarr returns but Book does not declare survive the
toggle instead of being silently dropped. BOOK_JSON now carries a few of
those undeclared fields so a regression to a typed round-trip fails the
tests rather than passing unnoticed.
This commit is contained in:
Dark-Alex-17 committed 2026-08-27 16:12:50 -06:00
1 parent f2787560d6
commit e30d4dbd0c
7 files changed
+222 -3

No files matched your search

+16
View File
@@ -97,6 +97,15 @@ pub enum ReadarrCommand {
)]
author_id: i64,
},
#[command(about = "Toggle monitoring for the specified book corresponding to the given book ID")]
ToggleBookMonitoring {
#[arg(
long,
help = "The Readarr ID of the book to toggle monitoring on",
required = true
)]
book_id: i64,
},
}
impl From<ReadarrCommand> for Command {
@@ -186,6 +195,13 @@ impl<'a, 'b> CliCommandHandler<'a, 'b, ReadarrCommand> for ReadarrCliHandler<'a,
.await?;
serde_json::to_string_pretty(&resp)?
}
ReadarrCommand::ToggleBookMonitoring { book_id } => {
let resp = self
.network
.handle_network_event(ReadarrEvent::ToggleBookMonitoring(book_id).into())
.await?;
serde_json::to_string_pretty(&resp)?
}
};
Ok(result)