Cauldron2D.Net.Api (Cauldron2D.Net v0.1.3)

Copy Markdown View Source

What a client on another machine asks a server over plain HTTP, as a plug a game forwards a path to: a token for a name and password (POST /token, with register: true to make the account first), the arenas (GET /arenas) as a lobby lists them, how the server is keeping up (GET /stats), and the boards (GET /leaders?period=day| week|all&metric=<name>&arena=<name>) when the game keeps a ledger.

forward "/api", Cauldron2D.Net.Api, login: &MyGame.Web.Auth.login/2, register: &MyGame.Web.Auth.register/2, token: &MyGame.Web.Auth.token/1, ledger: MyGame.Ledger

Options

  • :login — a function of a name and a password, {:ok, name} or :error. Required
  • :register — a function of a name and a password, {:ok, name} or {:error, reason}. Default: registration refused
  • :token — a function from a name to the token a socket connects with. Required
  • :ledger — a Cauldron2D.Ledger for the boards. Default: none, GET /leaders is 404

Summary

Functions

An arena as the API lists it: strings for the id and the kind, no world.

Functions

arena_json(arena)

@spec arena_json(map()) :: map()

An arena as the API lists it: strings for the id and the kind, no world.