Twitch API | Rust library for talking with the new Twitch API aka. "Helix", TMI and more!
See documentation for more info.
You can see current unpublished docs here:
See examples for examples.
use twitch_api::helix::HelixClient;
use twitch_oauth2::{AccessToken, UserToken};
use reqwest::Client as ReqwestClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
let client: HelixClient<ReqwestClient> = HelixClient::default();
let token = UserToken::from_existing(
&client,
AccessToken::new("mytoken".to_string()),
None, // Refresh Token
None, // Client Secret
)
.await?;
println!("Channel: {:?}",
client.get_channel_from_login("twitchdev", &token).await?
);
Ok(())
}
Notes
This crate was previously available as twitch_api2
and has since been renamed to twitch_api
Goals
This crate aims to target
- Helix
- TMI
- See implemented endpoints
- Note that TMI is planned to be deprecated, with
Get Chatters
replacing the remaining functionality
- EventSub
- PubSub (without a client)
- See implemented topics
- PubSub is planned to be deprecated, with a EventSub websocket implementation
- Extensions
- No functionality implemented yet
This crate should also be able to be used for
There are no current plans to support
- GraphQL
- Drops (except what is in Helix)
- Twitch IRC Chat, use museun/twitchchat or robotty/twitch-irc
- Authentication, use twitch-rs/twitch_oauth2
- Undocumented Helix endpoints, i.e endpoints mobile Twitch app uses. Including working "hidden" endpoints
Licensed under either of License Apache License, Version 2.0 or MIT license at your option.
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.