diff --git a/README.md b/README.md index 02b0592..641928c 100644 --- a/README.md +++ b/README.md @@ -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 } diff --git a/search.go b/search.go index 6a46934..a76d5bb 100644 --- a/search.go +++ b/search.go @@ -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 } @@ -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))