Packages

A Gleam library for interacting with the Discord API

Current section

Files

Jump to
shimmer src shimmer@ws@packets@hello.erl
Raw

src/shimmer@ws@packets@hello.erl

-module(shimmer@ws@packets@hello).
-compile(no_auto_import).
-export([from_map/1]).
-export_type([hello_packet_data/0]).
-type hello_packet_data() :: {hello_packet_data, integer()}.
-spec from_map(gleam@map:map_(gleam@dynamic:dynamic(), gleam@dynamic:dynamic())) -> {ok,
hello_packet_data()} |
{error, shimmer@internal@error:shimmer_error()}.
from_map(Map) ->
case begin
_pipe = Map,
shimmer@internal@map_helpers:get_field_safe(
_pipe,
shimmer@internal@map_helpers:dyn_atom(<<"heartbeat_interval"/utf8>>),
fun gleam@dynamic:int/1
)
end of
{error, _try} -> {error, _try};
{ok, Interval} ->
{ok, {hello_packet_data, Interval}}
end.