1
0
mirror of https://github.com/interviewstreet/go-jira.git synced 2025-02-15 13:53:15 +02:00

Add method to link issues

The original cherry-pick was modified.
Thanks for the initial version to @rumyantseva
This commit is contained in:
Elena Grahovac 2016-02-29 10:29:44 +03:00 committed by Andy Grunwald
parent f40a31fe85
commit c920de25cf

View File

@ -171,6 +171,7 @@ type IssueLink struct {
Type IssueLinkType `json:"type"`
OutwardIssue Issue `json:"outwardIssue"`
InwardIssue Issue `json:"inwardIssue"`
Comment Comment `json:"comment"`
}
// IssueLinkType represents a type of a link between to issues in JIRA.
@ -268,7 +269,24 @@ func (s *IssueService) AddComment(issueID string, comment *Comment) (*Comment, *
}
responseComment := new(Comment)
resp, _ := s.client.Do(req, responseComment)
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
func (s *IssueService) AddLink(issueLink *IssueLink) (*http.Response, error) {
apiEndpoint := fmt.Sprintf("rest/api/2/issueLink")
req, err := s.client.NewRequest("POST", apiEndpoint, issueLink)
if err != nil {
return nil, err
}
resp, err := s.client.Do(req, nil)
return resp, err
}