MCPcopy Create free account
hub / github.com/cli/cli / Query

Method Query

api/client.go:134–142  ·  view source on GitHub ↗

Query 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.

(hostname, name string, query any, variables map[string]any)

Source from the content-addressed store, hash-verified

132// Query 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,
133// GraphQLError will be returned, but the receiver will also be partially populated.
134func (c Client) Query(hostname, name string, query any, variables map[string]any) error {
135 opts := clientOptions(hostname, c.http.Transport)
136 opts.Headers[graphqlFeatures] = features
137 gqlClient, err := ghAPI.NewGraphQLClient(opts)
138 if err != nil {
139 return err
140 }
141 return handleResponse(gqlClient.Query(name, query, variables))
142}
143
144// 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,
145// GraphQLError will be returned, but the receiver will also be partially populated.

Callers

nothing calls this directly

Calls 3

clientOptionsFunction · 0.85
handleResponseFunction · 0.85
QueryMethod · 0.65

Tested by

no test coverage detected