Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow query filters in findIssue request #146

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion lib/jira.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ###
Expand All @@ -208,14 +211,25 @@ 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,
uri: this.makeUri('/issue/' + issueNumber),
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) {
Expand Down