app

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: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HeroHref

func HeroHref(heroID interface{}) string

HeroHref returns the resource href.

func MountHeroController

func MountHeroController(service *goa.Service, ctrl HeroController)

MountHeroController "mounts" a Hero resource controller on the given service.

Types

type CreateHeroContext

type CreateHeroContext struct {
	context.Context
	*goa.ResponseData
	*goa.RequestData
	Payload *CreateHeroPayload
}

CreateHeroContext provides the hero create action context.

func NewCreateHeroContext

func NewCreateHeroContext(ctx context.Context, r *http.Request, service *goa.Service) (*CreateHeroContext, error)

NewCreateHeroContext parses the incoming request URL and body, performs validations and creates the context used by the hero controller create action.

func (*CreateHeroContext) BadRequest

func (ctx *CreateHeroContext) BadRequest(r error) error

BadRequest sends a HTTP response with status code 400.

func (*CreateHeroContext) Created

func (ctx *CreateHeroContext) Created() error

Created sends a HTTP response with status code 201.

type CreateHeroPayload

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

CreateHeroPayload is the hero create action payload.

func (*CreateHeroPayload) Validate

func (payload *CreateHeroPayload) Validate() (err error)

Validate runs the validation rules defined in the design.

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.

type HeroController

type HeroController interface {
	goa.Muxer
	Create(*CreateHeroContext) error
	List(*ListHeroContext) error
	Show(*ShowHeroContext) error
}

HeroController is the controller interface for the Hero actions.

type ListHeroContext

type ListHeroContext struct {
	context.Context
	*goa.ResponseData
	*goa.RequestData
}

ListHeroContext provides the hero list action context.

func NewListHeroContext

func NewListHeroContext(ctx context.Context, r *http.Request, service *goa.Service) (*ListHeroContext, error)

NewListHeroContext parses the incoming request URL and body, performs validations and creates the context used by the hero controller list action.

func (*ListHeroContext) OK

OK sends a HTTP response with status code 200.

type ShowHeroContext

type ShowHeroContext struct {
	context.Context
	*goa.ResponseData
	*goa.RequestData
	HeroID int
}

ShowHeroContext provides the hero show action context.

func NewShowHeroContext

func NewShowHeroContext(ctx context.Context, r *http.Request, service *goa.Service) (*ShowHeroContext, error)

NewShowHeroContext parses the incoming request URL and body, performs validations and creates the context used by the hero controller show action.

func (*ShowHeroContext) NotFound

func (ctx *ShowHeroContext) NotFound() error

NotFound sends a HTTP response with status code 404.

func (*ShowHeroContext) OK

func (ctx *ShowHeroContext) OK(r *Hero) error

OK sends a HTTP response with status code 200.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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