@@ -855,8 +855,67 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
855
855
856
856
} ) ;
857
857
} ;
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
+
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
+
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
+
858
917
callback ( response . statusCode + ': Error while updating' ) ;
859
-
918
+
860
919
} ) ;
861
920
} ;
862
921
// ## List Transitions ##
0 commit comments