Packages

An extended and functional wrapper for the Clash of Clans API

Current section

Files

Jump to
clashofclans lib endpoints players builderbase highest_versus.ex
Raw

lib/endpoints/players/builderbase/highest_versus.ex

defmodule Endpoints.Players.HighestVersus do
alias Endpoints.Players.Raw
def get_players_highest_versus(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, ["bestVersusTrophies"])
|> Map.values()
|> hd()
end
end
end
end