game

package
v0.0.0-...-4880841 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package game implements the tictoctoe handler functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GameInfo

type GameInfo struct {
	Info GameOper
	// contains filtered or unexported fields
}

GameInfo contains db and handler functions interface

func New

func New() *GameInfo

New create a new instance of tictoctoe games backend

func (*GameInfo) CreateGame

func (g *GameInfo) CreateGame(game *models.Game, reqURL *url.URL) middleware.Responder

CreateGame is called on POST request from HTTP client. It create a new game and stores it into db.

func (*GameInfo) DeleteGame

func (g *GameInfo) DeleteGame(ID strfmt.UUID) middleware.Responder

DeleteGame is called on '/api/v1/games/{game_id}:' DELETE request. It deletes a requested game from db.

func (*GameInfo) GetAllGames

func (g *GameInfo) GetAllGames() middleware.Responder

GetAllGames is called on '/api/v1/games/' GET request. Successful response, returns an array of games, returns an empty array if no users found.

func (*GameInfo) GetGameDetails

func (g *GameInfo) GetGameDetails(ID strfmt.UUID) middleware.Responder

GetGameDetails is called on '/api/v1/games/{game_id}:' GET request. it returns a requested game ID details.

func (*GameInfo) PlayGame

func (g *GameInfo) PlayGame(gameID strfmt.UUID, game *models.Game) middleware.Responder

PlayGame is called on '/api/v1/games/{game_id}:' PUT request. It receives a game input from user. Make a move and returns game output in response body to user.

type GameOper

type GameOper interface {
	GetAllGames() middleware.Responder
	GetGameDetails(strfmt.UUID) middleware.Responder
	DeleteGame(strfmt.UUID) middleware.Responder
	CreateGame(models.Game, *url.URL) middleware.Responder
	PlayGame(strfmt.UUID, models.Game) middleware.Responder
}

GameOper implements interface for all handler functions

Jump to

Keyboard shortcuts

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