java.lang.Object
java.lang.Record
com.darkcollective.relix.lang.ast.source.PaginateSpec
Record Components:
entries - the pagination parameter mappings; must not be null or empty

public record PaginateSpec(List<PaginateEntry> entries) extends Record
Declares how an HTTP source's pagination maps to URL parameters.

When the query planner encounters a LimitNode or infers offset information, it consults this spec to construct the correct URL parameters.

Syntax (offset-based API):

   paginate: {
       limit:  query("limit")  [default: 100],
       offset: query("offset") [default: 0]
   }
 

Syntax (page-based API):

   paginate: {
       page:     query("page")     [default: 1],
       pagesize: query("per_page") [default: 50]
   }
 
  • Constructor Details

    • PaginateSpec

      public PaginateSpec(List<PaginateEntry> entries)
      Creates an instance of a PaginateSpec record class.
      Parameters:
      entries - the value for the entries record component
  • Method Details

    • entry

      public Optional<PaginateEntry> entry(String logicalName)
      Finds the entry with the given logical name (e.g. "limit").
      Parameters:
      logicalName - the logical name to search for
      Returns:
      the matching entry, or empty if not declared
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • entries

      public List<PaginateEntry> entries()
      Returns the value of the entries record component.
      Returns:
      the value of the entries record component