Skip to content

Commit 2cb059f

Browse files
committed
feat: add pagination support when fetching repository environments
1 parent 03dc7ec commit 2cb059f

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as vscode from "vscode";
22
import {GitHubRepoContext} from "../../git/repository";
33
import {EnvironmentNode} from "./environmentNode";
4+
import {Environment} from "../../model";
45

56
export class EnvironmentsNode extends vscode.TreeItem {
67
constructor(public readonly gitHubRepoContext: GitHubRepoContext) {
@@ -10,12 +11,16 @@ export class EnvironmentsNode extends vscode.TreeItem {
1011
}
1112

1213
async getEnvironments(): Promise<EnvironmentNode[]> {
13-
const result = await this.gitHubRepoContext.client.repos.getAllEnvironments({
14+
const opts = this.gitHubRepoContext.client.repos.getAllEnvironments.endpoint.merge({
1415
owner: this.gitHubRepoContext.owner,
15-
repo: this.gitHubRepoContext.name
16+
repo: this.gitHubRepoContext.name,
17+
per_page: 100
1618
});
1719

18-
const data = result.data.environments || [];
20+
// retrieve all environments
21+
const result = await this.gitHubRepoContext.client.paginate<Environment>(opts);
22+
23+
const data = result || [];
1924
return data.map(e => new EnvironmentNode(this.gitHubRepoContext, e));
2025
}
2126
}

0 commit comments

Comments
 (0)