api

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: MIT Imports: 20 Imported by: 0

README

API Definition

Contains API specs for OpenAPI 3, the go files generated from those specs and the API handler.

Documentation

Overview

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

Code generated by github.com/deepmap/oapi-codegen/v2 version v2.0.0 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAddressDataPage

func GetAddressDataPage[T storage.Paginated](a *ApiHandler, address AddressFilter, pag *PaginationParam) interface{}

func GetHoldersDataPage added in v0.2.1

func GetHoldersDataPage(a *ApiHandler, pag *PaginationParam) interface{}

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 ApiHandler

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

func NewApiHandler

func NewApiHandler(s storage.Storage, c *common.Config) *ApiHandler

func (*ApiHandler) GetAddressDags

func (a *ApiHandler) GetAddressDags(ctx echo.Context, address AddressFilter, params GetAddressDagsParams) error

GetAddressDags returns all DAG blocks sent by the selected address

func (*ApiHandler) GetAddressPbfts

func (a *ApiHandler) GetAddressPbfts(ctx echo.Context, address AddressFilter, params GetAddressPbftsParams) error

GetAddressPbfts returns all PBFT blocks produced by the selected address

func (*ApiHandler) GetAddressStats

func (a *ApiHandler) GetAddressStats(ctx echo.Context, address AddressFilter) error

GetAddressPbftTotal returns total number of PBFT blocks produced for the selected address

func (*ApiHandler) GetAddressTransactions

func (a *ApiHandler) GetAddressTransactions(ctx echo.Context, address AddressFilter, params GetAddressTransactionsParams) error

GetAddressTransactions returns all transactions from and to the selected address

func (*ApiHandler) GetAddressYield added in v0.2.1

func (a *ApiHandler) GetAddressYield(ctx echo.Context, address AddressParam, params GetAddressYieldParams) error

func (*ApiHandler) GetAddressYieldForInterval added in v1.5.6

func (a *ApiHandler) GetAddressYieldForInterval(ctx echo.Context, address AddressParam, params GetAddressYieldForIntervalParams) error

func (*ApiHandler) GetHolders added in v0.2.1

func (a *ApiHandler) GetHolders(ctx echo.Context, params GetHoldersParams) error

func (*ApiHandler) GetInternalTransactions added in v0.2.1

func (a *ApiHandler) GetInternalTransactions(ctx echo.Context, hash HashParam) error

func (*ApiHandler) GetTotalSupply

func (a *ApiHandler) GetTotalSupply(ctx echo.Context) error

func (*ApiHandler) GetTotalYield added in v0.2.1

func (a *ApiHandler) GetTotalYield(ctx echo.Context, params GetTotalYieldParams) error

func (*ApiHandler) GetTransaction added in v0.2.3

func (a *ApiHandler) GetTransaction(ctx echo.Context, hash string) error

func (*ApiHandler) GetTransactionLogs added in v0.2.1

func (a *ApiHandler) GetTransactionLogs(ctx echo.Context, hash HashParam) error

func (*ApiHandler) GetValidator

func (a *ApiHandler) GetValidator(ctx echo.Context, address AddressParam, params GetValidatorParams) error

GetValidator returns info about the validator for the selected week

func (*ApiHandler) GetValidators

func (a *ApiHandler) GetValidators(ctx echo.Context, params GetValidatorsParams) error

GetValidators returns all validators for the selected week and the number of PBFT blocks they produced

func (*ApiHandler) GetValidatorsTotal

func (a *ApiHandler) GetValidatorsTotal(ctx echo.Context, params GetValidatorsTotalParams) error

GetValidatorsTotal returns total number of PBFT blocks produced in selected week

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 ServerInterface

