Skip to content

Latest commit

 

History

History
36 lines (26 loc) · 1.14 KB

Pagination.md

File metadata and controls

36 lines (26 loc) · 1.14 KB

Pagination

Paginated API results are wrapped in an utilitary parent class "Page<T>" which allows to iterate on the following results pages.

Properties

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

Pages iterator

The iterator() method returns a Iterator<Page<T>> which allows to iterator on the following results pages.

Example

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();
}