router

package
v0.0.0-...-692fcab Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitReflector

func InitReflector(port int, addresses []string, opts *OASOptions) *openapi3.Reflector

InitReflector ...

func WithOIDC

func WithOIDC(ref *openapi3.Reflector, url, client, secret string)

WithOIDC ...

Types

type OASOptions

type OASOptions struct {
	Title       string
	Description string
	Version     string
	OASVersion  string
	AuthURL     string
	AuthClient  string
	AuthSecret  string
}

OASOptions ...

type Route

type Route struct {
	// contains filtered or unexported fields
}

Route is a structure for holding data for building OpenAPI spec and handling requests

func Delete

func Delete[T interface{}](path string, handlerFunc echo.HandlerFunc, handlers ...echo.MiddlewareFunc) *Route

Delete creates a DELETE route

func Get

func Get[T interface{}](path string, handlerFunc echo.HandlerFunc, handlers ...echo.MiddlewareFunc) *Route

Get creates a GET route

func Patch

func Patch[T interface{}, D interface{}](path string, handlerFunc echo.HandlerFunc, handlers ...echo.MiddlewareFunc) *Route

Patch creates a PATCH route

func Post

func Post[T interface{}, D interface{}](path string, handlerFunc echo.HandlerFunc, handlers ...echo.MiddlewareFunc) *Route

Post creates a POST route

func Put

func Put[T interface{}, D interface{}](path string, handlerFunc echo.HandlerFunc, handlers ...echo.MiddlewareFunc) *Route

Put creates a PUT route

func (*Route) Description

func (r *Route) Description(description string) *Route

Description add tags for the route

func (*Route) Header

func (r *Route) Header(name string) *Route

Header sets a query param

func (*Route) Query

func (r *Route) Query(name string) *Route

Query sets a query param

func (*Route) Res

func (r *Route) Res(body interface{}, code int) *Route

Res adds a response to spec

func (*Route) Summary

func (r *Route) Summary(summary string) *Route

Summary adds a summary to the route

func (*Route) Tags

func (r *Route) Tags(tags ...string) *Route

Tags add tags for the route

type Router

type Router struct {
	// contains filtered or unexported fields
}

Router holds the reference for openapi3.Reflector and routes

func Instance

func Instance() *Router

Instance is a singleton returning method for Router

func (*Router) Build

func (r *Router) Build(ref *openapi3.Reflector, app *echo.Echo)

Build builds the OpenAPI spec and registers handlers with Echo

func (*Router) Group

func (r *Router) Group(name string) *Router

Group groups routes under a common tag

func (*Router) Prefix

func (r *Router) Prefix(url string) *Router

Prefix adds an url prefix

func (*Router) Register

func (r *Router) Register(routes ...*Route) *Router

Register registers one or more routes

Jump to

Keyboard shortcuts

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