Skip to content

Commit

Permalink
Add support for continue tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
schrodit committed Feb 1, 2022
1 parent d4a1e15 commit 07737cb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ export class KubernetesObjectApi extends ApisApi {
fieldSelector?: string,
labelSelector?: string,
limit?: number,
continueToken?: string,
options: { headers: { [name: string]: string } } = { headers: {} },
): Promise<{ body: KubernetesListObject<KubernetesObject>; response: http.IncomingMessage }> {
// verify required parameters 'apiVersion', 'kind' is not null or undefined
Expand Down Expand Up @@ -388,6 +389,10 @@ export class KubernetesObjectApi extends ApisApi {
localVarQueryParameters.limit = ObjectSerializer.serialize(limit, 'number');
}

if (continueToken !== undefined) {
localVarQueryParameters.continue = ObjectSerializer.serialize(continueToken, 'string');
}

const localVarRequestOptions: request.Options = {
method: 'GET',
qs: localVarQueryParameters,
Expand Down
5 changes: 4 additions & 1 deletion src/object_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1751,7 +1751,7 @@ describe('KubernetesObject', () => {
it('should list resources in a namespace', async () => {
const scope = nock('https://d.i.y')
.get(
'/api/v1/namespaces/default/secrets?fieldSelector=metadata.name%3Dtest-secret1&labelSelector=app%3Dmy-app&limit=5',
'/api/v1/namespaces/default/secrets?fieldSelector=metadata.name%3Dtest-secret1&labelSelector=app%3Dmy-app&limit=5&continue=abc',
)
.reply(200, {
apiVersion: 'v1',
Expand All @@ -1768,6 +1768,7 @@ describe('KubernetesObject', () => {
],
metadata: {
resourceVersion: '216532459',
continue: 'abc',
},
});
const lr = await client.list(
Expand All @@ -1780,6 +1781,7 @@ describe('KubernetesObject', () => {
'metadata.name=test-secret1',
'app=my-app',
5,
'abc',
);
const items = lr.body.items;
expect(items).to.have.length(1);
Expand All @@ -1806,6 +1808,7 @@ describe('KubernetesObject', () => {
],
metadata: {
resourceVersion: '216532459',
continue: 'abc',
},
});
const lr = await client.list(
Expand Down

0 comments on commit 07737cb

Please sign in to comment.