Package com.fauna.event
Class FeedOptions
- java.lang.Object
-
- com.fauna.event.FeedOptions
-
public class FeedOptions extends java.lang.Object
Represents the options for configuring an Event Feed request in Fauna.The
FeedOptions
class 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 class
FeedOptions.Builder
Builder class for constructingFeedOptions
instances.
-
Field Summary
Fields Modifier and Type Field Description static FeedOptions
DEFAULT
The defaultFeedOptions
instance 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 newFeedOptions
with the specified parameters.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FeedOptions.Builder
builder()
Creates a newBuilder
for 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.FeedOptions
nextPage(FeedPage<?> page)
Returns theFeedOptions
for the next page, based on the cursor of the given page.
-
-
-
Field Detail
-
DEFAULT
public static final FeedOptions DEFAULT
The defaultFeedOptions
instance 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 newFeedOptions
with the specified parameters.- Parameters:
cursor
- AString
representing the cursor in the feed. Cannot be provided with astartTs
.startTs
- ALong
representing the start timestamp for the feed. Represents a time in microseconds since the Unix epoch. Cannot be provided with acursor
.pageSize
- AnInteger
specifying the number of items per feed page.timeout
- ADuration
specifying the timeout for the feed request.- Throws:
java.lang.IllegalArgumentException
- if bothcursor
andstartTs
are set.
-
-
Method Detail
-
getCursor
public java.util.Optional<java.lang.String> getCursor()
Retrieves the cursor.- Returns:
- An
Optional
containing the cursor, or empty if not set.
-
getStartTs
public java.util.Optional<java.lang.Long> getStartTs()
Retrieves the start timestamp.- Returns:
- An
Optional
containing the start timestamp, or empty if not set.
-
getPageSize
public java.util.Optional<java.lang.Integer> getPageSize()
Retrieves the page size.- Returns:
- An
Optional
containing the page size, or empty if not set.
-
getTimeout
public java.util.Optional<java.time.Duration> getTimeout()
Retrieves the timeout duration.- Returns:
- An
Optional
containing the timeout duration, or empty if not set.
-
builder
public static FeedOptions.Builder builder()
Creates a newBuilder
for constructingFeedOptions
.- Returns:
- A new
Builder
instance.
-
nextPage
public FeedOptions nextPage(FeedPage<?> page)
Returns theFeedOptions
for 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
FeedOptions
instance configured for the next page.
-
-