Skip to main content

genius_rust/
album.rs

1use serde::{Serialize, Deserialize};
2
3use crate::annotation::Referent;
4use crate::song::{Artist, SongPerformance};
5use crate::user::UserMetadata;
6use crate::Date;
7
8#[derive(Serialize, Deserialize, Debug)]
9pub struct Album {
10    /// Path of the API.
11    pub api_path: String,
12    /// Number of comments.
13    /// > Only in `get_album`
14    #[serde(skip_serializing_if = "Option::is_none")]
15    pub comment_count: Option<u32>,
16    /// Cover art thumbnail if the album.
17    /// > Only with `user-core` level token
18    #[serde(skip_serializing_if = "Option::is_none")]
19    pub cover_art_thumbnail_url: Option<String>,
20    /// Cover art of the album.
21    pub cover_art_url: String,
22    /// Custom header image.
23    /// > Only in `get_album`
24    #[serde(skip_serializing_if = "Option::is_none")]
25    pub custom_header_image_url: Option<String>,
26    /// Full album title is: "`name` by `author`".
27    pub full_title: String,
28    /// Header image.
29    /// > Only in `get_album`
30    #[serde(skip_serializing_if = "Option::is_none")]
31    pub header_image_url: Option<String>,
32    /// Id of the album.
33    pub id: u32,
34    /// > Only in `get_album`
35    #[serde(skip_serializing_if = "Option::is_none")]
36    pub lock_state: Option<String>,
37    /// Name of the album.
38    pub name: String,
39    /// Name with artist in `{album name} (artist: {artist name})`
40    /// > Only with `user-core` level token
41    #[serde(skip_serializing_if = "Option::is_none")]
42    pub name_with_artist: Option<String>,
43    /// Number of pyongs in this album.
44    /// > Only in `get_album`
45    #[serde(skip_serializing_if = "Option::is_none")]
46    pub pyongs_count: Option<u32>,
47    /// Release date of the album in ISO 8601 date format.
48    /// > Only in `get_album`
49    #[serde(skip_serializing_if = "Option::is_none")]
50    pub release_date: Option<String>,
51    /// Release date of the album in struct format [`Date`].
52    /// > Only in `get_album` or with `user-core` level token
53    #[serde(skip_serializing_if = "Option::is_none")]
54    pub release_date_components: Option<Date>,
55    /// Url of the album page.
56    pub url: String,
57    /// Current user metadata have all the permissions of the user to vote, edit etc. and some others stuffs.
58    /// > Only in `get_album`
59    #[serde(skip_serializing_if = "Option::is_none")]
60    pub current_user_metadata: Option<UserMetadata>,
61    /// Number of views in the album page.
62    /// > Only in `get_album`
63    #[serde(rename = "song_pageviews", skip_serializing_if = "Option::is_none")]
64    pub album_pageviews: Option<u32>,
65    /// Album artist.
66    pub artist: Artist,
67    /// All cover arts of the album.
68    /// > Only in `get_album`
69    #[serde(skip_serializing_if = "Option::is_none")]
70    pub cover_arts: Option<Vec<CoverArt>>,
71    /// Annotations in this album.
72    /// > Only in `get_album`
73    #[serde(skip_serializing_if = "Option::is_none")]
74    pub description_annotation: Option<Referent>,
75    /// All the people who worked on this album.
76    /// > Only in `get_album`
77    #[serde(skip_serializing_if = "Option::is_none")]
78    pub song_performances: Option<Vec<SongPerformance>>,
79}
80
81#[derive(Serialize, Deserialize, Debug)]
82pub struct CoverArt {
83    /// If this art have annotations.
84    pub annotated: bool,
85    /// Path of the API
86    pub api_path: String,
87    /// Id of cover art.
88    pub id: u32,
89    /// Image of the art.
90    pub image_url: String,
91    /// Thumbnail image of the art.
92    pub thumbnail_image_url: String,
93    /// Page of the art.
94    pub url: String,
95}