restapi

package
v1.2.8 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: Apache-2.0 Imports: 15 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// ParameterMessageID is used to identify a message by its ID.
	ParameterMessageID = "messageID"

	// ParameterTransactionID is used to identify a transaction by its ID.
	ParameterTransactionID = "transactionID"

	// ParameterOutputID is used to identify an output by its ID.
	ParameterOutputID = "outputID"

	// ParameterAddress is used to identify an address.
	ParameterAddress = "address"

	// ParameterMilestoneIndex is used to identify a milestone.
	ParameterMilestoneIndex = "milestoneIndex"

	// ParameterPeerID is used to identify a peer.
	ParameterPeerID = "peerID"

	// QueryParameterPageSize is used to define the page size for the results.
	QueryParameterPageSize = "pageSize"
)

Variables

View Source
var (
	// ErrInvalidParameter defines the invalid parameter error.
	ErrInvalidParameter = echo.NewHTTPError(http.StatusBadRequest, "invalid parameter")

	// ErrServiceNotImplemented defines the service not implemented error.
	ErrServiceNotImplemented = echo.NewHTTPError(http.StatusNotImplemented, "service not implemented")
)

Functions

func JSONResponse

func JSONResponse(c echo.Context, statusCode int, result interface{}) error

JSONResponse wraps the result into a "data" field and sends the JSON response with status code.

func ParseBech32AddressParam

func ParseBech32AddressParam(c echo.Context, prefix iotago.NetworkPrefix) (iotago.Address, error)

func ParseEd25519AddressParam

func ParseEd25519AddressParam(c echo.Context) (*iotago.Ed25519Address, error)

func ParseMessageIDParam

func ParseMessageIDParam(c echo.Context) (hornet.MessageID, error)

func ParseMilestoneIndexParam

func ParseMilestoneIndexParam(c echo.Context) (milestone.Index, error)

func ParseOutputIDParam

func ParseOutputIDParam(c echo.Context) (*iotago.UTXOInputID, error)

func ParsePeerIDParam

func ParsePeerIDParam(c echo.Context) (peer.ID, error)

func ParseTransactionIDParam

func ParseTransactionIDParam(c echo.Context) (*iotago.TransactionID, error)

func ParseUint32QueryParam added in v1.2.6

func ParseUint32QueryParam(c echo.Context, paramName string, maxValue ...uint32) (uint32, error)

Types

type AllowedRoute

type AllowedRoute func(method string, path string) bool

AllowedRoute defines a function to allow or disallow routes.

type DynamicProxy

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

func NewDynamicProxy

func NewDynamicProxy(e *echo.Echo, prefix string) *DynamicProxy

func (*DynamicProxy) AddGroup

func (p *DynamicProxy) AddGroup(prefix string) *echo.Group

func (*DynamicProxy) AddReverseProxy

func (p *DynamicProxy) AddReverseProxy(prefix string, host string, port uint32) error

func (*DynamicProxy) RemoveReverseProxy

func (p *DynamicProxy) RemoveReverseProxy(prefix string)

type HTTPErrorResponse

type HTTPErrorResponse struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

HTTPErrorResponse defines the error struct for the HTTPErrorResponseEnvelope.

type HTTPErrorResponseEnvelope

type HTTPErrorResponseEnvelope struct {
	Error HTTPErrorResponse `json:"error"`
}

HTTPErrorResponseEnvelope defines the error response schema for node API responses.

type HTTPOkResponseEnvelope

type HTTPOkResponseEnvelope struct {
	// The response is encapsulated in the Data field.
	Data interface{} `json:"data"`
}

HTTPOkResponseEnvelope defines the ok response schema for node API responses.

Jump to

Keyboard shortcuts

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