Class GraphQLResponse<T>
java.lang.Object
com.codename1.io.graphql.GraphQLResponse<T>
Result of a GraphQL query or mutation. Mirrors the shape of
Response and
GrpcResponse so call sites feel familiar,
but reflects a GraphQL-specific reality: a single response can
carry both mapped data and a non-empty errors array (a
partial result). Always check hasErrors() in addition to
getData().
getResponseCode() returns the underlying HTTP status (usually
200, since GraphQL surfaces logical failures in the body rather
than via HTTP status). 0 is used for transport-level failures
that never reached an HTTP response.
-
Constructor Summary
ConstructorsConstructorDescriptionGraphQLResponse(int httpCode, T data, List<GraphQLError> errors, String responseErrorMessage) -
Method Summary
Modifier and TypeMethodDescriptiongetData()The mappeddatapayload, or null when the server returned no data (a fatal error, or an empty/transport-failed response).Theerrorsarray, never null (empty when the call succeeded cleanly).intThe underlying HTTP status code.The first error message (a transport-failure description when the call never reached the server), or null on clean success.booleantruewhen the response carried at least one GraphQL error.booleanisOk()trueiff the response carried no GraphQL errors.
-
Constructor Details
-
GraphQLResponse
public GraphQLResponse(int httpCode, T data, List<GraphQLError> errors, String responseErrorMessage)
-
-
Method Details
-
getData
The mappeddatapayload, or null when the server returned no data (a fatal error, or an empty/transport-failed response). -
getErrors
Theerrorsarray, never null (empty when the call succeeded cleanly). -
hasErrors
public boolean hasErrors()truewhen the response carried at least one GraphQL error. -
getResponseCode
public int getResponseCode()The underlying HTTP status code.0signals a transport-level failure (network error, unparseable body) that never produced an HTTP response. -
isOk
public boolean isOk()trueiff the response carried no GraphQL errors. Note this is independent ofgetData()being non-null -- a valid response to a nullable root field can be error-free with null data. -
getResponseErrorMessage
The first error message (a transport-failure description when the call never reached the server), or null on clean success.
-