summaryrefslogtreecommitdiff
path: root/src/user.rs
blob: d4f57f95210e0af74d0d01d1fb6540216bd3093e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
//! Deezer user.

/*
pub enum ExplicitContentLevel
{
    explicit_display,
    explicit_no_recommendation,
    explicit_hide,
}
*/
use serde::Deserialize;

use crate::creator::Creator;

/// A Deezer user.
#[derive(Debug, Deserialize, Clone)]
pub struct User
{
    /// The user's Deezer ID
    pub id: u64,

    /// The user's Deezer nickname
    pub name: String,

    /// The user's last name
    pub lastname: String,

    /// The user's first name
    pub firstname: String,

    /// The user's email
    pub email: Option<String>,

    /// The user's status
    pub status: u32,

    /// The user's birthday
    pub birthday: String,

    /// The user's inscription date
    pub inscription_date: String,

    /// The user's gender : F or M
    pub gender: String,

    /// The String of the profil for the user on Deezer
    pub link: String,

    /// The String of the user's profil picture. Add 'size' parameter to the String to
    /// change size. Can be 'small', 'medium', 'big', 'xl'
    pub picture: String,

    /// The String of the user's profil picture in size small.
    pub picture_small: String,

    /// The String of the user's profil picture in size medium.
    pub picture_medium: String,

    /// The String of the user's profil picture in size big.
    pub picture_big: String,

    /// The String of the user's profil picture in size xl.
    pub picture_xl: String,

    /// The user's country
    pub country: String,

    /// The user's language
    pub lang: String,

    /// If the user is a kid or not
    pub is_kid: bool,

    /// The user's explicit content level according to his country
    pub explicit_content_level: String,

    /// The user's available explicit content levels according to his country. Possible
    /// values are: explicit_display, explicit_no_recommendation and explicit_hide
    pub explicit_content_levels_available: Vec<String>,

    /// API Link to the flow of this user
    pub tracklist: String,

    /// Object type.
    #[serde(rename = "type")]
    pub object_type: String,
}

/// A user's playlist.
#[derive(Debug, Deserialize, Clone)]
pub struct UserPlaylist
{
    /// The playlist's Deezer id
    pub id: u64,

    /// The playlist's title
    pub title: String,

    /// The playlist's duration (seconds)
    pub duration: u64,

    /// If the playlist is public or not
    pub public: bool,

    /// If the playlist is the love tracks playlist
    pub is_loved_track: bool,

    /// If the playlist is collaborative or not
    pub collaborative: bool,

    /// Nb tracks in the playlist
    pub nb_tracks: u64,

    /// The number of playlist's fans
    pub fans: u64,

    /// The url of the playlist on Deezer
    pub link: String,

    /// The url of the playlist's cover. Add 'size' parameter to the url to change size.
    /// Can be 'small', 'medium', 'big', 'xl'
    pub picture: String,

    /// The url of the playlist's cover in size small.
    pub picture_small: String,

    /// The url of the playlist's cover in size medium.
    pub picture_medium: String,

    /// The url of the playlist's cover in size big.
    pub picture_big: String,

    /// The url of the playlist's cover in size xl.
    pub picture_xl: String,

    /// The checksum for the track list
    pub checksum: String,

    /// The time when the playlist has been added
    pub time_add: u64,

    /// The time when the playlist has been updated
    pub time_mod: u64,

    /// The creator of the playlist.
    pub creator: Creator,
}

#[derive(Debug, Deserialize, Clone)]
pub(crate) struct UserPlaylists
{
    pub data: Vec<UserPlaylist>,
}