handlers

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2020 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSONErr

func JSONErr(w http.ResponseWriter, code int, errText string)

JSONErr write single error as JSON encoded response.

func JSONErrs

func JSONErrs(w http.ResponseWriter, code int, errs []string)

JSONErrs write multiple errors as JSON encoded response.

func JSONRedirect

func JSONRedirect(w http.ResponseWriter, code int, urlStr string)

JSONRedirect return redirect response, but with JSON formatted body.

func JSONResp

func JSONResp(w http.ResponseWriter, code int, content interface{})

JSONResp write content as JSON encoded response.

Types

type AccountAccountsDetailHandler added in v0.9.0

type AccountAccountsDetailHandler struct {
	Bns client.BnsClient
}

func (*AccountAccountsDetailHandler) ServeHTTP added in v0.9.0

AccountAccountsDetailHandler godoc @Summary Returns a list of `bnsd/x/account` Account entitiy. @Param accountKey path string false "Address of the admin" @Success 200 {object} json.RawMessage @Failure 404 {object} json.RawMessage @Failure 500 {object} json.RawMessage @Router /account/accounts/{accountKey} [get]

type AccountAccountsHandler added in v0.9.0

type AccountAccountsHandler struct {
	Bns client.BnsClient
}

func (*AccountAccountsHandler) ServeHTTP added in v0.9.0

AccountAccountsDetailHandler godoc @Summary Returns a list of `bnsd/x/account` Account entitiy. @Param domainKey query string false "Domain name" @Param ownerKey query string false "Admin address" @Description At most one of the query parameters must exist(excluding offset) @Success 200 {object} json.RawMessage @Failure 404 {object} json.RawMessage @Failure 500 {object} json.RawMessage @Router /account/accounts [get]

type AccountDomainsHandler added in v0.9.0

type AccountDomainsHandler struct {
	Bns client.BnsClient
}

func (*AccountDomainsHandler) ServeHTTP added in v0.9.0

AccountDomainsHandler godoc @Summary Returns a list of `bnsd/x/account` Domain entities. @Param admin query string false "Address of the admin" @Param offset query string false "Iteration offset" @Success 200 {object} json.RawMessage @Failure 404 {object} json.RawMessage @Redirect 303 @Router /account/domains/ [get]

type BlocksHandler

type BlocksHandler struct {
	Bns client.BnsClient
}

func (*BlocksHandler) ServeHTTP

