Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

api: pull_requests: add pagination #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

miri64
Copy link
Contributor

@miri64 miri64 commented Jul 30, 2018

This adds Github-like pagination to the /api/pull_requests API
call.

The following rules are applied:

  • Pages start counting at 1.
  • A page can be selected via the page query argument, the number of
    entries can be set via the per_page query argument.
  • The "Link" HTTP-header provide links to appropriate pages to
    navigate to (next, last, first, prev)
  • Building and queued jobs (collectively called "pending jobs" in the
    following) are always on the first page.
  • If the number pending jobs is lesser than per_page, a subset of the
    finished jobs is shown. Their number is determined by the difference
    between per_page and the number of pending jobs.
  • If the number of pending jobs is greater than or equal to per_page,
    finished jobs start on the second page.

Fixes #18

@miri64
Copy link
Contributor Author

miri64 commented Jul 31, 2018

(murdock needed a restart since the opening of this PR so the loading times aren't that large anymore ;-))

This adds [Github-like pagination][1] to the `/api/pull_requests` API
call.

The following rules are applied:
- Pages start counting at 1.
- A page can be selected via the `page` query argument, the number of
  entries can be set via the `per_page` query argument.
- The ["Link" HTTP-header][2] provide links to appropriate pages to
  navigate to (`next`, `last`, `first`, `prev`)
- Building and queued jobs (collectively called *"pending jobs"* in the
  following) are always on the first page.
- If the number pending jobs is lesser than `per_page`, a subset of the
  finished jobs is shown. Their number is determined by the difference
  between `per_page` and the number of pending jobs.
- If the number of pending jobs is greater than or equal to `per_page`,
  finished jobs start on the second page.

[1]: https://developer.github.com/v3/#pagination
[2]: https://tools.ietf.org/html/rfc8288
@miri64
Copy link
Contributor Author

miri64 commented Sep 10, 2019

This became an issue again so I rebased.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

api: paginate /api/pull_requests
1 participant