Skip to content

Commit 540bd46

Browse files
authored
Merge pull request #2 from DaleStudy/github-teams
feat: update GraphQL schema for teams and members
2 parents f6f7a8c + b73efb2 commit 540bd46

File tree

3 files changed

+83
-4
lines changed

3 files changed

+83
-4
lines changed

github.graphql

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,39 @@ extend schema
1717
)
1818

1919
type Query {
20+
"All teams in the DaleStudy organization"
21+
teams: [Team]!
22+
@connect(
23+
source: "github"
24+
# https://docs.github.com/en/rest/teams/teams#list-teams
25+
http: { GET: "/orgs/DaleStudy/teams" }
26+
selection: """
27+
id
28+
name
29+
description
30+
members {
31+
login
32+
id
33+
34+
}
35+
"""
36+
)
37+
38+
"All members of a team in the DaleStudy organization"
39+
members(teamName: String!): [Member]!
40+
@connect(
41+
source: "github"
42+
# https://docs.github.com/en/rest/teams/members#list-team-members
43+
http: {
44+
GET: "/orgs/DaleStudy/teams/{$args.teamName}/members?per_page=100"
45+
}
46+
selection: """
47+
login
48+
id
49+
avatarUrl: avatar_url
50+
"""
51+
)
52+
2053
"All trees in the leetcode-study repository"
2154
gitTrees: [GitTree]!
2255
@connect(
@@ -34,7 +67,38 @@ type Query {
3467
)
3568
}
3669

37-
"A file or directory in the Git repository"
70+
"A team"
71+
type Team {
72+
"The unique identifier"
73+
id: ID!
74+
"The name"
75+
name: String!
76+
"The description"
77+
description: String
78+
"The members"
79+
members: [Member]!
80+
@connect(
81+
source: "github"
82+
http: { GET: "/orgs/DaleStudy/teams/{$this.name}/members?per_page=100" }
83+
selection: """
84+
login
85+
id
86+
avatarUrl: avatar_url
87+
"""
88+
)
89+
}
90+
91+
"A member"
92+
type Member {
93+
"The unique identifier"
94+
id: ID!
95+
"The login name"
96+
login: String!
97+
"The avatar URL"
98+
avatarUrl: String!
99+
}
100+
101+
"A Git tree"
38102
type GitTree {
39103
"The type of the node"
40104
type: String!

router.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
supergraph:
2+
listen: 0.0.0.0:8080
3+
include_subgraph_errors:
4+
all: true
5+
cors:
6+
allow_any_origin: true
7+
connectors:
8+
sources:
9+
github.github:
10+
$config:
11+
token: ${env.GITHUB_API_TOKEN}
12+
telemetry:
13+
instrumentation:
14+
spans:
15+
mode: spec_compliant

supergraph.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
federation_version: =2.10.0
12
subgraphs:
2-
products:
3+
github:
34
routing_url: http://ignore
45
schema:
5-
file: products.graphql
6-
federation_version: =2.10.0
6+
file: github.graphql

0 commit comments

Comments
 (0)