summaryrefslogtreecommitdiff
path: root/src/kraken/mod.rs
diff options
context:
space:
mode:
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
+ }
+}