View Source GitHub.GraphQL (GitHub GraphQL Smart Cell v0.1.0)
Link to this section Summary
Link to this section Functions
Make a paginated query against the GitHub GraphQL API
This requires that the query itself support pagination.
- The query must define
$first: Int
and$after: String
variables - The query must use the
$first
and$after
variables - The query must request
pageInfo { hasNextPage, endCursor }
example-query-that-supports-automatic-pagination
Example query that supports automatic pagination
query($first: Int, $after: String) {
viewer {
followers(first: $first, after: $after) {
pageInfo {
endCursor
hasNextPage
}
nodes {
databaseId
}
}
}
}
The nodes
data will be collected into a list and returned.
Query the GitHub GraphQL API
Nothing fancy here like GitHub.GraphQL.paginate
: the query is simply
submitted and the response lightly parsed.
The happy path is a response with a 200 status code and a body that contains
a "data" field. If this is the case then {:ok, data}
is returned.
Otherwise various well known error conditions are recognized and will be
returned as {:error, some_error_value}