# The TA Client
### This section assumes that you have followed the instalation guide in the introduction.

The table below shows all of the functions of the taClient. From this point onwards `taClient` will be defined as `let taClient = new TAClient();`.

| taClient. (function) | Purpose and functionality | Is Async |
|:--------------------:|:--------------------------|:--------:|
|addAuthorizedUser()|Add a user who as either an admin or a viewer to your TA server.|True|
|addQualifierMaps()|Add maps to a qualifier. This takes in an array of maps.|True|
|addServer()|Add a CoreServer. You will probably never use this.|True|
|addTournamentPool()|Add a map pool to a tournament. This is the way a map pool can be created.|True|
|addTournamentPoolMaps()|Add maps to an already existing map pool.|True|
|addTournamentTeam()|Add a team to a tournament. This will create a new team|True|
|addUserToMatch()|Add a user to a match. This is how a coordinator joins a match.|True|
|connect()|Connect to a TournamentAssistant Core Server. This is the main server, not the tournament.|True|
|createMatch()|Create a match.|True|
|createQualifierEvent()|Create a qualifier. This will only be shows to players if the show qualifiers button is enabled.|True|
|createTournament()|Create a new tournament. You will have to provide the unit8 array for the image.|True|
|delayTestFinished()|**STREAMSYNC MORE DOCS REQUIRED** Set the clients as ready to play on the server?|True|
|deleteMatch()|Delete a match.|True|
|deleteQualifierEvent()|Delete a qualifier event.|True|
|deleteTournament()|Delete a tournament.|True|
|disconnect()|Disconnect from the Core Server.|True|
|emit()|Emit a custom packet. This is used for new feature testing and will not be discussed|True|
|flipColors()|Flip the colours of the players in the match. This was used in JJ25, and has just been left in.|True|
|flipHands()|Flip the hands of the players. This will flip the left or right handed mode.|True|
|generateBotToken()|Generate a bot JWT. This is often used for overlays etc.|True|
|getAuthorizedUsers()|Get the authorised user array for a tournament.|True|
|getBotTokensForUser()|Get the bot tokens of a user. This does not return the JWT.|True|
|getDiscordInfo()|Get the discord information of a user.|True|
|getLeaderboard()|Get the leaderboard of a map in a qualifer.|True|
|isConnected()|Check if the taClient is connected to the Core Server.|False|
|isConnecting()|Check if the taCleint is currectly connecting to the Core Server|False|
|joinTournament()|Join a tournament as the specified user.|True|
|loadImage()|**STREAMSYNC MORE DOCS REQUIRED** Set the colour image for users in streamsync?|True|
|loadSong()|**does this load for specified users, or for a match**Load a song to the users in a match.|True|
|on()|This is the standard listener. This is how events such as real time score can be subscribed to.|True|
|once()|Same as on, except only triggered once.|True|
|playSong()|Play the currently loaded song for the specified players.|True|
|removeAuthorizedUser()|Remove an authorised user from a tournament.|True|
|removeListener()|Remove a listener which was previously subscribed to. Do this when your application terminates.|True|
|removeQualifierMap()|Remove a qualifier map from an already existing qualifier.|True|
|removeTournamentPool()|Remove a map pool from a tournament.|True|
|removeTournamentPoolMap()|Remove a map from an already existing map pool.|True|
|removeTournamentTeam()|Remove a team from a tournament.|True|
|removeUserFromMatch()|Remove a user from a match.|True|
|returnToMenu()|Return the speciied players to the menu.|False|
|revokeBotToken()|Revoke a bot token. This will revoke the access of a bot token.|True|
|sendResponse()|Send a custom response to the TA Core Server. Do not use this unless you know exactly what you are doing.|True|
|setAuthToken()|Set the authorisation token of the taClient.|True|
|setMatchLeader()|Set the leader of a match. This is usually supposed to be the coordinator of the match.|True|
|setMatchMap()|Set the map of a match. This will load the map for the players in the match.|True|
|setQualifierFlags()|**A BIT UNCLEAR ON WHAT THIS DOES** Set the settings for a qualifier.|True|
|setQualifierImage()|Set the image of a qualifier.|True|
|setQualifierInfoChannel()|Set the Discord channel where the qualifier scores can be sent by the TA bot.|True|
|setQualifierLeaderboardSort()|Set the sorting type of the qualifiers leaderboard.|True|
|setQualifierName()|Set the name of a qualifier.|True|
|setTournamentAllowUnauthorizedView()|Set whether the tournament may be viewed by people without the view permission.|True|
|setTournamentBannedMods()|Set the banned mods for a tournament.|True|
|setTournamentEnablePools()|Set whether the map pools feature is enabled.|True|
|setTournamentEnableTeams()|Set whether the teams feature is enabled.|True|
|setTournamentImage()|Set the image of the tournament.|True|
|setTournamentName()|Set the name of the tournament.|True|
|setTournamentPoolName()|Set the name of an already existing map pool in a tournament.|True|
|setTournamentScoreUpdateFrequency()|Set the score update frequency for a tournament. This is usualy 30 frames.|True|
|setTournamentShowQualifierButton()|Set whether the qualifier button is shown in the tournament menu in game.|True|
|setTournamentShowTournamentButton()|Set whether the tournament button is shown in the tournament menu in game.|True|
|setTournamentTeamImage()|Set the image of an already existing team in a tournament.|True|
|setTournamentTeamName()|Set the name of an already existing team in a tournament.|True|
|showLoadedImage()|**STREAMSYNC MORE DOCS REQUIRED** Show the loaded image that is currently used for streamsync.|True|
|showPrompt()|Show a custom prompt to the users.|True|
|stateManager|This is the state manager. Find further documentation, as it is a vital component.|True|
|updateQualifierMap()|Update the settings of an already existing qualifier map. |True|
|updateTournamentPoolMap()|Update the settings of a map already in a map pool.|True|
|updateUser()|**what does this do??? Maybe update the discord Id or what?**Update a user????|True|

These are the main functions of the taClient. It is important to note that these are mostly asyncronous and must be awaited for if you wish to use the response they provide. There is however another important part of the taClient, which is the `taClient.stateManger`. This `stateManger` also has more functions which I have also provided in a table below. The `stateManger` loads its data once it connects to the TA CoreServer.

