summaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorDavid Blajda <blajda@hotmail.com>2018-12-09 21:51:41 +0000
committerDavid Blajda <blajda@hotmail.com>2018-12-09 21:51:41 +0000
commit89999751d8b0f6c22766af855628e0a93468cec1 (patch)
treeaaca09a259482860e169d0f0db8febf1ade39b71 /src/lib.rs
parent17c6e1ecf82d5a68eccdd62f7a9d757d101759fb (diff)
clean up reqwest code
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 6b75ba0..c509379 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -21,7 +21,7 @@ impl TwitchApi {
}
}
- pub fn users(&mut self, id: Vec<&str>, login: Vec<&str>) -> Box<Future<Item=(), Error=()> + Send> {
+ pub fn users(&mut self, id: Vec<&str>, login: Vec<&str>) -> Box<Future<Item=serde_json::Value, Error=()> + Send> {
let mut headers = header::HeaderMap::new();
let auth_key = &self.client_id;
let header_value = header::HeaderValue::from_str(&auth_key).unwrap();
@@ -65,10 +65,20 @@ impl TwitchApi {
.build().unwrap();
- let mut response = client
+ let mut f = client
.get(&url)
- .send();
+ .send()
+ .map(|mut res| {
+ res.json::<serde_json::Value>()
+ })
+ .and_then(|json| {
+ println!("{:?}", json);
+ json
+ })
+ .map_err(|_| ());
+
+ /*
let f = response
.map_err(|_| ())
.and_then(|res| {
@@ -91,6 +101,7 @@ impl TwitchApi {
})
.map_err(|_| ())
});
+ */
return Box::new(f);
}