| Crates.io | armature-graphql-client |
| lib.rs | armature-graphql-client |
| version | 0.1.1 |
| created_at | 2025-12-26 19:34:37.868533+00 |
| updated_at | 2025-12-30 22:12:31.768543+00 |
| description | GraphQL client with subscription support for Armature |
| homepage | https://pegasusheavy.github.io/armature |
| repository | https://github.com/pegasusheavy/armature |
| max_upload_size | |
| id | 2006143 |
| size | 89,265 |
GraphQL client with subscription support for the Armature framework.
[dependencies]
armature-graphql-client = "0.1"
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(())
}
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);
}
MIT OR Apache-2.0