libero/json/wire
JSON wire protocol: encode/decode, frame builders, SSR flags.
All encode functions take already-encoded json.Json values.
Generated typed encoders run first; this module wraps them in
protocol envelopes.
Produces/consumes String (JSON text), not BitArray.
Types
pub type RequestEnvelope {
RequestEnvelope(
module: String,
request_id: Int,
message: dynamic.Dynamic,
)
}
Constructors
-
RequestEnvelope( module: String, request_id: Int, message: dynamic.Dynamic, )
Values
pub fn decode_flags_typed(
flags flags: String,
decoder decoder: fn(dynamic.Dynamic) -> Result(
a,
List(error.JsonError),
),
) -> Result(a, List(error.JsonError))
pub fn decode_request(
data data: String,
expected_hash expected_hash: String,
) -> Result(RequestEnvelope, List(error.JsonError))
pub fn decode_server_frame(
data data: String,
) -> Result(
frame.ServerFrame(dynamic.Dynamic),
List(error.JsonError),
)
pub fn encode_error(
request_id request_id: option.Option(Int),
errors errors: List(error.JsonError),
) -> String
pub fn encode_flags(value: json.Json) -> String
pub fn encode_push(
module module: String,
value value: json.Json,
) -> String
pub fn encode_request(
module module: String,
request_id request_id: Int,
msg msg: json.Json,
contract_hash contract_hash: String,
) -> String
pub fn encode_response(
request_id request_id: Int,
value value: json.Json,
) -> String