//! All objects related to album defined by Spotify API use chrono::prelude::*; use serde::{Deserialize, Serialize}; use std::collections::HashMap; use crate::{ AlbumId, AlbumType, Copyright, DatePrecision, Image, Page, RestrictionReason, SimplifiedArtist, SimplifiedTrack, }; /// Simplified Album Object #[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, Default)] pub struct SimplifiedAlbum { #[serde(skip_serializing_if = "Option::is_none")] pub album_group: Option, pub album_type: Option, pub artists: Vec, #[serde(skip_serializing_if = "Vec::is_empty", default)] pub available_markets: Vec, pub external_urls: HashMap, pub href: Option, pub id: Option>, pub images: Vec, pub name: String, #[serde(skip_serializing_if = "Option::is_none")] pub release_date: Option, #[serde(skip_serializing_if = "Option::is_none")] pub release_date_precision: Option, #[serde(skip_serializing_if = "Option::is_none")] pub restrictions: Option, } /// Full Album Object #[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] pub struct FullAlbum { pub artists: Vec, pub album_type: AlbumType, pub available_markets: Option>, pub copyrights: Vec, pub external_ids: HashMap, pub external_urls: HashMap, pub genres: Vec, pub href: String, pub id: AlbumId<'static>, pub images: Vec, pub name: String, pub popularity: u32, pub release_date: String, pub release_date_precision: DatePrecision, pub tracks: Page, /// Not documented in official Spotify docs, however most albums do contain this field pub label: Option, } /// Intermediate full Albums wrapped by Vec object #[derive(Deserialize)] pub struct FullAlbums { pub albums: Vec, } /// Intermediate simplified Albums wrapped by Page object #[derive(Deserialize)] pub struct PageSimplifiedAlbums { pub albums: Page, } /// Saved Album object #[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] pub struct SavedAlbum { pub added_at: DateTime, pub album: FullAlbum, } /// Album restriction object #[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] pub struct Restriction { pub reason: RestrictionReason, }