From 54bcdf63d941dbbd0b3e565259515f013f1ecd13 Mon Sep 17 00:00:00 2001 From: David Blajda Date: Thu, 13 Dec 2018 16:50:33 +0000 Subject: Add clip endpoint --- src/lib.rs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'src/lib.rs') 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::>() }) .and_then(|json| json); return f; } + + pub fn clip(&self, id: &str) + -> impl Future, 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::>() + }) + .and_then(|json| json); + + return f; + } } -- cgit v1.2.3