Current section
Files
Jump to
Current section
Files
src/shimmer@ws@packets@identify.erl
-module(shimmer@ws@packets@identify).
-compile(no_auto_import).
-export([to_etf/1]).
-export_type([identify_packet_data/0]).
-type identify_packet_data() :: {identify_packet_data,
binary(),
integer(),
integer(),
integer()}.
-spec to_etf(identify_packet_data()) -> bitstring().
to_etf(Data) ->
Properties = begin
_pipe = gleam@map:new(),
_pipe@1 = gleam@map:insert(
_pipe,
<<"os"/utf8>>,
gleam@dynamic:from(<<"unix"/utf8>>)
),
_pipe@2 = gleam@map:insert(
_pipe@1,
<<"broswer"/utf8>>,
gleam@dynamic:from(<<"shimmer"/utf8>>)
),
gleam@map:insert(
_pipe@2,
<<"device"/utf8>>,
gleam@dynamic:from(<<"shimmer"/utf8>>)
)
end,
Data@1 = begin
_pipe@3 = gleam@map:new(),
_pipe@4 = gleam@map:insert(
_pipe@3,
<<"token"/utf8>>,
gleam@dynamic:from(erlang:element(2, Data))
),
_pipe@5 = gleam@map:insert(
_pipe@4,
<<"intents"/utf8>>,
gleam@dynamic:from(erlang:element(3, Data))
),
_pipe@6 = gleam@map:insert(
_pipe@5,
<<"shards"/utf8>>,
gleam@dynamic:from(
[erlang:element(4, Data), erlang:element(5, Data)]
)
),
gleam@map:insert(
_pipe@6,
<<"properties"/utf8>>,
gleam@dynamic:from(Properties)
)
end,
_pipe@7 = gleam@map:new(),
_pipe@8 = gleam@map:insert(_pipe@7, <<"op"/utf8>>, gleam@dynamic:from(2)),
_pipe@9 = gleam@map:insert(
_pipe@8,
<<"d"/utf8>>,
gleam@dynamic:from(Data@1)
),
erlang:term_to_binary(_pipe@9).