1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
use super::MediaContainer;
use serde::Deserialize;
use serde_repr::{Deserialize_repr, Serialize_repr};
use time::OffsetDateTime;

#[derive(Debug, Deserialize, Clone)]
#[cfg_attr(feature = "tests_deny_unknown_fields", serde(deny_unknown_fields))]
#[serde(rename_all = "camelCase")]
pub struct UsersMediaContainer {
    pub machine_identifier: String,
    #[serde(rename = "User", default)]
    pub users: Vec<User>,
    #[serde(flatten)]
    pub media_container: MediaContainer,
}

#[derive(Debug, Deserialize_repr, Clone, Serialize_repr)]
#[repr(u8)]
pub enum AllowTuners {
    None = 0,
    AllowLiveTv = 1,
    AllowLiveTvAndDvr = 2,
    #[serde(other)]
    Unknown,
}

#[derive(Debug, Deserialize, Clone)]
#[cfg_attr(feature = "tests_deny_unknown_fields", serde(deny_unknown_fields))]
#[serde(rename_all = "camelCase")]
pub struct User {
    pub id: u32,
    pub title: String,
    pub thumb: String,
    pub protected: bool,
    pub home: bool,
    pub allow_sync: bool,
    pub allow_camera_upload: bool,
    pub allow_channels: bool,
    pub allow_tuners: AllowTuners,
    pub allow_subtitle_admin: bool,
    pub restricted: bool,
    pub filter_all: String,
    pub filter_movies: String,
    pub filter_music: String,
    pub filter_photos: String,
    pub filter_television: String,
    #[serde(rename = "Server")]
    pub servers: Option<Vec<UserServer>>,
}

#[derive(Debug, Deserialize, Clone)]
#[cfg_attr(feature = "tests_deny_unknown_fields", serde(deny_unknown_fields))]
#[serde(rename_all = "camelCase")]
pub struct UserServer {
    pub id: u32,
    pub server_id: u32,
    pub machine_identifier: String,
    pub name: String,
    #[serde(with = "time::serde::timestamp")]
    pub last_seen_at: OffsetDateTime,
    pub num_libraries: u32,
    pub all_libraries: bool,
    pub owned: bool,
    pub pending: bool,
}