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");

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"
);

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);

Update a tournament’s attributes.

Deletes a tournament along with all its associated records. There is no undo, so use with care!

This should be invoked after a tournament’s check-in window closes before the tournament is started.

  1. Marks participants who have not checked in as inactive.
  2. Moves inactive participants to bottom seeds (ordered by original seed).
  3. 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.

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.

  1. Makes all participants active and clears their checked_in_at times.
  2. Transitions the tournament state from ‘checking_in’ or ‘checked_in’ to ‘pending’

Start a tournament, opening up first round matches for score reporting. The tournament must have at least 2 participants.

Finalize a tournament that has had all match scores submitted, rendering its results permanent.

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.

Add a participant to a tournament (up until it is started).

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.

Retrieve a single participant record for a tournament.

Update the attributes of a tournament participant.

Checks a participant in, setting checked_in_at to the current time.

Marks a participant as having not checked in, setting checked_in_at to nil.

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.

Retrieve a tournament’s match list.

Retrieve a single match record for a tournament.

Update/submit the score(s) for a match.

Retrieve a match’s attachments.

Retrieve a single match attachment record.

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.

Update the attributes of a match attachment.

Delete a match attachment.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.