summaryrefslogtreecommitdiff
path: root/src/user.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/user.rs')
-rw-r--r--src/user.rs153
1 files changed, 153 insertions, 0 deletions
diff --git a/src/user.rs b/src/user.rs
new file mode 100644
index 0000000..ee22f5a
--- /dev/null
+++ b/src/user.rs
@@ -0,0 +1,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)]
+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)]
+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)]
+pub(crate) struct UserPlaylists
+{
+ pub data: Vec<UserPlaylist>,
+}