mirror of
https://github.com/interviewstreet/go-jira.git
synced 2024-11-28 08:39:03 +02:00
⚡ [ISSUE] Add: Get Comment API
This commit is contained in:
parent
0b82da1f17
commit
3c24251c1a
26
issue.go
26
issue.go
@ -462,6 +462,7 @@ type Comment struct {
|
||||
Name string `json:"name,omitempty" structs:"name,omitempty"`
|
||||
Author User `json:"author,omitempty" structs:"author,omitempty"`
|
||||
Body string `json:"body,omitempty" structs:"body,omitempty"`
|
||||
RenderedBody string `json:"renderedBody,omitempty" structs:"body,omitempty"`
|
||||
UpdateAuthor User `json:"updateAuthor,omitempty" structs:"updateAuthor,omitempty"`
|
||||
Updated string `json:"updated,omitempty" structs:"updated,omitempty"`
|
||||
Created string `json:"created,omitempty" structs:"created,omitempty"`
|
||||
@ -904,6 +905,31 @@ func (s *IssueService) UpdateIssue(jiraID string, data map[string]interface{}) (
|
||||
return s.UpdateIssueWithContext(context.Background(), jiraID, data)
|
||||
}
|
||||
|
||||
func (s *IssueService) GetComment(ctx context.Context, issueID string, commentID string, options *GetQueryOptions) (*Comment, *Response, error) {
|
||||
apiEndpoint := fmt.Sprintf("rest/api/2/issue/%s/comment/%s", issueID, commentID)
|
||||
req, err := s.client.NewRequestWithContext(ctx, "GET", apiEndpoint, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
if options != nil {
|
||||
q, err := query.Values(options)
|
||||
if err != nil {
|
||||
return nil, nil
|
||||
}
|
||||
req.URL.RawQuery = q.Encode()
|
||||
}
|
||||
|
||||
comment := new(Comment)
|
||||
resp, err := s.client.Do(req, comment)
|
||||
if err != nil {
|
||||
jerr := NewJiraError(resp, err)
|
||||
return nil, resp, jerr
|
||||
}
|
||||
|
||||
return issue, resp, nil
|
||||
}
|
||||
|
||||
// AddCommentWithContext adds a new comment to issueID
|
||||
//
|
||||
// https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-comments/#api-rest-api-3-comment-list-post
|
||||
|
Loading…
Reference in New Issue
Block a user