func (h *BlocksHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

BlocksHandler godoc @Summary Get block details by height @Description get block detail by blockHeight @Param blockHeight path int true "Block Height" @Success 200 {object} json.RawMessage @Failure 404 {object} json.RawMessage @Redirect 303 @Router /blocks/{blockHeight} [get]

type CashBalanceHandler

type CashBalanceHandler struct {
	Bns client.BnsClient
}

func (*CashBalanceHandler) ServeHTTP

func (h *CashBalanceHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

CashBalanceHandler godoc @Summary Returns a `bnsd/x/cash.Set` entitiy. @Param address path string false "Bech32 or hex representation of an address" @Param offset query string false "Bech32 or hex representation of an address to be used as offset" @Success 200 {object} json.RawMessage @Failure 404 {object} json.RawMessage @Failure 500 {object} json.RawMessage @Router /cash/balances [get]

type DefaultHandler

type DefaultHandler struct {
	Domain string
}

DefaultHandler is used to handle the request that no other handler wants.

func (*DefaultHandler) ServeHTTP

func (h *DefaultHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type EscrowEscrowsHandler

type EscrowEscrowsHandler struct {
	Bns client.BnsClient
}

func (*EscrowEscrowsHandler) ServeHTTP

func (h *EscrowEscrowsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

EscrowEscrowsHandler godoc @Summary Returns a list of x/escrow Escrow entities. @Description At most one of the query parameters must exist(excluding offset) @Param offset query string false "Iteration offset" @Param source query string false "Source address" @Param destination query string false "Destination address" @Success 200 {object} json.RawMessage @Failure 404 {object} json.RawMessage @Failure 400 {object} json.RawMessage @Failure 500 @Router /escrow/escrows [get]

type GconfHandler

type GconfHandler struct {
	Bns   client.BnsClient
	Confs map[string]func() gconf.Configuration
}

func (*GconfHandler) ServeHTTP

func (h *GconfHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type GovProposalsHandler

type GovProposalsHandler struct {
	Bns client.BnsClient
}

GovProposalsHandler godoc @Summary Returns a list of x/gov Votes entities. @Description At most one of the query parameters must exist(excluding offset) @Param author query string false "Author address" @Param electorate query string false "Base64 encoded electorate ID" @Param elector query string false "Base64 encoded Elector ID" @Param electorID query int false "Elector ID" @Success 200 {object} json.RawMessage @Failure 404 {object} json.RawMessage @Failure 400 {object} json.RawMessage @Failure 500 @Router /gov/proposals [get]

func (*GovProposalsHandler) ServeHTTP

func (h *GovProposalsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type GovVotesHandler

type GovVotesHandler struct {
	Bns client.BnsClient
}

GovVotesHandler godoc @Summary Returns a list of x/gov Votes entities. @Description At most one of the query parameters must exist(excluding offset) @Param proposal query string false "Base64 encoded Proposal ID" @Param proposalID query int false "Proposal ID" @Param elector query string false "Base64 encoded Elector ID" @Param electorID query int false "Elector ID" @Success 200 {object} json.RawMessage @Failure 404 {object} json.RawMessage @Failure 400 {object} json.RawMessage @Failure 500 @Router /gov/votes [get]

func (*GovVotesHandler) ServeHTTP

func (h *GovVotesHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type InfoHandler

type InfoHandler struct{}

func (*InfoHandler) ServeHTTP

func (h *InfoHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

InfoHandler godoc @Summary Returns information about this instance of `bnsapi`. @Success 200 @Router /info/ [get]

type KeyValue

type KeyValue struct {
	Key   hexbytes  `json:"key"`
	Value orm.Model `json:"value"`
}

type MultisigContractsHandler

type MultisigContractsHandler struct {
	Bns client.BnsClient
}

func (*MultisigContractsHandler) ServeHTTP

MultisigContractsHandler godoc @Summary Returns a list of multisig Contract entities. @Description At most one of the query parameters must exist(excluding offset) @Param offset query string false "Iteration offset" @Success 200 {object} json.RawMessage @Failure 404 {object} json.RawMessage @Failure 500 @Router /multisig/contracts [get]

type TermdepositContractsHandler added in v0.9.0

type TermdepositContractsHandler struct {
	Bns client.BnsClient
}

func (*TermdepositContractsHandler) ServeHTTP added in v0.9.0

TermdepositContractsHandler godoc @Summary Returns a list of bnsd/x/termdeposit Contract entities. @Description At most one of the query parameters must exist(excluding offset) @Param offset query string false "Iteration offset" @Success 200 {object} json.RawMessage @Failure 404 {object} json.RawMessage @Failure 500 @Router /termdeposit/contracts [get]

type TermdepositDepositsHandler added in v0.9.0

type TermdepositDepositsHandler struct {
	Bns client.BnsClient
}

func (*TermdepositDepositsHandler) ServeHTTP added in v0.9.0

TermdepositDepositsHandler godoc @Summary Returns a list of bnsd/x/termdeposit Deposit entities. @Description At most one of the query parameters must exist(excluding offset) @Param depositor query string false "Depositor address" @Param contract query string false "Base64 encoded ID" @Param contract_id query int false "Contract ID as integer" @Success 200 {object} json.RawMessage @Failure 404 {object} json.RawMessage @Failure 500 @Router /termdeposit/deposits [get]

type UsernameOwnerHandler

type UsernameOwnerHandler struct {
	Bns client.BnsClient
}

func (*UsernameOwnerHandler) ServeHTTP

func (h *UsernameOwnerHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

UsernameOwnerHandler godoc @Summary Returns a `bnsd/username.Token` entitiy. @Param ownerAddress path string false "Bech32 or hex representation of an address" @Success 200 {object} json.RawMessage @Failure 404 {object} json.RawMessage @Failure 500 {object} json.RawMessage @Router /cash/balances [get]

Jump to

Keyboard shortcuts

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