Package io.smallrye.graphql.client
Interface Response
-
public interface Response
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description javax.json.JsonObjectgetData()The 'data' object contained in the response.List<GraphQLError>getErrors()List of errors contained in this response.<T> List<T>getList(Class<T> dataType, String rootField)Transform the contents of the `rootField` from this response into a list of objects of the requested type.<T> TgetObject(Class<T> dataType, String rootField)Transform the contents of the `rootField` from this response into an object of the requested type.Map<String,List<String>>getTransportMeta()Get transport-specific metadata that came from the server with this response.booleanhasData()If this response contains any data, this returns `true`; `false` otherwise.booleanhasError()If this response contains at least one error, this returns `true`; `false` otherwise.
-
-
-
Method Detail
-
getData
javax.json.JsonObject getData()
The 'data' object contained in the response. Can be JsonValue.NULL if the response contains an empty field, or `null` if the response does not contain this field at all.
-
getErrors
List<GraphQLError> getErrors()
List of errors contained in this response.
-
getList
<T> List<T> getList(Class<T> dataType, String rootField)
Transform the contents of the `rootField` from this response into a list of objects of the requested type. If the response contains this field but it is a single object rather than a list, this method throws an exception. If the response does not contain this field at all, this method throws an exception. If the response contains this field but with a null value, this method returns null.
-
getObject
<T> T getObject(Class<T> dataType, String rootField)
Transform the contents of the `rootField` from this response into an object of the requested type. If the response does not contain this field at all, this method throws an exception. If the response contains this field but it is null, this method returns null.
-
hasData
boolean hasData()
If this response contains any data, this returns `true`; `false` otherwise.
-
hasError
boolean hasError()
If this response contains at least one error, this returns `true`; `false` otherwise.
-
-