Skip to content

Commit 378b12f

Browse files
feat(roles): enable correct pagination parameters (#2398)
1 parent 05b3471 commit 378b12f

File tree

5 files changed

+19
-11
lines changed

5 files changed

+19
-11
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 1525
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-e4e4fe20b25c825f2c21322b8909758f1a84f25cfe0df7ce34571b8a2f2be1c1.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-4c85e60ad7ca96a7ddadf88e1e3c7b62fb791d39d435bedfe6caac2c27081a48.yml

api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Methods:
6161

6262
Methods:
6363

64-
- <code title="get /accounts/{account_id}/roles">client.accounts.roles.<a href="./src/resources/accounts/roles.ts">list</a>({ ...params }) -> RolesSinglePage</code>
64+
- <code title="get /accounts/{account_id}/roles">client.accounts.roles.<a href="./src/resources/accounts/roles.ts">list</a>({ ...params }) -> RolesV4PagePaginationArray</code>
6565
- <code title="get /accounts/{account_id}/roles/{role_id}">client.accounts.roles.<a href="./src/resources/accounts/roles.ts">get</a>(roleId, { ...params }) -> Role</code>
6666

6767
## Subscriptions

src/resources/accounts/roles.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
import { APIResource } from '../../resource';
44
import * as Core from '../../core';
55
import * as Shared from '../shared';
6-
import { RolesSinglePage } from '../shared';
6+
import { RolesV4PagePaginationArray } from '../shared';
7+
import { type V4PagePaginationArrayParams } from '../../pagination';
78

89
export class Roles extends APIResource {
910
/**
@@ -12,9 +13,12 @@ export class Roles extends APIResource {
1213
list(
1314
params: RoleListParams,
1415
options?: Core.RequestOptions,
15-
): Core.PagePromise<RolesSinglePage, Shared.Role> {
16-
const { account_id } = params;
17-
return this._client.getAPIList(`/accounts/${account_id}/roles`, RolesSinglePage, options);
16+
): Core.PagePromise<RolesV4PagePaginationArray, Shared.Role> {
17+
const { account_id, ...query } = params;
18+
return this._client.getAPIList(`/accounts/${account_id}/roles`, RolesV4PagePaginationArray, {
19+
query,
20+
...options,
21+
});
1822
}
1923

2024
/**
@@ -30,9 +34,9 @@ export class Roles extends APIResource {
3034
}
3135
}
3236

33-
export interface RoleListParams {
37+
export interface RoleListParams extends V4PagePaginationArrayParams {
3438
/**
35-
* Account identifier tag.
39+
* Path param: Account identifier tag.
3640
*/
3741
account_id: string;
3842
}
@@ -48,4 +52,4 @@ export declare namespace Roles {
4852
export { type RoleListParams as RoleListParams, type RoleGetParams as RoleGetParams };
4953
}
5054

51-
export { RolesSinglePage };
55+
export { RolesV4PagePaginationArray };

src/resources/shared.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,7 @@ export type TokenValue = string;
953953

954954
export class MembersV4PagePaginationArray extends V4PagePaginationArray<Member> {}
955955

956-
export class RolesSinglePage extends SinglePage<Role> {}
956+
export class RolesV4PagePaginationArray extends V4PagePaginationArray<Role> {}
957957

958958
export class SubscriptionsSinglePage extends SinglePage<Subscription> {}
959959

tests/api-resources/accounts/roles.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ describe('resource roles', () => {
2222
});
2323

2424
test('list: required and optional params', async () => {
25-
const response = await client.accounts.roles.list({ account_id: 'eb78d65290b24279ba6f44721b3ea3c4' });
25+
const response = await client.accounts.roles.list({
26+
account_id: 'eb78d65290b24279ba6f44721b3ea3c4',
27+
page: 1,
28+
per_page: 5,
29+
});
2630
});
2731

2832
test('get: only required params', async () => {

0 commit comments

Comments
 (0)