plex_api/media_container/
users.rs

1use super::MediaContainer;
2use serde::Deserialize;
3use serde_repr::{Deserialize_repr, Serialize_repr};
4use time::OffsetDateTime;
5
6#[derive(Debug, Deserialize, Clone)]
7#[cfg_attr(feature = "tests_deny_unknown_fields", serde(deny_unknown_fields))]
8#[serde(rename_all = "camelCase")]
9pub struct UsersMediaContainer {
10    pub machine_identifier: String,
11    #[serde(rename = "User", default)]
12    pub users: Vec<User>,
13    #[serde(flatten)]
14    pub media_container: MediaContainer,
15}
16
17#[derive(Debug, Deserialize_repr, Clone, Copy, Serialize_repr)]
18#[repr(u8)]
19pub enum AllowTuners {
20    None = 0,
21    AllowLiveTv = 1,
22    AllowLiveTvAndDvr = 2,
23    #[serde(other)]
24    Unknown,
25}
26
27#[derive(Debug, Deserialize, Clone)]
28#[cfg_attr(feature = "tests_deny_unknown_fields", serde(deny_unknown_fields))]
29#[serde(rename_all = "camelCase")]
30pub struct User {
31    pub id: u32,
32    pub title: String,
33    pub thumb: String,
34    pub protected: bool,
35    pub home: bool,
36    pub allow_sync: bool,
37    pub allow_camera_upload: bool,
38    pub allow_channels: bool,
39    pub allow_tuners: AllowTuners,
40    pub allow_subtitle_admin: bool,
41    pub restricted: bool,
42    pub filter_all: String,
43    pub filter_movies: String,
44    pub filter_music: String,
45    pub filter_photos: String,
46    pub filter_television: String,
47    #[serde(rename = "Server")]
48    pub servers: Option<Vec<UserServer>>,
49}
50
51#[derive(Debug, Deserialize, Clone)]
52#[cfg_attr(feature = "tests_deny_unknown_fields", serde(deny_unknown_fields))]
53#[serde(rename_all = "camelCase")]
54pub struct UserServer {
55    pub id: u32,
56    pub server_id: u32,
57    pub machine_identifier: String,
58    pub name: String,
59    #[serde(with = "time::serde::timestamp")]
60    pub last_seen_at: OffsetDateTime,
61    pub num_libraries: u32,
62    pub all_libraries: bool,
63    pub owned: bool,
64    pub pending: bool,
65}