summaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorDavid Blajda <blajda@hotmail.com>2018-12-13 16:50:33 +0000
committerDavid Blajda <blajda@hotmail.com>2018-12-13 16:50:33 +0000
commit54bcdf63d941dbbd0b3e565259515f013f1ecd13 (patch)
treea1f74c783ff99744b6852164af5aabd9bd4adb30 /src/lib.rs
parent0e41bde5b8fca4451e7e39f9fdd4636f408850bb (diff)
Add clip endpoint
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 37c89ca..450ffde 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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;
+ }
}