github.com/goadesign/goa/examples/cellar/gen/http/storage/client


client

import "github.com/goadesign/goa/examples/cellar/gen/http/storage/client"

Overview

Index

Package files

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

func AddStoragePath

func AddStoragePath() string

AddStoragePath returns the URL path to the storage service add HTTP endpoint.

func BuildAddPayload

func BuildAddPayload(storageAddBody string) (*storage.Bottle, error)

BuildAddPayload builds the payload for the storage add endpoint from CLI flags.

func BuildMultiAddPayload

func BuildMultiAddPayload(storageMultiAddBody string) ([]*storage.Bottle, error)

BuildMultiAddPayload builds the payload for the storage multi_add endpoint from CLI flags.

func BuildMultiUpdatePayload

func BuildMultiUpdatePayload(storageMultiUpdateBody string, storageMultiUpdateIds string) (*storage.MultiUpdatePayload, error)

BuildMultiUpdatePayload builds the payload for the storage multi_update endpoint from CLI flags.

func BuildRemovePayload

func BuildRemovePayload(storageRemoveID string) (*storage.RemovePayload, error)

BuildRemovePayload builds the payload for the storage remove endpoint from CLI flags.

func BuildShowPayload

func BuildShowPayload(storageShowID string, storageShowView string) (*storage.ShowPayload, error)

BuildShowPayload builds the payload for the storage show endpoint from CLI flags.

func DecodeAddResponse

func DecodeAddResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (interface{}, error)

DecodeAddResponse returns a decoder for responses returned by the storage add endpoint. restoreBody controls whether the response body should be restored after having been read.

func DecodeListResponse

func DecodeListResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (interface{}, error)

DecodeListResponse returns a decoder for responses returned by the storage list endpoint. restoreBody controls whether the response body should be restored after having been read.

func DecodeMultiAddResponse

func DecodeMultiAddResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (interface{}, error)

DecodeMultiAddResponse returns a decoder for responses returned by the storage multi_add endpoint. restoreBody controls whether the response body should be restored after having been read.

func DecodeMultiUpdateResponse

func DecodeMultiUpdateResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (interface{}, error)

DecodeMultiUpdateResponse returns a decoder for responses returned by the storage multi_update endpoint. restoreBody controls whether the response body should be restored after having been read.

func DecodeRateResponse

func DecodeRateResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (interface{}, error)

DecodeRateResponse returns a decoder for responses returned by the storage rate endpoint. restoreBody controls whether the response body should be restored after having been read.

func DecodeRemoveResponse

func DecodeRemoveResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (interface{}, error)

DecodeRemoveResponse returns a decoder for responses returned by the storage remove endpoint. restoreBody controls whether the response body should be restored after having been read.

func DecodeShowResponse

func DecodeShowResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (interface{}, error)

DecodeShowResponse returns a decoder for responses returned by the storage show endpoint. restoreBody controls whether the response body should be restored after having been read. DecodeShowResponse may return the following errors:

- "not_found" (type *storage.NotFound): http.StatusNotFound
- error: internal error

func EncodeAddRequest

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

EncodeAddRequest returns an encoder for requests sent to the storage add server.

func EncodeMultiAddRequest

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

EncodeMultiAddRequest returns an encoder for requests sent to the storage multi_add server.

func EncodeMultiUpdateRequest

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

EncodeMultiUpdateRequest returns an encoder for requests sent to the storage multi_update server.

func EncodeRateRequest

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

EncodeRateRequest returns an encoder for requests sent to the storage rate server.

func EncodeShowRequest

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

EncodeShowRequest returns an encoder for requests sent to the storage show server.

func ListStoragePath

func ListStoragePath() string

ListStoragePath returns the URL path to the storage service list HTTP endpoint.

func MultiAddStoragePath

func MultiAddStoragePath() string

MultiAddStoragePath returns the URL path to the storage service multi_add HTTP endpoint.

func MultiUpdateStoragePath

func MultiUpdateStoragePath() string

MultiUpdateStoragePath returns the URL path to the storage service multi_update HTTP endpoint.

func NewListStoredBottleCollectionOK

func NewListStoredBottleCollectionOK(body ListResponseBody) storageviews.StoredBottleCollectionView

NewListStoredBottleCollectionOK builds a “storage” service “list” endpoint result from a HTTP “OK” response.

func NewShowNotFound

func NewShowNotFound(body *ShowNotFoundResponseBody) *storage.NotFound

