Crates.io | github-gql-rs |
lib.rs | github-gql-rs |
version | 0.0.1 |
source | src |
created_at | 2017-09-26 01:03:42.312451 |
updated_at | 2017-09-26 01:03:42.312451 |
description | Pure Rust bindings to the Github V4 API using GraphQL |
homepage | https://github.com/mgattozzi/github-rs |
repository | https://github.com/mgattozzi/github-rs.git |
max_upload_size | |
id | 33116 |
size | 29,062 |
Given that this is a bit more free form a full on GraphQL library for client queries has not been made. Please refer to the GitHub V4 API docs for queries you can make.
github-gql-rs is intended to work on all tier 1 supported Rust systems:
Due to the use of certain features githubgql--rs requires rustc version 1.18 or higher.
Add the following to your Cargo.toml
[dependencies]
github-gql-rs = "0.01"
Then in your lib.rs
or main.rs
file add:
extern crate github_gql;
use github_gql::client::Github;
Now you can start making queries. Here's a small example to get your user information:
extern crate github_gql as gh;
extern crate serde_json;
use gh::client::Github;
use gh::query::Query;
use serde_json::Value;
fn main() {
let mut g = Github::new("YOUR API TOKEN GOES HERE").unwrap();
let (headers, status, json) = g.query::<Value>(
&Query::new_raw("query { viewer { login } }")
).unwrap();
println!("{}", headers);
println!("{}", status);
if let Some(json) = json {
println!("{}", json);
}
// This will update https://github.com/octocat/Hello-World/issues/349
// with a HOORAY emoji!
let (headers, status, json) = g.mutation::<Value>(
&Mutation::new_raw(
"mutation AddReactionToIssue { \
addReaction( input: { subjectId: \\\"MDU6SXNzdWUyMzEzOTE1NTE=\\\", content: HOORAY } ) { \
reaction { \
content \
} \
subject { \
id \
} \
} \
}")
).unwrap();
println!("{}", headers);
println!("{}", status);
if let Some(json) = json {
println!("{}", json);
}
}
See CONTRIBUTING.md for more information.
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.