diff options
author | David Blajda <blajda@hotmail.com> | 2018-12-13 16:50:33 +0000 |
---|---|---|
committer | David Blajda <blajda@hotmail.com> | 2018-12-13 16:50:33 +0000 |
commit | 54bcdf63d941dbbd0b3e565259515f013f1ecd13 (patch) | |
tree | a1f74c783ff99744b6852164af5aabd9bd4adb30 /src/lib.rs | |
parent | 0e41bde5b8fca4451e7e39f9fdd4636f408850bb (diff) |
Add clip endpoint
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 22 |
1 files changed, 20 insertions, 2 deletions
@@ -13,7 +13,7 @@ use reqwest::header; use reqwest::r#async::{Chunk, Decoder, Request, Response}; use reqwest::r#async::Client as ReqwestClient; -use self::models::{DataContainer, PaginationContainer, User, Video}; +use self::models::{DataContainer, PaginationContainer, User, Video, Clip}; const API_DOMAIN: &'static str = "api.twitch.tv"; @@ -103,11 +103,29 @@ impl Client { .get(&url) .send() .map(|mut res| { - println!("{:?}", res); res.json::<PaginationContainer<Video>>() }) .and_then(|json| json); return f; } + + pub fn clip(&self, id: &str) + -> impl Future<Item=DataContainer<Clip>, Error=reqwest::Error> + { + let url = + String::from("https://") + + API_DOMAIN + "/helix/clips" + "?id=" + id; + + let f = self.create_client() + .get(&url) + .send() + .map(|mut res| { + println!("{:?}", res); + res.json::<DataContainer<Clip>>() + }) + .and_then(|json| json); + + return f; + } } |