[][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::{TwitchClient, helix::channels::GetChannelInformationRequest};
use twitch_oauth2::{AppAccessToken, Scope, TwitchToken, tokens::errors::TokenError};

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

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

Re-exports

pub use twitch_oauth2;
pub use client::Client as HttpClient;

Modules

client

Different clients you can use with this crate to call the auth server.

helix

Helix endpoints or the New Twitch API

tmi

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

Structs

HelixClienthelix

Client for Helix or the New Twitch API

TMIClienttmi

Client for the twitch TMI endpoint, almost entirely undocumented and certainly not supported.

TwitchClient

Client for Twitch APIs.