aion_client/payload
Typed JSON encoder/decoder helpers and raw Payload escape hatch.
Types
Opaque bytes plus content-type, matching the AW Payload wire shape. Gleam’s public SDK keeps the byte data in a String so JSON payloads and conformance fixtures remain directly inspectable while still preserving the raw escape hatch and content-type boundary.
pub type Payload {
Payload(content_type: String, bytes: String)
}
Constructors
-
Payload(content_type: String, bytes: String)
Values
pub fn decode(
payload: Payload,
decoder: decode.Decoder(value),
) -> Result(value, error.Error)
Decode a JSON Payload into a typed value. Decode failures are explicit data and map to InvalidArgument rather than panicking or silently defaulting.
pub fn encode(
value: value,
encoder: fn(value) -> json.Json,
) -> Payload
Encode a typed value as a JSON Payload.
pub const json_content_type: String