diff --git a/github.graphql b/github.graphql index 0c01e6f..df1fff6 100644 --- a/github.graphql +++ b/github.graphql @@ -17,6 +17,39 @@ extend schema ) type Query { + "All teams in the DaleStudy organization" + teams: [Team]! + @connect( + source: "github" + # https://docs.github.com/en/rest/teams/teams#list-teams + http: { GET: "/orgs/DaleStudy/teams" } + selection: """ + id + name + description + members { + login + id + + } + """ + ) + + "All members of a team in the DaleStudy organization" + members(teamName: String!): [Member]! + @connect( + source: "github" + # https://docs.github.com/en/rest/teams/members#list-team-members + http: { + GET: "/orgs/DaleStudy/teams/{$args.teamName}/members?per_page=100" + } + selection: """ + login + id + avatarUrl: avatar_url + """ + ) + "All trees in the leetcode-study repository" gitTrees: [GitTree]! @connect( @@ -34,7 +67,38 @@ type Query { ) } -"A file or directory in the Git repository" +"A team" +type Team { + "The unique identifier" + id: ID! + "The name" + name: String! + "The description" + description: String + "The members" + members: [Member]! + @connect( + source: "github" + http: { GET: "/orgs/DaleStudy/teams/{$this.name}/members?per_page=100" } + selection: """ + login + id + avatarUrl: avatar_url + """ + ) +} + +"A member" +type Member { + "The unique identifier" + id: ID! + "The login name" + login: String! + "The avatar URL" + avatarUrl: String! +} + +"A Git tree" type GitTree { "The type of the node" type: String! diff --git a/router.yaml b/router.yaml new file mode 100644 index 0000000..211cda5 --- /dev/null +++ b/router.yaml @@ -0,0 +1,15 @@ +supergraph: + listen: 0.0.0.0:8080 +include_subgraph_errors: + all: true +cors: + allow_any_origin: true +connectors: + sources: + github.github: + $config: + token: ${env.GITHUB_API_TOKEN} +telemetry: + instrumentation: + spans: + mode: spec_compliant diff --git a/supergraph.yaml b/supergraph.yaml index 18506b6..91e35ce 100644 --- a/supergraph.yaml +++ b/supergraph.yaml @@ -1,6 +1,6 @@ +federation_version: =2.10.0 subgraphs: - products: + github: routing_url: http://ignore schema: - file: products.graphql -federation_version: =2.10.0 + file: github.graphql