Dinnerbone / twitch_api2

Libraries for managing twitch api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Twitch API2 | Rust library for talking with the new Twitch API aka. "Helix", TMI and more!

githubcrates-iodocs-rs-big

See documentation for more info.

You can see current unpublished docs here: local-docs

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,
    )
    .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 docs-rs twitch-reference
✔ Get Banned Users GET https://api.twitch.tv/helix/moderation/banned docs-rs twitch-reference
✔ Get Banned Events GET https://api.twitch.tv/helix/moderation/banned/events docs-rs twitch-reference
✔ Get Moderators GET https://api.twitch.tv/helix/moderation/moderators docs-rs twitch-reference
✔ Get Moderator Events GET https://api.twitch.tv/helix/moderation/moderators/events docs-rs twitch-reference

Channels

Endpoint
✔ Start Commercial POST https://api.twitch.tv/helix/channels/commercial docs-rs twitch-reference
✔ Get Channel Information GET https://api.twitch.tv/helix/channels docs-rs twitch-reference
✔ Modify Channel Information PATCH https://api.twitch.tv/helix/channels docs-rs twitch-reference

Analytics

Endpoint
🔨 Get Extension Analytics GET https://api.twitch.tv/helix/analytics/extensions twitch-reference
🔨 Get Game Analytics GET https://api.twitch.tv/helix/analytics/games twitch-reference

Bits

Endpoint
✔ Get Cheermotes GET https://api.twitch.tv/helix/bits/cheermotes docs-rs twitch-reference
✔ Get Bits Leaderboard GET https://api.twitch.tv/helix/bits/leaderboard docs-rs twitch-reference

Extensions

Endpoint
🔨 Get Extension Transactions GET https://api.twitch.tv/helix/extensions/transactions twitch-reference

Clips

Endpoint
🔨 Create Clip POST https://api.twitch.tv/helix/clips twitch-reference
✔ Get Clips GET https://api.twitch.tv/helix/clips docs-rs twitch-reference

Entitlements

Endpoint
🔨 Create Entitlement Grants Upload URL POST https://api.twitch.tv/helix/entitlements/upload twitch-reference
🔨 Get Code Status GET https://api.twitch.tv/helix/entitlements/codes twitch-reference
🔨 Redeem Code POST https://api.twitch.tv/helix/entitlements/code twitch-reference

Games

Endpoint
✔ Get Top Games GET https://api.twitch.tv/helix/games/top docs-rs twitch-reference
✔ Get Games GET https://api.twitch.tv/helix/games docs-rs twitch-reference

Search

Endpoint
✔ Search Categories GET https://api.twitch.tv/helix/search/categories docs-rs twitch-reference
✔ Search Channels GET https://api.twitch.tv/helix/search/channels docs-rs twitch-reference

Streams

Endpoint
🔨 Get Stream Key https://api.twitch.tv/helix/streams/key twitch-reference
✔ Get Streams GET https://api.twitch.tv/helix/streams docs-rs twitch-reference
🔨 Create Stream Marker POST https://api.twitch.tv/helix/streams/markers twitch-reference
🔨 Get Stream Markers GET https://api.twitch.tv/helix/streams/markers twitch-reference
✔ Get Stream Tags GET https://api.twitch.tv/helix/streams/tags docs-rs twitch-reference
🔨 Replace Stream Tags PUT https://api.twitch.tv/helix/streams/tags twitch-reference

Subscriptions

Endpoint
✔ Get Broadcaster Subscriptions GET https://api.twitch.tv/helix/subscriptions docs-rs twitch-reference

Tags

Endpoint
✔ Get All Stream Tags GET https://api.twitch.tv/helix/tags/streams docs-rs twitch-reference

Users

Endpoint
✔ Create User Follows POST https://api.twitch.tv/helix/users/follows  docs-rs twitch-reference
✔ Delete User Follows DELETE https://api.twitch.tv/helix/users/follows docs-rs twitch-reference
✔ Get Users GET https://api.twitch.tv/helix/users docs-rs twitch-reference
✔ Get Users Follows GET https://api.twitch.tv/helix/users/follows docs-rs twitch-reference
🔨 Update User PUT https://api.twitch.tv/helix/users twitch-reference
🔨 Get User Extensions GET https://api.twitch.tv/helix/users/extensions/list twitch-reference
🔨 Get User Active Extensions GET https://api.twitch.tv/helix/users/extensions twitch-reference
🔨 Update User Extensions PUT https://api.twitch.tv/helix/users/extensions twitch-reference

Videos

Endpoint
✔ Get Videos GET https://api.twitch.tv/helix/videos docs-rs twitch-reference

Webhooks

Endpoint
🔨 Get Webhook Subscriptions GET https://api.twitch.tv/helix/webhooks/subscriptions twitch-reference

Hypetrain

Endpoint
🔨 Get Hype Train Events GET https://api.twitch.tv/helix/hypetrain/events twitch-reference

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> docs-rs
✔ Bits Badge Notificaton channel-bits-badge-unlocks.<channel_id> docs-rs
✔ Channel Points channel-points-channel-v1.<channel_id> docs-rs
✔ Channel Subscriptions channel-subscribe-events-v1.<channel ID> docs-rs
✔ Chat Moderator Actions chat_moderator_actions.<channel ID> docs-rs
✔ Chat Moderator Actions (undocumented) chat_moderator_actions.<channel ID>.<user_id> docs-rs
🔨 Whispers whispers.<user ID>
✔ Channel Cheer Events channel-cheer-events-public-v1.<user ID> docs-rs
✔ Channel Sub Gifts V1 channel-sub-gifts-v1.<user ID> docs-rs
✔ Following following.<user ID> docs-rs
✔ Hype Train Events V1 hype-train-events-v1.<user ID> docs-rs
✔ Hype Train Events V1 Rewards hype-train-events-v1.<user ID> docs-rs
✔ Raid raid.<user ID> docs-rs
✔ Video Playback video-playback.<username> docs-rs
✔ Video Playback By ID video-playback-by-id.<user ID> docs-rs
License
Licensed under either of 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.

About

Libraries for managing twitch api

License:Apache License 2.0


Languages

Language:Rust 100.0%