Open weidongxu-microsoft opened 2 years ago
I will add a enable-page-size
option, to avoid affect older libs.
I would also include query parameter of client name maxPageSize
as candidate (not only for serializedName = maxpagesize
; as Batch does not use this name, so we'd expect them do a projectedName("maxPageSize")
).
Also will do this for DPG first.
Code may look like this (in impl)
public PagedIterable<BinaryData> list(RequestOptions requestOptions) {
return new PagedIterable<>(
(size) -> {
RequestOptions requestOptionsForSinglePage =
requestOptions == null ? new RequestOptions() : requestOptions;
if (size != null) {
requestOptionsForSinglePage.addQueryParam("maxpagesize", String.valueOf(size));
}
return listSinglePage(requestOptionsForSinglePage);
},
(nextLink, size) -> {
RequestOptions requestOptionsForNextPage = new RequestOptions();
requestOptionsForNextPage.setContext(
requestOptions != null && requestOptions.getContext() != null
? requestOptions.getContext()
: Context.NONE);
if (size != null) {
requestOptionsForNextPage.addQueryParam("maxpagesize", String.valueOf(size));
}
return listNextSinglePage(nextLink, requestOptionsForNextPage);
});
}
pageable API would need to generate like this, if
maxpagesize
parameter in REST API.user would call
pagedResponse.iterableByPage(pageSize)
to query with pageSize (instead oflist(pageSize
).