Flezha.SDK.Response (flezha_sdk v0.1.0)

Copy Markdown View Source

One outcome of a Flezha.SDK.ChannelBuilder.call/3, as its Response channel delivers it: the request the call end wrote (its bytes), the result ({:ok, answer} with the answer read by the call's decode:, or {:error, %Flezha.SDK.Error{}}, a missed deadline being call.timeout), the callee's instance id as target, and created, true when this call started the callee.

Summary

Functions

The Response a controller's envelope carries, read by the core's decoder. decode reads the answer's bytes as an input_with/3 parser does. A payload that is no envelope is {:error, %Flezha.SDK.Error{}} with the code call.malformed_response.

Types

t()

@type t() :: %Flezha.SDK.Response{
  created: boolean(),
  request: binary(),
  result: {:ok, term()} | {:error, Flezha.SDK.Error.t()},
  target: String.t()
}

Functions

decode(payload, decode)

@spec decode(binary(), (binary() -> {:ok, term()} | {:error, term()})) ::
  {:ok, t()} | {:error, term()}

The Response a controller's envelope carries, read by the core's decoder. decode reads the answer's bytes as an input_with/3 parser does. A payload that is no envelope is {:error, %Flezha.SDK.Error{}} with the code call.malformed_response.