QueryWithContext performs a GraphQL query based on a struct and parses the response with the same struct as the receiver. If there are errors in the response, GraphQLError will be returned, but the receiver will also be partially populated.
(ctx context.Context, hostname, name string, query interface{}, variables map[string]interface{})
| 91 | // QueryWithContext performs a GraphQL query based on a struct and parses the response with the same struct as the receiver. If there are errors in the response, |
| 92 | // GraphQLError will be returned, but the receiver will also be partially populated. |
| 93 | func (c Client) QueryWithContext(ctx context.Context, hostname, name string, query interface{}, variables map[string]interface{}) error { |
| 94 | opts := clientOptions(hostname, c.http.Transport) |
| 95 | opts.Headers[graphqlFeatures] = features |
| 96 | gqlClient, err := ghAPI.NewGraphQLClient(opts) |
| 97 | if err != nil { |
| 98 | return err |
| 99 | } |
| 100 | return handleResponse(gqlClient.QueryWithContext(ctx, name, query, variables)) |
| 101 | } |
| 102 | |
| 103 | // REST performs a REST request and parses the response. |
| 104 | func (c Client) REST(hostname string, method string, p string, body io.Reader, data interface{}) error { |
no test coverage detected