Skip to content

Commit 1feae41

Browse files
committed
Added deleteRemoteLink method.
1 parent 35d3088 commit 1feae41

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

lib/jira.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,49 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
678678
});
679679
};
680680

681+
/**
682+
* Deletes the remote links associated with the given issue.
683+
*
684+
* @param issueNumber - The internal id (not the issue key) of the issue
685+
* @param globalId - The global id of the remote link
686+
* @param callback
687+
*/
688+
this.deleteRemoteLink = function deleteRemoteLink(issueNumber, remoteLinkGID, callback) {
689+
690+
var options = {
691+
rejectUnauthorized: this.strictSSL,
692+
uri: this.makeUri('/issue/' + issueNumber + '/remotelink'),
693+
method: 'DELETE',
694+
json: true
695+
};
696+
697+
this.doRequest(options, function(error, response) {
698+
699+
if (error) {
700+
callback(error, null);
701+
return;
702+
}
703+
704+
if (response.statusCode === 404) {
705+
callback('Cannot create remote link. Invalid issue.');
706+
return;
707+
}
708+
709+
if (response.statusCode === 400) {
710+
callback('Cannot create remote link. ' + response.body.errors.title);
711+
return;
712+
}
713+
714+
if ([200, 201].indexOf(response.statusCode) < 0) {
715+
callback(response.statusCode + ': Unable to connect to JIRA during request.');
716+
return;
717+
}
718+
719+
callback(null, response.body);
720+
721+
});
722+
};
723+
681724

682725
// ## Get Versions for a project ##
683726
// ### Takes ###

0 commit comments

Comments
 (0)