Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiGameServer ¶
type ApiGameServer struct { GameService GameService Router chi.Router }
ApiGameServer is a HTTP server that exposes the game service
func NewApiGameServer ¶
func NewApiGameServer(evbus EventBus.Bus) ApiGameServer
NewApiGameServer creates a new HTTP server that exposes the game service
func (*ApiGameServer) CreateGame ¶
func (app *ApiGameServer) CreateGame(w http.ResponseWriter, r *http.Request)
CreateGame creates a new game
func (*ApiGameServer) GetGame ¶
func (app *ApiGameServer) GetGame(w http.ResponseWriter, r *http.Request)
GetGame returns the current position of the game
func (*ApiGameServer) MakeMove ¶
func (app *ApiGameServer) MakeMove(w http.ResponseWriter, r *http.Request)
MakeMove makes a move in the game
type GameRepo ¶
type GameRepo interface { Add(Game) error Get(string) (Game, error) Remove(string) error Update(Game) error }
GameRepo is an interface for a game repository.
type GameRepoStorage ¶
func (GameRepoStorage) Add ¶
func (grs GameRepoStorage) Add(g Game) error
Add adds a game to the repository.
func (GameRepoStorage) Get ¶
func (grs GameRepoStorage) Get(id string) (Game, error)
Get returns a game from the repository.
func (GameRepoStorage) Remove ¶
func (grs GameRepoStorage) Remove(id string) error
Remove removes a game from the repository.
func (GameRepoStorage) Update ¶
func (grs GameRepoStorage) Update(g Game) error
Update updates a game in the repository.
type GameResponse ¶
type GameService ¶
GameService is a service for managing games.
func NewGameService ¶
func NewGameService(gameRepo GameRepo, evbus EventBus.Bus) GameService
NewGameService creates a new GameService.
func (GameService) CreateGame ¶
func (gs GameService) CreateGame(playerWhite string, playerBlack string) (Game, error)
CreateGame creates a new game.
type MoveRequest ¶
type MoveRequest struct {
Move string `json:"move"`
}
type MoveResponse ¶
type StartGameResponse ¶
Click to show internal directories.
Click to hide internal directories.