client

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateBottlePath

func CreateBottlePath() string

CreateBottlePath computes a request path to the create action of bottle.

func ShowBottlePath

func ShowBottlePath(id string) string

ShowBottlePath computes a request path to the show action of bottle.

Types

type Bottle

type Bottle struct {
	// Unique bottle ID
	ID string `form:"id" json:"id" yaml:"id" xml:"id"`
	// Name of bottle
	Name string `form:"name" json:"name" yaml:"name" xml:"name"`
	// Rating of bottle
	Rating int `form:"rating" json:"rating" yaml:"rating" xml:"rating"`
	// Vintage of bottle
	Vintage int `form:"vintage" json:"vintage" yaml:"vintage" xml:"vintage"`
}

bottle media type (default view)

Identifier: application/vnd.gophercon.goa.bottle; view=default

func (*Bottle) Validate

func (mt *Bottle) Validate() (err error)

Validate validates the Bottle media type instance.

type BottlePayload

type BottlePayload struct {
	// Unique bottle ID
	ID *string `form:"id,omitempty" json:"id,omitempty" yaml:"id,omitempty" xml:"id,omitempty"`
	// Name of bottle
	Name string `form:"name" json:"name" yaml:"name" xml:"name"`
	// Rating of bottle
	Rating int `form:"rating" json:"rating" yaml:"rating" xml:"rating"`
	// Vintage of bottle
	Vintage int `form:"vintage" json:"vintage" yaml:"vintage" xml:"vintage"`
}

BottlePayload is the type used to create bottles

func (*BottlePayload) Validate

func (ut *BottlePayload) Validate() (err error)

Validate validates the BottlePayload type instance.

type Client

type Client struct {
	*goaclient.Client
	Encoder *goa.HTTPEncoder
	Decoder *goa.HTTPDecoder
}

Client is the cellar service client.

func New

func New(c goaclient.Doer) *Client

New instantiates the client.

func (*Client) CreateBottle

func (c *Client) CreateBottle(ctx context.Context, path string, payload *BottlePayload, contentType string) (*http.Response, error)

creates a bottle

func (*Client) DecodeBottle

func (c *Client) DecodeBottle(resp *http.Response) (*Bottle, error)

DecodeBottle decodes the Bottle instance encoded in resp body.

func (*Client) DecodeErrorResponse

func (c *Client) DecodeErrorResponse(resp *http.Response) (*goa.ErrorResponse, error)

DecodeErrorResponse decodes the ErrorResponse instance encoded in resp body.

func (*Client) DownloadSwaggerJSON

func (c *Client) DownloadSwaggerJSON(ctx context.Context, dest string) (int64, error)

DownloadSwaggerJSON downloads swagger.json and writes it to the file dest. It returns the number of bytes downloaded in case of success.

func (*Client) DownloadSwaggerYaml

func (c *Client) DownloadSwaggerYaml(ctx context.Context, dest string) (int64, error)

DownloadSwaggerYaml downloads swagger.yaml and writes it to the file dest. It returns the number of bytes downloaded in case of success.

func (*Client) NewCreateBottleRequest

func (c *Client) NewCreateBottleRequest(ctx context.Context, path string, payload *BottlePayload, contentType string) (*http.Request, error)

NewCreateBottleRequest create the request corresponding to the create action endpoint of the bottle resource.

func (*Client) NewShowBottleRequest

func (c *Client) NewShowBottleRequest(ctx context.Context, path string) (*http.Request, error)

NewShowBottleRequest create the request corresponding to the show action endpoint of the bottle resource.

func (*Client) ShowBottle

func (c *Client) ShowBottle(ctx context.Context, path string) (*http.Response, error)

shows a bottle

Jump to

Keyboard shortcuts

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