1
0
mirror of https://github.com/interviewstreet/go-jira.git synced 2025-01-07 23:01:48 +02:00

Adds ability to configure whether updates notify users

This commit is contained in:
spmassot 2018-10-15 15:55:29 -04:00
parent d8ff51da51
commit c6f546da3a
2 changed files with 5 additions and 4 deletions

View File

@ -27,6 +27,7 @@ const (
// JIRA API docs: https://docs.atlassian.com/jira/REST/latest/#api/2/issue
type IssueService struct {
client *Client
Notify bool
}
// Issue represents a JIRA issue.
@ -653,7 +654,7 @@ func (s *IssueService) Create(issue *Issue) (*Issue, *Response, error) {
//
// JIRA API docs: https://docs.atlassian.com/jira/REST/cloud/#api/2/issue-editIssue
func (s *IssueService) Update(issue *Issue) (*Issue, *Response, error) {
apiEndpoint := fmt.Sprintf("rest/api/2/issue/%v", issue.Key)
apiEndpoint := fmt.Sprintf("rest/api/2/issue/%v?notifyUsers=%t", issue.Key, s.Notify)
req, err := s.client.NewRequest("PUT", apiEndpoint, issue)
if err != nil {
return nil, nil, err
@ -674,7 +675,7 @@ func (s *IssueService) Update(issue *Issue) (*Issue, *Response, error) {
//
// https://docs.atlassian.com/jira/REST/7.4.0/#api/2/issue-editIssue
func (s *IssueService) UpdateIssue(jiraID string, data map[string]interface{}) (*Response, error) {
apiEndpoint := fmt.Sprintf("rest/api/2/issue/%v", jiraID)
apiEndpoint := fmt.Sprintf("rest/api/2/issue/%v?notifyUsers=%t", jiraID, s.Notify)
req, err := s.client.NewRequest("PUT", apiEndpoint, data)
if err != nil {
return nil, err

View File

@ -50,7 +50,7 @@ type Client struct {
// As an alternative you can use Session Cookie based authentication provided by this package as well.
// See https://docs.atlassian.com/jira/REST/latest/#authentication
// baseURL is the HTTP endpoint of your JIRA instance and should always be specified with a trailing slash.
func NewClient(httpClient *http.Client, baseURL string) (*Client, error) {
func NewClient(httpClient *http.Client, baseURL string, notify bool) (*Client, error) {
if httpClient == nil {
httpClient = http.DefaultClient
}
@ -70,7 +70,7 @@ func NewClient(httpClient *http.Client, baseURL string) (*Client, error) {
baseURL: parsedBaseURL,
}
c.Authentication = &AuthenticationService{client: c}
c.Issue = &IssueService{client: c}
c.Issue = &IssueService{client: c, Notify: notify}
c.Project = &ProjectService{client: c}
c.Board = &BoardService{client: c}
c.Sprint = &SprintService{client: c}