[draft] based on PR 43484, put PagingOptions to retriever lambda#43720
Conversation
| private PagedResponse<TodoItem> listNextSinglePage(String nextLink) { | ||
| Response<TodoPage> res = listNextSync(nextLink); | ||
| private PagedResponse<TodoItem> listNextSinglePage(PagingOptions pagingOptions, String nextLink) { | ||
| Response<TodoPage> res = (nextLink == null) ? listSync(pagingOptions) : listNextSync(nextLink); |
There was a problem hiding this comment.
Here, the code would fork in nextLink. If nextLink exists, it would just request that URL; if nextLink not exist, it would call the same API, but with pagingOptions updated (e.g. continuationToken updated from the prior page).
| nextLink = page.getNextLink(); | ||
| continuationToken = page.getContinuationToken(); | ||
| this.done = (nextLink == null || nextLink.isEmpty()) | ||
| && (continuationToken == null || continuationToken.isEmpty()); |
There was a problem hiding this comment.
Code here and above only handle the server-driven pageable (i.e. nextLink or continuationToken).
It does not handle client-side pageable (i.e. via incremental on pageIndex or index).
Handling of client-side pageable would require we get the PagingOptions of the prior request (in additional to this PagedResponse), and update it for next page.
| private Response<TodoPage> listSync() { | ||
| private Response<TodoPage> listSync(PagingOptions pagingOptions) { | ||
| // mock request on first page | ||
| return new HttpResponse<>(null, 200, null, new TodoPage(List.of(new TodoItem(), new TodoItem()), "nextLink1")); |
There was a problem hiding this comment.
Code here should set the value of pagingOptions.continuationToken into the proxy API.
(it also means emitter/codegen need to do special handling for continuationToken param, as it should appear on proxy API, but not on client method API)
1cffdc6 to
1695f0c
Compare
For #43484
Description
Please add an informative description that covers that changes made by the pull request and link all relevant issues.
If an SDK is being regenerated based on a new swagger spec, a link to the pull request containing these swagger spec changes has been included above.
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines