spoolframe_protocol/plex.rs
1//! The session user's Plex account link (P3-12), as clients may read it.
2//! Linking and unlinking are the web UI's (`<web_url>/profile`): a client
3//! only shows the state, and never sees the account's token.
4
5use serde::{Deserialize, Serialize};
6
7/// A linked Plex account: the user's watch state syncs with it.
8#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
9pub struct PlexLink {
10 /// The Plex account's username and email, as plex.tv said when it was
11 /// linked; both `None` for a link the server's config file makes.
12 pub username: Option<String>,
13 pub email: Option<String>,
14 /// Linked by the server's config file, as the Plex servers' owner:
15 /// only that file can unlink it, not the web UI.
16 pub by_config: bool,
17 /// When it was linked, Unix seconds; `None` for the config's.
18 pub linked_at: Option<i64>,
19 /// The user's last sync run since the server started, if any.
20 pub last_sync: Option<PlexSyncSummary>,
21 /// A sync run of theirs is going on now.
22 pub syncing: bool,
23}
24
25/// What one sync run did.
26#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
27pub struct PlexSyncSummary {
28 /// When it ended, Unix seconds.
29 pub at: i64,
30 /// The libraries synced.
31 pub libraries: u32,
32 /// Items whose state was taken from Plex, sent to Plex, left as they
33 /// were, and that failed.
34 pub pulled: u32,
35 pub pushed: u32,
36 pub skipped: u32,
37 pub failed: u32,
38}