@@ -62,7 +62,7 @@ class GitHub {
62
62
* Checks if a user exists.
63
63
*/
64
64
Future <bool > userExists (String name) =>
65
- request ("GET" , "/users/${name }" ).then ((resp) => resp.statusCode == 200 );
65
+ request ("GET" , "/users/${name }" ).then ((resp) => resp.statusCode == StatusCodes . OK );
66
66
67
67
/**
68
68
* Fetches the users specified by [names] .
@@ -92,7 +92,7 @@ class GitHub {
92
92
* Fetches the repository specified by the [slug] .
93
93
*/
94
94
Future <Repository > repository (RepositorySlug slug) {
95
- return getJSON ("/repos/${slug .owner }/${slug .name }" , convert: Repository .fromJSON, statusCode: 200 , fail: (http.Response response) {
95
+ return getJSON ("/repos/${slug .owner }/${slug .name }" , convert: Repository .fromJSON, statusCode: StatusCodes . OK , fail: (http.Response response) {
96
96
if (response.statusCode == 404 ) {
97
97
throw new RepositoryNotFound (this , slug.fullName);
98
98
}
@@ -140,7 +140,7 @@ class GitHub {
140
140
* Fetches the organization specified by [name] .
141
141
*/
142
142
Future <Organization > organization (String name) {
143
- return getJSON ("/orgs/${name }" , convert: Organization .fromJSON, statusCode: 200 , fail: (http.Response response) {
143
+ return getJSON ("/orgs/${name }" , convert: Organization .fromJSON, statusCode: StatusCodes . OK , fail: (http.Response response) {
144
144
if (response.statusCode == 404 ) {
145
145
throw new OrganizationNotFound (this , name);
146
146
}
@@ -300,8 +300,8 @@ class GitHub {
300
300
* Throws [AccessForbidden] if we are not authenticated.
301
301
*/
302
302
Future <CurrentUser > currentUser () {
303
- return getJSON ("/user" , statusCode: 200 , fail: (http.Response response) {
304
- if (response.statusCode == 403 ) {
303
+ return getJSON ("/user" , statusCode: StatusCodes . OK , fail: (http.Response response) {
304
+ if (response.statusCode == StatusCodes . FORBIDDEN ) {
305
305
throw new AccessForbidden (this );
306
306
}
307
307
}, convert: CurrentUser .fromJSON);
@@ -343,7 +343,7 @@ class GitHub {
343
343
* Fetches a Gist by the specified [id] .
344
344
*/
345
345
Future <Gist > gist (String id) {
346
- return getJSON ("/gist/${id }" , statusCode: 200 , convert: Gist .fromJSON);
346
+ return getJSON ("/gist/${id }" , statusCode: StatusCodes . OK , convert: Gist .fromJSON);
347
347
}
348
348
349
349
Stream <BlogPost > blogPosts ([String url = "https://github.com/blog.atom" ]) => _blogPosts (url);
@@ -409,7 +409,7 @@ class GitHub {
409
409
* Fetches a Single Notification
410
410
*/
411
411
Future <Notification > notification (String id) {
412
- return getJSON ("/notification/threads/${id }" , statusCode: 200 , convert: Notification .fromJSON);
412
+ return getJSON ("/notification/threads/${id }" , statusCode: StatusCodes . OK , convert: Notification .fromJSON);
413
413
}
414
414
415
415
/**
@@ -424,7 +424,7 @@ class GitHub {
424
424
* Fetches repository subscription information.
425
425
*/
426
426
Future <RepositorySubscription > subscription (RepositorySlug slug) {
427
- return getJSON ("/repos/${slug .fullName }/subscription" , statusCode: 200 , convert: RepositorySubscription .fromJSON);
427
+ return getJSON ("/repos/${slug .fullName }/subscription" , statusCode: StatusCodes . OK , convert: RepositorySubscription .fromJSON);
428
428
}
429
429
430
430
Stream <PublicKey > publicKeys ([String user]) {
@@ -570,7 +570,7 @@ class GitHub {
570
570
* Returns a map of the name to a url of the image.
571
571
*/
572
572
Future <Map <String , String >> emojis () {
573
- return getJSON ("/emojis" , statusCode: 200 );
573
+ return getJSON ("/emojis" , statusCode: StatusCodes . OK );
574
574
}
575
575
576
576
/**
@@ -625,15 +625,15 @@ class GitHub {
625
625
* Gets a language breakdown for the specified repository.
626
626
*/
627
627
Future <LanguageBreakdown > languages (RepositorySlug slug) =>
628
- getJSON ("/repos/${slug .fullName }/languages" , statusCode: 200 , convert: (github, input) => new LanguageBreakdown (input));
628
+ getJSON ("/repos/${slug .fullName }/languages" , statusCode: StatusCodes . OK , convert: (github, input) => new LanguageBreakdown (input));
629
629
630
630
/**
631
631
* Gets the readme file for a repository.
632
632
*/
633
633
Future <File > readme (RepositorySlug slug) {
634
634
var headers = {};
635
635
636
- return getJSON ("/repos/${slug .fullName }/readme" , headers: headers, statusCode: 200 , fail: (http.Response response) {
636
+ return getJSON ("/repos/${slug .fullName }/readme" , headers: headers, statusCode: StatusCodes . OK , fail: (http.Response response) {
637
637
if (response.statusCode == 404 ) {
638
638
throw new NotFound (this , response.body);
639
639
}
@@ -677,7 +677,7 @@ class GitHub {
677
677
* Gets the GitHub API Status.
678
678
*/
679
679
Future <APIStatus > apiStatus () {
680
- return getJSON ("https://status.github.com/api/status.json" , statusCode: 200 , convert: APIStatus .fromJSON);
680
+ return getJSON ("https://status.github.com/api/status.json" , statusCode: StatusCodes . OK , convert: APIStatus .fromJSON);
681
681
}
682
682
683
683
/**
@@ -737,7 +737,7 @@ class GitHub {
737
737
}
738
738
739
739
Future <PullRequest > pullRequest (RepositorySlug slug, int number) {
740
- return getJSON ("/repos/${slug .fullName }/pulls/${number }" , convert: PullRequest .fromJSON, statusCode: 200 );
740
+ return getJSON ("/repos/${slug .fullName }/pulls/${number }" , convert: PullRequest .fromJSON, statusCode: StatusCodes . OK );
741
741
}
742
742
743
743
/**
0 commit comments