Feature Request: filters and batch queries for PRs and branches


#1

Hello, I’ve been getting started with the GraphQL API, and overall, I’m very excited for what it offers.

Some things that have come up often in my application are the need to filter lists. For example, I need to query all branches that start with the prefix trying-. It would be nice if there was a filter argument that would accept a regex to match against. Currently, I work around this by listing everything and filtering on the client side, but most of that’s a waste, since I’m only looking for a few branches.

I also find myself wanting to query all pull requests with the given numbers. It would be nice to have a ids argument that accepted a list of PR numbers and returned a PR for each number instead of having to run a separate graphql query for each ID.

How complex are these features? Hopefully they should be relatively straightforward additions to the API. Thanks!


How can I get multiple users names just from their usernames?
#2

Adding fields for every possible query on the Filter structures seems…overkill (plus, how does one specify disjunctions (idX OR title.startsWith('WIP')) rather than only conjunctions (AND)). Instead, if you only need a few fields for each PR, doing the query shouldn’t be that expensive which is where GraphQL is really useful (instead of getting the 40+ fields unconditionally from REST).


#3

I understand that it might be complicated to add to the API. For me, the expensiveness is more the number of requests that need to be sent over HTTP, 1 request/response versus 10.


#4

What is the query you’re using and why would it require 10 vs. 1?


#5

For example, getting the names of 10 pull requests, whose numbers I know. Instead of sending 10 graphql requests of

query { repository { pullRequest(number: $number) { title } } }

It would be nice to send 1 graphql request like

query { repository { pullRequests(ids: $ids) { title } } }

#6

See this GraphQL issue since this is something I think should be part of the spec, not individual queries.