Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ type SearchRequest struct {
Submitter string // search submitter username (optional)
Contributer string // search contributor usernames (optional)

Sort string // sort results (optional)
SortOrder string // one of asc, desc (default) (optional)

Page int // optional
PerPage int // optional
}
Expand Down
10 changes: 10 additions & 0 deletions search.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ type SearchRequest struct {
Submitter string // search submitter username
Contributor string // search contributor usernames

Sort string // sort results
SortOrder string // one of asc, desc (default)

Page int
PerPage int
}
Expand Down Expand Up @@ -112,6 +115,13 @@ func (r *SearchRequest) params() url.Values {
params.Set("contributor", r.Contributor)
}

if r.Sort != "" {
params.Set("sort", r.Sort)
}
if r.SortOrder != "" {
params.Set("sort_order", r.SortOrder)
}

params.Set("page", strconv.Itoa(r.Page))
if r.PerPage != 0 {
params.Set("per_page", strconv.Itoa(r.PerPage))
Expand Down