diff options
author | Andy Wortman <ixineeringeverywhere@gmail.com> | 2017-10-02 01:27:08 -0700 |
---|---|---|
committer | Andy Wortman <ixineeringeverywhere@gmail.com> | 2017-10-02 01:27:18 -0700 |
commit | ea4e93f01d9e4ef17effae1e9a807bb1977865fe (patch) | |
tree | 08cfbcc32b9fbea5f13fd3447026090f51402274 /tw/events.rs | |
parent | afd61ae0822690f30d37859c806a8d8d843b8c1a (diff) |
move everything to src/
Diffstat (limited to 'tw/events.rs')
-rw-r--r-- | tw/events.rs | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/tw/events.rs b/tw/events.rs deleted file mode 100644 index 0541b0a..0000000 --- a/tw/events.rs +++ /dev/null @@ -1,44 +0,0 @@ -extern crate serde_json; - -pub enum Event { - Deleted { user_id: String, twete_id: String }, - RT_RT { user_id: String, twete_id: String }, - Fav_RT { user_id: String, twete_id: String }, - Fav { user_id: String, twete_id: String }, - Unfav { user_id: String, twete_id: String }, - Followed { user_id: String }, - Unfollowed { user_id: String } -} - -impl Event { - pub fn from_json(structure: serde_json::Map<String, serde_json::Value>) -> Option<Event> { - match &structure["event"].as_str().unwrap() { - &"follow" => Some(Event::Followed { - user_id: structure["source"]["id_str"].as_str().unwrap().to_owned() - }), - &"unfollow" => Some(Event::Unfollowed { - user_id: structure["source"]["id_str"].as_str().unwrap().to_owned() - }), - &"favorite" => Some(Event::Fav { - user_id: structure["source"]["id_str"].as_str().unwrap().to_owned(), - twete_id: structure["target_object"]["id_str"].as_str().unwrap().to_owned() - }), - &"unfavorite" => Some(Event::Unfav { - user_id: structure["source"]["id_str"].as_str().unwrap().to_owned(), - twete_id: structure["target_object"]["id_str"].as_str().unwrap().to_owned() - }), - &"favorited_retweet" => Some(Event::Fav_RT { - user_id: structure["source"]["id_str"].as_str().unwrap().to_owned(), - twete_id: structure["target_object"]["id_str"].as_str().unwrap().to_owned() - }), - &"retweeted_retweet" => Some(Event::RT_RT { - user_id: structure["source"]["id_str"].as_str().unwrap().to_owned(), - twete_id: structure["target_object"]["id_str"].as_str().unwrap().to_owned() - }), -// &"blocked" => Blocked { }, -// &"unblocked" => Unblocked { }, -// &"quoted_tweet" => ???, - e => { println!("unrecognized event: {}", e); None } - } - } -} |