Struct challonge::Challonge [−][src]
pub struct Challonge { /* fields omitted */ }
Expand description
Client for the Challonge REST API.
Implementations
Create new connection to Challonge.
Example
extern crate challonge; use self::challonge::Challonge; let c = Challonge::new("myusername", "myapikey");
pub fn tournament_index(
&self,
state: &TournamentState,
tournament_type: &TournamentType,
created_after: &Date<Local>,
created_before: &Date<Local>,
subdomain: &str
) -> Result<TournamentIndex, Error>
pub fn tournament_index(
&self,
state: &TournamentState,
tournament_type: &TournamentType,
created_after: &Date<Local>,
created_before: &Date<Local>,
subdomain: &str
) -> Result<TournamentIndex, Error>
Retrieve a set of tournaments created with your account.
Example
extern crate challonge; extern crate chrono; use self::challonge::Challonge; use self::challonge::tournament::{ TournamentState, TournamentType }; use self::chrono::*; let c = Challonge::new("myusername", "myapikey"); let index = c.tournament_index ( &TournamentState::All, &TournamentType::DoubleElimination, &Local::today(), &Local::today(), "subdomain" );
pub fn get_tournament(
&self,
id: &TournamentId,
includes: &TournamentIncludes
) -> Result<Tournament, Error>
pub fn get_tournament(
&self,
id: &TournamentId,
includes: &TournamentIncludes
) -> Result<Tournament, Error>
Retrieve a single tournament record created with your account.
Example
extern crate challonge; use challonge::Challonge; let c = Challonge::new("myusername", "myapikey"); let i = TournamentIncludes::Matches; let t = c.get_tournament(&TournamentId::Id(2669881), &i);
Create a new tournament.
Example
extern crate challonge; use challonge::Challonge; use challonge::tournament::TournamentCreate; let c = Challonge::new("myusername", "myapikey"); let tc = TournamentCreate { // explicitly define the whole structure name: "Tester".to_owned(), tournament_type: TournamentType::SingleElimination, url: "testerurl".to_owned(), subdomain: "subdomain".to_owned(), description: "Test tournament created from challonge-rs".to_owned(), open_signup: false, hold_third_place_match: false, pts_for_match_win: 0.0f64, pts_for_match_tie: 0.0f64, pts_for_game_win: 0.0f64, pts_for_game_tie: 0.0f64, pts_for_bye: 0.0f64, swiss_rounds: 0, ranked_by: RankedBy::PointsScored, rr_pts_for_match_win: 0.0f64, rr_pts_for_match_tie: 0.0f64, rr_pts_for_game_win: 0.0f64, rr_pts_for_game_tie: 0.0f64, show_rounds: false, private: false, notify_users_when_matches_open: true, notify_users_when_the_tournament_ends: true, sequential_pairings: false, signup_cap: 4, start_at: UTC::now().add(Duration::weeks(2)), check_in_duration: 60, grand_finals_modifier: None, }; let t = c.create_tournament(&tc); // or you may create `TournamentCreate` by using a builder: let mut tcb = TournamentCreate::new(); tcb.name("Test tournament") .tournament_type(TournamentType::SingleElimination) .url("TestUrl") .subdomain("subdomain") .description("TEST TOURNAMENT created by challonge-rs"); let tb = c.create_tournament(&tcb);
pub fn update_tournament(
&self,
id: &TournamentId,
tournament: &TournamentCreate
) -> Result<Tournament, Error>
pub fn update_tournament(
&self,
id: &TournamentId,
tournament: &TournamentCreate
) -> Result<Tournament, Error>
Update a tournament’s attributes.
Deletes a tournament along with all its associated records. There is no undo, so use with care!
pub fn tournament_process_checkins(
&self,
id: &TournamentId,
includes: &TournamentIncludes
) -> Result<(), Error>
pub fn tournament_process_checkins(
&self,
id: &TournamentId,
includes: &TournamentIncludes
) -> Result<(), Error>
This should be invoked after a tournament’s check-in window closes before the tournament is started.
- Marks participants who have not checked in as inactive.
- Moves inactive participants to bottom seeds (ordered by original seed).
- Transitions the tournament state from ‘checking_in’ to ‘checked_in’
NOTE: Checked in participants on the waiting list will be promoted if slots become available.
pub fn tournament_abort_checkins(
&self,
id: &TournamentId,
includes: &TournamentIncludes
) -> Result<(), Error>
pub fn tournament_abort_checkins(
&self,
id: &TournamentId,
includes: &TournamentIncludes
) -> Result<(), Error>
When your tournament is in a ‘checking_in’ or ‘checked_in’ state, there’s no way to edit the tournament’s start time (start_at) or check-in duration (check_in_duration). You must first abort check-in, then you may edit those attributes.
- Makes all participants active and clears their checked_in_at times.
- Transitions the tournament state from ‘checking_in’ or ‘checked_in’ to ‘pending’
pub fn tournament_start(
&self,
id: &TournamentId,
includes: &TournamentIncludes
) -> Result<(), Error>
pub fn tournament_start(
&self,
id: &TournamentId,
includes: &TournamentIncludes
) -> Result<(), Error>
Start a tournament, opening up first round matches for score reporting. The tournament must have at least 2 participants.
pub fn tournament_finalize(
&self,
id: &TournamentId,
includes: &TournamentIncludes
) -> Result<(), Error>
pub fn tournament_finalize(
&self,
id: &TournamentId,
includes: &TournamentIncludes
) -> Result<(), Error>
Finalize a tournament that has had all match scores submitted, rendering its results permanent.
pub fn tournament_reset(
&self,
id: &TournamentId,
includes: &TournamentIncludes
) -> Result<(), Error>
pub fn tournament_reset(
&self,
id: &TournamentId,
includes: &TournamentIncludes
) -> Result<(), Error>
Reset a tournament, clearing all of its scores and attachments. You can then add/remove/edit participants before starting the tournament again.
Retrieve a tournament’s participant list.
pub fn create_participant(
&self,
id: &TournamentId,
participant: &ParticipantCreate
) -> Result<Participant, Error>
pub fn create_participant(
&self,
id: &TournamentId,
participant: &ParticipantCreate
) -> Result<Participant, Error>
Add a participant to a tournament (up until it is started).
pub fn create_participant_bulk(
&self,
id: &TournamentId,
participants: Vec<ParticipantCreate>
) -> Result<(), Error>
pub fn create_participant_bulk(
&self,
id: &TournamentId,
participants: Vec<ParticipantCreate>
) -> Result<(), Error>
Bulk add participants to a tournament (up until it is started). If an invalid participant is detected, bulk participant creation will halt and any previously added participants (from this API request) will be rolled back.
pub fn get_participant(
&self,
id: &TournamentId,
participant_id: &ParticipantId,
include_matches: bool
) -> Result<Participant, Error>
pub fn get_participant(
&self,
id: &TournamentId,
participant_id: &ParticipantId,
include_matches: bool
) -> Result<Participant, Error>
Retrieve a single participant record for a tournament.
pub fn update_participant(
&self,
id: &TournamentId,
participant_id: &ParticipantId,
participant: &ParticipantCreate
) -> Result<(), Error>
pub fn update_participant(
&self,
id: &TournamentId,
participant_id: &ParticipantId,
participant: &ParticipantCreate
) -> Result<(), Error>
Update the attributes of a tournament participant.
pub fn check_in_participant(
&self,
id: &TournamentId,
participant_id: &ParticipantId
) -> Result<(), Error>
pub fn check_in_participant(
&self,
id: &TournamentId,
participant_id: &ParticipantId
) -> Result<(), Error>
Checks a participant in, setting checked_in_at to the current time.
pub fn undo_check_in_participant(
&self,
id: &TournamentId,
participant_id: &ParticipantId
) -> Result<(), Error>
pub fn undo_check_in_participant(
&self,
id: &TournamentId,
participant_id: &ParticipantId
) -> Result<(), Error>
Marks a participant as having not checked in, setting checked_in_at to nil.
pub fn delete_participant(
&self,
id: &TournamentId,
participant_id: &ParticipantId
) -> Result<(), Error>
pub fn delete_participant(
&self,
id: &TournamentId,
participant_id: &ParticipantId
) -> Result<(), Error>
If the tournament has not started, delete a participant, automatically filling in the abandoned seed number. If tournament is underway, mark a participant inactive, automatically forfeiting his/her remaining matches.
Randomize seeds among participants. Only applicable before a tournament has started.
pub fn match_index(
&self,
id: &TournamentId,
state: Option<MatchState>,
participant_id: Option<ParticipantId>
) -> Result<MatchIndex, Error>
pub fn match_index(
&self,
id: &TournamentId,
state: Option<MatchState>,
participant_id: Option<ParticipantId>
) -> Result<MatchIndex, Error>
Retrieve a tournament’s match list.
Retrieve a single match record for a tournament.
pub fn update_match(
&self,
id: &TournamentId,
match_id: &MatchId,
match_update: &MatchUpdate
) -> Result<Match, Error>
pub fn update_match(
&self,
id: &TournamentId,
match_id: &MatchId,
match_update: &MatchUpdate
) -> Result<Match, Error>
Update/submit the score(s) for a match.
pub fn attachments_index(
&self,
id: &TournamentId,
match_id: &MatchId
) -> Result<AttachmentIndex, Error>
pub fn attachments_index(
&self,
id: &TournamentId,
match_id: &MatchId
) -> Result<AttachmentIndex, Error>
Retrieve a match’s attachments.
pub fn get_attachment(
&self,
id: &TournamentId,
match_id: &MatchId,
attachment_id: &AttachmentId
) -> Result<Attachment, Error>
pub fn get_attachment(
&self,
id: &TournamentId,
match_id: &MatchId,
attachment_id: &AttachmentId
) -> Result<Attachment, Error>
Retrieve a single match attachment record.
pub fn create_attachment(
&self,
id: &TournamentId,
match_id: &MatchId,
attachment: &AttachmentCreate
) -> Result<Attachment, Error>
pub fn create_attachment(
&self,
id: &TournamentId,
match_id: &MatchId,
attachment: &AttachmentCreate
) -> Result<Attachment, Error>
Add a file, link, or text attachment to a match. NOTE: The associated tournament’s “accept_attachments” attribute must be true for this action to succeed.
pub fn update_attachment(
&self,
id: &TournamentId,
match_id: &MatchId,
attachment_id: &AttachmentId,
attachment: &AttachmentCreate
) -> Result<Attachment, Error>
pub fn update_attachment(
&self,
id: &TournamentId,
match_id: &MatchId,
attachment_id: &AttachmentId,
attachment: &AttachmentCreate
) -> Result<Attachment, Error>
Update the attributes of a match attachment.
pub fn delete_attachment(
&self,
id: &TournamentId,
match_id: &MatchId,
attachment_id: &AttachmentId
) -> Result<(), Error>
pub fn delete_attachment(
&self,
id: &TournamentId,
match_id: &MatchId,
attachment_id: &AttachmentId
) -> Result<(), Error>
Delete a match attachment.