From 2e08d0c8abbfb9f989c61acb4f6c580719a65b42 Mon Sep 17 00:00:00 2001 From: David Blajda Date: Thu, 27 Dec 2018 02:29:37 +0000 Subject: :Allow iteration over endpoints that provide pagination --- src/bin/main.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/bin') diff --git a/src/bin/main.rs b/src/bin/main.rs index 81f07ff..982dc9d 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -5,6 +5,7 @@ extern crate tokio; extern crate twitch_api; use futures::future::Future; +use futures::Stream; use std::env; use twitch_api::HelixClient; @@ -35,6 +36,18 @@ fn main() { () }); + let videos = authed_client + .videos() + .by_user("67955580") + .take(10) + .for_each(|collection| { + println!("{:?}", collection); + Ok(()) + }) + .map(|_| ()) + .map_err(|err| {println!("{:?}", err); ()}); + + /* let clip2 = client.kraken .clip(&"EnergeticApatheticTarsierThisIsSparta") @@ -51,6 +64,7 @@ fn main() { */ //std::mem::drop(authed_client); tokio::run( + /* clip.join(clip2) .and_then(|(c1, c2)| { println!("{:?} {:?}", c1, c2); @@ -67,5 +81,7 @@ fn main() { }) .map(|_| ()) .map_err(|_| ()) + */ + videos ); } -- cgit v1.2.3