()
| 69871 | this.body = body; |
| 69872 | } |
| 69873 | hasNextPage() { |
| 69874 | const items = this.getPaginatedItems(); |
| 69875 | if (!items.length) |
| 69876 | return false; |
| 69877 | return this.nextPageInfo() != null; |
| 69878 | } |
| 69879 | async getNextPage() { |
| 69880 | const nextInfo = this.nextPageInfo(); |
| 69881 | if (!nextInfo) { |
| 69882 | throw new AnthropicError("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`."); |
| 69883 | } |
| 69884 | const nextOptions = { ...this.options }; |
| 69885 | if ("params" in nextInfo && typeof nextOptions.query === "object") { |
| 69886 | nextOptions.query = { ...nextOptions.query, ...nextInfo.params }; |
| 69887 | } else if ("url" in nextInfo) { |
| 69888 | const params = [...Object.entries(nextOptions.query || {}), ...nextInfo.url.searchParams.entries()]; |
| 69889 | for (const [key, value] of params) { |
| 69890 | nextInfo.url.searchParams.set(key, value); |
| 69891 | } |
| 69892 | nextOptions.query = void 0; |
| 69893 | nextOptions.path = nextInfo.url.toString(); |
no test coverage detected