routes

package
v0.0.0-...-179bc96 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package routes provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen version v1.13.4 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSwagger

func GetSwagger() (swagger *openapi3.T, err error)

GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.

func PathToRawSpec

func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)

Constructs a synthetic filesystem for resolving external references when loading openapi specifications.

func RegisterHandlers

func RegisterHandlers(router EchoRouter, si ServerInterface)

RegisterHandlers adds each server route to the EchoRouter.

func RegisterHandlersWithBaseURL

func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string)

Registers handlers, and prepends BaseURL to the paths, so that the paths can be served under a prefix.

func StartWebServer

func StartWebServer(port string, routesImplementation StrictServerInterface, logger Logger) error

Start web server on the main thread. It exits the application if it fails setting up.

Types

type Account

type Account struct {
	// Balance balance in base units for each currency
	Balance []Amount `json:"balance"`

	// Id account id as registered at the Certificate Authority
	Id string `json:"id"`
}

Account Information about an account and its balance

type AccountSuccess

type AccountSuccess struct {
	Message string `json:"message"`

	// Payload Information about an account and its balance
	Payload Account `json:"payload"`
}

AccountSuccess defines model for AccountSuccess.

type AccountSuccessJSONResponse

type AccountSuccessJSONResponse struct {
	Message string `json:"message"`

	// Payload Information about an account and its balance
	Payload Account `json:"payload"`
}

type AccountsSuccess

type AccountsSuccess struct {
	Message string    `json:"message"`
	Payload []Account `json:"payload"`
}

AccountsSuccess defines model for AccountsSuccess.

type AccountsSuccessJSONResponse

type AccountsSuccessJSONResponse struct {
	Message string    `json:"message"`
	Payload []Account `json:"payload"`
}

type Amount

type Amount struct {
	// Code the code of the token
	Code string `json:"code"`

	// Value value in base units (usually cents)
	Value int64 `json:"value"`
}

Amount The amount to issue, transfer or redeem.

type Code

type Code = string

Code The token code to filter on

type Controller

type Controller struct {
	Service service.TokenService
}

func (Controller) Healthz

(GET /healthz)

func (Controller) OwnerAccount

Get an account and their balances (GET /owner/accounts/{id})

func (Controller) OwnerAccounts

Get all accounts on this node and their balances (GET /owner/accounts)

func (Controller) OwnerTransactions

Get all transactions for an account (GET /owner/accounts/{id}/transactions)

func (Controller) Readyz

(GET /readyz)

func (Controller) Redeem

Redeem (burn) tokens (POST /owner/accounts/{id}/redeem)

func (Controller) Transfer

Transfer tokens to another account (POST /owner/accounts/{id}/transfer)

type Counterparty

type Counterparty struct {
	Account string `json:"account"`

	// Node The node that holds the recipient account
	Node string `json:"node"`
}

Counterparty The counterparty in a Transfer or Issuance transaction.

type EchoRouter

type EchoRouter interface {
	CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
}

This is a simple interface which specifies echo.Route addition functions which are present on both echo.Echo and echo.Group, since we want to allow using either of them for path registration

type Error

type Error struct {
	// Message High level error message
	Message string `json:"message"`

	// Payload Details about the error
	Payload string `json:"payload"`
}

Error defines model for Error.

type ErrorResponse

type ErrorResponse = Error

ErrorResponse defines model for ErrorResponse.

type ErrorResponseJSONResponse

type ErrorResponseJSONResponse Error

type HealthSuccess

type HealthSuccess struct {
	// Message ok
	Message string `json:"message"`
}

HealthSuccess defines model for HealthSuccess.

type HealthSuccessJSONResponse

type HealthSuccessJSONResponse struct {
	// Message ok
	Message string `json:"message"`
}

type Healthz200JSONResponse

type Healthz200JSONResponse struct{ HealthSuccessJSONResponse }

func (Healthz200JSONResponse) VisitHealthzResponse

func (response Healthz200JSONResponse) VisitHealthzResponse(w http.ResponseWriter) error

type Healthz503JSONResponse

type Healthz503JSONResponse struct{ ErrorResponseJSONResponse }

func (Healthz503JSONResponse) VisitHealthzResponse

func (response Healthz503JSONResponse) VisitHealthzResponse(w http.ResponseWriter) error

type HealthzRequestObject

type HealthzRequestObject struct {
}

