Skip to content

Commit 2a9b17d

Browse files
author
Christoffer Pettersson
committed
Added possibility to delete a worklog
1 parent efc81d4 commit 2a9b17d

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ JiraApi options:
117117
* Set Max Results
118118
* Set Start-At parameter for results
119119
* Add a worklog
120+
* Delete a worklog
120121
* Add new estimate for worklog
121122
* Add a comment
122123
* Remote links (aka Web Links)

lib/jira.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1557,6 +1557,47 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
15571557
});
15581558
};
15591559

1560+
// ## Delete worklog from issue ##
1561+
// ### Takes ###
1562+
//
1563+
// * issueId: the Id of the issue to delete
1564+
// * worklogId: the Id of the worklog in issue to delete
1565+
// * callback: for when it's done
1566+
//
1567+
// ### Returns ###
1568+
// * error string
1569+
// * success object
1570+
//
1571+
// [Jira Doc](https://docs.atlassian.com/jira/REST/latest/#d2e1673)
1572+
1573+
this.deleteWorklog = function(issueId, worklogId, callback) {
1574+
1575+
var options = {
1576+
rejectUnauthorized: this.strictSSL,
1577+
uri: this.makeUri('/issue/' + issueId + '/worklog/' + worklogId),
1578+
method: 'DELETE',
1579+
followAllRedirects: true,
1580+
json: true
1581+
};
1582+
1583+
this.doRequest(options, function(error, response) {
1584+
1585+
if (error) {
1586+
callback(error, null);
1587+
return;
1588+
}
1589+
1590+
if (response.statusCode === 204) {
1591+
callback(null, "Success");
1592+
return;
1593+
}
1594+
1595+
callback(response.statusCode + ': Error while deleting');
1596+
1597+
});
1598+
1599+
};
1600+
15601601
// ## List all Issue Types ##
15611602
// ### Takes ###
15621603
//

0 commit comments

Comments
 (0)