Documentation
¶
Overview ¶
Package teams provides the JSON handlers to handle teams data in gonawin app.
It provides the following methods
GET /j/teams/ Retrieves all teams. POST /j/teams/new/ Creates a new team. GET /j/teams/show/[0-9]+/ Retrieves the team with the given id. POST /j/teams/update/[0-9]+/ Updates the team with the given id. POST /j/teams/destroy/[0-9]+/ Destroys the team with the given id. POST /j/teams/allow/[0-9]+/ Allow a user to be a member of a team with the given id. POST /j/teams/deny/[0-9]+/ Deny entrance of user to be a member of a team with the given id. POST /j/teams/join/[0-9]+/ Make a user join a team with the given id. GET /j/teams/search/ Search for all teams respecting the query "q" GET /j/teams/[0-9]+/members/ Retrieves all members of a team with the given id. GET /j/teams/[0-9]+/ranking/ Retrieves the ranking of a team with the given id. GET /j/teams/[0-9]+/accuracies/ Retrieves all the tournament accuracies of a team with the given id. GET /j/teams/[0-9]+/accuracies/[0-9]+/ Retrieves accuracies of a team with the given id for the specified tournament.
Every method below gives more information about every API call, its parameters, and its resutls.
Index ¶
- func Accuracies(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func AccuracyByTournament(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func AddAdmin(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func AllowRequest(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func DenyRequest(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func Destroy(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func Index(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func Invited(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func Join(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func Leave(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func Members(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func New(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func PriceByTournament(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func Prices(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 RequestInvite(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func Search(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func SendInvite(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func Show(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func Update(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- func UpdatePrice(w http.ResponseWriter, r *http.Request, u *mdl.User) error
- type PriceData
- type TeamData
- type TeamJoinViewModel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Accuracies ¶
Accuracies handler, use it to get the accuracies of a team.
GET /j/teams/:teamId/accuracies retrieves all the tournament accuracies of a team with the given id.
The response is an array of accurracies for the specified team group by tournament with the last 5 progressions.
func AccuracyByTournament ¶
AccuracyByTournament handler, use it to get the team accuracies by tournament:
GET /j/teams/:teamId/accuracies/:tournamentId retrieves accuracies of a team with the given id for the specified tournament.
The response is an array of accurracies for the specified team team group by tournament with all it's progressions.
func AddAdmin ¶
AddAdmin handler, use it to add an admin to a team.
GET /j/teams/:teamId/admin/add/:userId
func AllowRequest ¶
AllowRequest handler, use it to allow a user to join a team.
GET /j/teams/allow/[0-9]+/ Allow a request send by a user on a team.
After this, the user that send the request will be part of the team. Response: a JSON formatted status message.
func DenyRequest ¶
DenyRequest handler, use it to not allow a user to join a team.
GET /j/teams/deny/[0-9]+/ Deny a request send by a user on a team.
After this, the user will not be able to be part of the team. Response: a JSON formatted status message.
func Destroy ¶
Destroy handler, use to to destroy a team.
POST /j/teams/destroy/[0-9]+/ Destroys the team with the given id.
Response: JSON formatted message.
func Index ¶
Index handler, use it to get the team data.
GET /j/teams/? List users not joined by user.
Parameters:
'page' a int indicating the page number. 'count' a int indicating the number of teams per page number. default value is 25
Response: array of JSON formatted teams.
func Invited ¶
Invited handler, use it to get all the users who were invited to a team.
GET /j/teams/invited/[0-9]+/ Get list of users invited to a given team id.
Response: array of JSON formatted users.
func Join ¶
Join handler, use it to subscribe a user to a team. New user activity will be published
POST /j/teams/join/[0-9]+/ Make a user join a team with the given id.
Response: a JSON formatted team.
func Leave ¶
Leave handler, use it to make a user leave a team. Use this handler to leave a team.
POST /j/teams/leave/[0-9]+/? Make a user leave a team with the given id.
func Members ¶
Members handler, use it to get all members of a team.
/j/teams/[0-9]+/members/ GET use this handler to get members of a team.
Response: array of JSON formatted users.
func New ¶
New handler, use it to create a new team.
POST /j/teams/new/ Creates a new team.
Response: JSON formatted team.
func PriceByTournament ¶
PriceByTournament handler, use it to get the price of a team for a specific tournament.
GET /j/teams/[0-9]+/prices/[0-9]+/ Retrieves price of a team with the given id for the specified tournament.
Response: JSON formatted price.
func Prices ¶
Prices handler, use it to get the team's prices.
GET /j/teams/[0-9]+/prices/ Get the prices of a team team with the given team id.
Response: array of JSON formatted prices.
func Ranking ¶
Ranking handler, use it to retrieve the team ranking. Use this handler to get the ranking of a team. The ranking is an array of users (members of the team),
GET /j/teams/[0-9]+/ranking/
func RemoveAdmin ¶
RemoveAdmin handler, use it to remove an admin from a team.
Use this handler to remove a user as admin of the current team.
GET /j/teams/:teamId/admin/remove/:userId
func RequestInvite ¶
RequestInvite handler, use it to request an invitation to a team.
POST /j/teams/requestinvite/[0-9]+/ Request an invitation to a private team with the given id.
Response: a JSON formatted status message.
func Search ¶
Search handler returns the result of a team search in a JSON format. It uses parameter 'q' to make the query.
GET /j/teams/search/ Search for all teams respecting the query "q"
func SendInvite ¶
SendInvite handler, use it to send an invitation to gonawin.
POST /j/teams/sendinvite/[0-9]+/ Send an invitation to a user with the given team id and user id.
An activity is published when the invitation is sent. Response: a JSON formatted status message.
func Show ¶
Show handler, use it to get the team data to show.
GET /j/teams/show/[0-9]+/ Retrieves the team with the given id.
Response: JSON formatted team.
func Update ¶
Update handler, use it to update a team from a given id.
POST /j/teams/update/[0-9]+/ Updates the team with the given id.
Response: JSON formatted team.
func UpdatePrice ¶
UpdatePrice handler, use it to update the price of a team for a specific tournament.
POST /j/teams/[0-9]+/prices/update/[0-9]+/ Updates price of a team with the given id for the specified tournament.
Response: JSON formatted price.
Types ¶
type PriceData ¶
type PriceData struct {
Description string
}
PriceData holds basic information of a Price entity.
type TeamJoinViewModel ¶
TeamJoinViewModel is the view model for Team Join handler.