Class PaginatedCollection<TEntries extends EasyPostResource>

java.lang.Object
com.easypost.model.EasyPostResource
com.easypost.model.PaginatedCollection<TEntries>
  • Constructor Details

    • PaginatedCollection

      public PaginatedCollection()
  • Method Details

    • getNextPage

      public final <TCollection extends PaginatedCollection<TEntries>> TCollection getNextPage(Function<Map<String,Object>,TCollection> apiCallFunction, List<TEntries> currentEntries) throws EndOfPaginationError
      Get the next page of a paginated collection.
      Type Parameters:
      TCollection - The type of the collection to retrieve.
      Parameters:
      apiCallFunction - The function to call to get the next page.
      currentEntries - The current entries in the collection. Needed to determine the next page parameters.
      Returns:
      The next page of the collection.
      Throws:
      EndOfPaginationError - If there are no more pages to retrieve.
    • getNextPage

      public final <TCollection extends PaginatedCollection<TEntries>> TCollection getNextPage(Function<Map<String,Object>,TCollection> apiCallFunction, List<TEntries> currentEntries, Integer pageSize) throws EndOfPaginationError
      Get the next page of a paginated collection with a custom page size.
      Type Parameters:
      TCollection - The type of the collection to retrieve.
      Parameters:
      apiCallFunction - The function to call to get the next page.
      currentEntries - The current entries in the collection. Needed to determine the next page parameters.
      pageSize - The page size to use for the next page.
      Returns:
      The next page of the collection.
      Throws:
      EndOfPaginationError - If there are no more pages to retrieve.
    • buildNextPageParameters

      protected abstract Map<String,Object> buildNextPageParameters(List<TEntries> entries, Integer pageSize) throws EndOfPaginationError
      Build the parameters for retrieving the next page of a paginated collection.
      Parameters:
      entries - The current entries in the collection. Needed to determine the next page parameters.
      pageSize - The page size to use for the next page.
      Returns:
      The parameters for retrieving the next page of a paginated collection.
      Throws:
      EndOfPaginationError