coffee

package
v0.0.0-...-e3b2a5e Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

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

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

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

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

func ListAllCharacteristic() []string

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 BestCoffees

type BestCoffees struct {
	Characteristics []Characteristic `json:"characteristics"`
	ChatGpt         []Option         `json:"chat_gpt"`
	Database        *[]Option        `json:"database,omitempty"`
}

BestCoffees defines model for BestCoffees.

type Characteristic

type Characteristic string

Characteristic defines model for Characteristic.

const (
	Acidity    Characteristic = "acidity"
	Aftertaste Characteristic = "aftertaste"
	Aroma      Characteristic = "aroma"
	Body       Characteristic = "body"
	Flavor     Characteristic = "flavor"
	Sweetness  Characteristic = "sweetness"
)

Defines values for Characteristic.

func ConvertToCharacteristic

func ConvertToCharacteristic(strs []string) []Characteristic

func (Characteristic) IsValid

func (c Characteristic) IsValid() bool

func (Characteristic) String

func (c Characteristic) String() string

type ChiServerOptions

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

type Error

type Error struct {
	Code    int32  `json:"code"`
	Message string `json:"message"`
}

Error defines model for Error.

type Filter

type Filter struct {
	Characteristics []Characteristic
	Limit           int
	Sort            bool // 0 = desc - 1 = asc
}

type GetBestTypeCoffeeParams

type GetBestTypeCoffeeParams struct {
	// Characteristics Characteristics to build your best type of coffee, up to 3 selected characteristics.
	Characteristics []Characteristic `form:"characteristics" json:"characteristics"`
}

GetBestTypeCoffeeParams defines parameters for GetBestTypeCoffee.

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 Option

type Option struct {
	Details *map[string]interface{} `json:"details,omitempty"`
	Message string                  `json:"message"`
}

Option defines model for Option.

type OptionProvider

type OptionProvider struct {
	Message string
	Details interface{}
}

OptionProvider mean a selected option coffee

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 {
	// Get the right type of coffee
	// (GET /v1/best-coffees)
	GetBestTypeCoffee(w http.ResponseWriter, r *http.Request, params GetBestTypeCoffeeParams)
}

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) GetBestTypeCoffee

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

GetBestTypeCoffee operation middleware

type Service

type Service interface {
	GetCoffeeOptionsByCharacteristics(context.Context, Filter) ([]OptionProvider, error)
}

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 UnmarshallingParamError

type UnmarshallingParamError struct {
	ParamName string
	Err       error
}

func (*UnmarshallingParamError) Error

func (e *UnmarshallingParamError) Error() string

func (*UnmarshallingParamError) Unwrap

func (e *UnmarshallingParamError) Unwrap() error

type UseCase

type UseCase interface {
	GetBestCoffees(context.Context, Filter) (*BestCoffees, error)
}

UseCase the use-cases/business rules layer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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