fix(docs-infra): use correct parameters for paginated requests to GitHub (#25671)

As it turns out, in GitHub API paginated requests, page numbering is
1-based. (https://developer.github.com/v3/#pagination)

Starting at page 0 (which returns the first page), results in making the
same request twice and logging incorrect numbers (since the first 100
items are listed twice).

PR Close #25671
This commit is contained in:
George Kalpakas
2018-09-15 15:44:38 +03:00
committed by Kara Erickson
parent 021f4344b1
commit a01acec7fe
3 changed files with 9 additions and 8 deletions

View File

@ -38,7 +38,8 @@ export class GithubApi {
return this.request<T>('post', path, data);
}
public getPaginated<T>(pathname: string, baseParams: RequestParams = {}, currentPage: number = 0): Promise<T[]> {
// In GitHub API paginated requests, page numbering is 1-based. (https://developer.github.com/v3/#pagination)
public getPaginated<T>(pathname: string, baseParams: RequestParams = {}, currentPage: number = 1): Promise<T[]> {
const perPage = 100;
const params = {
...baseParams,