NewShowNotFound builds a storage service show endpoint not_found error.

func NewShowStoredBottleOK

func NewShowStoredBottleOK(body *ShowResponseBody) *storageviews.StoredBottleView

NewShowStoredBottleOK builds a “storage” service “show” endpoint result from a HTTP “OK” response.

func NewStorageMultiAddEncoder

func NewStorageMultiAddEncoder(encoderFn StorageMultiAddEncoderFunc) func(r *http.Request) goahttp.Encoder

NewStorageMultiAddEncoder returns an encoder to encode the multipart request for the “storage” service “multi_add” endpoint.

func NewStorageMultiUpdateEncoder

func NewStorageMultiUpdateEncoder(encoderFn StorageMultiUpdateEncoderFunc) func(r *http.Request) goahttp.Encoder

NewStorageMultiUpdateEncoder returns an encoder to encode the multipart request for the “storage” service “multi_update” endpoint.

func RateStoragePath

func RateStoragePath() string

RateStoragePath returns the URL path to the storage service rate HTTP endpoint.

func RemoveStoragePath

func RemoveStoragePath(id string) string

RemoveStoragePath returns the URL path to the storage service remove HTTP endpoint.

func ShowStoragePath

func ShowStoragePath(id string) string

ShowStoragePath returns the URL path to the storage service show HTTP endpoint.

type AddRequestBody

type AddRequestBody struct {
    // Name of bottle
    Name string `form:"name" json:"name" xml:"name"`
    // Winery that produces wine
    Winery *WineryRequestBody `form:"winery" json:"winery" xml:"winery"`
    // Vintage of bottle
    Vintage uint32 `form:"vintage" json:"vintage" xml:"vintage"`
    // Composition is the list of grape varietals and associated percentage.
    Composition []*ComponentRequestBody `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"`
}

AddRequestBody is the type of the “storage” service “add” endpoint HTTP request body.

func NewAddRequestBody

func NewAddRequestBody(p *storage.Bottle) *AddRequestBody

NewAddRequestBody builds the HTTP request body from the payload of the “add” endpoint of the “storage” service.

type BottleRequestBody

type BottleRequestBody struct {
    // Name of bottle
    Name string `form:"name" json:"name" xml:"name"`
    // Winery that produces wine
    Winery *WineryRequestBody `form:"winery" json:"winery" xml:"winery"`
    // Vintage of bottle
    Vintage uint32 `form:"vintage" json:"vintage" xml:"vintage"`
    // Composition is the list of grape varietals and associated percentage.
    Composition []*ComponentRequestBody `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"`
}

BottleRequestBody is used to define fields on request body types.

func NewBottleRequestBody

func NewBottleRequestBody(p []*storage.Bottle) []*BottleRequestBody

NewBottleRequestBody builds the HTTP request body from the payload of the “multi_add” endpoint of the “storage” service.

func (*BottleRequestBody) Validate

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

Validate runs the validations defined on BottleRequestBody

type Client

