diff --git a/CHANGELOG.md b/CHANGELOG.md index 130f3844..0689b120 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -168,8 +168,6 @@ client.Issue.Create(ctx, ...) #### `BoardService.GetAllSprints` removed, `BoardService.GetAllSprintsWithOptions` renamed - -The function `client.BoardService.GetAllSprints()` has been removed. The function `client.BoardService.GetAllSprintsWithOptions()` has been renamed to `client.BoardService.GetAllSprints()`. ##### If you used `client.BoardService.GetAllSprints()`: @@ -202,8 +200,6 @@ client.Board.GetAllSprints(context.Background(), 123, &GetAllSprintsOptions{Stat #### `GroupService.Get` removed, `GroupService.GetWithOptions` renamed - -The function `client.GroupService.Get()` has been removed. The function `client.GroupService.GetWithOptions()` has been renamed to `client.GroupService.Get()`. ##### If you used `client.GroupService.Get()`: @@ -234,6 +230,38 @@ After: client.Group.Get(context.Background(), "default", &GroupSearchOptions{StartAt: 0, MaxResults: 2}) ``` +#### `Issue.Update` removed, `Issue.UpdateWithOptions` renamed + +The function `client.Issue.UpdateWithOptions()` has been renamed to `client.Issue.Update()`. + +##### If you used `client.Issue.Update()`: + +Before: + +```go +client.Issue.Update(context.Background(), issue) +``` + +After: + +```go +client.Issue.Update(context.Background(), issue, nil) +``` + +##### If you used `client.Issue.UpdateWithOptions()`: + +Before: + +```go +client.Issue.UpdateWithOptions(context.Background(), issue, nil) +``` + +After: + +```go +client.Issue.Update(context.Background(), issue, nil) +``` + ### Breaking changes * Jira On-Premise and Jira Cloud have now different clients, because the API differs @@ -243,6 +271,7 @@ client.Group.Get(context.Background(), "default", &GroupSearchOptions{StartAt: 0 * `context` is now a first class citizen in all API calls. Functions that had a suffix like `...WithContext` have been removed entirely. The API methods support the context now as first argument. * `BoardService.GetAllSprints` has been removed and `BoardService.GetAllSprintsWithOptions` has been renamed to `BoardService.GetAllSprints` * `GroupService.Get` has been removed and `GroupService.GetWithOptions` has been renamed to `GroupService.Get` +* `Issue.Update` has been removed and `Issue.UpdateWithOptions` has been renamed to `Issue.Update` ### Features diff --git a/cloud/issue.go b/cloud/issue.go index b459cd08..99dc8f01 100644 --- a/cloud/issue.go +++ b/cloud/issue.go @@ -804,12 +804,12 @@ func (s *IssueService) Create(ctx context.Context, issue *Issue) (*Issue, *Respo return responseIssue, resp, nil } -// UpdateWithOptions updates an issue from a JSON representation, +// Update updates an issue from a JSON representation, // while also specifying 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://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issues/#api-rest-api-2-issue-issueidorkey-put // Caller must close resp.Body -func (s *IssueService) UpdateWithOptions(ctx context.Context, issue *Issue, opts *UpdateQueryOptions) (*Issue, *Response, error) { +func (s *IssueService) Update(ctx context.Context, issue *Issue, opts *UpdateQueryOptions) (*Issue, *Response, error) { apiEndpoint := fmt.Sprintf("rest/api/2/issue/%v", issue.Key) url, err := addOptions(apiEndpoint, opts) if err != nil { @@ -831,13 +831,6 @@ func (s *IssueService) UpdateWithOptions(ctx context.Context, issue *Issue, opts 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(ctx context.Context, issue *Issue) (*Issue, *Response, error) { - return s.UpdateWithOptions(ctx, issue, nil) -} - // 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 diff --git a/cloud/issue_test.go b/cloud/issue_test.go index 3618b4cb..bae570e1 100644 --- a/cloud/issue_test.go +++ b/cloud/issue_test.go @@ -146,7 +146,7 @@ func TestIssueService_Update(t *testing.T) { Description: "example bug report", }, } - issue, _, err := testClient.Issue.Update(context.Background(), i) + issue, _, err := testClient.Issue.Update(context.Background(), i, nil) if issue == nil { t.Error("Expected issue. Issue is nil") } diff --git a/onpremise/issue.go b/onpremise/issue.go index 45aade5a..b549afeb 100644 --- a/onpremise/issue.go +++ b/onpremise/issue.go @@ -804,12 +804,12 @@ func (s *IssueService) Create(ctx context.Context, issue *Issue) (*Issue, *Respo return responseIssue, resp, nil } -// UpdateWithOptions updates an issue from a JSON representation, +// Update updates an issue from a JSON representation, // while also specifying 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://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issues/#api-rest-api-2-issue-issueidorkey-put // Caller must close resp.Body -func (s *IssueService) UpdateWithOptions(ctx context.Context, issue *Issue, opts *UpdateQueryOptions) (*Issue, *Response, error) { +func (s *IssueService) Update(ctx context.Context, issue *Issue, opts *UpdateQueryOptions) (*Issue, *Response, error) { apiEndpoint := fmt.Sprintf("rest/api/2/issue/%v", issue.Key) url, err := addOptions(apiEndpoint, opts) if err != nil { @@ -831,13 +831,6 @@ func (s *IssueService) UpdateWithOptions(ctx context.Context, issue *Issue, opts 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(ctx context.Context, issue *Issue) (*Issue, *Response, error) { - return s.UpdateWithOptions(ctx, issue, nil) -} - // 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 diff --git a/onpremise/issue_test.go b/onpremise/issue_test.go index 36186f78..88bdc207 100644 --- a/onpremise/issue_test.go +++ b/onpremise/issue_test.go @@ -146,7 +146,7 @@ func TestIssueService_Update(t *testing.T) { Description: "example bug report", }, } - issue, _, err := testClient.Issue.Update(context.Background(), i) + issue, _, err := testClient.Issue.Update(context.Background(), i, nil) if issue == nil { t.Error("Expected issue. Issue is nil") }