controllers

package
v1.0.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2022 License: MIT Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	VersionKey       = `name:"_apiVersion"`
	StorageDriverKey = `name:"_apiStorageDriver"`
	LedgerListerKey  = `name:"_apiLedgerLister"`
)

Variables

Functions

func ProvideLedgerLister

func ProvideLedgerLister(provider interface{}) fx.Option

func ProvideStorageDriver

func ProvideStorageDriver(provider interface{}) fx.Option

func ProvideVersion

func ProvideVersion(provider interface{}) fx.Option

Types

type AccountController

type AccountController struct {
	BaseController
}

AccountController -

func NewAccountController

func NewAccountController() AccountController

NewAccountController -

func (*AccountController) GetAccount

func (ctl *AccountController) GetAccount(c *gin.Context)

GetAccount godoc @Summary Get account by address @Schemes @Param ledger path string true "ledger" @Param accountId path string true "accountId" @Accept json @Produce json @Success 200 {object} controllers.BaseResponse{account=core.Account} @Router /{ledger}/accounts/{accountId} [get]

func (*AccountController) GetAccounts

func (ctl *AccountController) GetAccounts(c *gin.Context)

GetAccounts godoc @Summary List all accounts @Schemes @Param ledger path string true "ledger" @Param after query string true "pagination cursor, will return accounts after given address (in descending order)" @Accept json @Produce json @Success 200 {object} controllers.BaseResponse{cursor=query.Cursor{data=[]core.Account}} @Router /{ledger}/accounts [get]

func (*AccountController) PostAccountMetadata

func (ctl *AccountController) PostAccountMetadata(c *gin.Context)

PostAccountMetadata godoc @Summary Add metadata to account @Schemes @Param ledger path string true "ledger" @Param accountId path string true "accountId" @Accept json @Produce json @Success 200 {object} controllers.BaseResponse @Failure 400 @Router /{ledger}/accounts/{accountId}/metadata [post]

type BaseController

type BaseController struct{}

Controllers struct

type BaseResponse

type BaseResponse struct{}

type ConfigController

type ConfigController struct {
	BaseController
	Version       string
	StorageDriver string
	LedgerLister  LedgerLister
}

ConfigController -

func NewConfigController

func NewConfigController(version string, storageDriver string, lister LedgerLister) ConfigController

NewConfigController -

func (*ConfigController) GetDocs

func (ctl *ConfigController) GetDocs(c *gin.Context)

func (*ConfigController) GetInfo

func (ctl *ConfigController) GetInfo(c *gin.Context)

GetInfo godoc @Summary Server Info @Description Show server informations @Tags server @Schemes @Accept json @Produce json @Success 200 {object} config.ConfigInfo{} @Router /_info [get]

type LedgerController

type LedgerController struct {
	BaseController
}

LedgerController -

func NewLedgerController

func NewLedgerController() LedgerController

NewLedgerController -

func (*LedgerController) GetStats

func (ctl *LedgerController) GetStats(c *gin.Context)

GetStats godoc @Summary Get Stats @Description Get ledger stats (aggregate metrics on accounts and transactions) @Tags stats @Schemes @Description The stats for account @Accept json @Produce json @Param ledger path string true "ledger" @Success 200 {object} ledger.Stats{} @Router /{ledger}/stats [get]

type LedgerLister

type LedgerLister interface {
	List(r *http.Request) []string
}

type LedgerListerFn

type LedgerListerFn func(r *http.Request) []string

func (LedgerListerFn) List

func (fn LedgerListerFn) List(r *http.Request) []string

type MappingController

type MappingController struct {
	BaseController
}

func NewMappingController

func NewMappingController() MappingController

func (*MappingController) GetMapping

func (ctl *MappingController) GetMapping(c *gin.Context)

GetMapping godoc @Summary Get mapping @Description Get ledger mapping @Tags contracts @Schemes @Param ledger path string true "ledger" @Accept json @Produce json @Success 200 {object} controllers.BaseResponse @Failure 404 {object} controllers.BaseResponse @Router /{ledger}/mapping [get]

func (*MappingController) PutMapping

