issue.go (gitea-1.13.1) | : | issue.go (gitea-1.13.2) | ||
---|---|---|---|---|
skipping to change at line 124 | skipping to change at line 124 | |||
} | } | |||
// ListIssues returns all issues assigned the authenticated user | // ListIssues returns all issues assigned the authenticated user | |||
func (c *Client) ListIssues(opt ListIssueOption) ([]*Issue, *Response, error) { | func (c *Client) ListIssues(opt ListIssueOption) ([]*Issue, *Response, error) { | |||
opt.setDefaults() | opt.setDefaults() | |||
issues := make([]*Issue, 0, opt.PageSize) | issues := make([]*Issue, 0, opt.PageSize) | |||
link, _ := url.Parse("/repos/issues/search") | link, _ := url.Parse("/repos/issues/search") | |||
link.RawQuery = opt.QueryEncode() | link.RawQuery = opt.QueryEncode() | |||
resp, err := c.getParsedResponse("GET", link.String(), jsonHeader, nil, & issues) | resp, err := c.getParsedResponse("GET", link.String(), jsonHeader, nil, & issues) | |||
if e := c.CheckServerVersionConstraint(">=1.12.0"); e != nil { | if e := c.checkServerVersionGreaterThanOrEqual(version1_12_0); e != nil { | |||
for i := 0; i < len(issues); i++ { | for i := 0; i < len(issues); i++ { | |||
if issues[i].Repository != nil { | if issues[i].Repository != nil { | |||
issues[i].Repository.Owner = strings.Split(issues [i].Repository.FullName, "/")[0] | issues[i].Repository.Owner = strings.Split(issues [i].Repository.FullName, "/")[0] | |||
} | } | |||
} | } | |||
} | } | |||
return issues, resp, err | return issues, resp, err | |||
} | } | |||
// ListRepoIssues returns all issues for a given repository | // ListRepoIssues returns all issues for a given repository | |||
func (c *Client) ListRepoIssues(owner, repo string, opt ListIssueOption) ([]*Iss ue, *Response, error) { | func (c *Client) ListRepoIssues(owner, repo string, opt ListIssueOption) ([]*Iss ue, *Response, error) { | |||
opt.setDefaults() | opt.setDefaults() | |||
issues := make([]*Issue, 0, opt.PageSize) | issues := make([]*Issue, 0, opt.PageSize) | |||
link, _ := url.Parse(fmt.Sprintf("/repos/%s/%s/issues", owner, repo)) | link, _ := url.Parse(fmt.Sprintf("/repos/%s/%s/issues", owner, repo)) | |||
link.RawQuery = opt.QueryEncode() | link.RawQuery = opt.QueryEncode() | |||
resp, err := c.getParsedResponse("GET", link.String(), jsonHeader, nil, & issues) | resp, err := c.getParsedResponse("GET", link.String(), jsonHeader, nil, & issues) | |||
if e := c.CheckServerVersionConstraint(">=1.12.0"); e != nil { | if e := c.checkServerVersionGreaterThanOrEqual(version1_12_0); e != nil { | |||
for i := 0; i < len(issues); i++ { | for i := 0; i < len(issues); i++ { | |||
if issues[i].Repository != nil { | if issues[i].Repository != nil { | |||
issues[i].Repository.Owner = strings.Split(issues [i].Repository.FullName, "/")[0] | issues[i].Repository.Owner = strings.Split(issues [i].Repository.FullName, "/")[0] | |||
} | } | |||
} | } | |||
} | } | |||
return issues, resp, err | return issues, resp, err | |||
} | } | |||
// GetIssue returns a single issue for a given repository | // GetIssue returns a single issue for a given repository | |||
func (c *Client) GetIssue(owner, repo string, index int64) (*Issue, *Response, e rror) { | func (c *Client) GetIssue(owner, repo string, index int64) (*Issue, *Response, e rror) { | |||
issue := new(Issue) | issue := new(Issue) | |||
resp, err := c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/issues/ %d", owner, repo, index), nil, nil, issue) | resp, err := c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/issues/ %d", owner, repo, index), nil, nil, issue) | |||
if e := c.CheckServerVersionConstraint(">=1.12.0"); e != nil && issue.Rep ository != nil { | if e := c.checkServerVersionGreaterThanOrEqual(version1_12_0); e != nil & & issue.Repository != nil { | |||
issue.Repository.Owner = strings.Split(issue.Repository.FullName, "/")[0] | issue.Repository.Owner = strings.Split(issue.Repository.FullName, "/")[0] | |||
} | } | |||
return issue, resp, err | return issue, resp, err | |||
} | } | |||
// CreateIssueOption options to create one issue | // CreateIssueOption options to create one issue | |||
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 | // username of assignee | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added |