File tree Expand file tree Collapse file tree 3 files changed +37
-1
lines changed
Expand file tree Collapse file tree 3 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -386,6 +386,23 @@ To read all the issues of a given repository
386386issues .list (options, function (err , issues ) {});
387387```
388388
389+ To create an issue
390+
391+ ``` js
392+ var options = {
393+ title: " Found a bug" ,
394+ body: " I'm having a problem with this." ,
395+ assignee: " assignee_username" ,
396+ milestone: 1 ,
397+ labels: [
398+ " Label1" ,
399+ " Label2"
400+ ]
401+ };
402+
403+ issues .create (options, function (err , issue ) {});
404+ ```
405+
389406To comment in a issue
390407
391408``` js
Original file line number Diff line number Diff line change 10081008 Github . Issue = function ( options ) {
10091009 var path = '/repos/' + options . user + '/' + options . repo + '/issues' ;
10101010
1011+ this . create = function ( options , cb ) {
1012+ _request ( 'POST' , path , options , cb ) ;
1013+ } ;
1014+
10111015 this . list = function ( options , cb ) {
10121016 var query = [ ] ;
10131017
11151119 } ;
11161120
11171121 return Github ;
1118- } ) ) ;
1122+ } ) ) ;
Original file line number Diff line number Diff line change @@ -17,6 +17,21 @@ describe('Github.Issue', function() {
1717 issues = github . getIssues ( testUser . USERNAME , 'TestRepo' ) ;
1818 } ) ;
1919
20+ it ( 'should create issue' , function ( done ) {
21+ issues . create ( {
22+ title : 'New issue' ,
23+ body : 'New issue body'
24+ } , function ( err , issue , xhr ) {
25+ should . not . exist ( err ) ;
26+ xhr . should . be . instanceof ( XMLHttpRequest ) ;
27+ should . exist ( issue . url ) ;
28+ issue . title . should . equal ( 'New issue' ) ;
29+ issue . body . should . equal ( 'New issue body' ) ;
30+
31+ done ( ) ;
32+ } ) ;
33+ } ) ;
34+
2035 it ( 'should list issues' , function ( done ) {
2136 issues . list ( { } , function ( err , issues , xhr ) {
2237 should . not . exist ( err ) ;
You can’t perform that action at this time.
0 commit comments