Hi I just started looking into GraphQL. Don’t really understand it yet but I’m getting there.
I’m playing around with the Github API. I’m trying to do a query to find all repositories matching specific names, from an array like: [“repo A”, “repo B”, “repo C”].
Something like this: (this example is pseudo though)
query {
repositoryOwner(login: "beinnor") {
repositories (first: 10, *** matchingNames: ["repo A", "repo B", "repo C"] ***) {
nodes {
name
}
}
}
}
Instead of getting the first 10 repos, i only want to get those in the array.
I’ve played around with the GitHub GraphQL API a bit, so now I realize that my previous response was irrelevant.
Trying to do a query without the “first” or “last” parameter gave me the following error:
{
"data": {
"repositoryOwner": null
},
"errors": [
{
"type": "MISSING_PAGINATION_BOUNDADRIES",
"path": [
"repositoryOwner",
"repositories"
],
"locations": [
{
"line": 3,
"column": 5
}
],
"message": "You must provide a `first` or `last` value to properly paginate the `repositories` connection."
}
]
}
If you enter a value larger than 100, say, 1000 for first, you’ll get the error message:
“Requesting 1000 records on the repositories connection exceeds the first limit of 100 records.”
As for finding a user’s repositories by names, maybe you could create the array of names on your end, loop through it, and for each name make the following graphql query:
query {
repository(owner: "bobjz" name: "repo-name") {
description
// other fields of interest
}
}
I could be wrong, but just using the GitHub GraphQL API Explorer isn’t going to get you what you want; you’ll have to build your own application.
Maybe somebody with more info will chime in…