Move event and type docs into their own files.
This commit is contained in:
parent
ce7e35cd53
commit
2ca4eef0a6
19 changed files with 213 additions and 261 deletions
15
server/docs/events/CreateGame.md
Normal file
15
server/docs/events/CreateGame.md
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# `CreateGame`:
|
||||
|
||||
## Description:
|
||||
Triggered when a user is creating a game.
|
||||
|
||||
## Request Payload:
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| name | String | The name of the person starting the game
|
||||
|
||||
## Response Payload: (`GameCreated`)
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| id | String | The user's game ID, this should be stored to permit users to re-join the game if they get disconnected.
|
||||
| game_code | String | The game's code that other players can use to connect to the game.
|
||||
6
server/docs/events/General_Response.md
Normal file
6
server/docs/events/General_Response.md
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# Properties Of All Response Payloads
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| status | Integer | The response code of the server. This follows HTTP standards as described by [Mozilla's Documentation](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status)
|
||||
| message? | String | More information relating to the response. This is set iff `success` is a non 2XX value.
|
||||
| source? | String | The event name that caused this response to be sent. This is set iff is a non 2XX value.
|
||||
14
server/docs/events/GetPastQuestions.md
Normal file
14
server/docs/events/GetPastQuestions.md
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# `GetPastQuestions`:
|
||||
|
||||
## Description:
|
||||
This event is sent from the client to the server when it has the PastQuestions component visible.
|
||||
|
||||
## Request Payload:
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| team | Integer | The team we are requesting the questions for. This can be one of `1`, or `2`, any other value will cause an error to be returned.
|
||||
|
||||
## Response Payload: (`PastQuestions`)
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| questions | String[] | All the previously chosen questions for the team.
|
||||
16
server/docs/events/JoinGame.md
Normal file
16
server/docs/events/JoinGame.md
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
# `JoinGame`:
|
||||
|
||||
## Description:
|
||||
Triggered by the client when it attempts to connect to a game.
|
||||
|
||||
## Request Payload:
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| name | String | The user's name
|
||||
| game_code | String | The game code for the game the user is trying to join.
|
||||
| id? | String | The user's ID that was stored if they have already joined a game and not finished it.
|
||||
|
||||
## Response Payload: (`GameJoined`)
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| id | String | The user's game ID, if `id` is set in the payload, this is the same, otherwise it is a brand new ID.
|
||||
14
server/docs/events/JoinTeam.md
Normal file
14
server/docs/events/JoinTeam.md
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# `JoinTeam`:
|
||||
|
||||
## Description:
|
||||
This event is triggered by the client when the user attempts to join a team from the lobby.
|
||||
|
||||
## Request Payload:
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| team | int | The team to join. Accepted values are: `1`, and `2`, any other value will throw an error.
|
||||
| role | String | The role the player is assuming. This can be `"writer"` or `"guesser"`, any other value will throw an error.
|
||||
|
||||
## Response Payload: (`JoinTeam`)
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
12
server/docs/events/NewHand.md
Normal file
12
server/docs/events/NewHand.md
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# `NewHand`:
|
||||
|
||||
## Description:
|
||||
This is the event client sends it requests a new 7 cards for the hand.
|
||||
|
||||
## Request Payload:
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| team | Integer | The team that is requesting a new hand.
|
||||
|
||||
## Response Payload:
|
||||
This event's response comes in the form of the `UpdateHand` event with the mode set to `"replace"`
|
||||
13
server/docs/events/ObjectList.md
Normal file
13
server/docs/events/ObjectList.md
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# `ObjectList`:
|
||||
|
||||
## Description:
|
||||
This event is sent by the client when they are wanting to retrieve the list of
|
||||
objects that the spirits can pick from.
|
||||
|
||||
## Request Payload:
|
||||
No payload is read from for this event.
|
||||
|
||||
## Response Payload: (`ObjectList`)
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| objects | String[] | The objects that are on the chosen card.
|
||||
14
server/docs/events/SelectObject.md
Normal file
14
server/docs/events/SelectObject.md
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# `SelectObject`:
|
||||
|
||||
## Description:
|
||||
The event sent by the clients when they are selecting an object from the card.
|
||||
|
||||
## Request Payload:
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| object | String | The name of the object that the spirits are selecting.
|
||||
|
||||
## Response Payload: (`ChosenObject`)
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| object | String | The object that has been selected.
|
||||
17
server/docs/events/SendCard.md
Normal file
17
server/docs/events/SendCard.md
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# `SendCard`:
|
||||
|
||||
## Description:
|
||||
Sends a card to the server, the server either then either forwards the card to the spirit or the past questions pile. The action that is taken is dependant on what the `from` property is set to.
|
||||
|
||||
## Request Payload:
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| text | String | The text of the card that is being sent.
|
||||
| from | String | The source of where the card is being sent from. This can be one of `"writer"`, `"guesser"`, any other value will return an error.
|
||||
| team | Integer | The team that is sending the card. This can be either `1` or `2`, any other value will return an error.
|
||||
|
||||
## Response Payload: (`NewCards`)
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| cards | String[] | The text of the cards that was sent.
|
||||
| from | String | The source of the card(s). This will be one of `"deck"`, or `"guesser"`
|
||||
18
server/docs/events/UpdateAnswer.md
Normal file
18
server/docs/events/UpdateAnswer.md
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# `UpdateAnswer`:
|
||||
|
||||
## Description:
|
||||
This event is sent to and from the server when a spirit is typing into one of the text boxes.
|
||||
|
||||
## Request Payload:
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| team | Integer | The team indicator number. This can be either `1`, or `2`, any other value will cause this event to return an error.
|
||||
| answer | Integer | The answer that is being updated. This can be any number between `1` and `8` (inclusive), any other value will cause this event return an error.
|
||||
| value | String | The new text for the input box.
|
||||
|
||||
## Response Payload: (`UpdateAnswer`)
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| team | Integer | The team indicator number. This can be either `1`, or `2`.
|
||||
| answer | Integer | The answer that is being updated. This can be any number between `1` and `8` (inclusive).
|
||||
| value | String | The new text for the input box.
|
||||
13
server/docs/events/UpdateHand.md
Normal file
13
server/docs/events/UpdateHand.md
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# `UpdateHand`:
|
||||
|
||||
## Description:
|
||||
Tells the client to update their hand, using one of the provided modes.
|
||||
|
||||
## Request Payload:
|
||||
This event is never sent to the server
|
||||
|
||||
## Response Payload:
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| questions | String[] | The cards that the operation for the hand will use.
|
||||
| mode | String | This is one of `"append"` or `"replace"`
|
||||
12
server/docs/events/UpdatePlayer.md
Normal file
12
server/docs/events/UpdatePlayer.md
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# `UpdatePlayer`:
|
||||
|
||||
## Description:
|
||||
This event is sent from the server and is a result of a player joining/changing team, this event is also fired when a new player joins the game.
|
||||
|
||||
## Request Payload:
|
||||
The client cannot send this event and only receives it.
|
||||
|
||||
## Response Payload:
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
| player | Player | The player's new data.
|
||||
13
server/docs/events/_template.md
Normal file
13
server/docs/events/_template.md
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# ``:
|
||||
|
||||
## Description:
|
||||
|
||||
|
||||
## Request Payload:
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
|
||||
|
||||
## Response Payload: (``)
|
||||
| Property | Type | Description
|
||||
| -------- | ---- | -----------
|
||||
Loading…
Add table
Add a link
Reference in a new issue