spotify_api/objects.rs
1use serde::{Deserialize, Serialize};
2
3/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-albumobject)
4#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
5pub struct AlbumObject {
6 /// The type of the album: `album`, `single`, or `compilation`.
7 pub album_type: String,
8 /// The artists of the album. Each artist object includes a link in `href` to more detailed information about the artist.
9 pub artists: Vec<ArtistObject>,
10 /// The markets in which the album is available: [ISO 3166-1 alpha-2 country codes.](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) Note that an album is considered available in a market when at least 1 of its tracks is available in that market.
11 pub available_markets: Vec<String>,
12 /// The copyright statements of the album.
13 pub copyrights: Vec<CopyrightObject>,
14 /// Known external IDs for the album.
15 pub external_ids: ExternalIdObject,
16 /// Known external URLs for this album.
17 pub external_urls: ExternalUrlObject,
18 /// A list of the genres used to classify the album. For example: “Prog Rock” , “Post-Grunge”. (If not yet classified, the array is empty.)
19 pub genres: Vec<String>,
20 /// A link to the Web API endpoint providing full details of the album.
21 pub href: String,
22 /// The Spotify ID for the album.
23 pub id: String,
24 /// The cover art for the album in various sizes, widest first.
25 pub images: Vec<ImageObject>,
26 /// The label for the album.
27 pub label: String,
28 /// The name of the album. In case of an album takedown, the value may be an empty string.
29 pub name: String,
30 /// The popularity of the album. The value will be between 0 and 100, with 100 being the most popular. The popularity is calculated from the popularity of the album’s individual tracks.
31 pub popularity: usize,
32 /// The date the album was first released, for example “1981-12-15”. Depending on the precision, it might be shown as “1981” or “1981-12”.
33 pub release_date: String,
34 /// The precision with which release_date value is known: “year” , “month” , or “day”.
35 pub release_date_precision: String,
36 /// Included in the response when a content restriction is applied. See [Restriction Object](https://developer.spotify.com/documentation/web-api/reference/#object-albumrestrictionobject) for more details.
37 pub restrictions: AlbumRestrictionObject,
38 /// The tracks of the album.
39 pub tracks: Vec<SimplifiedTrackObject>,
40 /// The object type: “album"
41 #[serde(rename = "type")]
42 pub _type: String,
43 /// The Spotify URI for the album.
44 pub uri: String,
45}
46/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-albumrestrictionobject)
47#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
48pub struct AlbumRestrictionObject {
49 /// The reason for the restriction. Supported values:
50 /// * `market` - The content item is not available in the given market.
51 /// * `product` - The content item is not available for the user’s subscription type.
52 /// * `explicit` - The content item is explicit and the user’s account is set to not play explicit content. Additional reasons may be added in the future. **Note**: If you use this field, make sure that your application safely handles unknown values.
53 pub reason: String,
54}
55/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-artistobject)
56#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
57pub struct ArtistObject {
58 /// Known external URLs for this artist.
59 pub external_urls: ExternalUrlObject,
60 /// Information about the followers of the artist.
61 pub followers: Option<FollowersObject>,
62 /// A list of the genres the artist is associated with. For example: `"Prog Rock"` , `"Post-Grunge"`. (If not yet classified, the array is empty.)
63 pub genres: Option<Vec<String>>,
64 /// A link to the Web API endpoint providing full details of the artist.
65 pub href: String,
66 /// The [Spotify ID](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for the artist.
67 pub id: String,
68 /// Images of the artist in various sizes, widest first.
69 pub images: Vec<ImageObject>,
70 /// The name of the artist.
71 pub name: String,
72 /// The popularity of the artist. The value will be between 0 and 100, with 100 being the most popular. The artist’s popularity is calculated from the popularity of all the artist’s tracks.
73 pub popularity: usize,
74 /// The object type: `"artist"`
75 #[serde(rename = "type")]
76 pub _type: String,
77 /// The [Spotify URI](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for the artist.
78 pub uri: String,
79}
80
81/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-audiofeaturesobject)
82#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
83pub struct AudioFeaturesObject {
84 /// A confidence measure from 0.0 to 1.0 of whether the track is acoustic. 1.0 represents high confidence the track is acoustic.
85 pub acousticness: usize,
86 /// An HTTP URL to access the full audio analysis of this track. An access token is required to access this data.
87 pub analysis_url: String,
88 /// Danceability describes how suitable a track is for dancing based on a combination of musical elements including tempo, rhythm stability, beat strength, and overall regularity. A value of 0.0 is least danceable and 1.0 is most danceable.
89 pub danceability: usize,
90 /// The duration of the track in milliseconds.
91 pub duration_ms: usize,
92 /// Energy is a measure from 0.0 to 1.0 and represents a perceptual measure of intensity and activity. Typically, energetic tracks feel fast, loud, and noisy. For example, death metal has high energy, while a Bach prelude scores low on the scale. Perceptual features contributing to this attribute include dynamic range, perceived loudness, timbre, onset rate, and general entropy.
93 pub energy: usize,
94 /// The Spotify ID for the track.
95 pub id: String,
96 /// Predicts whether a track contains no vocals. “Ooh” and “aah” sounds are treated as instrumental in this context. Rap or spoken word tracks are clearly “vocal”. The closer the instrumentalness value is to 1.0, the greater likelihood the track contains no vocal content. Values above 0.5 are intended to represent instrumental tracks, but confidence is higher as the value approaches 1.0.
97 pub instrumentalness: usize,
98 /// The key the track is in. Integers map to pitches using standard [Pitch Class notation](https://en.wikipedia.org/wiki/Pitch_class). E.g. 0 = C, 1 = C♯/D♭, 2 = D, and so on.
99 pub key: usize,
100 /// Detects the presence of an audience in the recording. Higher liveness values represent an increased probability that the track was performed live. A value above 0.8 provides strong likelihood that the track is live.
101 pub liveness: usize,
102 /// The overall loudness of a track in decibels (dB). Loudness values are averaged across the entire track and are useful for comparing relative loudness of tracks. Loudness is the quality of a sound that is the primary psychological correlate of physical strength (amplitude). Values typical range between -60 and 0 db.
103 pub loudness: usize,
104 /// Mode indicates the modality (major or minor) of a track, the type of scale from which its melodic content is derived. Major is represented by 1 and minor is 0.
105 pub mode: usize,
106 /// Speechiness detects the presence of spoken words in a track. The more exclusively speech-like the recording (e.g. talk show, audio book, poetry), the closer to 1.0 the attribute value. Values above 0.66 describe tracks that are probably made entirely of spoken words. Values between 0.33 and 0.66 describe tracks that may contain both music and speech, either in sections or layered, including such cases as rap music. Values below 0.33 most likely represent music and other non-speech-like tracks.
107 pub speechiness: usize,
108 /// The overall estimated tempo of a track in beats per minute (BPM). In musical terminology, tempo is the speed or pace of a given piece and derives directly from the average beat duration.
109 pub tempo: usize,
110 /// An estimated overall time signature of a track. The time signature (meter) is a notational convention to specify how many beats are in each bar (or measure).
111 pub time_signature: usize,
112 /// A link to the Web API endpoint providing full details of the track.
113 pub track_href: String,
114 /// The object type: “audio_features”
115 #[serde(rename = "type")]
116 pub _type: String,
117 /// The Spotify URI for the track.
118 pub uri: String,
119 /// A measure from 0.0 to 1.0 describing the musical positiveness conveyed by a track. Tracks with high valence sound more positive (e.g. happy, cheerful, euphoric), while tracks with low valence sound more negative (e.g. sad, depressed, angry).
120 pub valence: usize,
121}
122
123/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-categoryobject)
124#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
125pub struct CategoryObject {
126 /// A link to the Web API endpoint returning full details of the category.
127 pub href: String,
128 /// The category icon, in various sizes.
129 pub icons: Vec<ImageObject>,
130 /// The [Spotify category ID](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) of the category.
131 pub id: String,
132 /// The name of the category.
133 pub name: String,
134}
135
136/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-contextobject)
137#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
138pub struct ContextObject {
139 /// External URLs for this context.
140 pub external_urls: ExternalUrlObject,
141 /// A link to the Web API endpoint providing full details of the track.
142 pub href: String,
143 /// The object type, e.g. “artist”, “playlist”, “album”, “show”.
144 #[serde(rename = "type")]
145 pub _type: String,
146 /// The [Spotify URI](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for the context.
147 pub uri: String,
148}
149
150/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-copyrightobject)
151#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
152pub struct CopyrightObject {
153 /// The copyright text for this content.
154 pub text: String,
155 /// The type of copyright: `C` = the copyright, `P` = the sound recording (performance) copyright.
156 #[serde(rename = "type")]
157 pub _type: String,
158}
159
160/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-currentlyplayingcontextobject)
161#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
162pub struct CurrentlyPlayingContextObject {
163 /// Allows to update the user interface based on which playback actions are available within the current context.
164 pub actions: DisallowsObject,
165 /// A Context Object. Can be `null`.
166 pub context: ContextObject,
167 /// The object type of the currently playing item. Can be one of `track`, `episode`, `ad` or `unknown`.
168 pub currently_playing_type: String,
169 /// The device that is currently active.
170 pub device: DeviceObject,
171 /// If something is currently playing, return `true`.
172 pub is_playing: bool,
173 /// The currently playing track or episode. Can be `null`.
174 pub item: PlaylistItemType<TrackObject, EpisodeObject>,
175 /// Progress into the currently playing track or episode. Can be `null`.
176 pub progress_ms: usize,
177 /// off, track, context
178 pub repeat_state: String,
179 /// If shuffle is on or off.
180 pub shuffle_state: String,
181 /// Unix Millisecond Timestamp when data was fetched.
182 pub timestamp: usize,
183}
184/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-currentlyplayingobject)
185#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
186pub struct CurrentlyPlayingObject {
187 /// A Context Object. Can be `null`.
188 pub context: ContextObject,
189 /// The object type of the currently playing item. Can be one of `track`, `episode`, `ad` or `unknown`.
190 pub currently_playing_type: String,
191 /// If something is currently playing, return `true`.
192 pub is_playing: bool,
193 /// The currently playing track or episode. Can be `null`.
194 pub item: PlaylistItemType<TrackObject, EpisodeObject>,
195 /// Progress into the currently playing track or episode. Can be `null`.
196 pub progress_ms: usize,
197 /// If shuffle is on or off.
198 pub shuffle_state: String,
199 /// Unix Millisecond Timestamp when data was fetched.
200 pub timestamp: usize,
201}
202/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-cursorobject)
203#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
204pub struct CursorObject {
205 /// The cursor to use as key to find the next page of items.
206 pub after: String,
207}
208/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-cursorpagingobject)
209#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
210pub struct CursorPagingObject {
211 /// The cursors used to find the next set of items.
212 pub cursors: CursorObject,
213 /// A link to the Web API endpoint returning the full result of the request.
214 pub href: String,
215 /// The requested data.
216 //items: Vec<Object>
217 /// The maximum number of items in the response (as set in the query or by default)
218 pub limit: usize,
219 /// URL to the next page of items. (`null` if none)
220 pub next: String,
221 /// The total number of items available to return.
222 pub total: usize,
223}
224/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-deviceobject)
225#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
226pub struct DeviceObject {
227 /// The device ID. This may be `null`.
228 pub id: String,
229 /// If this device is the currently active device.
230 pub is_active: bool,
231 /// If this device is currently in a private session.
232 pub is_private_session: bool,
233 /// Whether controlling this device is restricted. At present if this is “true” then no Web API commands will be accepted by this device.
234 pub is_restricted: bool,
235 /// The name of the device.
236 pub name: String,
237 /// Device type, such as “computer”, “smartphone” or “speaker”.
238 #[serde(rename = "type")]
239 pub _type: String,
240 /// The current volume in percent. This may be null.
241 pub volume_percent: usize,
242}
243/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-devicesobject)
244#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
245pub struct DevicesObject {
246 /// A list of 0..n Device objects
247 pub devices: Vec<DeviceObject>,
248}
249/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-disallowsobject)
250#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
251pub struct DisallowsObject {
252 /// Interrupting playback. Optional field.
253 pub interrupting_playback: Option<bool>,
254 /// Pausing. Optional field.
255 pub pausing: Option<bool>,
256 /// Resuming. Optional field.
257 pub resuming: Option<bool>,
258 /// Seeking playback location. Optional field.
259 pub seeking: Option<bool>,
260 /// Skipping to the next context. Optional field.
261 pub skipping_next: Option<bool>,
262 /// Skipping to the previous context. Optional field.
263 pub skipping_prev: Option<bool>,
264 /// Toggling repeat context flag. Optional field.
265 pub toggling_repeat_context: Option<bool>,
266 /// Toggling repeat track flag. Optional field.
267 pub toggling_repeat_track: Option<bool>,
268 /// Toggling shuffle flag. Optional field.
269 pub toggling_shuffle: Option<bool>,
270 /// Transfering playback between devices. Optional field.
271 pub transferring_playback: Option<bool>,
272}
273/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-episodeobject)
274#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
275pub struct EpisodeObject {
276 /// A URL to a 30 second preview (MP3 format) of the episode. `null` if not available.
277 pub audio_preview_url: String,
278 /// A description of the episode. HTML tags are stripped away from this field, use `html_description` field in case HTML tags are needed.
279 pub description: String,
280 /// The episode length in milliseconds.
281 pub duration_ms: usize,
282 /// Whether or not the episode has explicit content (true = yes it does; false = no it does not OR unknown).
283 pub explicit: bool,
284 /// External URLs for this episode.
285 pub external_urls: ExternalUrlObject,
286 /// A link to the Web API endpoint providing full details of the episode.
287 pub href: String,
288 /// A description of the episode. This field may contain HTML tags.
289 pub html_description: String,
290 /// The [Spotify ID](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for the episode.
291 pub id: String,
292 /// The cover art for the episode in various sizes, widest first.
293 pub images: Vec<ImageObject>,
294 /// True if the episode is hosted outside of Spotify’s CDN.
295 pub is_externally_hosted: bool,
296 /// True if the episode is playable in the given market. Otherwise false.
297 pub is_playable: bool,
298 /// **Note: This field is deprecated and might be removed in the future. Please use the languages field instead.** The language used in the episode, identified by a [ISO 639](https://en.wikipedia.org/wiki/ISO_639) code.
299 pub language: String,
300 /// A list of the languages used in the episode, identified by their [ISO 639](https://en.wikipedia.org/wiki/ISO_639) code.
301 pub languages: Vec<String>,
302 /// The name of the episode.
303 pub name: String,
304 /// The date the episode was first released, for example `"1981-12-15"`. Depending on the precision, it might be shown as `"1981"` or `"1981-12"`.
305 pub release_date: String,
306 /// The precision with which `release_date` value is known: `"year"`, `"month"`, or `"day"`.
307 pub release_date_precision: String,
308 /// Included in the response when a content restriction is applied. See [Restriction Object](https://developer.spotify.com/documentation/web-api/reference/#object-episoderestrictionobject) for more details.
309 pub restrictions: EpisodeRestrictionObject,
310 /// The user’s most recent position in the episode. Set if the supplied access token is a user token and has the scope `user-read-playback-position`.
311 pub resume_point: ResumePointObject,
312 /// The show on which the episode belongs.
313 pub show: SimplifiedShowObject,
314 /// The object type: “episode”.
315 #[serde(rename = "type")]
316 pub _type: String,
317 /// The [Spotify URI](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for the episode.
318 pub uri: String,
319}
320/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-episoderestrictionobject)
321#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
322pub struct EpisodeRestrictionObject {
323 /// The reason for the restriction. Supported values:
324 /// * `market` - The content item is not available in the given market.
325 /// * `product` - The content item is not available for the user’s subscription type.
326 /// * `explicit` - The content item is explicit and the user’s account is set to not play explicit content. Additional reasons may be added in the future. **Note**: If you use this field, make sure that your application safely handles unknown values.
327 pub reason: String,
328}
329
330#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
331pub struct ErrorJSON {
332 pub error: ErrorObject,
333}
334#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
335/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-errorobject)
336pub struct ErrorObject {
337 /// A short description of the cause of the error.
338 pub message: String,
339 /// The HTTP status code (also returned in the response header; see [Response Status Codes](https://developer.spotify.com/documentation/web-api/#response-status-codes) for more information).
340 pub status: usize,
341}
342/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-explicitcontentsettingsobject)
343#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
344pub struct ExplicitContentSettingsObject {
345 /// When `true`, indicates that explicit content should not be played.
346 pub filter_enabled: bool,
347 /// When `true`, indicates that the explicit content setting is locked and can’t be changed by the user.
348 pub filter_locked: bool,
349}
350/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-externalidobject)
351#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
352pub struct ExternalIdObject {
353 /// [International Article Number](https://en.wikipedia.org/wiki/International_Article_Number)
354 pub ean: String,
355 /// [International Standard Recording Code](https://en.wikipedia.org/wiki/International_Standard_Recording_Code)
356 pub isrc: String,
357 /// [Universal Product Code](https://en.wikipedia.org/wiki/Universal_Product_Code)
358 pub upc: String,
359}
360/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-externalurlobject)
361#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
362pub struct ExternalUrlObject {
363 /// The [Spotify URL](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for the object.
364 pub spotify: String,
365}
366/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-followersobject)
367#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
368pub struct FollowersObject {
369 /// A link to the Web API endpoint providing full details of the followers; `null` if not available. Please note that this will always be set to null, as the Web API does not support it at the moment.
370 pub href: String,
371 /// The total number of followers.
372 pub total: usize,
373}
374/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-imageobject)
375#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
376pub struct ImageObject {
377 /// The image height in pixels. If unknown: `null` or not returned.
378 pub height: Option<u32>,
379 /// The source URL of the image.
380 pub url: String,
381 /// The image width in pixels. If unknown: `null` or not returned.
382 pub width: Option<u32>,
383}
384/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-linkedtrackobject)
385#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
386pub struct LinkedTrackObject {
387 /// Known external URLs for this track.
388 pub external_urls: ExternalUrlObject,
389 /// A link to the Web API endpoint providing full details of the track.
390 pub href: String,
391 /// The [Spotify ID](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for the track.
392 pub id: String,
393 /// The object type: “track”.
394 #[serde(rename = "type")]
395 pub _type: String,
396 /// The [Spotify URI](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for the track.
397 pub uri: String,
398}
399/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-pagingobject)
400#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
401pub struct PagingObject {
402 /// A link to the Web API endpoint returning the full result of the request
403 pub href: String,
404 /// The requested data.
405 //items: Vec<Object>,
406 /// The maximum number of items in the response (as set in the query or by default).
407 pub limit: usize,
408 /// URL to the next page of items. (`null` if none)
409 pub next: String,
410 /// The offset of the items returned (as set in the query or by default)
411 pub offset: usize,
412 /// URL to the previous page of items. (`null` if none)
413 pub previous: String,
414 /// The total number of items available to return.
415 pub total: usize,
416}
417/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-playhistoryobject)
418#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
419pub struct PlayHistoryObject {
420 /// The context the track was played from.
421 pub context: ContextObject,
422 /// The date and time the track was played.
423 //played_at: Timestamp,
424 /// The track the user listened to.
425 pub track: SimplifiedTrackObject,
426}
427/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-playererrorobject)
428#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
429pub struct PlayerErrorObject {
430 pub message: String,
431 /// * `NO_PREV_TRACK` - The command requires a previous track, but there is none in the context.
432 /// * `NO_NEXT_TRACK` - The command requires a next track, but there is none in the context.
433 /// * `NO_SPECIFIC_TRACK` - The requested track does not exist.
434 /// * `ALREADY_PAUSED` - The command requires playback to not be paused.
435 /// * `NOT_PAUSED` - The command requires playback to be paused.
436 /// * `NOT_PLAYING_LOCALLY` - The command requires playback on the local device.
437 /// * `NOT_PLAYING_TRACK` - The command requires that a track is currently playing.
438 /// * `NOT_PLAYING_CONTEXT` - The command requires that a context is currently playing.
439 /// * `ENDLESS_CONTEXT` - The shuffle command cannot be applied on an endless context.
440 /// * `CONTEXT_DISALLOW` - The command could not be performed on the context.
441 /// * `ALREADY_PLAYING` - The track should not be restarted if the same track and context is already playing, and there is a resume point.
442 /// * `RATE_LIMITED` - The user is rate limited due to too frequent track play, also known as cat-on-the-keyboard spamming.
443 /// * `REMOTE_CONTROL_DISALLOW` - The context cannot be remote-controlled.
444 /// * `DEVICE_NOT_CONTROLLABLE` - Not possible to remote control the device.
445 /// * `VOLUME_CONTROL_DISALLOW` - Not possible to remote control the device’s volume.
446 /// * `NO_ACTIVE_DEVICE` - Requires an active device and the user has none.
447 /// * `PREMIUM_REQUIRED` - The request is prohibited for non-premium users.
448 /// * `UNKNOWN` - Certain actions are restricted because of unknown reasons.
449 pub reason: String,
450 /// The HTTP status code. Either `404 NOT FOUND` or `403 FORBIDDEN`. Also returned in the response header.
451 pub status: usize,
452}
453/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-playlistobject)
454#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
455pub struct PlaylistObject {
456 /// `true` if the owner allows other users to modify the playlist.
457 pub collaborative: bool,
458 /// The playlist description. Only returned for modified, verified playlists, otherwise `null`.
459 pub description: String,
460 /// Known external URLs for this playlist.
461 pub external_urls: ExternalUrlObject,
462 /// Information about the followers of the playlist.
463 pub followers: FollowersObject,
464 /// A link to the Web API endpoint providing full details of the playlist.
465 pub href: String,
466 /// The [Spotify ID](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for the playlist.
467 pub id: String,
468 /// Images for the playlist. The array may be empty or contain up to three images. The images are returned by size in descending order. See [Working with Playlists](https://developer.spotify.com/documentation/general/guides/working-with-playlists/). _Note: If returned, the source URL for the image (`url`) is temporary and will expire in less than a day._
469 pub images: Vec<ImageObject>,
470 /// The name of the playlist.
471 pub name: String,
472 /// The user who owns the playlist
473 pub owner: PublicUserObject,
474 /// The playlist’s public/private status: `true` the playlist is public, `false` the playlist is private, `null` the playlist status is not relevant. For more about public/private status, see [Working with Playlists](https://developer.spotify.com/documentation/general/guides/working-with-playlists/)
475 pub public: bool,
476 /// The version identifier for the current playlist. Can be supplied in other requests to target a specific playlist version
477 pub snapshot_id: String,
478 /// Information about the tracks of the playlist. Note, a track object may be `null`. This can happen if a track is no longer available.
479 pub tracks: Vec<PlaylistTrackObject>,
480 /// The object type: “playlist”
481 #[serde(rename = "type")]
482 pub _type: String,
483 /// The [Spotify URI](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for the playlist.
484 pub uri: String,
485}
486/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-playlisttrackobject)
487#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
488pub struct PlaylistTrackObject {
489 /// The date and time the track or episode was added. Note that some very old playlists may return `null` in this field.
490 //added_at: Timestamp,
491 /// The Spotify user who added the track or episode. Note that some very old playlists may return `null` in this field.
492 pub added_by: PublicUserObject,
493 /// Whether this track or episode is a [local file](https://developer.spotify.com/documentation/general/guides/local-files-spotify-playlists/) or not.
494 pub is_local: bool,
495 /// Information about the track or episode.
496 pub track: PlaylistItemType<TrackObject, EpisodeObject>,
497}
498
499#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
500pub enum PlaylistItemType<T, E> {
501 Track(T),
502 Episode(E),
503}
504
505/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-playlisttracksrefobject)
506#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
507pub struct PlaylistTracksRefObject {
508 /// A link to the Web API endpoint where full details of the playlist’s tracks can be retrieved.
509 pub href: String,
510 /// Number of tracks in the playlist.
511 pub total: usize,
512}
513/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-privateuserobject)
514#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
515pub struct PrivateUserObject {
516 /// The country of the user, as set in the user’s account profile. An [ISO 3166-1 alpha-2 country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). This field is only available when the current user has granted access to the [user-read-private](https://developer.spotify.com/documentation/general/guides/authorization-guide/#list-of-scopes) scope.
517 pub country: String,
518 /// The name displayed on the user’s profile. `null` if not available.
519 pub display_name: String,
520 /// The user’s email address, as entered by the user when creating their account. **_Important!_** This email address is unverified; there is no proof that it actually belongs to the user. This field is only available when the current user has granted access to the [user-read-email](https://developer.spotify.com/documentation/general/guides/authorization-guide/#list-of-scopes) scope.
521 pub email: String,
522 /// The user’s explicit content settings. This field is only available when the current user has granted access to the [user-read-private](https://developer.spotify.com/documentation/general/guides/authorization-guide/#list-of-scopes) scope.
523 pub explicit_content: ExplicitContentSettingsObject,
524 /// Known external URLs for this user.
525 pub external_urls: ExternalUrlObject,
526 /// Information about the followers of the user.
527 pub followers: FollowersObject,
528 /// A link to the Web API endpoint for this user.
529 pub href: String,
530 /// The [Spotify user ID](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for the user.
531 pub id: String,
532 /// The user’s profile image.
533 pub images: Vec<ImageObject>,
534 /// The user’s Spotify subscription level: “premium”, “free”, etc. (The subscription level “open” can be considered the same as “free”.) This field is only available when the current user has granted access to the [user-read-private](https://developer.spotify.com/documentation/general/guides/authorization-guide/#list-of-scopes) scope.
535 pub product: String,
536 /// The object type: “user”
537 #[serde(rename = "type")]
538 pub _type: String,
539 /// The [Spotify URI](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for the user.
540 pub uri: String,
541}
542/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-publicuserobject)
543#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
544pub struct PublicUserObject {
545 /// The name displayed on the user’s profile. `null` if not available.
546 pub display_name: String,
547 /// Known public external URLs for this user.
548 pub external_urls: ExternalUrlObject,
549 /// Information about the followers of this user.
550 pub followers: FollowersObject,
551 /// A link to the Web API endpoint for this user.
552 pub href: String,
553 /// The [Spotify user ID](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for this user.
554 pub id: String,
555 /// The user’s profile image.
556 pub images: Vec<ImageObject>,
557 /// The object type: “user”
558 #[serde(rename = "type")]
559 pub _type: String,
560 /// The [Spotify URI](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for this user.
561 pub uri: String,
562}
563/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-recommendationseedobject)
564#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
565pub struct RecommendationSeedObject {
566 /// The number of tracks available after min_* and max_* filters have been applied.
567 #[serde(rename = "afterFilteringSize")]
568 pub after_filtering_size: usize,
569 /// The number of tracks available after relinking for regional availability.
570 #[serde(rename = "afterRelinkingSize")]
571 pub after_relinking_size: usize,
572 /// A link to the full track or artist data for this seed. For tracks this will be a link to a [Track Object](https://developer.spotify.com/documentation/web-api/reference/#object-trackobject). For artists a link to [an Artist Object](https://developer.spotify.com/documentation/web-api/reference/#object-artistobject). For genre seeds, this value will be `null`.
573 pub href: String,
574 /// The id used to select this seed. This will be the same as the string used in the `seed_artists`, `seed_tracks` or `seed_genres` parameter.
575 pub id: String,
576 /// The number of recommended tracks available for this seed.
577 #[serde(rename = "initialPoolSize")]
578 pub initial_pool_size: usize,
579 /// The entity type of this seed. One of `artist`, `track` or `genre`.
580 #[serde(rename = "type")]
581 pub _type: String,
582}
583/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-recommendationsobject)
584#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
585pub struct RecommendationsObject {
586 /// An array of [recommendation seed objects](https://developer.spotify.com/documentation/web-api/reference/#object-recommendationseedobject).
587 pub seeds: Vec<RecommendationSeedObject>,
588 /// An array of [track object (simplified)](https://developer.spotify.com/documentation/web-api/reference/#object-simplifiedtrackobject) ordered according to the parameters supplied.
589 pub tracks: Vec<SimplifiedTrackObject>,
590}
591/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-resumepointobject)
592#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
593pub struct ResumePointObject {
594 /// Whether or not the episode has been fully played by the user.
595 pub fully_played: bool,
596 /// The user’s most recent position in the episode in milliseconds.
597 pub resume_position_ms: usize,
598}
599/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-savedalbumobject)
600#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
601pub struct SavedAlbumObject {
602 /// The date and time the album was saved Timestamps are returned in ISO 8601 format as Coordinated Universal Time (UTC) with a zero offset: YYYY-MM-DDTHH:MM:SSZ. If the time is imprecise (for example, the date/time of an album release), an additional field indicates the precision; see for example, release_date in an album object.
603 pub added_at: String,
604 /// Information about the album.
605 pub album: AlbumObject,
606}
607/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-savedepisodeobject)
608#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
609pub struct SavedEpisodeObject {
610 /// The date and time the episode was saved. Timestamps are returned in ISO 8601 format as Coordinated Universal Time (UTC) with a zero offset: YYYY-MM-DDTHH:MM:SSZ.
611 pub added_at: String,
612 /// Information about the episode.
613 pub episode: EpisodeObject,
614}
615/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-savedshowobject)
616#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
617pub struct SavedShowObject {
618 /// The date and time the show was saved. Timestamps are returned in ISO 8601 format as Coordinated Universal Time (UTC) with a zero offset: YYYY-MM-DDTHH:MM:SSZ. If the time is imprecise (for example, the date/time of an album release), an additional field indicates the precision; see for example, release_date in an album object.
619 pub added_at: String,
620 /// Information about the show.
621 pub show: SimplifiedShowObject,
622}
623/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-savedtrackobject)
624#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
625pub struct SavedTrackObject {
626 /// The date and time the track was saved. Timestamps are returned in ISO 8601 format as Coordinated Universal Time (UTC) with a zero offset: YYYY-MM-DDTHH:MM:SSZ. If the time is imprecise (for example, the date/time of an album release), an additional field indicates the precision; see for example, release_date in an album object.
627 pub added_at: String,
628 /// Information about the track.
629 pub track: TrackObject,
630}
631/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-showobject)
632#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
633pub struct ShowObject {
634 /// A list of the countries in which the show can be played, identified by their [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code.
635 pub available_markets: Vec<String>,
636 /// The copyright statements of the show.
637 pub copyrights: Vec<CopyrightObject>,
638 /// A description of the show.
639 pub description: String,
640 /// A list of the show’s episodes.
641 pub episodes: Vec<SimplifiedEpisodeObject>,
642 /// Whether or not the show has explicit content (true = yes it does; false = no it does not OR unknown).
643 pub explicit: bool,
644 /// External URLs for this show.
645 pub external_urls: ExternalUrlObject,
646 /// A link to the Web API endpoint providing full details of the show.
647 pub href: String,
648 /// The [Spotify ID](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for the show.
649 pub id: String,
650 /// The cover art for the show in various sizes, widest first.
651 pub images: Vec<ImageObject>,
652 /// True if all of the show’s episodes are hosted outside of Spotify’s CDN. This field might be `null` in some cases.
653 pub is_externally_hosted: bool,
654 /// A list of the languages used in the show, identified by their [ISO 639](https://en.wikipedia.org/wiki/ISO_639) code.
655 pub languages: Vec<String>,
656 /// The media type of the show.
657 pub media_type: String,
658 /// The name of the episode.
659 pub name: String,
660 /// The publisher of the show.
661 pub publisher: String,
662 /// The object type: “show”.
663 #[serde(rename = "type")]
664 pub _type: String,
665 /// The [Spotify URI](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for the show.
666 pub uri: String,
667}
668/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-simplifiedalbumobject)
669#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
670pub struct SimplifiedAlbumObject {
671 /// The type of the album: `album`, `single`, or `compilation`.
672 pub album_type: String,
673 /// The artists of the album. Each artist object includes a link in `href` to more detailed information about the artist.
674 pub artists: Vec<ArtistObject>,
675 /// The markets in which the album is available: [ISO 3166-1 alpha-2 country codes.](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) Note that an album is considered available in a market when at least 1 of its tracks is available in that market.
676 pub available_markets: Vec<String>,
677 /// Known external URLs for this album.
678 pub external_urls: ExternalUrlObject,
679 /// A link to the Web API endpoint providing full details of the album.
680 pub href: String,
681 /// The Spotify ID for the album.
682 pub id: String,
683 /// The cover art for the album in various sizes, widest first.
684 pub images: Vec<ImageObject>,
685 /// The name of the album. In case of an album takedown, the value may be an empty string.
686 pub name: String,
687 /// The date the album was first released, for example “1981-12-15”. Depending on the precision, it might be shown as “1981” or “1981-12”.
688 pub release_date: String,
689 /// The precision with which release_date value is known: “year” , “month” , or “day”.
690 pub release_date_precision: String,
691 /// Included in the response when a content restriction is applied. See [Restriction Object](https://developer.spotify.com/documentation/web-api/reference/#object-albumrestrictionobject) for more details.
692 pub restrictions: AlbumRestrictionObject,
693 /// The object type: “album"
694 #[serde(rename = "type")]
695 pub _type: String,
696 /// The Spotify URI for the album.
697 pub uri: String,
698}
699/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-simplifiedartistobject)
700#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
701pub struct SimplifiedArtistObject {
702 /// Known external URLs for this artist.
703 pub external_urls: ExternalUrlObject,
704 /// A link to the Web API endpoint providing full details of the artist.
705 pub href: String,
706 /// The [Spotify ID](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for the artist.
707 pub id: String,
708 /// The name of the artist.
709 pub name: String,
710 /// The object type: `"artist"`
711 #[serde(rename = "type")]
712 pub _type: String,
713 /// The [Spotify URI](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for the artist.
714 pub uri: String,
715}
716/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-simplifiedepisodeobject)
717#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
718pub struct SimplifiedEpisodeObject {
719 /// A URL to a 30 second preview (MP3 format) of the episode. `null` if not available.
720 pub audio_preview_url: String,
721 /// A description of the episode. HTML tags are stripped away from this field, use `html_description` field in case HTML tags are needed.
722 pub description: String,
723 /// The episode length in milliseconds.
724 pub duration_ms: usize,
725 /// Whether or not the episode has explicit content (true = yes it does; false = no it does not OR unknown).
726 pub explicit: bool,
727 /// External URLs for this episode.
728 pub external_urls: ExternalUrlObject,
729 /// A link to the Web API endpoint providing full details of the episode.
730 pub href: String,
731 /// A description of the episode. This field may contain HTML tags.
732 pub html_description: String,
733 /// The [Spotify ID](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for the episode.
734 pub id: String,
735 /// The cover art for the episode in various sizes, widest first.
736 pub images: Vec<ImageObject>,
737 /// True if the episode is hosted outside of Spotify’s CDN.
738 pub is_externally_hosted: bool,
739 /// True if the episode is playable in the given market. Otherwise false.
740 pub is_playable: bool,
741 /// **Note: This field is deprecated and might be removed in the future. Please use the languages field instead.** The language used in the episode, identified by a [ISO 639](https://en.wikipedia.org/wiki/ISO_639) code.
742 pub language: String,
743 /// A list of the languages used in the episode, identified by their [ISO 639](https://en.wikipedia.org/wiki/ISO_639) code.
744 pub languages: Vec<String>,
745 /// The name of the episode.
746 pub name: String,
747 /// The date the episode was first released, for example `"1981-12-15"`. Depending on the precision, it might be shown as `"1981"` or `"1981-12"`.
748 pub release_date: String,
749 /// The precision with which `release_date` value is known: `"year"`, `"month"`, or `"day"`.
750 pub release_date_precision: String,
751 /// Included in the response when a content restriction is applied. See [Restriction Object](https://developer.spotify.com/documentation/web-api/reference/#object-episoderestrictionobject) for more details.
752 pub restrictions: EpisodeRestrictionObject,
753 /// The user’s most recent position in the episode. Set if the supplied access token is a user token and has the scope `user-read-playback-position`.
754 pub resume_point: ResumePointObject,
755 /// The object type: “episode”.
756 #[serde(rename = "type")]
757 pub _type: String,
758 /// The [Spotify URI](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for the episode.
759 pub uri: String,
760}
761/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-simplifiedplaylistobject)
762#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
763pub struct SimplifiedPlaylistObject {
764 /// `true` if the owner allows other users to modify the playlist.
765 pub collaborative: bool,
766 /// The playlist description. Only returned for modified, verified playlists, otherwise `null`.
767 pub description: String,
768 /// Known external URLs for this playlist.
769 pub external_urls: ExternalUrlObject,
770 /// A link to the Web API endpoint providing full details of the playlist.
771 pub href: String,
772 /// The [Spotify ID](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for the playlist.
773 pub id: String,
774 /// Images for the playlist. The array may be empty or contain up to three images. The images are returned by size in descending order. See [Working with Playlists](https://developer.spotify.com/documentation/general/guides/working-with-playlists/). _Note: If returned, the source URL for the image (`url`) is temporary and will expire in less than a day._
775 pub images: Vec<ImageObject>,
776 /// The name of the playlist.
777 pub name: String,
778 /// The user who owns the playlist
779 pub owner: PublicUserObject,
780 /// The playlist’s public/private status: `true` the playlist is public, `false` the playlist is private, `null` the playlist status is not relevant. For more about public/private status, see [Working with Playlists](https://developer.spotify.com/documentation/general/guides/working-with-playlists/)
781 pub public: bool,
782 /// The version identifier for the current playlist. Can be supplied in other requests to target a specific playlist version
783 pub snapshot_id: String,
784 /// Information about the tracks of the playlist. Note, a track object may be `null`. This can happen if a track is no longer available.
785 pub tracks: Vec<PlaylistTrackObject>,
786 /// The object type: “playlist”
787 #[serde(rename = "type")]
788 pub _type: String,
789 /// The [Spotify URI](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for the playlist.
790 pub uri: String,
791}
792/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-simplifiedshowobject)
793#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
794pub struct SimplifiedShowObject {
795 /// A list of the countries in which the show can be played, identified by their [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code.
796 pub available_markets: Vec<String>,
797 /// The copyright statements of the show.
798 pub copyrights: Vec<CopyrightObject>,
799 /// A description of the show.
800 pub description: String,
801 /// Whether or not the show has explicit content (true = yes it does; false = no it does not OR unknown).
802 pub explicit: bool,
803 /// External URLs for this show.
804 pub external_urls: ExternalUrlObject,
805 /// A link to the Web API endpoint providing full details of the show.
806 pub href: String,
807 /// The [Spotify ID](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for the show.
808 pub id: String,
809 /// The cover art for the show in various sizes, widest first.
810 pub images: Vec<ImageObject>,
811 /// True if all of the show’s episodes are hosted outside of Spotify’s CDN. This field might be `null` in some cases.
812 pub is_externally_hosted: bool,
813 /// A list of the languages used in the show, identified by their [ISO 639](https://en.wikipedia.org/wiki/ISO_639) code.
814 pub languages: Vec<String>,
815 /// The media type of the show.
816 pub media_type: String,
817 /// The name of the episode.
818 pub name: String,
819 /// The publisher of the show.
820 pub publisher: String,
821 /// The object type: “show”.
822 #[serde(rename = "type")]
823 pub _type: String,
824 /// The [Spotify URI](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for the show.
825 pub uri: String,
826}
827/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-simplifiedtrackobject)
828#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
829pub struct SimplifiedTrackObject {
830 /// The artists who performed the track. Each artist object includes a link in `href` to more detailed information about the artist.
831 pub artists: Vec<ArtistObject>,
832 /// A list of the countries in which the track can be played, identified by their [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code.
833 pub available_markets: Vec<String>,
834 /// The disc number (usually `1` unless the album consists of more than one disc).
835 pub disc_number: usize,
836 /// The track length in milliseconds.
837 pub duration_ms: usize,
838 /// Whether or not the track has explicit lyrics (`true` = yes it does; `false` = no it does not OR unknown).
839 pub explicit: bool,
840 /// Known external URLs for this track.
841 pub external_urls: ExternalUrlObject,
842 /// A link to the Web API endpoint providing full details of the track.
843 pub href: String,
844 /// The [Spotify ID](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for the track.
845 pub id: String,
846 /// Whether or not the track is from a local file.
847 pub is_local: bool,
848 /// Part of the response when [Track Relinking](https://developer.spotify.com/documentation/general/guides/track-relinking-guide/) is applied. If `true`, the track is playable in the given market. Otherwise `false`.
849 pub is_playable: bool,
850 /// Part of the response when [Track Relinking](https://developer.spotify.com/documentation/general/guides/track-relinking-guide/) is applied, and the requested track has been replaced with different track. The track in the `linked_from` object contains information about the originally requested track.
851 pub linked_from: LinkedFrom,
852 /// The name of the track.
853 pub name: String,
854 /// A link to a 30 second preview (MP3 format) of the track. Can be `null`
855 pub preview_url: String,
856 /// Included in the response when a content restriction is applied. See [Restriction Object](https://developer.spotify.com/documentation/web-api/reference/#object-trackrestrictionobject) for more details.
857 pub restrictions: TrackRestrictionObject,
858 /// The number of the track. If an album has several discs, the track number is the number on the specified disc.
859 pub track_number: usize,
860 /// The object type: “track”.
861 #[serde(rename = "type")]
862 pub _type: String,
863 /// The [Spotify URI](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for the track.
864 pub uri: String,
865}
866/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-trackobject)
867#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
868pub struct TrackObject {
869 /// The album on which the track appears. The album object includes a link in `href` to full information about the album.
870 pub album: SimplifiedAlbumObject,
871 /// The artists who performed the track. Each artist object includes a link in `href` to more detailed information about the artist.
872 pub artists: Vec<ArtistObject>,
873 /// A list of the countries in which the track can be played, identified by their [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code.
874 pub available_markets: Vec<String>,
875 /// The disc number (usually `1` unless the album consists of more than one disc).
876 pub disc_number: usize,
877 /// The track length in milliseconds.
878 pub duration_ms: usize,
879 /// Whether or not the track has explicit lyrics ( `true` = yes it does; `false` = no it does not OR unknown).
880 pub explicit: bool,
881 /// Known external IDs for the track.
882 pub external_ids: ExternalIdObject,
883 /// Known external URLs for this track.
884 pub external_urls: ExternalUrlObject,
885 /// A link to the Web API endpoint providing full details of the track.
886 pub href: String,
887 /// The [Spotify ID](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for the track.
888 pub id: String,
889 /// Whether or not the track is from a local file.
890 pub is_local: bool,
891 /// Part of the response when [Track Relinking](https://developer.spotify.com/documentation/general/guides/track-relinking-guide/) is applied. If `true`, the track is playable in the given market. Otherwise `false`.
892 pub is_playable: bool,
893 /// Part of the response when [Track Relinking](https://developer.spotify.com/documentation/general/guides/track-relinking-guide/) is applied, and the requested track has been replaced with different track. The track in the `linked_from` object contains information about the originally requested track.
894 pub linked_from: LinkedFrom,
895 /// The name of the track.
896 pub name: String,
897 /// The popularity of the track. The value will be between 0 and 100, with 100 being the most popular.
898 /// The popularity of a track is a value between 0 and 100, with 100 being the most popular. The popularity is calculated by algorithm and is based, in the most part, on the total number of plays the track has had and how recent those plays are.
899 /// Generally speaking, songs that are being played a lot now will have a higher popularity than songs that were played a lot in the past. Duplicate tracks (e.g. the same track from a single and an album) are rated independently. Artist and album popularity is derived mathematically from track popularity. Note that the popularity value may lag actual popularity by a few days: the value is not updated in real time.
900 pub popularity: usize,
901 /// A link to a 30 second preview (MP3 format) of the track. Can be `null`
902 pub preview_url: String,
903 /// Included in the response when a content restriction is applied. See [Restriction Object](https://developer.spotify.com/documentation/web-api/reference/#object-trackrestrictionobject) for more details.
904 pub restrictions: TrackRestrictionObject,
905 /// The number of the track. If an album has several discs, the track number is the number on the specified disc.
906 pub track_number: usize,
907 /// The object type: “track”.
908 #[serde(rename = "type")]
909 pub _type: String,
910 /// The [Spotify URI](https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids) for the track.
911 pub uri: String,
912}
913/// [Reference](https://developer.spotify.com/documentation/general/guides/track-relinking-guide/)
914#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
915pub struct LinkedFrom {
916 pub external_urls: ExternalUrlObject,
917 pub href: String,
918 pub id: String,
919 #[serde(rename = "type")]
920 pub _type: String,
921 pub uri: String,
922}
923
924/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-trackrestrictionobject)
925#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
926pub struct TrackRestrictionObject {
927 /// The reason for the restriction. Supported values:
928 /// * `market` - The content item is not available in the given market.
929 /// * `product` - The content item is not available for the user’s subscription type.
930 /// * `explicit` - The content item is explicit and the user’s account is set to not play explicit content. Additional reasons may be added in the future. Note: If you use this field, make sure that your application safely handles unknown values.
931 pub reason: String,
932}
933/// [Reference](https://developer.spotify.com/documentation/web-api/reference/#object-tuneabletrackobject)
934#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
935pub struct TuneableTrackObject {
936 /// A confidence measure from 0.0 to 1.0 of whether the track is acoustic. 1.0 represents high confidence the track is acoustic.
937 pub acousticness: usize,
938 /// Danceability describes how suitable a track is for dancing based on a combination of musical elements including tempo, rhythm stability, beat strength, and overall regularity. A value of 0.0 is least danceable and 1.0 is most danceable.
939 pub danceability: usize,
940 /// The duration of the track in milliseconds.
941 pub duration_ms: usize,
942 /// Energy is a measure from 0.0 to 1.0 and represents a perceptual measure of intensity and activity. Typically, energetic tracks feel fast, loud, and noisy. For example, death metal has high energy, while a Bach prelude scores low on the scale. Perceptual features contributing to this attribute include dynamic range, perceived loudness, timbre, onset rate, and general entropy.
943 pub energy: usize,
944 /// Predicts whether a track contains no vocals. “Ooh” and “aah” sounds are treated as instrumental in this context. Rap or spoken word tracks are clearly “vocal”. The closer the instrumentalness value is to 1.0, the greater likelihood the track contains no vocal content. Values above 0.5 are intended to represent instrumental tracks, but confidence is higher as the value approaches 1.0.
945 pub instrumentalness: usize,
946 /// The key the track is in. Integers map to pitches using standard [Pitch Class notation](https://en.wikipedia.org/wiki/Pitch_class). E.g. 0 = C, 1 = C♯/D♭, 2 = D, and so on.
947 pub key: usize,
948 /// Detects the presence of an audience in the recording. Higher liveness values represent an increased probability that the track was performed live. A value above 0.8 provides strong likelihood that the track is live.
949 pub liveness: usize,
950 /// The overall loudness of a track in decibels (dB). Loudness values are averaged across the entire track and are useful for comparing relative loudness of tracks. Loudness is the quality of a sound that is the primary psychological correlate of physical strength (amplitude). Values typical range between -60 and 0 db.
951 pub loudness: usize,
952 /// Mode indicates the modality (major or minor) of a track, the type of scale from which its melodic content is derived. Major is represented by 1 and minor is 0.
953 pub mode: usize,
954 /// The popularity of the track. The value will be between 0 and 100, with 100 being the most popular. The popularity is calculated by algorithm and is based, in the most part, on the total number of plays the track has had and how recent those plays are. _Note: When applying track relinking via the `market` parameter, it is expected to find relinked tracks with popularities that do not match `min_*`, `max_*` and `target_*` popularities. These relinked tracks are accurate replacements for unplayable tracks with the expected popularity scores. Original, non-relinked tracks are available via the `linked_from attribute` of the [relinked track response](https://developer.spotify.com/documentation/general/guides/track-relinking-guide/)._
955 pub popularity: usize,
956 /// Speechiness detects the presence of spoken words in a track. The more exclusively speech-like the recording (e.g. talk show, audio book, poetry), the closer to 1.0 the attribute value. Values above 0.66 describe tracks that are probably made entirely of spoken words. Values between 0.33 and 0.66 describe tracks that may contain both music and speech, either in sections or layered, including such cases as rap music. Values below 0.33 most likely represent music and other non-speech-like tracks.
957 pub speechiness: usize,
958 /// The overall estimated tempo of a track in beats per minute (BPM). In musical terminology, tempo is the speed or pace of a given piece and derives directly from the average beat duration.
959 pub tempo: usize,
960 /// An estimated overall time signature of a track. The time signature (meter) is a notational convention to specify how many beats are in each bar (or measure).
961 pub time_signature: usize,
962 /// A measure from 0.0 to 1.0 describing the musical positiveness conveyed by a track. Tracks with high valence sound more positive (e.g. happy, cheerful, euphoric), while tracks with low valence sound more negative (e.g. sad, depressed, angry).
963 pub valence: usize,
964}