@@ -35,7 +35,8 @@ class Repository {
35
35
/**
36
36
* If the Repository is a fork
37
37
*/
38
- bool fork;
38
+ @ApiName ("fork" )
39
+ bool isFork;
39
40
40
41
/**
41
42
* Url to the GitHub Repository Page
@@ -150,7 +151,7 @@ class Repository {
150
151
..name = input['name' ]
151
152
..id = input['id' ]
152
153
..fullName = input['full_name' ]
153
- ..fork = input['fork' ]
154
+ ..isFork = input['fork' ]
154
155
..url = input['html_url' ]
155
156
..description = input['description' ]
156
157
..cloneUrls = new CloneUrls ()
@@ -263,6 +264,11 @@ class Repository {
263
264
return copyOf (hooks.map ((it) => Hook .fromJSON (github, fullName, it)));
264
265
});
265
266
}
267
+
268
+ Future <Repository > fork ([CreateFork request]) {
269
+ if (request == null ) request = new CreateFork ();
270
+ return github.postJSON ("/repos/${fullName }/forks" , body: request.toJSON (), convert: Repository .fromJSON);
271
+ }
266
272
267
273
/**
268
274
* Gets the Repository Releases
@@ -535,4 +541,16 @@ class LanguageBreakdown {
535
541
});
536
542
return buffer.toString ();
537
543
}
544
+ }
545
+
546
+ class CreateFork {
547
+ final String organization;
548
+
549
+ CreateFork ([this .organization]);
550
+
551
+ String toJSON () {
552
+ var map = {};
553
+ putValue ("organization" , organization, map);
554
+ return JSON .encode (map);
555
+ }
538
556
}
0 commit comments