Macro for Telegram API type structs with automatic parsing.
Usage:
defmodule Hotline.Types.User do
use Hotline.Type
defstruct [:id, :is_bot, :first_name]
@type t :: %__MODULE__{
id: integer(),
is_bot: boolean(),
first_name: String.t()
}
endThe parse/1 function converts a raw map (with string keys) into the struct,
dropping unknown fields and applying nested type parsing via parse_nested/1.
Override parse_nested/1 to return a map of %{field_atom => parser_fn} for
fields that contain nested Hotline types.