armature-graphql-client

Crates.ioarmature-graphql-client
lib.rsarmature-graphql-client
version0.1.1
created_at2025-12-26 19:34:37.868533+00
updated_at2025-12-30 22:12:31.768543+00
descriptionGraphQL client with subscription support for Armature
homepagehttps://pegasusheavy.github.io/armature
repositoryhttps://github.com/pegasusheavy/armature
max_upload_size
id2006143
size89,265
Joseph R. Quinn (quinnjr)

documentation

README

armature-graphql-client

GraphQL client with subscription support for the Armature framework.

Features

  • Query/Mutation - Execute GraphQL operations
  • Subscriptions - Real-time updates via WebSocket
  • Type Generation - Generate types from schema
  • Batching - Automatic query batching
  • Caching - Response caching

Installation

[dependencies]
armature-graphql-client = "0.1"

Quick Start

use armature_graphql_client::{Client, gql};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new("https://api.example.com/graphql");

    // Query
    let query = gql! {
        query GetUser($id: ID!) {
            user(id: $id) {
                id
                name
                email
            }
        }
    };

    let response = client
        .query(query)
        .variable("id", "123")
        .execute()
        .await?;

    Ok(())
}

Subscriptions

let subscription = gql! {
    subscription OnMessage {
        messageAdded {
            id
            text
        }
    }
};

let mut stream = client.subscribe(subscription).await?;

while let Some(message) = stream.next().await {
    println!("New message: {:?}", message);
}

License

MIT OR Apache-2.0

Commit count: 0

cargo fmt