From 559cc2fb2a8ac8071aa1389df753d912c69f83ef Mon Sep 17 00:00:00 2001 From: Gusted Date: Thu, 28 Apr 2022 08:43:52 +0800 Subject: [PATCH] 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 Reviewed-by: Lunny Xiao Co-authored-by: Gusted Co-committed-by: Gusted --- gitea/issue.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gitea/issue.go b/gitea/issue.go index c33856a..660e7c5 100644 --- a/gitea/issue.go +++ b/gitea/issue.go @@ -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() }