mirror of
https://github.com/interviewstreet/go-jira.git
synced 2025-06-27 00:21:07 +02:00
Merge pull request #177 from namely/master
Adds ability to configure whether updates notify users
This commit is contained in:
25
issue.go
25
issue.go
@ -29,6 +29,13 @@ type IssueService struct {
|
|||||||
client *Client
|
client *Client
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UpdateQueryOptions specifies the optional parameters to the Edit issue
|
||||||
|
type UpdateQueryOptions struct {
|
||||||
|
NotifyUsers bool `url:"notifyUsers,omitempty"`
|
||||||
|
OverrideScreenSecurity bool `url:"overrideScreenSecurity,omitempty"`
|
||||||
|
OverrideEditableFlag bool `url:"overrideEditableFlag,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
// Issue represents a JIRA issue.
|
// Issue represents a JIRA issue.
|
||||||
type Issue struct {
|
type Issue struct {
|
||||||
Expand string `json:"expand,omitempty" structs:"expand,omitempty"`
|
Expand string `json:"expand,omitempty" structs:"expand,omitempty"`
|
||||||
@ -655,12 +662,17 @@ func (s *IssueService) Create(issue *Issue) (*Issue, *Response, error) {
|
|||||||
return responseIssue, resp, nil
|
return responseIssue, resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update updates an issue from a JSON representation. The issue is found by key.
|
// UpdateWithOptions updates an issue from a JSON representation,
|
||||||
|
// while also specifiying query params. The issue is found by key.
|
||||||
//
|
//
|
||||||
// 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) UpdateWithOptions(issue *Issue, opts *UpdateQueryOptions) (*Issue, *Response, error) {
|
||||||
apiEndpoint := fmt.Sprintf("rest/api/2/issue/%v", issue.Key)
|
apiEndpoint := fmt.Sprintf("rest/api/2/issue/%v", issue.Key)
|
||||||
req, err := s.client.NewRequest("PUT", apiEndpoint, issue)
|
url, err := addOptions(apiEndpoint, opts)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
req, err := s.client.NewRequest("PUT", url, issue)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
@ -676,6 +688,13 @@ func (s *IssueService) Update(issue *Issue) (*Issue, *Response, error) {
|
|||||||
return &ret, resp, nil
|
return &ret, resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update updates an issue from a JSON representation. The issue is found by key.
|
||||||
|
//
|
||||||
|
// JIRA API docs: https://docs.atlassian.com/jira/REST/cloud/#api/2/issue-editIssue
|
||||||
|
func (s *IssueService) Update(issue *Issue) (*Issue, *Response, error) {
|
||||||
|
return s.UpdateWithOptions(issue, nil)
|
||||||
|
}
|
||||||
|
|
||||||
// UpdateIssue updates an issue from a JSON representation. The issue is found by key.
|
// UpdateIssue updates an issue from a JSON representation. The issue is found by key.
|
||||||
//
|
//
|
||||||
// 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
|
||||||
|
24
jira_test.go
24
jira_test.go
@ -440,30 +440,6 @@ func TestClient_GetBaseURL_WithURL(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// REMOVED : This actually calls a live URL. It's not a unit test.
|
|
||||||
// I'm also not really sure what it's testing.
|
|
||||||
// func TestClient_Do_PagingInfoEmptyByDefault(t *testing.T) {
|
|
||||||
// c, _ := NewClient(nil, testJIRAInstanceURL)
|
|
||||||
// req, _ := c.NewRequest("GET", "/", nil)
|
|
||||||
// t.Errorf("%v\n", req)
|
|
||||||
// type foo struct {
|
|
||||||
// A string
|
|
||||||
// }
|
|
||||||
// body := new(foo)
|
|
||||||
|
|
||||||
// resp, _ := c.Do(req, body)
|
|
||||||
|
|
||||||
// if resp.StartAt != 0 {
|
|
||||||
// t.Errorf("StartAt not equal to 0")
|
|
||||||
// }
|
|
||||||
// if resp.MaxResults != 0 {
|
|
||||||
// t.Errorf("StartAt not equal to 0")
|
|
||||||
// }
|
|
||||||
// if resp.Total != 0 {
|
|
||||||
// t.Errorf("StartAt not equal to 0")
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
func TestBasicAuthTransport(t *testing.T) {
|
func TestBasicAuthTransport(t *testing.T) {
|
||||||
setup()
|
setup()
|
||||||
defer teardown()
|
defer teardown()
|
||||||
|
Reference in New Issue
Block a user