Crates.io | twitch-helix |
lib.rs | twitch-helix |
version | 0.1.0 |
source | src |
created_at | 2020-07-23 22:44:34.833157 |
updated_at | 2020-07-23 22:44:34.833157 |
description | API to interact with twitch's Helix API |
homepage | |
repository | https://github.com/Zenithsiz/twitch-helix/ |
max_upload_size | |
id | 268816 |
size | 27,690 |
This library provides a rust API to interact with the
twitch Helix
API, as described here.
The API is focused around describing each request, with the actual
requests being done either outside the crate, or by the Client
type.
The following example shows how to use the library to make a request
to validate an oauth token, receiving a client id and then to query a
stream's info, using tokio
.
use twitch_helix::{Client, OAuthRequest, HelixRequest};
#[tokio::main]
pub async fn main() -> Result<(), Box<dyn std::error::Error>> {
let oauth_token = "<insert your oauth token>";
let mut client = Client::new(oauth_token);
let validation = client
.request_oauth(&twitch_helix::request::oauth::validate::Request)
.await?
.into_result()?;
let channel_info_request = twitch_helix::request::search::channel::Request::new(channel);
let channel_info_response = client
.request_helix(&channel_info_request, &validation.client_id)
.await?
.into_result()?
.data;
let channel_info = channel_info_request.channel(channel_info_response)?;
}