PaginateResponse implements ResponseData
A helper to handle paginations
Tags
Interfaces, Classes and Traits
- ResponseData
Table of Contents
- enableCache() : void
- Enable the cache
- getOriginalResponse() : PaginatedResponse
- Returning the original response
- getPage() : int
- Returning the zero indexed page number
- items() : ItemIterator<string|int, T>
- Iterate over items
- pages() : PageIterator<string|int, T>
- Iterate over pages
Methods
enableCache()
Enable the cache
public
enableCache() : void
This method allows to reuse the iterator without fetching already fetched data again. Do not call this method if you do not want to reuse the iterator. Because all data are storing in the memory.
Return values
void —getOriginalResponse()
Returning the original response
public
getOriginalResponse() : PaginatedResponse
This response will change each time after accessed the next page
Return values
PaginatedResponse —Original response object
getPage()
Returning the zero indexed page number
public
getPage() : int
Return values
int —items()
Iterate over items
public
items() : ItemIterator<string|int, T>
This iterator will iterate over all fetched items. This iterator is calling the API and fetching more values automatically when the iterator reached to the end.
Tags
Return values
ItemIterator<string|int, T> —pages()
Iterate over pages
public
pages() : PageIterator<string|int, T>
This iterator will call the API in every iteration and you can get all limited items that returned from the api as the iterated item.