issues

Github, Jira, Gitlab issues from Plan 9's acme
Log | Files | Refs | README | LICENSE

commit f89e6959eeefa36199b1e3da13833da91e6bc5bf
parent fe16fe01487af6519ff5099959c52917bc7e5deb
Author: Oliver Lowe <o@olowe.co>
Date:   Tue, 28 Jul 2026 22:14:24 +1000

hub: initial create issue support

Diffstat:
Missue/hub/hub.go | 21+++++++++++++++++++++
1 file changed, 21 insertions(+), 0 deletions(-)

diff --git a/issue/hub/hub.go b/issue/hub/hub.go @@ -124,6 +124,27 @@ func (c *Client) Issues(owner, repo string) ([]Issue, error) { return issues, err } +func (c *Client) CreateIssue(owner, repo, title, body string) (*Issue, error) { + m := map[string]string{ + "title": title, + "body": body, + } + b, err := json.Marshal(&m) + if err != nil { + return nil, fmt.Errorf("encode issue: %w", err) + } + p := path.Join("/repos", owner, repo, "issues") + resp, err := c.post(p, bytes.NewReader(b)) + if resp.StatusCode != http.StatusCreated { + // TODO(otl): decode error message + return nil, errors.New(resp.Status) + } + defer resp.Body.Close() + var issue Issue + err = json.NewDecoder(resp.Body).Decode(&issue) + return &issue, err +} + func (c *Client) Comments(owner, repo string, issue int) ([]Comment, error) { var comments []Comment p := path.Join("/repos", owner, repo, "issues", strconv.Itoa(issue), "comments")