client

package
v2.1.3+incompatible Latest Latest
Warning

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

Go to latest
Published: May 25, 2020 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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.

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

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

Jump to

Keyboard shortcuts

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