var listSprints = function(request, reply) {
	var projectId = request.params.projectId;

	jira.getSprintsForProject(projectId, function (error, sprints) {
		if (error) throw error; // maybe we should start thinking about error handling :D
		reply(sprints).type('application/json');
	});
};
var findIssue = function(issueId) {
	var deferred = Q.defer();
	jira.findIssue(issueId, function(error, issue) {
		if (error) {
			return deferred.reject(error);
		}

		deferred.resolve(issue);
	});

	return deferred.promise;
};
	return function(rapidView) {
		var deferred = Q.defer();
		jira.getSprintIssues(rapidView.id, sprintId, function(error, issues) {
			if (error) {
				return deferred.reject(error);
			}

			deferred.resolve(issues);
		});

		return deferred.promise;
	}
var findRapidView = function(project) {
	var deferred = Q.defer();
	jira.findRapidView(project.name, function(error, rapidView) {
		if (error) {
			return deferred.reject(error);
		}

		deferred.resolve(rapidView);
	});

	return deferred.promise;
};
var getProject = function(projectId) {
	var deferred = Q.defer();
	jira.getProject(projectId, function(error, project) {
		if (error) {
			return deferred.reject(error);
		}

		deferred.resolve(project);
	});

	return deferred.promise;
};