qobuz_api_rust/models/release.rs
1use serde::{Deserialize, Serialize};
2
3use crate::models::Image;
4
5/// File URL model containing information about a downloadable file
6///
7/// This struct represents a file URL with information about the track, format,
8/// and availability for download or streaming.
9///
10/// # Examples
11///
12/// ```
13/// use qobuz_api_rust::models::FileUrl;
14///
15/// let file_url = FileUrl {
16/// track_id: Some(12345),
17/// url: Some("https://example.com/file.mp3".to_string()),
18/// format_id: Some(5),
19/// mime_type: Some("audio/mpeg".to_string()),
20/// ..Default::default()
21/// };
22/// ```
23#[derive(Serialize, Deserialize, Debug, Clone, Default)]
24pub struct FileUrl {
25 /// ID of the track associated with the file
26 #[serde(rename = "track_id")]
27 pub track_id: Option<i32>,
28
29 /// Duration of the track in seconds
30 #[serde(rename = "duration")]
31 pub duration: Option<i32>,
32
33 /// URL to download or stream the file
34 #[serde(rename = "url")]
35 pub url: Option<String>,
36
37 /// Format ID for the file
38 #[serde(rename = "format_id")]
39 pub format_id: Option<i32>,
40
41 /// MIME type of the file
42 #[serde(rename = "mime_type")]
43 pub mime_type: Option<String>,
44
45 /// Sampling rate of the file in kHz
46 #[serde(rename = "sampling_rate")]
47 pub sampling_rate: Option<f64>,
48
49 /// Bit depth of the file
50 #[serde(rename = "bit_depth")]
51 pub bit_depth: Option<i32>,
52
53 /// Status of the file URL (e.g., "available", "error")
54 #[serde(rename = "status")]
55 pub status: Option<String>,
56
57 /// Message providing additional information about the file URL
58 #[serde(rename = "message")]
59 pub message: Option<String>,
60
61 /// Code providing additional information about the file URL
62 #[serde(rename = "code")]
63 pub code: Option<String>,
64}
65
66/// Releases list model containing a list of releases
67///
68/// This struct represents a paginated list of releases with information about
69/// whether more releases are available.
70///
71/// # Examples
72///
73/// ```
74/// use qobuz_api_rust::models::{ReleasesList, Release};
75///
76/// let releases_list = ReleasesList {
77/// has_more: Some(true),
78/// items: Some(vec![Release::default()]),
79/// };
80/// ```
81#[derive(Serialize, Deserialize, Debug, Clone, Default)]
82pub struct ReleasesList {
83 /// Whether there are more releases available beyond the current list
84 #[serde(rename = "has_more")]
85 pub has_more: Option<bool>,
86
87 /// List of releases in the current page
88 #[serde(rename = "items")]
89 pub items: Option<Vec<Release>>,
90}
91
92/// Release model containing information about a music release
93///
94/// This struct represents a music release with details about the album, artist,
95/// image, UPC, release date, label, and various other properties.
96///
97/// # Examples
98///
99/// ```
100/// use qobuz_api_rust::models::Release;
101///
102/// let release = Release {
103/// id: Some("release123".to_string()),
104/// title: Some("Example Release".to_string()),
105/// release_date: Some("2023-01-01".to_string()),
106/// ..Default::default()
107/// };
108/// ```
109#[derive(Serialize, Deserialize, Debug, Clone, Default)]
110pub struct Release {
111 /// Unique identifier for the release
112 #[serde(rename = "id")]
113 pub id: Option<String>,
114
115 /// Title of the release
116 #[serde(rename = "title")]
117 pub title: Option<String>,
118
119 /// Artist information for the release
120 #[serde(rename = "artist")]
121 pub artist: Option<ReleaseArtist>,
122
123 /// Image information for the release artwork
124 #[serde(rename = "image")]
125 pub image: Option<Image>,
126
127 /// Universal Product Code for the release
128 #[serde(rename = "upc")]
129 pub upc: Option<String>,
130
131 /// Release date of the release
132 #[serde(rename = "release_date")]
133 pub release_date: Option<String>,
134
135 /// Label that released the album
136 #[serde(rename = "label")]
137 pub label: Option<String>,
138
139 /// Version information for the release
140 #[serde(rename = "version")]
141 pub version: Option<String>,
142
143 /// Number of tracks in the release
144 #[serde(rename = "tracks_count")]
145 pub tracks_count: Option<i32>,
146
147 /// Duration of the release in seconds
148 #[serde(rename = "duration")]
149 pub duration: Option<i64>,
150
151 /// Copyright information for the release
152 #[serde(rename = "copyright")]
153 pub copyright: Option<String>,
154
155 /// URL to the release on Qobuz
156 #[serde(rename = "url")]
157 pub url: Option<String>,
158
159 /// Whether the release is high-quality
160 #[serde(rename = "is_hq")]
161 pub is_hq: Option<bool>,
162
163 /// Whether the release has explicit content
164 #[serde(rename = "is_explicit")]
165 pub is_explicit: Option<bool>,
166
167 /// List of tracks in the release
168 #[serde(rename = "tracks")]
169 pub tracks: Option<ReleaseTrackList>,
170
171 /// Physical support information for the release
172 #[serde(rename = "physical_support")]
173 pub physical_support: Option<ReleasePhysicalSupport>,
174
175 /// Rights information for the release
176 #[serde(rename = "rights")]
177 pub rights: Option<ReleaseRights>,
178
179 /// Audio information for the release
180 #[serde(rename = "audio_info")]
181 pub audio_info: Option<ReleaseAudioInfo>,
182}
183
184/// Release artist model containing information about an artist in a release
185///
186/// This struct represents an artist associated with a release, including their
187/// identification, name, and slug.
188///
189/// # Examples
190///
191/// ```
192/// use qobuz_api_rust::models::ReleaseArtist;
193///
194/// let release_artist = ReleaseArtist {
195/// id: Some(12345),
196/// name: Some("Example Artist".to_string()),
197/// slug: Some("example-artist".to_string()),
198/// };
199/// ```
200#[derive(Serialize, Deserialize, Debug, Clone, Default)]
201pub struct ReleaseArtist {
202 /// Unique identifier for the artist
203 #[serde(rename = "id")]
204 pub id: Option<i32>,
205
206 /// Name of the artist
207 #[serde(rename = "name")]
208 pub name: Option<String>,
209
210 /// URL-friendly slug for the artist
211 #[serde(rename = "slug")]
212 pub slug: Option<String>,
213}
214
215/// Release track list model containing a list of tracks in a release
216///
217/// This struct represents a list of tracks in a release along with the total count.
218///
219/// # Examples
220///
221/// ```
222/// use qobuz_api_rust::models::{ReleaseTrackList, ReleaseTrack};
223///
224/// let track_list = ReleaseTrackList {
225/// items: Some(vec![ReleaseTrack::default()]),
226/// total: Some(10),
227/// };
228/// ```
229#[derive(Serialize, Deserialize, Debug, Clone, Default)]
230pub struct ReleaseTrackList {
231 /// List of tracks in the release
232 #[serde(rename = "items")]
233 pub items: Option<Vec<ReleaseTrack>>,
234
235 /// Total number of tracks in the release
236 #[serde(rename = "total")]
237 pub total: Option<i32>,
238}
239
240/// Release track model containing information about a track in a release
241///
242/// This struct represents a track in a release with details about its identification,
243/// title, duration, and position in the release.
244///
245/// # Examples
246///
247/// ```
248/// use qobuz_api_rust::models::ReleaseTrack;
249///
250/// let release_track = ReleaseTrack {
251/// id: Some(12345),
252/// title: Some("Example Track".to_string()),
253/// duration: Some(180),
254/// track_number: Some(1),
255/// media_number: Some(1),
256/// };
257/// ```
258#[derive(Serialize, Deserialize, Debug, Clone, Default)]
259pub struct ReleaseTrack {
260 /// Unique identifier for the track
261 #[serde(rename = "id")]
262 pub id: Option<i32>,
263
264 /// Title of the track
265 #[serde(rename = "title")]
266 pub title: Option<String>,
267
268 /// Duration of the track in seconds
269 #[serde(rename = "duration")]
270 pub duration: Option<i64>,
271
272 /// Track number within the release
273 #[serde(rename = "track_number")]
274 pub track_number: Option<i32>,
275
276 /// Media number (disk number) for the track
277 #[serde(rename = "media_number")]
278 pub media_number: Option<i32>,
279}
280
281/// Release physical support model containing information about physical media
282///
283/// This struct represents information about physical media support for a release,
284/// including type, format, and description.
285///
286/// # Examples
287///
288/// ```
289/// use qobuz_api_rust::models::ReleasePhysicalSupport;
290///
291/// let physical_support = ReleasePhysicalSupport {
292/// type_field: Some("cd".to_string()),
293/// format: Some("CD".to_string()),
294/// description: Some("Compact Disc".to_string()),
295/// };
296/// ```
297#[derive(Serialize, Deserialize, Debug, Clone, Default)]
298pub struct ReleasePhysicalSupport {
299 /// Type of physical support
300 #[serde(rename = "type")]
301 pub type_field: Option<String>,
302
303 /// Format of the physical support
304 #[serde(rename = "format")]
305 pub format: Option<String>,
306
307 /// Description of the physical support
308 #[serde(rename = "description")]
309 pub description: Option<String>,
310}
311
312/// Release rights model containing information about usage rights
313///
314/// This struct represents the rights associated with a release, specifically
315/// whether it can be streamed or downloaded.
316///
317/// # Examples
318///
319/// ```
320/// use qobuz_api_rust::models::ReleaseRights;
321///
322/// let rights = ReleaseRights {
323/// can_stream: Some(true),
324/// can_download: Some(true),
325/// };
326/// ```
327#[derive(Serialize, Deserialize, Debug, Clone, Default)]
328pub struct ReleaseRights {
329 /// Whether the release can be streamed
330 #[serde(rename = "can_stream")]
331 pub can_stream: Option<bool>,
332
333 /// Whether the release can be downloaded
334 #[serde(rename = "can_download")]
335 pub can_download: Option<bool>,
336}
337
338/// Release audio information model containing technical audio specifications
339///
340/// This struct represents the technical audio specifications for a release,
341/// including bit depth, sampling rate, and format.
342///
343/// # Examples
344///
345/// ```
346/// use qobuz_api_rust::models::ReleaseAudioInfo;
347///
348/// let audio_info = ReleaseAudioInfo {
349/// bit_depth: Some(24),
350/// sampling_rate: Some(96.0),
351/// format: Some("FLAC".to_string()),
352/// };
353/// ```
354#[derive(Serialize, Deserialize, Debug, Clone, Default)]
355pub struct ReleaseAudioInfo {
356 /// Bit depth of the audio
357 #[serde(rename = "bit_depth")]
358 pub bit_depth: Option<i32>,
359
360 /// Sampling rate of the audio in kHz
361 #[serde(rename = "sampling_rate")]
362 pub sampling_rate: Option<f64>,
363
364 /// Format of the audio
365 #[serde(rename = "format")]
366 pub format: Option<String>,
367}