Add Ref to Issue structs (#466)

Add Ref to Issue structs

Add TEST

Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/466
Reviewed-by: Andrew Thornton <art27@cantab.net>
Reviewed-by: Norwin <noerw@noreply.gitea.io>
Co-Authored-By: 6543 <6543@obermui.de>
Co-Committed-By: 6543 <6543@obermui.de>
This commit is contained in:
6543 2020-12-16 06:16:31 +08:00
parent 68eec69f47
commit cd52f0058b
2 changed files with 11 additions and 3 deletions

View File

@ -39,6 +39,7 @@ type Issue struct {
OriginalAuthorID int64 `json:"original_author_id"`
Title string `json:"title"`
Body string `json:"body"`
Ref string `json:"ref"`
Labels []*Label `json:"labels"`
Milestone *Milestone `json:"milestone"`
// deprecated
@ -173,7 +174,9 @@ func (c *Client) GetIssue(owner, repo string, index int64) (*Issue, *Response, e
type CreateIssueOption struct {
Title string `json:"title"`
Body string `json:"body"`
// username of assignee
Ref string `json:"ref"`
// deprecated
// TODO: rm on sdk 0.15.0
Assignee string `json:"assignee"`
Assignees []string `json:"assignees"`
Deadline *time.Time `json:"due_date"`
@ -210,8 +213,11 @@ 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"`
Title string `json:"title"`
Body *string `json:"body"`
Ref *string `json:"ref"`
// deprecated
// TODO: rm on sdk 0.15.0
Assignee *string `json:"assignee"`
Assignees []string `json:"assignees"`
Milestone *int64 `json:"milestone"`

View File

@ -59,11 +59,13 @@ func editIssues(t *testing.T, c *Client) {
Title: "Edited",
Body: OptionalString("123 test and go"),
State: &state,
Ref: OptionalString("master"),
})
assert.NoError(t, err)
assert.EqualValues(t, issue.ID, issueNew.ID)
assert.EqualValues(t, "123 test and go", issueNew.Body)
assert.EqualValues(t, "Edited", issueNew.Title)
assert.EqualValues(t, "master", issueNew.Ref)
}
func listIssues(t *testing.T, c *Client) {