type Client struct {
    // List Doer is the HTTP client used to make requests to the list endpoint.
    ListDoer goahttp.Doer

    // Show Doer is the HTTP client used to make requests to the show endpoint.
    ShowDoer goahttp.Doer

    // Add Doer is the HTTP client used to make requests to the add endpoint.
    AddDoer goahttp.Doer

    // Remove Doer is the HTTP client used to make requests to the remove endpoint.
    RemoveDoer goahttp.Doer

    // Rate Doer is the HTTP client used to make requests to the rate endpoint.
    RateDoer goahttp.Doer

    // MultiAdd Doer is the HTTP client used to make requests to the multi_add
    // endpoint.
    MultiAddDoer goahttp.Doer

    // MultiUpdate Doer is the HTTP client used to make requests to the
    // multi_update endpoint.
    MultiUpdateDoer 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 storage 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 storage service servers.

func (*Client) Add

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

Add returns an endpoint that makes HTTP requests to the storage service add server.

func (*Client) BuildAddRequest

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

BuildAddRequest instantiates a HTTP request object with method and path set to call the “storage” service “add” endpoint

func (*Client) BuildListRequest

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

BuildListRequest instantiates a HTTP request object with method and path set to call the “storage” service “list” endpoint

func (*Client) BuildMultiAddRequest

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

BuildMultiAddRequest instantiates a HTTP request object with method and path set to call the “storage” service “multi_add” endpoint

func (*Client) BuildMultiUpdateRequest

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

BuildMultiUpdateRequest instantiates a HTTP request object with method and path set to call the “storage” service “multi_update” endpoint

func (*Client) BuildRateRequest

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

BuildRateRequest instantiates a HTTP request object with method and path set to call the “storage” service “rate” endpoint

func (*Client) BuildRemoveRequest

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

BuildRemoveRequest instantiates a HTTP request object with method and path set to call the “storage” service “remove” endpoint

func (*Client) BuildShowRequest

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

BuildShowRequest instantiates a HTTP request object with method and path set to call the “storage” service “show” endpoint

func (*Client) List

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

List returns an endpoint that makes HTTP requests to the storage service list server.

func (*Client) MultiAdd

func (c *Client) MultiAdd(storageMultiAddEncoderFn StorageMultiAddEncoderFunc) goa.Endpoint

MultiAdd returns an endpoint that makes HTTP requests to the storage service multi_add server.

func (*Client) MultiUpdate

func (c *Client) MultiUpdate(storageMultiUpdateEncoderFn StorageMultiUpdateEncoderFunc) goa.Endpoint

MultiUpdate returns an endpoint that makes HTTP requests to the storage service multi_update server.

func (*Client) Rate

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

Rate returns an endpoint that makes HTTP requests to the storage service rate server.

func (*Client) Remove

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

Remove returns an endpoint that makes HTTP requests to the storage service remove server.

func (*Client) Show

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

Show returns an endpoint that makes HTTP requests to the storage service show server.

type ComponentRequestBody

type ComponentRequestBody struct {
    // Grape varietal
    Varietal string `form:"varietal" json:"varietal" xml:"varietal"`
    // Percentage of varietal in wine
    Percentage *uint32 `form:"percentage,omitempty" json:"percentage,omitempty" xml:"percentage,omitempty"`
}

ComponentRequestBody is used to define fields on request body types.

func (*ComponentRequestBody) Validate

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

Validate runs the validations defined on ComponentRequestBody

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 ListResponseBody

type ListResponseBody []*StoredBottleResponseBody

ListResponseBody is the type of the “storage” service “list” endpoint HTTP response body.

type MultiUpdateRequestBody

type MultiUpdateRequestBody struct {
    // Array of bottle info that matches the ids attribute
    Bottles []*BottleRequestBody `form:"bottles" json:"bottles" xml:"bottles"`
}

MultiUpdateRequestBody is the type of the “storage” service “multi_update” endpoint HTTP request body.

func NewMultiUpdateRequestBody

func NewMultiUpdateRequestBody(p *storage.MultiUpdatePayload) *MultiUpdateRequestBody

NewMultiUpdateRequestBody builds the HTTP request body from the payload of the “multi_update” endpoint of the “storage” service.

type ShowNotFoundResponseBody

type ShowNotFoundResponseBody struct {
    // Message of error
    Message *string `form:"message,omitempty" json:"message,omitempty" xml:"message,omitempty"`
    // ID of missing bottle
    ID *string `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
}

ShowNotFoundResponseBody is the type of the “storage” service “show” endpoint HTTP response body for the “not_found” error.

func (*ShowNotFoundResponseBody) Validate

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

Validate runs the validations defined on ShowNotFoundResponseBody

type ShowResponseBody

type ShowResponseBody 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"`
}

ShowResponseBody is the type of the “storage” service “show” endpoint HTTP response body.

type StorageMultiAddEncoderFunc

type StorageMultiAddEncoderFunc func(*multipart.Writer, []*storage.Bottle) error

StorageMultiAddEncoderFunc is the type to encode multipart request for the “storage” service “multi_add” endpoint.

type StorageMultiUpdateEncoderFunc

type StorageMultiUpdateEncoderFunc func(*multipart.Writer, *storage.MultiUpdatePayload) error

StorageMultiUpdateEncoderFunc is the type to encode multipart request for the “storage” service “multi_update” endpoint.

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 WineryRequestBody

type WineryRequestBody struct {
    // Name of winery
    Name string `form:"name" json:"name" xml:"name"`
    // Region of winery
    Region string `form:"region" json:"region" xml:"region"`
    // Country of winery
    Country string `form:"country" json:"country" xml:"country"`
    // Winery website URL
    URL *string `form:"url,omitempty" json:"url,omitempty" xml:"url,omitempty"`
}

WineryRequestBody is used to define fields on request body types.

func (*WineryRequestBody) Validate

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

Validate runs the validations defined on WineryRequestBody

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