Skip to content

Commit 3d757d4

Browse files
committed
Merge pull request #60 from anton-rudeshko/minors
A bunch of minor fixes Added IntelliJ IDEA workspace to .gitignore Fixed mixed tabs and spaces (replaced tabs with spaces) Fixed typo Fixed inappropriate JSDoc params Added missing semicolons and proper indent
2 parents c6916ef + 0bb859e commit 3d757d4

File tree

2 files changed

+117
-115
lines changed

2 files changed

+117
-115
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,7 @@ logs
1212
results
1313

1414
node_modules
15-
npm-debug.log
15+
npm-debug.log
16+
17+
.idea
18+
*.iml

lib/jira.js

Lines changed: 113 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
// * `Jira API Version<string>`: Known to work with `2` and `2.0.alpha1`
5050
// * `verbose<bool>`: Log some info to the console, usually for debugging
5151
// * `strictSSL<bool>`: Set to false if you have self-signed certs or something non-trustworthy
52-
// * `oauth`: A disctionary of `consumer_key`, `consumer_secret`, `access_token` and `access_token_secret` to be used for OAuth authentication.
52+
// * `oauth`: A dictionary of `consumer_key`, `consumer_secret`, `access_token` and `access_token_secret` to be used for OAuth authentication.
5353
//
5454
// ## Implemented APIs ##
5555
//
@@ -249,7 +249,6 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
249249
// * count: count of unresolved issues for requested version
250250
//
251251
// [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#id288524)
252-
253252
this.getUnresolvedIssueCount = function(version, callback) {
254253
var options = {
255254
rejectUnauthorized: this.strictSSL,
@@ -291,7 +290,6 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
291290
// * project: the json object representing the entire project
292291
//
293292
// [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#id289232)
294-
295293
this.getProject = function(project, callback) {
296294

297295
var options = {
@@ -391,7 +389,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
391389
/**
392390
* Returns a list of sprints belonging to a Rapid View.
393391
*
394-
* @param rapidView ID
392+
* @param rapidViewId
395393
* @param callback
396394
*/
397395
this.getLastSprintForRapidView = function(rapidViewId, callback) {
@@ -443,8 +441,8 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
443441
/**
444442
* Returns sprint and issues information
445443
*
446-
* @param rapidView ID
447-
* @param sprint ID
444+
* @param rapidViewId
445+
* @param sprintId
448446
* @param callback
449447
*/
450448
this.getSprintIssues = function getSprintIssues(rapidViewId, sprintId, callback) {
@@ -565,8 +563,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
565563
* }
566564
*
567565
* @param link
568-
* @param errorCallback
569-
* @param successCallback
566+
* @param callback
570567
*/
571568
this.issueLink = function(link, callback) {
572569

@@ -611,7 +608,6 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
611608
// * versions: array of the versions for a product
612609
//
613610
// [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#id289653)
614-
615611
this.getVersions = function(project, callback) {
616612

617613
var options = {
@@ -784,7 +780,6 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
784780
// * issues: array of issues for the user
785781
//
786782
// [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#id333082)
787-
//
788783
this.searchJira = function(searchString, optional, callback) {
789784
// backwards compatibility
790785
optional = optional || {};
@@ -949,17 +944,18 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
949944

950945
});
951946
};
952-
// ## Delete issue to Jira ##
953-
// ### Takes ###
954-
//
955-
// * issueId: the Id of the issue to delete
956-
// * callback: for when it's done
957-
//
958-
// ### Returns ###
959-
// * error string
960-
// * success object
961-
//
962-
// [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#id290791)
947+
948+
// ## Delete issue to Jira ##
949+
// ### Takes ###
950+
//
951+
// * issueId: the Id of the issue to delete
952+
// * callback: for when it's done
953+
//
954+
// ### Returns ###
955+
// * error string
956+
// * success object
957+
//
958+
// [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#id290791)
963959
this.deleteIssue = function(issueNum, callback) {
964960
var options = {
965961
rejectUnauthorized: this.strictSSL,
@@ -985,6 +981,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
985981

986982
});
987983
};
984+
988985
// ## Update issue in Jira ##
989986
// ### Takes ###
990987
//
@@ -1264,6 +1261,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
12641261

12651262
});
12661263
};
1264+
12671265
// ## Transition issue in Jira ##
12681266
// ### Takes ###
12691267
//
@@ -1354,6 +1352,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
13541352

13551353
});
13561354
};
1355+
13571356
// ## Add a comment to an issue ##
13581357
// ### Takes ###
13591358
// * issueId: Issue to add a comment to
@@ -1394,6 +1393,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
13941393
}
13951394
});
13961395
};
1396+
13971397
// ## Add a worklog to a project ##
13981398
// ### Takes ###
13991399
// * issueId: Issue to add a worklog to
@@ -1434,8 +1434,8 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
14341434
*/
14351435
this.addWorklog = function(issueId, worklog, newEstimate, callback) {
14361436
if(typeof callback == 'undefined') {
1437-
callback = newEstimate
1438-
newEstimate = false
1437+
callback = newEstimate;
1438+
newEstimate = false;
14391439
}
14401440
var options = {
14411441
rejectUnauthorized: this.strictSSL,
@@ -1470,6 +1470,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
14701470

14711471
});
14721472
};
1473+
14731474
// ## List all Issue Types ##
14741475
// ### Takes ###
14751476
//
@@ -1690,7 +1691,6 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
16901691
});
16911692
};
16921693

