robotapiserver

package
v0.0.0-...-9fbc374 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

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

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 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.

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 RobotId

type RobotId = int

RobotId defines model for robotId.

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 TaskId

type TaskId = int

TaskId defines model for taskId.

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.

Jump to

Keyboard shortcuts

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