-module(deriv@example@bar). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]). -export([decoder_baz/0, encode_baz/1]). -export_type([baz/0]). -type baz() :: {baz, integer(), binary(), boolean()}. -file("src/deriv/example/bar.gleam", 13). -spec decoder_baz() -> decode:decoder(baz()). decoder_baz() -> _pipe = decode:into( begin decode:parameter( fun(Id) -> decode:parameter( fun(Name) -> decode:parameter( fun(Active) -> {baz, Id, Name, Active} end ) end ) end ) end ), _pipe@1 = decode:field( _pipe, <<"id"/utf8>>, {decoder, fun gleam@dynamic:int/1} ), _pipe@2 = decode:field( _pipe@1, <<"name"/utf8>>, {decoder, fun gleam@dynamic:string/1} ), decode:field( _pipe@2, <<"active"/utf8>>, {decoder, fun gleam@dynamic:bool/1} ). -file("src/deriv/example/bar.gleam", 26). -spec encode_baz(baz()) -> gleam@json:json(). encode_baz(Value) -> gleam@json:object( [{<<"id"/utf8>>, gleam@json:int(erlang:element(2, Value))}, {<<"name"/utf8>>, gleam@json:string(erlang:element(3, Value))}, {<<"active"/utf8>>, gleam@json:bool(erlang:element(4, Value))}] ).