twitch-gql-rs

Crates.iotwitch-gql-rs
lib.rstwitch-gql-rs
version0.2.4
created_at2025-10-19 08:39:01.12768+00
updated_at2026-01-09 09:08:43.800866+00
descriptionGraphQL client and types for interacting with Twitch's GraphQL API.
homepagehttps://github.com/this-is-really/twitch-gql-rs
repository
max_upload_size
id1890218
size107,087
grootar (this-is-really)

documentation

README

TWITCH-GQL-RS

crates.io Documentation github.com

A small, lightweight implementation of a GraphQL client for interacting with Twitch's GraphQL API. Designed for simple queries, typed responses, and easy integration into async Rust applications.

Example

use std::{error::Error, path::Path};
use twitch_gql_rs::{client_type::ClientType, TwitchClient};

async fn example() -> Result<(), Box<dyn std::error::Error>> {
    let path = Path::new("save.json");

    if !path.exists() {
        let client_type = ClientType::android_app();
        let mut client = TwitchClient::new(&client_type).await?;
        let get_auth = client.request_device_auth().await?;
        println!("Please open the following link in your browser:\n{}\nThen enter this code: {}", get_auth.verification_uri, get_auth.user_code);
        client.auth(get_auth).await?;
        client.save_file(&path).await?;
    }

    let client = TwitchClient::load_from_file(&path).await?;
    let inventory = client.get_inventory().await?;
    for in_progress in inventory.inventory.dropCampaignsInProgress {
        for time_based in in_progress.timeBasedDrops {
            if let Some(id) = time_based.self_drop.dropInstanceID {
                println!("{id}")
            }
        }
    }
Ok(())
}
Commit count: 0

cargo fmt