Skip to content

Commit 7916085

Browse files
authored
Merge pull request #686 from github/graphql-queries-update
Clean up variable names, remove broken objects, prettify queries, add pagination example
2 parents 49b2293 + 3ea7079 commit 7916085

26 files changed

+165
-137
lines changed

graphql/queries/1-org-members.graphql

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
query {
2-
organization(login:"github") {
3-
login
4-
name
5-
members(first:100) {
6-
edges {
7-
node {
8-
login
9-
location
10-
}
11-
}
2+
organization(login: "ORG_NAME") {
3+
login
4+
name
5+
members(first: 100) {
6+
edges {
7+
node {
8+
login
9+
location
1210
}
11+
}
1312
}
13+
}
1414
}

graphql/queries/10-mutation-issue-comment-get-issue.graphql

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
query getRepoIssue($orgName: String!, $repoName: String!) {
2+
repository(owner: $orgName, name: $repoName) {
3+
issues(last: 1) {
4+
edges {
5+
node {
6+
number
7+
id
8+
body
9+
}
10+
}
11+
}
12+
}
13+
}
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
# Get ISSUE_ID from graphql/queries/10-query-issue-comment-get-issue.graphql
2+
13
mutation {
24
addComment (
35
input: {
46
body: "Added by GraphQL",
5-
subjectId:"<RETURNED_BY_PREVIOUS_CALL>"
7+
subjectId:"ISSUE_ID"
68
})
79

810
{
911
clientMutationId
1012
}
11-
}
13+
}
Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
1-
query ($orgLogin:String!) {
2-
organization(login: $orgLogin) {
3-
login
4-
name
5-
members(first:100) {
6-
edges {
7-
node {
8-
login
9-
location
10-
}
11-
}
1+
query {
2+
organization(login: "ORG_NAME") {
3+
login
4+
name
5+
membersWithRole(first: 100) {
6+
edges {
7+
node {
8+
login
9+
location
1210
}
11+
}
1312
}
14-
}
15-
16-
variables {
17-
"orgLogin": "bidnessforb"
13+
}
1814
}
Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
{
2-
organization(login: "github") {
3-
login
4-
name
5-
members(first: 100) {
6-
edges {
7-
node {
8-
login
9-
location
10-
}
11-
}
1+
query {
2+
organization(login: "ORG_NAME") {
3+
login
4+
name
5+
members(first: 100) {
6+
edges {
7+
node {
8+
login
9+
location
10+
}
11+
}
12+
edges {
13+
node {
14+
commitComments(first: 3) {
1215
edges {
13-
node {
14-
commitComments(first: 3) {
15-
edges {
16-
node {
17-
id
18-
body
19-
}
20-
}
21-
}
22-
}
16+
node {
17+
id
18+
body
19+
}
2320
}
21+
}
2422
}
23+
}
2524
}
25+
}
2626
}

graphql/queries/4-org-repos-fragment.graphql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
query {
2-
organization(login: "github") {
2+
organization(login: "ORG_NAME") {
33
repositories {
44
...repoFrag
55
}

graphql/queries/5-org-repos-fragment-2.graphql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
query {
2-
organization(login: "github") {
2+
organization(login: "ORG_NAME") {
33
...orgFrag
44
repositories {
55
...repoFrag
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
query getOrg($orgLogin:String!) {
2-
organization(login: $orgLogin) {
1+
query getOrg($orgName:String!) {
2+
organization(login: $orgName) {
33
login
44
name
5-
members(first: 100) {
5+
membersWithRole(first: 100) {
66
edges {
77
node {
88
login
@@ -14,5 +14,5 @@ query getOrg($orgLogin:String!) {
1414
}
1515

1616
variables {
17-
"orgLogin": "github"
18-
}
17+
"orgName": "ORG_NAME"
18+
}

graphql/queries/branches-and-commits-by-repository.graphql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
query getCommitsByBranchByRepo($org:String!, $repo:String!) {
2-
organization(login:$org) {
1+
query getCommitsByBranchByRepo($orgName:String!, $repoName:String!) {
2+
organization(login:$orgName) {
33
name
4-
repository(name:$repo) {
4+
repository(name:$repoName) {
55
name
66
refs(refPrefix: "refs/heads/", first: 10) {
77
nodes {
@@ -33,4 +33,4 @@ query getCommitsByBranchByRepo($org:String!, $repo:String!) {
3333
}
3434
}
3535
}
36-
}
36+
}

0 commit comments

Comments
 (0)