client

package
v0.0.0-...-3014a84 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2015 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionCommand

type ActionCommand interface {
	// Run makes the HTTP request and returns the response.
	Run(c *Client) (*http.Response, error)
	// RegisterFlags defines the command flags.
	RegisterFlags(*kingpin.CmdClause)
}

ActionCommand represents a single action command as defined on the command line. Each command is associated with a generated client method and contains the logic to call the method passing in arguments computed from the command line.

type Client

type Client struct {
	*goa.Client
}

Client is the cellar service client.

func New

func New() *Client

New instantiates the client.

func (*Client) CreateAccount

func (c *Client) CreateAccount(path string, payload *CreateAccountPayload) (*http.Response, error)

Create new account

func (*Client) CreateBottle

func (c *Client) CreateBottle(path string, payload *CreateBottlePayload) (*http.Response, error)

Record new bottle

func (*Client) DeleteAccount

func (c *Client) DeleteAccount(path string) (*http.Response, error)

DeleteAccount makes a request to the delete action endpoint of the account resource

func (*Client) DeleteBottle

func (c *Client) DeleteBottle(path string) (*http.Response, error)

DeleteBottle makes a request to the delete action endpoint of the bottle resource

func (*Client) ListBottle

func (c *Client) ListBottle(path string, years []int) (*http.Response, error)

List all bottles in account optionally filtering by year

func (*Client) RateBottle

func (c *Client) RateBottle(path string, payload *RateBottlePayload) (*http.Response, error)

RateBottle makes a request to the rate action endpoint of the bottle resource

func (*Client) ShowAccount

func (c *Client) ShowAccount(path string) (*http.Response, error)

Retrieve account with given id

func (*Client) ShowBottle

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

Retrieve bottle with given id

func (*Client) UpdateAccount

func (c *Client) UpdateAccount(path string, payload *UpdateAccountPayload) (*http.Response, error)

Change account name

func (*Client) UpdateBottle

func (c *Client) UpdateBottle(path string, payload *UpdateBottlePayload) (*http.Response, error)

UpdateBottle makes a request to the update action endpoint of the bottle resource

type CreateAccountPayload

type CreateAccountPayload struct {
	// Name of account
	Name string `json:"name"`
}

CreateAccountPayload is the data structure used to initialize the account create request body.

type CreateBottlePayload

type CreateBottlePayload struct {
	Color     string `json:"color"`
	Country   string `json:"country,omitempty"`
	Name      string `json:"name"`
	Region    string `json:"region,omitempty"`
	Review    string `json:"review,omitempty"`
	Sweetness int    `json:"sweetness,omitempty"`
	Varietal  string `json:"varietal"`
	Vineyard  string `json:"vineyard"`
	Vintage   int    `json:"vintage"`
}

CreateBottlePayload is the data structure used to initialize the bottle create request body.

type RateBottlePayload

type RateBottlePayload struct {
	// Rating of bottle between 1 and 5
	Rating int `json:"rating"`
}

RateBottlePayload is the data structure used to initialize the bottle rate request body.

type UpdateAccountPayload

type UpdateAccountPayload struct {
	// Name of account
	Name string `json:"name"`
}

UpdateAccountPayload is the data structure used to initialize the account update request body.

type UpdateBottlePayload

type UpdateBottlePayload struct {
	Color     string `json:"color,omitempty"`
	Country   string `json:"country,omitempty"`
	Name      string `json:"name,omitempty"`
	Region    string `json:"region,omitempty"`
	Review    string `json:"review,omitempty"`
	Sweetness int    `json:"sweetness,omitempty"`
	Varietal  string `json:"varietal,omitempty"`
	Vineyard  string `json:"vineyard,omitempty"`
	Vintage   int    `json:"vintage,omitempty"`
}

UpdateBottlePayload is the data structure used to initialize the bottle update request body.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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