type HealthzResponseObject

type HealthzResponseObject interface {
	VisitHealthzResponse(w http.ResponseWriter) error
}

type Id

type Id = string

Id account id as registered at the Certificate Authority

type Logger

type Logger interface {
	Infof(template string, args ...interface{})
	Debugf(template string, args ...interface{})
	Warnf(template string, args ...interface{})
	Errorf(template string, args ...interface{})
	Fatalf(template string, args ...interface{})
}

type OperationsAPI

type OperationsAPI struct{}

type OwnerAccount200JSONResponse

type OwnerAccount200JSONResponse struct{ AccountSuccessJSONResponse }

func (OwnerAccount200JSONResponse) VisitOwnerAccountResponse

func (response OwnerAccount200JSONResponse) VisitOwnerAccountResponse(w http.ResponseWriter) error

type OwnerAccountParams

type OwnerAccountParams struct {
	Code *Code `form:"code,omitempty" json:"code,omitempty"`
}

OwnerAccountParams defines parameters for OwnerAccount.

type OwnerAccountRequestObject

type OwnerAccountRequestObject struct {
	Id     Id `json:"id"`
	Params OwnerAccountParams
}

type OwnerAccountResponseObject

type OwnerAccountResponseObject interface {
	VisitOwnerAccountResponse(w http.ResponseWriter) error
}

type OwnerAccountdefaultJSONResponse

type OwnerAccountdefaultJSONResponse struct {
	Body       Error
	StatusCode int
}

func (OwnerAccountdefaultJSONResponse) VisitOwnerAccountResponse

func (response OwnerAccountdefaultJSONResponse) VisitOwnerAccountResponse(w http.ResponseWriter) error

type OwnerAccounts200JSONResponse

type OwnerAccounts200JSONResponse struct{ AccountsSuccessJSONResponse }

func (OwnerAccounts200JSONResponse) VisitOwnerAccountsResponse

func (response OwnerAccounts200JSONResponse) VisitOwnerAccountsResponse(w http.ResponseWriter) error

type OwnerAccountsRequestObject

type OwnerAccountsRequestObject struct {
}

type OwnerAccountsResponseObject

type OwnerAccountsResponseObject interface {
	VisitOwnerAccountsResponse(w http.ResponseWriter) error
}

type OwnerAccountsdefaultJSONResponse

type OwnerAccountsdefaultJSONResponse struct {
	Body       Error
	StatusCode int
}

func (OwnerAccountsdefaultJSONResponse) VisitOwnerAccountsResponse

func (response OwnerAccountsdefaultJSONResponse) VisitOwnerAccountsResponse(w http.ResponseWriter) error

type OwnerTransactions200JSONResponse

type OwnerTransactions200JSONResponse struct {
	TransactionsSuccessJSONResponse
}

func (OwnerTransactions200JSONResponse) VisitOwnerTransactionsResponse

func (response OwnerTransactions200JSONResponse) VisitOwnerTransactionsResponse(w http.ResponseWriter) error

type OwnerTransactionsRequestObject

type OwnerTransactionsRequestObject struct {
	Id Id `json:"id"`
}

type OwnerTransactionsResponseObject

type OwnerTransactionsResponseObject interface {
	VisitOwnerTransactionsResponse(w http.ResponseWriter) error
}

type OwnerTransactionsdefaultJSONResponse

type OwnerTransactionsdefaultJSONResponse struct {
	Body       Error
	StatusCode int
}

func (OwnerTransactionsdefaultJSONResponse) VisitOwnerTransactionsResponse

func (response OwnerTransactionsdefaultJSONResponse) VisitOwnerTransactionsResponse(w http.ResponseWriter) error

type Readyz200JSONResponse

type Readyz200JSONResponse struct{ HealthSuccessJSONResponse }

func (Readyz200JSONResponse) VisitReadyzResponse

func (response Readyz200JSONResponse) VisitReadyzResponse(w http.ResponseWriter) error

type Readyz503JSONResponse

type Readyz503JSONResponse struct{ ErrorResponseJSONResponse }

func (Readyz503JSONResponse) VisitReadyzResponse

func (response Readyz503JSONResponse) VisitReadyzResponse(w http.ResponseWriter) error

type ReadyzRequestObject

type ReadyzRequestObject struct {
}

type ReadyzResponseObject

