From 142acef5ce79f78585afcce31748af46c72a3dea Mon Sep 17 00:00:00 2001 From: kolaente Date: Tue, 17 Apr 2018 02:54:29 +0200 Subject: [PATCH] Preparation for Issue due dates (go-gitea/gitea#2533) (#103) * Added deadline for issue * Added deadline for pull requests * Added comment for swagger date format --- gitea/issue.go | 18 ++++++++++++------ gitea/pull.go | 37 ++++++++++++++++++++++--------------- 2 files changed, 34 insertions(+), 21 deletions(-) diff --git a/gitea/issue.go b/gitea/issue.go index 6da4667..27809ca 100644 --- a/gitea/issue.go +++ b/gitea/issue.go @@ -52,6 +52,8 @@ type Issue struct { Updated time.Time `json:"updated_at"` // swagger:strfmt date-time Closed *time.Time `json:"closed_at"` + // swagger:strfmt date-time + Deadline *time.Time `json:"due_date"` PullRequest *PullRequestMeta `json:"pull_request"` } @@ -94,6 +96,8 @@ type CreateIssueOption struct { // username of assignee Assignee string `json:"assignee"` Assignees []string `json:"assignees"` + // swagger:strfmt date-time + Deadline *time.Time `json:"due_date"` // milestone id Milestone int64 `json:"milestone"` // list of label ids @@ -114,12 +118,14 @@ 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"` - Assignee *string `json:"assignee"` - Assignees []string `json:"assignees"` - Milestone *int64 `json:"milestone"` - State *string `json:"state"` + Title string `json:"title"` + Body *string `json:"body"` + Assignee *string `json:"assignee"` + Assignees []string `json:"assignees"` + Milestone *int64 `json:"milestone"` + State *string `json:"state"` + // swagger:strfmt date-time + Deadline *time.Time `json:"due_date"` } // EditIssue modify an existing issue for a given repository diff --git a/gitea/pull.go b/gitea/pull.go index f196bd9..7d38b14 100644 --- a/gitea/pull.go +++ b/gitea/pull.go @@ -41,6 +41,9 @@ type PullRequest struct { Head *PRBranchInfo `json:"head"` MergeBase string `json:"merge_base"` + // swagger:strfmt date-time + Deadline *time.Time `json:"due_date"` + // swagger:strfmt date-time Created *time.Time `json:"created_at"` // swagger:strfmt date-time @@ -82,14 +85,16 @@ func (c *Client) GetPullRequest(owner, repo string, index int64) (*PullRequest, // CreatePullRequestOption options when creating a pull request type CreatePullRequestOption struct { - Head string `json:"head" binding:"Required"` - Base string `json:"base" binding:"Required"` - Title string `json:"title" binding:"Required"` - Body string `json:"body"` - Assignee string `json:"assignee"` - Assignees []string `json:"assignees"` - Milestone int64 `json:"milestone"` - Labels []int64 `json:"labels"` + Head string `json:"head" binding:"Required"` + Base string `json:"base" binding:"Required"` + Title string `json:"title" binding:"Required"` + Body string `json:"body"` + Assignee string `json:"assignee"` + Assignees []string `json:"assignees"` + Milestone int64 `json:"milestone"` + Labels []int64 `json:"labels"` + // swagger:strfmt date-time + Deadline *time.Time `json:"due_date"` } // CreatePullRequest create pull request with options @@ -105,13 +110,15 @@ func (c *Client) CreatePullRequest(owner, repo string, opt CreatePullRequestOpti // EditPullRequestOption options when modify pull request type EditPullRequestOption struct { - Title string `json:"title"` - Body string `json:"body"` - Assignee string `json:"assignee"` - Assignees []string `json:"assignees"` - Milestone int64 `json:"milestone"` - Labels []int64 `json:"labels"` - State *string `json:"state"` + Title string `json:"title"` + Body string `json:"body"` + Assignee string `json:"assignee"` + Assignees []string `json:"assignees"` + Milestone int64 `json:"milestone"` + Labels []int64 `json:"labels"` + State *string `json:"state"` + // swagger:strfmt date-time + Deadline *time.Time `json:"due_date"` } // EditPullRequest modify pull request with PR id and options