Skip to content

Commit e2395e4

Browse files
committed
Merge pull request #110 from corgrath/master
Added possibility to delete a worklog
2 parents a1dcf47 + 2a9b17d commit e2395e4

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
@@ -118,6 +118,7 @@ JiraApi options:
118118
* Set Max Results
119119
* Set Start-At parameter for results
120120
* Add a worklog
121+
* Delete a worklog
121122
* Add new estimate for worklog
122123
* Add a comment
123124
* Remote links (aka Web Links)

lib/jira.js

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

1736+
// ## Delete worklog from issue ##
1737+
// ### Takes ###
1738+
//
1739+
// * issueId: the Id of the issue to delete
1740+
// * worklogId: the Id of the worklog in issue to delete
1741+
// * callback: for when it's done
1742+
//
1743+
// ### Returns ###
1744+
// * error string
1745+
// * success object
1746+
//
1747+
// [Jira Doc](https://docs.atlassian.com/jira/REST/latest/#d2e1673)
1748+
1749+
this.deleteWorklog = function(issueId, worklogId, callback) {
1750+
1751+
var options = {
1752+
rejectUnauthorized: this.strictSSL,
1753+
uri: this.makeUri('/issue/' + issueId + '/worklog/' + worklogId),
1754+
method: 'DELETE',
1755+
followAllRedirects: true,
1756+
json: true
1757+
};
1758+
1759+
this.doRequest(options, function(error, response) {
1760+
1761+
if (error) {
1762+
callback(error, null);
1763+
return;
1764+
}
1765+
1766+
if (response.statusCode === 204) {
1767+
callback(null, "Success");
1768+
return;
1769+
}
1770+
1771+
callback(response.statusCode + ': Error while deleting');
1772+
1773+
});
1774+
1775+
};
1776+
17361777
// ## List all Issue Types ##
17371778
// ### Takes ###
17381779
//

0 commit comments

Comments
 (0)