Skip to content

Commit cceb4d4

Browse files
authored
Revert "Fix: Remove Sort & Direction Fields From IssueListCommentsOptions" (#1857)
1 parent b235769 commit cceb4d4

File tree

4 files changed

+48
-2
lines changed

4 files changed

+48
-2
lines changed

github/github-accessors.go

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

github/github-accessors_test.go

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

github/issues_comments.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ func (i IssueComment) String() string {
3535
// IssueListCommentsOptions specifies the optional parameters to the
3636
// IssuesService.ListComments method.
3737
type IssueListCommentsOptions struct {
38+
// Sort specifies how to sort comments. Possible values are: created, updated.
39+
Sort *string `url:"sort,omitempty"`
40+
41+
// Direction in which to sort comments. Possible values are: asc, desc.
42+
Direction *string `url:"direction,omitempty"`
43+
3844
// Since filters comments by time.
3945
Since *time.Time `url:"since,omitempty"`
4046

github/issues_comments_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,18 @@ func TestIssuesService_ListComments_allIssues(t *testing.T) {
2323
testMethod(t, r, "GET")
2424
testHeader(t, r, "Accept", mediaTypeReactionsPreview)
2525
testFormValues(t, r, values{
26-
"since": "2002-02-10T15:30:00Z",
27-
"page": "2",
26+
"sort": "updated",
27+
"direction": "desc",
28+
"since": "2002-02-10T15:30:00Z",
29+
"page": "2",
2830
})
2931
fmt.Fprint(w, `[{"id":1}]`)
3032
})
3133

3234
since := time.Date(2002, time.February, 10, 15, 30, 0, 0, time.UTC)
3335
opt := &IssueListCommentsOptions{
36+
Sort: String("updated"),
37+
Direction: String("desc"),
3438
Since: &since,
3539
ListOptions: ListOptions{Page: 2},
3640
}

0 commit comments

Comments
 (0)