routes

package
v0.0.0-...-2fa83c9 Latest Latest
Warning

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

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

Documentation

Overview

Package auditor 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 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 AuditorAccount200JSONResponse

type AuditorAccount200JSONResponse struct{ AccountSuccessJSONResponse }

func (AuditorAccount200JSONResponse) VisitAuditorAccountResponse

func (response AuditorAccount200JSONResponse) VisitAuditorAccountResponse(w http.ResponseWriter) error

type AuditorAccountParams

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

AuditorAccountParams defines parameters for AuditorAccount.

type AuditorAccountRequestObject

type AuditorAccountRequestObject struct {
	Id     Id `json:"id"`
	Params AuditorAccountParams
}

type AuditorAccountResponseObject

type AuditorAccountResponseObject interface {
	VisitAuditorAccountResponse(w http.ResponseWriter) error
}

type AuditorAccountdefaultJSONResponse

type AuditorAccountdefaultJSONResponse struct {
	Body       Error
	StatusCode int
}

func (AuditorAccountdefaultJSONResponse) VisitAuditorAccountResponse

func (response AuditorAccountdefaultJSONResponse) VisitAuditorAccountResponse(w http.ResponseWriter) error

type AuditorTransactions200JSONResponse

type AuditorTransactions200JSONResponse struct {
	TransactionsSuccessJSONResponse
}

func (AuditorTransactions200JSONResponse) VisitAuditorTransactionsResponse

func (response AuditorTransactions200JSONResponse) VisitAuditorTransactionsResponse(w http.ResponseWriter) error

type AuditorTransactionsRequestObject

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

type AuditorTransactionsResponseObject

type AuditorTransactionsResponseObject interface {
	VisitAuditorTransactionsResponse(w http.ResponseWriter) error
}

type AuditorTransactionsdefaultJSONResponse

type AuditorTransactionsdefaultJSONResponse struct {
	Body       Error
	StatusCode int
}

func (AuditorTransactionsdefaultJSONResponse) VisitAuditorTransactionsResponse

func (response AuditorTransactionsdefaultJSONResponse) VisitAuditorTransactionsResponse(w http.ResponseWriter) error

type Code

type Code = string

Code The token code to filter on

type Controller

type Controller struct {
	Service service.TokenService
}

func (Controller) AuditorAccount

Get an account and their balance of a certain type (GET /auditor/accounts/{id})

func (Controller) AuditorTransactions

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

func (Controller) Healthz

(GET /healthz)

func (Controller) Readyz

(GET /readyz)

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 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 ServerInterface

type ServerInterface interface {
	// Get an account and their balance of a certain type
	// (GET /auditor/accounts/{id})
	AuditorAccount(ctx echo.Context, id Id, params AuditorAccountParams) error
	// Get all transactions for an account
	// (GET /auditor/accounts/{id}/transactions)
	AuditorTransactions(ctx echo.Context, id Id) error

	// (GET /healthz)
	Healthz(ctx echo.Context) 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) AuditorAccount

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

AuditorAccount converts echo context to params.

func (*ServerInterfaceWrapper) AuditorTransactions

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

AuditorTransactions converts echo context to params.

func (*ServerInterfaceWrapper) Healthz

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

Healthz converts echo context to params.

func (*ServerInterfaceWrapper) Readyz

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

Readyz converts echo context to params.

type StrictHandlerFunc

type StrictHandlerFunc = runtime.StrictEchoHandlerFunc

type StrictMiddlewareFunc

type StrictMiddlewareFunc = runtime.StrictEchoMiddlewareFunc

type StrictServerInterface

type StrictServerInterface interface {
	// Get an account and their balance of a certain type
	// (GET /auditor/accounts/{id})
	AuditorAccount(ctx context.Context, request AuditorAccountRequestObject) (AuditorAccountResponseObject, error)
	// Get all transactions for an account
	// (GET /auditor/accounts/{id}/transactions)
	AuditorTransactions(ctx context.Context, request AuditorTransactionsRequestObject) (AuditorTransactionsResponseObject, error)

	// (GET /healthz)
	Healthz(ctx context.Context, request HealthzRequestObject) (HealthzResponseObject, 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"`
}

Jump to

Keyboard shortcuts

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