mirror of
https://gitea.com/gitea/go-sdk.git
synced 2024-06-02 02:01:25 +05:30
[Backport] Add IssueType as filter for ListIssues (#288)
wait for CI to get job done add IssueType as filter for ListIssues Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/288 Reviewed-by: Andrew Thornton <art27@cantab.net> Reviewed-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
parent
89970fb7b5
commit
e688af22be
|
@ -48,10 +48,23 @@ type ListIssueOption struct {
|
|||
Page int
|
||||
// open, closed, all
|
||||
State string
|
||||
Type IssueType
|
||||
Labels []string
|
||||
KeyWord string
|
||||
}
|
||||
|
||||
// IssueType is issue a pull or only an issue
|
||||
type IssueType string
|
||||
|
||||
const (
|
||||
// IssueTypeAll pr and issue
|
||||
IssueTypeAll IssueType = ""
|
||||
// IssueTypeIssue only issues
|
||||
IssueTypeIssue IssueType = "issues"
|
||||
// IssueTypePull only pulls
|
||||
IssueTypePull IssueType = "pulls"
|
||||
)
|
||||
|
||||
// QueryEncode turns options into querystring argument
|
||||
func (opt *ListIssueOption) QueryEncode() string {
|
||||
query := make(url.Values)
|
||||
|
@ -81,6 +94,7 @@ func (opt *ListIssueOption) QueryEncode() string {
|
|||
if len(opt.KeyWord) > 0 {
|
||||
query.Add("q", opt.KeyWord)
|
||||
}
|
||||
query.Add("type", string(opt.Type))
|
||||
|
||||
return query.Encode()
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ func TestIssue(t *testing.T) {
|
|||
c := newTestClient()
|
||||
|
||||
createIssue(t, c)
|
||||
time.Sleep(time.Second)
|
||||
listIssues(t, c)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue