@@ -31,7 +31,7 @@ type IssueService service
3131
3232// UpdateQueryOptions specifies the optional parameters to the Edit issue
3333type UpdateQueryOptions struct {
34- NotifyUsers bool `url:"notifyUsers,omitempty"`
34+ NotifyUsers bool `url:"notifyUsers"` // can't be omitted as this means it's omitted when false which isn't desired as this defaults to true
3535 OverrideScreenSecurity bool `url:"overrideScreenSecurity,omitempty"`
3636 OverrideEditableFlag bool `url:"overrideEditableFlag,omitempty"`
3737}
@@ -559,7 +559,7 @@ type GetWorklogsQueryOptions struct {
559559}
560560
561561type AddWorklogQueryOptions struct {
562- NotifyUsers bool `url:"notifyUsers,omitempty"`
562+ NotifyUsers bool `url:"notifyUsers"` // can't be omitted as this means it's omitted when false which isn't desired as this defaults to true
563563 AdjustEstimate string `url:"adjustEstimate,omitempty"`
564564 NewEstimate string `url:"newEstimate,omitempty"`
565565 ReduceBy string `url:"reduceBy,omitempty"`
@@ -868,8 +868,24 @@ func (s *IssueService) Update(ctx context.Context, issue *Issue, opts *UpdateQue
868868// TODO Double check this method if this works as expected, is using the latest API and the response is complete
869869// This double check effort is done for v2 - Remove this two lines if this is completed.
870870func (s * IssueService ) UpdateIssue (ctx context.Context , jiraID string , data map [string ]interface {}) (* Response , error ) {
871- apiEndpoint := fmt .Sprintf ("rest/api/2/issue/%v" , jiraID )
872- req , err := s .client .NewRequest (ctx , http .MethodPut , apiEndpoint , data )
871+ return s .UpdateIssueWithOptions (ctx , jiraID , data , & UpdateQueryOptions {})
872+ }
873+
874+ // UpdateIssueWithOptions updates an issue from a JSON patch,
875+ // while also specifying query params. The issue is found by key.
876+ //
877+ // Jira API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issues/#api-rest-api-2-issue-issueidorkey-put
878+ // Caller must close resp.Body
879+ //
880+ // TODO Double check this method if this works as expected, is using the latest API and the response is complete
881+ // This double check effort is done for v2 - Remove this two lines if this is completed.
882+ func (s * IssueService ) UpdateIssueWithOptions (ctx context.Context , jiraID string , data map [string ]interface {}, opts * UpdateQueryOptions ) (* Response , error ) {
883+ a := fmt .Sprintf ("rest/api/2/issue/%v" , jiraID )
884+ url , err := addOptions (a , opts )
885+ if err != nil {
886+ return nil , err
887+ }
888+ req , err := s .client .NewRequest (ctx , http .MethodPut , url , data )
873889 if err != nil {
874890 return nil , err
875891 }
0 commit comments