From cadd27a036f355b3a5d6bf39a9d4ead93d833123 Mon Sep 17 00:00:00 2001 From: Lanre Adelowo Date: Thu, 7 Feb 2019 21:50:18 +0100 Subject: [PATCH] add SDK methods for starting/stopping a stopwatch --- gitea/issue.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/gitea/issue.go b/gitea/issue.go index 8fc2b2b..0a1defb 100644 --- a/gitea/issue.go +++ b/gitea/issue.go @@ -139,6 +139,22 @@ func (c *Client) EditIssue(owner, repo string, index int64, opt EditIssueOption) jsonHeader, bytes.NewReader(body), issue) } +// StartIssueStopWatch starts a stopwatch for an existing issue for a given +// repository +func (c *Client) StartIssueStopWatch(owner, repo string, index int64) error { + _, err := c.getResponse("POST", fmt.Sprintf("/repos/%s/%s/issues/%d/stopwatch/start", owner, repo, index), + jsonHeader, nil) + return err +} + +// StopIssueStopWatch stops an existing stopwatch for an issue in a given +// repository +func (c *Client) StopIssueStopWatch(owner, repo string, index int64) error { + _, err := c.getResponse("POST", fmt.Sprintf("/repos/%s/%s/issues/%d/stopwatch/stop", owner, repo, index), + jsonHeader, nil) + return err +} + // EditDeadlineOption options for creating a deadline type EditDeadlineOption struct { // required:true