0
0
Fork 0

Add data types for data payloads for the events

This commit is contained in:
Oliver-Akins 2020-12-23 12:36:56 -07:00
parent 7b2a5eeda4
commit b1c161dcb3

88
server/src/types/data.d.ts vendored Normal file
View file

@ -0,0 +1,88 @@
interface response {
status: number;
source?: String;
message?: String;
}
type team = 1 | 2;
type role = "writer" | "guesser";
type answer = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
interface CreateGame {
name: String;
}
interface GameCreated extends response {
game_code?: String;
id?: String;
}
interface GetPastQuestions {
team: team;
}
interface PastQuestions extends response {
questions?: String[];
}
interface JoinGame {
game_code: String;
name: String;
id?: String;
}
interface GameJoined extends response {
id?: String;
}
interface NewHand {
team: team;
}
interface SendCard {
text: String;
from: role;
team: team;
}
interface UpdateHand extends response{
mode?: "append" | "replace";
questions?: String[];
}
interface ObjectList {}
interface ObjectListResponse extends response {
objects?: String[];
}
interface SelectObject {
object: String;
}
interface ChosenObject extends response {
object?: String;
}
interface UpdateAnswer {
answer: answer;
value: String;
team: team;
}
interface UpdateAnswerResponse extends response {
answer: answer;
value: String;
team: team;
}
interface UpdatePlayer {
name: String;
team: team;
role: role;
}
interface UpdatePlayerResponse {
name: String;
team: team;
role: role;
}