qobuz_api_rust/models/
playlist.rs

1use serde::{Deserialize, Serialize};
2
3use crate::models::{
4    Artist, Focus, Genre, Image, ItemSearchResult, Playlist as PlaylistModel, Tag, Track, User,
5};
6
7/// Playlist model containing information about a user playlist
8///
9/// This struct represents a playlist with details about its content, owner,
10/// creation date, and various properties.
11///
12/// # Examples
13///
14/// ```
15/// use qobuz_api_rust::models::Playlist;
16///
17/// let playlist = Playlist {
18///     id: Some(789012345),
19///     name: Some("My Favorites".to_string()),
20///     is_public: Some(true),
21///     ..Default::default()
22/// };
23/// ```
24#[derive(Serialize, Deserialize, Debug, Clone, Default)]
25pub struct Playlist {
26    /// Unique identifier for the playlist
27    #[serde(rename = "id")]
28    pub id: Option<i64>,
29
30    /// Name of the playlist
31    #[serde(rename = "name")]
32    pub name: Option<String>,
33
34    /// Description of the playlist
35    #[serde(rename = "description")]
36    pub description: Option<String>,
37
38    /// Total duration of the playlist in seconds
39    #[serde(rename = "duration")]
40    pub duration: Option<i64>,
41
42    /// Unix timestamp of when the playlist was created
43    #[serde(rename = "created_at")]
44    pub created_at: Option<i64>,
45
46    /// Unix timestamp of when the playlist was last updated
47    #[serde(rename = "updated_at")]
48    pub updated_at: Option<i64>,
49
50    /// Unix timestamp of when the playlist was made public
51    #[serde(rename = "public_at")]
52    pub public_at: Option<i64>,
53
54    /// Unix timestamp marking the start of the playlist's publication period
55    #[serde(rename = "published_from")]
56    pub published_from: Option<i64>,
57
58    /// Unix timestamp marking the end of the playlist's publication period
59    #[serde(rename = "published_to")]
60    pub published_to: Option<i64>,
61
62    /// Number of tracks in the playlist
63    #[serde(rename = "tracks_count")]
64    pub tracks_count: Option<i32>,
65
66    /// Number of users following the playlist
67    #[serde(rename = "users_count")]
68    pub users_count: Option<i32>,
69
70    /// Whether the playlist is public
71    #[serde(rename = "is_public")]
72    pub is_public: Option<bool>,
73
74    /// Whether the playlist is featured
75    #[serde(rename = "is_featured")]
76    pub is_featured: Option<bool>,
77
78    /// Whether the playlist is published
79    #[serde(rename = "is_published")]
80    pub is_published: Option<bool>,
81
82    /// Whether the playlist is collaborative
83    #[serde(rename = "is_collaborative")]
84    pub is_collaborative: Option<bool>,
85
86    /// User who owns the playlist
87    #[serde(rename = "owner")]
88    pub owner: Option<User>,
89
90    /// Image information for the playlist artwork
91    #[serde(rename = "image")]
92    pub image: Option<Image>,
93
94    /// List of image URLs for the playlist
95    #[serde(rename = "images")]
96    pub images: Option<Vec<String>>,
97
98    /// List of rectangular image URLs for the playlist
99    #[serde(rename = "image_rectangle")]
100    pub image_rectangle: Option<Vec<String>>,
101
102    /// List of small rectangular image URLs for the playlist
103    #[serde(rename = "image_rectangle_mini")]
104    pub image_rectangle_mini: Option<Vec<String>>,
105
106    /// List of 150px square image URLs for the playlist
107    #[serde(rename = "images150")]
108    pub images150: Option<Vec<String>>,
109
110    /// List of 300px square image URLs for the playlist
111    #[serde(rename = "images300")]
112    pub images300: Option<Vec<String>>,
113
114    /// Search results for tracks in the playlist
115    #[serde(rename = "tracks")]
116    pub tracks: Option<ItemSearchResult<Box<Track>>>,
117
118    /// List of genres associated with the playlist
119    #[serde(rename = "genres")]
120    pub genres: Option<Vec<Genre>>,
121
122    /// List of tags associated with the playlist
123    #[serde(rename = "tags")]
124    pub tags: Option<Vec<Tag>>,
125
126    /// List of featured artists in the playlist
127    #[serde(rename = "featured_artists")]
128    pub featured_artists: Option<Vec<Box<Artist>>>,
129
130    /// Search results for similar playlists
131    #[serde(rename = "similar_playlists")]
132    pub similar_playlists: Option<ItemSearchResult<Box<PlaylistModel>>>,
133
134    /// Focus items related to the playlist
135    #[serde(rename = "items_focus")]
136    pub items_focus: Option<Vec<Focus>>,
137
138    /// Timestamp position within the playlist
139    #[serde(rename = "timestamp_position")]
140    pub timestamp_position: Option<i64>,
141
142    /// URL-friendly slug for the playlist
143    #[serde(rename = "slug")]
144    pub slug: Option<String>,
145
146    /// List of stores where the playlist is available
147    #[serde(rename = "stores")]
148    pub stores: Option<Vec<String>>,
149}