client

package
v0.0.0-...-a3c55cb Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2016 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAccountPath

func CreateAccountPath() string

CreateAccountPath computes a request path to the create action of account.

func CreateBottlePath

func CreateBottlePath(accountID int) string

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

func DeleteAccountPath

func DeleteAccountPath(accountID int) string

DeleteAccountPath computes a request path to the delete action of account.

func DeleteBottlePath

func DeleteBottlePath(accountID int, bottleID int) string

DeleteBottlePath computes a request path to the delete action of bottle.

func HealthHealthPath

func HealthHealthPath() string

HealthHealthPath computes a request path to the health action of health.

func ListAccountPath

func ListAccountPath() string

ListAccountPath computes a request path to the list action of account.

func ListBottlePath

func ListBottlePath(accountID int) string

ListBottlePath computes a request path to the list action of bottle.

func RateBottlePath

func RateBottlePath(accountID int, bottleID int) string

RateBottlePath computes a request path to the rate action of bottle.

func ShowAccountPath

func ShowAccountPath(accountID int) string

ShowAccountPath computes a request path to the show action of account.

func ShowBottlePath

func ShowBottlePath(accountID int, bottleID int) string

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

func UpdateAccountPath

func UpdateAccountPath(accountID int) string

UpdateAccountPath computes a request path to the update action of account.

func UpdateBottlePath

func UpdateBottlePath(accountID int, bottleID int) string

UpdateBottlePath computes a request path to the update action of bottle.

func WatchBottlePath

func WatchBottlePath(accountID int, bottleID int) string

WatchBottlePath computes a request path to the watch action of bottle.

Types

type Account

type Account struct {
	// Date of creation
	CreatedAt time.Time `form:"created_at" json:"created_at" xml:"created_at"`
	// Email of account owner
	CreatedBy string `form:"created_by" json:"created_by" xml:"created_by"`
	// API href of account
	Href string `form:"href" json:"href" xml:"href"`
	// ID of account
	ID int `form:"id" json:"id" xml:"id"`
	// Name of account
	Name string `form:"name" json:"name" xml:"name"`
}

A tenant account (default view)

Identifier: application/vnd.account+json; view=default

func (*Account) Validate

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

Validate validates the Account media type instance.

type AccountCollection

type AccountCollection []*Account

AccountCollection is the media type for an array of Account (default view)

Identifier: application/vnd.account+json; type=collection; view=default

func (AccountCollection) Validate

func (mt AccountCollection) Validate() (err error)

Validate validates the AccountCollection media type instance.

type AccountLink struct {
	// API href of account
	Href string `form:"href" json:"href" xml:"href"`
	// ID of account
	ID int `form:"id" json:"id" xml:"id"`
}

A tenant account (link view)

Identifier: application/vnd.account+json; view=link

func (*AccountLink) Validate

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

Validate validates the AccountLink media type instance.

type AccountLinkCollection

type AccountLinkCollection []*AccountLink

AccountCollection is the media type for an array of Account (link view)

Identifier: application/vnd.account+json; type=collection; view=link

func (AccountLinkCollection) Validate

func (mt AccountLinkCollection) Validate() (err error)

Validate validates the AccountLinkCollection media type instance.

type AccountTiny

type AccountTiny struct {
	// API href of account
	Href string `form:"href" json:"href" xml:"href"`
	// ID of account
	ID int `form:"id" json:"id" xml:"id"`
	// Name of account
	Name string `form:"name" json:"name" xml:"name"`
}

A tenant account (tiny view)

Identifier: application/vnd.account+json; view=tiny

func (*AccountTiny) Validate

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

Validate validates the AccountTiny media type instance.

type AccountTinyCollection

type AccountTinyCollection []*AccountTiny

AccountCollection is the media type for an array of Account (tiny view)

Identifier: application/vnd.account+json; type=collection; view=tiny

func (AccountTinyCollection) Validate

func (mt AccountTinyCollection) Validate() (err error)

Validate validates the AccountTinyCollection media type instance.

type Bottle

type Bottle struct {
	// Account that owns bottle
	Account *AccountTiny `form:"account,omitempty" json:"account,omitempty" xml:"account,omitempty"`
	// API href of bottle
	Href string `form:"href" json:"href" xml:"href"`
	// ID of bottle
	ID int `form:"id" json:"id" xml:"id"`
	// Links to related resources
	Links *BottleLinks `form:"links,omitempty" json:"links,omitempty" xml:"links,omitempty"`
	Name  string       `form:"name" json:"name" xml:"name"`
	// Rating of bottle between 1 and 5
	Rating   *int   `form:"rating,omitempty" json:"rating,omitempty" xml:"rating,omitempty"`
	Varietal string `form:"varietal" json:"varietal" xml:"varietal"`
	Vineyard string `form:"vineyard" json:"vineyard" xml:"vineyard"`
	Vintage  int    `form:"vintage" json:"vintage" xml:"vintage"`
}

