Documentation ¶
Index ¶
- Constants
- type APIResponse
- type Client
- type Match
- type MatchItem
- type Participant
- type ParticipantItem
- type Tournament
- func (t *Tournament) AddParticipant(name string, misc string) (*Participant, error)
- func (t *Tournament) GetMatch(id int) *Match
- func (t *Tournament) GetMatches() []*Match
- func (t *Tournament) GetOpenMatchForParticipant(p *Participant) *Match
- func (t *Tournament) GetOpenMatches() []*Match
- func (t *Tournament) GetParticipant(id int) *Participant
- func (t *Tournament) GetParticipantByMisc(misc string) *Participant
- func (t *Tournament) GetParticipantByName(name string) *Participant
- func (t *Tournament) GetUrl() string
- func (t *Tournament) IsCompleted() bool
- func (t *Tournament) RemoveParticipant(name string) error
- func (t *Tournament) RemoveParticipantById(id int) error
- func (t *Tournament) Start() error
- func (t *Tournament) SubmitMatch(m *Match) (*Match, error)
- func (t *Tournament) UnmarshalJSON(b []byte) (err error)
- func (t *Tournament) Update() *TournamentRequest
- type TournamentItem
- type TournamentRequest
Constants ¶
View Source
const ( API_VERSION = "v1" STATE_OPEN = "open" STATE_ALL = "all" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIResponse ¶
type APIResponse struct { Tournament *Tournament `json:"tournament"` Participant *Participant `json:"participant"` Match Match `json:"match"` Errors []string `json:"errors"` }
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CreateTournament ¶
func (c *Client) CreateTournament(name string, subUrl string, domain string, open bool, tType string) (*Tournament, error)
* creates a new tournament
func (*Client) NewTournamentRequest ¶
func (c *Client) NewTournamentRequest(id string) *TournamentRequest
type Match ¶
type Match struct { Id int `json:"id"` Identifier string `json:"identifier"` State string `json:"state"` PlayerOneId int `json:"player1_id"` PlayerTwoId int `json:"player2_id"` PlayerOneScore int PlayerTwoScore int UpdatedAt *time.Time `json:"updated_at,omitempty"` WinnerId int `json:"winner_id"` PlayerOne *Participant PlayerTwo *Participant Winner *Participant Scores string `json:"scores_csv"` }
func DiffMatches ¶
func (*Match) ResolveParticipants ¶
func (m *Match) ResolveParticipants(t *Tournament)
type Participant ¶
type Participant struct { Id int `json:"id"` Name string `json:"display_name"` Misc string `json:"misc"` Seed int `json:"seed"` Wins int Losses int TotalScore int }
func (*Participant) Lose ¶
func (p *Participant) Lose()
func (*Participant) Win ¶
func (p *Participant) Win()
type ParticipantItem ¶
type ParticipantItem struct {
Participant Participant `json:"participant"`
}
type Tournament ¶
type Tournament struct { Name string `json:"name"` Id int `json:"id"` Url string `json:"url"` FullUrl string `json:"full_challonge_url"` State string `json:"state"` SubDomain string `json:"subdomain"` ParticipantsCount int `json:"participants_count"` StartedAt *time.Time `json:"started_at,mitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` Type string `json:"tournament_type"` Description string `json:"description"` GameName string `json:"game_name"` Progress int `json:"progress_meter"` SubUrl string `json:"sub_url"` ParticipantItems []*ParticipantItem `json:"participants,omitempty"` MatchItems []*MatchItem `json:"matches,omitempty"` Participants []*Participant `json:"resolved_participants"` Matches []*Match `json:"resolved_matches"` }
func (*Tournament) AddParticipant ¶
func (t *Tournament) AddParticipant(name string, misc string) (*Participant, error)
* adds participant to tournament
func (*Tournament) GetMatch ¶
func (t *Tournament) GetMatch(id int) *Match
* returns match with resolved participants
func (*Tournament) GetMatches ¶
func (t *Tournament) GetMatches() []*Match
* returns all matches for tournament
func (*Tournament) GetOpenMatchForParticipant ¶
func (t *Tournament) GetOpenMatchForParticipant(p *Participant) *Match
func (*Tournament) GetOpenMatches ¶
func (t *Tournament) GetOpenMatches() []*Match
* returns all open matches
func (*Tournament) GetParticipant ¶
func (t *Tournament) GetParticipant(id int) *Participant
func (*Tournament) GetParticipantByMisc ¶
func (t *Tournament) GetParticipantByMisc(misc string) *Participant
func (*Tournament) GetParticipantByName ¶
func (t *Tournament) GetParticipantByName(name string) *Participant
func (*Tournament) IsCompleted ¶
func (t *Tournament) IsCompleted() bool
func (*Tournament) RemoveParticipant ¶
func (t *Tournament) RemoveParticipant(name string) error
* removes participant from tournament
func (*Tournament) RemoveParticipantById ¶
func (t *Tournament) RemoveParticipantById(id int) error
* removes participant by id
func (*Tournament) Start ¶
func (t *Tournament) Start() error
func (*Tournament) SubmitMatch ¶
func (t *Tournament) SubmitMatch(m *Match) (*Match, error)
func (*Tournament) UnmarshalJSON ¶
func (t *Tournament) UnmarshalJSON(b []byte) (err error)
func (*Tournament) Update ¶
func (t *Tournament) Update() *TournamentRequest
type TournamentItem ¶
type TournamentItem struct {
Tournament Tournament `json:"tournament"`
}
* items to flatten json structure
type TournamentRequest ¶
type TournamentRequest struct { Id string Params map[string]string // contains filtered or unexported fields }
func (*TournamentRequest) Get ¶
func (r *TournamentRequest) Get() (*Tournament, error)
func (*TournamentRequest) WithMatches ¶
func (r *TournamentRequest) WithMatches() *TournamentRequest
func (*TournamentRequest) WithParticipants ¶
func (r *TournamentRequest) WithParticipants() *TournamentRequest
Click to show internal directories.
Click to hide internal directories.