Skip to content

Commit 3ad678e

Browse files
committed
Make the GitHub schema compile
1 parent 655361f commit 3ad678e

File tree

16 files changed

+8764
-25
lines changed

16 files changed

+8764
-25
lines changed

Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,10 @@ graphql_query_derive = {path = "./graphql_query_derive"}
1010
graphql-parser = "*"
1111
serde = "1.0"
1212
serde_derive = "1.0"
13+
14+
[workspace]
15+
members = [
16+
".",
17+
"examples/github",
18+
"graphql_query_derive",
19+
]

examples/github/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target

examples/github/Cargo.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[package]
2+
name = "graphql_query_github_example"
3+
version = "0.1.0"
4+
authors = ["Tom Houlé <[email protected]>"]
5+
6+
[dependencies]
7+
failure = "*"
8+
graphql_query = { path = "../.." }
9+
serde = "1.0"
10+
serde_derive = "1.0"
11+
serde_json = "1.0"
12+
reqwest = "*"

examples/github/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# graphql-client GitHub API examples
2+
3+
The schema is taken from [this repo](https://raw.githubusercontent.com/octokit/graphql-schema/master/schema.graphql).

examples/github/src/main.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
extern crate failure;
2+
#[macro_use]
3+
extern crate graphql_query;
4+
extern crate reqwest;
5+
extern crate serde;
6+
extern crate serde_json;
7+
#[macro_use]
8+
extern crate serde_derive;
9+
10+
use graphql_query::*;
11+
12+
#[derive(GraphQLQuery)]
13+
#[GraphQLQuery(schema_path = "src/schema.graphql", query_path = "src/query_1.graphql")]
14+
struct Query1;
15+
16+
fn main() -> Result<(), failure::Error> {
17+
let q = Query1::build_query(query1::Variables);
18+
Ok(())
19+
}

examples/github/src/query_1.graphql

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
query OctocatRepos {
2+
repository(owner: "octocat", name: "Hello-World") {
3+
issues(last: 20, states: CLOSED) {
4+
edges {
5+
node {
6+
title
7+
url
8+
labels(first: 5) {
9+
edges {
10+
node {
11+
name
12+
}
13+
}
14+
}
15+
}
16+
}
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)