feat(network): Added network support for fetching host and security configs from Sonarr
This commit is contained in:
+1
-114
@@ -9,6 +9,7 @@ use strum_macros::EnumIter;
|
||||
|
||||
use crate::{models::HorizontallyScrollableText, serde_enum_from};
|
||||
|
||||
use super::servarr_models::{HostConfig, Indexer, SecurityConfig};
|
||||
use super::Serdeable;
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -57,44 +58,6 @@ pub struct AddRootFolderBody {
|
||||
pub path: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Default, PartialEq, Eq, Clone, Copy, Debug, ValueEnum)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub enum AuthenticationMethod {
|
||||
#[default]
|
||||
Basic,
|
||||
Forms,
|
||||
None,
|
||||
}
|
||||
|
||||
impl Display for AuthenticationMethod {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
let authentication_method = match self {
|
||||
AuthenticationMethod::Basic => "basic",
|
||||
AuthenticationMethod::Forms => "forms",
|
||||
AuthenticationMethod::None => "none",
|
||||
};
|
||||
write!(f, "{authentication_method}")
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Default, PartialEq, Eq, Clone, Copy, Debug, ValueEnum)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub enum AuthenticationRequired {
|
||||
Enabled,
|
||||
#[default]
|
||||
DisabledForLocalAddresses,
|
||||
}
|
||||
|
||||
impl Display for AuthenticationRequired {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
let authentication_required = match self {
|
||||
AuthenticationRequired::Enabled => "enabled",
|
||||
AuthenticationRequired::DisabledForLocalAddresses => "disabledForLocalAddresses",
|
||||
};
|
||||
write!(f, "{authentication_required}")
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default, Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
|
||||
pub struct BlocklistResponse {
|
||||
pub records: Vec<BlocklistItem>,
|
||||
@@ -123,26 +86,6 @@ pub struct BlocklistItemMovie {
|
||||
pub title: HorizontallyScrollableText,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Default, PartialEq, Eq, Clone, Copy, Debug, ValueEnum)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub enum CertificateValidation {
|
||||
#[default]
|
||||
Enabled,
|
||||
DisabledForLocalAddresses,
|
||||
Disabled,
|
||||
}
|
||||
|
||||
impl Display for CertificateValidation {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
let certificate_validation = match self {
|
||||
CertificateValidation::Enabled => "enabled",
|
||||
CertificateValidation::DisabledForLocalAddresses => "disabledForLocalAddresses",
|
||||
CertificateValidation::Disabled => "disabled",
|
||||
};
|
||||
write!(f, "{certificate_validation}")
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Derivative, Default, Clone, Debug, PartialEq, Eq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Collection {
|
||||
@@ -281,51 +224,6 @@ pub struct EditMovieParams {
|
||||
pub clear_tags: bool,
|
||||
}
|
||||
|
||||
#[derive(Default, Deserialize, Serialize, Debug, Clone, Eq, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct HostConfig {
|
||||
pub bind_address: HorizontallyScrollableText,
|
||||
#[serde(deserialize_with = "super::from_i64")]
|
||||
pub port: i64,
|
||||
pub url_base: Option<HorizontallyScrollableText>,
|
||||
pub instance_name: Option<HorizontallyScrollableText>,
|
||||
pub application_url: Option<HorizontallyScrollableText>,
|
||||
pub enable_ssl: bool,
|
||||
#[serde(deserialize_with = "super::from_i64")]
|
||||
pub ssl_port: i64,
|
||||
pub ssl_cert_path: Option<String>,
|
||||
pub ssl_cert_password: Option<String>,
|
||||
}
|
||||
|
||||
#[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(Default, Deserialize, Serialize, Debug, Clone, Eq, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct IndexerSettings {
|
||||
@@ -634,17 +532,6 @@ pub struct RootFolder {
|
||||
pub unmapped_folders: Option<Vec<UnmappedFolder>>,
|
||||
}
|
||||
|
||||
#[derive(Default, Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct SecurityConfig {
|
||||
pub authentication_method: AuthenticationMethod,
|
||||
pub authentication_required: AuthenticationRequired,
|
||||
pub username: String,
|
||||
pub password: Option<String>,
|
||||
pub api_key: String,
|
||||
pub certificate_validation: CertificateValidation,
|
||||
}
|
||||
|
||||
#[derive(Default, Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct SystemStatus {
|
||||
|
||||
Reference in New Issue
Block a user