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

Open
sebs opened this Issue Feb 18, 2014 · 0 comments

Projects

None yet

1 participant

@sebs
sebs commented Feb 18, 2014

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;
    }

  });

}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment