feat(cli): Support for listing all Sonarr tags
This commit is contained in:
@@ -74,28 +74,28 @@ impl<'a, 'b> CliCommandHandler<'a, 'b, SonarrDeleteCommand> for SonarrDeleteComm
|
||||
SonarrDeleteCommand::BlocklistItem { blocklist_item_id } => {
|
||||
let resp = self
|
||||
.network
|
||||
.handle_network_event((SonarrEvent::DeleteBlocklistItem(Some(blocklist_item_id))).into())
|
||||
.handle_network_event(SonarrEvent::DeleteBlocklistItem(Some(blocklist_item_id)).into())
|
||||
.await?;
|
||||
serde_json::to_string_pretty(&resp)?
|
||||
}
|
||||
SonarrDeleteCommand::Download { download_id } => {
|
||||
let resp = self
|
||||
.network
|
||||
.handle_network_event((SonarrEvent::DeleteDownload(Some(download_id))).into())
|
||||
.handle_network_event(SonarrEvent::DeleteDownload(Some(download_id)).into())
|
||||
.await?;
|
||||
serde_json::to_string_pretty(&resp)?
|
||||
}
|
||||
SonarrDeleteCommand::Indexer { indexer_id } => {
|
||||
let resp = self
|
||||
.network
|
||||
.handle_network_event((SonarrEvent::DeleteIndexer(Some(indexer_id))).into())
|
||||
.handle_network_event(SonarrEvent::DeleteIndexer(Some(indexer_id)).into())
|
||||
.await?;
|
||||
serde_json::to_string_pretty(&resp)?
|
||||
}
|
||||
SonarrDeleteCommand::RootFolder { root_folder_id } => {
|
||||
let resp = self
|
||||
.network
|
||||
.handle_network_event((SonarrEvent::DeleteRootFolder(Some(root_folder_id))).into())
|
||||
.handle_network_event(SonarrEvent::DeleteRootFolder(Some(root_folder_id)).into())
|
||||
.await?;
|
||||
serde_json::to_string_pretty(&resp)?
|
||||
}
|
||||
|
||||
@@ -76,42 +76,42 @@ impl<'a, 'b> CliCommandHandler<'a, 'b, SonarrGetCommand> for SonarrGetCommandHan
|
||||
SonarrGetCommand::AllIndexerSettings => {
|
||||
let resp = self
|
||||
.network
|
||||
.handle_network_event((SonarrEvent::GetAllIndexerSettings).into())
|
||||
.handle_network_event(SonarrEvent::GetAllIndexerSettings.into())
|
||||
.await?;
|
||||
serde_json::to_string_pretty(&resp)?
|
||||
}
|
||||
SonarrGetCommand::EpisodeDetails { episode_id } => {
|
||||
let resp = self
|
||||
.network
|
||||
.handle_network_event((SonarrEvent::GetEpisodeDetails(Some(episode_id))).into())
|
||||
.handle_network_event(SonarrEvent::GetEpisodeDetails(Some(episode_id)).into())
|
||||
.await?;
|
||||
serde_json::to_string_pretty(&resp)?
|
||||
}
|
||||
SonarrGetCommand::HostConfig => {
|
||||
let resp = self
|
||||
.network
|
||||
.handle_network_event((SonarrEvent::GetHostConfig).into())
|
||||
.handle_network_event(SonarrEvent::GetHostConfig.into())
|
||||
.await?;
|
||||
serde_json::to_string_pretty(&resp)?
|
||||
}
|
||||
SonarrGetCommand::SecurityConfig => {
|
||||
let resp = self
|
||||
.network
|
||||
.handle_network_event((SonarrEvent::GetSecurityConfig).into())
|
||||
.handle_network_event(SonarrEvent::GetSecurityConfig.into())
|
||||
.await?;
|
||||
serde_json::to_string_pretty(&resp)?
|
||||
}
|
||||
SonarrGetCommand::SeriesDetails { series_id } => {
|
||||
let resp = self
|
||||
.network
|
||||
.handle_network_event((SonarrEvent::GetSeriesDetails(Some(series_id))).into())
|
||||
.handle_network_event(SonarrEvent::GetSeriesDetails(Some(series_id)).into())
|
||||
.await?;
|
||||
serde_json::to_string_pretty(&resp)?
|
||||
}
|
||||
SonarrGetCommand::SystemStatus => {
|
||||
let resp = self
|
||||
.network
|
||||
.handle_network_event((SonarrEvent::GetStatus).into())
|
||||
.handle_network_event(SonarrEvent::GetStatus.into())
|
||||
.await?;
|
||||
serde_json::to_string_pretty(&resp)?
|
||||
}
|
||||
|
||||
@@ -61,9 +61,9 @@ pub enum SonarrListCommand {
|
||||
QualityProfiles,
|
||||
#[command(about = "List all queued events")]
|
||||
QueuedEvents,
|
||||
#[command(about = "List all series in your Sonarr library")]
|
||||
#[command(about = "List all root folders in Sonarr")]
|
||||
RootFolders,
|
||||
#[command(about = "List all series in your Sonarr library")]
|
||||
Series,
|
||||
#[command(about = "Fetch all history events for the series with the given ID")]
|
||||
SeriesHistory {
|
||||
@@ -74,6 +74,8 @@ pub enum SonarrListCommand {
|
||||
)]
|
||||
series_id: i64,
|
||||
},
|
||||
#[command(about = "List all Sonarr tags")]
|
||||
Tags,
|
||||
}
|
||||
|
||||
impl From<SonarrListCommand> for Command {
|
||||
@@ -106,42 +108,42 @@ impl<'a, 'b> CliCommandHandler<'a, 'b, SonarrListCommand> for SonarrListCommandH
|
||||
SonarrListCommand::Blocklist => {
|
||||
let resp = self
|
||||
.network
|
||||
.handle_network_event((SonarrEvent::GetBlocklist).into())
|
||||
.handle_network_event(SonarrEvent::GetBlocklist.into())
|
||||
.await?;
|
||||
serde_json::to_string_pretty(&resp)?
|
||||
}
|
||||
SonarrListCommand::Downloads => {
|
||||
let resp = self
|
||||
.network
|
||||
.handle_network_event((SonarrEvent::GetDownloads).into())
|
||||
.handle_network_event(SonarrEvent::GetDownloads.into())
|
||||
.await?;
|
||||
serde_json::to_string_pretty(&resp)?
|
||||
}
|
||||
SonarrListCommand::Episodes { series_id } => {
|
||||
let resp = self
|
||||
.network
|
||||
.handle_network_event((SonarrEvent::GetEpisodes(Some(series_id))).into())
|
||||
.handle_network_event(SonarrEvent::GetEpisodes(Some(series_id)).into())
|
||||
.await?;
|
||||
serde_json::to_string_pretty(&resp)?
|
||||
}
|
||||
SonarrListCommand::EpisodeHistory { episode_id } => {
|
||||
let resp = self
|
||||
.network
|
||||
.handle_network_event((SonarrEvent::GetEpisodeHistory(Some(episode_id))).into())
|
||||
.handle_network_event(SonarrEvent::GetEpisodeHistory(Some(episode_id)).into())
|
||||
.await?;
|
||||
serde_json::to_string_pretty(&resp)?
|
||||
}
|
||||
SonarrListCommand::History { events: items } => {
|
||||
let resp = self
|
||||
.network
|
||||
.handle_network_event((SonarrEvent::GetHistory(Some(items))).into())
|
||||
.handle_network_event(SonarrEvent::GetHistory(Some(items)).into())
|
||||
.await?;
|
||||
serde_json::to_string_pretty(&resp)?
|
||||
}
|
||||
SonarrListCommand::Indexers => {
|
||||
let resp = self
|
||||
.network
|
||||
.handle_network_event((SonarrEvent::GetIndexers).into())
|
||||
.handle_network_event(SonarrEvent::GetIndexers.into())
|
||||
.await?;
|
||||
serde_json::to_string_pretty(&resp)?
|
||||
}
|
||||
@@ -165,35 +167,42 @@ impl<'a, 'b> CliCommandHandler<'a, 'b, SonarrListCommand> for SonarrListCommandH
|
||||
SonarrListCommand::QualityProfiles => {
|
||||
let resp = self
|
||||
.network
|
||||
.handle_network_event((SonarrEvent::GetQualityProfiles).into())
|
||||
.handle_network_event(SonarrEvent::GetQualityProfiles.into())
|
||||
.await?;
|
||||
serde_json::to_string_pretty(&resp)?
|
||||
}
|
||||
SonarrListCommand::QueuedEvents => {
|
||||
let resp = self
|
||||
.network
|
||||
.handle_network_event((SonarrEvent::GetQueuedEvents).into())
|
||||
.handle_network_event(SonarrEvent::GetQueuedEvents.into())
|
||||
.await?;
|
||||
serde_json::to_string_pretty(&resp)?
|
||||
}
|
||||
SonarrListCommand::RootFolders => {
|
||||
let resp = self
|
||||
.network
|
||||
.handle_network_event((SonarrEvent::GetRootFolders).into())
|
||||
.handle_network_event(SonarrEvent::GetRootFolders.into())
|
||||
.await?;
|
||||
serde_json::to_string_pretty(&resp)?
|
||||
}
|
||||
SonarrListCommand::Series => {
|
||||
let resp = self
|
||||
.network
|
||||
.handle_network_event((SonarrEvent::ListSeries).into())
|
||||
.handle_network_event(SonarrEvent::ListSeries.into())
|
||||
.await?;
|
||||
serde_json::to_string_pretty(&resp)?
|
||||
}
|
||||
SonarrListCommand::SeriesHistory { series_id } => {
|
||||
let resp = self
|
||||
.network
|
||||
.handle_network_event((SonarrEvent::GetSeriesHistory(Some(series_id))).into())
|
||||
.handle_network_event(SonarrEvent::GetSeriesHistory(Some(series_id)).into())
|
||||
.await?;
|
||||
serde_json::to_string_pretty(&resp)?
|
||||
}
|
||||
SonarrListCommand::Tags => {
|
||||
let resp = self
|
||||
.network
|
||||
.handle_network_event(SonarrEvent::GetTags.into())
|
||||
.await?;
|
||||
serde_json::to_string_pretty(&resp)?
|
||||
}
|
||||
|
||||
@@ -31,7 +31,8 @@ mod tests {
|
||||
"quality-profiles",
|
||||
"indexers",
|
||||
"queued-events",
|
||||
"root-folders"
|
||||
"root-folders",
|
||||
"tags"
|
||||
)]
|
||||
subcommand: &str,
|
||||
) {
|
||||
@@ -202,6 +203,7 @@ mod tests {
|
||||
#[case(SonarrListCommand::QueuedEvents, SonarrEvent::GetQueuedEvents)]
|
||||
#[case(SonarrListCommand::RootFolders, SonarrEvent::GetRootFolders)]
|
||||
#[case(SonarrListCommand::Series, SonarrEvent::ListSeries)]
|
||||
#[case(SonarrListCommand::Tags, SonarrEvent::GetTags)]
|
||||
#[tokio::test]
|
||||
async fn test_handle_list_command(
|
||||
#[case] list_command: SonarrListCommand,
|
||||
|
||||
Reference in New Issue
Block a user