type ReadyzResponseObject interface {
	VisitReadyzResponse(w http.ResponseWriter) error
}

type Redeem200JSONResponse

type Redeem200JSONResponse struct{ RedeemSuccessJSONResponse }

func (Redeem200JSONResponse) VisitRedeemResponse

func (response Redeem200JSONResponse) VisitRedeemResponse(w http.ResponseWriter) error

type RedeemJSONRequestBody

type RedeemJSONRequestBody = RedeemRequest

RedeemJSONRequestBody defines body for Redeem for application/json ContentType.

type RedeemRequest

type RedeemRequest struct {
	// Amount The amount to issue, transfer or redeem.
	Amount Amount `json:"amount"`

	// Message optional message that will be visible to the auditor
	Message *string `json:"message,omitempty"`
}

RedeemRequest Instructions to redeem tokens from an account

type RedeemRequestObject

type RedeemRequestObject struct {
	Id   Id `json:"id"`
	Body *RedeemJSONRequestBody
}

type RedeemResponseObject

type RedeemResponseObject interface {
	VisitRedeemResponse(w http.ResponseWriter) error
}

type RedeemSuccess

type RedeemSuccess struct {
	Message string `json:"message"`

	// Payload Transaction id
	Payload string `json:"payload"`
}

RedeemSuccess defines model for RedeemSuccess.

type RedeemSuccessJSONResponse

type RedeemSuccessJSONResponse struct {
	Message string `json:"message"`

	// Payload Transaction id
	Payload string `json:"payload"`
}

type RedeemdefaultJSONResponse

type RedeemdefaultJSONResponse struct {
	Body       Error
	StatusCode int
}

func (RedeemdefaultJSONResponse) VisitRedeemResponse

func (response RedeemdefaultJSONResponse) VisitRedeemResponse(w http.ResponseWriter) error

type ServerInterface

type ServerInterface interface {

	// (GET /healthz)
	Healthz(ctx echo.Context) error
	// Get all accounts on this node and their balances
	// (GET /owner/accounts)
	OwnerAccounts(ctx echo.Context) error
	// Get an account and their balances
	// (GET /owner/accounts/{id})
	OwnerAccount(ctx echo.Context, id Id, params OwnerAccountParams) error
	// Redeem (burn) tokens
	// (POST /owner/accounts/{id}/redeem)
	Redeem(ctx echo.Context, id Id) error
	// Get all transactions for an account
	// (GET /owner/accounts/{id}/transactions)
	OwnerTransactions(ctx echo.Context, id Id) error
	// Transfer tokens to another account
	// (POST /owner/accounts/{id}/transfer)
	Transfer(ctx echo.Context, id Id) error

	// (GET /readyz)
	Readyz(ctx echo.Context) error
}

ServerInterface represents all server handlers.

func NewStrictHandler

func NewStrictHandler(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc) ServerInterface

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler ServerInterface
}

ServerInterfaceWrapper converts echo contexts to parameters.

func (*ServerInterfaceWrapper) Healthz

func (w *ServerInterfaceWrapper) Healthz(ctx echo.Context) error

Healthz converts echo context to params.

func (*ServerInterfaceWrapper) OwnerAccount

func (w *ServerInterfaceWrapper) OwnerAccount(ctx echo.Context) error

OwnerAccount converts echo context to params.

func (*ServerInterfaceWrapper) OwnerAccounts

func (w *ServerInterfaceWrapper) OwnerAccounts(ctx echo.Context) error

OwnerAccounts converts echo context to params.

func (*ServerInterfaceWrapper) OwnerTransactions

func (w *ServerInterfaceWrapper) OwnerTransactions(ctx echo.Context) error

OwnerTransactions converts echo context to params.

func (*ServerInterfaceWrapper) Readyz

func (w *ServerInterfaceWrapper) Readyz(ctx echo.Context) error

Readyz converts echo context to params.

func (*ServerInterfaceWrapper) Redeem

func (w *ServerInterfaceWrapper) Redeem(ctx echo.Context) error

Redeem converts echo context to params.

func (*ServerInterfaceWrapper) Transfer

func (w *ServerInterfaceWrapper) Transfer(ctx echo.Context) error

Transfer converts echo context to params.

type StrictHandlerFunc

type StrictHandlerFunc = runtime.StrictEchoHandlerFunc

type StrictMiddlewareFunc

