webapi

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const APIVersion = 1

Variables

View Source
var ConfirmedStateLagThreshold uint32

Functions

func AddHealthEndpoint added in v1.0.3

func AddHealthEndpoint(server echoswagger.ApiRoot, chainService interfaces.ChainService, metricsService interfaces.MetricsService)

func Init

func Init(
	logger *loggerpkg.Logger,
	server echoswagger.ApiRoot,
	waspVersion string,
	config *configuration.Configuration,
	networkProvider peering.NetworkProvider,
	trustedNetworkManager peering.TrustedNetworkManager,
	userManager *userspkg.UserManager,
	chainRecordRegistryProvider registry.ChainRecordRegistryProvider,
	dkShareRegistryProvider registry.DKShareRegistryProvider,
	nodeIdentityProvider registry.NodeIdentityProvider,
	chainsProvider chains.Provider,
	dkgNodeProvider dkg.NodeProvider,
	shutdownHandler *shutdown.ShutdownHandler,
	chainMetricsProvider *metrics.ChainMetricsProvider,
	authConfig authentication.AuthConfiguration,
	requestCacheTTL time.Duration,
	websocketService *websocket.Service,
	indexDbPath string,
	pub *publisher.Publisher,
	jsonrpcParams *jsonrpc.Parameters,
)

Types

type APIGroupModifier added in v1.0.3

type APIGroupModifier struct {
	OverrideHandler func(api echoswagger.Api)
	// contains filtered or unexported fields
}

APIGroupModifier is required as it is impossible with echoSwagger to define a group with mixed authentication rules. Most of our routes are protected but very few are not.

While it is possible to create two different groups such as (chainAdm, chainPub), this will pollute the code generation and the documentation itself, as it will create empty groups for controllers that define no public routes, duplicate code files and increase the client lib size even further

Furthermore, it's forbidden to create two groups with the same name to support two different authentication rules. This wrapper adds modifiers to each route that it is assigned to. See: api.go -> loadControllers

func (*APIGroupModifier) Add added in v1.0.3

func (p *APIGroupModifier) Add(method, path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echoswagger.Api

func (*APIGroupModifier) CallOverrideHandler added in v1.0.3

func (p *APIGroupModifier) CallOverrideHandler(api echoswagger.Api) echoswagger.Api

func (*APIGroupModifier) DELETE added in v1.0.3

func (p *APIGroupModifier) DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echoswagger.Api

func (*APIGroupModifier) EchoGroup added in v1.0.3

func (p *APIGroupModifier) EchoGroup() *echo.Group

func (*APIGroupModifier) GET added in v1.0.3

func (p *APIGroupModifier) GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echoswagger.Api

func (*APIGroupModifier) HEAD added in v1.0.3

func (p *APIGroupModifier) HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echoswagger.Api

func (*APIGroupModifier) OPTIONS added in v1.0.3

func (p *APIGroupModifier) OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echoswagger.Api

func (*APIGroupModifier) PATCH added in v1.0.3

func (p *APIGroupModifier) PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echoswagger.Api

func (*APIGroupModifier) POST added in v1.0.3

func (p *APIGroupModifier) POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echoswagger.Api

func (*APIGroupModifier) PUT added in v1.0.3

func (p *APIGroupModifier) PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echoswagger.Api

func (*APIGroupModifier) SetDescription added in v1.0.3

func (p *APIGroupModifier) SetDescription(desc string) echoswagger.ApiGroup

func (*APIGroupModifier) SetExternalDocs added in v1.0.3

func (p *APIGroupModifier) SetExternalDocs(desc, url string) echoswagger.ApiGroup

func (*APIGroupModifier) SetSecurity added in v1.0.3

func (p *APIGroupModifier) SetSecurity(names ...string) echoswagger.ApiGroup

func (*APIGroupModifier) SetSecurityWithScope added in v1.0.3

func (p *APIGroupModifier) SetSecurityWithScope(s map[string][]string) echoswagger.ApiGroup

type Mocker added in v1.0.3

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

func NewMocker added in v1.0.3

func NewMocker() *Mocker

func (*Mocker) Get added in v1.0.3

func (m *Mocker) Get(i interface{}) interface{}

func (*Mocker) LoadMockFiles added in v1.0.3

func (m *Mocker) LoadMockFiles()

Jump to

Keyboard shortcuts

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