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
use serde_derive::*;
use serde_json::Value;

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Tweet {
    pub created_at: String,
    pub id: u64,
    pub id_str: String,
    pub text: String,
    pub truncated: bool,
    pub entities: Box<TweetEntities>,
    pub metadata: Option<TweetMetadata>,
    pub source: String,
    pub user: Value, //TODO: implement correct type

    pub in_reply_to_status_id: Option<u64>,
    pub in_reply_to_status_id_str: Option<String>,
    pub in_reply_to_user_id: Option<u64>,
    pub in_reply_to_user_id_str: Option<String>,
    pub in_reply_to_screen_name: Option<String>,

    pub geo: Option<Value>,          //TODO: implement correct type
    pub coordinates: Option<Value>,  //TODO: implement correct type
    pub place: Option<Value>,        //TODO: implement correct type
    pub contributors: Option<Value>, //TODO: implement correct type
    pub is_quote_status: bool,
    pub quoted_status_id: Option<u64>,
    pub quoted_status_id_str: Option<String>,

    pub quoted_status: Option<Value>, //TODO: implement correct type

    pub retweet_count: u64,
    pub favorite_count: u64,
    pub favorited: bool,
    pub retweeted: bool,
    pub possibly_sensitive: Option<bool>,
    pub lang: String,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct TweetEntities {
    hashtags: Value,
    symbols: Value,
    user_mentions: Value,
    urls: Vec<EntityUrls>,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct EntityUrls {
    url: String,
    expanded_url: String,
    display_url: String,
    indices: Vec<u64>,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct TweetMetadata {
    iso_language_code: String,
    result_type: String,
}