teams

package
v0.1.31-0...-b1e5c7a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2018 License: ISC Imports: 12 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func Accuracies

func Accuracies(w http.ResponseWriter, r *http.Request, u *mdl.User) error

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

func AccuracyByTournament(w http.ResponseWriter, r *http.Request, u *mdl.User) error

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

func AddAdmin(w http.ResponseWriter, r *http.Request, u *mdl.User) error

AddAdmin handler, use it to add an admin to a team.

GET	/j/teams/:teamId/admin/add/:userId

func AllowRequest

func AllowRequest(w http.ResponseWriter, r *http.Request, u *mdl.User) error

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

func DenyRequest(w http.ResponseWriter, r *http.Request, u *mdl.User) error

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

func Destroy(w http.ResponseWriter, r *http.Request, u *mdl.User) error

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

func Index(w http.ResponseWriter, r *http.Request, u *mdl.User) error

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

func Invited(w http.ResponseWriter, r *http.Request, u *mdl.User) error

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

func Join(w http.ResponseWriter, r *http.Request, u *mdl.User) error

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

func Leave(w http.ResponseWriter, r *http.Request, u *mdl.User) error

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

func Members(w http.ResponseWriter, r *http.Request, u *mdl.User) error

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

func New(w http.ResponseWriter, r *http.Request, u *mdl.User) error

New handler, use it to create a new team.

POST	/j/teams/new/		Creates a new team.

Response: JSON formatted team.

func PriceByTournament

func PriceByTournament(w http.ResponseWriter, r *http.Request, u *mdl.User) error

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

func Prices(w http.ResponseWriter, r *http.Request, u *mdl.User) error

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

func Ranking(w http.ResponseWriter, r *http.Request, u *mdl.User) error

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

func RemoveAdmin(w http.ResponseWriter, r *http.Request, u *mdl.User) error

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

func RequestInvite(w http.ResponseWriter, r *http.Request, u *mdl.User) error

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(w http.ResponseWriter, r *http.Request, u *mdl.User) error

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

func SendInvite(w http.ResponseWriter, r *http.Request, u *mdl.User) error

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

func Show(w http.ResponseWriter, r *http.Request, u *mdl.User) error

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

func Update(w http.ResponseWriter, r *http.Request, u *mdl.User) error

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

func UpdatePrice(w http.ResponseWriter, r *http.Request, u *mdl.User) error

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 TeamData

type TeamData struct {
	Name        string
	Description string
	Visibility  string
}

TeamData holds basic information of a Team entity.

type TeamJoinViewModel

type TeamJoinViewModel struct {
	MessageInfo string `json:",omitempty"`
	Team        mdl.TeamJSON
}

TeamJoinViewModel is the view model for Team Join handler.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL