Current section
Files
Jump to
Current section
Files
src/telega@models@update.erl
-module(telega@models@update).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([decode/1]).
-export_type([update/0]).
-type update() :: {update, telega@models@message:message(), integer()}.
-spec decode(gleam@dynamic:dynamic_()) -> {ok, update()} |
{error, list(gleam@dynamic:decode_error())}.
decode(Json) ->
_pipe = Json,
(gleam@dynamic:decode2(
fun(Field@0, Field@1) -> {update, Field@0, Field@1} end,
gleam@dynamic:field(
<<"message"/utf8>>,
fun telega@models@message:decode/1
),
gleam@dynamic:field(<<"update_id"/utf8>>, fun gleam@dynamic:int/1)
))(_pipe).