Repository: google/go-github
Pull request #1584 (2020-07-23 01:35:32)

Fix: Remove Sort & Direction Fields From IssueListCommentsOptions
For: #1583 

- The `Sort` & `Direction` fields in` IssueListCommentsOptions` were removed from the github api so they no longer work.
- Fields have been removed from the struct and any corresponding tests. 

- [x] tests pass
- [x] code fmt

> These are tagged as breaking changes so not sure if anything else needs to be updated to reflect that

codecov[bot]: # [Codecov](https://codecov.io/gh/google/go-github/pull/1584?src=pr&el=h1) Report
> Merging [#1584](https://codecov.io/gh/google/go-github/pull/1584?src=pr&el=desc) into [master](https://codecov.io/gh/google/go-github/commit/e881974953e6ab6d1a6a1610e98ed6401a3aa1ba&el=desc) will **increase** coverage by `5.17%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/google/go-github/pull/1584/graphs/tree.svg?width=650&height=150&src=pr&token=EgYjGjZlI0)](https://codecov.io/gh/google/go-github/pull/1584?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master    #1584      +/-   ##
==========================================
+ Coverage   67.95%   73.13%   +5.17%     
==========================================
  Files          96       96              
  Lines        8762     7053    -1709     
==========================================
- Hits         5954     5158     -796     
+ Misses       1898      985     -913     
  Partials      910      910              
```


| [Impacted Files](https://codecov.io/gh/google/go-github/pull/1584?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [github/issues\_comments.go](https://codecov.io/gh/google/go-github/pull/1584/diff?src=pr&el=tree#diff-Z2l0aHViL2lzc3Vlc19jb21tZW50cy5nbw==) | `82.45% <ø> (+3.58%)` | :arrow_up: |
| [github/github.go](https://codecov.io/gh/google/go-github/pull/1584/diff?src=pr&el=tree#diff-Z2l0aHViL2dpdGh1Yi5nbw==) | `89.65% <0.00%> (-0.03%)` | :arrow_down: |
| [github/admin.go](https://codecov.io/gh/google/go-github/pull/1584/diff?src=pr&el=tree#diff-Z2l0aHViL2FkbWluLmdv) | `100.00% <0.00%> (ø)` | |
| [github/strings.go](https://codecov.io/gh/google/go-github/pull/1584/diff?src=pr&el=tree#diff-Z2l0aHViL3N0cmluZ3MuZ28=) | `100.00% <0.00%> (ø)` | |
| [github/activity.go](https://codecov.io/gh/google/go-github/pull/1584/diff?src=pr&el=tree#diff-Z2l0aHViL2FjdGl2aXR5Lmdv) | `100.00% <0.00%> (ø)` | |
| [github/timestamp.go](https://codecov.io/gh/google/go-github/pull/1584/diff?src=pr&el=tree#diff-Z2l0aHViL3RpbWVzdGFtcC5nbw==) | `100.00% <0.00%> (ø)` | |
| [github/admin\_stats.go](https://codecov.io/gh/google/go-github/pull/1584/diff?src=pr&el=tree#diff-Z2l0aHViL2FkbWluX3N0YXRzLmdv) | `100.00% <0.00%> (ø)` | |
| [github/repos\_traffic.go](https://codecov.io/gh/google/go-github/pull/1584/diff?src=pr&el=tree#diff-Z2l0aHViL3JlcG9zX3RyYWZmaWMuZ28=) | `100.00% <0.00%> (ø)` | |
| [github/pulls\_reviewers.go](https://codecov.io/gh/google/go-github/pull/1584/diff?src=pr&el=tree#diff-Z2l0aHViL3B1bGxzX3Jldmlld2Vycy5nbw==) | `100.00% <0.00%> (ø)` | |
| [github/git\_commits.go](https://codecov.io/gh/google/go-github/pull/1584/diff?src=pr&el=tree#diff-Z2l0aHViL2dpdF9jb21taXRzLmdv) | `91.30% <0.00%> (+1.30%)` | :arrow_up: |
| ... and [83 more](https://codecov.io/gh/google/go-github/pull/1584/diff?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/google/go-github/pull/1584?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/google/go-github/pull/1584?src=pr&el=footer). Last update [e881974...7757d83](https://codecov.io/gh/google/go-github/pull/1584?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/github/actions_runners.go b/github/actions_runners.go
index 2cac674e..8960ac8e 100644
--- a/github/actions_runners.go
+++ b/github/actions_runners.go
@@ -69,6 +69,7 @@ type Runner struct {
 	Name   *string `json:"name,omitempty"`
 	OS     *string `json:"os,omitempty"`
 	Status *string `json:"status,omitempty"`
+	Busy   *bool   `json:"busy,omitempty"`
 }
 
 // Runners represents a collection of self-hosted runners for a repository.
diff --git a/github/github-accessors.go b/github/github-accessors.go
index 8c591ce8..8e35c555 100644
--- a/github/github-accessors.go
+++ b/github/github-accessors.go
@@ -5084,14 +5084,6 @@ func (i *IssueEvent) GetURL() string {
 	return *i.URL
 }
 
-// GetDirection returns the Direction field if it's non-nil, zero value otherwise.
-func (i *IssueListCommentsOptions) GetDirection() string {
-	if i == nil || i.Direction == nil {
-		return ""
-	}
-	return *i.Direction
-}
-
 // GetSince returns the Since field if it's non-nil, zero value otherwise.
 func (i *IssueListCommentsOptions) GetSince() time.Time {
 	if i == nil || i.Since == nil {
@@ -5100,14 +5092,6 @@ func (i *IssueListCommentsOptions) GetSince() time.Time {
 	return *i.Since
 }
 
-// GetSort returns the Sort field if it's non-nil, zero value otherwise.
-func (i *IssueListCommentsOptions) GetSort() string {
-	if i == nil || i.Sort == nil {
-		return ""
-	}
-	return *i.Sort
-}
-
 // GetAssignee returns the Assignee field if it's non-nil, zero value otherwise.
 func (i *IssueRequest) GetAssignee() string {
 	if i == nil || i.Assignee == nil {
@@ -10364,6 +10348,14 @@ func (r *Reactions) GetConfused() int {
 	return *r.Confused
 }
 
+// GetEyes returns the Eyes field if it's non-nil, zero value otherwise.
+func (r *Reactions) GetEyes() int {
+	if r == nil || r.Eyes == nil {
+		return 0
+	}
+	return *r.Eyes
+}
+
 // GetHeart returns the Heart field if it's non-nil, zero value otherwise.
 func (r *Reactions) GetHeart() int {
 	if r == nil || r.Heart == nil {
@@ -10404,6 +10396,14 @@ func (r *Reactions) GetPlusOne() int {
 	return *r.PlusOne
 }
 
+// GetRocket returns the Rocket field if it's non-nil, zero value otherwise.
+func (r *Reactions) GetRocket() int {
+	if r == nil || r.Rocket == nil {
+		return 0
+	}
+	return *r.Rocket
+}
+
 // GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise.
 func (r *Reactions) GetTotalCount() int {
 	if r == nil || r.TotalCount == nil {
@@ -12308,6 +12308,14 @@ func (r *ReviewersRequest) GetNodeID() string {
 	return *r.NodeID
 }
 
+// GetBusy returns the Busy field if it's non-nil, zero value otherwise.
+func (r *Runner) GetBusy() bool {
+	if r == nil || r.Busy == nil {
+		return false
+	}
+	return *r.Busy
+}
+
 // GetID returns the ID field if it's non-nil, zero value otherwise.
 func (r *Runner) GetID() int64 {
 	if r == nil || r.ID == nil {
diff --git a/github/issues_comments.go b/github/issues_comments.go
index fc67511b..eade48ee 100644
--- a/github/issues_comments.go
+++ b/github/issues_comments.go
@@ -35,12 +35,6 @@ func (i IssueComment) String() string {
 // IssueListCommentsOptions specifies the optional parameters to the
 // IssuesService.ListComments method.
 type IssueListCommentsOptions struct {
-	// Sort specifies how to sort comments. Possible values are: created, updated.
-	Sort *string `url:"sort,omitempty"`
-
-	// Direction in which to sort comments. Possible values are: asc, desc.
-	Direction *string `url:"direction,omitempty"`
-
 	// Since filters comments by time.
 	Since *time.Time `url:"since,omitempty"`
 
diff --git a/github/reactions.go b/github/reactions.go
index ce0a7518..47eb41f0 100644
--- a/github/reactions.go
+++ b/github/reactions.go
@@ -25,7 +25,7 @@ type Reaction struct {
 	NodeID *string `json:"node_id,omitempty"`
 	// Content is the type of reaction.
 	// Possible values are:
-	//     "+1", "-1", "laugh", "confused", "heart", "hooray".
+	//     "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes".
 	Content *string `json:"content,omitempty"`
 }
 
@@ -38,6 +38,8 @@ type Reactions struct {
 	Confused   *int    `json:"confused,omitempty"`
 	Heart      *int    `json:"heart,omitempty"`
 	Hooray     *int    `json:"hooray,omitempty"`
+	Rocket     *int    `json:"rocket,omitempty"`
+	Eyes       *int    `json:"eyes,omitempty"`
 	URL        *string `json:"url,omitempty"`
 }
 
@@ -86,7 +88,7 @@ func (s *ReactionsService) ListCommentReactions(ctx context.Context, owner, repo
 // CreateCommentReaction creates a reaction for a commit comment.
 // Note that if you have already created a reaction of type content, the
 // previously created reaction will be returned with Status: 200 OK.
-// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray".
+// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes".
 //
 // GitHub API docs: https://developer.github.com/v3/reactions/#create-reaction-for-a-commit-comment
 func (s *ReactionsService) CreateCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) {
@@ -158,7 +160,7 @@ func (s *ReactionsService) ListIssueReactions(ctx context.Context, owner, repo s
 // CreateIssueReaction creates a reaction for an issue.
 // Note that if you have already created a reaction of type content, the
 // previously created reaction will be returned with Status: 200 OK.
-// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray".
+// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes".
 //
 // GitHub API docs: https://developer.github.com/v3/reactions/#create-reaction-for-an-issue
 func (s *ReactionsService) CreateIssueReaction(ctx context.Context, owner, repo string, number int, content string) (*Reaction, *Response, error) {
@@ -230,7 +232,7 @@ func (s *ReactionsService) ListIssueCommentReactions(ctx context.Context, owner,
 // CreateIssueCommentReaction creates a reaction for an issue comment.
 // Note that if you have already created a reaction of type content, the
 // previously created reaction will be returned with Status: 200 OK.
-// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray".
+// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes".
 //
 // GitHub API docs: https://developer.github.com/v3/reactions/#create-reaction-for-an-issue-comment
 func (s *ReactionsService) CreateIssueCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) {
@@ -302,7 +304,7 @@ func (s *ReactionsService) ListPullRequestCommentReactions(ctx context.Context,
 // CreatePullRequestCommentReaction creates a reaction for a pull request review comment.
 // Note that if you have already created a reaction of type content, the
 // previously created reaction will be returned with Status: 200 OK.
-// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray".
+// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes".
 //
 // GitHub API docs: https://developer.github.com/v3/reactions/#create-reaction-for-a-pull-request-review-comment
 func (s *ReactionsService) CreatePullRequestCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) {
@@ -371,7 +373,7 @@ func (s *ReactionsService) ListTeamDiscussionReactions(ctx context.Context, team
 }
 
 // CreateTeamDiscussionReaction creates a reaction for a team discussion.
-// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray".
+// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes".
 //
 // GitHub API docs: https://developer.github.com/v3/reactions/#create-reaction-for-a-team-discussion-legacy
 func (s *ReactionsService) CreateTeamDiscussionReaction(ctx context.Context, teamID int64, discussionNumber int, content string) (*Reaction, *Response, error) {
@@ -438,7 +440,7 @@ func (s *ReactionsService) ListTeamDiscussionCommentReactions(ctx context.Contex
 }
 
 // CreateTeamDiscussionCommentReaction creates a reaction for a team discussion comment.
-// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray".
+// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes".
 //
 // GitHub API docs: https://developer.github.com/v3/reactions/#create-reaction-for-a-team-discussion-comment-legacy
 func (s *ReactionsService) CreateTeamDiscussionCommentReaction(ctx context.Context, teamID int64, discussionNumber, commentNumber int, content string) (*Reaction, *Response, error) {


Test patch:
diff --git a/github/issues_comments_test.go b/github/issues_comments_test.go
index 69acb242..2b5ec50c 100644
--- a/github/issues_comments_test.go
+++ b/github/issues_comments_test.go
@@ -23,18 +23,14 @@ func TestIssuesService_ListComments_allIssues(t *testing.T) {
 		testMethod(t, r, "GET")
 		testHeader(t, r, "Accept", mediaTypeReactionsPreview)
 		testFormValues(t, r, values{
-			"sort":      "updated",
-			"direction": "desc",
-			"since":     "2002-02-10T15:30:00Z",
-			"page":      "2",
+			"since": "2002-02-10T15:30:00Z",
+			"page":  "2",
 		})
 		fmt.Fprint(w, `[{"id":1}]`)
 	})
 
 	since := time.Date(2002, time.February, 10, 15, 30, 0, 0, time.UTC)
 	opt := &IssueListCommentsOptions{
-		Sort:        String("updated"),
-		Direction:   String("desc"),
 		Since:       &since,
 		ListOptions: ListOptions{Page: 2},
 	}
diff --git a/github/pulls_comments_test.go b/github/pulls_comments_test.go
index ace57003..7d3a7c76 100644
--- a/github/pulls_comments_test.go
+++ b/github/pulls_comments_test.go
@@ -29,6 +29,8 @@ func TestPullComments_marshall(t *testing.T) {
 		Confused:   Int(0),
 		Heart:      Int(0),
 		Hooray:     Int(0),
+		Rocket:     Int(0),
+		Eyes:       Int(0),
 		URL:        String("u"),
 	}
 
@@ -116,6 +118,8 @@ func TestPullComments_marshall(t *testing.T) {
 			"confused": 0,
 			"heart": 0,
 			"hooray": 0,
+			"rocket": 0,
+			"eyes": 0,
 			"url": "u"
 		},
 		"created_at": "2002-02-10T15:30:00Z",
diff --git a/github/reactions_test.go b/github/reactions_test.go
index ede3105e..9beaff73 100644
--- a/github/reactions_test.go
+++ b/github/reactions_test.go
@@ -43,6 +43,8 @@ func TestReactions_Marshal(t *testing.T) {
 		Confused:   Int(1),
 		Heart:      Int(1),
 		Hooray:     Int(1),
+		Rocket:     Int(1),
+		Eyes:       Int(1),
 		URL:        String("u"),
 	}
 
@@ -54,6 +56,8 @@ func TestReactions_Marshal(t *testing.T) {
 		"confused": 1,
 		"heart": 1,
 		"hooray": 1,
+		"rocket": 1,
+		"eyes": 1,		
 		"url": "u"
 	}`