Skip to content

Commit c0a7adf

Browse files
authored
Merge pull request #265 from aleksandr-m/feature/stars_per_page
Add per page parameter to stars related activities
2 parents 2446c27 + c13d3d7 commit c0a7adf

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

lib/src/common/activity_service.dart

+10-7
Original file line numberDiff line numberDiff line change
@@ -215,25 +215,28 @@ class ActivityService extends Service {
215215
/// Lists people who have starred the specified repo.
216216
///
217217
/// API docs: https://developer.github.com/v3/activity/starring/#list-stargazers
218-
Stream<User> listStargazers(RepositorySlug slug) {
218+
Stream<User> listStargazers(RepositorySlug slug, {int perPage = 30}) {
219219
return PaginationHelper(github).objects('GET',
220-
'/repos/${slug.fullName}/stargazers', (dynamic i) => User.fromJson(i));
220+
'/repos/${slug.fullName}/stargazers', (dynamic i) => User.fromJson(i),
221+
params: {'per_page': perPage});
221222
}
222223

223224
/// Lists all the repos starred by a user.
224225
///
225226
/// API docs: https://developer.github.com/v3/activity/starring/#list-repositories-being-starred
226-
Stream<Repository> listStarredByUser(String user) {
227+
Stream<Repository> listStarredByUser(String user, {int perPage = 30}) {
227228
return PaginationHelper(github).objects(
228-
'GET', '/users/$user/starred', (dynamic i) => Repository.fromJson(i));
229+
'GET', '/users/$user/starred', (dynamic i) => Repository.fromJson(i),
230+
params: {'per_page': perPage});
229231
}
230232

231233
/// Lists all the repos by the current user.
232234
///
233235
/// API docs: https://developer.github.com/v3/activity/starring/#list-repositories-being-starred
234-
Stream<Repository> listStarred() {
235-
return PaginationHelper(github)
236-
.objects('GET', '/user/starred', (dynamic i) => Repository.fromJson(i));
236+
Stream<Repository> listStarred({int perPage = 30}) {
237+
return PaginationHelper(github).objects(
238+
'GET', '/user/starred', (dynamic i) => Repository.fromJson(i),
239+
params: {'per_page': perPage});
237240
}
238241

239242
/// Checks if the currently authenticated user has starred the specified repository.

0 commit comments

Comments
 (0)