Documentation ¶
Index ¶
- func BuildPickPayload(sommelierPickBody string) (*sommelier.Criteria, error)
- func DecodePickResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (any, error)
- func EncodePickRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, any) error
- func NewPickNoCriteria(body string) sommelier.NoCriteria
- func NewPickNoMatch(body string) sommelier.NoMatch
- func NewPickStoredBottleCollectionOK(body PickResponseBody) sommelierviews.StoredBottleCollectionView
- func PickSommelierPath() string
- func ValidateComponentResponse(body *ComponentResponse) (err error)
- func ValidateStoredBottleResponse(body *StoredBottleResponse) (err error)
- func ValidateWineryResponse(body *WineryResponse) (err error)
- type Client
- type ComponentResponse
- type PickRequestBody
- type PickResponseBody
- type StoredBottleResponse
- type WineryResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildPickPayload ¶
BuildPickPayload builds the payload for the sommelier pick endpoint from CLI flags.
func DecodePickResponse ¶
func DecodePickResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (any, error)
DecodePickResponse returns a decoder for responses returned by the sommelier pick endpoint. restoreBody controls whether the response body should be restored after having been read. DecodePickResponse may return the following errors:
- "no_criteria" (type sommelier.NoCriteria): http.StatusBadRequest
- "no_match" (type sommelier.NoMatch): http.StatusNotFound
- error: internal error
func EncodePickRequest ¶
EncodePickRequest returns an encoder for requests sent to the sommelier pick server.
func NewPickNoCriteria ¶
func NewPickNoCriteria(body string) sommelier.NoCriteria
NewPickNoCriteria builds a sommelier service pick endpoint no_criteria error.
func NewPickNoMatch ¶
NewPickNoMatch builds a sommelier service pick endpoint no_match error.
func NewPickStoredBottleCollectionOK ¶
func NewPickStoredBottleCollectionOK(body PickResponseBody) sommelierviews.StoredBottleCollectionView
NewPickStoredBottleCollectionOK builds a "sommelier" service "pick" endpoint result from a HTTP "OK" response.
func PickSommelierPath ¶
func PickSommelierPath() string
PickSommelierPath returns the URL path to the sommelier service pick HTTP endpoint.
func ValidateComponentResponse ¶
func ValidateComponentResponse(body *ComponentResponse) (err error)
ValidateComponentResponse runs the validations defined on ComponentResponse
func ValidateStoredBottleResponse ¶
func ValidateStoredBottleResponse(body *StoredBottleResponse) (err error)
ValidateStoredBottleResponse runs the validations defined on StoredBottleResponse
func ValidateWineryResponse ¶
func ValidateWineryResponse(body *WineryResponse) (err error)
ValidateWineryResponse runs the validations defined on WineryResponse
Types ¶
type Client ¶
type Client struct { // Pick Doer is the HTTP client used to make requests to the pick endpoint. PickDoer goahttp.Doer // RestoreResponseBody controls whether the response bodies are reset after // decoding so they can be read again. RestoreResponseBody bool // contains filtered or unexported fields }
Client lists the sommelier service endpoint HTTP clients.
func NewClient ¶
func NewClient( scheme string, host string, doer goahttp.Doer, enc func(*http.Request) goahttp.Encoder, dec func(*http.Response) goahttp.Decoder, restoreBody bool, ) *Client
NewClient instantiates HTTP clients for all the sommelier service servers.
func (*Client) BuildPickRequest ¶
BuildPickRequest instantiates a HTTP request object with method and path set to call the "sommelier" service "pick" endpoint
type ComponentResponse ¶
type ComponentResponse struct { // Grape varietal Varietal *string `form:"varietal,omitempty" json:"varietal,omitempty" xml:"varietal,omitempty"` // Percentage of varietal in wine Percentage *uint32 `form:"percentage,omitempty" json:"percentage,omitempty" xml:"percentage,omitempty"` }
ComponentResponse is used to define fields on response body types.
type PickRequestBody ¶
type PickRequestBody struct { // Name of bottle to pick Name *string `form:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"` // Varietals in preference order Varietal []string `form:"varietal,omitempty" json:"varietal,omitempty" xml:"varietal,omitempty"` // Winery of bottle to pick Winery *string `form:"winery,omitempty" json:"winery,omitempty" xml:"winery,omitempty"` }
PickRequestBody is the type of the "sommelier" service "pick" endpoint HTTP request body.
func NewPickRequestBody ¶
func NewPickRequestBody(p *sommelier.Criteria) *PickRequestBody
NewPickRequestBody builds the HTTP request body from the payload of the "pick" endpoint of the "sommelier" service.
type PickResponseBody ¶
type PickResponseBody []*StoredBottleResponse
PickResponseBody is the type of the "sommelier" service "pick" endpoint HTTP response body.
type StoredBottleResponse ¶
type StoredBottleResponse struct { // ID is the unique id of the bottle. ID *string `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"` // Name of bottle Name *string `form:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"` // Winery that produces wine Winery *WineryResponse `form:"winery,omitempty" json:"winery,omitempty" xml:"winery,omitempty"` // Vintage of bottle Vintage *uint32 `form:"vintage,omitempty" json:"vintage,omitempty" xml:"vintage,omitempty"` // Composition is the list of grape varietals and associated percentage. Composition []*ComponentResponse `form:"composition,omitempty" json:"composition,omitempty" xml:"composition,omitempty"` // Description of bottle Description *string `form:"description,omitempty" json:"description,omitempty" xml:"description,omitempty"` // Rating of bottle from 1 (worst) to 5 (best) Rating *uint32 `form:"rating,omitempty" json:"rating,omitempty" xml:"rating,omitempty"` }
StoredBottleResponse is used to define fields on response body types.
type WineryResponse ¶
type WineryResponse struct { // Name of winery Name *string `form:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"` // Region of winery Region *string `form:"region,omitempty" json:"region,omitempty" xml:"region,omitempty"` // Country of winery Country *string `form:"country,omitempty" json:"country,omitempty" xml:"country,omitempty"` // Winery website URL URL *string `form:"url,omitempty" json:"url,omitempty" xml:"url,omitempty"` }
WineryResponse is used to define fields on response body types.