mirror of
https://github.com/interviewstreet/go-jira.git
synced 2025-02-03 13:11:49 +02:00
Adds ability to configure whether updates notify users
This commit is contained in:
parent
d8ff51da51
commit
c6f546da3a
5
issue.go
5
issue.go
@ -27,6 +27,7 @@ const (
|
|||||||
// JIRA API docs: https://docs.atlassian.com/jira/REST/latest/#api/2/issue
|
// JIRA API docs: https://docs.atlassian.com/jira/REST/latest/#api/2/issue
|
||||||
type IssueService struct {
|
type IssueService struct {
|
||||||
client *Client
|
client *Client
|
||||||
|
Notify bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// Issue represents a JIRA issue.
|
// 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
|
// JIRA API docs: https://docs.atlassian.com/jira/REST/cloud/#api/2/issue-editIssue
|
||||||
func (s *IssueService) Update(issue *Issue) (*Issue, *Response, error) {
|
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)
|
req, err := s.client.NewRequest("PUT", apiEndpoint, issue)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
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
|
// 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) {
|
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)
|
req, err := s.client.NewRequest("PUT", apiEndpoint, data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
4
jira.go
4
jira.go
@ -50,7 +50,7 @@ type Client struct {
|
|||||||
// As an alternative you can use Session Cookie based authentication provided by this package as well.
|
// 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
|
// 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.
|
// 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 {
|
if httpClient == nil {
|
||||||
httpClient = http.DefaultClient
|
httpClient = http.DefaultClient
|
||||||
}
|
}
|
||||||
@ -70,7 +70,7 @@ func NewClient(httpClient *http.Client, baseURL string) (*Client, error) {
|
|||||||
baseURL: parsedBaseURL,
|
baseURL: parsedBaseURL,
|
||||||
}
|
}
|
||||||
c.Authentication = &AuthenticationService{client: c}
|
c.Authentication = &AuthenticationService{client: c}
|
||||||
c.Issue = &IssueService{client: c}
|
c.Issue = &IssueService{client: c, Notify: notify}
|
||||||
c.Project = &ProjectService{client: c}
|
c.Project = &ProjectService{client: c}
|
||||||
c.Board = &BoardService{client: c}
|
c.Board = &BoardService{client: c}
|
||||||
c.Sprint = &SprintService{client: c}
|
c.Sprint = &SprintService{client: c}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user