Skip to main content

rspotify_model/
user.rs

1//! All kinds of user object
2
3use serde::{Deserialize, Serialize};
4
5use std::collections::HashMap;
6
7use crate::{Country, Followers, Image, SubscriptionLevel, UserId};
8
9/// Public user object
10#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
11pub struct PublicUser {
12    pub display_name: Option<String>,
13    pub external_urls: HashMap<String, String>,
14    #[deprecated(
15        since = "0.16.0",
16        note = "Spotify has removed this field. See https://github.com/ramsayleung/rspotify/issues/550"
17    )]
18    pub followers: Option<Followers>,
19    pub href: String,
20    pub id: UserId<'static>,
21    #[serde(default = "Vec::new")]
22    pub images: Vec<Image>,
23}
24
25/// Private user object
26#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
27pub struct PrivateUser {
28    #[deprecated(
29        since = "0.16.0",
30        note = "Spotify has removed this field. See https://github.com/ramsayleung/rspotify/issues/550"
31    )]
32    pub country: Option<Country>,
33    pub display_name: Option<String>,
34    #[deprecated(
35        since = "0.16.0",
36        note = "Spotify has removed this field. See https://github.com/ramsayleung/rspotify/issues/550"
37    )]
38    pub email: Option<String>,
39    pub external_urls: HashMap<String, String>,
40    #[deprecated(
41        since = "0.16.0",
42        note = "Spotify has removed this field. See https://github.com/ramsayleung/rspotify/issues/550"
43    )]
44    pub explicit_content: Option<ExplicitContent>,
45    #[deprecated(
46        since = "0.16.0",
47        note = "Spotify has removed this field. See https://github.com/ramsayleung/rspotify/issues/550"
48    )]
49    pub followers: Option<Followers>,
50    pub href: String,
51    pub id: UserId<'static>,
52    pub images: Option<Vec<Image>>,
53    #[deprecated(
54        since = "0.16.0",
55        note = "Spotify has removed this field. See https://github.com/ramsayleung/rspotify/issues/550"
56    )]
57    pub product: Option<SubscriptionLevel>,
58}
59
60/// Explicit content setting object
61#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, Default)]
62pub struct ExplicitContent {
63    pub filter_enabled: bool,
64    pub filter_locked: bool,
65}