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

Method Mutate

api/client.go:122–130  ·  view source on GitHub ↗

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, GraphQLError will be returned, but the receiver will also be partially populated.

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

Source from the content-addressed store, hash-verified

120// 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,
121// GraphQLError will be returned, but the receiver will also be partially populated.
122func (c Client) Mutate(hostname, name string, mutation any, variables map[string]any) error {
123 opts := clientOptions(hostname, c.http.Transport)
124 opts.Headers[graphqlFeatures] = features
125 gqlClient, err := ghAPI.NewGraphQLClient(opts)
126 if err != nil {
127 return err
128 }
129 return handleResponse(gqlClient.Mutate(name, mutation, variables))
130}
131
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.

Callers

nothing calls this directly

Calls 3

clientOptionsFunction · 0.85
handleResponseFunction · 0.85
MutateMethod · 0.65

Tested by

no test coverage detected