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: 18 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 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 Controller

type Controller struct {
	Service service.TokenService
}

func (Controller) Healthz

(GET /healthz)

func (Controller) Issue

Issue tokens to an account (POST /issue)

func (Controller) Readyz

(GET /readyz)

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 Issue200JSONResponse

type Issue200JSONResponse struct{ IssueSuccessJSONResponse }

func (Issue200JSONResponse) VisitIssueResponse

func (response Issue200JSONResponse) VisitIssueResponse(w http.ResponseWriter) error

type IssueJSONRequestBody

type IssueJSONRequestBody = TransferRequest

IssueJSONRequestBody defines body for Issue for application/json ContentType.

type IssueRequestObject

type IssueRequestObject struct {
	Body *IssueJSONRequestBody
}

type IssueResponseObject

type IssueResponseObject interface {
	VisitIssueResponse(w http.ResponseWriter) error
}

type IssueSuccess

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

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

IssueSuccess defines model for IssueSuccess.

type IssueSuccessJSONResponse

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

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

type IssuedefaultJSONResponse

type IssuedefaultJSONResponse struct {
	Body       Error
	StatusCode int
}

func (IssuedefaultJSONResponse) VisitIssueResponse

func (response IssuedefaultJSONResponse) VisitIssueResponse(w http.ResponseWriter) error

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 /healthz)
	Healthz(ctx echo.Context) error
	// Issue tokens to an account
	// (POST /issuer/issue)
	Issue(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) Healthz

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

Healthz converts echo context to params.

func (*ServerInterfaceWrapper) Issue

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

Issue 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 /healthz)
	Healthz(ctx context.Context, request HealthzRequestObject) (HealthzResponseObject, error)
	// Issue tokens to an account
	// (POST /issuer/issue)
	Issue(ctx context.Context, request IssueRequestObject) (IssueResponseObject, error)

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

StrictServerInterface represents all server handlers.

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

Jump to

Keyboard shortcuts

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