Package `graphql` provides a GraphQL client implementation.
For more information, see package [`github.com/shurcooL/githubql`](https://github.com/shurcooL/githubql), which is a specialized version targeting GitHub GraphQL API v4. That package is driving the feature development.
**Status:** In active early research and development. The API will change when opportunities for improvement are discovered; it is not yet frozen.
Installation
------------
`graphql` requires Go version 1.8 or later.
```bash
go get -u github.com/shurcooL/graphql
```
Usage
-----
Construct a GraphQL client, specifying the GraphQL server URL. Then, you can use it to make GraphQL queries and mutations.
Some GraphQL servers may require authentication. The `graphql` package does not directly handle authentication. Instead, when creating a new client, you're expected to pass an `http.Client` that performs authentication. The easiest and recommended way to do this is to use the [`golang.org/x/oauth2`](https://golang.org/x/oauth2) package. You'll need an OAuth token with the right scopes. Then:
However, that'll only work if the arguments are constant and known in advance. Otherwise, you will need to make use of variables. Replace the constants in the struct field tag with variable names:
| [example/graphqldev](https://godoc.org/github.com/shurcooL/graphql/example/graphqldev) | graphqldev is a test program currently being used for developing graphql package. |
| [ident](https://godoc.org/github.com/shurcooL/graphql/ident) | Package ident provides functions for parsing and converting identifier names between various naming convention. |
| [internal/jsonutil](https://godoc.org/github.com/shurcooL/graphql/internal/jsonutil) | Package jsonutil provides a function for decoding JSON into a GraphQL query data structure. |