# Class GraphQLResponse<T>

java.lang.Object
com.codename1.io.graphql.GraphQLResponse<T>

public final class GraphQLResponse<T> extends Object

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

  Constructors
  Constructor
  Description
  `GraphQLResponse(int httpCode, T data, List<GraphQLError> errors, String responseErrorMessage)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `T`
  `getData()`
  The mapped `data` payload, or null when the server returned no data (a fatal error, or an empty/transport-failed response).
  `List<GraphQLError>`
  `getErrors()`
  The `errors` array, never null (empty when the call succeeded cleanly).
  `int`
  `getResponseCode()`
  The underlying HTTP status code.
  `String`
  `getResponseErrorMessage()`
  The first error message (a transport-failure description when the call never reached the server), or null on clean success.
  `boolean`
  `hasErrors()`
  `true` when the response carried at least one GraphQL error.
  `boolean`
  `isOk()`
  `true` iff the response carried no GraphQL errors.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### GraphQLResponse

    public GraphQLResponse(int httpCode, T data, List<GraphQLError> errors, String responseErrorMessage)

- ## Method Details

  - ### getData

    public T getData()
    The mapped `data` payload, or null when the server returned no data (a fatal error, or an empty/transport-failed response).

  - ### getErrors

    public List<GraphQLError> getErrors()
    The `errors` array, never null (empty when the call succeeded cleanly).

  - ### hasErrors

    public boolean hasErrors()
    `true` when the response carried at least one GraphQL error.

  - ### getResponseCode

    public int getResponseCode()
    The underlying HTTP status code. `0` signals a transport-level failure (network error, unparseable body) that never produced an HTTP response.

  - ### isOk

    public boolean isOk()
    `true` iff the response carried no GraphQL errors. Note this is independent of `getData()` being non-null -- a valid response to a nullable root field can be error-free with null data.

  - ### getResponseErrorMessage

    public String getResponseErrorMessage()
    The first error message (a transport-failure description when the call never reached the server), or null on clean success.