Skip to content

Commit b2eae3c

Browse files
Merge pull request #333 from wowq/opt-sort
fix: add Sort option
2 parents 3e58d4f + 8302fa6 commit b2eae3c

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

scm/client.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ type (
8282
Size int
8383
From string
8484
To string
85+
Sort string
8586
}
8687

8788
// GraphQLService the API to performing GraphQL queries

scm/driver/gitlab/util.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ func encodeListOptions(opts *scm.ListOptions) string {
3030
if opts.To != "" {
3131
params.Set("to", opts.To)
3232
}
33+
if opts.Sort != "" {
34+
params.Set("sort", opts.Sort)
35+
}
3336
return params.Encode()
3437
}
3538

scm/driver/gitlab/util_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ func Test_encodeListOptions(t *testing.T) {
1414
opts := scm.ListOptions{
1515
Page: 10,
1616
Size: 30,
17+
Sort: "asc",
1718
}
18-
want := "page=10&per_page=30"
19+
want := "page=10&per_page=30&sort=asc"
1920
got := encodeListOptions(&opts)
2021
if got != want {
2122
t.Errorf("Want encoded list options %q, got %q", want, got)

0 commit comments

Comments
 (0)