Current section

Files

Jump to
tallgrass src tallgrass@location.erl
Raw

src/tallgrass@location.erl

-module(tallgrass@location).
-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([location/0]).
-type location() :: {location,
integer(),
binary(),
tallgrass@common@resource:resource(),
list(tallgrass@common@name:name()),
list(tallgrass@common@generation:generation_game_index()),
list(tallgrass@common@resource:resource())}.
-file("/Users/stevetoro/Code/tallgrass/src/tallgrass/location.gleam", 24).
-spec new() -> tallgrass@client:client().
new() ->
tallgrass@client:new().
-file("/Users/stevetoro/Code/tallgrass/src/tallgrass/location.gleam", 75).
-spec location() -> decode:decoder(location()).
location() ->
_pipe = decode:into(
(decode:parameter(
fun(Id) ->
decode:parameter(
fun(Name) ->
decode:parameter(
fun(Region) ->
decode:parameter(
fun(Names) ->
decode:parameter(
fun(Game_indices) ->
decode:parameter(
fun(Areas) ->
{location,
Id,
Name,
Region,
Names,
Game_indices,
Areas}
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,
<<"region"/utf8>>,
tallgrass@common@resource:resource()
),
_pipe@4 = decode:field(
_pipe@3,
<<"names"/utf8>>,
decode:list(tallgrass@common@name:name())
),
_pipe@5 = decode:field(
_pipe@4,
<<"game_indices"/utf8>>,
decode:list(tallgrass@common@generation:generation_game_index())
),
decode:field(
_pipe@5,
<<"areas"/utf8>>,
decode:list(tallgrass@common@resource:resource())
).
-file("/Users/stevetoro/Code/tallgrass/src/tallgrass/location.gleam", 49).
-spec fetch_resource(
tallgrass@client:client(),
tallgrass@common@resource:resource()
) -> {ok, location()} | {error, tallgrass@client@request:error()}.
fetch_resource(Client, Resource) ->
tallgrass@client:fetch_resource(Client, Resource, location()).
-file("/Users/stevetoro/Code/tallgrass/src/tallgrass/location.gleam", 35).
-spec fetch(tallgrass@client:client()) -> {ok,
tallgrass@common@resource:paginated_resource()} |
{error, tallgrass@client@request:error()}.
fetch(Client) ->
tallgrass@client:fetch_resources(Client, <<"location"/utf8>>).
-file("/Users/stevetoro/Code/tallgrass/src/tallgrass/location.gleam", 60).
-spec fetch_by_id(tallgrass@client:client(), integer()) -> {ok, location()} |
{error, tallgrass@client@request:error()}.
fetch_by_id(Client, Id) ->
tallgrass@client:fetch_by_id(Client, <<"location"/utf8>>, Id, location()).
-file("/Users/stevetoro/Code/tallgrass/src/tallgrass/location.gleam", 71).
-spec fetch_by_name(tallgrass@client:client(), binary()) -> {ok, location()} |
{error, tallgrass@client@request:error()}.
fetch_by_name(Client, Name) ->
tallgrass@client:fetch_by_name(
Client,
<<"location"/utf8>>,
Name,
location()
).