Skip to main content

prawn/models/
tracks_attributes.rs

1/*
2 * TIDAL API
3 *
4 * The TIDAL API is a [JSON:API](https://jsonapi.org/)–compliant web API that exposes TIDAL’s music, metadata, and user-related functionality through a consistent, resource-oriented design. More information and API management are available at [developer.tidal.com](developer.tidal.com)
5 *
6 * The version of the OpenAPI document: 1.0.36
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15#[serde(default)]
16pub struct TracksAttributes {
17    /// Access type
18    #[serde(rename = "accessType", skip_serializing_if = "Option::is_none")]
19    pub access_type: Option<AccessType>,
20    /// Available usage for this track
21    #[serde(rename = "availability", skip_serializing_if = "Option::is_none")]
22    pub availability: Option<Vec<Availability>>,
23    /// Beats per minute
24    #[serde(rename = "bpm", skip_serializing_if = "Option::is_none")]
25    pub bpm: Option<f32>,
26    #[serde(rename = "copyright", skip_serializing_if = "Option::is_none")]
27    pub copyright: Option<Box<models::Copyright>>,
28    /// Datetime of track creation (ISO 8601)
29    #[serde(rename = "createdAt", skip_serializing_if = "Option::is_none")]
30    pub created_at: Option<String>,
31    /// Duration (ISO 8601)
32    #[serde(rename = "duration")]
33    pub duration: String,
34    /// Explicit content
35    #[serde(rename = "explicit")]
36    pub explicit: bool,
37    /// Track links external to TIDAL API
38    #[serde(rename = "externalLinks", skip_serializing_if = "Option::is_none")]
39    pub external_links: Option<Vec<models::ExternalLink>>,
40    /// International Standard Recording Code (ISRC)
41    #[serde(rename = "isrc")]
42    pub isrc: String,
43    /// Key
44    #[serde(rename = "key")]
45    pub key: Key,
46    /// The scale of the key
47    #[serde(rename = "keyScale")]
48    pub key_scale: KeyScale,
49    #[serde(rename = "mediaTags")]
50    pub media_tags: Vec<String>,
51    /// Popularity (0.0 - 1.0)
52    #[serde(rename = "popularity")]
53    pub popularity: f64,
54    /// Is the track spotlighted?
55    #[serde(rename = "spotlighted", skip_serializing_if = "Option::is_none")]
56    pub spotlighted: Option<bool>,
57    /// Track title
58    #[serde(rename = "title")]
59    pub title: String,
60    #[serde(rename = "toneTags", skip_serializing_if = "Option::is_none")]
61    pub tone_tags: Option<Vec<String>>,
62    /// Track version, complements title
63    #[serde(rename = "version", skip_serializing_if = "Option::is_none")]
64    pub version: Option<String>,
65}
66
67impl TracksAttributes {
68    pub fn new(
69        duration: String,
70        explicit: bool,
71        isrc: String,
72        key: Key,
73        key_scale: KeyScale,
74        media_tags: Vec<String>,
75        popularity: f64,
76        title: String,
77    ) -> TracksAttributes {
78        TracksAttributes {
79            access_type: None,
80            availability: None,
81            bpm: None,
82            copyright: None,
83            created_at: None,
84            duration,
85            explicit,
86            external_links: None,
87            isrc,
88            key,
89            key_scale,
90            media_tags,
91            popularity,
92            spotlighted: None,
93            title,
94            tone_tags: None,
95            version: None,
96        }
97    }
98}
99/// Access type
100#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
101pub enum AccessType {
102    #[serde(rename = "PUBLIC")]
103    Public,
104    #[serde(rename = "UNLISTED")]
105    Unlisted,
106    #[serde(rename = "PRIVATE")]
107    Private,
108}
109
110impl Default for AccessType {
111    fn default() -> AccessType {
112        Self::Public
113    }
114}
115/// Available usage for this track
116#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
117pub enum Availability {
118    #[serde(rename = "STREAM")]
119    Stream,
120    #[serde(rename = "DJ")]
121    Dj,
122    #[serde(rename = "STEM")]
123    Stem,
124}
125
126impl Default for Availability {
127    fn default() -> Availability {
128        Self::Stream
129    }
130}
131/// Key
132#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
133pub enum Key {
134    #[serde(rename = "UNKNOWN")]
135    Unknown,
136    #[serde(rename = "C")]
137    C,
138    #[serde(rename = "CSharp")]
139    CSharp,
140    #[serde(rename = "D")]
141    D,
142    #[serde(rename = "Eb")]
143    Eb,
144    #[serde(rename = "E")]
145    E,
146    #[serde(rename = "F")]
147    F,
148    #[serde(rename = "FSharp")]
149    FSharp,
150    #[serde(rename = "G")]
151    G,
152    #[serde(rename = "Ab")]
153    Ab,
154    #[serde(rename = "A")]
155    A,
156    #[serde(rename = "Bb")]
157    Bb,
158    #[serde(rename = "B")]
159    B,
160}
161
162impl Default for Key {
163    fn default() -> Key {
164        Self::Unknown
165    }
166}
167/// The scale of the key
168#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
169pub enum KeyScale {
170    #[serde(rename = "UNKNOWN")]
171    Unknown,
172    #[serde(rename = "MAJOR")]
173    Major,
174    #[serde(rename = "MINOR")]
175    Minor,
176    #[serde(rename = "AEOLIAN")]
177    Aeolian,
178    #[serde(rename = "BLUES")]
179    Blues,
180    #[serde(rename = "DORIAN")]
181    Dorian,
182    #[serde(rename = "HARMONIC_MINOR")]
183    HarmonicMinor,
184    #[serde(rename = "LOCRIAN")]
185    Locrian,
186    #[serde(rename = "LYDIAN")]
187    Lydian,
188    #[serde(rename = "MIXOLYDIAN")]
189    Mixolydian,
190    #[serde(rename = "PENTATONIC_MAJOR")]
191    PentatonicMajor,
192    #[serde(rename = "PHRYGIAN")]
193    Phrygian,
194    #[serde(rename = "MELODIC_MINOR")]
195    MelodicMinor,
196    #[serde(rename = "PENTATONIC_MINOR")]
197    PentatonicMinor,
198}
199
200impl Default for KeyScale {
201    fn default() -> KeyScale {
202        Self::Unknown
203    }
204}