Use GraphQL to efficiently request details of multiple repositories (enhancement)
jamestelfer opened this issue · 1 comments
Proposed enhancement to use the GH GraphQL API to retrieve repository details in batches, instead of one by one via REST. This would be useful for the list supplied to --repo
, as well as the code search functionality introduced in #399.
Coming from a suggestion in #399:
Nice to have (no need if you don't want to) would be to use the v4 (GraphQL) API to fetch all of these with one request.
That is true for--repo
as well, but maybe even more here since I guess it will normally be more returns.
On further investigation, I was uncertain whether the GraphQL API would supply all the required information:
I'm not sure that there's a direct equivalent of the permissions element returned by REST. There's a similar field (viewerPermission), but it has some caveats.
The users permission level on the repository. Will return null if authenticated as an GitHub App.
Prototyping query
{
repository(owner: "lindell", name: "multi-gitter") {
name
nameWithOwner
owner {
login
}
defaultBranchRef {
name
}
createdAt
isArchived
isDisabled
isFork
sshUrl
url
viewerPermission
repositoryTopics(last: 50) {
nodes {
topic {
name
}
}
}
}
}