diff --git a/lib/jira.js b/lib/jira.js index 190e2661..2bb3caf3 100644 --- a/lib/jira.js +++ b/lib/jira.js @@ -200,6 +200,9 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor // ### Takes ### // // * issueNumber: the issueNumber to find + // * optional: object containing any optional query string arguments as specified in the API. + // For backwards compatibility, this input is optional. Therefore, this proc can be + // called with findIssue(issuenumber, callback). // * callback: for when it's done // // ### Returns ### @@ -208,7 +211,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor // * issue: an object of the issue // // [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#id290709) - this.findIssue = function(issueNumber, callback) { + this.findIssue = function(issueNumber, optional, callback) { var options = { rejectUnauthorized: this.strictSSL, @@ -216,6 +219,17 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor method: 'GET' }; + // For backwards compatibility, allow "optional" to have not been passed in + // i.e. there are only two arguments to the function - issueNumber and callback + if (arguments.length == 2) { + callback = optional + optional = null + } + + if (optional != null) { + options.qs = optional + } + this.doRequest(options, function(error, response, body) { if (error) {