XmtpElixirSdk.CodecRegistry
(xmtp_elixir_sdk v0.1.2)
Copy Markdown
Registry of custom content codecs keyed by canonical content type.
Summary
Types
@type codec_module() :: module()
@type t() :: %XmtpElixirSdk.CodecRegistry{ codecs: %{optional(String.t()) => codec_module()} }
Functions
@spec decode(t(), XmtpElixirSdk.Content.Unknown.t() | term()) :: {:ok, term()} | {:error, :missing_codec | XmtpElixirSdk.Error.t()}
@spec encode(t(), codec_module(), term()) :: {:ok, XmtpElixirSdk.Content.Unknown.t()} | {:error, XmtpElixirSdk.Error.t()}
@spec get_codec(t(), XmtpElixirSdk.Types.ContentTypeId.t() | String.t()) :: codec_module() | nil
@spec new([codec_module()]) :: t()
@spec register(t(), codec_module()) :: t()