Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add per page parameter to stars related activities #265

Merged
merged 1 commit into from
Oct 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions lib/src/common/activity_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -215,25 +215,28 @@ class ActivityService extends Service {
/// Lists people who have starred the specified repo.
///
/// API docs: https://developer.github.com/v3/activity/starring/#list-stargazers
Stream<User> listStargazers(RepositorySlug slug) {
Stream<User> listStargazers(RepositorySlug slug, {int perPage = 30}) {
return PaginationHelper(github).objects('GET',
'/repos/${slug.fullName}/stargazers', (dynamic i) => User.fromJson(i));
'/repos/${slug.fullName}/stargazers', (dynamic i) => User.fromJson(i),
params: {'per_page': perPage});
}

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

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

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