openapi

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2023 License: MIT Imports: 9 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.9.1 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 Board

type Board struct {
	// Number of checkers in each point on the board.
	O CheckerLayout `json:"o"`

	// Number of checkers in each point on the board.
	X CheckerLayout `json:"x"`
}

Board defines model for Board.

type CheckerLayout

type CheckerLayout struct {
	N1  *int `json:"1,omitempty"`
	N10 *int `json:"10,omitempty"`
	N11 *int `json:"11,omitempty"`
	N12 *int `json:"12,omitempty"`
	N13 *int `json:"13,omitempty"`
	N14 *int `json:"14,omitempty"`
	N15 *int `json:"15,omitempty"`
	N16 *int `json:"16,omitempty"`
	N17 *int `json:"17,omitempty"`
	N18 *int `json:"18,omitempty"`
	N19 *int `json:"19,omitempty"`
	N2  *int `json:"2,omitempty"`
	N20 *int `json:"20,omitempty"`
	N21 *int `json:"21,omitempty"`
	N22 *int `json:"22,omitempty"`
	N23 *int `json:"23,omitempty"`
	N24 *int `json:"24,omitempty"`
	N3  *int `json:"3,omitempty"`
	N4  *int `json:"4,omitempty"`
	N5  *int `json:"5,omitempty"`
	N6  *int `json:"6,omitempty"`
	N7  *int `json:"7,omitempty"`
	N8  *int `json:"8,omitempty"`
	N9  *int `json:"9,omitempty"`
	Bar *int `json:"bar,omitempty"`
}

Number of checkers in each point on the board.

type CheckerPlay

type CheckerPlay struct {
	// Point where the checker is currently
	From CheckerPlayFrom `json:"from"`

	// Point where the checker will move
	To CheckerPlayTo `json:"to"`
}

Move coordinates

type CheckerPlayFrom

type CheckerPlayFrom string

Point where the checker is currently

const (
	CheckerPlayFromBar CheckerPlayFrom = "bar"

	CheckerPlayFromN1 CheckerPlayFrom = "1"

	CheckerPlayFromN10 CheckerPlayFrom = "10"

	CheckerPlayFromN11 CheckerPlayFrom = "11"

	CheckerPlayFromN12 CheckerPlayFrom = "12"

	CheckerPlayFromN13 CheckerPlayFrom = "13"

	CheckerPlayFromN14 CheckerPlayFrom = "14"

	CheckerPlayFromN15 CheckerPlayFrom = "15"

	CheckerPlayFromN16 CheckerPlayFrom = "16"

	CheckerPlayFromN17 CheckerPlayFrom = "17"

	CheckerPlayFromN18 CheckerPlayFrom = "18"

	CheckerPlayFromN19 CheckerPlayFrom = "19"

	CheckerPlayFromN2 CheckerPlayFrom = "2"

	CheckerPlayFromN20 CheckerPlayFrom = "20"

	CheckerPlayFromN21 CheckerPlayFrom = "21"

	CheckerPlayFromN22 CheckerPlayFrom = "22"

	CheckerPlayFromN23 CheckerPlayFrom = "23"

	CheckerPlayFromN24 CheckerPlayFrom = "24"

	CheckerPlayFromN3 CheckerPlayFrom = "3"

	CheckerPlayFromN4 CheckerPlayFrom = "4"

	CheckerPlayFromN5 CheckerPlayFrom = "5"

	CheckerPlayFromN6 CheckerPlayFrom = "6"

	CheckerPlayFromN7 CheckerPlayFrom = "7"

	CheckerPlayFromN8 CheckerPlayFrom = "8"

	CheckerPlayFromN9 CheckerPlayFrom = "9"
)

Defines values for CheckerPlayFrom.

type CheckerPlayTo

type CheckerPlayTo string

Point where the checker will move

