// Package api provides primitives to interact with the openapi HTTP API. // // Code generated by github.com/deepmap/oapi-codegen version v1.9.0 DO NOT EDIT. package api import ( "github.com/labstack/echo/v4" ) // ServerInterface represents all server handlers. type ServerInterface interface { // Register a new worker // (POST /api/worker/register-worker) RegisterWorker(ctx echo.Context) error // Obtain a new task to execute // (POST /api/worker/task) ScheduleTask(ctx echo.Context) error } // ServerInterfaceWrapper converts echo contexts to parameters. type ServerInterfaceWrapper struct { Handler ServerInterface } // RegisterWorker converts echo context to params. func (w *ServerInterfaceWrapper) RegisterWorker(ctx echo.Context) error { var err error // Invoke the callback with all the unmarshalled arguments err = w.Handler.RegisterWorker(ctx) return err } // ScheduleTask converts echo context to params. func (w *ServerInterfaceWrapper) ScheduleTask(ctx echo.Context) error { var err error ctx.Set(Worker_authScopes, []string{""}) // Invoke the callback with all the unmarshalled arguments err = w.Handler.ScheduleTask(ctx) return err } // 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 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 } // RegisterHandlers adds each server route to the EchoRouter. func RegisterHandlers(router EchoRouter, si ServerInterface) { RegisterHandlersWithBaseURL(router, si, "") } // Registers handlers, and prepends BaseURL to the paths, so that the paths // can be served under a prefix. func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string) { wrapper := ServerInterfaceWrapper{ Handler: si, } router.POST(baseURL+"/api/worker/register-worker", wrapper.RegisterWorker) router.POST(baseURL+"/api/worker/task", wrapper.ScheduleTask) }