qobuz_api_rust/models/
track.rs

1use serde::{Deserialize, Serialize};
2
3use crate::models::{Album, Artist, AudioInfo};
4
5/// Track model representing a track on the Qobuz platform
6///
7/// This struct contains comprehensive information about a track including its
8/// identification, title, version, duration, album, artists, and various metadata.
9///
10/// # Examples
11///
12/// ```
13/// use qobuz_api_rust::models::Track;
14///
15/// let track = Track {
16///     id: Some(12345),
17///     title: Some("Example Track".to_string()),
18///     ..Default::default()
19/// };
20/// ```
21#[derive(Serialize, Deserialize, Debug, Clone, Default)]
22pub struct Track {
23    /// Unique identifier for the track
24    #[serde(rename = "id")]
25    pub id: Option<i32>,
26
27    /// Title of the track
28    #[serde(rename = "title")]
29    pub title: Option<String>,
30
31    /// Version information for the track (e.g., "Remastered", "Acoustic")
32    #[serde(rename = "version")]
33    pub version: Option<String>,
34
35    /// International Standard Recording Code for the track
36    #[serde(rename = "isrc")]
37    pub isrc: Option<String>,
38
39    /// Track number within its album
40    #[serde(rename = "track_number")]
41    pub track_number: Option<i32>,
42
43    /// Duration of the track in seconds
44    #[serde(rename = "duration")]
45    pub duration: Option<i64>,
46
47    /// Media number (disk number) for the track
48    #[serde(rename = "media_number")]
49    pub media_number: Option<i32>,
50
51    /// Work information for the track (for classical music)
52    #[serde(rename = "work")]
53    pub work: Option<String>,
54
55    /// Album that contains this track (boxed to handle recursive structures)
56    #[serde(rename = "album")]
57    pub album: Option<Box<Album>>,
58
59    /// Main performer of the track (boxed to handle recursive structures)
60    #[serde(rename = "performer")]
61    pub performer: Option<Box<Artist>>,
62
63    /// List of performers for the track as a string
64    #[serde(rename = "performers")]
65    pub performers: Option<String>,
66
67    /// Composer of the track (boxed to handle recursive structures)
68    #[serde(rename = "composer")]
69    pub composer: Option<Box<Artist>>,
70
71    /// Audio information for the track
72    #[serde(rename = "audio_info")]
73    pub audio_info: Option<AudioInfo>,
74
75    /// Copyright information for the track
76    #[serde(rename = "copyright")]
77    pub copyright: Option<String>,
78
79    /// Whether the track is displayable to users
80    #[serde(rename = "displayable")]
81    pub displayable: Option<bool>,
82
83    /// Whether the track is available for download
84    #[serde(rename = "downloadable")]
85    pub downloadable: Option<bool>,
86
87    /// Whether the track is available for purchase
88    #[serde(rename = "purchasable")]
89    pub purchasable: Option<bool>,
90
91    /// Whether the track is available for streaming
92    #[serde(rename = "streamable")]
93    pub streamable: Option<bool>,
94
95    /// Whether the track has a preview available
96    #[serde(rename = "previewable")]
97    pub previewable: Option<bool>,
98
99    /// Whether the track has a sample available
100    #[serde(rename = "sampleable")]
101    pub sampleable: Option<bool>,
102
103    /// Whether the track is available in high-resolution format
104    #[serde(rename = "hires")]
105    pub hires: Option<bool>,
106
107    /// Whether the track is streamable in high-resolution format
108    #[serde(rename = "hires_streamable")]
109    pub hires_streamable: Option<bool>,
110
111    /// Maximum bit depth of the track's audio file
112    #[serde(rename = "maximum_bit_depth")]
113    pub maximum_bit_depth: Option<f64>,
114
115    /// Maximum number of audio channels in the track's file
116    #[serde(rename = "maximum_channel_count")]
117    pub maximum_channel_count: Option<f64>,
118
119    /// Maximum sampling rate of the track's audio file
120    #[serde(rename = "maximum_sampling_rate")]
121    pub maximum_sampling_rate: Option<f64>,
122
123    /// Unix timestamp of when the track became purchasable
124    #[serde(rename = "purchasable_at")]
125    pub purchasable_at: Option<i64>,
126
127    /// Unix timestamp of when the track became streamable
128    #[serde(rename = "streamable_at")]
129    pub streamable_at: Option<i64>,
130
131    /// Date when the track became available for download
132    #[serde(rename = "release_date_download")]
133    pub release_date_download: Option<String>,
134
135    /// Original release date of the track
136    #[serde(rename = "release_date_original")]
137    pub release_date_original: Option<String>,
138
139    /// Date when the track became available for streaming
140    #[serde(rename = "release_date_stream")]
141    pub release_date_stream: Option<String>,
142
143    /// Whether the track has parental content warnings
144    #[serde(rename = "parental_warning")]
145    pub parental_warning: Option<bool>,
146}