mirror of
https://github.com/interviewstreet/go-jira.git
synced 2025-02-19 19:10:12 +02:00
Merge pull request #2 from bluevare/samyak-jira-comment
✨ [Jira Comment api] Add: Update comment api v3
This commit is contained in:
commit
0b82da1f17
26
issue.go
26
issue.go
@ -956,6 +956,32 @@ func (s *IssueService) AddComment(issueID string, comment *Comment) (*Comment, *
|
||||
return s.AddCommentWithContext(context.Background(), issueID, comment)
|
||||
}
|
||||
|
||||
func (s *IssueService) UpdateCommentWithContextv3(ctx context.Context, issueID string, comment *Commentv3) (*Commentv3, *Response, error) {
|
||||
reqBody := struct {
|
||||
Body interface{} `json:"body"`
|
||||
}{
|
||||
Body: comment.Body,
|
||||
}
|
||||
apiEndpoint := fmt.Sprintf("rest/api/3/issue/%s/comment/%s", issueID, comment.ID)
|
||||
req, err := s.client.NewRequestWithContext(ctx, "PUT", apiEndpoint, reqBody)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
responseComment := new(Commentv3)
|
||||
resp, err := s.client.Do(req, responseComment)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return responseComment, resp, nil
|
||||
}
|
||||
|
||||
// UpdateComment wraps UpdateCommentWithContext using the background context.
|
||||
func (s *IssueService) UpdateCommentv3(issueID string, comment *Commentv3) (*Commentv3, *Response, error) {
|
||||
return s.UpdateCommentWithContextv3(context.Background(), issueID, comment)
|
||||
}
|
||||
|
||||
// UpdateCommentWithContext 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
|
||||
|
Loading…
x
Reference in New Issue
Block a user