1
0
mirror of https://gitea.com/jolheiser/sip synced 2024-11-26 07:33:48 +01:00
sip/modules/sdk/pulls.go
jolheiser 58fe648da6
More work
Signed-off-by: jolheiser <john.olheiser@gmail.com>
2020-02-15 23:51:14 -06:00

26 lines
510 B
Go

package sdk
import (
"code.gitea.io/sdk/gitea"
)
// GetPulls returns all matching PRs from a Gitea instance
func GetPulls(client *gitea.Client, owner, repo string, opts gitea.ListPullRequestsOptions) ([]*gitea.PullRequest, error) {
pulls := make([]*gitea.PullRequest, 0)
p := 1
for {
opts.Page = p
list, err := client.ListRepoPullRequests(owner, repo, opts)
if err != nil {
return pulls, err
}
p++
pulls = append(pulls, list...)
if len(list) == 0 {
break
}
}
return pulls, nil
}