const (
	CheckerPlayToN1 CheckerPlayTo = "1"

	CheckerPlayToN10 CheckerPlayTo = "10"

	CheckerPlayToN11 CheckerPlayTo = "11"

	CheckerPlayToN12 CheckerPlayTo = "12"

	CheckerPlayToN13 CheckerPlayTo = "13"

	CheckerPlayToN14 CheckerPlayTo = "14"

	CheckerPlayToN15 CheckerPlayTo = "15"

	CheckerPlayToN16 CheckerPlayTo = "16"

	CheckerPlayToN17 CheckerPlayTo = "17"

	CheckerPlayToN18 CheckerPlayTo = "18"

	CheckerPlayToN19 CheckerPlayTo = "19"

	CheckerPlayToN2 CheckerPlayTo = "2"

	CheckerPlayToN20 CheckerPlayTo = "20"

	CheckerPlayToN21 CheckerPlayTo = "21"

	CheckerPlayToN22 CheckerPlayTo = "22"

	CheckerPlayToN23 CheckerPlayTo = "23"

	CheckerPlayToN24 CheckerPlayTo = "24"

	CheckerPlayToN3 CheckerPlayTo = "3"

	CheckerPlayToN4 CheckerPlayTo = "4"

	CheckerPlayToN5 CheckerPlayTo = "5"

	CheckerPlayToN6 CheckerPlayTo = "6"

	CheckerPlayToN7 CheckerPlayTo = "7"

	CheckerPlayToN8 CheckerPlayTo = "8"

	CheckerPlayToN9 CheckerPlayTo = "9"

	CheckerPlayToOff CheckerPlayTo = "off"
)

Defines values for CheckerPlayTo.

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 EvalInfo

type EvalInfo struct {
	// Was cube decision considered?
	Cubeful bool `json:"cubeful"`

	// How many turns ahead was considered. Typically 3, but may terminate earlier if probabilty already looks certain.
	Plies int `json:"plies"`
}

Evaluation details

type Evaluation

type Evaluation struct {
	// Equity difference compared to the best move
	Diff float32 `json:"diff"`

	// Equity value of the move relative to zero (neutral)
	Eq float32 `json:"eq"`

	// Evaluation details
	Info *EvalInfo `json:"info,omitempty"`

	// Probabilty of win/lose after making this move. Values are percentage proportions of 1, i.e. 1 means 100% certainty, 0.5 means 50% etc.
	Probability *Probability `json:"probability,omitempty"`
}

Score of the move

type Move

type Move struct {
	// Score of the move
	Evaluation *Evaluation    `json:"evaluation,omitempty"`
	Play       *[]CheckerPlay `json:"play,omitempty"`
}

Backgammon move

type MoveArgs

type MoveArgs struct {
	Board Board `json:"board"`

	// Is doubling cube in use?
	Cubeful *bool `json:"cubeful,omitempty"`

	// 2-slot array of dice values been thrown
	Dice []int `json:"dice"`

	// Max number of moves to return. if not supplied means return all available moves.
	MaxMoves *int `json:"max-moves,omitempty"`

	// Player on roll
	Player MoveArgsPlayer `json:"player"`

	// Whether or not to calculate equities for each available move. Takes longer.
	ScoreMoves *bool `json:"score-moves,omitempty"`
}

MoveArgs defines model for MoveArgs.

type MoveArgsPlayer

type MoveArgsPlayer string

Player on roll

const (
	MoveArgsPlayerO MoveArgsPlayer = "o"

	MoveArgsPlayerX MoveArgsPlayer = "x"
)

Defines values for MoveArgsPlayer.

type PostGetmovesJSONBody

type PostGetmovesJSONBody MoveArgs

PostGetmovesJSONBody defines parameters for PostGetmoves.

type PostGetmovesJSONRequestBody

type PostGetmovesJSONRequestBody PostGetmovesJSONBody

PostGetmovesJSONRequestBody defines body for PostGetmoves for application/json ContentType.

type Probability

type Probability struct {
	// Probabilty of losing the game. Always `1 - win`
	Lose float32 `json:"lose"`

	// Probabilty of losing a backgammon
	LoseBG float32 `json:"loseBG"`

	// Probabilty of losing a gammon
	LoseG float32 `json:"loseG"`

	// Probabilty of winning the game
	Win float32 `json:"win"`

	// Probability of winning a backgammon
	WinBG float32 `json:"winBG"`

	// Probability of winning a gammon
	WinG float32 `json:"winG"`
}

Probabilty of win/lose after making this move. Values are percentage proportions of 1, i.e. 1 means 100% certainty, 0.5 means 50% etc.

type ServerInterface

type ServerInterface interface {
	// Get moves
	// (POST /getmoves)
	PostGetmoves(ctx echo.Context) error
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler ServerInterface
}

ServerInterfaceWrapper converts echo contexts to parameters.

func (*ServerInterfaceWrapper) PostGetmoves

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

PostGetmoves converts echo context to params.

Jump to

Keyboard shortcuts

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