Skip to content

Fix pagination logic to use next link #418

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

Merged
merged 3 commits into from
Apr 18, 2025
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
## 9.25.0-wip
## 9.25.0

* Require Dart 3.5
* Require `package:http` `^1.0.0`.
* Fix pagination logic to use `next` link.

## 9.24.0

Expand Down
6 changes: 2 additions & 4 deletions lib/src/common/util/pagination.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ class PaginationHelper {
params = Map.from(params);
}

var page = params['page'] ?? 1;
params['page'] = page;

while (true) {
http.Response response;
try {
Expand Down Expand Up @@ -70,7 +67,8 @@ class PaginationHelper {
break;
}

params['page'] = ++page;
path = next;
params = null;
}
}

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: github
version: 9.25.0-wip
version: 9.25.0
description: A high-level GitHub API Client Library that uses Github's v3 API
homepage: https://github.com/SpinlockLabs/github.dart

Expand Down
4 changes: 2 additions & 2 deletions test/common/repos_service_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void main() {
test('listCommits', () async {
final repositories = create((request) async {
expect(request.url.path, '/repos/${slug.fullName}/commits');
expect(request.url.query, 'page=1');
expect(request.url.query, isEmpty);

return Response(listCommits, StatusCodes.OK);
});
Expand All @@ -29,7 +29,7 @@ void main() {
expect(request.url.path, '/repos/${slug.fullName}/commits');
expect(
request.url.query,
'author=octocat&committer=octodog&sha=abc&path=%2Fpath&since=2022-02-22T00%3A00%3A00.000&until=2023-02-22T00%3A00%3A00.000&page=1',
'author=octocat&committer=octodog&sha=abc&path=%2Fpath&since=2022-02-22T00%3A00%3A00.000&until=2023-02-22T00%3A00%3A00.000',
);
return Response(listCommits, StatusCodes.OK);
});
Expand Down
2 changes: 1 addition & 1 deletion test/git_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ void main() {
test('code search', () async {
nock(fakeApiUrl)
.get(
'/search/code?q=search%20repo%3ASpinlockLabs%2Fgithub.dart%20in%3Afile&per_page=20&page=1')
'/search/code?q=search%20repo%3ASpinlockLabs%2Fgithub.dart%20in%3Afile&per_page=20')
.reply(200, nocked.searchResults);

final results = (await github.search
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy