public class PaginatedData<I,P,R,E extends CoreApiException> extends Object
| Constructor and Description |
|---|
PaginatedData(ApiCall<R,E> apiCall,
java.util.function.Function<PageWrapper<I,R>,P> pageCreator,
java.util.function.Function<R,List<I>> itemsCreator,
PaginationStrategy... strategies) |
| Modifier and Type | Method and Description |
|---|---|
PaginatedData<I,P,R,E> |
copy() |
CompletableFuture<Boolean> |
fetchNextPageAsync()
Start fetching the next page asynchronously.
|
<T> List<T> |
getItems(java.util.function.Function<CheckedSupplier<I,E>,T> itemSupplier)
Get the items in current page converted to type T.
|
<T> T |
getPage(java.util.function.Function<CheckedSupplier<P,E>,T> pageSupplier)
Get the current page converted to type T.
|
int |
getPageSize() |
HttpRequest.Builder |
getRequestBuilder() |
io.apimatic.coreinterfaces.http.response.Response |
getResponse() |
<T> Iterator<T> |
items(java.util.function.Function<CheckedSupplier<I,E>,T> itemSupplier) |
<T> Iterator<T> |
pages(java.util.function.Function<CheckedSupplier<P,E>,T> pageSupplier) |
public PaginatedData(ApiCall<R,E> apiCall, java.util.function.Function<PageWrapper<I,R>,P> pageCreator, java.util.function.Function<R,List<I>> itemsCreator, PaginationStrategy... strategies)
apiCall - ApiCall instance to be paginated.pageCreator - Converts the PageWrapper into the instance of type P.itemsCreator - Extract list of items of type I from response.strategies - List of applicable pagination strategies.public HttpRequest.Builder getRequestBuilder()
public io.apimatic.coreinterfaces.http.response.Response getResponse()
public int getPageSize()
public <T> List<T> getItems(java.util.function.Function<CheckedSupplier<I,E>,T> itemSupplier)
T - Represents the type of items in list.itemSupplier - A converter to convert the CheckedSupplier of items to type T.public <T> T getPage(java.util.function.Function<CheckedSupplier<P,E>,T> pageSupplier)
T - Represents the return type.pageSupplier - A converter to convert the CheckedSupplier of page to type T.public <T> Iterator<T> items(java.util.function.Function<CheckedSupplier<I,E>,T> itemSupplier)
T - Represents the type of items in iterator.itemSupplier - A converter to convert the CheckedSupplier of items to type T.public <T> Iterator<T> pages(java.util.function.Function<CheckedSupplier<P,E>,T> pageSupplier)
T - Represents the type of pages in iterator.pageSupplier - A converter to convert the CheckedSupplier of page to type T.public PaginatedData<I,P,R,E> copy()
public CompletableFuture<Boolean> fetchNextPageAsync()
Copyright © 2025. All rights reserved.