Packages

An extended and functional wrapper for the Clash of Clans API

Current section

Files

Jump to
clashofclans lib endpoints players builderbase versus_trophies.ex
Raw

lib/endpoints/players/builderbase/versus_trophies.ex

defmodule Endpoints.Players.VersusTrophies do
alias Endpoints.Players.Raw
def get_players_versus_trophies(playertag) do
with {:ok, account} <- Raw.get_raw_player_information(playertag) do
if account["bestVersusTrophies"] == nil do
{:error, "Player has no Builder Hall"}
else
Map.take(account, ["versusTrophies"])
|> Map.values()
|> hd()
end
end
end
end