diff --git a/common/enums/Status.ts b/common/enums/Status.ts new file mode 100644 index 0000000..81df131 --- /dev/null +++ b/common/enums/Status.ts @@ -0,0 +1,7 @@ +export const Status = { + Success: 200, + UnknownError: 400, + OutOfDate: 401, + NotFound: 404, + Teapot: 418, +} \ No newline at end of file diff --git a/common/types/Colour.ts b/common/types/Colour.ts new file mode 100644 index 0000000..1820756 --- /dev/null +++ b/common/types/Colour.ts @@ -0,0 +1,4 @@ +interface Colour { + name: string; + hex: string; +} \ No newline at end of file diff --git a/common/types/ServerResponse.ts b/common/types/ServerResponse.ts new file mode 100644 index 0000000..235d2bd --- /dev/null +++ b/common/types/ServerResponse.ts @@ -0,0 +1,8 @@ +interface ServerResponse { + + /** The state indicator for responses from the server */ + status: number; + + /** Additional information that is provided by the server */ + message?: string; +} \ No newline at end of file diff --git a/common/types/events/SaveShip.ts b/common/types/events/SaveShip.ts new file mode 100644 index 0000000..2841946 --- /dev/null +++ b/common/types/events/SaveShip.ts @@ -0,0 +1,18 @@ +/** The data the client must provide in the `SaveShip` event. */ +interface SaveShip { + colour: string; + ship: string; +} + +/** + * The event that get's sent out to all the other players on a successful + * `SaveShip` event + */ +interface DesignUpdate { + player: string; + ship: string; + colour: string; +} + +/** The response to the client that triggered the `SaveShip` event. */ +interface SaveShipResponse extends ServerResponse {} \ No newline at end of file