Skip to content

Commit 4ea3299

Browse files
committed
More endpoints for issue-api
1 parent 9687205 commit 4ea3299

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

gitea/issue.go

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,25 @@ type ListIssueOption struct {
5151
State string
5252
}
5353

54-
// ListRepoIssues list one repos' issues
54+
// ListIssues returns all issues assigned the authenticated user
55+
func (c *Client) ListIssues(opt ListIssueOption) ([]*Issue, error) {
56+
issues := make([]*Issue, 0, 10)
57+
return issues, c.getParsedResponse("GET", fmt.Sprintf("/issues?page=%d", opt.Page), nil, nil, &issues)
58+
}
59+
60+
// ListUserIssues returns all issues assigned to the authenticated user
61+
func (c *Client) ListUserIssues(opt ListIssueOption) ([]*Issue, error) {
62+
issues := make([]*Issue, 0, 10)
63+
return issues, c.getParsedResponse("GET", fmt.Sprintf("/user/issues?page=%d", opt.Page), nil, nil, &issues)
64+
}
65+
66+
// ListRepoIssues returns all issues for a given repository
5567
func (c *Client) ListRepoIssues(owner, repo string, opt ListIssueOption) ([]*Issue, error) {
5668
issues := make([]*Issue, 0, 10)
5769
return issues, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/issues?page=%d", owner, repo, opt.Page), nil, nil, &issues)
5870
}
5971

60-
// GetIssue get some one issue of repository
72+
// GetIssue returns a single issue for a given repository
6173
func (c *Client) GetIssue(owner, repo string, index int64) (*Issue, error) {
6274
issue := new(Issue)
6375
return issue, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/issues/%d", owner, repo, index), nil, nil, issue)
@@ -73,7 +85,7 @@ type CreateIssueOption struct {
7385
Closed bool `json:"closed"`
7486
}
7587

76-
// CreateIssue create an issue with options
88+
// CreateIssue create a new issue for a given repository
7789
func (c *Client) CreateIssue(owner, repo string, opt CreateIssueOption) (*Issue, error) {
7890
body, err := json.Marshal(&opt)
7991
if err != nil {
@@ -93,7 +105,7 @@ type EditIssueOption struct {
93105
State *string `json:"state"`
94106
}
95107

96-
// EditIssue modify an issue of repository
108+
// EditIssue modify an existing issue for a given repository
97109
func (c *Client) EditIssue(owner, repo string, index int64, opt EditIssueOption) (*Issue, error) {
98110
body, err := json.Marshal(&opt)
99111
if err != nil {

0 commit comments

Comments
 (0)