1
0
mirror of https://github.com/interviewstreet/go-jira.git synced 2025-03-31 21:55:08 +02:00

[Jira Comment api] Add: Comment api v3

This commit is contained in:
samyakgaur 2021-10-13 15:39:08 +05:30
parent 8b237cdcde
commit 369c077c50

View File

@ -956,6 +956,33 @@ 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 string `json:"body"`
}{
Body: comment.Body.(string),
// 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