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

View file

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