Skip to content

Commit 91f8b66

Browse files
feat: update via SDK Studio (#138)
1 parent b6a0f00 commit 91f8b66

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,9 @@ export namespace Cloudflare {
386386
export import CursorLimitPaginationParams = Pagination.CursorLimitPaginationParams;
387387
export import CursorLimitPaginationResponse = Pagination.CursorLimitPaginationResponse;
388388

389+
export import SinglePage = Pagination.SinglePage;
390+
export import SinglePageResponse = Pagination.SinglePageResponse;
391+
389392
export import Accounts = API.Accounts;
390393
export import Account = API.Account;
391394
export import AccountUpdateResponse = API.AccountUpdateResponse;

src/pagination.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,3 +263,37 @@ export class CursorLimitPagination<Item>
263263
};
264264
}
265265
}
266+
267+
export type SinglePageResponse<Item> = Item[];
268+
269+
export class SinglePage<Item> extends AbstractPage<Item> {
270+
items: Array<Item>;
271+
272+
constructor(
273+
client: APIClient,
274+
response: Response,
275+
body: SinglePageResponse<Item>,
276+
options: FinalRequestOptions,
277+
) {
278+
super(client, response, body, options);
279+
280+
this.items = body || [];
281+
}
282+
283+
getPaginatedItems(): Item[] {
284+
return this.items ?? [];
285+
}
286+
287+
// @deprecated Please use `nextPageInfo()` instead
288+
/**
289+
* This page represents a response that isn't actually paginated at the API level
290+
* so there will never be any next page params.
291+
*/
292+
nextPageParams(): null {
293+
return null;
294+
}
295+
296+
nextPageInfo(): null {
297+
return null;
298+
}
299+
}

0 commit comments

Comments
 (0)