Skip to content

Commit

Permalink
chore: add a few missed plexpass entities
Browse files Browse the repository at this point in the history
  • Loading branch information
andrey-yantsen committed Mar 15, 2023
1 parent 1071ee4 commit 4005e0d
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 1 deletion.
29 changes: 29 additions & 0 deletions crates/plex-api/src/media_container/server/library.rs
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,7 @@ pub enum LibraryType {
Show,
Artist,
Photo,
Mixed,
#[cfg(not(feature = "tests_deny_unknown_fields"))]
#[serde(other)]
Unknown,
Expand Down Expand Up @@ -811,6 +812,30 @@ pub struct ServerHome {
pub title: String,
}

#[derive(Debug, Deserialize, Clone)]
#[cfg_attr(feature = "tests_deny_unknown_fields", serde(deny_unknown_fields))]
#[serde(rename_all = "camelCase")]
pub struct LiveTv {
#[serde(rename = "Pivot")]
pub pivots: Vec<Pivot>,
pub id: String,
pub title: String,
pub hub_key: String,
}

#[derive(Debug, Deserialize, Clone)]
#[cfg_attr(feature = "tests_deny_unknown_fields", serde(deny_unknown_fields))]
#[serde(rename_all = "camelCase")]
pub struct OnlineLibrary {
#[serde(rename = "type")]
pub library_type: LibraryType,
pub key: String,
pub title: String,
pub icon: String,
#[serde(default, with = "time::serde::timestamp::option")]
pub updated_at: Option<OffsetDateTime>,
}

#[derive(Debug, Deserialize, Clone)]
#[serde(untagged)]
pub enum ContentDirectory {
Expand All @@ -819,6 +844,10 @@ pub enum ContentDirectory {
Media(Box<ServerLibrary>),
#[serde(rename_all = "camelCase")]
Home(ServerHome),
#[serde(rename_all = "camelCase")]
LiveTv(LiveTv),
#[serde(rename_all = "camelCase")]
Online(OnlineLibrary),
#[cfg(not(feature = "tests_deny_unknown_fields"))]
Unknown(Value),
}
15 changes: 15 additions & 0 deletions crates/plex-api/src/media_container/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ pub struct Action {
pub key: String,
}

#[derive(Debug, Deserialize, Clone)]
#[serde(tag = "type", rename_all = "camelCase")]
pub struct GridChannelFilter {
pub key: String,
pub title: String,
pub genre_rating_key: String,
}

#[derive(Debug, Deserialize, Clone)]
#[serde(tag = "type", rename_all = "lowercase")]
pub enum MediaProviderFeature {
Expand Down Expand Up @@ -73,6 +81,11 @@ pub enum MediaProviderFeature {
Subscribe {
flavor: String,
},
Grid {
key: String,
#[serde(rename = "GridChannelFilter")]
grid_channel_filter: Vec<GridChannelFilter>,
},
#[cfg(not(feature = "tests_deny_unknown_fields"))]
#[serde(other)]
Unknown,
Expand All @@ -83,6 +96,8 @@ pub enum MediaProviderFeature {
pub enum MediaProviderProtocol {
Stream,
Download,
#[serde(rename = "livetv")]
LiveTv,
#[cfg(not(feature = "tests_deny_unknown_fields"))]
#[serde(other)]
Unknown,
Expand Down
1 change: 1 addition & 0 deletions crates/plex-api/src/server/library.rs
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,7 @@ impl Library {
LibraryType::Show => Library::TV(TVLibrary { client, directory }),
LibraryType::Artist => Library::Music(MusicLibrary { client, directory }),
LibraryType::Photo => Library::Photo(PhotoLibrary { client, directory }),
LibraryType::Mixed => todo!("Mixed library type is not supported yet"),
#[cfg(not(feature = "tests_deny_unknown_fields"))]
LibraryType::Unknown => panic!("Unknown library type"),
}
Expand Down
2 changes: 1 addition & 1 deletion crates/plex-api/tests/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ mod offline {
let server_result = Server::new(mock_server.base_url(), client_authenticated).await;

m.assert();
server_result.expect("can't recover myplex from server");
server_result.expect("can't load server");
}

#[plex_api_test_helper::offline_test]
Expand Down

0 comments on commit 4005e0d

Please sign in to comment.