client

package
v0.0.0-...-37f29b7 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2017 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateHeroPath

func CreateHeroPath() string

CreateHeroPath computes a request path to the create action of hero.

func ListHeroPath

func ListHeroPath() string

ListHeroPath computes a request path to the list action of hero.

func ShowHeroPath

func ShowHeroPath(heroID int) string

ShowHeroPath computes a request path to the show action of hero.

Types

type Client

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

Client is the comics service client.

func New

func New(c goaclient.Doer) *Client

New instantiates the client.

func (*Client) CreateHero

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

Create new hero

func (*Client) DecodeErrorResponse

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

DecodeErrorResponse decodes the ErrorResponse instance encoded in resp body.

func (*Client) DecodeHero

func (c *Client) DecodeHero(resp *http.Response) (*Hero, error)

DecodeHero decodes the Hero instance encoded in resp body.

func (*Client) DecodeHeroCollection

func (c *Client) DecodeHeroCollection(resp *http.Response) (HeroCollection, error)

DecodeHeroCollection decodes the HeroCollection instance encoded in resp body.

func (*Client) ListHero

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

Retrieve all heroes

func (*Client) NewCreateHeroRequest

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

NewCreateHeroRequest create the request corresponding to the create action endpoint of the hero resource.

func (*Client) NewListHeroRequest

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

NewListHeroRequest create the request corresponding to the list action endpoint of the hero resource.

func (*Client) NewShowHeroRequest

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

NewShowHeroRequest create the request corresponding to the show action endpoint of the hero resource.

func (*Client) ShowHero

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

Get hero by id

type CreateHeroPayload

type CreateHeroPayload struct {
	Name string `form:"name" json:"name" xml:"name"`
}

CreateHeroPayload is the hero create action payload.

type Hero

type Hero struct {
	// Unique heroe ID
	ID int `form:"id" json:"id" xml:"id"`
	// Name of hero
	Name string `form:"name" json:"name" xml:"name"`
}

A comic hero (default view)

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

func (*Hero) Validate

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

Validate validates the Hero media type instance.

type HeroCollection

type HeroCollection []*Hero

HeroCollection is the media type for an array of Hero (default view)

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

func (HeroCollection) Validate

func (mt HeroCollection) Validate() (err error)

Validate validates the HeroCollection media type instance.

Jump to

Keyboard shortcuts

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