Documentation ¶
Overview ¶
Package tournaments provides the JSON handlers to handle tournaments data in gonawin app.
Index ¶
- func ActivatePhase(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func AddAdmin(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func BlockMatchPrediction(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func Calendar(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func CalendarWithPrediction(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func CandidateTeams(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func Destroy(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func GetChampionsLeague(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func GetCopaAmerica(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func GetEuro(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func GetWorldCup(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func Groups(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func Index(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func Join(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func JoinAsTeam(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func LeaveAsTeam(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func Matches(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func New(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func NewChampionsLeague(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func NewCopaAmerica(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func NewEuro(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func NewWorldCup(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func Participants(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func Predict(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func Ranking(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func RemoveAdmin(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func Reset(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func Search(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func Show(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func SimulateMatches(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func Teams(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func Update(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func UpdateMatchResult(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func UpdateTeam(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- type ByDate
- type DayJSON
- type DayWithPredictionJSON
- type GroupJSON
- type MatchJSON
- type MatchWithPredictionJSON
- type PhaseJSON
- type TeamJSON
- type TournamentData
- type UserPredictionJSON
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActivatePhase ¶
ActivatePhase handler let you activate phase of tournament.
Use this handler to activate all the matches of given phase in tournament.
GET /j/tournaments/[0-9]+/admin/activatephase/
func BlockMatchPrediction ¶
BlockMatchPrediction is the handler allowing to block the prediction for match of tournament.
func Calendar ¶
Calendar handler gets you the calendar data of a specific tournament. Use this handler to get the calendar of a tournament. The calendar structure is an array of the tournament matches with the following information: * the location * the teams involved * the date by default the data returned is grouped by days.This means we will return an array of days, each of which can have an array of matches. You can also specify the 'groupby' parameter to be 'day' or 'phase' in which case you would have an array of phases, each of which would have an array of days who would have an array of matches.
func CalendarWithPrediction ¶
CalendarWithPrediction handler give you a JSON tournament calendar with the user predictions. Use this handler to get the calendar of a tournament with the predictions of the players in a specific team. The calendar structure is an array of the tournament matches with the following information: * the location * the teams involved * the date by default the data returned is grouped by days.This means we will return an array of days, each of which can have an array of matches. the 'groupby' parameter does not support 'phases' yet.
func CandidateTeams ¶
CandidateTeams handler, use it to get the list of teams that you can add to a tournament.
func GetChampionsLeague ¶
GetChampionsLeague returns the json data of the champions league tournament.
func GetCopaAmerica ¶
GetCopaAmerica returns the json data of the current Copa America tournament.
func GetWorldCup ¶
GetWorldCup is the get world cup tournament handler.
func Groups ¶
Groups handelr sends the JSON tournament groups data. use this handler to get groups of a tournament.
func Join ¶
Join handler let the user join a tournament.
POST /j/tournaments/join/:tournamentId let a user join a tournament.
func JoinAsTeam ¶
JoinAsTeam makes all members of a team join the tournament.
POST j/tournaments/joinasteam/:tournamentId/:teamId let a team join a tournament.
func LeaveAsTeam ¶
LeaveAsTeam makes the team leave the tournament.
func Matches ¶
Matches is the handler allowing to get the matches of a tournament. use the filter parameter to specify the matches you want: if filter is equal to 'first' you wil get matches of the first phase of the tournament. if filter is equal to 'second' you will get the matches of the second phase of the tournament.
func NewChampionsLeague ¶
NewChampionsLeague creates a champions league tournament.
func NewCopaAmerica ¶
NewCopaAmerica creates a the current copa america tournament.
func NewWorldCup ¶
NewWorldCup is the new world cup tournament handler.
func Participants ¶
Participants handler, use it to get the participants to a tournament. use this handler to get participants of a tournament.
func Ranking ¶
Ranking is the Tournament ranking handler: Use this handler to get the ranking of a tournament. The ranking is an array of users (members) or teams, You can specify the rankby parameter to be "users" or "teams".
GET /j/tournament/[0-9]+/ranking/
The response is an array of users.
func RemoveAdmin ¶
RemoveAdmin handler lets you remove an admin from a tournament.
Use this handler to remove a user as admin of the current tournament.
GET /j/tournaments/[0-9]+/admin/remove/
func SimulateMatches ¶
SimulateMatches simulates the scores of a phase in a tournament.
POST /j/tournaments/[0-9]+/matches/simulate?phase=:phaseName
func Teams ¶
Teams is the Tournament teams handler: Use this handler to get the teams of a tournament. Returns an array of teams, You can specify the groupby parameter to be "phase".
GET /j/tournament/[0-9]+/teams/
The response is an array of teams group by phase.
func UpdateMatchResult ¶
UpdateMatchResult is the handler allowing to update match of tournament with results information. from parameter 'result' with format 'result1 result2' the match information is updated accordingly.
func UpdateTeam ¶
UpdateTeam is the Update team handler. replaces a team for the second phase of the tournament.
Types ¶
type ByDate ¶
type ByDate []DayJSON
ByDate type implements the sort.Interface for []DayJSON based on the date field.
type DayJSON ¶
DayJSON is a variable to hold a date and match field. We use it to group tournament matches information by days.
type DayWithPredictionJSON ¶
type DayWithPredictionJSON struct { Date time.Time Matches []MatchWithPredictionJSON }
DayWithPredictionJSON is a variable to hold a date and match with prediction.
type GroupJSON ¶
A GroupJSON is a variable to hold a the name of a group and an array of Teams. We use it to group tournament teams information by group to meet world cup organization.
type MatchJSON ¶
type MatchJSON struct { Id int64 `json:"Id"` IdNumber int64 `json:"IdNumber"` Date time.Time Team1 string Team2 string Iso1 string Iso2 string Location string Result1 int64 Result2 int64 HasPredict bool Predict string Finished bool Ready bool CanPredict bool }
MatchJSON is a variable to hold of match information.
type MatchWithPredictionJSON ¶
type MatchWithPredictionJSON struct { Match MatchJSON Participants []UserPredictionJSON }
MatchWithPredictionJSON is a variable to hold a match and an array of participants who put a predict on the match.
type PhaseJSON ¶
PhaseJSON is a variable to hold a the name of a phase and an array of days. We use it to group tournament matches information by phases.
type TeamJSON ¶
A TeamJSON is a variable to hold the basic information of a Team: The name of the team, the number of points recorded in the group phase, the goals for and against.
type TournamentData ¶
TournamentData holds the name and the description of a tournament.