A bottle of wine (default view)

Identifier: application/vnd.bottle+json; view=default

func (*Bottle) Validate

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

Validate validates the Bottle media type instance.

type BottleCollection

type BottleCollection []*Bottle

BottleCollection is the media type for an array of Bottle (default view)

Identifier: application/vnd.bottle+json; type=collection; view=default

func (BottleCollection) Validate

func (mt BottleCollection) Validate() (err error)

Validate validates the BottleCollection media type instance.

type BottleFull

type BottleFull struct {
	// Account that owns bottle
	Account *Account `form:"account,omitempty" json:"account,omitempty" xml:"account,omitempty"`
	Color   string   `form:"color" json:"color" xml:"color"`
	Country *string  `form:"country,omitempty" json:"country,omitempty" xml:"country,omitempty"`
	// Date of creation
	CreatedAt time.Time `form:"created_at" json:"created_at" xml:"created_at"`
	// API href of bottle
	Href string `form:"href" json:"href" xml:"href"`
	// ID of bottle
	ID int `form:"id" json:"id" xml:"id"`
	// Links to related resources
	Links *BottleLinks `form:"links,omitempty" json:"links,omitempty" xml:"links,omitempty"`
	Name  string       `form:"name" json:"name" xml:"name"`
	// Rating of bottle between 1 and 5
	Rating    *int    `form:"rating,omitempty" json:"rating,omitempty" xml:"rating,omitempty"`
	Region    *string `form:"region,omitempty" json:"region,omitempty" xml:"region,omitempty"`
	Review    *string `form:"review,omitempty" json:"review,omitempty" xml:"review,omitempty"`
	Sweetness *int    `form:"sweetness,omitempty" json:"sweetness,omitempty" xml:"sweetness,omitempty"`
	// Date of last update
	UpdatedAt *time.Time `form:"updated_at,omitempty" json:"updated_at,omitempty" xml:"updated_at,omitempty"`
	Varietal  string     `form:"varietal" json:"varietal" xml:"varietal"`
	Vineyard  string     `form:"vineyard" json:"vineyard" xml:"vineyard"`
	Vintage   int        `form:"vintage" json:"vintage" xml:"vintage"`
}

A bottle of wine (full view)

Identifier: application/vnd.bottle+json; view=full

func (*BottleFull) Validate

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

Validate validates the BottleFull media type instance.

type BottleLinks struct {
	Account *AccountLink `form:"account,omitempty" json:"account,omitempty" xml:"account,omitempty"`
}

BottleLinks contains links to related resources of Bottle.

func (*BottleLinks) Validate

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

Validate validates the BottleLinks type instance.

type BottleLinksArray

type BottleLinksArray []*BottleLinks

BottleLinksArray contains links to related resources of BottleCollection.

func (BottleLinksArray) Validate

func (ut BottleLinksArray) Validate() (err error)

Validate validates the BottleLinksArray type instance.

type BottlePayload

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

BottlePayload user type.

func (*BottlePayload) Validate

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

Validate validates the BottlePayload type instance.

type BottleTiny

type BottleTiny struct {
	// API href of bottle
	Href string `form:"href" json:"href" xml:"href"`
	// ID of bottle
	ID int `form:"id" json:"id" xml:"id"`
	// Links to related resources
	Links *BottleLinks `form:"links,omitempty" json:"links,omitempty" xml:"links,omitempty"`
	Name  string       `form:"name" json:"name" xml:"name"`
	// Rating of bottle between 1 and 5
	Rating *int `form:"rating,omitempty" json:"rating,omitempty" xml:"rating,omitempty"`
}

A bottle of wine (tiny view)

Identifier: application/vnd.bottle+json; view=tiny

func (*BottleTiny) Validate

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

Validate validates the BottleTiny media type instance.

type BottleTinyCollection

type BottleTinyCollection []*BottleTiny

BottleCollection is the media type for an array of Bottle (tiny view)

Identifier: application/vnd.bottle+json; type=collection; view=tiny

func (BottleTinyCollection) Validate

func (mt BottleTinyCollection) Validate() (err error)

Validate validates the BottleTinyCollection media 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) CreateAccount

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

Create new account

func (*Client) CreateBottle

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

Record new bottle

func (*Client) DecodeAccount

func (c *Client) DecodeAccount(resp *http.Response) (*Account, error)

DecodeAccount decodes the Account instance encoded in resp body.

func (*Client) DecodeAccountCollection

func (c *Client) DecodeAccountCollection(resp *http.Response) (AccountCollection, error)

DecodeAccountCollection decodes the AccountCollection instance encoded in resp body.

