Change the deprecated url by the new one to edit and delete an issue comment (#181)

This commit is contained in:
ngourdon 2019-06-14 02:12:43 +00:00 committed by Gitea
parent 7e711e06b5
commit bd51a6c8a9

View file

@ -38,17 +38,17 @@ func (c *Client) CreateIssueComment(owner, repo string, index int64, opt structs
} }
// EditIssueComment edits an issue comment. // EditIssueComment edits an issue comment.
func (c *Client) EditIssueComment(owner, repo string, index, commentID int64, opt structs.EditIssueCommentOption) (*Comment, error) { func (c *Client) EditIssueComment(owner, repo string, commentID int64, opt structs.EditIssueCommentOption) (*Comment, error) {
body, err := json.Marshal(&opt) body, err := json.Marshal(&opt)
if err != nil { if err != nil {
return nil, err return nil, err
} }
comment := new(Comment) comment := new(Comment)
return comment, c.getParsedResponse("PATCH", fmt.Sprintf("/repos/:%s/:%s/issues/%d/comments/%d", owner, repo, index, commentID), jsonHeader, bytes.NewReader(body), comment) return comment, c.getParsedResponse("PATCH", fmt.Sprintf("/repos/%s/%s/issues/comments/%d", owner, repo, commentID), jsonHeader, bytes.NewReader(body), comment)
} }
// DeleteIssueComment deletes an issue comment. // DeleteIssueComment deletes an issue comment.
func (c *Client) DeleteIssueComment(owner, repo string, index, commentID int64) error { func (c *Client) DeleteIssueComment(owner, repo string, commentID int64) error {
_, err := c.getResponse("DELETE", fmt.Sprintf("/repos/%s/%s/issues/%d/comments/%d", owner, repo, index, commentID), nil, nil) _, err := c.getResponse("DELETE", fmt.Sprintf("/repos/%s/%s/issues/comments/%d", owner, repo, commentID), nil, nil)
return err return err
} }