Package com.fauna.event
Class StreamRequest
- java.lang.Object
-
- com.fauna.event.StreamRequest
-
public class StreamRequest extends java.lang.ObjectDefines the request body for interacting with the Fauna /stream endpoint.The
StreamRequestclass constructs a JSON request body that includes anEventSourceandStreamOptionsto configure the request parameters.
-
-
Constructor Summary
Constructors Constructor Description StreamRequest(EventSource eventSource, StreamOptions streamOptions)Constructs aStreamRequestwith the specified event source and options.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Stringserialize()Serializes thisStreamRequestto a JSON string for the Fauna /stream endpoint.
-
-
-
Constructor Detail
-
StreamRequest
public StreamRequest(EventSource eventSource, StreamOptions streamOptions)
Constructs aStreamRequestwith the specified event source and options.- Parameters:
eventSource- TheEventSourceproviding the event source token.streamOptions- TheStreamOptionsspecifying additional request options.- Throws:
java.lang.IllegalArgumentException- ifeventSourceorstreamOptionsis null.
-
-
Method Detail
-
serialize
public java.lang.String serialize() throws java.io.IOExceptionSerializes thisStreamRequestto a JSON string for the Fauna /stream endpoint.The JSON includes fields based on the
EventSourceandStreamOptionsconfigurations. Either the cursor or start timestamp is included, with cursor taking precedence.- Returns:
- A JSON-formatted
Stringrepresenting this stream request. - Throws:
java.io.IOException- if an error occurs during serialization.
-
-