[][src]Crate twitch_api2

githubcrates-iodocs-rs


Rust library for talking with the new Twitch API aka. "Helix" and TMI. Use Twitch endpoints fearlessly!

Examples

use twitch_api2::{Client, helix::channels::GetChannelInformationRequest};
use twitch_oauth2::{AppAccessToken, Scope, TokenError, TwitchToken};

let token =
    match AppAccessToken::get_app_access_token(client_id, client_secret, Scope::all()).await {
        Ok(t) => t,
        Err(TokenError::RequestError(e)) => panic!("got error: {:?}", e),
        Err(e) => panic!(e),
    };
let client = Client::new();
let req = GetChannelInformationRequest::builder()
    .broadcaster_id("27620241")
    .build();

println!("{:?}", &client.helix.req_get(req, &token).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.