diff options
author | David Blajda <blajda@hotmail.com> | 2018-12-16 20:24:36 +0000 |
---|---|---|
committer | David Blajda <blajda@hotmail.com> | 2018-12-16 20:24:36 +0000 |
commit | 27267ed98fc839b51ae4621fd1aa230f7f068bdc (patch) | |
tree | 94c6899c8ab0a6fae8e8f4f7295e0a027933e703 /src/helix/endpoints.rs | |
parent | be68a7da226743edbce5b52e506d9083e2859578 (diff) |
Prototype of a non-trait based client
Diffstat (limited to 'src/helix/endpoints.rs')
-rw-r--r-- | src/helix/endpoints.rs | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/src/helix/endpoints.rs b/src/helix/endpoints.rs index 80b4ebb..a02bf73 100644 --- a/src/helix/endpoints.rs +++ b/src/helix/endpoints.rs @@ -8,19 +8,7 @@ use super::models::{DataContainer, PaginationContainer, User, Video, Clip}; use super::Client; const API_DOMAIN: &'static str = "api.twitch.tv"; -/* When Client owns a ReqwestClient, any futures spawned do not immediately - * terminate but 'hang'. When creating a new client for each request this problem - * does not occur. This would need to be resolved so we can benefit from keep alive - * connections. - */ - -use super::super::GetRequest; -use super::super::GetRequestRef; -use std::marker::PhantomData; - -use super::HelixClient; - -fn apply_standard_headers(client: &Box<dyn HelixClient>, request: RequestBuilder) +fn apply_standard_headers(client: Client, request: RequestBuilder) -> RequestBuilder { let client_header = header::HeaderValue::from_str(client.id()).unwrap(); @@ -28,7 +16,7 @@ fn apply_standard_headers(client: &Box<dyn HelixClient>, request: RequestBuilder request.header("Client-ID", client_header) } -pub fn clip(client: &Box<dyn HelixClient>, id: &str) +pub fn clip(client: Client, id: &str) -> impl Future<Item=DataContainer<Clip>, Error=reqwest::Error> { let url = |