aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/code.gitea.io/sdk/gitea/issue.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/code.gitea.io/sdk/gitea/issue.go')
-rw-r--r--vendor/code.gitea.io/sdk/gitea/issue.go48
1 files changed, 32 insertions, 16 deletions
diff --git a/vendor/code.gitea.io/sdk/gitea/issue.go b/vendor/code.gitea.io/sdk/gitea/issue.go
index 688924634b..c33856a4da 100644
--- a/vendor/code.gitea.io/sdk/gitea/issue.go
+++ b/vendor/code.gitea.io/sdk/gitea/issue.go
@@ -42,10 +42,7 @@ type Issue struct {
Ref string `json:"ref"`
Labels []*Label `json:"labels"`
Milestone *Milestone `json:"milestone"`
- // deprecated
- // TODO: rm on sdk 0.15.0
- Assignee *User `json:"assignee"`
- Assignees []*User `json:"assignees"`
+ Assignees []*User `json:"assignees"`
// Whether the issue is open or closed
State StateType `json:"state"`
IsLocked bool `json:"is_locked"`
@@ -66,6 +63,14 @@ type ListIssueOption struct {
Labels []string
Milestones []string
KeyWord string
+ Since time.Time
+ Before time.Time
+ // filter by created by username
+ CreatedBy string
+ // filter by assigned to username
+ AssignedBy string
+ // filter by username mentioned
+ MentionedBy string
}
// StateType issue state type
@@ -114,6 +119,23 @@ func (opt *ListIssueOption) QueryEncode() string {
query.Add("milestones", strings.Join(opt.Milestones, ","))
}
+ if !opt.Since.IsZero() {
+ query.Add("since", opt.Since.Format(time.RFC3339))
+ }
+ if !opt.Before.IsZero() {
+ query.Add("before", opt.Before.Format(time.RFC3339))
+ }
+
+ if len(opt.CreatedBy) > 0 {
+ query.Add("created_by", opt.CreatedBy)
+ }
+ if len(opt.AssignedBy) > 0 {
+ query.Add("assigned_by", opt.AssignedBy)
+ }
+ if len(opt.MentionedBy) > 0 {
+ query.Add("mentioned_by", opt.MentionedBy)
+ }
+
return query.Encode()
}
@@ -178,12 +200,9 @@ func (c *Client) GetIssue(owner, repo string, index int64) (*Issue, *Response, e
// CreateIssueOption options to create one issue
type CreateIssueOption struct {
- Title string `json:"title"`
- Body string `json:"body"`
- Ref string `json:"ref"`
- // deprecated
- // TODO: rm on sdk 0.15.0
- Assignee string `json:"assignee"`
+ Title string `json:"title"`
+ Body string `json:"body"`
+ Ref string `json:"ref"`
Assignees []string `json:"assignees"`
Deadline *time.Time `json:"due_date"`
// milestone id
@@ -222,12 +241,9 @@ func (c *Client) CreateIssue(owner, repo string, opt CreateIssueOption) (*Issue,
// EditIssueOption options for editing an issue
type EditIssueOption struct {
- Title string `json:"title"`
- Body *string `json:"body"`
- Ref *string `json:"ref"`
- // deprecated
- // TODO: rm on sdk 0.15.0
- Assignee *string `json:"assignee"`
+ Title string `json:"title"`
+ Body *string `json:"body"`
+ Ref *string `json:"ref"`
Assignees []string `json:"assignees"`
Milestone *int64 `json:"milestone"`
State *StateType `json:"state"`