func (ctl *MappingController) PutMapping(c *gin.Context)

PutMapping godoc @Summary Put mapping @Description Update ledger mapping @Tags mapping @Schemes @Param ledger path string true "ledger" @Accept json @Produce json @Success 200 {object} controllers.BaseResponse @Failure 404 {object} controllers.BaseResponse @Router /{ledger}/mapping [put]

type ScriptController

type ScriptController struct {
	BaseController
}

ScriptController -

func NewScriptController

func NewScriptController() ScriptController

NewScriptController -

func (*ScriptController) PostScript

func (ctl *ScriptController) PostScript(c *gin.Context)

PostScript godoc @Summary Execute Numscript @Description Execute a Numscript and create the transaction if any @Tags script @Schemes @Param ledger path string true "ledger" @Param script body core.Script true "script" @Accept json @Produce json @Success 200 {object} controllers.BaseResponse @Router /{ledger}/script [post]

type TransactionController

type TransactionController struct {
	BaseController
}

TransactionController -

func NewTransactionController

func NewTransactionController() TransactionController

NewTransactionController -

func (*TransactionController) GetTransaction

func (ctl *TransactionController) GetTransaction(c *gin.Context)

GetTransaction godoc @Summary Get Transaction @Description Get transaction by transaction id @Tags transactions @Schemes @Param ledger path string true "ledger" @Param txid path string true "txid" @Accept json @Produce json @Success 200 {object} controllers.BaseResponse @Failure 404 {object} controllers.BaseResponse @Router /{ledger}/transactions/{txid} [get]

func (*TransactionController) GetTransactions

func (ctl *TransactionController) GetTransactions(c *gin.Context)

GetTransactions godoc @Summary Get all Transactions @Description Get all ledger transactions @Tags transactions @Schemes @Param ledger path string true "ledger" @Param after query string false "pagination cursor, will return transactions after given txid (in descending order)" @Param reference query string false "find transactions by reference field" @Param account query string false "find transactions with postings involving given account, either as source or destination" @Accept json @Produce json @Success 200 {object} controllers.BaseResponse{cursor=query.Cursor{data=[]core.Transaction}} @Router /{ledger}/transactions [get]

func (*TransactionController) PostTransaction

func (ctl *TransactionController) PostTransaction(c *gin.Context)

PostTransactions godoc @Summary Create Transaction @Description Create a new ledger transaction @Tags transactions @Schemes @Description Commit a new transaction to the ledger @Param ledger path string true "ledger" @Param transaction body core.Transaction true "transaction" @Accept json @Produce json @Success 200 {object} controllers.BaseResponse @Router /{ledger}/transactions [post]

func (*TransactionController) PostTransactionMetadata

func (ctl *TransactionController) PostTransactionMetadata(c *gin.Context)

PostTransactionMetadata godoc @Summary Set Transaction Metadata @Description Set a new metadata to a ledger transaction by transaction id @Tags transactions @Schemes @Param ledger path string true "ledger" @Param txid path string true "txid" @Accept json @Produce json @Success 200 {object} controllers.BaseResponse @Router /{ledger}/transactions/{txid}/metadata [post]

func (*TransactionController) PostTransactionsBatch

func (ctl *TransactionController) PostTransactionsBatch(c *gin.Context)

PostTransactionsBatch godoc @Summary Create Transactions Batch @Description Create a new ledger transactions batch @Tags transactions @Schemes @Description Commit a batch of new transactions to the ledger @Param ledger path string true "ledger" @Param transactions body core.Transactions true "transactions" @Accept json @Produce json @Success 200 {object} controllers.BaseResponse @Failure 400 @Router /{ledger}/transactions/batch [post]

func (*TransactionController) RevertTransaction

func (ctl *TransactionController) RevertTransaction(c *gin.Context)

RevertTransaction godoc @Summary Revert Transaction @Description Revert a ledger transaction by transaction id @Tags transactions @Schemes @Param ledger path string true "ledger" @Param txid path string true "txid" @Accept json @Produce json @Success 200 {object} controllers.BaseResponse @Router /{ledger}/transactions/{txid}/revert [post]

Jump to

Keyboard shortcuts

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