-module(deriv@example@birl). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]). -export([decoder_date_time_examples/0, encode_date_time_examples/1, decoder_dict_field_type_dict_field_type/0, decoder_dict_field_type/0, encode_dict_field_type/1]). -export_type([date_time_examples/0, dict_field_type/0]). -type date_time_examples() :: {date_time_examples, birl:time(), birl:time(), birl:time(), birl:time(), birl:time(), birl:time(), birl:time()}. -type dict_field_type() :: {dict_field_type, gleam@dict:dict(binary(), integer())}. -file("src/deriv/example/birl.gleam", 19). -spec decoder_date_time_examples() -> decode:decoder(date_time_examples()). decoder_date_time_examples() -> _pipe = decode:into( begin decode:parameter( fun(T0) -> decode:parameter( fun(T1) -> decode:parameter( fun(T2) -> decode:parameter( fun(T3) -> decode:parameter( fun(T4) -> decode:parameter( fun(T5) -> decode:parameter( fun(T6) -> {date_time_examples, T0, T1, T2, T3, T4, T5, T6} end ) end ) end ) end ) end ) end ) end ) end ), _pipe@1 = decode:field( _pipe, <<"t0"/utf8>>, deriv@util:decoder_birl_parse() ), _pipe@2 = decode:field( _pipe@1, <<"t1"/utf8>>, deriv@util:decoder_birl_parse() ), _pipe@3 = decode:field( _pipe@2, <<"t2"/utf8>>, deriv@util:decoder_birl_from_naive() ), _pipe@4 = decode:field( _pipe@3, <<"t3"/utf8>>, deriv@util:decoder_birl_from_http() ), _pipe@5 = decode:field( _pipe@4, <<"t4"/utf8>>, deriv@util:decoder_birl_from_unix() ), _pipe@6 = decode:field( _pipe@5, <<"t5"/utf8>>, deriv@util:decoder_birl_from_unix_milli() ), decode:field( _pipe@6, <<"t6"/utf8>>, deriv@util:decoder_birl_from_unix_micro() ). -file("src/deriv/example/birl.gleam", 39). -spec encode_date_time_examples(date_time_examples()) -> gleam@json:json(). encode_date_time_examples(Value) -> gleam@json:object( [{<<"t0"/utf8>>, deriv@util:encode_birl_to_iso8601(erlang:element(2, Value))}, {<<"t1"/utf8>>, deriv@util:encode_birl_to_iso8601(erlang:element(3, Value))}, {<<"t2"/utf8>>, deriv@util:encode_birl_to_naive(erlang:element(4, Value))}, {<<"t3"/utf8>>, deriv@util:encode_birl_to_http(erlang:element(5, Value))}, {<<"t4"/utf8>>, deriv@util:encode_birl_to_unix(erlang:element(6, Value))}, {<<"t5"/utf8>>, deriv@util:encode_birl_to_unix_milli(erlang:element(7, Value))}, {<<"t6"/utf8>>, deriv@util:encode_birl_to_unix_micro(erlang:element(8, Value))}] ). -file("src/deriv/example/birl.gleam", 61). -spec decoder_dict_field_type_dict_field_type() -> decode:decoder(dict_field_type()). decoder_dict_field_type_dict_field_type() -> _pipe = decode:into( begin decode:parameter(fun(Dict) -> {dict_field_type, Dict} end) end ), decode:field( _pipe, <<"dict"/utf8>>, decode:dict( {decoder, fun gleam@dynamic:string/1}, {decoder, fun gleam@dynamic:int/1} ) ). -file("src/deriv/example/birl.gleam", 57). -spec decoder_dict_field_type() -> decode:decoder(dict_field_type()). decoder_dict_field_type() -> decode:one_of([decoder_dict_field_type_dict_field_type()]). -file("src/deriv/example/birl.gleam", 71). -spec encode_dict_field_type(dict_field_type()) -> gleam@json:json(). encode_dict_field_type(Value) -> case Value of {dict_field_type, _} = Value@1 -> gleam@json:object( [{<<"dict"/utf8>>, gleam@json:dict( erlang:element(2, Value@1), fun(Str) -> Str end, fun gleam@json:int/1 )}] ) end.