Class RtPagination<T>

java.lang.Object
com.jcabi.github.RtPagination<T>
Type Parameters:
T - Type of iterable objects
All Implemented Interfaces:
Iterable<T>

@Immutable public final class RtPagination<T> extends Object implements Iterable<T>
GitHub pagination.

This class is a convenient iterator over multiple JSON objects returned by GitHub API. For example, to iterate through notifications (see Notifications API) you can use this code:

 Iterable<JsonObject> notifications = new RtPagination<>(
   new RtGitHub(oauth).entry()
     .uri().path("/notifications").back(),
   RtPagination.COPYING
 );
Since:
0.11
See Also:
  • Field Details

    • COPYING

      public static final RtValuePagination.Mapping<jakarta.json.JsonObject,jakarta.json.JsonObject> COPYING
      Mapping that just copies JsonObject.
      Suppressed Checkstyle violations:
      LineLength (3 lines)
  • Constructor Details

    • RtPagination

      public RtPagination(com.jcabi.http.Request req, RtValuePagination.Mapping<T,jakarta.json.JsonObject> mpp)
      Public ctor.
      Parameters:
      req - Request
      mpp - Mapping
  • Method Details

    • iterator

      public Iterator<T> iterator()
      Specified by:
      iterator in interface Iterable<T>
    • request

      public com.jcabi.http.Request request()
      Entry.
      Returns:
      Entry point
    • mapping

      public RtValuePagination.Mapping<T,jakarta.json.JsonObject> mapping()
      Mapping.
      Returns:
      Mapping