@@ -18,7 +18,7 @@ class ActivityService extends Service {
18
18
/// API docs: https://developer.github.com/v3/activity/events/#list-public-events
19
19
Stream <Event > listPublicEvents ({int pages = 2 }) {
20
20
return PaginationHelper (github)
21
- .objects ('GET' , '/events' , Event .fromJSON , pages: pages);
21
+ .objects ('GET' , '/events' , (i) => Event .fromJson (i) , pages: pages);
22
22
}
23
23
24
24
/// Lists public events for a network of repositories.
@@ -27,7 +27,7 @@ class ActivityService extends Service {
27
27
Stream <Event > listRepositoryNetworkEvents (RepositorySlug slug,
28
28
{int pages = 2 }) {
29
29
return PaginationHelper (github).objects (
30
- 'GET' , '/networks/${slug .fullName }/events' , Event .fromJSON ,
30
+ 'GET' , '/networks/${slug .fullName }/events' , (i) => Event .fromJson (i) ,
31
31
pages: pages);
32
32
}
33
33
@@ -47,8 +47,8 @@ class ActivityService extends Service {
47
47
///
48
48
/// API docs: https://developer.github.com/v3/activity/events/#list-repository-events
49
49
Stream <Event > listRepositoryIssueEvents (RepositorySlug slug, {int pages}) {
50
- return PaginationHelper (github).objects (
51
- 'GET' , ' /repos/${slug .fullName }/issues/events' , Event .fromJSON ,
50
+ return PaginationHelper (github).objects ('GET' ,
51
+ '/repos/${slug .fullName }/issues/events' , (i) => Event .fromJson (i) ,
52
52
pages: pages);
53
53
}
54
54
@@ -62,7 +62,7 @@ class ActivityService extends Service {
62
62
/// API docs: https://developer.github.com/v3/activity/events/#list-repository-events
63
63
Stream <Event > listRepositoryEvents (RepositorySlug slug, {int pages}) {
64
64
return PaginationHelper (github).objects (
65
- 'GET' , '/repos/${slug .fullName }/events' , Event .fromJSON ,
65
+ 'GET' , '/repos/${slug .fullName }/events' , (i) => Event .fromJson (i) ,
66
66
pages: pages);
67
67
}
68
68
@@ -76,8 +76,9 @@ class ActivityService extends Service {
76
76
///
77
77
/// API docs: https://developer.github.com/v3/activity/events/#list-public-events-for-an-organization
78
78
Stream <Event > listEventsForOrganization (String name, {int pages}) {
79
- return PaginationHelper (github)
80
- .objects ('GET' , '/orgs/$name /events' , Event .fromJSON, pages: pages);
79
+ return PaginationHelper (github).objects (
80
+ 'GET' , '/orgs/$name /events' , (i) => Event .fromJson (i),
81
+ pages: pages);
81
82
}
82
83
83
84
/// Returns an [EventPoller] for public events for an organization.
@@ -103,7 +104,7 @@ class ActivityService extends Service {
103
104
/// API docs: https://developer.github.com/v3/activity/events/#list-events-performed-by-a-user
104
105
Stream <Event > listEventsPerformedByUser (String username, {int pages}) {
105
106
return PaginationHelper (github).objects (
106
- 'GET' , '/users/$username /events' , Event .fromJSON ,
107
+ 'GET' , '/users/$username /events' , (i) => Event .fromJson (i) ,
107
108
pages: pages);
108
109
}
109
110
@@ -112,7 +113,7 @@ class ActivityService extends Service {
112
113
/// API docs: https://developer.github.com/v3/activity/events/#list-public-events-performed-by-a-user
113
114
Stream <Event > listPublicEventsPerformedByUser (String username, {int pages}) {
114
115
return PaginationHelper (github).objects (
115
- 'GET' , '/users/$username /events/public' , Event .fromJSON ,
116
+ 'GET' , '/users/$username /events/public' , (i) => Event .fromJson (i) ,
116
117
pages: pages);
117
118
}
118
119
@@ -214,15 +215,15 @@ class ActivityService extends Service {
214
215
/// API docs: https://developer.github.com/v3/activity/starring/#list-repositories-being-starred
215
216
Stream <Repository > listStarredByUser (String user) {
216
217
return PaginationHelper (github)
217
- .objects ('GET' , '/users/$user /starred' , Repository .fromJSON );
218
+ .objects ('GET' , '/users/$user /starred' , (i) => Repository .fromJson (i) );
218
219
}
219
220
220
221
/// Lists all the repos by the current user.
221
222
///
222
223
/// API docs: https://developer.github.com/v3/activity/starring/#list-repositories-being-starred
223
224
Stream <Repository > listStarred () {
224
225
return PaginationHelper (github)
225
- .objects ('GET' , '/user/starred' , Repository .fromJSON );
226
+ .objects ('GET' , '/user/starred' , (i) => Repository .fromJson (i) );
226
227
}
227
228
228
229
/// Checks if the currently authenticated user has starred the specified repository.
@@ -268,16 +269,16 @@ class ActivityService extends Service {
268
269
///
269
270
/// API docs: https://developer.github.com/v3/activity/watching/#list-repositories-being-watched
270
271
Stream <Repository > listWatchedByUser (String user) {
271
- return PaginationHelper (github)
272
- . objects ( 'GET' , '/users/$user /subscriptions' , Repository .fromJSON );
272
+ return PaginationHelper (github). objects (
273
+ 'GET' , '/users/$user /subscriptions' , (i) => Repository .fromJson (i) );
273
274
}
274
275
275
276
/// Lists the repositories the current user is watching.
276
277
///
277
278
/// API docs: https://developer.github.com/v3/activity/watching/#list-repositories-being-watched
278
279
Stream <Repository > listWatched () {
279
280
return PaginationHelper (github)
280
- .objects ('GET' , '/user/subscriptions' , Repository .fromJSON );
281
+ .objects ('GET' , '/user/subscriptions' , (i) => Repository .fromJson (i) );
281
282
}
282
283
283
284
/// Fetches repository subscription information.
@@ -286,7 +287,8 @@ class ActivityService extends Service {
286
287
Future <RepositorySubscription > getRepositorySubscription (
287
288
RepositorySlug slug) =>
288
289
github.getJSON ('/repos/${slug .fullName }/subscription' ,
289
- statusCode: StatusCodes .OK , convert: RepositorySubscription .fromJSON);
290
+ statusCode: StatusCodes .OK ,
291
+ convert: (i) => RepositorySubscription .fromJson (i));
290
292
291
293
/// Sets the Repository Subscription Status
292
294
///
@@ -302,7 +304,7 @@ class ActivityService extends Service {
302
304
return github.postJSON (
303
305
'/repos/${slug .fullName }/subscription' ,
304
306
statusCode: StatusCodes .OK ,
305
- convert: RepositorySubscription .fromJSON ,
307
+ convert: (i) => RepositorySubscription .fromJson (i) ,
306
308
body: jsonEncode (map),
307
309
);
308
310
}
@@ -354,7 +356,7 @@ class EventPoller {
354
356
355
357
if (! (onlyNew && _timer == null )) {
356
358
for (final item in json) {
357
- final event = Event .fromJSON (item);
359
+ final event = Event .fromJson (item);
358
360
359
361
if (after == null ? false : event.createdAt.toUtc ().isBefore (after)) {
360
362
continue ;
0 commit comments