MCPcopy
hub / github.com/cli/cli / GraphQL

Method GraphQL

api/client.go:57–65  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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.
57func (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.

Callers 15

listRulesetsFunction · 0.80
listLabelsFunction · 0.80
listOrgsFunction · 0.80
listIssuesFunction · 0.80
searchIssuesFunction · 0.80
FindIssueOrPRFunction · 0.80
listReposFunction · 0.80
searchReposFunction · 0.80
repoCreateFunction · 0.80
listTemplateRepositoriesFunction · 0.80
LoadSearchResultsMethod · 0.80
PullRequestForRunFunction · 0.80

Calls 3

clientOptionsFunction · 0.85
handleResponseFunction · 0.85
DoMethod · 0.65

Tested by 2

TestGraphQLFunction · 0.64
TestGraphQLErrorFunction · 0.64