mirror of
https://github.com/interviewstreet/go-jira.git
synced 2025-03-19 20:57:47 +02:00
POST for comments and PUT for issues - Thanks to @rumyantseva
This commit is contained in:
parent
10af43a35a
commit
1d62c4bf25
42
issue.go
42
issue.go
@ -248,3 +248,45 @@ func (s *IssueService) Create(issue *Issue) (*Issue, *http.Response, error) {
|
||||
|
||||
return responseIssue, resp, nil
|
||||
}
|
||||
|
||||
func (s *IssueService) UpdateFields(issueID string, fields map[string]string) (*Issue, *http.Response, error) {
|
||||
apiEndpoint := fmt.Sprintf("rest/api/2/issue/%s", issueID)
|
||||
|
||||
type FieldsParams struct {
|
||||
Fields map[string]string `json:"fields"`
|
||||
}
|
||||
|
||||
params := FieldsParams{
|
||||
Fields: fields,
|
||||
}
|
||||
|
||||
req, err := s.client.NewRequest("PUT", apiEndpoint, params)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
responseIssue := new(Issue)
|
||||
resp, _ := s.client.Do(req, responseIssue)
|
||||
|
||||
return responseIssue, resp, nil
|
||||
}
|
||||
|
||||
func (s *IssueService) AddComment(issueID string, comment string) (*Issue, *http.Response, error) {
|
||||
apiEndpoint := fmt.Sprintf("rest/api/2/issue/%s/comment", issueID)
|
||||
|
||||
type CommentBody struct {
|
||||
Body string `json:"body"`
|
||||
}
|
||||
|
||||
params := CommentBody{Body: comment}
|
||||
|
||||
req, err := s.client.NewRequest("POST", apiEndpoint, params)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
responseIssue := new(Issue)
|
||||
resp, _ := s.client.Do(req, responseIssue)
|
||||
|
||||
return responseIssue, resp, nil
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user