You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(server): Use the term "match" in the API and Lobby (#704)
Closes#703
* GameMetadata -> MatchMetadata
* rooms -> matches
* API exposes `matchID`, make Lobby use that instead of `gameID` or `roomID`.
* CreateGame -> CreateMatch
* gameID, roomID -> matchID
* Document Lobby API endpoints.
* nextRoomID -> nextMatchID
* Update error messages.
* gameList -> matchList
* Use "match" wherever it makes sense in lobby code.
* Replace "room" with "match" in documentation.
* Rename 'game' to 'match' in comments and test names.
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
* doesGameRequireAuthentication -> doesMatchRequireAuthentication
* Rename gameID to matchID in database interface functions.
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
Copy file name to clipboardExpand all lines: docs/documentation/api/Lobby.md
+22-22Lines changed: 22 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,15 +21,15 @@ import { Lobby } from 'boardgame.io/react';
21
21
22
22
### Server-side API
23
23
24
-
The [Server](/api/Server) hosts the Lobby REST API that can be used to create and join rooms. It is particularly useful when you want to
24
+
The [Server](/api/Server) hosts the Lobby REST API that can be used to create and join matches. It is particularly useful when you want to
25
25
authenticate clients to prove that they have the right to send
26
26
actions on behalf of a player.
27
27
28
-
Authenticated games are created with server-side tokens for each player. You can create a room with the `create` API call, and join a player to a room with the `join` API call.
28
+
Authenticated games are created with server-side tokens for each player. You can create a match with the `create` API call, and join a player to a match with the `join` API call.
29
29
30
30
A game that is authenticated will not accept moves from a client on behalf of a player without the appropriate credential token.
31
31
32
-
Use the `create` API call to create a room that requires credential tokens. When you call the `join` API, you can retrieve the credential token for a particular player.
32
+
Use the `create` API call to create a match that requires credential tokens. When you call the `join` API, you can retrieve the credential token for a particular player.
33
33
34
34
#### Configuration
35
35
@@ -45,27 +45,27 @@ Options are:
45
45
-`apiPort`: If specified, it runs the Lobby API in a separate Koa server on this port. Otherwise, it shares the same Koa server runnning on the default boardgame.io `port`.
46
46
-`apiCallback`: Called when the Koa server is ready. Only applicable if `apiPort` is specified.
47
47
48
-
#### Creating a room
48
+
#### Creating a match
49
49
50
50
##### POST `/games/{name}/create`
51
51
52
-
Creates a new authenticated room for a game named `name`.
52
+
Creates a new authenticated match for a game named `name`.
53
53
54
54
Accepts three parameters:
55
55
56
56
`numPlayers` (required): the number of players.
57
57
58
58
`setupData` (optional): custom object that is passed to the game `setup` function.
59
59
60
-
`unlisted` (optional): if set to `true`, the room will be excluded from the public list of room instances.
60
+
`unlisted` (optional): if set to `true`, the match will be excluded from the public list of match instances.
61
61
62
-
Returns `roomID`, which is the ID of the newly created game instance.
62
+
Returns `matchID`, which is the ID of the newly created game instance.
63
63
64
64
#### Joining a game
65
65
66
66
##### POST `/games/{name}/{id}/join`
67
67
68
-
Allows a player to join a particular room instance `id` of a game named `name`.
68
+
Allows a player to join a particular match instance `id` of a game named `name`.
69
69
70
70
Accepts three JSON body parameters:
71
71
@@ -81,7 +81,7 @@ Returns `playerCredentials` which is the token this player will require to authe
81
81
82
82
##### POST `/games/{name}/{id}/update`
83
83
84
-
Rename and/or update additional information of a user in the room instance `id` of a game named `name` previously joined by the player.
84
+
Rename and/or update additional information of a user in the match instance `id` of a game named `name` previously joined by the player.
85
85
86
86
Accepts four parameters, requires at least one of the two optional parameters:
87
87
@@ -93,41 +93,41 @@ Accepts four parameters, requires at least one of the two optional parameters:
93
93
94
94
`data` (optional): additional information associated to the player.
95
95
96
-
#### Leaving a room
96
+
#### Leaving a match
97
97
98
98
##### POST `/games/{name}/{id}/leave`
99
99
100
-
Leave the room instance `id` of a game named `name` previously joined by the player.
100
+
Leave the match instance `id` of a game named `name` previously joined by the player.
101
101
102
102
Accepts two parameters, all required:
103
103
104
104
`playerID`: the ID used by the player in the game (0, 1...).
105
105
106
106
`credentials`: the authentication token of the player.
107
107
108
-
#### Listing all room instances of a given game
108
+
#### Listing all match instances of a given game
109
109
110
110
##### GET `/games/{name}`
111
111
112
-
Returns all room instances of the game named `name`.
112
+
Returns all match instances of the game named `name`.
113
113
114
-
Returns an array of `rooms`. Each instance has fields:
114
+
Returns an array of `matches`. Each instance has fields:
115
115
116
-
`roomID`: the ID of the room instance.
116
+
`matchID`: the ID of the match instance.
117
117
118
118
`players`: the list of seats and players that have joined the game, if any.
119
119
120
120
`setupData` (optional): custom object that was passed to the game `setup` function.
121
121
122
-
#### Getting specific instance of a room by its ID
122
+
#### Getting specific instance of a match by its ID
123
123
124
124
##### GET `/games/{name}/{id}`
125
125
126
-
Returns a room instance given its roomID.
126
+
Returns a match instance given its matchID.
127
127
128
-
Returns a room instance. Each instance has fields:
128
+
Returns a match instance. Each instance has fields:
129
129
130
-
`roomID`: the ID of the room instance.
130
+
`matchID`: the ID of the match instance.
131
131
132
132
`players`: the list of seats and players that have joined the game, if any.
133
133
@@ -143,14 +143,14 @@ All actions for an authenticated game require an additional payload field `crede
143
143
144
144
`{name}` (required): the name of the game being played again.
145
145
146
-
`{id}` (required): the ID of the previous finished room.
146
+
`{id}` (required): the ID of the previous finished match.
147
147
148
-
Given a previous room, generates a room ID where users should go if they want to play again. Creates this new room if it didn't exist before.
148
+
Given a previous match, generates a match ID where users should go if they want to play again. Creates this new match if it didn't exist before.
149
149
150
150
Accepts these parameters:
151
151
152
152
`playerID` (required): the player ID of the player on the previous game.
153
153
154
154
`credentials` (required): player's credentials.
155
155
156
-
Returns `nextRoomID`, which is the ID of the newly created room that the user should go to play again.
156
+
Returns `nextMatchID`, which is the ID of the newly created match that the user should go to play again.
0 commit comments