Package com.google.genai
Class Pager<T extends JsonSerializable>
java.lang.Object
com.google.genai.Pager<T>
- All Implemented Interfaces:
Iterable<T>
Pager class for iterating through paginated results.
-
Method Summary
Modifier and TypeMethodDescriptioniterator()
Returns an iterator for the Pager.name()
Returns the name of the item for this pager.com.google.common.collect.ImmutableList<T>
nextPage()
Fetches the next page of items.com.google.common.collect.ImmutableList<T>
page()
Returns the current page of items as a list.int
pageSize()
Returns the page size for this pager.Returns an Optional of theHttpResponse
for the current page, which can be used to get the http headers.int
size()
Returns the size of the current page.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
nextPage
Fetches the next page of items. This makes a new API request. -
iterator
Returns an iterator for the Pager.- Specified by:
iterator
in interfaceIterable<T extends JsonSerializable>
-
name
Returns the name of the item for this pager. -
pageSize
public int pageSize()Returns the page size for this pager. -
size
public int size()Returns the size of the current page. -
page
Returns the current page of items as a list. -
sdkHttpResponse
Returns an Optional of theHttpResponse
for the current page, which can be used to get the http headers.
-