1
0
mirror of https://github.com/interviewstreet/go-jira.git synced 2025-07-03 00:27:05 +02:00

Add UpdateComment method

This commit is contained in:
Morgan Patch
2017-08-31 14:46:04 -07:00
parent acbc88d595
commit 418d671092
2 changed files with 52 additions and 0 deletions

View File

@ -646,6 +646,30 @@ func (s *IssueService) AddComment(issueID string, comment *Comment) (*Comment, *
return responseComment, resp, nil
}
// UpdateComment updates the body of a comment, identified by comment.ID, on the issueID.
//
// JIRA API docs: https://docs.atlassian.com/jira/REST/cloud/#api/2/issue/{issueIdOrKey}/comment-updateComment
func (s *IssueService) UpdateComment(issueID string, comment *Comment) (*Comment, *Response, error) {
reqBody := struct {
Body string `json:"body"`
}{
Body: comment.Body,
}
apiEndpoint := fmt.Sprintf("rest/api/2/issue/%s/comment/%s", issueID, comment.ID)
req, err := s.client.NewRequest("POST", apiEndpoint, reqBody)
if err != nil {
return nil, nil, err
}
responseComment := new(Comment)
resp, err := s.client.Do(req, responseComment)
if err != nil {
return nil, resp, err
}
return responseComment, resp, nil
}
// AddLink adds a link between two issues.
//
// JIRA API docs: https://docs.atlassian.com/jira/REST/latest/#api/2/issueLink