Skip to content

API Refactoring - v2.0#632

Open
ppaquette wants to merge 1 commit intokestasjk:masterfrom
ppaquette:feature/api-v2
Open

API Refactoring - v2.0#632
ppaquette wants to merge 1 commit intokestasjk:masterfrom
ppaquette:feature/api-v2

Conversation

@ppaquette
Copy link
Copy Markdown
Contributor

@kestasjk @jmo1121109

For your comments.

This is a more substantial API refactoring that fixes most of the current issues.

We should probably wait a couple of weeks before merging this, to make sure everything works properly first. I wanted to do it while I still had the API specification clear in my mind.

The corresponding python PR is at here PR 96.

  1. Allows CD Bot Ordering
  • Added a dropdown on the create game page that allows bots to submit orders when someone is in civil disorder
  • Added an admin menu to toggle this setting
  • Added a short description that will appear on every game that shows whether the setting is on/off
  • If the bot submits an order for someone in CD, a gamemaster message is logged in the global chatbox

A game needs to meet all the following conditions to be eligible for CD ordering:

  • It must have the property 'allowBotCDOrdering' == 'Yes'
  • It must be active (i.e. not pre-game or finished)
  • It must have a member with 'Left' status
  • It must not be part of a tournamenet
  • It must have the missingPlayerPolicy set to 'Normal'
  • It must be on a variantID that is in $apiConfig['variantIDs']
  • It must be 'NoPress' or the $apiConfig['noPressOnly'] must be set to false
  • It must be on valid gameID if $apiConfig['restrictToGameIDs'] is set
  1. Specification upgraded to support press games
  • Added routes so the bot can play full press games
  • The bot can read its own messages, and send messages to other players
  • The bot can vote on Draw, Pause, Cancel, Concede
  • The bot can toggle the ready flag as necessary
  • The bot can query games having new messages after a certain timestamp
  1. Implemented fine-grained permission level
  • Completely rewritten the API permission level
  • Now only one permission per API key (canReplaceUsersInCD)
  • Every route has a validateRoute method to check for permissions

Building a mobile app should also be much easier with this API, since most of the core functionalities are supported (except create_game, find_games, join_game).

- Added API key permission 'canReplaceUsersInCD'
- Added game property 'allowBotCDOrdering' that can be configured on the create game page
- Added route 'game/message' to send game messages
- Added route 'game/ready' to change the wait/ready flag
- Added route 'game/vote' to vote on draw, pause, cancel, concede
- Added route 'players/my_games' to filter games based on criteria

- Refactored the API permission on a more granular level
- Improved the logic for allowing bots to submit orders for users in civil disorder
@jmo1121109
Copy link
Copy Markdown
Contributor

Oh wow, didn't realize a press version was near. It'll take me some time to look through all this. So your suggestion of a couple weeks is good timing wise lol.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants