http

package
v0.0.0-...-bd0efcb Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2020 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultClient = http.DefaultClient

Functions

func GetReqID

func GetReqID(r *http.Request) string

GetReqID is

func ListenAndServe

func ListenAndServe(addr string, handler http.Handler) error

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

func ListenAndServeTLS(addr, certFile, keyFile string, handler http.Handler) error

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

func RequestIDMiddleware(next http.Handler) http.Handler

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)

func Serve

func Serve(handler http.Handler, port int, https bool, sslCertPath, sslKeyPath string) error

Serve is

Types

type BlockChainUsageQuery

type BlockChainUsageQuery struct {
	ApplicationID string `json:"application_id"`
	StartDate     string `json:"start_date"`
	EndDate       string `json:"end_date"`
}

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 LinksData

type LinksData struct {
	Self string `json:"self"`
	Next string `json:"next"`
}

type Message

type Message struct {
	Data *MessageData `json:"data"`
}

type MessageData

type MessageData struct {
	Message string `json:"message"`
	Error   string `json:"error"`
}

type PaginationData

type PaginationData struct {
	Links   LinksData `json:"links"`
	Count   int       `json:"count"`
	SinceID string    `json:"sinceId"`
}

type RelationshipData

type RelationshipData struct {
	ID   string `json:"id"`
	HREF string `json:"href"`
}

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) Authenticate

func (s *Server) Authenticate(next http.Handler) http.Handler

func (*Server) GetErc721TokenTxList

func (s *Server) GetErc721TokenTxList() http.Handler

获取一个所有721 通证的交易列表

func (*Server) GetErc721TokenTxListByUser

func (s *Server) GetErc721TokenTxListByUser() http.Handler

获取一个所有721 通证对于某用户的交易列表

func (*Server) GetErc721TxListByUser

func (s *Server) GetErc721TxListByUser() http.Handler

获取一个所有用户关于721的交易列表

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

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"`
}

type TokenInfo

type TokenInfo struct {
	Status      string `json:"status"`
	Name        string `json:"name"`
	Symbol      string `json:"symbol"`
	TotalSupply int    `json:"totalSupply"`
}

Jump to

Keyboard shortcuts

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