This repository has been archived by the owner on Aug 12, 2021. It is now read-only.
v1.0.0-beta.2
Pre-release
Pre-release
Beta 2 is out !
New creation/update system
Now, when you want to create or update a tournament/participant/match, you will have to use the helper class (TournamentBuilder
, ParticipantBuilder
and MatchBuilder
). This way, you will only be able to set the properties supported by the api. This will ensure more consistent and predictable results. However, if you were using the previous version, you might need to re-write some code.
Below are a few examples on how the new system works compared to the old one.
Creating a tournament
To create a tournament, you now use the TournamentBuilder
class:
- Before:
Tournament tournament = new Tournament { Name = "MyTournament" }; // client is a ChallongeClient, which you can find in the Challonge namespace await client.Tournaments.CreateTournamentAsync(tournament);
- After:
TournamentBuilder builder = new TournamentBuilder { Name = "MyTournament" }; await client.Tournaments.CreateTournamentAsync(builder);
As you can see, the new system is just like the old one, except you don't have access to all of the tournament's properties.
Updating a tournament
There was no easy way to update a tournament before, so here is how you can do it now:
// First, we get the tournament we want to update
Tournament tournament = await client.Tournaments.GetTournamentAsync("old_url");
// Then we create the builder from that tournament, which allows us to change its properties
TournamentBuilder builder = new TournamentBuilder(tournament) { Name = "Updated Name", Url = "new_url" };
// Finally, we update the tournament using the api
await client.Tournaments.UpdateTournamentAsync("old_url", builder);