feat(network): Support for fetching Sonarr series history for a given series ID

This commit is contained in:
2024-11-20 14:54:16 -07:00
parent 5872a6ba72
commit 86d93377ac
5 changed files with 516 additions and 14 deletions
@@ -58,7 +58,6 @@ impl Default for SonarrData {
#[derive(Clone, Copy, PartialEq, Eq, Debug, Default, EnumIter)]
pub enum ActiveSonarrBlock {
#[default]
AddRootFolderPrompt,
AddSeriesAlreadyInLibrary,
AddSeriesConfirmPrompt,
@@ -95,6 +94,8 @@ pub enum ActiveSonarrBlock {
FilterHistoryError,
FilterSeries,
FilterSeriesError,
FilterSeriesHistory,
FilterSeriesHistoryError,
History,
HistoryDetails,
HistorySortPrompt,
@@ -116,11 +117,15 @@ pub enum ActiveSonarrBlock {
SearchSeasonError,
SearchSeries,
SearchSeriesError,
SearchSeriesHistory,
SearchSeriesHistoryError,
SeasonDetails,
SeasonHistory,
#[default]
Series,
SeriesDetails,
SeriesHistory,
SeriesHistorySortPrompt,
SeriesSortPrompt,
System,
SystemLogs,
+2
View File
@@ -349,6 +349,7 @@ pub enum SonarrSerdeable {
SecurityConfig(SecurityConfig),
SeriesVec(Vec<Series>),
Series(Series),
SonarrHistoryItems(Vec<SonarrHistoryItem>),
SonarrHistoryWrapper(SonarrHistoryWrapper),
SystemStatus(SystemStatus),
BlocklistResponse(BlocklistResponse),
@@ -382,6 +383,7 @@ serde_enum_from!(
SecurityConfig(SecurityConfig),
SeriesVec(Vec<Series>),
Series(Series),
SonarrHistoryItems(Vec<SonarrHistoryItem>),
SonarrHistoryWrapper(SonarrHistoryWrapper),
SystemStatus(SystemStatus),
BlocklistResponse(BlocklistResponse),
+9 -11
View File
@@ -9,8 +9,8 @@ mod tests {
},
sonarr_models::{
BlocklistItem, BlocklistResponse, DownloadRecord, DownloadsResponse, Episode,
IndexerSettings, Series, SeriesStatus, SeriesType, SonarrHistoryItem, SonarrHistoryWrapper,
SonarrSerdeable, SystemStatus,
IndexerSettings, Series, SeriesStatus, SeriesType, SonarrHistoryItem, SonarrSerdeable,
SystemStatus,
},
Serdeable,
};
@@ -169,18 +169,16 @@ mod tests {
}
#[test]
fn test_sonarr_serdeable_from_sonarr_history_wrapper() {
let history_wrapper = SonarrHistoryWrapper {
records: vec![SonarrHistoryItem {
id: 1,
..SonarrHistoryItem::default()
}],
};
let sonarr_serdeable: SonarrSerdeable = history_wrapper.clone().into();
fn test_sonarr_serdeable_from_sonarr_history_items() {
let history_items = vec![SonarrHistoryItem {
id: 1,
..SonarrHistoryItem::default()
}];
let sonarr_serdeable: SonarrSerdeable = history_items.clone().into();
assert_eq!(
sonarr_serdeable,
SonarrSerdeable::SonarrHistoryWrapper(history_wrapper)
SonarrSerdeable::SonarrHistoryItems(history_items)
);
}