Skip to content

Commit d646d4f

Browse files
Added gql_client under rust/client directory
1 parent faa2d44 commit d646d4f

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
name: gql_client
3+
description: Minimal GraphQL client for Rust
4+
url: https://github.com/arthurkhlghatyan/gql-client-rs
5+
github: arthurkhlghatyan/gql-client-rs
6+
---
7+
8+
Usage example
9+
```rust
10+
use gql_client::Client;
11+
12+
#[tokio::main]
13+
async fn main() -> Result<(), Box<dyn std::error::Error>> {
14+
let endpoint = "https://graphqlzero.almansi.me/api";
15+
let query = r#"
16+
query AllPostsQuery {
17+
posts {
18+
data {
19+
id
20+
}
21+
}
22+
}
23+
"#;
24+
25+
let client = Client::new(endpoint);
26+
let data: AllPosts = client.query::<AllPosts>(query).await.unwrap();
27+
28+
println!("{:?}" data);
29+
30+
Ok(())
31+
}
32+
```

0 commit comments

Comments
 (0)