Skip to content
This repository was archived by the owner on Jun 8, 2019. It is now read-only.

Commit 40e36e1

Browse files
kolaentelafriks
authored andcommitted
Added deadline structs for api (#105)
* Added deadline structs for api * fixed lint + fmt
1 parent 1c8d12f commit 40e36e1

File tree

2 files changed

+38
-24
lines changed

2 files changed

+38
-24
lines changed

gitea/issue.go

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,14 @@ func (c *Client) CreateIssue(owner, repo string, opt CreateIssueOption) (*Issue,
118118

119119
// EditIssueOption options for editing an issue
120120
type EditIssueOption struct {
121-
Title string `json:"title"`
122-
Body *string `json:"body"`
123-
Assignee *string `json:"assignee"`
124-
Assignees []string `json:"assignees"`
125-
Milestone *int64 `json:"milestone"`
126-
State *string `json:"state"`
121+
Title string `json:"title"`
122+
Body *string `json:"body"`
123+
Assignee *string `json:"assignee"`
124+
Assignees []string `json:"assignees"`
125+
Milestone *int64 `json:"milestone"`
126+
State *string `json:"state"`
127127
// swagger:strfmt date-time
128-
Deadline *time.Time `json:"due_date"`
128+
Deadline *time.Time `json:"due_date"`
129129
}
130130

131131
// EditIssue modify an existing issue for a given repository
@@ -138,3 +138,17 @@ func (c *Client) EditIssue(owner, repo string, index int64, opt EditIssueOption)
138138
return issue, c.getParsedResponse("PATCH", fmt.Sprintf("/repos/%s/%s/issues/%d", owner, repo, index),
139139
jsonHeader, bytes.NewReader(body), issue)
140140
}
141+
142+
// EditDeadlineOption options for creating a deadline
143+
type EditDeadlineOption struct {
144+
// required:true
145+
// swagger:strfmt date-time
146+
Deadline *time.Time `json:"due_date"`
147+
}
148+
149+
// IssueDeadline represents an issue deadline
150+
// swagger:model
151+
type IssueDeadline struct {
152+
// swagger:strfmt date-time
153+
Deadline *time.Time `json:"due_date"`
154+
}

gitea/pull.go

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,16 @@ func (c *Client) GetPullRequest(owner, repo string, index int64) (*PullRequest,
8585

8686
// CreatePullRequestOption options when creating a pull request
8787
type CreatePullRequestOption struct {
88-
Head string `json:"head" binding:"Required"`
89-
Base string `json:"base" binding:"Required"`
90-
Title string `json:"title" binding:"Required"`
91-
Body string `json:"body"`
92-
Assignee string `json:"assignee"`
93-
Assignees []string `json:"assignees"`
94-
Milestone int64 `json:"milestone"`
95-
Labels []int64 `json:"labels"`
88+
Head string `json:"head" binding:"Required"`
89+
Base string `json:"base" binding:"Required"`
90+
Title string `json:"title" binding:"Required"`
91+
Body string `json:"body"`
92+
Assignee string `json:"assignee"`
93+
Assignees []string `json:"assignees"`
94+
Milestone int64 `json:"milestone"`
95+
Labels []int64 `json:"labels"`
9696
// swagger:strfmt date-time
97-
Deadline *time.Time `json:"due_date"`
97+
Deadline *time.Time `json:"due_date"`
9898
}
9999

100100
// CreatePullRequest create pull request with options
@@ -110,15 +110,15 @@ func (c *Client) CreatePullRequest(owner, repo string, opt CreatePullRequestOpti
110110

111111
// EditPullRequestOption options when modify pull request
112112
type EditPullRequestOption struct {
113-
Title string `json:"title"`
114-
Body string `json:"body"`
115-
Assignee string `json:"assignee"`
116-
Assignees []string `json:"assignees"`
117-
Milestone int64 `json:"milestone"`
118-
Labels []int64 `json:"labels"`
119-
State *string `json:"state"`
113+
Title string `json:"title"`
114+
Body string `json:"body"`
115+
Assignee string `json:"assignee"`
116+
Assignees []string `json:"assignees"`
117+
Milestone int64 `json:"milestone"`
118+
Labels []int64 `json:"labels"`
119+
State *string `json:"state"`
120120
// swagger:strfmt date-time
121-
Deadline *time.Time `json:"due_date"`
121+
Deadline *time.Time `json:"due_date"`
122122
}
123123

124124
// EditPullRequest modify pull request with PR id and options

0 commit comments

Comments
 (0)