handlers

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2019 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Overview

Package handlers handles and helps specify the algod/api

Currently, server implementation annotations serve as the API ground truth. From that, we use go-swagger to generate a swagger spec.

IF YOU MODIFY THIS PACKAGE: IMPORTANT MAKE SURE YOU REGENERATE THE SWAGGER SPEC (using go:generate) MAKE SURE IT VALIDATES

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccountInformation

func AccountInformation(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)

AccountInformation is an httpHandler for route GET /v1/account/{addr:[A-Z0-9]{KeyLength}}

func AssetInformation

func AssetInformation(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)

AssetInformation is an httpHandler for route GET /v1/asset/{index:[0-9]+}

func Assets

func Assets(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)

Assets is an httpHandler for route GET /v1/assets

func GetBlock

func GetBlock(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)

GetBlock is an httpHandler for route GET /v1/block/{round}

func GetPendingTransactions

func GetPendingTransactions(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)

GetPendingTransactions is an httpHandler for route GET /v1/transactions/pending.

func GetPendingTransactionsByAddress

func GetPendingTransactionsByAddress(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)

GetPendingTransactionsByAddress is an httpHandler for route GET /v1/account/addr:[A-Z0-9]{KeyLength}}/transactions/pending.

func GetSupply

func GetSupply(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)

GetSupply is an httpHandler for route GET /v1/ledger/supply

func GetTransactionByID

func GetTransactionByID(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)

GetTransactionByID is an httpHandler for route GET /v1/transaction/{txid}

func PendingTransactionInformation

func PendingTransactionInformation(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)

PendingTransactionInformation is an httpHandler for route GET /v1/transactions/pending/{txid:[A-Z0-9]+}

func RawTransaction

func RawTransaction(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)

RawTransaction is an httpHandler for route POST /v1/transactions

func SendJSON

func SendJSON(obj Response, w http.ResponseWriter, log logging.Logger)

SendJSON is like writeJSON, but it writes to the log instead of returning an error. The caller must ensure that no writes to w happen after this function is called. Unwraps a Response object and converts it to an HTTP Response.

func Status

func Status(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)

Status is an httpHandler for route GET /v1/status

func SuggestedFee

func SuggestedFee(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)

SuggestedFee is an httpHandler for route GET /v1/transactions/fee

func SuggestedParams

func SuggestedParams(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)

SuggestedParams is an httpHandler for route GET /v1/transactions/params

func TransactionInformation

func TransactionInformation(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)

TransactionInformation is an httpHandler for route GET /v1/account/{addr:[A-Z0-9]{KeyLength}}/transaction/{txid:[A-Z0-9]+}

func Transactions

func Transactions(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)

Transactions is an httpHandler for route GET /v1/account/{addr:[A-Z0-9]+}/transactions

func WaitForBlock

func WaitForBlock(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)

WaitForBlock is an httpHandler for route GET /v1/status/wait-for-block-after/{round:[0-9]+}

Types

type AccountInformationResponse

type AccountInformationResponse struct {
	// in: body
	Body *v1.Account
}

AccountInformationResponse contains an account information

swagger:response AccountInformationResponse

type AssetInformationResponse

type AssetInformationResponse struct {
	// in: body
	Body *v1.AssetParams
}

AssetInformationResponse contains asset information

swagger:response AssetInformationResponse

type AssetsResponse

type AssetsResponse struct {
	// in: body
	Body *v1.AssetList
}

AssetsResponse contains a list of assets

swagger:response AssetsResponse

type BlockResponse

type BlockResponse struct {
	// in: body
	Body *v1.Block
}

BlockResponse contains block information

swagger:response BlockResponse

type PendingTransactionsResponse

type PendingTransactionsResponse struct {
	// in: body
	Body *v1.PendingTransactions
}

PendingTransactionsResponse contains a (potentially truncated) list of transactions and the total number of transactions currently in the pool.

swagger:response PendingTransactionsResponse

type Response

type Response interface {
	// contains filtered or unexported methods
}

Response is a generic interface wrapping any data returned by the server. We wrap every type in a Response type so that we can swagger annotate them.

Each response must have a Body (a payload). We write an interface for this because it better mirrors the go-swagger annotation style (which requires swagger colon responses to have an embedded body struct of the actual data to be sent. of course, they can also have headers and the sort.) Anything implementing the Response interface will naturally be able to be annotated by swagger:response. This also allows package functions to naturally unwrap Response types and send the underlying Body through another interface (e.g. an http.ResponseWriter)

type StatusResponse

type StatusResponse struct {
	// in: body
	Body *v1.NodeStatus
}

StatusResponse contains the node's status information

swagger:response StatusResponse

type SupplyResponse

type SupplyResponse struct {
	// in: body
	Body *v1.Supply
}

SupplyResponse contains the ledger supply information

swagger:response SupplyResponse

type TransactionFeeResponse

type TransactionFeeResponse struct {
	// in: body
	Body *v1.TransactionFee
}

TransactionFeeResponse contains a suggested fee

swagger:response TransactionFeeResponse

type TransactionIDResponse

type TransactionIDResponse struct {
	// in: body
	Body *v1.TransactionID
}

TransactionIDResponse contains a transaction information

swagger:response TransactionIDResponse

type TransactionParamsResponse

type TransactionParamsResponse struct {
	// in: body
	Body *v1.TransactionParams
}

TransactionParamsResponse contains the parameters for constructing a new transaction.

swagger:response TransactionParamsResponse

type TransactionResponse

type TransactionResponse struct {
	// in: body
	Body *v1.Transaction
}

TransactionResponse contains a transaction information

swagger:response TransactionResponse

type TransactionsResponse

type TransactionsResponse struct {
	// in: body
	Body *v1.TransactionList
}

TransactionsResponse contains a list of transactions

swagger:response TransactionsResponse

Jump to

Keyboard shortcuts

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