[][src]Crate twitch_api2

Rust library for talking with the new Twitch API aka. "Helix" and TMI.

githubcrates-iodocs-rs


Use Twitch endpoints fearlessly
use twitch_api2::{Client, helix::channel::GetChannelRequest};
use twitch_oauth2::{AppAccessToken, Scope, TokenError, TwitchToken};

let client =
    match AppAccessToken::get_app_access_token(client_id, client_secret, Scope::all()).await {
        Ok(t) => Client::with_token(t).unwrap(),
        Err(TokenError::RequestError(e)) => panic!("got error: {:?}", e),
        Err(e) => panic!(e),
    };

let req = GetChannelRequest {
    broadcaster_id: client.helix.token().await.as_ref().validate_token().await?.user_id,
};

println!("{:?}", &client.helix.req_get(req).await?.data[0].title);

Re-exports

pub use crate::helix::HelixClient;
pub use crate::tmi::TMIClient;
pub use twitch_oauth2;

Modules

helix

Helix endpoints or the New Twitch API

tmi

TMI Endpoint, twitch's unsupported api for better chatters retrieval

Structs

Client

Client for Twitch APIs.

Enums

Error