type ServerInterface interface {
	// Returns all DAG blocks
	// (GET /address/{address}/dags)
	GetAddressDags(ctx echo.Context, address AddressParam, params GetAddressDagsParams) error
	// Returns all PBFT blocks
	// (GET /address/{address}/pbfts)
	GetAddressPbfts(ctx echo.Context, address AddressParam, params GetAddressPbftsParams) error
	// Returns stats for the address
	// (GET /address/{address}/stats)
	GetAddressStats(ctx echo.Context, address AddressParam) error
	// Returns all transactions
	// (GET /address/{address}/transactions)
	GetAddressTransactions(ctx echo.Context, address AddressParam, params GetAddressTransactionsParams) error
	// Returns yield for the address
	// (GET /address/{address}/yield)
	GetAddressYield(ctx echo.Context, address AddressParam, params GetAddressYieldParams) error
	// Returns yield for the address
	// (GET /address/{address}/yieldForInterval)
	GetAddressYieldForInterval(ctx echo.Context, address AddressParam, params GetAddressYieldForIntervalParams) error
	// Returns the list of TARA token holders and their balances
	// (GET /holders)
	GetHolders(ctx echo.Context, params GetHoldersParams) error
	// Returns total supply
	// (GET /totalSupply)
	GetTotalSupply(ctx echo.Context) error
	// Returns total yield
	// (GET /totalYield)
	GetTotalYield(ctx echo.Context, params GetTotalYieldParams) error
	// Returns the decoded transaction
	// (GET /transaction/{hash})
	GetTransaction(ctx echo.Context, hash HashParam) error
	// Returns internal transactions
	// (GET /transaction/{hash}/internal_transactions)
	GetInternalTransactions(ctx echo.Context, hash HashParam) error
	// Returns event logs of transaction
	// (GET /transaction/{hash}/logs)
	GetTransactionLogs(ctx echo.Context, hash HashParam) error
	// Returns all validators
	// (GET /validators)
	GetValidators(ctx echo.Context, params GetValidatorsParams) error
	// Returns total number of PBFT blocks
	// (GET /validators/total)
	GetValidatorsTotal(ctx echo.Context, params GetValidatorsTotalParams) error
	// Returns info about the validator
	// (GET /validators/{address})
	GetValidator(ctx echo.Context, address AddressParam, params GetValidatorParams) error
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler ServerInterface
}

ServerInterfaceWrapper converts echo contexts to parameters.

func (*ServerInterfaceWrapper) GetAddressDags

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

GetAddressDags converts echo context to params.

func (*ServerInterfaceWrapper) GetAddressPbfts

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

GetAddressPbfts converts echo context to params.

func (*ServerInterfaceWrapper) GetAddressStats

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

GetAddressStats converts echo context to params.

func (*ServerInterfaceWrapper) GetAddressTransactions

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

GetAddressTransactions converts echo context to params.

func (*ServerInterfaceWrapper) GetAddressYield added in v0.2.1

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

GetAddressYield converts echo context to params.

func (*ServerInterfaceWrapper) GetAddressYieldForInterval added in v1.5.6

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

GetAddressYieldForInterval converts echo context to params.

func (*ServerInterfaceWrapper) GetHolders added in v0.2.1

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

GetHolders converts echo context to params.

func (*ServerInterfaceWrapper) GetInternalTransactions added in v0.2.1

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

GetInternalTransactions converts echo context to params.

func (*ServerInterfaceWrapper) GetTotalSupply

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

GetTotalSupply converts echo context to params.

func (*ServerInterfaceWrapper) GetTotalYield added in v0.2.1

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

GetTotalYield converts echo context to params.

func (*ServerInterfaceWrapper) GetTransaction added in v0.2.3

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

GetTransaction converts echo context to params.

func (*ServerInterfaceWrapper) GetTransactionLogs added in v0.2.1

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

GetTransactionLogs converts echo context to params.

func (*ServerInterfaceWrapper) GetValidator

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

GetValidator converts echo context to params.

func (*ServerInterfaceWrapper) GetValidators

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

GetValidators converts echo context to params.

func (*ServerInterfaceWrapper) GetValidatorsTotal

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

GetValidatorsTotal converts echo context to params.

Jump to

Keyboard shortcuts

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