-
Notifications
You must be signed in to change notification settings - Fork 17
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
Retrieve paginated response from API and allow project specific URLs #22
base: master
Are you sure you want to change the base?
Conversation
I hope this gets merged in, this is really useful. I just realized the implication. I am currently on a project and thought it would pull all the issues, not just the first page capped at 20. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the use-case for changing this URL please?
} else { | ||
return response.json as Promise<T>; | ||
} | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this just going to keep retrieving page after page of results? What happens if there are thousands of results?
Is is not better to specify the max number of results in the main filter query?
I want all the pages. I therefore have a copy of all my GitLab issues
available to me in Obsidian. If you specify the maximum number of pages
what's the criteria for the pages it returns? The most recent, the open
issues, the highest priority issues... Selfishly I created the branch with
my use case in mind and it doesn't seem to be an issue for Obsidian or
GitLab (I use the cloud version).
…On Thu, 23 May 2024 at 18:41, Ben Roberts ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/gitlab-api.ts
<#22 (comment)>
:
> return requestUrl(params)
.then((response: RequestUrlResponse) => {
if (response.status !== 200) {
throw new Error(response.text);
}
- return response.json as Promise<T>;
- });
+ if ("x-next-page" in response.headers && response.headers["x-next-page"] != "") {
+ return GitlabApi.load(url, gitlabToken, response.headers["x-next-page"]).then((j) => {
+ return response.json.concat(j) as Promise<T>;
+ }) as Promise<T>;
+ } else {
+ return response.json as Promise<T>;
+ }
+ });
Isn't this just going to keep retrieving page after page of results? What
happens if there are thousands of results?
Is is not better to specify the max number of results in the main filter
query?
—
Reply to this email directly, view it on GitHub
<#22 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALGU36L2XXOTPOY44E4N37TZDYS4VAVCNFSM6AAAAAAU5ZV7DWVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDANZUGY2DMMBUG4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I didn't mean limit the number of pages, I meant tell Gitlab to send the number you want in a single page of results. So if you know you have e.g. 500 issues and you do want them all, then set a If we allow thousands of results to be downloaded, memory and performance are going to become a problem. How can we set an upper limit? |
Retrieves all the pages of issues if a paginated response is returned.
Also allows a project specific URL to be used for the GitLab URL.