diff --git a/pkg/cmd/issue/edit/edit_test.go b/pkg/cmd/issue/edit/edit_test.go index 389f80e0c..2b0cd87da 100644 --- a/pkg/cmd/issue/edit/edit_test.go +++ b/pkg/cmd/issue/edit/edit_test.go @@ -437,26 +437,22 @@ func mockIssueUpdate(t *testing.T, reg *httpmock.Registry) { reg.Register( httpmock.GraphQL(`mutation IssueUpdate\b`), httpmock.GraphQLMutation(` - { "data": { "updateIssue": { "issue": { - "id": "123" - } } } }`, + { "data": { "updateIssue": { "__typename": "" } } }`, func(inputs map[string]interface{}) {}), ) } func mockIssueUpdateLabels(t *testing.T, reg *httpmock.Registry) { reg.Register( - httpmock.GraphQL(`mutation AddLabels\b`), + httpmock.GraphQL(`mutation LabelAdd\b`), httpmock.GraphQLMutation(` - { "data": { "addLabelsToLabelable": { "labelable": { - } } } }`, + { "data": { "addLabelsToLabelable": { "__typename": "" } } }`, func(inputs map[string]interface{}) {}), ) reg.Register( - httpmock.GraphQL(`mutation RemoveLabels\b`), + httpmock.GraphQL(`mutation LabelRemove\b`), httpmock.GraphQLMutation(` - { "data": { "removeLabelsFromLabelable": { "labelable": { - } } } }`, + { "data": { "removeLabelsFromLabelable": { "__typename": "" } } }`, func(inputs map[string]interface{}) {}), ) } diff --git a/pkg/cmd/pr/edit/edit_test.go b/pkg/cmd/pr/edit/edit_test.go index 1b1de5ac1..00ff74382 100644 --- a/pkg/cmd/pr/edit/edit_test.go +++ b/pkg/cmd/pr/edit/edit_test.go @@ -559,17 +559,15 @@ func mockPullRequestReviewersUpdate(t *testing.T, reg *httpmock.Registry) { func mockPullRequestUpdateLabels(t *testing.T, reg *httpmock.Registry) { reg.Register( - httpmock.GraphQL(`mutation AddLabels\b`), + httpmock.GraphQL(`mutation LabelAdd\b`), httpmock.GraphQLMutation(` - { "data": { "addLabelsToLabelable": { "labelable": { - } } } }`, + { "data": { "addLabelsToLabelable": { "__typename": "" } } }`, func(inputs map[string]interface{}) {}), ) reg.Register( - httpmock.GraphQL(`mutation RemoveLabels\b`), + httpmock.GraphQL(`mutation LabelRemove\b`), httpmock.GraphQLMutation(` - { "data": { "removeLabelsFromLabelable": { "labelable": { - } } } }`, + { "data": { "removeLabelsFromLabelable": { "__typename": "" } } }`, func(inputs map[string]interface{}) {}), ) } diff --git a/pkg/cmd/pr/shared/editable_http.go b/pkg/cmd/pr/shared/editable_http.go index 996eb9467..f9b19cb07 100644 --- a/pkg/cmd/pr/shared/editable_http.go +++ b/pkg/cmd/pr/shared/editable_http.go @@ -108,17 +108,13 @@ func addLabels(httpClient *http.Client, id string, repo ghrepo.Interface, labels var mutation struct { AddLabelsToLabelable struct { - Labelable struct { - Labels struct { - TotalCount int - } - } + Typename string `graphql:"__typename"` } `graphql:"addLabelsToLabelable(input: $input)"` } variables := map[string]interface{}{"input": params} gql := graphql.NewClient(ghinstance.GraphQLEndpoint(repo.RepoHost()), httpClient) - return gql.MutateNamed(context.Background(), "AddLabels", &mutation, variables) + return gql.MutateNamed(context.Background(), "LabelAdd", &mutation, variables) } func removeLabels(httpClient *http.Client, id string, repo ghrepo.Interface, labels []string) error { @@ -129,25 +125,19 @@ func removeLabels(httpClient *http.Client, id string, repo ghrepo.Interface, lab var mutation struct { RemoveLabelsFromLabelable struct { - Labelable struct { - Labels struct { - TotalCount int - } - } + Typename string `graphql:"__typename"` } `graphql:"removeLabelsFromLabelable(input: $input)"` } variables := map[string]interface{}{"input": params} gql := graphql.NewClient(ghinstance.GraphQLEndpoint(repo.RepoHost()), httpClient) - return gql.MutateNamed(context.Background(), "RemoveLabels", &mutation, variables) + return gql.MutateNamed(context.Background(), "LabelRemove", &mutation, variables) } func updateIssue(httpClient *http.Client, repo ghrepo.Interface, params githubv4.UpdateIssueInput) error { var mutation struct { UpdateIssue struct { - Issue struct { - ID string - } + Typename string `graphql:"__typename"` } `graphql:"updateIssue(input: $input)"` } variables := map[string]interface{}{"input": params} @@ -158,9 +148,7 @@ func updateIssue(httpClient *http.Client, repo ghrepo.Interface, params githubv4 func updatePullRequest(httpClient *http.Client, repo ghrepo.Interface, params githubv4.UpdatePullRequestInput) error { var mutation struct { UpdatePullRequest struct { - PullRequest struct { - ID string - } + Typename string `graphql:"__typename"` } `graphql:"updatePullRequest(input: $input)"` } variables := map[string]interface{}{"input": params}