Current section

Files

Jump to
discord_gleam src discord_gleam@ws@packets@guild_role_update.erl
Raw

src/discord_gleam@ws@packets@guild_role_update.erl

-module(discord_gleam@ws@packets@guild_role_update).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/discord_gleam/ws/packets/guild_role_update.gleam").
-export([from_json_string/1]).
-export_type([guild_role_update_packet/0, guild_role_update_packet_data/0]).
-type guild_role_update_packet() :: {guild_role_update_packet,
binary(),
integer(),
integer(),
guild_role_update_packet_data()}.
-type guild_role_update_packet_data() :: {guild_role_update_packet_data,
discord_gleam@discord@snowflake:snowflake(discord_gleam@discord@snowflake:guild()),
discord_gleam@types@role:role()}.
-file("src/discord_gleam/ws/packets/guild_role_update.gleam", 23).
-spec from_json_string(binary()) -> {ok, guild_role_update_packet()} |
{error, gleam@json:decode_error()}.
from_json_string(Encoded) ->
Decoder = begin
gleam@dynamic@decode:field(
<<"t"/utf8>>,
{decoder, fun gleam@dynamic@decode:decode_string/1},
fun(T) ->
gleam@dynamic@decode:field(
<<"s"/utf8>>,
{decoder, fun gleam@dynamic@decode:decode_int/1},
fun(S) ->
gleam@dynamic@decode:field(
<<"op"/utf8>>,
{decoder, fun gleam@dynamic@decode:decode_int/1},
fun(Op) ->
gleam@dynamic@decode:field(
<<"d"/utf8>>,
begin
gleam@dynamic@decode:field(
<<"guild_id"/utf8>>,
discord_gleam@discord@snowflake:decoder(
),
fun(Guild_id) ->
gleam@dynamic@decode:field(
<<"role"/utf8>>,
discord_gleam@types@role:json_decoder(
),
fun(Role) ->
gleam@dynamic@decode:success(
{guild_role_update_packet_data,
Guild_id,
Role}
)
end
)
end
)
end,
fun(D) ->
gleam@dynamic@decode:success(
{guild_role_update_packet,
T,
S,
Op,
D}
)
end
)
end
)
end
)
end
)
end,
gleam@json:parse(Encoded, Decoder).