44
loading...
This website collects cookies to deliver better user experience
Teams
members:me visibility:visible
and run the search
https://github.com/orgs/ORG_NAME/teams?query=members%3Ame+visibility%3Avisible
(subject to change at any time)Secret
or All
if you prefer.{
organization(login: "github") {
totalCount
teams(first: 10, role:MEMBER) {
edges {
node {
name
}
}
}
}
}
query {
viewer {
login
}
}
Organization
based on its login and return its name:query {
# new! replacing the current viewer with organization
organization(login:"github") {
name
}
}
name
will result in an error since the intent of the executed query is to retrieve one or more available fields:{
"errors": [
{
"message": "Parse error on \"}\" (RCURLY) at [5, 3]",
"locations": [
{
"line": 5,
"column": 3
}
]
}
]
}
{
organization(login: "github") {
# new! inclusion of teams and their names
teams(first: 10) {
edges {
node {
name
}
}
}
}
}
edges
and node
are a way of traversing the relationship between a set of objects in GraphQL (check out GraphQL.org's Learn Page on Pagination for more information). Here, we're targeting the github
organization's teams and limiting it to the first 10
(though, you're welcome to choose any number upto 100, which is the global limit of returned objects).role
. By default, it's a null
value and totally optional. For our cases, we can either set role
to ADMIN
or MEMBER
. I'm interested in finding teams that I'm solely a member of:{
organization(login: "github") {
# new! inclusion of `role:MEMBER`
teams(first: 10, role:MEMBER) {
edges {
node {
name
}
}
}
}
}
totalCount
field that's available on all collections. So, for something like say, teams
, we can specify totalCount
as a sibling field to edges
:{
organization(login: "github") {
# new! inclusion of the total number of teams I'm a part of
totalCount
teams(first: 10, role:MEMBER) {
edges {
node {
name
}
}
}
}
}
totalCount
, you can replace the number of teams to fetch by that number. If it's more than 100
, you can use cursors to get the next set of teams (check out this example to get an idea of how this works).