Class Pager<T extends JsonSerializable>

java.lang.Object
com.google.genai.Pager<T>
All Implemented Interfaces:
Iterable<T>

public class Pager<T extends JsonSerializable> extends Object implements Iterable<T>
Pager class for iterating through paginated results.
  • Method Details

    • nextPage

      public com.google.common.collect.ImmutableList<T> nextPage()
      Fetches the next page of items. This makes a new API request.
    • iterator

      public Iterator<T> iterator()
      Returns an iterator for the Pager.
      Specified by:
      iterator in interface Iterable<T extends JsonSerializable>
    • name

      public String 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

      public com.google.common.collect.ImmutableList<T> page()
      Returns the current page of items as a list.
    • sdkHttpResponse

      public Optional<HttpResponse> sdkHttpResponse()
      Returns an Optional of the HttpResponse for the current page, which can be used to get the http headers.