openapi

package
v0.0.0-...-ea99d12 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package openapi provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen version v1.15.0 DO NOT EDIT.

Package openapi provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen version v1.15.0 DO NOT EDIT.

Package openapi provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen version v1.15.0 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSwagger

func GetSwagger() (swagger *openapi3.T, err error)

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

func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)

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 BadRequest

type BadRequest = Error

BadRequest defines model for BadRequest.

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

type CreateGameJSONBody struct {
	Player1 string `json:"player1"`
	Player2 string `json:"player2"`
}

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 Error

type Error struct {
	Message string `json:"message"`
}

Error defines model for Error.

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. 0 => Undefined 1 => Player1Wins 2 => Player2Wins 3 => Tie
	Result Result `json:"result"`

	// Turn The turn that needs to play next. 0 => Player1 1 => Player2
	Turn Turn `json:"turn"`
}

Game defines model for Game.

type GameID

type GameID = string

GameID defines model for GameID.

type InternalServerError

type InternalServerError = Error

InternalServerError defines model for InternalServerError.

type NewGameBody

type NewGameBody struct {
	Player1 string `json:"player1"`
	Player2 string `json:"player2"`
}

NewGameBody defines model for NewGameBody.

type NewPlayBody

type NewPlayBody struct {
	PitIndex int64 `json:"pit_index"`
}

NewPlayBody defines model for NewPlayBody.

type NotFound

type NotFound = Error

NotFound defines model for NotFound.

type PlayCreated

type PlayCreated struct {
	Game           Game  `json:"game"`
	PlayedPitIndex int64 `json:"played_pit_index"`
}

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 Result

type Result int

Result The result of the game. 0 => Undefined 1 => Player1Wins 2 => Player2Wins 3 => Tie

const (
	ResultN0 Result = 0
	ResultN1 Result = 1
	ResultN2 Result = 2
	ResultN3 Result = 3
)

Defines values for Result.

type ServerInterface

type ServerInterface interface {
	// Create game
	// (POST /games)
	CreateGame(ctx echo.Context) error
	// Show game
	// (GET /games/{id})
	ShowGame(ctx echo.Context, id GameID) error
	// Perform next play
	// (POST /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) ShowGame

func (w *ServerInterfaceWrapper) ShowGame(ctx echo.Context) error

ShowGame converts echo context to params.

type Turn

type Turn int

Turn The turn that needs to play next. 0 => Player1 1 => Player2

const (
	TurnN0 Turn = 0
	TurnN1 Turn = 1
)

Defines values for Turn.

Jump to

Keyboard shortcuts

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