plex_api/media_container/preferences/
mod.rs1mod deserializer;
2
3use std::fmt::Display;
4
5use super::MediaContainer;
6use serde::Deserialize;
7
8#[derive(Debug, Deserialize, Clone)]
9#[cfg_attr(
10 all(test, feature = "tests_deny_unknown_fields"),
11 serde(deny_unknown_fields)
12)]
13pub struct Preferences {
14 #[serde(rename = "Setting", default)]
15 pub settings: Vec<Setting>,
16 #[serde(flatten)]
17 pub media_container: MediaContainer,
18}
19
20#[derive(Debug, Clone)]
21pub struct Setting {
22 pub id: String,
23 pub label: String,
24 pub summary: String,
25 pub hidden: bool,
26 pub advanced: bool,
27 pub group: String,
28 pub value: Value,
29 pub default: Value,
30 pub suggested_values: Option<Vec<SettingEnumValue>>,
31}
32
33#[derive(Debug, Clone)]
34pub enum Value {
35 Int(i64),
36 Text(String),
37 Bool(bool),
38 Double(f64),
39}
40
41impl Display for Value {
42 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
43 match self {
44 Value::Text(s) => write!(f, "{}", s),
45 Value::Int(i) => write!(f, "{}", i),
46 Value::Bool(b) => write!(f, "{}", if *b { "1" } else { "0" }),
47 Value::Double(d) => write!(f, "{}", d),
48 }
49 }
50}
51
52#[derive(Debug, Clone)]
53pub struct SettingEnumValue {
54 pub value: String,
55 pub hint: String,
56}