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

Method Query

api/client.go:135–143  ·  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

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