GraphQL performs a GraphQL request using the query string and parses the response into data receiver. If there are errors in the response, GraphQLError will be returned, but the receiver will also be partially populated.
(hostname string, query string, variables map[string]interface{}, data interface{})
| 55 | // GraphQL performs a GraphQL request using the query string and parses the response into data receiver. If there are errors in the response, |
| 56 | // GraphQLError will be returned, but the receiver will also be partially populated. |
| 57 | func (c Client) GraphQL(hostname string, query string, variables map[string]interface{}, data interface{}) error { |
| 58 | opts := clientOptions(hostname, c.http.Transport) |
| 59 | opts.Headers[graphqlFeatures] = features |
| 60 | gqlClient, err := ghAPI.NewGraphQLClient(opts) |
| 61 | if err != nil { |
| 62 | return err |
| 63 | } |
| 64 | return handleResponse(gqlClient.Do(query, variables, data)) |
| 65 | } |
| 66 | |
| 67 | // Mutate performs a GraphQL mutation based on a struct and parses the response with the same struct as the receiver. If there are errors in the response, |
| 68 | // GraphQLError will be returned, but the receiver will also be partially populated. |