summaryrefslogtreecommitdiff
path: root/src/kraken/mod.rs
diff options
context:
space:
mode:
authorDavid Blajda <blajda@hotmail.com>2018-12-13 20:56:55 +0000
committerDavid Blajda <blajda@hotmail.com>2018-12-13 20:56:55 +0000
commit8615cc2f030240ba2982dba893fe63f11a0c8a88 (patch)
tree30c7103625323404696331c2384130ce06f8bc96 /src/kraken/mod.rs
parent54bcdf63d941dbbd0b3e565259515f013f1ecd13 (diff)
Restructure project and included kraken endpoint
Diffstat (limited to 'src/kraken/mod.rs')
-rw-r--r--src/kraken/mod.rs33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/kraken/mod.rs b/src/kraken/mod.rs
new file mode 100644
index 0000000..2015781
--- /dev/null
+++ b/src/kraken/mod.rs
@@ -0,0 +1,33 @@
+use reqwest::header;
+use reqwest::r#async::{Chunk, Decoder, Request, Response};
+use reqwest::r#async::Client as ReqwestClient;
+
+mod endpoints;
+mod models;
+
+const ACCEPT: &str = "application/vnd.twitchtv.v5+json";
+pub const API_DOMAIN: &str = "api.twitch.tv";
+
+pub struct Client {
+ id: String,
+}
+
+impl Client {
+ pub fn new(id: &str) -> Client {
+ Client {
+ id: id.to_owned(),
+ }
+ }
+
+ fn create_reqwest_client(&self) -> ReqwestClient {
+ let mut headers = header::HeaderMap::new();
+ let auth_key = &self.id;
+ let client_header = header::HeaderValue::from_str(auth_key).unwrap();
+ let accept_header = header::HeaderValue::from_str(ACCEPT).unwrap();
+ headers.insert("Client-ID", client_header);
+ headers.insert("Accept", accept_header);
+
+ let client = ReqwestClient::builder().default_headers(headers).build().unwrap();
+ client
+ }
+}