Package com.intercom.api.core.pagination
Interface BiDirectionalPage<T>
-
- Type Parameters:
T- The type of items in the page
- All Known Implementing Classes:
AsyncCustomPager,CustomPager
public interface BiDirectionalPage<T>Interface for pages that support bidirectional pagination (both forward and backward navigation). This is used for custom pagination scenarios where the API provides both next and previous page links.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.List<T>getItems()Returns the items in the current page.<R> java.util.Optional<R>getResponse()Returns the full response object for accessing pagination metadata.booleanhasNext()Returns whether there is a next page available.booleanhasPrevious()Returns whether there is a previous page available.BiDirectionalPage<T>nextPage()Fetches and returns the next page.BiDirectionalPage<T>previousPage()Fetches and returns the previous page.
-
-
-
Method Detail
-
hasNext
boolean hasNext()
Returns whether there is a next page available.- Returns:
- true if next page exists and can be fetched
-
hasPrevious
boolean hasPrevious()
Returns whether there is a previous page available.- Returns:
- true if previous page exists and can be fetched
-
nextPage
BiDirectionalPage<T> nextPage() throws java.io.IOException
Fetches and returns the next page.- Returns:
- the next page
- Throws:
java.util.NoSuchElementException- if no next page existsjava.io.IOException- if the HTTP request fails
-
previousPage
BiDirectionalPage<T> previousPage() throws java.io.IOException
Fetches and returns the previous page.- Returns:
- the previous page
- Throws:
java.util.NoSuchElementException- if no previous page existsjava.io.IOException- if the HTTP request fails
-
getItems
java.util.List<T> getItems()
Returns the items in the current page.- Returns:
- list of items in this page
-
getResponse
<R> java.util.Optional<R> getResponse()
Returns the full response object for accessing pagination metadata.- Returns:
- Optional containing the response, or empty if unavailable
-
-