Skip to content

Commit

Permalink
Merge pull request #349 from jira-node/update-worklog
Browse files Browse the repository at this point in the history
Add updateWorklog method
  • Loading branch information
Seth10001 authored Oct 12, 2022
2 parents fa68d30 + 6d98ffe commit bc43d06
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/jira.js
Original file line number Diff line number Diff line change
Expand Up @@ -1362,6 +1362,24 @@ export default class JiraApi {
}));
}

/** Update worklog from issue
* [Jira Doc](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-worklogs/#api-rest-api-2-issue-issueidorkey-worklog-id-put)
* @name updateWorklog
* @function
* @param {string} issueId - the Id of the issue to update
* @param {string} worklogId - the Id of the worklog in issue to update
* @param {string} body - value to set
*/
updateWorklog(issueId, worklogId, body) {
return this.doRequest(this.makeRequestHeader(this.makeUri({
pathname: `/issue/${issueId}/worklog/${worklogId}`,
}), {
method: 'PUT',
body,
followAllRedirects: true,
}));
}

/** Deletes an issue link.
* [Jira Doc](https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-rest-api-3-issueLink-linkId-delete)
* @name deleteIssueLink
Expand Down
5 changes: 5 additions & 0 deletions test/jira-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,11 @@ describe('Jira API Tests', () => {
result.should.eql('http://jira.somehost.com:8080/rest/api/2.0/issue/someIssueNumber/worklog/someWorklogId');
});

it('updateWorklog hits proper url', async () => {
const result = await dummyURLCall('updateWorklog', ['someIssueNumber', 'someWorklogId']);
result.should.eql('http://jira.somehost.com:8080/rest/api/2.0/issue/someIssueNumber/worklog/someWorklogId');
});

it('deleteIssueLink hits proper url', async () => {
const result = await dummyURLCall('deleteIssueLink', ['someLinkId']);
result.should.eql('http://jira.somehost.com:8080/rest/api/2.0/issueLink/someLinkId');
Expand Down

0 comments on commit bc43d06

Please sign in to comment.