Add sorting by owner/team for list search on user (#585)

- Add sorting by Owner and Team for the user list issues endpoint.
- Ref: https://github.com/go-gitea/gitea/pull/16662

Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/585
Reviewed-by: John Olheiser <john.olheiser@gmail.com>
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-committed-by: Gusted <williamzijl7@hotmail.com>
This commit is contained in:
Gusted 2022-04-28 08:43:52 +08:00 committed by Lunny Xiao
parent 468d48c978
commit 559cc2fb2a
1 changed files with 10 additions and 0 deletions

View File

@ -71,6 +71,10 @@ type ListIssueOption struct {
AssignedBy string
// filter by username mentioned
MentionedBy string
// filter by owner (only works on ListIssues on User)
Owner string
// filter by team (requires organization owner parameter to be provided and only works on ListIssues on User)
Team string
}
// StateType issue state type
@ -135,6 +139,12 @@ func (opt *ListIssueOption) QueryEncode() string {
if len(opt.MentionedBy) > 0 {
query.Add("mentioned_by", opt.MentionedBy)
}
if len(opt.Owner) > 0 {
query.Add("owner", opt.Owner)
}
if len(opt.Team) > 0 {
query.Add("team", opt.MentionedBy)
}
return query.Encode()
}