Package com.fauna.event
Class FeedOptions
- java.lang.Object
-
- com.fauna.event.FeedOptions
-
public class FeedOptions extends java.lang.ObjectRepresents the options for configuring an Event Feed request in Fauna.The
FeedOptionsclass provides configuration parameters such as cursor, start timestamp, page size, and timeout for retrieving feeds from Fauna.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFeedOptions.BuilderBuilder class for constructingFeedOptionsinstances.
-
Field Summary
Fields Modifier and Type Field Description static FeedOptionsDEFAULTThe defaultFeedOptionsinstance with default settings.
-
Constructor Summary
Constructors Constructor Description FeedOptions(java.lang.String cursor, java.lang.Long startTs, java.lang.Integer pageSize, java.time.Duration timeout)Constructs a newFeedOptionswith the specified parameters.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FeedOptions.Builderbuilder()Creates a newBuilderfor constructingFeedOptions.java.util.Optional<java.lang.String>getCursor()Retrieves the cursor.java.util.Optional<java.lang.Integer>getPageSize()Retrieves the page size.java.util.Optional<java.lang.Long>getStartTs()Retrieves the start timestamp.java.util.Optional<java.time.Duration>getTimeout()Retrieves the timeout duration.FeedOptionsnextPage(FeedPage<?> page)Returns theFeedOptionsfor the next page, based on the cursor of the given page.
-
-
-
Field Detail
-
DEFAULT
public static final FeedOptions DEFAULT
The defaultFeedOptionsinstance with default settings.
-
-
Constructor Detail
-
FeedOptions
public FeedOptions(java.lang.String cursor, java.lang.Long startTs, java.lang.Integer pageSize, java.time.Duration timeout)Constructs a newFeedOptionswith the specified parameters.- Parameters:
cursor- AStringrepresenting the cursor in the feed. Cannot be provided with astartTs.startTs- ALongrepresenting the start timestamp for the feed. Represents a time in microseconds since the Unix epoch. Cannot be provided with acursor.pageSize- AnIntegerspecifying the number of items per feed page.timeout- ADurationspecifying the timeout for the feed request.- Throws:
java.lang.IllegalArgumentException- if bothcursorandstartTsare set.
-
-
Method Detail
-
getCursor
public java.util.Optional<java.lang.String> getCursor()
Retrieves the cursor.- Returns:
- An
Optionalcontaining the cursor, or empty if not set.
-
getStartTs
public java.util.Optional<java.lang.Long> getStartTs()
Retrieves the start timestamp.- Returns:
- An
Optionalcontaining the start timestamp, or empty if not set.
-
getPageSize
public java.util.Optional<java.lang.Integer> getPageSize()
Retrieves the page size.- Returns:
- An
Optionalcontaining the page size, or empty if not set.
-
getTimeout
public java.util.Optional<java.time.Duration> getTimeout()
Retrieves the timeout duration.- Returns:
- An
Optionalcontaining the timeout duration, or empty if not set.
-
builder
public static FeedOptions.Builder builder()
Creates a newBuilderfor constructingFeedOptions.- Returns:
- A new
Builderinstance.
-
nextPage
public FeedOptions nextPage(FeedPage<?> page)
Returns theFeedOptionsfor the next page, based on the cursor of the given page.This method copies options like page size and timeout, but does not set or copy
startTs, because it uses the cursor.- Parameters:
page- The current or latestFeedPage.- Returns:
- A new
FeedOptionsinstance configured for the next page.
-
-