Current section

Files

Jump to
tallgrass src tallgrass@berry.erl
Raw

src/tallgrass@berry.erl

-module(tallgrass@berry).
-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([berry/0, berry_flavor_map/0]).
-type berry() :: {berry,
integer(),
binary(),
integer(),
integer(),
integer(),
integer(),
integer(),
integer(),
tallgrass@common@resource:resource(),
list(berry_flavor_map()),
tallgrass@common@resource:resource(),
tallgrass@common@resource:resource()}.
-type berry_flavor_map() :: {berry_flavor_map,
integer(),
tallgrass@common@resource:resource()}.
-file("/Users/stevetoro/Code/tallgrass/src/tallgrass/berry.gleam", 30).
-spec new() -> tallgrass@client:client().
new() ->
tallgrass@client:new().
-file("/Users/stevetoro/Code/tallgrass/src/tallgrass/berry.gleam", 124).
-spec berry_flavor_map() -> decode:decoder(berry_flavor_map()).
berry_flavor_map() ->
_pipe = decode:into(
(decode:parameter(
fun(Potency) ->
decode:parameter(
fun(Berry) -> {berry_flavor_map, Potency, Berry} end
)
end
))
),
_pipe@1 = decode:field(
_pipe,
<<"potency"/utf8>>,
{decoder, fun gleam@dynamic:int/1}
),
decode:field(
_pipe@1,
<<"flavor"/utf8>>,
tallgrass@common@resource:resource()
).
-file("/Users/stevetoro/Code/tallgrass/src/tallgrass/berry.gleam", 81).
-spec berry() -> decode:decoder(berry()).
berry() ->
_pipe = decode:into(
(decode:parameter(
fun(Id) ->
decode:parameter(
fun(Name) ->
decode:parameter(
fun(Growth_time) ->
decode:parameter(
fun(Max_harvest) ->
decode:parameter(
fun(Natural_gift_power) ->
decode:parameter(
fun(Size) ->
decode:parameter(
fun(Smoothness) ->
decode:parameter(
fun(
Soil_dryness
) ->
decode:parameter(
fun(
Firmness
) ->
decode:parameter(
fun(
Flavors
) ->
decode:parameter(
fun(
Item
) ->
decode:parameter(
fun(
Natural_gift_type
) ->
{berry,
Id,
Name,
Growth_time,
Max_harvest,
Natural_gift_power,
Size,
Smoothness,
Soil_dryness,
Firmness,
Flavors,
Item,
Natural_gift_type}
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,
<<"growth_time"/utf8>>,
{decoder, fun gleam@dynamic:int/1}
),
_pipe@4 = decode:field(
_pipe@3,
<<"max_harvest"/utf8>>,
{decoder, fun gleam@dynamic:int/1}
),
_pipe@5 = decode:field(
_pipe@4,
<<"natural_gift_power"/utf8>>,
{decoder, fun gleam@dynamic:int/1}
),
_pipe@6 = decode:field(
_pipe@5,
<<"size"/utf8>>,
{decoder, fun gleam@dynamic:int/1}
),
_pipe@7 = decode:field(
_pipe@6,
<<"smoothness"/utf8>>,
{decoder, fun gleam@dynamic:int/1}
),
_pipe@8 = decode:field(
_pipe@7,
<<"soil_dryness"/utf8>>,
{decoder, fun gleam@dynamic:int/1}
),
_pipe@9 = decode:field(
_pipe@8,
<<"firmness"/utf8>>,
tallgrass@common@resource:resource()
),
_pipe@10 = decode:field(
_pipe@9,
<<"flavors"/utf8>>,
decode:list(berry_flavor_map())
),
_pipe@11 = decode:field(
_pipe@10,
<<"item"/utf8>>,
tallgrass@common@resource:resource()
),
decode:field(
_pipe@11,
<<"natural_gift_type"/utf8>>,
tallgrass@common@resource:resource()
).
-file("/Users/stevetoro/Code/tallgrass/src/tallgrass/berry.gleam", 55).
-spec fetch_resource(
tallgrass@client:client(),
tallgrass@common@resource:resource()
) -> {ok, berry()} | {error, tallgrass@client@request:error()}.
fetch_resource(Client, Resource) ->
tallgrass@client:fetch_resource(Client, Resource, berry()).
-file("/Users/stevetoro/Code/tallgrass/src/tallgrass/berry.gleam", 41).
-spec fetch(tallgrass@client:client()) -> {ok,
tallgrass@common@resource:paginated_resource()} |
{error, tallgrass@client@request:error()}.
fetch(Client) ->
tallgrass@client:fetch_resources(Client, <<"berry"/utf8>>).
-file("/Users/stevetoro/Code/tallgrass/src/tallgrass/berry.gleam", 66).
-spec fetch_by_id(tallgrass@client:client(), integer()) -> {ok, berry()} |
{error, tallgrass@client@request:error()}.
fetch_by_id(Client, Id) ->
tallgrass@client:fetch_by_id(Client, <<"berry"/utf8>>, Id, berry()).
-file("/Users/stevetoro/Code/tallgrass/src/tallgrass/berry.gleam", 77).
-spec fetch_by_name(tallgrass@client:client(), binary()) -> {ok, berry()} |
{error, tallgrass@client@request:error()}.
fetch_by_name(Client, Name) ->
tallgrass@client:fetch_by_name(Client, <<"berry"/utf8>>, Name, berry()).