Skip to content

Commit c1db1bd

Browse files
Fix #25
1 parent b448d7d commit c1db1bd

File tree

1 file changed

+60
-1
lines changed

1 file changed

+60
-1
lines changed

lib/jira.js

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -855,8 +855,67 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
855855

856856
});
857857
};
858+
859+
// ## List Components ##
860+
// ### Takes ###
861+
//
862+
// * project: key for the project
863+
// * callback: for when it's done
864+
//
865+
// ### Returns ###
866+
// * error string
867+
// * array of components
868+
//
869+
// [Jira Doc](http://docs.atlassian.com/jira/REST/latest/#id290489)
870+
/*
871+
* [{
872+
* "self": "http://localhostname:8090/jira/rest/api/2.0/component/1234",
873+
* "id": "1234",
874+
* "name": "name",
875+
* "description": "Description.",
876+
* "assigneeType": "PROJECT_DEFAULT",
877+
* "assignee": {
878+
* "self": "http://localhostname:8090/jira/rest/api/2.0/user?username=user@domain.com",
879+
* "name": "[email protected]",
880+
* "displayName": "SE Support",
881+
* "active": true
882+
* },
883+
* "realAssigneeType": "PROJECT_DEFAULT",
884+
* "realAssignee": {
885+
* "self": "http://localhostname:8090/jira/rest/api/2.0/user?username=user@domain.com",
886+
* "name": "[email protected]",
887+
* "displayName": "User name",
888+
* "active": true
889+
* },
890+
* "isAssigneeTypeValid": true
891+
* }]
892+
*/
893+
this.listComponents = function(project, callback) {
894+
var options = {
895+
rejectUnauthorized: this.strictSSL,
896+
uri: this.makeUri('/project/' + project + '/components'),
897+
method: 'GET',
898+
json: true
899+
};
900+
901+
this.request(options, function(error, response, body) {
902+
903+
if (error) {
904+
callback(error, null);
905+
return;
906+
}
907+
908+
if (response.statusCode === 200) {
909+
callback(null, body);
910+
return;
911+
}
912+
if (response.statusCode === 404) {
913+
callback("Project not found");
914+
return;
915+
}
916+
858917
callback(response.statusCode + ': Error while updating');
859-
918+
860919
});
861920
};
862921
// ## List Transitions ##

0 commit comments

Comments
 (0)