Documentation ¶
Overview ¶
Package robotapiserver provides primitives to interact with the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen version (devel) 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 EchoRouter
- type Error
- type MoveRobotJSONBody
- type MoveRobotJSONRequestBody
- type MoveRobotRequest
- type MoveRobotRequestMoveSequences
- type MoveRobotResponse
- type Robot
- type RobotId
- type ServerInterface
- type ServerInterfaceWrapper
- func (w *ServerInterfaceWrapper) CancelTask(ctx echo.Context) error
- func (w *ServerInterfaceWrapper) Dashboard(ctx echo.Context) error
- func (w *ServerInterfaceWrapper) GetAllRobots(ctx echo.Context) error
- func (w *ServerInterfaceWrapper) GetAllTasks(ctx echo.Context) error
- func (w *ServerInterfaceWrapper) GetRobot(ctx echo.Context) error
- func (w *ServerInterfaceWrapper) GetTask(ctx echo.Context) error
- func (w *ServerInterfaceWrapper) MoveRobot(ctx echo.Context) error
- func (w *ServerInterfaceWrapper) RobotsWebsocket(ctx echo.Context) error
- func (w *ServerInterfaceWrapper) TasksWebsocket(ctx echo.Context) error
- type Task
- type TaskId
- type TaskStatus
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 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 { // Error code Code int `json:"code"` // Error message Message string `json:"message"` }
Error defines model for error.
type MoveRobotJSONBody ¶
type MoveRobotJSONBody = MoveRobotRequest
MoveRobotJSONBody defines parameters for MoveRobot.
type MoveRobotJSONRequestBody ¶
type MoveRobotJSONRequestBody = MoveRobotJSONBody
MoveRobotJSONRequestBody defines body for MoveRobot for application/json ContentType.
type MoveRobotRequest ¶
type MoveRobotRequest struct {
MoveSequences []MoveRobotRequestMoveSequences `json:"moveSequences"`
}
MoveRobotRequest defines model for moveRobotRequest.
type MoveRobotRequestMoveSequences ¶
type MoveRobotRequestMoveSequences string
MoveRobotRequestMoveSequences defines model for MoveRobotRequest.MoveSequences.
const ( E MoveRobotRequestMoveSequences = "E" N MoveRobotRequestMoveSequences = "N" S MoveRobotRequestMoveSequences = "S" W MoveRobotRequestMoveSequences = "W" )
Defines values for MoveRobotRequestMoveSequences.
type MoveRobotResponse ¶
type MoveRobotResponse struct {
Task Task `json:"task"`
}
MoveRobotResponse defines model for moveRobotResponse.
type Robot ¶
type Robot struct { Id int `json:"id"` XPosition int `json:"xPosition"` YPosition int `json:"yPosition"` }
Robot defines model for robot.
type ServerInterface ¶
type ServerInterface interface { // Returns a web dashboard // (GET /) Dashboard(ctx echo.Context) error // Return the list of all robots with their current status // (GET /api/robots) GetAllRobots(ctx echo.Context) error // Get robot // (GET /api/robots/{robotId}) GetRobot(ctx echo.Context, robotId RobotId) error // Move robot // (PUT /api/robots/{robotId}) MoveRobot(ctx echo.Context, robotId RobotId) error // Get all tasks // (GET /api/tasks) GetAllTasks(ctx echo.Context) error // Cancel task // (DELETE /api/tasks/{taskId}) CancelTask(ctx echo.Context, taskId TaskId) error // Get task // (GET /api/tasks/{taskId}) GetTask(ctx echo.Context, taskId TaskId) error // Returns a websocket that streams the robots status // (GET /ws/robots) RobotsWebsocket(ctx echo.Context) error // Returns a websocket streams the current running tasks // (GET /ws/tasks) TasksWebsocket(ctx echo.Context) error }
ServerInterface represents all server handlers.
type ServerInterfaceWrapper ¶
type ServerInterfaceWrapper struct {
Handler ServerInterface
}
ServerInterfaceWrapper converts echo contexts to parameters.
func (*ServerInterfaceWrapper) CancelTask ¶
func (w *ServerInterfaceWrapper) CancelTask(ctx echo.Context) error
CancelTask converts echo context to params.
func (*ServerInterfaceWrapper) Dashboard ¶
func (w *ServerInterfaceWrapper) Dashboard(ctx echo.Context) error
Dashboard converts echo context to params.
func (*ServerInterfaceWrapper) GetAllRobots ¶
func (w *ServerInterfaceWrapper) GetAllRobots(ctx echo.Context) error
GetAllRobots converts echo context to params.
func (*ServerInterfaceWrapper) GetAllTasks ¶
func (w *ServerInterfaceWrapper) GetAllTasks(ctx echo.Context) error
GetAllTasks converts echo context to params.
func (*ServerInterfaceWrapper) GetRobot ¶
func (w *ServerInterfaceWrapper) GetRobot(ctx echo.Context) error
GetRobot converts echo context to params.
func (*ServerInterfaceWrapper) GetTask ¶
func (w *ServerInterfaceWrapper) GetTask(ctx echo.Context) error
GetTask converts echo context to params.
func (*ServerInterfaceWrapper) MoveRobot ¶
func (w *ServerInterfaceWrapper) MoveRobot(ctx echo.Context) error
MoveRobot converts echo context to params.
func (*ServerInterfaceWrapper) RobotsWebsocket ¶
func (w *ServerInterfaceWrapper) RobotsWebsocket(ctx echo.Context) error
RobotsWebsocket converts echo context to params.
func (*ServerInterfaceWrapper) TasksWebsocket ¶
func (w *ServerInterfaceWrapper) TasksWebsocket(ctx echo.Context) error
TasksWebsocket converts echo context to params.
type Task ¶
type Task struct { Id int `json:"id"` Status TaskStatus `json:"status"` }
Task defines model for task.
type TaskStatus ¶
type TaskStatus string
TaskStatus defines model for Task.Status.
const ( CANCELLED TaskStatus = "CANCELLED" COMPLETED TaskStatus = "COMPLETED" CREATED TaskStatus = "CREATED" INPROGRESS TaskStatus = "INPROGRESS" )
Defines values for TaskStatus.