import ""



Package files

cli.go client.go encode_decode.go paths.go types.go

func BuildPickPayload

func BuildPickPayload(sommelierPickBody string) (*sommelier.Criteria, error)

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) (interface{}, 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

func EncodePickRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, interface{}) error

EncodePickRequest returns an encoder for requests sent to the sommelier pick server.

func NewPickNoCriteria

func NewPickNoCriteria(body PickNoCriteriaResponseBody) sommelier.NoCriteria

NewPickNoCriteria builds a sommelier service pick endpoint no_criteria error.

func NewPickNoMatch

func NewPickNoMatch(body PickNoMatchResponseBody) sommelier.NoMatch

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.

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

func (c *Client) BuildPickRequest(ctx context.Context, v interface{}) (*http.Request, error)

BuildPickRequest instantiates a HTTP request object with method and path set to call the “sommelier” service “pick” endpoint

func (*Client) Pick

func (c *Client) Pick() goa.Endpoint

Pick returns an endpoint that makes HTTP requests to the sommelier service pick server.

type ComponentResponseBody

type ComponentResponseBody 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"`

ComponentResponseBody is used to define fields on response body types.

func (*ComponentResponseBody) Validate

func (body *ComponentResponseBody) Validate() (err error)

Validate runs the validations defined on ComponentResponseBody

type PickNoCriteriaResponseBody

type PickNoCriteriaResponseBody string

PickNoCriteriaResponseBody is the type of the “sommelier” service “pick” endpoint HTTP response body for the “no_criteria” error.

type PickNoMatchResponseBody

type PickNoMatchResponseBody string

PickNoMatchResponseBody is the type of the “sommelier” service “pick” endpoint HTTP response body for the “no_match” error.

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 []*StoredBottleResponseBody

PickResponseBody is the type of the “sommelier” service “pick” endpoint HTTP response body.

type StoredBottleResponseBody

type StoredBottleResponseBody 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 *WineryResponseBody `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 []*ComponentResponseBody `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"`

StoredBottleResponseBody is used to define fields on response body types.

func (*StoredBottleResponseBody) Validate

func (body *StoredBottleResponseBody) Validate() (err error)

Validate runs the validations defined on StoredBottleResponseBody

type WineryResponseBody

type WineryResponseBody 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"`

WineryResponseBody is used to define fields on response body types.

func (*WineryResponseBody) Validate

func (body *WineryResponseBody) Validate() (err error)

Validate runs the validations defined on WineryResponseBody

Generated by godoc2md