handlers

package
v1.1.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const PaginationMaxItems = 50

paginationMaxItems defines how many items should a single result return. This values should not be greater than orm.queryRangeLimit so that each query returns enough results.

Variables

This section is empty.

Functions

func AtMostOne added in v0.21.4

func AtMostOne(query url.Values, names ...string) bool

AtMostOne returns true if at most one non empty value from given list of names exists in the query.

func EncodeSequence added in v0.21.4

func EncodeSequence(val uint64) []byte

func ExtractIDFromKey added in v1.1.5

func ExtractIDFromKey(key string) []byte

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.

func LastChunk added in v0.21.4

func LastChunk(path string) string

LastChunk returns last path chunk - everything after the last `/` character. For example LAST in /foo/bar/LAST and empty string in /foo/bar/

func NextKeyValue added in v0.21.4

func NextKeyValue(b []byte) []byte

func WeaveAddressFromQuery added in v0.21.4

func WeaveAddressFromQuery(rawAddr string) (weave.Address, error)

Types

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 @Tags Status @Param blockHeight path int true "Block Height" @Success 200 @Failure 404 @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 balance in IOV Token of the given iov address @Description The iov address may be in the bech32 (iov....) or hex (ON3LK...) format. @Tags IOV token @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 @Failure 404 @Failure 500 @Router /cash/balances [get]

type DefaultHandler

type DefaultHandler struct{}

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 all the smart contract Escrows. @Description At most one of the query parameters must exist(excluding offset) @Tags IOV token @Param offset query string false "Iteration offset" @Param source query string false "Source address" @Param destination query string false "Destination address" @Success 200 @Failure 404 @Failure 400 @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
}

func (*GovProposalsHandler) ServeHTTP

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

GovProposalsHandler godoc @Summary Returns a list of x/gov Votes entities. @Description At most one of the query parameters must exist(excluding offset) @Tags Governance @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 @Failure 404 @Failure 400 @Failure 500 @Router /gov/proposals [get]

type GovVotesHandler

type GovVotesHandler struct {
	Bns client.BnsClient
}

func (*GovVotesHandler) ServeHTTP

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

GovVotesHandler godoc @Summary Returns a list of Votes made on the governance. @Description At most one of the query parameters must exist(excluding offset) @Tags Governance @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 @Failure 404 @Failure 400 @Failure 500 @Router /gov/votes [get]

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`. @Tags Status @Success 200 @Router /info/ [get]

type KeyValue

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

type MultipleObjectsResponse added in v0.21.4

type MultipleObjectsResponse struct {
	Objects []KeyValue `json:"objects"`
}

type MultisigContractsHandler

type MultisigContractsHandler struct {
	Bns client.BnsClient
}

func (*MultisigContractsHandler) ServeHTTP

MultisigContractsHandler godoc @Summary Returns a list of all the multisig Contracts. @Description At most one of the query parameters must exist(excluding offset) @Tags IOV token @Param offset query string false "Iteration offset" @Success 200 @Failure 404 @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 entities. @Description The term deposit Contract are the contract defining the dates until which one can deposit. @Tags IOV token @Param offset query string false "Pagination offset" @Success 200 {object} handlers.MultipleObjectsResponse @Failure 404 @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 (individual deposits). @Description At most one of the query parameters must exist (excluding offset). @Description The query may be filtered by Depositor, in which case it returns all the deposits from the Depositor. @Description The query may be filtered by Deposit Contract, in which case it returns all the deposits from this Contract. @Description The query may be filtered by Contract ID, in which case it returns the deposits from the Deposit Contract with this ID. @Tags IOV token @Param depositor query string false "Depositor address in bech32 (iov1c9eprq0gxdmwl9u25j568zj7ylqgc7ajyu8wxr) or hex(C1721181E83376EF978AA4A9A38A5E27C08C7BB2)" @Param contract query string false "Base64 encoded ID" @Param contract_id query int false "Contract ID as integer" @Success 200 {object} handlers.MultipleObjectsResponse @Failure 404 @Failure 500 @Router /termdeposit/deposits [get]

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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