From 7b8ac6a410068059c33b6fa815b51509f6101fae Mon Sep 17 00:00:00 2001 From: Weslei Juan Novaes Pereira Date: Fri, 28 Feb 2020 10:37:18 -0300 Subject: [PATCH 1/9] Added support to delete commit comment --- github/reactions.go | 18 ++++++++++++++++++ github/reactions_test.go | 16 ++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/github/reactions.go b/github/reactions.go index 43c863af61d..6d3b8536fff 100644 --- a/github/reactions.go +++ b/github/reactions.go @@ -8,6 +8,7 @@ package github import ( "context" "fmt" + "net/http" ) // ReactionsService provides access to the reactions-related functions in the @@ -109,6 +110,23 @@ func (s ReactionsService) CreateCommentReaction(ctx context.Context, owner, repo return m, resp, nil } +// DeleteCommentReaction delete the reaction for a commit comment. +// +// GitHub API docs: https://developer.github.com/v3/reactions/#delete-a-commit-comment-reaction +func (s *ReactionsService) DeleteCommentReaction(ctx context.Context, owner, repo string, id, reactionID int64) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions/%v", owner, repo, id, reactionID) + + req, err := s.client.NewRequest(http.MethodDelete, u, nil) + if err != nil { + return nil, err + } + + // TODO: remove custom Accept headers when APIs fully launch. + req.Header.Set("Accept", mediaTypeReactionsPreview) + + return s.client.Do(ctx, req, nil) +} + // ListIssueReactions lists the reactions for an issue. // // GitHub API docs: https://developer.github.com/v3/reactions/#list-reactions-for-an-issue diff --git a/github/reactions_test.go b/github/reactions_test.go index c32274dec53..47eb4c917d1 100644 --- a/github/reactions_test.go +++ b/github/reactions_test.go @@ -340,3 +340,19 @@ func TestReactionsService_DeleteReaction(t *testing.T) { t.Errorf("DeleteReaction returned error: %v", err) } } + +func TestReactionsService_DeleteCommitCommentReaction(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/repos/o/r/comments/1/reactions/2", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "DELETE") + testHeader(t, r, "Accept", mediaTypeReactionsPreview) + + w.WriteHeader(http.StatusNoContent) + }) + + if _, err := client.Reactions.DeleteCommentReaction(context.Background(), "o", "r", 1, 2); err != nil { + t.Errorf("DeleteReaction returned error: %v", err) + } +} From b2c96fca98ca5597df6142ff9785f879a85268cd Mon Sep 17 00:00:00 2001 From: Weslei Juan Novaes Pereira Date: Fri, 28 Feb 2020 10:50:38 -0300 Subject: [PATCH 2/9] Updated message --- github/reactions_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/reactions_test.go b/github/reactions_test.go index 47eb4c917d1..0f3e6d894ef 100644 --- a/github/reactions_test.go +++ b/github/reactions_test.go @@ -353,6 +353,6 @@ func TestReactionsService_DeleteCommitCommentReaction(t *testing.T) { }) if _, err := client.Reactions.DeleteCommentReaction(context.Background(), "o", "r", 1, 2); err != nil { - t.Errorf("DeleteReaction returned error: %v", err) + t.Errorf("DeleteCommentReaction returned error: %v", err) } } From 96ee94989fbf77ad963afc5267a3aae1f1651b92 Mon Sep 17 00:00:00 2001 From: Weslei Juan Novaes Pereira Date: Fri, 28 Feb 2020 11:59:07 -0300 Subject: [PATCH 3/9] Typo and param name --- github/reactions.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/github/reactions.go b/github/reactions.go index 6d3b8536fff..9e062c5995d 100644 --- a/github/reactions.go +++ b/github/reactions.go @@ -110,11 +110,11 @@ func (s ReactionsService) CreateCommentReaction(ctx context.Context, owner, repo return m, resp, nil } -// DeleteCommentReaction delete the reaction for a commit comment. +// DeleteCommentReaction deletes the reaction for a commit comment. // // GitHub API docs: https://developer.github.com/v3/reactions/#delete-a-commit-comment-reaction -func (s *ReactionsService) DeleteCommentReaction(ctx context.Context, owner, repo string, id, reactionID int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions/%v", owner, repo, id, reactionID) +func (s *ReactionsService) DeleteCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions/%v", owner, repo, commentID, reactionID) req, err := s.client.NewRequest(http.MethodDelete, u, nil) if err != nil { From 821eb9681fcea86bcde764cad95e17b56987b36f Mon Sep 17 00:00:00 2001 From: Weslei Juan Novaes Pereira Date: Fri, 28 Feb 2020 12:12:49 -0300 Subject: [PATCH 4/9] Added support to delete reaction by repo_id --- github/reactions.go | 15 ++++++++++++++- github/reactions_test.go | 16 ++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/github/reactions.go b/github/reactions.go index 9e062c5995d..c2c9ced3193 100644 --- a/github/reactions.go +++ b/github/reactions.go @@ -116,7 +116,20 @@ func (s ReactionsService) CreateCommentReaction(ctx context.Context, owner, repo func (s *ReactionsService) DeleteCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions/%v", owner, repo, commentID, reactionID) - req, err := s.client.NewRequest(http.MethodDelete, u, nil) + return s.deleteCommentReaction(ctx, u) +} + +// DeleteCommentReactionByRepoID deletes the reaction for a commit comment by repository ID. +// +// GitHub API docs: https://developer.github.com/v3/reactions/#delete-a-commit-comment-reaction +func (s *ReactionsService) DeleteCommentReactionByRepoID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { + u := fmt.Sprintf("repositories/%v/comments/%v/reactions/%v", repoID, commentID, reactionID) + + return s.deleteCommentReaction(ctx, u) +} + +func (s ReactionsService) deleteCommentReaction(ctx context.Context, url string) (*Response, error) { + req, err := s.client.NewRequest(http.MethodDelete, url, nil) if err != nil { return nil, err } diff --git a/github/reactions_test.go b/github/reactions_test.go index 0f3e6d894ef..90b9eaafc28 100644 --- a/github/reactions_test.go +++ b/github/reactions_test.go @@ -356,3 +356,19 @@ func TestReactionsService_DeleteCommitCommentReaction(t *testing.T) { t.Errorf("DeleteCommentReaction returned error: %v", err) } } + +func TestReactionsService_DeleteCommitCommentReactionByRepoID(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/repositories/1/comments/2/reactions/3", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "DELETE") + testHeader(t, r, "Accept", mediaTypeReactionsPreview) + + w.WriteHeader(http.StatusNoContent) + }) + + if _, err := client.Reactions.DeleteCommentReactionByRepoID(context.Background(), 1, 2, 3); err != nil { + t.Errorf("DeleteCommentReactionByRepoID returned error: %v", err) + } +} From 2a54322d635bcf5eda685718d81e740ebbf87b51 Mon Sep 17 00:00:00 2001 From: Weslei Juan Novaes Pereira Date: Fri, 28 Feb 2020 15:59:08 -0300 Subject: [PATCH 5/9] Add support to delete reactions --- github/reactions.go | 113 +++++++++++++++++++++----- github/reactions_test.go | 168 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 249 insertions(+), 32 deletions(-) diff --git a/github/reactions.go b/github/reactions.go index c2c9ced3193..0973f7b226b 100644 --- a/github/reactions.go +++ b/github/reactions.go @@ -116,7 +116,7 @@ func (s ReactionsService) CreateCommentReaction(ctx context.Context, owner, repo func (s *ReactionsService) DeleteCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions/%v", owner, repo, commentID, reactionID) - return s.deleteCommentReaction(ctx, u) + return s.deleteReaction(ctx, u) } // DeleteCommentReactionByRepoID deletes the reaction for a commit comment by repository ID. @@ -125,19 +125,7 @@ func (s *ReactionsService) DeleteCommentReaction(ctx context.Context, owner, rep func (s *ReactionsService) DeleteCommentReactionByRepoID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { u := fmt.Sprintf("repositories/%v/comments/%v/reactions/%v", repoID, commentID, reactionID) - return s.deleteCommentReaction(ctx, u) -} - -func (s ReactionsService) deleteCommentReaction(ctx context.Context, url string) (*Response, error) { - req, err := s.client.NewRequest(http.MethodDelete, url, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - return s.client.Do(ctx, req, nil) + return s.deleteReaction(ctx, u) } // ListIssueReactions lists the reactions for an issue. @@ -194,6 +182,24 @@ func (s ReactionsService) CreateIssueReaction(ctx context.Context, owner, repo s return m, resp, nil } +// DeleteIssueReaction deletes the reaction to an issue. +// +// GitHub API docs: https://developer.github.com/v3/reactions/#delete-an-issue-reaction +func (s *ReactionsService) DeleteIssueReaction(ctx context.Context, owner, repo string, issueNumber, reactionID int64) (*Response, error) { + url := fmt.Sprintf("repos/%v/%v/issues/%v/reactions/%v", owner, repo, issueNumber, reactionID) + + return s.deleteReaction(ctx, url) +} + +// DeleteIssueReactionByRepoID deletes the reaction to an issue by repository ID. +// +// GitHub API docs: https://developer.github.com/v3/reactions/#delete-an-issue-reaction +func (s *ReactionsService) DeleteIssueReactionByRepoID(ctx context.Context, repoID, issueNumber, reactionID int64) (*Response, error) { + url := fmt.Sprintf("repositories/%v/issues/%v/reactions/%v", repoID, issueNumber, reactionID) + + return s.deleteReaction(ctx, url) +} + // ListIssueCommentReactions lists the reactions for an issue comment. // // GitHub API docs: https://developer.github.com/v3/reactions/#list-reactions-for-an-issue-comment @@ -248,6 +254,24 @@ func (s ReactionsService) CreateIssueCommentReaction(ctx context.Context, owner, return m, resp, nil } +// DeleteIssueCommentReaction deletes the reaction to an issue comment. +// +// GitHub API docs: https://developer.github.com/v3/reactions/#delete-an-issue-comment-reaction +func (s *ReactionsService) DeleteIssueCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) { + url := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions/%v", owner, repo, commentID, reactionID) + + return s.deleteReaction(ctx, url) +} + +// DeleteIssueCommentReactionByRepoID deletes the reaction to an issue comment by repository ID. +// +// GitHub API docs: https://developer.github.com/v3/reactions/#delete-an-issue-comment-reaction +func (s *ReactionsService) DeleteIssueCommentReactionByRepoID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { + url := fmt.Sprintf("repositories/%v/issues/comments/%v/reactions/%v", repoID, commentID, reactionID) + + return s.deleteReaction(ctx, url) +} + // ListPullRequestCommentReactions lists the reactions for a pull request review comment. // // GitHub API docs: https://developer.github.com/v3/reactions/#list-reactions-for-an-issue-comment @@ -302,6 +326,24 @@ func (s ReactionsService) CreatePullRequestCommentReaction(ctx context.Context, return m, resp, nil } +// DeletePullRequestCommentReaction deletes the reaction to a pull request review comment. +// +// GitHub API docs: https://developer.github.com/v3/reactions/#delete-a-pull-request-comment-reaction +func (s *ReactionsService) DeletePullRequestCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) { + url := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions/%v", owner, repo, commentID, reactionID) + + return s.deleteReaction(ctx, url) +} + +// DeletePullRequestCommentReactionByRepoID deletes the reaction to a pull request review comment by repository ID. +// +// GitHub API docs: https://developer.github.com/v3/reactions/#delete-a-pull-request-comment-reaction +func (s *ReactionsService) DeletePullRequestCommentReactionByRepoID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { + url := fmt.Sprintf("repositories/%v/pulls/comments/%v/reactions/%v", repoID, commentID, reactionID) + + return s.deleteReaction(ctx, url) +} + // ListTeamDiscussionReactions lists the reactions for a team discussion. // // GitHub API docs: https://developer.github.com/v3/reactions/#list-reactions-for-a-team-discussion @@ -352,6 +394,24 @@ func (s *ReactionsService) CreateTeamDiscussionReaction(ctx context.Context, tea return m, resp, nil } +// DeleteTeamDiscussionReaction deletes the reaction to a team discussion. +// +// GitHub API docs: https://developer.github.com/v3/reactions/#delete-team-discussion-reaction +func (s *ReactionsService) DeleteTeamDiscussionReaction(ctx context.Context, org, teamSlug string, discussionNumber, reactionID int64) (*Response, error) { + url := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/reactions/%v", org, teamSlug, discussionNumber, reactionID) + + return s.deleteReaction(ctx, url) +} + +// DeleteTeamDiscussionReactionByTeamIDAndOrgID deletes the reaction to a team discussion by organization ID and team ID. +// +// GitHub API docs: https://developer.github.com/v3/reactions/#delete-team-discussion-reaction +func (s *ReactionsService) DeleteTeamDiscussionReactionByTeamIDAndOrgID(ctx context.Context, orgID, teamID, discussionNumber, reactionID int64) (*Response, error) { + url := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/reactions/%v", orgID, teamID, discussionNumber, reactionID) + + return s.deleteReaction(ctx, url) +} + // ListTeamDiscussionCommentReactions lists the reactions for a team discussion comment. // // GitHub API docs: https://developer.github.com/v3/reactions/#list-reactions-for-a-team-discussion-comment @@ -401,18 +461,31 @@ func (s *ReactionsService) CreateTeamDiscussionCommentReaction(ctx context.Conte return m, resp, nil } -// DeleteReaction deletes a reaction. +// DeleteTeamDiscussionCommentReaction deletes the reaction to a team discussion comment. +// +// GitHub API docs: https://developer.github.com/v3/reactions/#delete-team-discussion-comment-reaction +func (s *ReactionsService) DeleteTeamDiscussionCommentReaction(ctx context.Context, org, teamSlug string, discussionNumber, commentNumber, reactionID int64) (*Response, error) { + url := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments/%v/reactions/%v", org, teamSlug, discussionNumber, commentNumber, reactionID) + + return s.deleteReaction(ctx, url) +} + +// DeleteTeamDiscussionCommentReactionByTeamIDAndOrgID deletes the reaction to a team discussion comment by organization ID and team ID. // -// GitHub API docs: https://developer.github.com/v3/reaction/reactions/#delete-a-reaction-archive -func (s *ReactionsService) DeleteReaction(ctx context.Context, id int64) (*Response, error) { - u := fmt.Sprintf("reactions/%v", id) +// GitHub API docs: https://developer.github.com/v3/reactions/#delete-team-discussion-comment-reaction +func (s *ReactionsService) DeleteTeamDiscussionCommentReactionByTeamIDAndOrgID(ctx context.Context, orgID, teamID, discussionNumber, commentNumber, reactionID int64) (*Response, error) { + url := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments/%v/reactions/%v", orgID, teamID, discussionNumber, commentNumber, reactionID) + + return s.deleteReaction(ctx, url) +} - req, err := s.client.NewRequest("DELETE", u, nil) +func (s ReactionsService) deleteReaction(ctx context.Context, url string) (*Response, error) { + req, err := s.client.NewRequest(http.MethodDelete, url, nil) if err != nil { return nil, err } - // TODO: remove custom Accept header when this API fully launches. + // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeReactionsPreview) return s.client.Do(ctx, req, nil) diff --git a/github/reactions_test.go b/github/reactions_test.go index 90b9eaafc28..5897a7ea7f0 100644 --- a/github/reactions_test.go +++ b/github/reactions_test.go @@ -325,50 +325,194 @@ func TestReactionService_CreateTeamDiscussionCommentReaction(t *testing.T) { } } -func TestReactionsService_DeleteReaction(t *testing.T) { +func TestReactionsService_DeleteCommitCommentReaction(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - mux.HandleFunc("/reactions/1", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/comments/1/reactions/2", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") testHeader(t, r, "Accept", mediaTypeReactionsPreview) w.WriteHeader(http.StatusNoContent) }) - if _, err := client.Reactions.DeleteReaction(context.Background(), 1); err != nil { - t.Errorf("DeleteReaction returned error: %v", err) + if _, err := client.Reactions.DeleteCommentReaction(context.Background(), "o", "r", 1, 2); err != nil { + t.Errorf("DeleteCommentReaction returned error: %v", err) } } -func TestReactionsService_DeleteCommitCommentReaction(t *testing.T) { +func TestReactionsService_DeleteCommitCommentReactionByRepoID(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - mux.HandleFunc("/repos/o/r/comments/1/reactions/2", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repositories/1/comments/2/reactions/3", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") testHeader(t, r, "Accept", mediaTypeReactionsPreview) w.WriteHeader(http.StatusNoContent) }) - if _, err := client.Reactions.DeleteCommentReaction(context.Background(), "o", "r", 1, 2); err != nil { - t.Errorf("DeleteCommentReaction returned error: %v", err) + if _, err := client.Reactions.DeleteCommentReactionByRepoID(context.Background(), 1, 2, 3); err != nil { + t.Errorf("DeleteCommentReactionByRepoID returned error: %v", err) } } -func TestReactionsService_DeleteCommitCommentReactionByRepoID(t *testing.T) { +func TestReactionsService_DeleteIssueReaction(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - mux.HandleFunc("/repositories/1/comments/2/reactions/3", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/issues/1/reactions/2", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") testHeader(t, r, "Accept", mediaTypeReactionsPreview) w.WriteHeader(http.StatusNoContent) }) - if _, err := client.Reactions.DeleteCommentReactionByRepoID(context.Background(), 1, 2, 3); err != nil { - t.Errorf("DeleteCommentReactionByRepoID returned error: %v", err) + if _, err := client.Reactions.DeleteIssueReaction(context.Background(), "o", "r", 1, 2); err != nil { + t.Errorf("DeleteIssueReaction returned error: %v", err) + } +} + +func TestReactionsService_DeleteIssueReactionByRepoID(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/repositories/1/issues/2/reactions/3", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "DELETE") + testHeader(t, r, "Accept", mediaTypeReactionsPreview) + + w.WriteHeader(http.StatusNoContent) + }) + + if _, err := client.Reactions.DeleteIssueReactionByRepoID(context.Background(), 1, 2, 3); err != nil { + t.Errorf("DeleteIssueReactionByRepoID returned error: %v", err) + } +} + +func TestReactionsService_DeleteIssueCommentReaction(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/repos/o/r/issues/comments/1/reactions/2", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "DELETE") + testHeader(t, r, "Accept", mediaTypeReactionsPreview) + + w.WriteHeader(http.StatusNoContent) + }) + + if _, err := client.Reactions.DeleteIssueCommentReaction(context.Background(), "o", "r", 1, 2); err != nil { + t.Errorf("DeleteIssueCommentReaction returned error: %v", err) + } +} + +func TestReactionsService_DeleteIssueCommentReactionByRepoID(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/repositories/1/issues/comments/2/reactions/3", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "DELETE") + testHeader(t, r, "Accept", mediaTypeReactionsPreview) + + w.WriteHeader(http.StatusNoContent) + }) + + if _, err := client.Reactions.DeleteIssueCommentReactionByRepoID(context.Background(), 1, 2, 3); err != nil { + t.Errorf("DeleteIssueCommentReactionByRepoID returned error: %v", err) + } +} + +func TestReactionsService_DeletePullRequestCommentReaction(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/repos/o/r/pulls/comments/1/reactions/2", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "DELETE") + testHeader(t, r, "Accept", mediaTypeReactionsPreview) + + w.WriteHeader(http.StatusNoContent) + }) + + if _, err := client.Reactions.DeletePullRequestCommentReaction(context.Background(), "o", "r", 1, 2); err != nil { + t.Errorf("DeletePullRequestCommentReaction returned error: %v", err) + } +} + +func TestReactionsService_DeletePullRequestCommentReactionByRepoID(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/repositories/1/pulls/comments/2/reactions/3", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "DELETE") + testHeader(t, r, "Accept", mediaTypeReactionsPreview) + + w.WriteHeader(http.StatusNoContent) + }) + + if _, err := client.Reactions.DeletePullRequestCommentReactionByRepoID(context.Background(), 1, 2, 3); err != nil { + t.Errorf("DeletePullRequestCommentReactionByRepoID returned error: %v", err) + } +} + +func TestReactionsService_DeleteTeamDiscussionReaction(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/orgs/o/teams/s/discussions/1/reactions/2", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "DELETE") + testHeader(t, r, "Accept", mediaTypeReactionsPreview) + + w.WriteHeader(http.StatusNoContent) + }) + + if _, err := client.Reactions.DeleteTeamDiscussionReaction(context.Background(), "o", "s", 1, 2); err != nil { + t.Errorf("DeleteTeamDiscussionReaction returned error: %v", err) + } +} + +func TestReactionsService_DeleteTeamDiscussionReactionByTeamIDAndOrgID(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/organizations/1/team/2/discussions/3/reactions/4", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "DELETE") + testHeader(t, r, "Accept", mediaTypeReactionsPreview) + + w.WriteHeader(http.StatusNoContent) + }) + + if _, err := client.Reactions.DeleteTeamDiscussionReactionByTeamIDAndOrgID(context.Background(), 1, 2, 3, 4); err != nil { + t.Errorf("DeleteTeamDiscussionReactionByTeamIDAndOrgID returned error: %v", err) + } +} + +func TestReactionsService_DeleteTeamDiscussionCommentReaction(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/orgs/o/teams/s/discussions/1/comments/2/reactions/3", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "DELETE") + testHeader(t, r, "Accept", mediaTypeReactionsPreview) + + w.WriteHeader(http.StatusNoContent) + }) + + if _, err := client.Reactions.DeleteTeamDiscussionCommentReaction(context.Background(), "o", "s", 1, 2, 3); err != nil { + t.Errorf("DeleteTeamDiscussionCommentReaction returned error: %v", err) + } +} + +func TestReactionsService_DeleteTeamDiscussionCommentReactionByTeamIDAndOrgID(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/organizations/1/team/2/discussions/3/comments/4/reactions/5", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "DELETE") + testHeader(t, r, "Accept", mediaTypeReactionsPreview) + + w.WriteHeader(http.StatusNoContent) + }) + + if _, err := client.Reactions.DeleteTeamDiscussionCommentReactionByTeamIDAndOrgID(context.Background(), 1, 2, 3, 4, 5); err != nil { + t.Errorf("DeleteTeamDiscussionCommentReactionByTeamIDAndOrgID returned error: %v", err) } } From f393eb724ea644eca7f437ec60ea2429ce604b6e Mon Sep 17 00:00:00 2001 From: Weslei Juan Novaes Pereira Date: Mon, 2 Mar 2020 10:38:36 -0300 Subject: [PATCH 6/9] Removed duplicated tests --- github/reactions_test.go | 32 -------------------------------- go.mod | 3 ++- go.sum | 11 +++++++++++ 3 files changed, 13 insertions(+), 33 deletions(-) diff --git a/github/reactions_test.go b/github/reactions_test.go index bee9d76d5a0..5897a7ea7f0 100644 --- a/github/reactions_test.go +++ b/github/reactions_test.go @@ -516,35 +516,3 @@ func TestReactionsService_DeleteTeamDiscussionCommentReactionByTeamIDAndOrgID(t t.Errorf("DeleteTeamDiscussionCommentReactionByTeamIDAndOrgID returned error: %v", err) } } - -func TestReactionsService_DeleteCommitCommentReaction(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - mux.HandleFunc("/repos/o/r/comments/1/reactions/2", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "DELETE") - testHeader(t, r, "Accept", mediaTypeReactionsPreview) - - w.WriteHeader(http.StatusNoContent) - }) - - if _, err := client.Reactions.DeleteCommentReaction(context.Background(), "o", "r", 1, 2); err != nil { - t.Errorf("DeleteCommentReaction returned error: %v", err) - } -} - -func TestReactionsService_DeleteCommitCommentReactionByRepoID(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - mux.HandleFunc("/repositories/1/comments/2/reactions/3", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "DELETE") - testHeader(t, r, "Accept", mediaTypeReactionsPreview) - - w.WriteHeader(http.StatusNoContent) - }) - - if _, err := client.Reactions.DeleteCommentReactionByRepoID(context.Background(), 1, 2, 3); err != nil { - t.Errorf("DeleteCommentReactionByRepoID returned error: %v", err) - } -} diff --git a/go.mod b/go.mod index bb82bb43edb..8e2330b3dce 100644 --- a/go.mod +++ b/go.mod @@ -1,10 +1,11 @@ module github.com/google/go-github/v29 require ( + github.com/PuerkitoBio/goquery v1.5.1 // indirect github.com/golang/protobuf v1.3.2 // indirect + github.com/google/go-cmp v0.4.0 // indirect github.com/google/go-querystring v1.0.0 golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 - golang.org/x/net v0.0.0-20190311183353-d8887717615a // indirect golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be google.golang.org/appengine v1.1.0 ) diff --git a/go.sum b/go.sum index dbab13e8b82..31f08a1bde0 100644 --- a/go.sum +++ b/go.sum @@ -1,15 +1,26 @@ +github.com/PuerkitoBio/goquery v1.5.1 h1:PSPBGne8NIUWw+/7vFBV+kG2J/5MOjbzc7154OaKCSE= +github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc= +github.com/andybalholm/cascadia v1.1.0 h1:BuuO6sSfQNFRu1LppgbD25Hr2vLYW25JvxHs5zzsLTo= +github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y= github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2 h1:CCH4IOTTfewWjGOlSp+zGcjutRKlBEZQ6wTn8ozI/nI= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0 h1:igQkv0AAhEIvTEpD5LIpAfav2eeVO9HBTjvKHVJPRSs= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= From 51ebd58bdf59a203bc78af974c649f8150cd4dd7 Mon Sep 17 00:00:00 2001 From: Weslei Juan Novaes Pereira Date: Tue, 3 Mar 2020 09:59:23 -0300 Subject: [PATCH 7/9] revert go.mod and go.sum changes --- go.mod | 3 +-- go.sum | 11 ----------- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/go.mod b/go.mod index 8e2330b3dce..bb82bb43edb 100644 --- a/go.mod +++ b/go.mod @@ -1,11 +1,10 @@ module github.com/google/go-github/v29 require ( - github.com/PuerkitoBio/goquery v1.5.1 // indirect github.com/golang/protobuf v1.3.2 // indirect - github.com/google/go-cmp v0.4.0 // indirect github.com/google/go-querystring v1.0.0 golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 + golang.org/x/net v0.0.0-20190311183353-d8887717615a // indirect golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be google.golang.org/appengine v1.1.0 ) diff --git a/go.sum b/go.sum index 31f08a1bde0..dbab13e8b82 100644 --- a/go.sum +++ b/go.sum @@ -1,26 +1,15 @@ -github.com/PuerkitoBio/goquery v1.5.1 h1:PSPBGne8NIUWw+/7vFBV+kG2J/5MOjbzc7154OaKCSE= -github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc= -github.com/andybalholm/cascadia v1.1.0 h1:BuuO6sSfQNFRu1LppgbD25Hr2vLYW25JvxHs5zzsLTo= -github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y= github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2 h1:CCH4IOTTfewWjGOlSp+zGcjutRKlBEZQ6wTn8ozI/nI= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0 h1:igQkv0AAhEIvTEpD5LIpAfav2eeVO9HBTjvKHVJPRSs= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= From d52f947f44bfa8ef51085ae89ca3904b2c90eb83 Mon Sep 17 00:00:00 2001 From: Weslei Juan Novaes Pereira Date: Mon, 9 Mar 2020 11:03:16 -0300 Subject: [PATCH 8/9] Changes requested --- github/reactions.go | 24 ++++++++++++------------ github/reactions_test.go | 12 ++++++------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/github/reactions.go b/github/reactions.go index 0973f7b226b..af1cd1860ab 100644 --- a/github/reactions.go +++ b/github/reactions.go @@ -119,10 +119,10 @@ func (s *ReactionsService) DeleteCommentReaction(ctx context.Context, owner, rep return s.deleteReaction(ctx, u) } -// DeleteCommentReactionByRepoID deletes the reaction for a commit comment by repository ID. +// DeleteCommentReactionByID deletes the reaction for a commit comment by repository ID. // // GitHub API docs: https://developer.github.com/v3/reactions/#delete-a-commit-comment-reaction -func (s *ReactionsService) DeleteCommentReactionByRepoID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { +func (s *ReactionsService) DeleteCommentReactionByID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { u := fmt.Sprintf("repositories/%v/comments/%v/reactions/%v", repoID, commentID, reactionID) return s.deleteReaction(ctx, u) @@ -191,10 +191,10 @@ func (s *ReactionsService) DeleteIssueReaction(ctx context.Context, owner, repo return s.deleteReaction(ctx, url) } -// DeleteIssueReactionByRepoID deletes the reaction to an issue by repository ID. +// DeleteIssueReactionByID deletes the reaction to an issue by repository ID. // // GitHub API docs: https://developer.github.com/v3/reactions/#delete-an-issue-reaction -func (s *ReactionsService) DeleteIssueReactionByRepoID(ctx context.Context, repoID, issueNumber, reactionID int64) (*Response, error) { +func (s *ReactionsService) DeleteIssueReactionByID(ctx context.Context, repoID, issueNumber, reactionID int64) (*Response, error) { url := fmt.Sprintf("repositories/%v/issues/%v/reactions/%v", repoID, issueNumber, reactionID) return s.deleteReaction(ctx, url) @@ -263,10 +263,10 @@ func (s *ReactionsService) DeleteIssueCommentReaction(ctx context.Context, owner return s.deleteReaction(ctx, url) } -// DeleteIssueCommentReactionByRepoID deletes the reaction to an issue comment by repository ID. +// DeleteIssueCommentReactionByID deletes the reaction to an issue comment by repository ID. // // GitHub API docs: https://developer.github.com/v3/reactions/#delete-an-issue-comment-reaction -func (s *ReactionsService) DeleteIssueCommentReactionByRepoID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { +func (s *ReactionsService) DeleteIssueCommentReactionByID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { url := fmt.Sprintf("repositories/%v/issues/comments/%v/reactions/%v", repoID, commentID, reactionID) return s.deleteReaction(ctx, url) @@ -335,10 +335,10 @@ func (s *ReactionsService) DeletePullRequestCommentReaction(ctx context.Context, return s.deleteReaction(ctx, url) } -// DeletePullRequestCommentReactionByRepoID deletes the reaction to a pull request review comment by repository ID. +// DeletePullRequestCommentReactionByID deletes the reaction to a pull request review comment by repository ID. // // GitHub API docs: https://developer.github.com/v3/reactions/#delete-a-pull-request-comment-reaction -func (s *ReactionsService) DeletePullRequestCommentReactionByRepoID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { +func (s *ReactionsService) DeletePullRequestCommentReactionByID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { url := fmt.Sprintf("repositories/%v/pulls/comments/%v/reactions/%v", repoID, commentID, reactionID) return s.deleteReaction(ctx, url) @@ -403,10 +403,10 @@ func (s *ReactionsService) DeleteTeamDiscussionReaction(ctx context.Context, org return s.deleteReaction(ctx, url) } -// DeleteTeamDiscussionReactionByTeamIDAndOrgID deletes the reaction to a team discussion by organization ID and team ID. +// DeleteTeamDiscussionReactionByOrgIDAndTeamID deletes the reaction to a team discussion by organization ID and team ID. // // GitHub API docs: https://developer.github.com/v3/reactions/#delete-team-discussion-reaction -func (s *ReactionsService) DeleteTeamDiscussionReactionByTeamIDAndOrgID(ctx context.Context, orgID, teamID, discussionNumber, reactionID int64) (*Response, error) { +func (s *ReactionsService) DeleteTeamDiscussionReactionByOrgIDAndTeamID(ctx context.Context, orgID, teamID, discussionNumber, reactionID int64) (*Response, error) { url := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/reactions/%v", orgID, teamID, discussionNumber, reactionID) return s.deleteReaction(ctx, url) @@ -470,10 +470,10 @@ func (s *ReactionsService) DeleteTeamDiscussionCommentReaction(ctx context.Conte return s.deleteReaction(ctx, url) } -// DeleteTeamDiscussionCommentReactionByTeamIDAndOrgID deletes the reaction to a team discussion comment by organization ID and team ID. +// DeleteTeamDiscussionCommentReactionByOrgIDAndTeamID deletes the reaction to a team discussion comment by organization ID and team ID. // // GitHub API docs: https://developer.github.com/v3/reactions/#delete-team-discussion-comment-reaction -func (s *ReactionsService) DeleteTeamDiscussionCommentReactionByTeamIDAndOrgID(ctx context.Context, orgID, teamID, discussionNumber, commentNumber, reactionID int64) (*Response, error) { +func (s *ReactionsService) DeleteTeamDiscussionCommentReactionByOrgIDAndTeamID(ctx context.Context, orgID, teamID, discussionNumber, commentNumber, reactionID int64) (*Response, error) { url := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments/%v/reactions/%v", orgID, teamID, discussionNumber, commentNumber, reactionID) return s.deleteReaction(ctx, url) diff --git a/github/reactions_test.go b/github/reactions_test.go index 5897a7ea7f0..ede3105e0df 100644 --- a/github/reactions_test.go +++ b/github/reactions_test.go @@ -352,7 +352,7 @@ func TestReactionsService_DeleteCommitCommentReactionByRepoID(t *testing.T) { w.WriteHeader(http.StatusNoContent) }) - if _, err := client.Reactions.DeleteCommentReactionByRepoID(context.Background(), 1, 2, 3); err != nil { + if _, err := client.Reactions.DeleteCommentReactionByID(context.Background(), 1, 2, 3); err != nil { t.Errorf("DeleteCommentReactionByRepoID returned error: %v", err) } } @@ -384,7 +384,7 @@ func TestReactionsService_DeleteIssueReactionByRepoID(t *testing.T) { w.WriteHeader(http.StatusNoContent) }) - if _, err := client.Reactions.DeleteIssueReactionByRepoID(context.Background(), 1, 2, 3); err != nil { + if _, err := client.Reactions.DeleteIssueReactionByID(context.Background(), 1, 2, 3); err != nil { t.Errorf("DeleteIssueReactionByRepoID returned error: %v", err) } } @@ -416,7 +416,7 @@ func TestReactionsService_DeleteIssueCommentReactionByRepoID(t *testing.T) { w.WriteHeader(http.StatusNoContent) }) - if _, err := client.Reactions.DeleteIssueCommentReactionByRepoID(context.Background(), 1, 2, 3); err != nil { + if _, err := client.Reactions.DeleteIssueCommentReactionByID(context.Background(), 1, 2, 3); err != nil { t.Errorf("DeleteIssueCommentReactionByRepoID returned error: %v", err) } } @@ -448,7 +448,7 @@ func TestReactionsService_DeletePullRequestCommentReactionByRepoID(t *testing.T) w.WriteHeader(http.StatusNoContent) }) - if _, err := client.Reactions.DeletePullRequestCommentReactionByRepoID(context.Background(), 1, 2, 3); err != nil { + if _, err := client.Reactions.DeletePullRequestCommentReactionByID(context.Background(), 1, 2, 3); err != nil { t.Errorf("DeletePullRequestCommentReactionByRepoID returned error: %v", err) } } @@ -480,7 +480,7 @@ func TestReactionsService_DeleteTeamDiscussionReactionByTeamIDAndOrgID(t *testin w.WriteHeader(http.StatusNoContent) }) - if _, err := client.Reactions.DeleteTeamDiscussionReactionByTeamIDAndOrgID(context.Background(), 1, 2, 3, 4); err != nil { + if _, err := client.Reactions.DeleteTeamDiscussionReactionByOrgIDAndTeamID(context.Background(), 1, 2, 3, 4); err != nil { t.Errorf("DeleteTeamDiscussionReactionByTeamIDAndOrgID returned error: %v", err) } } @@ -512,7 +512,7 @@ func TestReactionsService_DeleteTeamDiscussionCommentReactionByTeamIDAndOrgID(t w.WriteHeader(http.StatusNoContent) }) - if _, err := client.Reactions.DeleteTeamDiscussionCommentReactionByTeamIDAndOrgID(context.Background(), 1, 2, 3, 4, 5); err != nil { + if _, err := client.Reactions.DeleteTeamDiscussionCommentReactionByOrgIDAndTeamID(context.Background(), 1, 2, 3, 4, 5); err != nil { t.Errorf("DeleteTeamDiscussionCommentReactionByTeamIDAndOrgID returned error: %v", err) } } From ffb6c4531163b518752aa782d47a6fc031438a2d Mon Sep 17 00:00:00 2001 From: Weslei Juan Novaes Pereira Date: Wed, 18 Mar 2020 10:13:21 -0300 Subject: [PATCH 9/9] updated type of numbers to int --- github/reactions.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/github/reactions.go b/github/reactions.go index af1cd1860ab..1602032e221 100644 --- a/github/reactions.go +++ b/github/reactions.go @@ -185,7 +185,7 @@ func (s ReactionsService) CreateIssueReaction(ctx context.Context, owner, repo s // DeleteIssueReaction deletes the reaction to an issue. // // GitHub API docs: https://developer.github.com/v3/reactions/#delete-an-issue-reaction -func (s *ReactionsService) DeleteIssueReaction(ctx context.Context, owner, repo string, issueNumber, reactionID int64) (*Response, error) { +func (s *ReactionsService) DeleteIssueReaction(ctx context.Context, owner, repo string, issueNumber int, reactionID int64) (*Response, error) { url := fmt.Sprintf("repos/%v/%v/issues/%v/reactions/%v", owner, repo, issueNumber, reactionID) return s.deleteReaction(ctx, url) @@ -194,7 +194,7 @@ func (s *ReactionsService) DeleteIssueReaction(ctx context.Context, owner, repo // DeleteIssueReactionByID deletes the reaction to an issue by repository ID. // // GitHub API docs: https://developer.github.com/v3/reactions/#delete-an-issue-reaction -func (s *ReactionsService) DeleteIssueReactionByID(ctx context.Context, repoID, issueNumber, reactionID int64) (*Response, error) { +func (s *ReactionsService) DeleteIssueReactionByID(ctx context.Context, repoID, issueNumber int, reactionID int64) (*Response, error) { url := fmt.Sprintf("repositories/%v/issues/%v/reactions/%v", repoID, issueNumber, reactionID) return s.deleteReaction(ctx, url) @@ -397,7 +397,7 @@ func (s *ReactionsService) CreateTeamDiscussionReaction(ctx context.Context, tea // DeleteTeamDiscussionReaction deletes the reaction to a team discussion. // // GitHub API docs: https://developer.github.com/v3/reactions/#delete-team-discussion-reaction -func (s *ReactionsService) DeleteTeamDiscussionReaction(ctx context.Context, org, teamSlug string, discussionNumber, reactionID int64) (*Response, error) { +func (s *ReactionsService) DeleteTeamDiscussionReaction(ctx context.Context, org, teamSlug string, discussionNumber int, reactionID int64) (*Response, error) { url := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/reactions/%v", org, teamSlug, discussionNumber, reactionID) return s.deleteReaction(ctx, url) @@ -406,7 +406,7 @@ func (s *ReactionsService) DeleteTeamDiscussionReaction(ctx context.Context, org // DeleteTeamDiscussionReactionByOrgIDAndTeamID deletes the reaction to a team discussion by organization ID and team ID. // // GitHub API docs: https://developer.github.com/v3/reactions/#delete-team-discussion-reaction -func (s *ReactionsService) DeleteTeamDiscussionReactionByOrgIDAndTeamID(ctx context.Context, orgID, teamID, discussionNumber, reactionID int64) (*Response, error) { +func (s *ReactionsService) DeleteTeamDiscussionReactionByOrgIDAndTeamID(ctx context.Context, orgID, teamID, discussionNumber int, reactionID int64) (*Response, error) { url := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/reactions/%v", orgID, teamID, discussionNumber, reactionID) return s.deleteReaction(ctx, url) @@ -464,7 +464,7 @@ func (s *ReactionsService) CreateTeamDiscussionCommentReaction(ctx context.Conte // DeleteTeamDiscussionCommentReaction deletes the reaction to a team discussion comment. // // GitHub API docs: https://developer.github.com/v3/reactions/#delete-team-discussion-comment-reaction -func (s *ReactionsService) DeleteTeamDiscussionCommentReaction(ctx context.Context, org, teamSlug string, discussionNumber, commentNumber, reactionID int64) (*Response, error) { +func (s *ReactionsService) DeleteTeamDiscussionCommentReaction(ctx context.Context, org, teamSlug string, discussionNumber, commentNumber int, reactionID int64) (*Response, error) { url := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments/%v/reactions/%v", org, teamSlug, discussionNumber, commentNumber, reactionID) return s.deleteReaction(ctx, url) @@ -473,7 +473,7 @@ func (s *ReactionsService) DeleteTeamDiscussionCommentReaction(ctx context.Conte // DeleteTeamDiscussionCommentReactionByOrgIDAndTeamID deletes the reaction to a team discussion comment by organization ID and team ID. // // GitHub API docs: https://developer.github.com/v3/reactions/#delete-team-discussion-comment-reaction -func (s *ReactionsService) DeleteTeamDiscussionCommentReactionByOrgIDAndTeamID(ctx context.Context, orgID, teamID, discussionNumber, commentNumber, reactionID int64) (*Response, error) { +func (s *ReactionsService) DeleteTeamDiscussionCommentReactionByOrgIDAndTeamID(ctx context.Context, orgID, teamID, discussionNumber, commentNumber int, reactionID int64) (*Response, error) { url := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments/%v/reactions/%v", orgID, teamID, discussionNumber, commentNumber, reactionID) return s.deleteReaction(ctx, url)