# Class GrpcResponse<T>

java.lang.Object
com.codename1.io.grpc.GrpcResponse<T>

public final class GrpcResponse<T> extends java.lang.Object

Result of a unary gRPC call. Mirrors the shape of `Response` so call sites that already use the REST helpers feel at home, but the integer status code returned by `getResponseCode()` is the gRPC status, not the HTTP one:

- `0` -- `OK`. Wire-level success.
- `1..16` -- standard gRPC statuses (CANCELLED, UNKNOWN, ...).
- `-1` -- the transport itself failed (network error, HTTP non-200, missing status trailer). `getHttpCode()` still returns the underlying HTTP code in that case.

Use `isOk()` for the common "request succeeded" check.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `STATUS_ABORTED`
  `static final int`
  `STATUS_ALREADY_EXISTS`
  `static final int`
  `STATUS_CANCELLED`
  `static final int`
  `STATUS_DATA_LOSS`
  `static final int`
  `STATUS_DEADLINE_EXCEEDED`
  `static final int`
  `STATUS_FAILED_PRECONDITION`
  `static final int`
  `STATUS_INTERNAL`
  `static final int`
  `STATUS_INVALID_ARGUMENT`
  `static final int`
  `STATUS_NOT_FOUND`
  `static final int`
  `STATUS_OK`
  `static final int`
  `STATUS_OUT_OF_RANGE`
  `static final int`
  `STATUS_PERMISSION_DENIED`
  `static final int`
  `STATUS_RESOURCE_EXHAUSTED`
  `static final int`
  `STATUS_TRANSPORT_FAILURE`
  Sentinel status indicating the transport itself failed (no `grpc-status` trailer was parsed).
  `static final int`
  `STATUS_UNAUTHENTICATED`
  `static final int`
  `STATUS_UNAVAILABLE`
  `static final int`
  `STATUS_UNIMPLEMENTED`
  `static final int`
  `STATUS_UNKNOWN`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `GrpcResponse(int grpcStatus, int httpCode, T responseData, String responseMessage)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `getHttpCode()`
  The underlying HTTP status code.
  `int`
  `getResponseCode()`
  The gRPC status code.
  `T`
  `getResponseData()`
  The deserialised response message, or `null` when the call failed or the server returned an empty body.
  `String`
  `getResponseErrorMessage()`
  The server-supplied `grpc-message` trailer (or the HTTP error message when the call failed before reaching the trailer).
  `boolean`
  `isOk()`
  `true` iff `getResponseCode()` is `0` (gRPC `OK`).

  ### Methods inherited from class java.lang.Object

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

- ## Field Details

  - ### STATUS_OK

    public static final int STATUS_OK
    See Also:
      - Constant Field Values

  - ### STATUS_CANCELLED

    public static final int STATUS_CANCELLED
    See Also:
      - Constant Field Values

  - ### STATUS_UNKNOWN

    public static final int STATUS_UNKNOWN
    See Also:
      - Constant Field Values

  - ### STATUS_INVALID_ARGUMENT

    public static final int STATUS_INVALID_ARGUMENT
    See Also:
      - Constant Field Values

  - ### STATUS_DEADLINE_EXCEEDED

    public static final int STATUS_DEADLINE_EXCEEDED
    See Also:
      - Constant Field Values

  - ### STATUS_NOT_FOUND

    public static final int STATUS_NOT_FOUND
    See Also:
      - Constant Field Values

  - ### STATUS_ALREADY_EXISTS

    public static final int STATUS_ALREADY_EXISTS
    See Also:
      - Constant Field Values

  - ### STATUS_PERMISSION_DENIED

    public static final int STATUS_PERMISSION_DENIED
    See Also:
      - Constant Field Values

  - ### STATUS_RESOURCE_EXHAUSTED

    public static final int STATUS_RESOURCE_EXHAUSTED
    See Also:
      - Constant Field Values

  - ### STATUS_FAILED_PRECONDITION

    public static final int STATUS_FAILED_PRECONDITION
    See Also:
      - Constant Field Values

  - ### STATUS_ABORTED

    public static final int STATUS_ABORTED
    See Also:
      - Constant Field Values

  - ### STATUS_OUT_OF_RANGE

    public static final int STATUS_OUT_OF_RANGE
    See Also:
      - Constant Field Values

  - ### STATUS_UNIMPLEMENTED

    public static final int STATUS_UNIMPLEMENTED
    See Also:
      - Constant Field Values

  - ### STATUS_INTERNAL

    public static final int STATUS_INTERNAL
    See Also:
      - Constant Field Values

  - ### STATUS_UNAVAILABLE

    public static final int STATUS_UNAVAILABLE
    See Also:
      - Constant Field Values

  - ### STATUS_DATA_LOSS

    public static final int STATUS_DATA_LOSS
    See Also:
      - Constant Field Values

  - ### STATUS_UNAUTHENTICATED

    public static final int STATUS_UNAUTHENTICATED
    See Also:
      - Constant Field Values

  - ### STATUS_TRANSPORT_FAILURE

    public static final int STATUS_TRANSPORT_FAILURE
    Sentinel status indicating the transport itself failed (no `grpc-status` trailer was parsed). Inspect `getHttpCode()` for the underlying HTTP error.
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### GrpcResponse

    public GrpcResponse(int grpcStatus, int httpCode, T responseData, String responseMessage)

- ## Method Details

  - ### getResponseData

    public T getResponseData()
    The deserialised response message, or `null` when the call failed or the server returned an empty body.

  - ### getResponseCode

    public int getResponseCode()
    The gRPC status code. `0` is success; non-zero codes follow the standard gRPC status enumeration. `-1` (`STATUS_TRANSPORT_FAILURE`) signals a transport-level error -- the call never reached `grpc-status`.

  - ### getHttpCode

    public int getHttpCode()
    The underlying HTTP status code. Usually `200` even for a non-zero gRPC status, because the server returns gRPC errors in trailers rather than via HTTP status. Useful when `getResponseCode()` is `STATUS_TRANSPORT_FAILURE`.

  - ### isOk

    public boolean isOk()
    `true` iff `getResponseCode()` is `0` (gRPC `OK`).

  - ### getResponseErrorMessage

    public String getResponseErrorMessage()
    The server-supplied `grpc-message` trailer (or the HTTP error message when the call failed before reaching the trailer).