Skip to content

Commit

Permalink
Revert "Fix: Remove Sort & Direction Fields From IssueListCommentsOpt…
Browse files Browse the repository at this point in the history
…ions" (#1857)
  • Loading branch information
gmlewis committed Apr 24, 2021
1 parent b235769 commit cceb4d4
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 2 deletions.
16 changes: 16 additions & 0 deletions github/github-accessors.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions github/github-accessors_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions github/issues_comments.go
Expand Up @@ -35,6 +35,12 @@ 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"`

Expand Down
8 changes: 6 additions & 2 deletions github/issues_comments_test.go
Expand Up @@ -23,14 +23,18 @@ func TestIssuesService_ListComments_allIssues(t *testing.T) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", mediaTypeReactionsPreview)
testFormValues(t, r, values{
"since": "2002-02-10T15:30:00Z",
"page": "2",
"sort": "updated",
"direction": "desc",
"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},
}
Expand Down

0 comments on commit cceb4d4

Please sign in to comment.