api

package
v0.0.0-...-f069fcf Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2022 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SendTransaction  = "sendTransaction"
	GetTransaction   = "getTransaction"
	GetBlockByHash   = "getBlockByHash"
	GetBlockByNumber = "getBlockByNumber"
	ListResources    = "listResources"
	Call             = "call"
)

Variables

View Source
var (
	Success     = NewError(http.StatusOK, 0, "success")
	ServerError = NewError(http.StatusInternalServerError, 200500, "system error!")
	NotFound    = NewError(http.StatusNotFound, 200404, http.StatusText(http.StatusNotFound))
)

Functions

func ErrHandler

func ErrHandler() gin.HandlerFunc

func HandleNotFound

func HandleNotFound(c *gin.Context)

404

Types

type API

type API interface {
	SendTransaction()
	GetTransaction()
	GetBlockByHash()
	GetBlockByNumber()
	ListResources()
	Call()
}

type Error

type Error struct {
	StatusCode int    `json:"-"`
	Code       int    `json:"code"`
	Msg        string `json:"msg"`
}

func NewError

func NewError(statusCode, Code int, msg string) *Error

func OtherError

func OtherError(message string) *Error

func (*Error) Error

func (e *Error) Error() string

type Server

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

func NewServer

func NewServer(config *repo.Config, router router.Router, mg *appchain.Manager, logger logrus.FieldLogger) *Server

func (*Server) QueryIBTP

func (g *Server) QueryIBTP(c *gin.Context)

GET 127.0.0.1:80/api/QueryIBTP/:did/:to/:id

func (*Server) QueryOuterMeta

func (g *Server) QueryOuterMeta(c *gin.Context)

GET 127.0.0.1:80/api/QueryOuterMeta/:did

func (*Server) Start

func (g *Server) Start() error

func (*Server) Stop

func (g *Server) Stop() error

Jump to

Keyboard shortcuts

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