Package com.fauna.response
Class QueryResponse
- java.lang.Object
-
- com.fauna.response.QueryResponse
-
- Direct Known Subclasses:
QueryFailure
,QuerySuccess
public abstract class QueryResponse extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
QueryResponse.Builder<T>
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> QueryResponse.Builder<T>
builder(Codec<T> codec)
A helper method to instantiate a new builder.java.lang.Long
getLastSeenTxn()
Gets the last seen transaction timestamp.java.util.Map<java.lang.String,java.lang.String>
getQueryTags()
Gets the query tags associated with the response.java.lang.Long
getSchemaVersion()
Gets the schema version.QueryStats
getStats()
Gets the query stats associated with the response.java.lang.String
getSummary()
Gets the summary associated with the response.static <T> QuerySuccess<T>
parseResponse(java.net.http.HttpResponse<java.io.InputStream> response, Codec<T> codec, StatsCollector statsCollector)
A helper method to adapt an HTTP response into a QuerySuccess or throw the appropriate FaunaException.
-
-
-
Method Detail
-
builder
public static <T> QueryResponse.Builder<T> builder(Codec<T> codec)
A helper method to instantiate a new builder.- Type Parameters:
T
- The return type of the data.- Parameters:
codec
- The codec to use when parsing data.- Returns:
- A new Builder instance.
-
parseResponse
public static <T> QuerySuccess<T> parseResponse(java.net.http.HttpResponse<java.io.InputStream> response, Codec<T> codec, StatsCollector statsCollector) throws FaunaException
A helper method to adapt an HTTP response into a QuerySuccess or throw the appropriate FaunaException.- Type Parameters:
T
- The response type on success.- Parameters:
response
- The HTTP response to adapt.codec
- The codec to use when reading the HTTP response body.statsCollector
- The stats collector to accumulate stats against.- Returns:
- A QuerySuccess instance.
- Throws:
FaunaException
- Thrown on non-200 responses.
-
getLastSeenTxn
public java.lang.Long getLastSeenTxn()
Gets the last seen transaction timestamp.- Returns:
- A long representing the last seen transaction timestamp.
-
getSchemaVersion
public java.lang.Long getSchemaVersion()
Gets the schema version.- Returns:
- A long representing the schema version.
-
getSummary
public java.lang.String getSummary()
Gets the summary associated with the response.- Returns:
- A string representing the summary.
-
getQueryTags
public java.util.Map<java.lang.String,java.lang.String> getQueryTags()
Gets the query tags associated with the response.- Returns:
- A Map containing the query tags.
-
getStats
public QueryStats getStats()
Gets the query stats associated with the response.- Returns:
- A QueryStats instance.
-
-