Class: TournamentApi
tournament.TournamentApi
Tournament wrapper class. Handles access to tournament instances.
Constructors
constructor
• new TournamentApi(client
): TournamentApi
Parameters
Name | Type |
---|---|
client |
Client |
Returns
Properties
client
• Private
client: Client
currentTournament
• currentTournament: null
| Tournament
Methods
create
▸ create(config
): Promise
<boolean
>
Create a tournament if the player is not already in a tournament
Parameters
Name | Type | Description |
---|---|---|
config |
TournamentCreateConfig |
tournament configuration |
Returns
Promise
<boolean
>
true if a tournament was successfully created
getTournaments
▸ getTournaments(): Promise
<null
| Tournament
[]>
Returns list of player’s active/historical Tournament(s)
Returns
Promise
<null
| Tournament
[]>
init
▸ init(): Promise
<boolean
>
Initialize tournaments by setting currentTournament to a Tournament instance if the game is in a tournament.
Returns
Promise
<boolean
>
true if the game has been started from a tournament, false if not
isSupported
▸ isSupported(): boolean
Are tournaments supported on current platform.
Returns
boolean
join
▸ join(tournamentID
): Promise
<boolean
>
Allows the player to join an existing tournament.
Parameters
Name | Type | Description |
---|---|---|
tournamentID |
string |
the tournament session to switch into |
Returns
Promise
<boolean
>
postScore
▸ postScore(score
): Promise
<boolean
>
Post a score into the current tournament
Parameters
Name | Type | Description |
---|---|---|
score |
number |
player’s score |
Returns
Promise
<boolean
>
share
▸ share(score
, data?
): Promise
<boolean
>
Share the current existing tournament.
Parameters
Name | Type | Description |
---|---|---|
score |
number |
player’s score |
data? |
any |
A blob of data to attach to the update. Retrievable via entrypoint |
Returns
Promise
<boolean
>