Function twitch_api2::helix::make_stream
source · [−]pub fn make_stream<'a, C: HttpClient<'a> + Send + Sync, T: TwitchToken + ?Sized + Send + Sync, Req: Request + RequestGet + Paginated + Clone + Debug + Send + Sync + 'a, Item: Send + 'a>(
req: Req,
token: &'a T,
client: &'a HelixClient<'a, C>,
fun: impl Fn(<Req as Request>::Response) -> VecDeque<Item> + Send + Sync + Copy + 'static
) -> Pin<Box<dyn Stream<Item = Result<Item, ClientRequestError<<C as HttpClient<'a>>::Error>>> + Send + 'a>> where
<Req as Request>::Response: Send + Sync + Debug + Clone,
Available on crate feature
helix
only.Expand description
Make a paginate-able request into a stream
Examples
use twitch_api2::helix;
use futures::TryStreamExt;
let req = helix::moderation::GetModeratorsRequest::builder()
.broadcaster_id("1234")
.build();
helix::make_stream(req, &token, &client, std::collections::VecDeque::from).try_collect::<Vec<_>>().await?