Opsmaru.Incus.Response (opsmaru_incus v0.1.0)

Copy Markdown View Source

Native Incus envelope with lossless metadata/unknown fields and ETag.

Summary

Functions

Accepted async envelopes are not completed operations.

Explicit typed JSON projection for native Response, ResponseRaw and ResponseType.

Extract native map metadata without modifying the originating response.

Explicit typed native projection; ordinary response/model decoding remains lossless.

Extract native string-slice metadata; native null retains the initialized empty slice.

Types

t()

@type t() :: %Opsmaru.Incus.Response{
  connection: term(),
  error: term(),
  error_code: term(),
  etag: term(),
  http_status: term(),
  identity: term(),
  metadata: term(),
  operation: term(),
  raw: term(),
  status: term(),
  status_code: term(),
  type: term()
}

Functions

accepted?(arg1)

Accepted async envelopes are not completed operations.

decode(body, status, headers)

decode_native(type, body)

Explicit typed JSON projection for native Response, ResponseRaw and ResponseType.

Unlike the wire envelope decoder, arbitrary response-type strings and native null/default fields are accepted. Unknown fields are dropped. Response metadata retains decoded JSON numbers; ResponseRaw metadata uses native float64 numbers. This returns model data, never an accepted operation or authorized connection.

Input/output are bounded to 1 MiB and input nesting to 64 levels. Duplicate object keys, ambiguous case aliases and non-ASCII envelope keys reject rather than emulate Go's ordered merging and Unicode field-name folding. ResponseRaw also rejects negative zero with an integer mantissa (including exponents), whose sign Jason discards. RawMessage whitespace/number spelling is not retained. Equality concerns parsed JSON for RawMessage and exact native float64 values for ResponseRaw metadata.

metadata_as_map(arg1)

Extract native map metadata without modifying the originating response.

metadata_as_model(arg1, type)

Explicit typed native projection; ordinary response/model decoding remains lossless.

metadata_as_operation(response)

metadata_as_string_slice(arg1)

Extract native string-slice metadata; native null retains the initialized empty slice.