type StrictMiddlewareFunc = runtime.StrictEchoMiddlewareFunc

type StrictServerInterface

type StrictServerInterface interface {

	// (GET /healthz)
	Healthz(ctx context.Context, request HealthzRequestObject) (HealthzResponseObject, error)
	// Get all accounts on this node and their balances
	// (GET /owner/accounts)
	OwnerAccounts(ctx context.Context, request OwnerAccountsRequestObject) (OwnerAccountsResponseObject, error)
	// Get an account and their balances
	// (GET /owner/accounts/{id})
	OwnerAccount(ctx context.Context, request OwnerAccountRequestObject) (OwnerAccountResponseObject, error)
	// Redeem (burn) tokens
	// (POST /owner/accounts/{id}/redeem)
	Redeem(ctx context.Context, request RedeemRequestObject) (RedeemResponseObject, error)
	// Get all transactions for an account
	// (GET /owner/accounts/{id}/transactions)
	OwnerTransactions(ctx context.Context, request OwnerTransactionsRequestObject) (OwnerTransactionsResponseObject, error)
	// Transfer tokens to another account
	// (POST /owner/accounts/{id}/transfer)
	Transfer(ctx context.Context, request TransferRequestObject) (TransferResponseObject, error)

	// (GET /readyz)
	Readyz(ctx context.Context, request ReadyzRequestObject) (ReadyzResponseObject, error)
}

StrictServerInterface represents all server handlers.

type TransactionRecord

type TransactionRecord struct {
	// Amount The amount to issue, transfer or redeem.
	Amount Amount `json:"amount"`

	// Id transaction id
	Id string `json:"id"`

	// Message user provided message
	Message string `json:"message"`

	// Recipient the recipient of the transaction
	Recipient string `json:"recipient"`

	// Sender the sender of the transaction
	Sender string `json:"sender"`

	// Status Unknown | Pending | Confirmed | Deleted
	Status string `json:"status"`

	// Timestamp timestamp in the format: "2018-03-20T09:12:28Z"
	Timestamp time.Time `json:"timestamp"`
}

TransactionRecord A transaction

type TransactionsSuccess

type TransactionsSuccess struct {
	Message string              `json:"message"`
	Payload []TransactionRecord `json:"payload"`
}

TransactionsSuccess defines model for TransactionsSuccess.

type TransactionsSuccessJSONResponse

type TransactionsSuccessJSONResponse struct {
	Message string              `json:"message"`
	Payload []TransactionRecord `json:"payload"`
}

type Transfer200JSONResponse

type Transfer200JSONResponse struct{ TransferSuccessJSONResponse }

func (Transfer200JSONResponse) VisitTransferResponse

func (response Transfer200JSONResponse) VisitTransferResponse(w http.ResponseWriter) error

type TransferJSONRequestBody

type TransferJSONRequestBody = TransferRequest

TransferJSONRequestBody defines body for Transfer for application/json ContentType.

type TransferRequest

type TransferRequest struct {
	// Amount The amount to issue, transfer or redeem.
	Amount Amount `json:"amount"`

	// Counterparty The counterparty in a Transfer or Issuance transaction.
	Counterparty Counterparty `json:"counterparty"`

	// Message optional message that will be sent and stored with the transfer transaction
	Message *string `json:"message,omitempty"`
}

TransferRequest Instructions to issue or transfer tokens to an account

type TransferRequestObject

type TransferRequestObject struct {
	Id   Id `json:"id"`
	Body *TransferJSONRequestBody
}

type TransferResponseObject

type TransferResponseObject interface {
	VisitTransferResponse(w http.ResponseWriter) error
}

type TransferSuccess

type TransferSuccess struct {
	Message string `json:"message"`

	// Payload Transaction id
	Payload string `json:"payload"`
}

TransferSuccess defines model for TransferSuccess.

type TransferSuccessJSONResponse

type TransferSuccessJSONResponse struct {
	Message string `json:"message"`

	// Payload Transaction id
	Payload string `json:"payload"`
}

type TransferdefaultJSONResponse

type TransferdefaultJSONResponse struct {
	Body       Error
	StatusCode int
}

func (TransferdefaultJSONResponse) VisitTransferResponse

func (response TransferdefaultJSONResponse) VisitTransferResponse(w http.ResponseWriter) error

Jump to

Keyboard shortcuts

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