Skip to content

Documentation

LeonNiekus edited this page Apr 29, 2021 · 21 revisions

API

Description

The API provides a variety of routes that support both the online Blade-based configuration screens as well as the Xamarin-based cross-platform mobile app. The API is used to send data from the configuration screens to the clients and vice versa. In order to achieve client synchronization, data pushing is used as opposed to data polling. Pusher App is used to achieve this goal. The API currently does not support any user authentication platforms using tokens.

Details

  • API language: php ^7.3|^8.0 (Laravel)
  • API structure: REST
  • Supported HTTP methods: GET, POST, PUT, DELETE
  • Security platforms: CSRF tokens, TLS support
  • User authentication platform: none
  • User authentication definition: none
  • Supported database engine: MySQL
  • Database setup-structure: Laravel migrations

Routes

UserController@get

Returns information regarding a singular user (user specified by id).

  • Parameters: $user: User
  • Associated Route: GET /api/users/{user}

UserController@store

Creates and stores a new user.

  • Parameters: $request: UserStoreRequest
  • Associated Route: POST /api/users

UserController@update

Updates the location of a user (user specified by id).

  • Parameters: $request: UpdateLocationRequest, $user: User
  • Associated Route: PUT /api/users/{user}

InviteKeyController@get

Returns one of three options regarding invite keys (invite key specified by invite key value):

  1. Error message: "The given invite key is in use"
  2. Error message: "The given key has expired since its parent game has ended"
  3. The given key object as JSON
  • Parameters: $key: InviteKey
  • Associated Route: GET /api/invite-keys/{key}

GameController@get

Returns a game's details (game specified by id).

  • Parameters: $game: Game
  • Associated Route: GET /api/games/{game}

GameController@getUsers

Returns all the users that belong to a game (game specified by id).

  • Parameters: $game: Game
  • Associated Route: GET /api/games/{game}/users

GameController@getUsersWithRole

Returns all the users, including their roles, that belong to a game (game specified by id).

  • Parameters: $game: Game
  • Associated Route: GET /api/games/{game}/users-with-role

GameController@getLoot

Returns all the loot that belongs to a game (game specified by id).

  • Parameters: $game: Game
  • Associated Route: GET /api/games/{game}/loot

GameController@getBorderMarkers

Returns a game's border markers (game specified by id).

  • Parameters: $game: Game
  • Associated Route: GET /api/games/{game}/border-markers

Configuration Screens

Description

Firstly, the configuration screens allow a game leader to specify certain game details such as game duration or game area. The invite keys for a game are also generated here. After all of the game settings have been set to the game leader's prefered values, a game can be started with the click of a button. Secondly, after a game has been started, the configuration screens provide the game leader with certain game details and interactions, such as an overview of the players' last known locations and buttons for pausing, resuming and ending a game.

Details

  • Configuration screens language: Blade HTML
  • Supported browsers: any
  • User authentication method: To be implemented
  • User authentication definition: To be implemented

Routes

GameController@index

Returns a view for creating a new game or selecting / deleting an existing game.

  • Parameters: none
  • Associated Route: GET /games

GameController@store

Sends a request to the server to create a new game. Redirects the user to the new game's configuration screen.

  • Parameters: none
  • Associated Route: POST /games

GameController@destroy

Sends a request to the server to remove a game (game specified by id). Redirects the user back to the index page.

  • Parameters: $game: Game
  • Associated Route: DELETE /games/{game}

GameController@show

Returns the configuration screen for a game (game specified by id). If a game has already started, this route will redirect the user to the game's in-game configuration page instead.

  • Parameters: $game: Game
  • Associated Route: GET /games/{game}

InviteKeyController@generateKeys

Sends a request to the server to generate invite keys for a game. This route is not to be called manually, and is instead designed to be called via AJAX.

  • Parameters: $request: GenerateKeysRequest, $game: Game
  • Associated Route: POST /games/{game}/invite-keys

GameController@storeMarkers

Sends a request to the server to store specified border markers. This route is not to be called manually, and is instead designed to be called via AJAX.

  • Parameters: $request: StoreBorderMarkerRequest, $game: Game
  • Associated Route: POST /games/{game}/border-markers

GameController@update

Sends a request to the server to update a game's status (game specified by id).

  • Parameters: $request: UpdateGameStateRequest, $game: Game
  • Associated Route: PUT /games/{game}

Clone this wiki locally