Skip to content

[Feature Request] Allow page size option (per_page) in listPullRequestFiles call #408

Open

Description

@rausanka

The listPullRequests call allows an optional second parameter for options that include setting the page size for for a request. GitHub allows per_page to also be sent along for the call wrapped by listPullRequestFiles but this library doesn't allow options to be passed.

I'm happy to submit a PR but want to know:

  1. If you're cool with this
  2. How you'd like me to add this functionality without breaking any existing uses of the library that rely on the second parameter being a callback. implement a listPullRequestFilesWithOptions?

Activity

  1. clayreimann commented on Dec 19, 2016

    @clayreimann
    Member

    I for one am cool with this idea. But, are you sure we don't just fetch all pages by default? Many of our methods fetch all of the pages behind the scenes.

    We probably want to re-think how we implement paged methods in general.

  2. rausanka commented on Dec 24, 2016

    @rausanka
    Author

    Based on https://github.com/github-tools/github/blob/master/lib/Repository.js, it seems that the only Repository call that requests all pages is listProjects. Also, it doesn't look like the use of _requestAllPages in listProjects takes advantage of using the per_page option to increase page sizes from 30 to 100.

    Given this, it seems like there are a few possible improvements (not necessarily mutually exclusive):

    1. Change all of the paginated calls in Repository.js to use _requestAllPages instead of _request
    2. Change listProjects to set per_page to 100 to reduce necessary requests to get all pages
    3. To your point about re-thinking how paged methods are implemented, maybe have two calls for each method, one for getting individual pages, one for getting all pages (e.g. listPullRequestFiles for getting individual pages as before and a new listAllPullRequestFiles for recursively getting all files across all pages).
  3. rausanka commented on Jul 29, 2017

    @rausanka
    Author

    Been thinking about this more recently and I think we should definitely do #2 above and I'd prefer #3 over #1 as large repositories might have many pages (e.g. at QuanticMind we're creating ~300 PRs/month) that will quickly get you into GitHub API rate limiting hell. Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions