Skip to content

Commit

Permalink
added verification module
Browse files Browse the repository at this point in the history
  • Loading branch information
notahelpr committed Oct 29, 2022
1 parent 2157bdc commit fb5c3fd
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,20 @@ Example.playername("your-tag-here")
---

## Getting started
*BSF: This is a WIP and currently in v1 (development) mode. This means that the API is not stable and may change at any time. Please report bugs through issue requests, thanks.*
*Please only use the latest version of the package - we do not offer support for any lower or outdated versions.*
> #### Installing
[https://hex.pm/packages/clashofclans](https://hex.pm/packages/clashofclans)
```elixir
def deps do
[{:clashofclans, "~> 1.2.5"}]
[{:clashofclans, "~> 1.3.0"}]
end
```

```
$ mix deps.get
```

---

> #### Configuration
Since we (currently) only support authentication through APi tokens, you will need to get one from the [Clash of Clans API](https://developer.clashofclans.com/#/account) website. Once you have your token, you can add it to your `config/config.exs` file like so:

Expand Down Expand Up @@ -158,6 +156,9 @@ make sure the `.env` is in your root directory.
- previous_legend_season_trophies(playertag)
- previous_legend_season_id(playertag)

`Players.Verification/2`
- verifyplayer(playertag, token)

`Leagues/0`
- legend_league
- titan_league_three
Expand Down Expand Up @@ -187,9 +188,6 @@ make sure the `.env` is in your root directory.
- goldpass_starttime
- goldpass_endtime


locations and verification coming soon!

---

© vKxni 2022, [MIT Licence](/LICENSE), by [@vKxni](https://github.com/vKxni).
7 changes: 6 additions & 1 deletion lib/clashofclans.ex
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ defmodule Clashofclans.Extended.Players do
VersusTrophies,
Builderbase.VersusWinCount,
VersusWins,
Heroes
Heroes,
Verification
}

def townhallweapon(playertag) do
Expand Down Expand Up @@ -189,6 +190,10 @@ defmodule Clashofclans.Extended.Players do
def battlemachinelevel(playertag) do
Heroes.get_level_of_battle_machine(playertag)
end

def verifyplayer(playertag, token) do
Verification.verify_player(playertag, token)
end
end

defmodule Clashofclans.Extendend.LegendLeague do
Expand Down
5 changes: 4 additions & 1 deletion lib/endpoints/players/verification.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ defmodule Endpoints.Players.Verification do
@moduledoc """
This module is responsible for verifying a players account.
e.g. "#AB123", "my_token_here"
Returns "invalid" if the API token is invalid/expired,
Return "ok" if both is valid and the player is verified.
DEV NOTE: This module has its own request endpoint since we need "content-type" instead of the "accept" header.
DEV NOTE: This module has its own request endpoint since we need a POST request with a "content-type"
# instead of the "accept" header.
"""

def process_request_headers(headers),
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ defmodule Clashofclans.MixProject do
def project do
[
app: :clashofclans,
version: "1.2.5",
version: "1.3.0",
description: "An extended and functional wrapper for the Clash of Clans API",
elixir: "~> 1.14",
start_permanent: Mix.env() == :prod,
Expand Down

0 comments on commit fb5c3fd

Please sign in to comment.