View Source PhxJsonRpc.Response (Phoenix JSON RPC v0.6.0)

Basic struct for the rpc response

Summary

Types

t()

Type represents structure for the rpc response.

Functions

Creates an empty rpc response.

Creates the new rpc response from the given params.

Types

@type t() :: %PhxJsonRpc.Response{
  data: PhxJsonRpc.Types.rpc_response(),
  error: PhxJsonRpc.Types.rpc_error(),
  id: PhxJsonRpc.Types.rpc_request_id(),
  valid?: boolean(),
  version: PhxJsonRpc.Types.jsonrpc_version()
}

Type represents structure for the rpc response.

Functions

@spec empty(boolean()) :: t()

Creates an empty rpc response.

Examples

iex> PhxJsonRpc.Response.empty()
%PhxJsonRpc.Response{
  version: nil,
  data: nil,
  id: nil,
  valid?: false,
  error: nil
}
@spec new(Keyword.t()) :: t()

Creates the new rpc response from the given params.

Examples

iex> PhxJsonRpc.Response.new(version: "2.0", data: "hello", id: "[REQUEST-UUID]", valid?: true)
%PhxJsonRpc.Response{
  version: "2.0",
  data: "hello",
  id: "[REQUEST-UUID]",
  valid?: true,
  error: nil
}