ExPilot.Duels.Remote (ExPilot v0.1.1)

Copy Markdown View Source

A challenge sent to another ExPilot server over its API (POST <url>/duel), and a duel there declined or withdrawn (POST <url>/duel/cancel).

{:ok, duel} = ExPilot.Duels.Remote.challenge("http://arcade:2280/api", token, "bob", "dogfight", 5)
:ok = ExPilot.Duels.Remote.cancel("http://arcade:2280/api", token, duel.id)

url is the server's API, token one from Cauldron2D.Net.Remote.login/4, arena the name of the arena the duel borrows its map from. The duel comes back as ExPilot.Duels describes it with string keys turned to atoms and its arena a string; {:error, text} carries the server's reason.

Summary

Functions

Decline or withdraw duel id on the server at url, as the token's pilot (POST <url>/duel/cancel).

Functions

cancel(url, token, id)

@spec cancel(String.t(), String.t(), pos_integer()) :: :ok | {:error, String.t()}

Decline or withdraw duel id on the server at url, as the token's pilot (POST <url>/duel/cancel).

challenge(url, token, to, arena, first_to)

@spec challenge(String.t(), String.t(), String.t(), String.t(), pos_integer()) ::
  {:ok, map()} | {:error, String.t()}