diff --git a/.stats.yml b/.stats.yml index b1eddf2..d569fcb 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 111 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-6860d955bb7b497681b9d1ae03c10c51a458c68f5011efc648ae9d049250d6c7.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-4e3ac088751d52ff03184c39a009d093a7457f4e25dc489a938fe25ad5d83d98.yml diff --git a/src/resources/users/pats.ts b/src/resources/users/pats.ts index dcb49b9..8ea91af 100644 --- a/src/resources/users/pats.ts +++ b/src/resources/users/pats.ts @@ -11,10 +11,10 @@ export class Pats extends APIResource { * ListPersonalAccessTokens */ list( - params: PatListParams, + params: PatListParams | null | undefined = {}, options?: RequestOptions, ): PagePromise { - const { token, pageSize, ...body } = params; + const { token, pageSize, ...body } = params ?? {}; return this._client.getAPIList( '/gitpod.v1.UserService/ListPersonalAccessTokens', PersonalAccessTokensPage, diff --git a/tests/api-resources/users/pats.test.ts b/tests/api-resources/users/pats.test.ts index cb8544c..31f99a1 100644 --- a/tests/api-resources/users/pats.test.ts +++ b/tests/api-resources/users/pats.test.ts @@ -10,7 +10,7 @@ const client = new Gitpod({ describe('resource pats', () => { // skipped: tests are disabled for the time being test.skip('list', async () => { - const responsePromise = client.users.pats.list({}); + const responsePromise = client.users.pats.list(); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -20,6 +20,22 @@ describe('resource pats', () => { expect(dataAndResponse.response).toBe(rawResponse); }); + // skipped: tests are disabled for the time being + test.skip('list: request options and params are passed correctly', async () => { + // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error + await expect( + client.users.pats.list( + { + token: 'token', + pageSize: 0, + filter: { userIds: ['182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'] }, + pagination: { token: 'token', pageSize: 100 }, + }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(Gitpod.NotFoundError); + }); + // skipped: tests are disabled for the time being test.skip('delete', async () => { const responsePromise = client.users.pats.delete({});