Add Ref to Issue structs #466

Merged
6543 merged 3 commits from 6543/go-sdk:update_issue_struct_add_ref into master 2020-12-15 22:16:32 +00:00
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) {