api

package
v0.0.0-...-dc3c4d4 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthMiddleware

func AuthMiddleware(r *mux.Router, chainSvc *service.BlockchainService, handler authErrorHandler) mux.MiddlewareFunc

func JsonRpcValidationMiddleware

func JsonRpcValidationMiddleware(next http.Handler) http.Handler

func LogTracingMiddleware

func LogTracingMiddleware(prefix string) mux.MiddlewareFunc

func LoggingMiddleware

func LoggingMiddleware(next http.Handler) http.Handler

func MetricsMiddleware

func MetricsMiddleware(next http.Handler) http.Handler

func MustServe

func MustServe(svcFactory *service.Factory)

MustServe serves the API endpoints. Be minded this function will block until application exit.

func Shutdown

func Shutdown() error

Shutdown shutdowns the API endpoints with 5s timeout.

func Wrap

func Wrap(
	controllerFunc func(hc *handlerContext) (interface{}, error),
	module string,
) func(w http.ResponseWriter, r *http.Request)

Types

type BillingController

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

func NewBillingController

func NewBillingController(billingSvc *service.BillingService) *BillingController

func (*BillingController) Bill

func (bc *BillingController) Bill(hc *handlerContext) (interface{}, error)

type Config

type Config struct {
	Endpoint string `default:":8080"`
}

type JrBillingApi

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

func (*JrBillingApi) Bill

func (api *JrBillingApi) Bill(r *http.Request, args *service.BillingRequest, reply **model.BusinessError) error

JSON-RPC billing API can be requested like: {"jsonrpc":"2.0","method":"web3pay.Bill","params":[{ "dryRun": true, "resourceId": "default"}],"id":1}

func (*JrBillingApi) BillBatch

func (api *JrBillingApi) BillBatch(r *http.Request, args *service.BillingBatchRequest, reply **model.BusinessError) error

JSON-RPC billing batch API can be requested like: {"jsonrpc":"2.0","method":"web3pay.BillBatch","params":[{ "dryRun": true, "resourceUses": {"default":1}}],"id":1}

Jump to

Keyboard shortcuts

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