Class JsonRpcResponse

java.lang.Object
com.github.copilot.sdk.json.JsonRpcResponse

public final class JsonRpcResponse extends Object
JSON-RPC 2.0 response structure.

This is an internal class representing the wire format of a JSON-RPC response. It follows the JSON-RPC 2.0 specification. A response contains either a result or an error, but not both.

Since:
1.0.0
See Also:
  • Constructor Details

    • JsonRpcResponse

      public JsonRpcResponse()
  • Method Details

    • getJsonrpc

      public String getJsonrpc()
      Gets the JSON-RPC version.
      Returns:
      the version string (should be "2.0")
    • setJsonrpc

      public void setJsonrpc(String jsonrpc)
      Sets the JSON-RPC version.
      Parameters:
      jsonrpc - the version string
    • getId

      public Object getId()
      Gets the response ID.
      Returns:
      the request identifier this response corresponds to
    • setId

      public void setId(Object id)
      Sets the response ID.
      Parameters:
      id - the response identifier
    • getResult

      public Object getResult()
      Gets the result of the RPC call.
      Returns:
      the result object, or null if there was an error
    • setResult

      public void setResult(Object result)
      Sets the result of the RPC call.
      Parameters:
      result - the result object
    • getError

      public JsonRpcError getError()
      Gets the error if the RPC call failed.
      Returns:
      the error object, or null if successful
    • setError

      public void setError(JsonRpcError error)
      Sets the error for a failed RPC call.
      Parameters:
      error - the error object