import { Client } from "./client.js"; class Tourmanents { /** * @param {Client} client */ constructor(client) { /** * @type {Client} */ this.client = client } async createTournament(nb_players, online) { if (online) return "offline"; let response = await this.client._post("/api/tournaments/", {numbers_of_players: nb_players}); let response_data = await response.json(); if (JSON.stringify(response_data) === JSON.stringify({'detail': 'Authentication credentials were not provided.'})) { this.client._update_logged(false); return null; } return response_data.tournament_id; } } export { Tourmanents }