Documentation ¶
Index ¶
- Variables
- func GetReqID(r *http.Request) string
- func ListenAndServe(addr string, handler http.Handler) error
- func ListenAndServeTLS(addr, certFile, keyFile string, handler http.Handler) error
- func RequestIDMiddleware(next http.Handler) http.Handler
- func RespondAccepted(w http.ResponseWriter, v interface{})
- func RespondCreated(w http.ResponseWriter, v interface{})
- func RespondError(w http.ResponseWriter, err error, code int, reqID string)
- func RespondMessage(w http.ResponseWriter, msg string)
- func RespondNotFound(w http.ResponseWriter)
- func RespondOK(w http.ResponseWriter, v interface{})
- func RespondServeFile(w http.ResponseWriter, f *baas.FileBlob)
- func Serve(handler http.Handler, port int, https bool, sslCertPath, sslKeyPath string) error
- type BlockChainUsageQuery
- type BlockOperation
- type DeployOperation
- type Error
- type HealthStats
- type LinksData
- type Message
- type MessageData
- type PaginationData
- type RelationshipData
- type RelationshipsData
- type Server
- type ServerConfig
- type SmartContractOperation
- type TokenInfo
Constants ¶
This section is empty.
Variables ¶
var DefaultClient = http.DefaultClient
Functions ¶
func ListenAndServe ¶
ListenAndServe just copies the http package ListenAndServe function later on I should refactor this to actually create my own server and handlers for now yolo
func ListenAndServeTLS ¶
ListenAndServeTLS just copies the http package ListenAndServe function later on I should refactor this to actually create my own server and handlers for now yolo
func RequestIDMiddleware ¶
RequestIDMiddleware creates a id for each request coming in. It then passes it down via context
func RespondAccepted ¶
func RespondAccepted(w http.ResponseWriter, v interface{})
Accepted encodes a JSON response and sets the status to HTTP Status to 200 OK
func RespondCreated ¶
func RespondCreated(w http.ResponseWriter, v interface{})
RespondCreated encodes a JSON response and sets the status to HTTP Status to 201 CREATED
func RespondError ¶
func RespondError(w http.ResponseWriter, err error, code int, reqID string)
RespondError writes an API error message to the response and logger.
func RespondMessage ¶
func RespondMessage(w http.ResponseWriter, msg string)
func RespondNotFound ¶
func RespondNotFound(w http.ResponseWriter)
NotFound writes an API error message to the response.
func RespondOK ¶
func RespondOK(w http.ResponseWriter, v interface{})
OK encodes a JSON response and sets the status to HTTP Status to 200 OK
func RespondServeFile ¶
func RespondServeFile(w http.ResponseWriter, f *baas.FileBlob)
Types ¶
type BlockChainUsageQuery ¶
type BlockOperation ¶
type BlockOperation struct { Opr string `json:"op"` Userid string `json:"userId"` Password string `json:"password"` Targetid string `json:"toUserId"` CipherText string `json:"cipherText"` Message string `json:"msg"` Encode string `json:"encode"` Value float64 `json:"quantity"` Hash string `json:"txHash"` Size string `json:"total"` Page string `json:"page"` Contract string `json:"contract"` TokenId string `json:"tokenId"` GasLimit int64 `json:"gasLimit"` }
type DeployOperation ¶
type DeployOperation struct { Name string `json:"name"` UserId string `json:"userId"` Password string `json:"password"` Symbol string `json:"symbol"` Decimal uint8 `json:"decimals"` TotalSupply uint64 `json:"totalSupply"` Capacity uint64 `json:"cap"` Class uint8 `json:"type"` Description string `json:"desc"` }
type Error ¶
type Error struct { Error string `json:"error,omitempty"` Type string `json:"type"` RequestID string `json:"requestId"` HTTPCode int `json:"httpCode"` }
Error is a generic HTTP response body for errors.
type HealthStats ¶
type HealthStats struct { AllocatedMemory uint64 `json:"allocatedMemory"` TotalAllocatedMemory uint64 `json:"totalAllocatedMemory"` Goroutines int `json:"goroutines"` GCCycles uint32 `json:"completedGCCycles"` NumberOfCPUs int `json:"cpus"` HeapSys uint64 `json:"maxHeapUsage"` HeapAllocated uint64 `json:"heapInUse"` ObjectsInUse uint64 `json:"objectsInUse"` OSMemoryObtained uint64 `json:"OSMemoryObtained"` }
type Message ¶
type Message struct {
Data *MessageData `json:"data"`
}
type MessageData ¶
type PaginationData ¶
type RelationshipData ¶
type RelationshipsData ¶
type RelationshipsData struct {
HREF string `json:"href"`
}
type Server ¶
type Server struct { BlockService baas.BlockService ApplicationService baas.ApplicationService UploadService baas.UploadService FileServeService baas.FileServeService UsageService baas.UsageService QueryDecoder *schema.Decoder AuthToken string Log zerolog.Logger *mux.Router }
func NewServer ¶
func NewServer(c *ServerConfig) *Server
func (*Server) GetErc721TokenTxList ¶
获取一个所有721 通证的交易列表
func (*Server) GetErc721TokenTxListByUser ¶
获取一个所有721 通证对于某用户的交易列表
func (*Server) GetErc721TxListByUser ¶
获取一个所有用户关于721的交易列表
type ServerConfig ¶
type ServerConfig struct { BlockService baas.BlockService ApplicationService baas.ApplicationService UploadService baas.UploadService FileServeService baas.FileServeService UsageService baas.UsageService QueryDecoder *schema.Decoder AuthToken string Log zerolog.Logger }
type SmartContractOperation ¶
type SmartContractOperation struct { Contract string `json:"contract"` Meta string `json:"metadata"` UserId string `json:"userId"` Password string `json:"password"` TokenId string `json:"tokenId"` SendUserId string `json:"sendUserId"` TargetId string `json:"toUserId"` Property string `json:"property"` Memo string `json:"memo"` BlockNumber string `json:"blockNumber"` Hash string `json:"txHash"` Quantity float64 `json:"quantity"` Action string `json:"action"` GasLimit int64 `json:"gasLimit"` }
Source Files ¶
- application_request.go
- application_response.go
- application_transport.go
- auth_middleware.go
- blockchain_request.go
- blockchain_response.go
- blockchain_transport.go
- file_response.go
- file_serve_query.go
- file_serve_transport.go
- health_transport.go
- request_id_middleware.go
- respond.go
- routes.go
- serve.go
- server.go
- upload_request.go
- upload_transport.go
- usage_query.go
- usage_response.go
- usage_transport.go