class Game { /** * @param {Client} client */ constructor(client, id) { /** * @type {Client} */ this.client = client; this.id = id; } async init() { let response = await this.client._get(`/api/games/${this.id}`); if (response.status !== 200) return response.status; let response_data = await response.json(); this.players_id = response_data.players_id; this.state = response_data.state; this.started = response_data.started; this.finished = response_data.finished; this.winner_id = this.finished ? response_data.winner_id : undefined; return 0; } } export { Game }