Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrBadRequest = GameError{StatusCode: http.StatusBadRequest, Type: "api_error", Message: "Cannot process current request"} ErrUserNotFound = GameError{StatusCode: http.StatusBadRequest, Type: "user_not_found", Message: "Cannot find the given username"} ErrInvalidJSON = GameError{StatusCode: http.StatusBadRequest, Type: "invalid_json", Message: "Invalid or malformed JSON"} // decide between conflict and bad request ErrAlreadyExists = GameError{StatusCode: http.StatusConflict, Type: "duplicate_entry", Message: "Another entity has the same value as this field"} ErrWrongClick = GameError{StatusCode: http.StatusBadRequest, Type: "click_not_allowed", Message: "May be a cell clicked twice or an invalid click type"} )
Functions ¶
Types ¶
type GameError ¶
type LostResponse ¶
type ResponseAPI ¶
type ResponseAPI struct { Success bool `json:"success"` Status int `json:"status,omitempty"` Result interface{} `json:"result,omitempty"` }
func LostGame ¶
func LostGame(clicks int, username string) *ResponseAPI
func Success ¶
func Success(result interface{}, status int) *ResponseAPI
func (*ResponseAPI) Send ¶
func (r *ResponseAPI) Send(w http.ResponseWriter)
Click to show internal directories.
Click to hide internal directories.