Documentation
¶
Overview ¶
Package openapi provides primitives to interact with the openapi HTTP API.
Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.4.1 DO NOT EDIT.
Index ¶
- func GetSwagger() (swagger *openapi3.T, err error)
- func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)
- func RegisterHandlers(router EchoRouter, si ServerInterface)
- func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string)
- type BadRequest
- type BoardSide
- type CreateGameJSONBody
- type CreateGameJSONRequestBody
- type CreatePlayJSONBody
- type CreatePlayJSONRequestBody
- type EchoRouter
- type Error
- type Game
- type GameID
- type InternalServerError
- type NewGameBody
- type NewPlayBody
- type NotFound
- type PlayCreated
- type Player
- type Result
- type ServerInterface
- type ServerInterfaceWrapper
- func (w *ServerInterfaceWrapper) CreateGame(ctx echo.Context) error
- func (w *ServerInterfaceWrapper) CreatePlay(ctx echo.Context) error
- func (w *ServerInterfaceWrapper) RenderDocs(ctx echo.Context) error
- func (w *ServerInterfaceWrapper) RenderSwagger(ctx echo.Context) error
- func (w *ServerInterfaceWrapper) ShowGame(ctx echo.Context) error
- type Turn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSwagger ¶
GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.
func PathToRawSpec ¶
Constructs a synthetic filesystem for resolving external references when loading openapi specifications.
func RegisterHandlers ¶
func RegisterHandlers(router EchoRouter, si ServerInterface)
RegisterHandlers adds each server route to the EchoRouter.
func RegisterHandlersWithBaseURL ¶
func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string)
Registers handlers, and prepends BaseURL to the paths, so that the paths can be served under a prefix.
Types ¶
type BoardSide ¶
type BoardSide struct {
// Pits The pits of the board side
Pits []int64 `json:"pits"`
Player Player `json:"player"`
// Store The store (big pit) of the board side
Store int64 `json:"store"`
}
BoardSide A side of the board
type CreateGameJSONBody ¶
CreateGameJSONBody defines parameters for CreateGame.
type CreateGameJSONRequestBody ¶
type CreateGameJSONRequestBody CreateGameJSONBody
CreateGameJSONRequestBody defines body for CreateGame for application/json ContentType.
type CreatePlayJSONBody ¶
type CreatePlayJSONBody struct {
PitIndex int64 `json:"pit_index"`
}
CreatePlayJSONBody defines parameters for CreatePlay.
type CreatePlayJSONRequestBody ¶
type CreatePlayJSONRequestBody CreatePlayJSONBody
CreatePlayJSONRequestBody defines body for CreatePlay for application/json ContentType.
type EchoRouter ¶
type EchoRouter interface {
CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
}
This is a simple interface which specifies echo.Route addition functions which are present on both echo.Echo and echo.Group, since we want to allow using either of them for path registration
type Game ¶
type Game struct {
// BoardSide1 A side of the board
BoardSide1 BoardSide `json:"board_side1"`
// BoardSide2 A side of the board
BoardSide2 BoardSide `json:"board_side2"`
// Id The id of the game
Id string `json:"id"`
// Result The result of the game
Result Result `json:"result"`
// Turn The turn that needs to play next
Turn Turn `json:"turn"`
}
Game defines model for Game.
type InternalServerError ¶
type InternalServerError = Error
InternalServerError defines model for InternalServerError.
type NewGameBody ¶
NewGameBody defines model for NewGameBody.
type NewPlayBody ¶
type NewPlayBody struct {
PitIndex int64 `json:"pit_index"`
}
NewPlayBody defines model for NewPlayBody.
type PlayCreated ¶
PlayCreated defines model for PlayCreated.
type Player ¶
type Player struct {
// Name The name of the player
Name string `json:"name"`
// Score The score of the player
Score int64 `json:"score"`
}
Player defines model for Player.
type ServerInterface ¶
type ServerInterface interface {
// Render API docs page
// (GET /docs)
RenderDocs(ctx echo.Context) error
// Render swagger JSON
// (GET /swagger.json)
RenderSwagger(ctx echo.Context) error
// Create game
// (POST /v1/games)
CreateGame(ctx echo.Context) error
// Show game
// (GET /v1/games/{id})
ShowGame(ctx echo.Context, id GameID) error
// Perform next play
// (POST /v1/games/{id}/plays)
CreatePlay(ctx echo.Context, id GameID) error
}
ServerInterface represents all server handlers.
type ServerInterfaceWrapper ¶
type ServerInterfaceWrapper struct {
Handler ServerInterface
}
ServerInterfaceWrapper converts echo contexts to parameters.
func (*ServerInterfaceWrapper) CreateGame ¶
func (w *ServerInterfaceWrapper) CreateGame(ctx echo.Context) error
CreateGame converts echo context to params.
func (*ServerInterfaceWrapper) CreatePlay ¶
func (w *ServerInterfaceWrapper) CreatePlay(ctx echo.Context) error
CreatePlay converts echo context to params.
func (*ServerInterfaceWrapper) RenderDocs ¶
func (w *ServerInterfaceWrapper) RenderDocs(ctx echo.Context) error
RenderDocs converts echo context to params.
func (*ServerInterfaceWrapper) RenderSwagger ¶
func (w *ServerInterfaceWrapper) RenderSwagger(ctx echo.Context) error
RenderSwagger converts echo context to params.