Package com.fauna.event
Class StreamRequest
- java.lang.Object
-
- com.fauna.event.StreamRequest
-
public class StreamRequest extends java.lang.Object
Defines the request body for interacting with the Fauna /stream endpoint.The
StreamRequest
class constructs a JSON request body that includes anEventSource
andStreamOptions
to configure the request parameters.
-
-
Constructor Summary
Constructors Constructor Description StreamRequest(EventSource eventSource, StreamOptions streamOptions)
Constructs aStreamRequest
with the specified event source and options.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
serialize()
Serializes thisStreamRequest
to a JSON string for the Fauna /stream endpoint.
-
-
-
Constructor Detail
-
StreamRequest
public StreamRequest(EventSource eventSource, StreamOptions streamOptions)
Constructs aStreamRequest
with the specified event source and options.- Parameters:
eventSource
- TheEventSource
providing the event source token.streamOptions
- TheStreamOptions
specifying additional request options.- Throws:
java.lang.IllegalArgumentException
- ifeventSource
orstreamOptions
is null.
-
-
Method Detail
-
serialize
public java.lang.String serialize() throws java.io.IOException
Serializes thisStreamRequest
to a JSON string for the Fauna /stream endpoint.The JSON includes fields based on the
EventSource
andStreamOptions
configurations. Either the cursor or start timestamp is included, with cursor taking precedence.- Returns:
- A JSON-formatted
String
representing this stream request. - Throws:
java.io.IOException
- if an error occurs during serialization.
-
-