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

Basic struct for the rpc response

Link to this section 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.

Link to this section 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.

Link to this section Functions

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

Creates an empty rpc response.

examples

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

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
}