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
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug, Clone, Default)]
pub struct Withheld {
    pub copyright: Option<bool>,
    pub country_codes: Option<Vec<String>>,
    pub scope: Option<Scope>,
    #[serde(flatten)]
    extra: std::collections::HashMap<String, serde_json::Value>,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub enum Scope {
    Tweet,
    User,
}

impl std::fmt::Display for Scope {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        match self {
            Self::Tweet => write!(f, "tweet"),
            Self::User => write!(f, "user"),
        }
    }
}

impl Default for Scope {
    fn default() -> Self {
        Self::Tweet
    }
}