See documentation for more info.
You can see current unpublished docs for the main branch here:
See examples for examples. If you want to run them locally, make sure you get the git submodules first.
use twitch_api::helix::HelixClient;
use twitch_api::twitch_oauth2::{AccessToken, UserToken};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
// Create the HelixClient, which is used to make requests to the Twitch API
let client: HelixClient<reqwest::Client> = HelixClient::default();
// Create a UserToken, which is used to authenticate requests
let token = UserToken::from_token(&client, AccessToken::from("mytoken")).await?;
println!(
"Channel: {:?}",
client.get_channel_from_login("twitchdev", &token).await?
);
Ok(())
}
This crate was previously available as twitch_api2
and has since been renamed to twitch_api
This crate aims to target
- Helix
- EventSub
- Extensions
- No functionality implemented yet
- PubSub (without a client)
- See implemented topics
- PubSub is deprecated, replaced with EventSub websockets
There are no current plans to support
- GraphQL
- Drops (except what is in Helix)
- Twitch IRC Chat, use museun/twitch_message or robotty/twitch-irc
- Authentication, use twitch-rs/twitch_oauth2
- Undocumented Helix endpoints, i.e endpoints mobile Twitch app uses. Including working "hidden" endpoints
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.