MCPcopy
hub / github.com/cli/cli / addLabels

Function addLabels

pkg/cmd/pr/shared/editable_http.go:152–167  ·  view source on GitHub ↗
(httpClient *http.Client, id string, repo ghrepo.Interface, labels []string)

Source from the content-addressed store, hash-verified

150}
151
152func addLabels(httpClient *http.Client, id string, repo ghrepo.Interface, labels []string) error {
153 params := githubv4.AddLabelsToLabelableInput{
154 LabelableID: id,
155 LabelIDs: *ghIds(&labels),
156 }
157
158 var mutation struct {
159 AddLabelsToLabelable struct {
160 Typename string `graphql:"__typename"`
161 } `graphql:"addLabelsToLabelable(input: $input)"`
162 }
163
164 variables := map[string]interface{}{"input": params}
165 gql := api.NewClientFromHTTP(httpClient)
166 return gql.Mutate(repo.RepoHost(), "LabelAdd", &mutation, variables)
167}
168
169func removeLabels(httpClient *http.Client, id string, repo ghrepo.Interface, labels []string) error {
170 params := githubv4.RemoveLabelsFromLabelableInput{

Callers 1

UpdateIssueFunction · 0.85

Calls 4

NewClientFromHTTPFunction · 0.92
ghIdsFunction · 0.85
MutateMethod · 0.65
RepoHostMethod · 0.65

Tested by

no test coverage detected