node-jira icon indicating copy to clipboard operation
node-jira copied to clipboard

get all sprints for a rapidId ... maybe a patch

Open sebs opened this issue 11 years ago • 0 comments

after some fidleing and reading the docs I came up with this function I needed for some reason

JiraApi.prototype.getAllSprintsForRapidId = function (rapidViewId, callback) {

  var options = {
    rejectUnauthorized: this.strictSSL,
    uri: this.makeUri('/sprintquery/' + rapidViewId, 'rest/greenhopper/'),
    method: 'GET',
    json: true
  };


  this.request(options, function (error, response) {

    if (error) {
      callback(error, null);
      return;
    }

    if (response.statusCode === 404) {
      callback('Invalid URL');
      return;
    }

    if (response.statusCode !== 200) {
      callback(response.statusCode + ': Unable to connect to JIRA during sprints search.');
      return;
    }

    if (response.body !== null) {
      var sprints = response.body;
      callback(null, sprints);
      return;
    }

  });

}

sebs avatar Feb 18 '14 17:02 sebs