ports

package
v0.0.0-...-caad1fc Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2024 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

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

Code generated by github.com/deepmap/oapi-codegen version v1.16.3 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 Handler

func Handler(si ServerInterface) http.Handler

Handler creates http.Handler with routing matching OpenAPI spec.

func HandlerFromMux

func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler

HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.

func HandlerFromMuxWithBaseURL

func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler

func HandlerWithOptions

func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler

HandlerWithOptions creates http.Handler with additional options

func PathToRawSpec

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

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

Types

type ChiServerOptions

type ChiServerOptions struct {
	BaseURL          string
	BaseRouter       chi.Router
	Middlewares      []MiddlewareFunc
	ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type CreateWalletJSONRequestBody

type CreateWalletJSONRequestBody = Wallet

CreateWalletJSONRequestBody defines body for CreateWallet for application/json ContentType.

type HttpServer

type HttpServer struct {
	// contains filtered or unexported fields
}

func NewHttpServer

func NewHttpServer(application app.Application) HttpServer

func (HttpServer) CreateWallet

func (s HttpServer) CreateWallet(w http.ResponseWriter, r *http.Request)

CreateWallet handles POST /v1/wallets

func (HttpServer) GetWalletById

func (s HttpServer) GetWalletById(w http.ResponseWriter, r *http.Request, id string)

GetWalletById handles GET /v1/wallets/{id}

type InvalidParamFormatError

type InvalidParamFormatError struct {
	ParamName string
	Err       error
}

func (*InvalidParamFormatError) Error

func (e *InvalidParamFormatError) Error() string

func (*InvalidParamFormatError) Unwrap

func (e *InvalidParamFormatError) Unwrap() error

type MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler

type RequiredHeaderError

type RequiredHeaderError struct {
	ParamName string
	Err       error
}

func (*RequiredHeaderError) Error

func (e *RequiredHeaderError) Error() string

func (*RequiredHeaderError) Unwrap

func (e *RequiredHeaderError) Unwrap() error

type RequiredParamError

type RequiredParamError struct {
	ParamName string
}

func (*RequiredParamError) Error

func (e *RequiredParamError) Error() string

type ServerInterface

type ServerInterface interface {
	// Create a wallet
	// (POST /v1/wallets)
	CreateWallet(w http.ResponseWriter, r *http.Request)
	// Get wallet by ID
	// (GET /v1/wallets/{id})
	GetWalletById(w http.ResponseWriter, r *http.Request, id string)
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandlerFunc   func(w http.ResponseWriter, r *http.Request, err error)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) CreateWallet

func (siw *ServerInterfaceWrapper) CreateWallet(w http.ResponseWriter, r *http.Request)

CreateWallet operation middleware

func (*ServerInterfaceWrapper) GetWalletById

func (siw *ServerInterfaceWrapper) GetWalletById(w http.ResponseWriter, r *http.Request)

GetWalletById operation middleware

type TooManyValuesForParamError

type TooManyValuesForParamError struct {
	ParamName string
	Count     int
}

func (*TooManyValuesForParamError) Error

type UnescapedCookieParamError

type UnescapedCookieParamError struct {
	ParamName string
	Err       error
}

func (*UnescapedCookieParamError) Error

func (e *UnescapedCookieParamError) Error() string

func (*UnescapedCookieParamError) Unwrap

func (e *UnescapedCookieParamError) Unwrap() error

type Unimplemented

type Unimplemented struct{}

func (Unimplemented) CreateWallet

func (_ Unimplemented) CreateWallet(w http.ResponseWriter, r *http.Request)

Create a wallet (POST /v1/wallets)

func (Unimplemented) GetWalletById

func (_ Unimplemented) GetWalletById(w http.ResponseWriter, r *http.Request, id string)

Get wallet by ID (GET /v1/wallets/{id})

type UnmarshalingParamError

type UnmarshalingParamError struct {
	ParamName string
	Err       error
}

func (*UnmarshalingParamError) Error

func (e *UnmarshalingParamError) Error() string

func (*UnmarshalingParamError) Unwrap

func (e *UnmarshalingParamError) Unwrap() error

type Wallet

type Wallet struct {
	Balance float32 `json:"balance"`
	Name    string  `json:"name"`
}

Wallet defines model for Wallet.

type WalletResponse

type WalletResponse struct {
	Balance float32 `json:"balance"`
	Id      string  `json:"id"`
	Name    string  `json:"name"`
}

WalletResponse defines model for WalletResponse.

Jump to

Keyboard shortcuts

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