Add Pagination Options for List Requests #205

Merged
lunny merged 36 commits from spawn2kill/go-sdk:pagination into master 2020-02-05 08:00:00 +00:00
Showing only changes of commit c4211a73e2 - Show all commits

View File

@ -91,6 +91,7 @@ func (c *Client) ListOrgRepos(org string, opt ListOrgReposOptions) ([]*Repositor
// SearchRepoOptions options for searching repositories
type SearchRepoOptions struct {
// https://try.gitea.io/api/swagger#/repository/repoSearch
ListOptions
Keyword string
Topic bool
IncludeDesc bool
@ -106,7 +107,7 @@ type SearchRepoOptions struct {
// QueryEncode turns options into querystring argument
func (opt *SearchRepoOptions) QueryEncode() string {
query := make(url.Values)
query := opt.getURLQuery()
if opt.Keyword != "" {
query.Add("q", opt.Keyword)
}
@ -148,6 +149,7 @@ type searchRepoResponse struct {
// SearchRepos searches for repositories matching the given filters
func (c *Client) SearchRepos(opt SearchRepoOptions) ([]*Repository, error) {
opt.setDefaults()
resp := new(searchRepoResponse)
link, _ := url.Parse("/repos/search")