GitHub API v4 does not show the results for companies when user query is used. If I use repositoryOwner instead, it returns results for both users and companies. However, user query can return more detailed information such as biography, website, location etc. which is not included in repositoryOwner query.
Is there an alternative option covering all type of users?
You can access the User or Organization interface in RepositoryOwner using respectively ... on User & ... on Organization :
{
repositoryOwner(login: "google") {
... on User {
avatarUrl
bio
}
... on Organization {
name
members {
totalCount
}
}
}
}
Try it in the explorer
If the result is an organization it will only returns the fields you specifed in ... on Organization block, if the result is a user it will return the fields specified in ... on User, in this case as google is an organization :
{
"data": {
"repositoryOwner": {
"name": "Google",
"members": {
"totalCount": 1656
}
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With