@@ -15,18 +15,17 @@ class ActivityService extends Service {
15
15
///
16
16
/// API docs: https://developer.github.com/v3/activity/events/#list-public-events
17
17
Stream <Event > listPublicEvents ({int pages = 2 }) {
18
- return PaginationHelper (github).objects (
19
- 'GET' , '/events' , (dynamic i) => Event .fromJson (i),
20
- pages: pages);
18
+ return PaginationHelper (github)
19
+ .objects ('GET' , '/events' , Event .fromJson, pages: pages);
21
20
}
22
21
23
22
/// Lists public events for a network of repositories.
24
23
///
25
24
/// API docs: https://developer.github.com/v3/activity/events/#list-public-events-for-a-network-of-repositories
26
25
Stream <Event > listRepositoryNetworkEvents (RepositorySlug slug,
27
26
{int pages = 2 }) {
28
- return PaginationHelper (github).objects ('GET' ,
29
- '/networks/${slug .fullName }/events' , ( dynamic i) => Event .fromJson (i) ,
27
+ return PaginationHelper (github).objects (
28
+ 'GET' , ' /networks/${slug .fullName }/events' , Event .fromJson,
30
29
pages: pages);
31
30
}
32
31
@@ -47,9 +46,7 @@ class ActivityService extends Service {
47
46
/// API docs: https://developer.github.com/v3/activity/events/#list-repository-events
48
47
Stream <Event > listRepositoryIssueEvents (RepositorySlug slug, {int ? pages}) {
49
48
return PaginationHelper (github).objects (
50
- 'GET' ,
51
- '/repos/${slug .fullName }/issues/events' ,
52
- (dynamic i) => Event .fromJson (i),
49
+ 'GET' , '/repos/${slug .fullName }/issues/events' , Event .fromJson,
53
50
pages: pages);
54
51
}
55
52
@@ -62,8 +59,8 @@ class ActivityService extends Service {
62
59
///
63
60
/// API docs: https://developer.github.com/v3/activity/events/#list-repository-events
64
61
Stream <Event > listRepositoryEvents (RepositorySlug slug, {int ? pages}) {
65
- return PaginationHelper (github).objects ('GET' ,
66
- '/repos/${slug .fullName }/events' , ( dynamic i) => Event .fromJson (i) ,
62
+ return PaginationHelper (github).objects (
63
+ 'GET' , ' /repos/${slug .fullName }/events' , Event .fromJson,
67
64
pages: pages);
68
65
}
69
66
@@ -77,9 +74,8 @@ class ActivityService extends Service {
77
74
///
78
75
/// API docs: https://developer.github.com/v3/activity/events/#list-public-events-for-an-organization
79
76
Stream <Event > listEventsForOrganization (String name, {int ? pages}) {
80
- return PaginationHelper (github).objects (
81
- 'GET' , '/orgs/$name /events' , (dynamic i) => Event .fromJson (i),
82
- pages: pages);
77
+ return PaginationHelper (github)
78
+ .objects ('GET' , '/orgs/$name /events' , Event .fromJson, pages: pages);
83
79
}
84
80
85
81
/// Returns an [EventPoller] for public events for an organization.
@@ -105,16 +101,16 @@ class ActivityService extends Service {
105
101
/// API docs: https://developer.github.com/v3/activity/events/#list-events-performed-by-a-user
106
102
Stream <Event > listEventsPerformedByUser (String username, {int ? pages}) {
107
103
return PaginationHelper (github).objects (
108
- 'GET' , '/users/$username /events' , ( dynamic i) => Event .fromJson (i) ,
104
+ 'GET' , '/users/$username /events' , Event .fromJson,
109
105
pages: pages);
110
106
}
111
107
112
108
/// Lists the public events performed by a user.
113
109
///
114
110
/// API docs: https://developer.github.com/v3/activity/events/#list-public-events-performed-by-a-user
115
111
Stream <Event > listPublicEventsPerformedByUser (String username, {int ? pages}) {
116
- return PaginationHelper (github).objects ('GET' ,
117
- '/users/$username /events/public' , ( dynamic i) => Event .fromJson (i) ,
112
+ return PaginationHelper (github).objects (
113
+ 'GET' , ' /users/$username /events/public' , Event .fromJson,
118
114
pages: pages);
119
115
}
120
116
@@ -132,7 +128,7 @@ class ActivityService extends Service {
132
128
Stream <Notification > listNotifications (
133
129
{bool all = false , bool participating = false }) {
134
130
return PaginationHelper (github).objects (
135
- 'GET' , '/notifications' , ( dynamic i) => Notification .fromJson (i) ,
131
+ 'GET' , '/notifications' , Notification .fromJson,
136
132
params: {'all' : all, 'participating' : participating});
137
133
}
138
134
@@ -141,10 +137,8 @@ class ActivityService extends Service {
141
137
/// API docs: https://developer.github.com/v3/activity/notifications/#list-your-notifications-in-a-repository
142
138
Stream <Notification > listRepositoryNotifications (RepositorySlug repository,
143
139
{bool all = false , bool participating = false }) {
144
- return PaginationHelper (github).objects (
145
- 'GET' ,
146
- '/repos/${repository .fullName }/notifications' ,
147
- (dynamic i) => Notification .fromJson (i),
140
+ return PaginationHelper (github).objects ('GET' ,
141
+ '/repos/${repository .fullName }/notifications' , Notification .fromJson,
148
142
params: {'all' : all, 'participating' : participating});
149
143
}
150
144
@@ -192,8 +186,7 @@ class ActivityService extends Service {
192
186
/// API docs: https://developer.github.com/v3/activity/notifications/#view-a-single-thread
193
187
Future <Notification > getThread (String threadId) =>
194
188
github.getJSON ('/notification/threads/$threadId ' ,
195
- statusCode: StatusCodes .OK ,
196
- convert: (dynamic i) => Notification .fromJson (i));
189
+ statusCode: StatusCodes .OK , convert: Notification .fromJson);
197
190
198
191
/// Mark the specified notification thread as read.
199
192
///
@@ -214,8 +207,8 @@ class ActivityService extends Service {
214
207
///
215
208
/// API docs: https://developer.github.com/v3/activity/starring/#list-stargazers
216
209
Stream <User > listStargazers (RepositorySlug slug, {int perPage = 30 }) {
217
- return PaginationHelper (github).objects ('GET' ,
218
- '/repos/${slug .fullName }/stargazers' , ( dynamic i) => User .fromJson (i) ,
210
+ return PaginationHelper (github).objects (
211
+ 'GET' , ' /repos/${slug .fullName }/stargazers' , User .fromJson,
219
212
params: {'per_page' : perPage});
220
213
}
221
214
@@ -224,7 +217,7 @@ class ActivityService extends Service {
224
217
/// API docs: https://developer.github.com/v3/activity/starring/#list-repositories-being-starred
225
218
Stream <Repository > listStarredByUser (String user, {int perPage = 30 }) {
226
219
return PaginationHelper (github).objects (
227
- 'GET' , '/users/$user /starred' , ( dynamic i) => Repository .fromJson (i) ,
220
+ 'GET' , '/users/$user /starred' , Repository .fromJson,
228
221
params: {'per_page' : perPage});
229
222
}
230
223
@@ -233,7 +226,7 @@ class ActivityService extends Service {
233
226
/// API docs: https://developer.github.com/v3/activity/starring/#list-repositories-being-starred
234
227
Stream <Repository > listStarred ({int perPage = 30 }) {
235
228
return PaginationHelper (github).objects (
236
- 'GET' , '/user/starred' , ( dynamic i) => Repository .fromJson (i) ,
229
+ 'GET' , '/user/starred' , Repository .fromJson,
237
230
params: {'per_page' : perPage});
238
231
}
239
232
@@ -272,24 +265,24 @@ class ActivityService extends Service {
272
265
///
273
266
/// API docs: https://developer.github.com/v3/activity/watching/#list-watchers
274
267
Stream <User > listWatchers (RepositorySlug slug) {
275
- return PaginationHelper (github). objects ( 'GET' ,
276
- ' /repos/${slug .fullName }/subscribers' , ( dynamic i) => User .fromJson (i) );
268
+ return PaginationHelper (github)
269
+ . objects ( 'GET' , ' /repos/${slug .fullName }/subscribers' , User .fromJson);
277
270
}
278
271
279
272
/// Lists the repositories the specified user is watching.
280
273
///
281
274
/// API docs: https://developer.github.com/v3/activity/watching/#list-repositories-being-watched
282
275
Stream <Repository > listWatchedByUser (String user) {
283
- return PaginationHelper (github). objects ( 'GET' , '/users/$ user /subscriptions' ,
284
- ( dynamic i) => Repository .fromJson (i) );
276
+ return PaginationHelper (github)
277
+ . objects ( 'GET' , '/users/$ user /subscriptions' , Repository .fromJson);
285
278
}
286
279
287
280
/// Lists the repositories the current user is watching.
288
281
///
289
282
/// API docs: https://developer.github.com/v3/activity/watching/#list-repositories-being-watched
290
283
Stream <Repository > listWatched () {
291
- return PaginationHelper (github). objects (
292
- 'GET' , '/user/subscriptions' , ( dynamic i) => Repository .fromJson (i) );
284
+ return PaginationHelper (github)
285
+ . objects ( 'GET' , '/user/subscriptions' , Repository .fromJson);
293
286
}
294
287
295
288
/// Fetches repository subscription information.
@@ -298,8 +291,7 @@ class ActivityService extends Service {
298
291
Future <RepositorySubscription > getRepositorySubscription (
299
292
RepositorySlug slug) =>
300
293
github.getJSON ('/repos/${slug .fullName }/subscription' ,
301
- statusCode: StatusCodes .OK ,
302
- convert: (dynamic i) => RepositorySubscription .fromJson (i));
294
+ statusCode: StatusCodes .OK , convert: RepositorySubscription .fromJson);
303
295
304
296
/// Sets the Repository Subscription Status
305
297
///
@@ -315,7 +307,7 @@ class ActivityService extends Service {
315
307
return github.putJSON (
316
308
'/repos/${slug .fullName }/subscription' ,
317
309
statusCode: StatusCodes .OK ,
318
- convert: ( dynamic i) => RepositorySubscription .fromJson (i) ,
310
+ convert: RepositorySubscription .fromJson,
319
311
body: GitHubJson .encode (map),
320
312
);
321
313
}
0 commit comments