Twitch API2 | 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_api2::{TwitchClient, helix::channels::GetChannelInformationRequest};
use twitch_oauth2::{AccessToken, Scope, TwitchToken, tokens::errors::TokenError, UserToken, client::reqwest_http_client};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
let client_id = twitch_oauth2::ClientId::new("validclientid".to_string());
let token = UserToken::from_existing(
reqwest_http_client,
AccessToken::new("mytoken".to_string()),
None, None, )
.await?;
let client: TwitchClient<reqwest::Client> = TwitchClient::default();
let req = GetChannelInformationRequest::builder()
.broadcaster_id("12826")
.build();
println!("{:?}", &client.helix.req_get(req, &token).await?.data.unwrap().title);
Ok(())
}
Goals
This crate aims to target
This crate should also be able to be used for
There are no current plans to support
Implemented endpoints
Helix
Moderation
Endpoint |
|
|
✔ Check AutoMod Status |
POST https://api.twitch.tv/helix/moderation/enforcements/status |
|
✔ Get Banned Users |
GET https://api.twitch.tv/helix/moderation/banned |
|
✔ Get Banned Events |
GET https://api.twitch.tv/helix/moderation/banned/events |
|
✔ Get Moderators |
GET https://api.twitch.tv/helix/moderation/moderators |
|
✔ Get Moderator Events |
GET https://api.twitch.tv/helix/moderation/moderators/events |
|
Channels
Endpoint |
|
|
✔ Start Commercial |
POST https://api.twitch.tv/helix/channels/commercial |
|
✔ Get Channel Information |
GET https://api.twitch.tv/helix/channels |
|
✔ Modify Channel Information |
PATCH https://api.twitch.tv/helix/channels |
|
Analytics
Endpoint |
|
|
🔨 Get Extension Analytics |
GET https://api.twitch.tv/helix/analytics/extensions |
|
🔨 Get Game Analytics |
GET https://api.twitch.tv/helix/analytics/games |
|
Bits
Endpoint |
|
|
✔ Get Cheermotes |
GET https://api.twitch.tv/helix/bits/cheermotes |
|
✔ Get Bits Leaderboard |
GET https://api.twitch.tv/helix/bits/leaderboard |
|
Extensions
Endpoint |
|
|
🔨 Get Extension Transactions |
GET https://api.twitch.tv/helix/extensions/transactions |
|
Channel Points
Endpoint |
|
|
🔨 Create Custom Rewards |
POST https://api.twitch.tv/helix/channel_points/custom_rewards |
|
🔨 Delete Custom Rewards |
DELETE https://api.twitch.tv/helix/channel_points/custom_rewards |
|
🔨 Get Custom Reward |
GET https://api.twitch.tv/helix/channel_points/custom_rewards |
|
✔ Get Custom Reward Redemption |
GET https://api.twitch.tv/helix/channel_points/custom_rewards/redemptions |
|
🔨 Update Custom Reward |
PATCH https://api.twitch.tv/helix/channel_points/custom_rewards |
|
✔ Update Redemption Status |
PATCH https://api.twitch.tv/helix/channel_points/custom_rewards/redemptions |
|
Clips
Endpoint |
|
|
🔨 Create Clip |
POST https://api.twitch.tv/helix/clips |
|
✔ Get Clips |
GET https://api.twitch.tv/helix/clips |
|
Entitlements
Endpoint |
|
|
🔨 Create Entitlement Grants Upload URL |
POST https://api.twitch.tv/helix/entitlements/upload |
|
🔨 Get Code Status |
GET https://api.twitch.tv/helix/entitlements/codes |
|
🔨 Redeem Code |
POST https://api.twitch.tv/helix/entitlements/code |
|
EventSub
Endpoint |
|
|
🔨 Create EventSub Subscription |
POST https://api.twitch.tv/helix/eventsub/subscriptions |
|
🔨 Delete EventSub Subscription |
DELETE https://api.twitch.tv/helix/eventsub/subscriptions |
|
🔨 Get EventSub Subscriptions |
GET https://api.twitch.tv/helix/eventsub/subscriptions |
|
Games
Endpoint |
|
|
✔ Get Top Games |
GET https://api.twitch.tv/helix/games/top |
|
✔ Get Games |
GET https://api.twitch.tv/helix/games |
|
Search
Endpoint |
|
|
✔ Search Categories |
GET https://api.twitch.tv/helix/search/categories |
|
✔ Search Channels |
GET https://api.twitch.tv/helix/search/channels |
|
Streams
Endpoint |
|
|
🔨 Get Stream Key |
https://api.twitch.tv/helix/streams/key |
|
✔ Get Streams |
GET https://api.twitch.tv/helix/streams |
|
🔨 Create Stream Marker |
POST https://api.twitch.tv/helix/streams/markers |
|
🔨 Get Stream Markers |
GET https://api.twitch.tv/helix/streams/markers |
|
✔ Get Stream Tags |
GET https://api.twitch.tv/helix/streams/tags |
|
🔨 Replace Stream Tags |
PUT https://api.twitch.tv/helix/streams/tags |
|
Subscriptions
Endpoint |
|
|
✔ Get Broadcaster Subscriptions |
GET https://api.twitch.tv/helix/subscriptions |
|
✔ Get Broadcaster Subscriptions Events |
GET https://api.twitch.tv/helix/subscriptions/events |
|
Tags
Endpoint |
|
|
✔ Get All Stream Tags |
GET https://api.twitch.tv/helix/tags/streams |
|
Users
Endpoint |
|
|
✔ Create User Follows |
POST https://api.twitch.tv/helix/users/follows |
|
✔ Delete User Follows |
DELETE https://api.twitch.tv/helix/users/follows |
|
✔ Get Users |
GET https://api.twitch.tv/helix/users |
|
✔ Get Users Follows |
GET https://api.twitch.tv/helix/users/follows |
|
🔨 Update User |
PUT https://api.twitch.tv/helix/users |
|
🔨 Get User Extensions |
GET https://api.twitch.tv/helix/users/extensions/list |
|
🔨 Get User Active Extensions |
GET https://api.twitch.tv/helix/users/extensions |
|
🔨 Update User Extensions |
PUT https://api.twitch.tv/helix/users/extensions |
|
Videos
Endpoint |
|
|
✔ Get Videos |
GET https://api.twitch.tv/helix/videos |
|
Webhooks
Endpoint |
|
|
✔ Get Webhook Subscriptions |
GET https://api.twitch.tv/helix/webhooks/subscriptions |
|
Hypetrain
Endpoint |
|
|
✔ Get Hype Train Events |
GET https://api.twitch.tv/helix/hypetrain/events |
|
TMI
Endpoint |
|
✔ Get Chatters |
https://tmi.twitch.tv/group/user/{broadcaster}/chatters |
✔ Get Hosts |
https://tmi.twitch.tv/hosts |
PubSub
Endpoint |
Topic |
|
🔨 Bits V1 |
channel-bits-events-v1.<channel ID> |
|
✔ Bits V2 |
channel-bits-events-v2.<channel ID> |
|
✔ Bits Badge Notificaton |
channel-bits-badge-unlocks.<channel_id> |
|
✔ Channel Points |
channel-points-channel-v1.<channel_id> |
|
✔ Channel Subscriptions |
channel-subscribe-events-v1.<channel ID> |
|
✔ Chat Moderator Actions |
chat_moderator_actions.<channel ID> |
|
✔ Chat Moderator Actions (undocumented) |
chat_moderator_actions.<channel ID>.<user_id> |
|
🔨 Whispers |
whispers.<user ID> |
|
✔ Channel Cheer Events |
channel-cheer-events-public-v1.<user ID> |
|
✔ Channel Sub Gifts V1 |
channel-sub-gifts-v1.<user ID> |
|
✔ Following |
following.<user ID> |
|
✔ Hype Train Events V1 |
hype-train-events-v1.<user ID> |
|
✔ Hype Train Events V1 Rewards |
hype-train-events-v1.<user ID> |
|
✔ Raid |
raid.<user ID> |
|
✔ Video Playback |
video-playback.<username> |
|
✔ Video Playback By ID |
video-playback-by-id.<user ID> |
|
Webhooks
Endpoint |
Topic |
|
✔ Topic: User Follows |
https://api.twitch.tv/helix/users/follows |
|
✔ Topic: Stream Changed |
https://api.twitch.tv/helix/streams |
|
✔ Topic: User Changed |
https://api.twitch.tv/helix/users |
|
🔨 Topic: Extension Transaction Created |
https://api.twitch.tv/helix/extensions/transactions |
|
✔ Topic: Moderator Change Events |
https://api.twitch.tv/helix/moderation/moderators/events |
|
✔ Topic: Channel Ban Change Events |
https://api.twitch.tv/helix/moderation/banned/events |
|
✔ Topic: Subscription Events |
https://api.twitch.tv/helix/subscriptions/events |
|
✔ Topic: Hype Train Event |
https://api.twitch.tv/helix/hypetrain/events |
|