diff options
author | David Blajda <blajda@hotmail.com> | 2018-12-27 22:03:23 +0000 |
---|---|---|
committer | David Blajda <blajda@hotmail.com> | 2018-12-27 22:03:23 +0000 |
commit | 678e3d3f28cb8594204dc5e2b7597ae66a4582c7 (patch) | |
tree | 55b563cfdc09dab8f18c1f4d688ebf0c2187985c /src/bin/main.rs | |
parent | cb1b144e48ee357a76f551433d4886f092d259c8 (diff) |
Use Id types for endpoints and implement kraken headers
Diffstat (limited to 'src/bin/main.rs')
-rw-r--r-- | src/bin/main.rs | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/src/bin/main.rs b/src/bin/main.rs index ba1482a..15b7753 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -8,26 +8,32 @@ use futures::future::Future; use futures::Stream; use std::env; use twitch_api::HelixClient; +use twitch_api::KrakenClient; +use std::str::FromStr; + +use twitch_api::types::UserId; +use twitch_api::types::ClipId; + fn main() { dotenv::dotenv().unwrap(); let client_id = &env::var("TWITCH_API").unwrap(); - let client = HelixClient::new(client_id); - + let helix_client = HelixClient::new(client_id); + let kraken_client = KrakenClient::new(client_id); - let authed_client = client; /* .authenticate(&env::var("TWITCH_SECRET").unwrap()) .build(); */ - let clip = authed_client + let clip = helix_client .clips() - .clip(&"EnergeticApatheticTarsierThisIsSparta") + .clip(&ClipId::new("EnergeticApatheticTarsierThisIsSparta")) .map_err(|err| { println!("{:?}", err); () }); + /* let clip2 = authed_client .clips() @@ -36,27 +42,31 @@ fn main() { println!("{:?}", err); () }); + */ + + //use twitch_api::types::VideoId; + /* let videos = authed_client .videos() - .by_user("67955580") - .take(10) + .by_user(&UserId::from_str("19571641").unwrap()) + .take(1) .for_each(|collection| { println!("{:?}", collection); Ok(()) }) .map(|_| ()) .map_err(|err| {println!("{:?}", err); ()}); + */ - /* - let clip2 = client.kraken + let clip2 = kraken_client + .clips() .clip(&"EnergeticApatheticTarsierThisIsSparta") .map_err(|err| { println!("{:?}", err); () }); - */ /* Prevents tokio from **hanging** * since tokio::run blocks the current thread and waits for the entire runtime @@ -65,15 +75,16 @@ fn main() { */ //std::mem::drop(authed_client); tokio::run( - /* clip.join(clip2) .and_then(|(c1, c2)| { - println!("{:?} {:?}", c1, c2); + println!("{:?}", c1); + println!("__"); + println!("{:?}", c2); Ok((c1, c2)) }).and_then(move |_| { - authed_client + helix_client .clips() - .clip(&"EnergeticApatheticTarsierThisIsSparta") + .clip(&ClipId::new("EnergeticApatheticTarsierThisIsSparta")) .map(|_| ()) .map_err(|err| { println!("{:?}", err); @@ -82,7 +93,6 @@ fn main() { }) .map(|_| ()) .map_err(|_| ()) - */ - videos + /*videos*/ ); } |