feat(network): Added the GetIndexers network call for Sonarr
This commit is contained in:
@@ -3,7 +3,7 @@ use chrono::{DateTime, Utc};
|
||||
use strum::EnumIter;
|
||||
|
||||
use crate::models::{
|
||||
sonarr_models::{BlocklistItem, DownloadRecord, Episode, Series},
|
||||
sonarr_models::{BlocklistItem, DownloadRecord, Episode, Indexer, Series},
|
||||
stateful_list::StatefulList,
|
||||
stateful_table::StatefulTable,
|
||||
stateful_tree::StatefulTree,
|
||||
@@ -27,6 +27,7 @@ pub struct SonarrData {
|
||||
pub downloads: StatefulTable<DownloadRecord>,
|
||||
pub episode_details_modal: Option<EpisodeDetailsModal>,
|
||||
pub quality_profile_map: BiMap<i64, String>,
|
||||
pub indexers: StatefulTable<Indexer>,
|
||||
}
|
||||
|
||||
impl Default for SonarrData {
|
||||
@@ -42,6 +43,7 @@ impl Default for SonarrData {
|
||||
downloads: StatefulTable::default(),
|
||||
episode_details_modal: None,
|
||||
quality_profile_map: BiMap::new(),
|
||||
indexers: StatefulTable::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ mod tests {
|
||||
assert!(sonarr_data.downloads.is_empty());
|
||||
assert!(sonarr_data.episode_details_modal.is_none());
|
||||
assert!(sonarr_data.quality_profile_map.is_empty());
|
||||
assert!(sonarr_data.indexers.is_empty());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,6 +103,35 @@ pub struct EpisodeFile {
|
||||
pub media_info: Option<MediaInfo>,
|
||||
}
|
||||
|
||||
#[derive(Default, Deserialize, Serialize, Debug, Clone, Eq, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Indexer {
|
||||
#[serde(deserialize_with = "super::from_i64")]
|
||||
pub id: i64,
|
||||
pub name: Option<String>,
|
||||
pub implementation: Option<String>,
|
||||
pub implementation_name: Option<String>,
|
||||
pub config_contract: Option<String>,
|
||||
pub supports_rss: bool,
|
||||
pub supports_search: bool,
|
||||
pub fields: Option<Vec<IndexerField>>,
|
||||
pub enable_rss: bool,
|
||||
pub enable_automatic_search: bool,
|
||||
pub enable_interactive_search: bool,
|
||||
pub protocol: String,
|
||||
#[serde(deserialize_with = "super::from_i64")]
|
||||
pub priority: i64,
|
||||
#[serde(deserialize_with = "super::from_i64")]
|
||||
pub download_client_id: i64,
|
||||
pub tags: Vec<Number>,
|
||||
}
|
||||
|
||||
#[derive(Default, Deserialize, Serialize, Debug, Clone, Eq, PartialEq)]
|
||||
pub struct IndexerField {
|
||||
pub name: Option<String>,
|
||||
pub value: Option<Value>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Default, Debug, Hash, Clone, PartialEq, Eq, Ord, PartialOrd)]
|
||||
pub struct Language {
|
||||
pub name: String,
|
||||
@@ -330,6 +359,7 @@ pub enum SonarrSerdeable {
|
||||
DownloadsResponse(DownloadsResponse),
|
||||
Episode(Episode),
|
||||
Episodes(Vec<Episode>),
|
||||
Indexers(Vec<Indexer>),
|
||||
QualityProfiles(Vec<QualityProfile>),
|
||||
SeriesVec(Vec<Series>),
|
||||
SystemStatus(SystemStatus),
|
||||
@@ -355,6 +385,7 @@ serde_enum_from!(
|
||||
DownloadsResponse(DownloadsResponse),
|
||||
Episode(Episode),
|
||||
Episodes(Vec<Episode>),
|
||||
Indexers(Vec<Indexer>),
|
||||
QualityProfiles(Vec<QualityProfile>),
|
||||
SeriesVec(Vec<Series>),
|
||||
SystemStatus(SystemStatus),
|
||||
|
||||
Reference in New Issue
Block a user