View Source FLHook.Dict (FLHook Client v2.1.2)
A module that provides helpers to decode command response and event data.
Summary
Functions
Fetches the field using the specified key from the dict. Optionally allows specification of a type to coerce the param to.
Fetches the field using the specified key from the dict. Optionally allows specification of a type to coerce the value to. Raises when the param is missing or could not be coerced to the given type.
Gets the field using the specified key from the dict.
Fetches multiple fields with the specified keys from the dict. Optionally allows specification of a type to coerce the param to.
Puts multiple fields using the specified keys from the dict into the given struct. Optionally allows specification of a type to coerce the param to.
Converts the dict to a plain map.
Types
Functions
@spec fetch(t(), key(), field_type()) :: {:ok, any()} | {:error, FLHook.FieldError.t()}
Fetches the field using the specified key from the dict. Optionally allows specification of a type to coerce the param to.
@spec fetch!(t(), key(), field_type()) :: any() | no_return()
Fetches the field using the specified key from the dict. Optionally allows specification of a type to coerce the value to. Raises when the param is missing or could not be coerced to the given type.
Gets the field using the specified key from the dict.
@spec pick(t(), [key()] | [{key(), field_type()}]) :: {:ok, %{optional(key()) => any()}} | {:error, FLHook.FieldError.t()}
Fetches multiple fields with the specified keys from the dict. Optionally allows specification of a type to coerce the param to.
@spec pick_into(t(), module() | struct(), [key()] | [{key(), field_type()}]) :: {:ok, struct()} | {:error, FLHook.FieldError.t()}
Puts multiple fields using the specified keys from the dict into the given struct. Optionally allows specification of a type to coerce the param to.
@spec to_map(t(), key_style :: :string | :atom) :: %{optional(atom()) => String.t()} | %{optional(String.t()) => String.t()}
Converts the dict to a plain map.