MCPcopy
hub / github.com/cli/cli / QueryWithContext

Method QueryWithContext

api/client.go:93–101  ·  view source on GitHub ↗

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{})

Source from the content-addressed store, hash-verified

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.
93func (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.
104func (c Client) REST(hostname string, method string, p string, body io.Reader, data interface{}) error {

Callers 1

fetchDraftReleaseFunction · 0.80

Calls 2

clientOptionsFunction · 0.85
handleResponseFunction · 0.85

Tested by

no test coverage detected