Skip to content

Commit 6d98ffe

Browse files
committed
Add updateWorklog method
1 parent 9dc7c18 commit 6d98ffe

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/jira.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,6 +1362,24 @@ export default class JiraApi {
13621362
}));
13631363
}
13641364

1365+
/** Update worklog from issue
1366+
* [Jira Doc](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-worklogs/#api-rest-api-2-issue-issueidorkey-worklog-id-put)
1367+
* @name updateWorklog
1368+
* @function
1369+
* @param {string} issueId - the Id of the issue to update
1370+
* @param {string} worklogId - the Id of the worklog in issue to update
1371+
* @param {string} body - value to set
1372+
*/
1373+
updateWorklog(issueId, worklogId, body) {
1374+
return this.doRequest(this.makeRequestHeader(this.makeUri({
1375+
pathname: `/issue/${issueId}/worklog/${worklogId}`,
1376+
}), {
1377+
method: 'PUT',
1378+
body,
1379+
followAllRedirects: true,
1380+
}));
1381+
}
1382+
13651383
/** Deletes an issue link.
13661384
* [Jira Doc](https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-rest-api-3-issueLink-linkId-delete)
13671385
* @name deleteIssueLink

test/jira-tests.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,11 @@ describe('Jira API Tests', () => {
798798
result.should.eql('http://jira.somehost.com:8080/rest/api/2.0/issue/someIssueNumber/worklog/someWorklogId');
799799
});
800800

801+
it('updateWorklog hits proper url', async () => {
802+
const result = await dummyURLCall('updateWorklog', ['someIssueNumber', 'someWorklogId']);
803+
result.should.eql('http://jira.somehost.com:8080/rest/api/2.0/issue/someIssueNumber/worklog/someWorklogId');
804+
});
805+
801806
it('deleteIssueLink hits proper url', async () => {
802807
const result = await dummyURLCall('deleteIssueLink', ['someLinkId']);
803808
result.should.eql('http://jira.somehost.com:8080/rest/api/2.0/issueLink/someLinkId');

0 commit comments

Comments
 (0)