func (c *Client) DecodeAccountLink(resp *http.Response) (*AccountLink, error)

DecodeAccountLink decodes the AccountLink instance encoded in resp body.

func (*Client) DecodeAccountLinkCollection

func (c *Client) DecodeAccountLinkCollection(resp *http.Response) (AccountLinkCollection, error)

DecodeAccountLinkCollection decodes the AccountLinkCollection instance encoded in resp body.

func (*Client) DecodeAccountTiny

func (c *Client) DecodeAccountTiny(resp *http.Response) (*AccountTiny, error)

DecodeAccountTiny decodes the AccountTiny instance encoded in resp body.

func (*Client) DecodeAccountTinyCollection

func (c *Client) DecodeAccountTinyCollection(resp *http.Response) (AccountTinyCollection, error)

DecodeAccountTinyCollection decodes the AccountTinyCollection instance encoded in resp body.

func (*Client) DecodeBottle

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

DecodeBottle decodes the Bottle instance encoded in resp body.

func (*Client) DecodeBottleCollection

func (c *Client) DecodeBottleCollection(resp *http.Response) (BottleCollection, error)

DecodeBottleCollection decodes the BottleCollection instance encoded in resp body.

func (*Client) DecodeBottleFull

func (c *Client) DecodeBottleFull(resp *http.Response) (*BottleFull, error)

DecodeBottleFull decodes the BottleFull instance encoded in resp body.

func (*Client) DecodeBottleTiny

func (c *Client) DecodeBottleTiny(resp *http.Response) (*BottleTiny, error)

DecodeBottleTiny decodes the BottleTiny instance encoded in resp body.

func (*Client) DecodeBottleTinyCollection

func (c *Client) DecodeBottleTinyCollection(resp *http.Response) (BottleTinyCollection, error)

DecodeBottleTinyCollection decodes the BottleTinyCollection 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) DeleteAccount

func (c *Client) DeleteAccount(ctx context.Context, 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(ctx context.Context, path string) (*http.Response, error)

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

func (*Client) DownloadJs

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

DownloadJs downloads /files with the given filename and writes it to the file dest. It returns the number of bytes downloaded in case of success.

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) DownloadUI

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

DownloadUI downloads index.html and writes it to the file dest. It returns the number of bytes downloaded in case of success.

func (*Client) HealthHealth

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

Perform health check.

func (*Client) ListAccount

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

Retrieve all accounts.

func (*Client) ListBottle

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

List all bottles in account optionally filtering by year

func (*Client) NewCreateAccountRequest

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

NewCreateAccountRequest create the request corresponding to the create action endpoint of the account resource.

func (*Client) NewCreateBottleRequest

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

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

func (*Client) NewDeleteAccountRequest

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

NewDeleteAccountRequest create the request corresponding to the delete action endpoint of the account resource.

func (*Client) NewDeleteBottleRequest

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

NewDeleteBottleRequest create the request corresponding to the delete action endpoint of the bottle resource.

func (*Client) NewHealthHealthRequest

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

NewHealthHealthRequest create the request corresponding to the health action endpoint of the health resource.

func (*Client) NewListAccountRequest

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

NewListAccountRequest create the request corresponding to the list action endpoint of the account resource.

func (*Client) NewListBottleRequest

func (c *Client) NewListBottleRequest(ctx context.Context, path string, years []int) (*http.Request, error)

NewListBottleRequest create the request corresponding to the list action endpoint of the bottle resource.

func (*Client) NewRateBottleRequest

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

NewRateBottleRequest create the request corresponding to the rate action endpoint of the bottle resource.

func (*Client) NewShowAccountRequest

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

NewShowAccountRequest create the request corresponding to the show action endpoint of the account 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) NewUpdateAccountRequest

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

NewUpdateAccountRequest create the request corresponding to the update action endpoint of the account resource.

func (*Client) NewUpdateBottleRequest

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

NewUpdateBottleRequest create the request corresponding to the update action endpoint of the bottle resource.

func (*Client) RateBottle

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

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

func (*Client) ShowAccount

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

Retrieve account with given id. IDs 1 and 2 pre-exist in the system.

func (*Client) ShowBottle

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

Retrieve bottle with given id

func (*Client) UpdateAccount

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

Change account name

func (*Client) UpdateBottle

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

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

func (*Client) WatchBottle

func (c *Client) WatchBottle(ctx context.Context, path string) (*websocket.Conn, error)

Retrieve bottle with given id

type CreateAccountPayload

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

CreateAccountPayload is the account create action payload.

type CreateBottlePayload

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

CreateBottlePayload is the bottle create action payload.

type RateBottlePayload

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

RateBottlePayload is the bottle rate action payload.

type UpdateAccountPayload

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

UpdateAccountPayload is the account update action payload.

Jump to

Keyboard shortcuts

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