use serde::{Deserialize, Serialize}; pub enum GetItemsQueryString { Folder, Album, Songs, } impl GetItemsQueryString { pub fn build(&self, parent_id: impl Into + std::fmt::Display) -> String { let common = format!("parentId={parent_id}&enable_images=false"); match self { Self::Folder => format!("{common}&SortBy=SortName&fields=Path,RecursiveItemCount"), Self::Album => format!("{common}&SortBy=SortName&fields=Path,RecursiveItemCount"), Self::Songs => format!( "{common}&SortBy=ParentIndexNumber,IndexNumber,SortName&fields=ItemCounts,MediaSourceCount,Path" ), } } } #[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct GetItemsResponseModel { pub items: Vec, pub total_record_count: u64, pub start_index: u64, } #[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct ItemModel { pub name: String, pub id: String, pub path: String, pub production_year: Option, pub is_folder: bool, #[serde(rename = "Type")] pub type_field: String, pub artists: Option>, pub artist_items: Option>, pub album_artist: Option, pub album_artists: Option>, pub media_type: String, #[serde(default)] pub recursive_item_count: u64, } #[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct ArtistItemModel { pub name: String, pub id: String, } #[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct AlbumArtistModel { pub name: String, pub id: String, }