-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider AutoPaging Optionally Returning Edges #197
Comments
Totally agree! It seems GraphQL has much better performance (compared to Octokit) but things like this make it pretty hard to migrate 😢 |
I just hit this scenario too, also on the var collaboratorQuery = new Query()
.Repository(Var("repo"), Var("owner"))
.Collaborators(query: Var("author"))
.Select(c => new
{
c.PageInfo.HasNextPage,
c.PageInfo.EndCursor,
Users = c.Edges.Select(e => new
{
e.Node.Login,
e.Permission
}).ToList()
})
.Compile();
while (true)
{
string? afterCursor = null;
var collaborators = await connection.Run(collaboratorQuery, new Dictionary<string, object?>
{
{ "owner", owner },
{ "repo", repo },
{ "author", data.PullRequest.Author },
{ "after_cursor", afterCursor }
});
var author = collaborators.Users.SingleOrDefault(user => string.Equals(user.Login, data.PullRequest.Author, StringComparison.InvariantCultureIgnoreCase));
if (author is not null)
{
Console.WriteLine($"Collaborator:");
Console.WriteLine($" Login: {author.Login}");
Console.WriteLine($" Permission: {author.Permission}");
break;
}
if (collaborators.HasNextPage)
{
afterCursor = collaborators.EndCursor;
}
else
{
Console.WriteLine($"Author '{data.PullRequest.Author}' is not a collaborator in this repository.");
break;
}
} |
I'm also comping up against this. Would be keen to pick this up if that's OK (I see it's 'up for grabs')? In my head the solution I was going to suggest was to add an optional argument to |
A lot of times there is important information on the
Edge
(E.g.,LanguageEdge
has size in bytes,CollaboratorEdge
hasRepositoryPermisson
) and the implementation of autopaging only returns the underlying node. Unless I'm missing something, this means anytime you need information from the edge you are required to fall back to manual paging.It looks like
AllPages
could be modified to optionally return anIQueryableList
ofEdges
rather thanNodes
. Is that modification something that you would be in favor of? Was this considered and discarded?The text was updated successfully, but these errors were encountered: