diff options
author | David Blajda <blajda@hotmail.com> | 2018-12-20 23:42:45 +0000 |
---|---|---|
committer | David Blajda <blajda@hotmail.com> | 2018-12-20 23:42:45 +0000 |
commit | 298806448db4a4e74306ec648bfc0e43a76c6bc3 (patch) | |
tree | 1cdd90df0d65a513ad94588dae7621b03a906b3e /src/bin/main.rs | |
parent | 2bae9a4e8d8b77f8a99df6829547a60f883632a3 (diff) |
Split auth and unauth client and created ClientTrait
Diffstat (limited to 'src/bin/main.rs')
-rw-r--r-- | src/bin/main.rs | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/bin/main.rs b/src/bin/main.rs index c5b7ea2..81f07ff 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -6,17 +6,16 @@ extern crate twitch_api; use futures::future::Future; use std::env; -use twitch_api::Client; use twitch_api::HelixClient; fn main() { dotenv::dotenv().unwrap(); let client_id = &env::var("TWITCH_API").unwrap(); - let client = Client::new(client_id); + let client = HelixClient::new(client_id); let authed_client = - client.helix.clone() + client .authenticate(&env::var("TWITCH_SECRET").unwrap()) .build(); @@ -50,13 +49,21 @@ fn main() { * to become idle but it will never becomes idle since we keep a reference * to a reqwest client which maintains a connection pool. */ - std::mem::drop(authed_client); - std::mem::drop(client); + //std::mem::drop(authed_client); tokio::run( clip.join(clip2) .and_then(|(c1, c2)| { println!("{:?} {:?}", c1, c2); Ok((c1, c2)) + }).and_then(move |_| { + authed_client + .clips() + .clip(&"EnergeticApatheticTarsierThisIsSparta") + .map(|_| ()) + .map_err(|err| { + println!("{:?}", err); + () + }) }) .map(|_| ()) .map_err(|_| ()) |