REST

package
v0.0.0-...-d5421df Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

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

Code generated by github.com/deepmap/oapi-codegen/v2 version v2.1.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 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 HealthAggregation

type HealthAggregation struct {
	// Components The different Components of the Server
	Components *[]HealthAggregationComponent `json:"components,omitempty"`

	// Health A Health Check Result
	Health HealthResult `json:"health"`
}

HealthAggregation defines model for HealthAggregation.

type HealthAggregationComponent

type HealthAggregationComponent struct {
	// Health A Health Check Result
	Health HealthResult `json:"health"`

	// Name The Name of the Component to be Health Checked
	Name string `json:"name"`
}

HealthAggregationComponent defines model for HealthAggregationComponent.

type HealthResult

type HealthResult string

HealthResult A Health Check Result

const (
	Down HealthResult = "Down"
	Up   HealthResult = "Up"
)

Defines values for HealthResult.

type ID

type ID = openapi_types.UUID

ID An object ID (in the form of UUID)

type RegisterJSONRequestBody

type RegisterJSONRequestBody = Registration

RegisterJSONRequestBody defines body for Register for application/json ContentType.

type Registration

type Registration struct {
	Password string `json:"password"`
	Username string `json:"username"`
}

Registration defines model for Registration.

type RegistrationResult

type RegistrationResult struct {
	// Id An object ID (in the form of UUID)
	Id       *ID    `json:"id,omitempty"`
	Password string `json:"password"`
	Username string `json:"username"`
}

RegistrationResult defines model for RegistrationResult.

type ServerInterface

type ServerInterface interface {
	// Checks if the Service is Available for Processing Request
	// (GET /health)
	IsHealthy(ctx echo.Context) error
	// Checks if the Service is Operational
	// (GET /ready)
	IsReady(ctx echo.Context) error
	// Register a new User
	// (POST /register)
	Register(ctx echo.Context) error
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler ServerInterface
}

ServerInterfaceWrapper converts echo contexts to parameters.

func (*ServerInterfaceWrapper) IsHealthy

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

IsHealthy converts echo context to params.

func (*ServerInterfaceWrapper) IsReady

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

IsReady converts echo context to params.

func (*ServerInterfaceWrapper) Register

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

Register converts echo context to params.

Jump to

Keyboard shortcuts

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