1693-
16941694
// ## Describe the currently authenticated user ##
16951695
// ### Takes ###
16961696
//
@@ -1715,7 +1715,6 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
17151715
* }
17161716
* }
17171717
*/
1718-
17191718
this.getCurrentUser = function(callback) {
17201719
var options = {
17211720
rejectUnauthorized: this.strictSSL,
@@ -1742,94 +1741,94 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
17421741
};
17431742

17441743
// ## Retrieve the backlog of a certain Rapid View ##
1745-
// ### Takes ###
1746-
// * rapidViewId: rapid view id
1747-
// * callback: for when it's done
1748-
//
1749-
// ### Returns ###
1750-
// * error string
1751-
// * backlog object
1752-
/*
1753-
* Backlog item is in the format:
1754-
* {
1755-
* "sprintMarkersMigrated": true,
1756-
* "issues": [
1757-
* {
1758-
* "id": 67890,
1759-
* "key": "KEY-1234",
1760-
* "summary": "Issue Summary",
1761-
* ...
1762-
* }
1763-
* ],
1764-
* "rankCustomFieldId": 12345,
1765-
* "sprints": [
1766-
* {
1767-
* "id": 123,
1768-
* "name": "Sprint Name",
1769-
* "state": "FUTURE",
1770-
* ...
1771-
* }
1772-
* ],
1773-
* "supportsPages": true,
1774-
* "projects": [
1775-
* {
1776-
* "id": 567,
1777-
* "key": "KEY",
1778-
* "name": "Project Name"
1779-
* }
1780-
* ],
1781-
* "epicData": {
1782-
* "epics": [
1783-
* {
1784-
* "id": 9876,
1785-
* "key": "KEY-4554",
1786-
* "typeName": "Epic",
1787-
* ...
1788-
* }
1789-
* ],
1790-
* "canEditEpics": true,
1791-
* "supportsPages": true
1792-
* },
1793-
* "canManageSprints": true,
1794-
* "maxIssuesExceeded": false,
1795-
* "queryResultLimit": 2147483647,
1796-
* "versionData": {
1797-
* "versionsPerProject": {
1798-
* "567": [
1799-
* {
1800-
* "id": 8282,
1801-
* "name": "Version Name",
1802-
* ...
1803-
* }
1804-
* ]
1805-
* },
1806-
* "canCreateVersion": true
1807-
* }
1808-
* }
1809-
*/
1810-
this.getBacklogForRapidView = function(rapidViewId, callback) {
1811-
var options = {
1812-
rejectUnauthorized: this.strictSSL,
1813-
uri: this.makeUri('/xboard/plan/backlog/data?rapidViewId=' + rapidViewId, 'rest/greenhopper/'),
1814-
method: 'GET',
1815-
json: true
1816-
};
1817-
1818-
this.doRequest(options, function(error, response) {
1819-
if (error) {
1820-
callback(error, null);
1821-
1822-
return;
1823-
}
1824-
1825-
if (response.statusCode === 200) {
1826-
callback(null, response.body);
1827-
1828-
return;
1829-
}
1830-
1831-
callback(response.statusCode + ': Error while retrieving backlog');
1832-
});
1833-
};
1744+
// ### Takes ###
1745+
// * rapidViewId: rapid view id
1746+
// * callback: for when it's done
1747+
//
1748+
// ### Returns ###
1749+
// * error string
1750+
// * backlog object
1751+
/*
1752+
* Backlog item is in the format:
1753+
* {
1754+
* "sprintMarkersMigrated": true,
1755+
* "issues": [
1756+
* {
1757+
* "id": 67890,
1758+
* "key": "KEY-1234",
1759+
* "summary": "Issue Summary",
1760+
* ...
1761+
* }
1762+
* ],
1763+
* "rankCustomFieldId": 12345,
1764+
* "sprints": [
1765+
* {
1766+
* "id": 123,
1767+
* "name": "Sprint Name",
1768+
* "state": "FUTURE",
1769+
* ...
1770+
* }
1771+
* ],
1772+
* "supportsPages": true,
1773+
* "projects": [
1774+
* {
1775+
* "id": 567,
1776+
* "key": "KEY",
1777+
* "name": "Project Name"
1778+
* }
1779+
* ],
1780+
* "epicData": {
1781+
* "epics": [
1782+
* {
1783+
* "id": 9876,
1784+
* "key": "KEY-4554",
1785+
* "typeName": "Epic",
1786+
* ...
1787+
* }
1788+
* ],
1789+
* "canEditEpics": true,
1790+
* "supportsPages": true
1791+
* },
1792+
* "canManageSprints": true,
1793+
* "maxIssuesExceeded": false,
1794+
* "queryResultLimit": 2147483647,
1795+
* "versionData": {
1796+
* "versionsPerProject": {
1797+
* "567": [
1798+
* {
1799+
* "id": 8282,
1800+
* "name": "Version Name",
1801+
* ...
1802+
* }
1803+
* ]
1804+
* },
1805+
* "canCreateVersion": true
1806+
* }
1807+
* }
1808+
*/
1809+
this.getBacklogForRapidView = function(rapidViewId, callback) {
1810+
var options = {
1811+
rejectUnauthorized: this.strictSSL,
1812+
uri: this.makeUri('/xboard/plan/backlog/data?rapidViewId=' + rapidViewId, 'rest/greenhopper/'),
1813+
method: 'GET',
1814+
json: true
1815+
};
1816+
1817+
this.doRequest(options, function(error, response) {
1818+
if (error) {
1819+
callback(error, null);
1820+
1821+
return;
1822+
}
1823+
1824+
if (response.statusCode === 200) {
1825+
callback(null, response.body);
1826+
1827+
return;
1828+
}
1829+
1830+
callback(response.statusCode + ': Error while retrieving backlog');
1831+
});
1832+
};
18341833

18351834
}).call(JiraApi.prototype);

0 commit comments

Comments
 (0)