Current section

Files

Jump to
tallgrass src tallgrass@item.erl
Raw

src/tallgrass@item.erl

-module(tallgrass@item).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([new/0, fetch_resource/2, fetch/1, fetch_by_id/2, fetch_by_name/2]).
-export_type([item/0, version_group_flavor_text/0, item_holder_pokemon/0, item_holder_pokemon_version_detail/0]).
-type item() :: {item,
integer(),
binary(),
integer(),
gleam@option:option(integer()),
gleam@option:option(tallgrass@common@resource:resource()),
list(tallgrass@common@resource:resource()),
tallgrass@common@resource:resource(),
list(tallgrass@common@effect:verbose_effect()),
list(version_group_flavor_text()),
list(tallgrass@common@generation:generation_game_index()),
list(tallgrass@common@name:name()),
list(item_holder_pokemon()),
gleam@option:option(tallgrass@common@resource:resource())}.
-type version_group_flavor_text() :: {version_group_flavor_text,
binary(),
tallgrass@common@resource:resource(),
tallgrass@common@resource:resource()}.
-type item_holder_pokemon() :: {item_holder_pokemon,
tallgrass@common@resource:resource(),
list(item_holder_pokemon_version_detail())}.
-type item_holder_pokemon_version_detail() :: {item_holder_pokemon_version_detail,
integer(),
tallgrass@common@resource:resource()}.
-file("/Users/stevetoro/Code/tallgrass/src/tallgrass/item.gleam", 52).
-spec new() -> tallgrass@client:client().
new() ->
tallgrass@client:new().
-file("/Users/stevetoro/Code/tallgrass/src/tallgrass/item.gleam", 152).
-spec version_group_flavor_text() -> decode:decoder(version_group_flavor_text()).
version_group_flavor_text() ->
_pipe = decode:into(
(decode:parameter(
fun(Text) ->
decode:parameter(
fun(Language) ->
decode:parameter(
fun(Version_group) ->
{version_group_flavor_text,
Text,
Language,
Version_group}
end
)
end
)
end
))
),
_pipe@1 = decode:field(
_pipe,
<<"text"/utf8>>,
{decoder, fun gleam@dynamic:string/1}
),
_pipe@2 = decode:field(
_pipe@1,
<<"language"/utf8>>,
tallgrass@common@resource:resource()
),
decode:field(
_pipe@2,
<<"version_group"/utf8>>,
tallgrass@common@resource:resource()
).
-file("/Users/stevetoro/Code/tallgrass/src/tallgrass/item.gleam", 177).
-spec item_holder_pokemon_version_detail() -> decode:decoder(item_holder_pokemon_version_detail()).
item_holder_pokemon_version_detail() ->
_pipe = decode:into(
(decode:parameter(
fun(Rarity) ->
decode:parameter(
fun(Version) ->
{item_holder_pokemon_version_detail, Rarity, Version}
end
)
end
))
),
_pipe@1 = decode:field(
_pipe,
<<"rarity"/utf8>>,
{decoder, fun gleam@dynamic:int/1}
),
decode:field(
_pipe@1,
<<"version"/utf8>>,
tallgrass@common@resource:resource()
).
-file("/Users/stevetoro/Code/tallgrass/src/tallgrass/item.gleam", 164).
-spec item_holder_pokemon() -> decode:decoder(item_holder_pokemon()).
item_holder_pokemon() ->
_pipe = decode:into(
(decode:parameter(
fun(Pokemon) ->
decode:parameter(
fun(Version_details) ->
{item_holder_pokemon, Pokemon, Version_details}
end
)
end
))
),
_pipe@1 = decode:field(
_pipe,
<<"pokemon"/utf8>>,
tallgrass@common@resource:resource()
),
decode:field(
_pipe@1,
<<"version_details"/utf8>>,
decode:list(item_holder_pokemon_version_detail())
).
-file("/Users/stevetoro/Code/tallgrass/src/tallgrass/item.gleam", 103).
-spec item() -> decode:decoder(item()).
item() ->
_pipe = decode:into(
(decode:parameter(
fun(Id) ->
decode:parameter(
fun(Name) ->
decode:parameter(
fun(Cost) ->
decode:parameter(
fun(Fling_power) ->
decode:parameter(
fun(Fling_effect) ->
decode:parameter(
fun(Attributes) ->
decode:parameter(
fun(Category) ->
decode:parameter(
fun(
Effect_entries
) ->
decode:parameter(
fun(
Flavor_text_entries
) ->
decode:parameter(
fun(
Game_indices
) ->
decode:parameter(
fun(
Names
) ->
decode:parameter(
fun(
Held_by_pokemon
) ->
decode:parameter(
fun(
Baby_trigger_for
) ->
{item,
Id,
Name,
Cost,
Fling_power,
Fling_effect,
Attributes,
Category,
Effect_entries,
Flavor_text_entries,
Game_indices,
Names,
Held_by_pokemon,
Baby_trigger_for}
end
)
end
)
end
)
end
)
end
)
end
)
end
)
end
)
end
)
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}
),
_pipe@3 = decode:field(
_pipe@2,
<<"cost"/utf8>>,
{decoder, fun gleam@dynamic:int/1}
),
_pipe@4 = decode:field(
_pipe@3,
<<"fling_power"/utf8>>,
decode:optional({decoder, fun gleam@dynamic:int/1})
),
_pipe@5 = decode:field(
_pipe@4,
<<"fling_effect"/utf8>>,
decode:optional(tallgrass@common@resource:resource())
),
_pipe@6 = decode:field(
_pipe@5,
<<"attributes"/utf8>>,
decode:list(tallgrass@common@resource:resource())
),
_pipe@7 = decode:field(
_pipe@6,
<<"category"/utf8>>,
tallgrass@common@resource:resource()
),
_pipe@8 = decode:field(
_pipe@7,
<<"effect_entries"/utf8>>,
decode:list(tallgrass@common@effect:verbose_effect())
),
_pipe@9 = decode:field(
_pipe@8,
<<"flavor_text_entries"/utf8>>,
decode:list(version_group_flavor_text())
),
_pipe@10 = decode:field(
_pipe@9,
<<"game_indices"/utf8>>,
decode:list(tallgrass@common@generation:generation_game_index())
),
_pipe@11 = decode:field(
_pipe@10,
<<"names"/utf8>>,
decode:list(tallgrass@common@name:name())
),
_pipe@12 = decode:field(
_pipe@11,
<<"held_by_pokemon"/utf8>>,
decode:list(item_holder_pokemon())
),
decode:field(
_pipe@12,
<<"baby_trigger_for"/utf8>>,
decode:optional(tallgrass@common@resource:resource())
).
-file("/Users/stevetoro/Code/tallgrass/src/tallgrass/item.gleam", 77).
-spec fetch_resource(
tallgrass@client:client(),
tallgrass@common@resource:resource()
) -> {ok, item()} | {error, tallgrass@client@request:error()}.
fetch_resource(Client, Resource) ->
tallgrass@client:fetch_resource(Client, Resource, item()).
-file("/Users/stevetoro/Code/tallgrass/src/tallgrass/item.gleam", 63).
-spec fetch(tallgrass@client:client()) -> {ok,
tallgrass@common@resource:paginated_resource()} |
{error, tallgrass@client@request:error()}.
fetch(Client) ->
tallgrass@client:fetch_resources(Client, <<"item"/utf8>>).
-file("/Users/stevetoro/Code/tallgrass/src/tallgrass/item.gleam", 88).
-spec fetch_by_id(tallgrass@client:client(), integer()) -> {ok, item()} |
{error, tallgrass@client@request:error()}.
fetch_by_id(Client, Id) ->
tallgrass@client:fetch_by_id(Client, <<"item"/utf8>>, Id, item()).
-file("/Users/stevetoro/Code/tallgrass/src/tallgrass/item.gleam", 99).
-spec fetch_by_name(tallgrass@client:client(), binary()) -> {ok, item()} |
{error, tallgrass@client@request:error()}.
fetch_by_name(Client, Name) ->
tallgrass@client:fetch_by_name(Client, <<"item"/utf8>>, Name, item()).