feat(cli): Support for fetching episode history events from Sonarr

This commit is contained in:
2024-11-20 20:03:53 -07:00
parent fa4ec709c0
commit 71870d9396
2 changed files with 75 additions and 0 deletions
+16
View File
@@ -31,6 +31,15 @@ pub enum SonarrListCommand {
)]
series_id: i64,
},
#[command(about = "Fetch all history events for the episode with the given ID")]
EpisodeHistory {
#[arg(
long,
help = "The Sonarr ID of the episode whose history you wish to fetch",
required = true
)]
episode_id: i64,
},
#[command(about = "Fetch all Sonarr history events")]
History {
#[arg(long, help = "How many history events to fetch", default_value_t = 500)]
@@ -113,6 +122,13 @@ impl<'a, 'b> CliCommandHandler<'a, 'b, SonarrListCommand> for SonarrListCommandH
.await?;
serde_json::to_string_pretty(&resp)?
}
SonarrListCommand::EpisodeHistory { episode_id } => {
let resp = self
.network
.handle_network_event((SonarrEvent::GetEpisodeHistory(Some(episode_id))).into())
.await?;
serde_json::to_string_pretty(&resp)?
}
SonarrListCommand::History { events: items } => {
let resp = self
.network