ExValorantAPIClient

ExValorantAPIClient is simple Valorant API client.

Installation

If available in Hex, the package can be installed by adding ex_valorant_api_client to your list of dependencies in mix.exs:

def deps do
  [
    {:ex_valorant_api_client, "~> 0.2.0"}
  ]
end

Usage

iex> client = ExValorantAPIClient.new("your_api_key")
%Tesla.Client{
    adapter: nil,
    fun: nil,
    post: [],
    pre: [
      {Tesla.Middleware.DecompressResponse, :call, [[]]},
      {Tesla.Middleware.JSON, :call, [[engine: Jason]]},
      {Tesla.Middleware.Headers, :call, [[{"X-Riot-Token", "your_api_key"}]]}
    ]
}

iex> {:ok, response} = ExValorantAPIClient.get_account_by_riot_id(client, "game_name", "tag_line")
{:ok,
  ...
  body: %{
    "gameName" => "G kenkun",
    "puuid" => "Yy5i4LmA9J1dkiCgUycHB8Ec_XYLOsouuef7arkDY2q2_i-9YoCTf2KHwY25ckrOFVEyks6I4D8K4A",
    "tagLine" => "JP1"
  },
  ...
  status: 200,
  url: "https://asia.api.riotgames.com/riot/account/v1/accounts/by-riot-id/g_kenkun/JP1"
}}

iex> response.body
%{
  "gameName" => "G kenkun",
  "puuid" => "Yy5i4LmA9J1dkiCgUycHB8Ec_XYLOsouuef7arkDY2q2_i-9YoCTf2KHwY25ckrOFVEyks6I4D8K4A",
  "tagLine" => "JP1"
}