Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add pagination to search endpoints#583

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
alaycock wants to merge1 commit intogithub-tools:master
base:master
Choose a base branch
Loading
fromalaycock:master

Conversation

@alaycock
Copy link

@alaycockalaycock commentedSep 6, 2019
edited
Loading

Changes:

  • Updated the jsdoc to correctly document theGithub.search function.
  • If apage option is passed into_requestAllPages, it will only fetch that single page, instead of attempting to fetch all of the pages.
  • Removed theresults parameter from_requestAllPages, since that is only meant to be used internally anyway. It's trivial to re-introduce, so let me know if this makes sense to do, since this could break some backwards compatibility if folks are using an unsupported argument.
  • Added a test for pagination, and a new fixture for that test. Fixed a number of other fixtures that didn't seem to have the correct page number.
  • Changed the fixtures to userawHeader instead ofheader, since the tests were not paginating. This was introduced when the spec for fixture files changed from nock@7 to nock@8.

Let me know if this is the right approach. I've only run tests for the search endpoints (due to lack of access to the testing repo), so I'm not sure if this is going to introduce errors elsewhere.

Closes#406
This could be a potential solution for#460, although introducing alimit could be an alternate solution.

/**
* Create a new Search wrapper
*@param {string} query - the querytosearchfor
*@param {Search.Params} searchParameters - the queryand othersearchparameters
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Not sure if jsdoc understands how to reach into other files (Search.js). Let me know if this will be a problem.

if(!options){
options={};
}
options.page=parseInt(
Copy link
Author

@alaycockalaycockSep 6, 2019
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

If someone can clarify this, I would appreciate it.

Why does the page number need to be manually extracted and appended to the options?

nextUrl is being extracted from the headers, wouldn't it have all the options it already needs? Then by callingthis._requestAllPages(nextUrl, options, cb, results); the options are being re-added to the url, which results in duplicate parameters in the path, eg:

/search/repositories?q=tetris+language%3Aassembly&sort=stars&order=desc&type=all&per_page=100&page=4&q=tetris+language:assembly&sort=stars&order=desc&type=all&per_page=100&page=4

Although this might just be a workaround for other endpoints, since I have't done exploration into how other endpoints paginate.

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

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[Feature Request] Ability to fetch a single page of items in a list

1 participant

@alaycock

[8]ページ先頭

©2009-2025 Movatter.jp