feat(readarr): fetch Readarr author history and expose it on the CLI
Add the GetAuthorHistory event, backed by GET /history/author?authorId=N, which returns a flat array of history records for a single author. The fetcher mirrors the artist-history equivalent, sorting by id and carrying the sort-prompt route guard so a refresh landing while the sort prompt is open cannot clobber an in-progress sort selection. Expose it as `readarr list author-history --author-id N`.
This commit is contained in:
7 files changed
+402
-6
No files matched your search
@@ -17,6 +17,15 @@ mod list_command_handler_tests;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Subcommand)]
|
||||
pub enum ReadarrListCommand {
|
||||
#[command(about = "Fetch all history events for the author with the given ID")]
|
||||
AuthorHistory {
|
||||
#[arg(
|
||||
long,
|
||||
help = "The Readarr ID of the author whose history you wish to fetch",
|
||||
required = true
|
||||
)]
|
||||
author_id: i64,
|
||||
},
|
||||
#[command(about = "List all authors in your Readarr library")]
|
||||
Authors,
|
||||
#[command(about = "List disk space details for all provisioned root folders in Readarr")]
|
||||
@@ -74,6 +83,13 @@ impl<'a, 'b> CliCommandHandler<'a, 'b, ReadarrListCommand> for ReadarrListComman
|
||||
|
||||
async fn handle(self) -> Result<String> {
|
||||
let result = match self.command {
|
||||
ReadarrListCommand::AuthorHistory { author_id } => {
|
||||
let resp = self
|
||||
.network
|
||||
.handle_network_event(ReadarrEvent::GetAuthorHistory(author_id).into())
|
||||
.await?;
|
||||
serde_json::to_string_pretty(&resp)?
|
||||
}
|
||||
ReadarrListCommand::Authors => {
|
||||
let resp = self
|
||||
.network
|
||||
|
||||
Reference in new issue
Block a user