Paginated API results are wrapped in an utilitary parent class "Page<T>" which allows to iterate on the following results pages.
Name | Type | Description |
---|---|---|
items | List<T> | Items of the current page |
itemsTotal | Integer | Total number of items that exist. |
pagesTotal | Integer | Number of items listed in the current page. |
pageSize | Integer | Maximum number of item per page. |
currentPage | Integer | The current page index. |
currentPageItems | Integer | The number of items on the current page. |
links | List<PaginationLink> | pagination links |
The iterator()
method returns a Iterator<Page<T>>
which allows to iterator on the following results pages.
ApiVideoClient apiVideoClient = new ApiVideoClient("YOUR_API_KEY");
try {
for (Page<Video> page : apiVideoClient.videos().list().execute()) {
List<Video> videos = page.getItems();
System.out.println(videos);
}
} catch (ApiException e) {
e.printStackTrace();
}