shared

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2021 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RespondWith added in v1.0.147

func RespondWith(c *gin.Context, status int, dataField interface{}, err string, code ReturnCode)

RespondWith will respond with the generic API response

func RespondWithValidationError added in v1.0.147

func RespondWithValidationError(c *gin.Context, err string)

RespondWithValidationError will be called when the application's context is invalid

Types

type ApiFacadeHandler added in v1.2.0

type ApiFacadeHandler interface {
	RestApiInterface() string
	RestAPIServerDebugMode() bool
	PprofEnabled() bool
	IsInterfaceNil() bool
}

ApiFacadeHandler interface defines methods that can be used from `elrondFacade` context variable

type GenericAPIResponse

type GenericAPIResponse struct {
	Data  interface{} `json:"data"`
	Error string      `json:"error"`
	Code  ReturnCode  `json:"code"`
}

GenericAPIResponse defines the structure of all responses on API endpoints

type HttpServerCloser added in v1.2.0

type HttpServerCloser interface {
	Start()
	Close() error
	IsInterfaceNil() bool
}

HttpServerCloser defines the basic actions of starting and closing that a web server should be able to do

type MiddlewareProcessor added in v1.2.0

type MiddlewareProcessor interface {
	MiddlewareHandlerFunc() gin.HandlerFunc
	IsInterfaceNil() bool
}

MiddlewareProcessor defines a processor used internally by the web server when processing requests

type ReturnCode

type ReturnCode string

ReturnCode defines the type defines to identify return codes

const ReturnCodeInternalError ReturnCode = "internal_issue"

ReturnCodeInternalError defines a request which hasn't been executed successfully due to an internal error

const ReturnCodeRequestError ReturnCode = "bad_request"

ReturnCodeRequestError defines a request which hasn't been executed successfully due to a bad request received

const ReturnCodeSuccess ReturnCode = "successful"

ReturnCodeSuccess defines a successful request

const ReturnCodeSystemBusy ReturnCode = "system_busy"

ReturnCodeSystemBusy defines a request which hasn't been executed successfully due to too many requests

type UpgradeableHttpServerHandler added in v1.2.0

type UpgradeableHttpServerHandler interface {
	CreateHttpServer() (HttpServerCloser, error)
	UpdateFacade(facade ApiFacadeHandler) error
	GetHttpServer() HttpServerCloser
	SetHttpServer(httpServer HttpServerCloser) error
	Close() error
	IsInterfaceNil() bool
}

UpgradeableHttpServerHandler defines the actions that an upgradeable http server need to do

Jump to

Keyboard shortcuts

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