Documentation
¶
Overview ¶
API for existing games.
API for session management.
Helper functions for API communication and game setup.
Structs for API communication are defined here.
Index ¶
- func DeleteSessions(w http.ResponseWriter, r *http.Request)
- func GetGame(w http.ResponseWriter, r *http.Request)
- func GetSessions(w http.ResponseWriter, r *http.Request)
- func PostSessions(w http.ResponseWriter, r *http.Request)
- func PutGame(w http.ResponseWriter, r *http.Request)
- func PutSessions(w http.ResponseWriter, r *http.Request)
- func UpdateTurn(w http.ResponseWriter, r *http.Request)
- type GameNameAndID
- type ReqDeleteSessions
- type ReqGetGame
- type ReqPostSessions
- type ReqPutGame
- type ReqPutSessions
- type RespGetSessions
- type RespPostSessions
- type RespPutSessions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteSessions ¶
func DeleteSessions(w http.ResponseWriter, r *http.Request)
Deletes an ongoing game
func GetSessions ¶
func GetSessions(w http.ResponseWriter, r *http.Request)
Displays all existing games
func UpdateTurn ¶
func UpdateTurn(w http.ResponseWriter, r *http.Request)
Endpoint to update the player turn for testing purposes
Types ¶
type GameNameAndID ¶
type ReqDeleteSessions ¶
Delete an ongoing game
type ReqGetGame ¶
type ReqGetGame struct {
Moveidx int32 `schema:"moveidx"`
BoardID int32 `schema:"boardid"`
Password string `schema:"password"`
Color string `schema:"color"`
Token string `schema:"token"`
Statereq bool `schema:"statereq"`
Turnreq bool `schema:"turnreq"`
}
Get game data
type ReqPutGame ¶
type ReqPutGame struct {
BoardID int32 `json:"boardid"`
Password string `json:"password"`
Color string `json:"color"`
Token string `json:"token"`
Move string `json:"move,omitempty"`
Forfeit bool `json:"forfeit,omitempty"`
}
Apply move
type ReqPutSessions ¶
type ReqPutSessions struct {
BoardID int32 `json:"boardid"`
Password string `json:"password"`
Color string `json:"color"`
}
Entry a game
type RespGetSessions ¶
type RespGetSessions struct {
Games []GameNameAndID `json:"games"`
}
Get all sessions
type RespPostSessions ¶
type RespPutSessions ¶
type RespPutSessions struct {
Token string `json:"token"`
}
Click to show internal directories.
Click to hide internal directories.