creatures

package
v0.0.0-...-06ad8fd Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const ServiceName = "creatures"

ServiceName is the name of the service as defined in the design. This is the same value that is set in the endpoint request contexts under the ServiceKey key.

Variables

View Source
var MethodNames = [3]string{"list", "get", "random-facts"}

MethodNames lists the service method names as defined in the design. These are the same values that are set in the endpoint request contexts under the MethodKey key.

Functions

func MakeBadRequest

func MakeBadRequest(err error) *goa.ServiceError

MakeBadRequest builds a goa.ServiceError from an error.

func MakeNotFound

func MakeNotFound(err error) *goa.ServiceError

MakeNotFound builds a goa.ServiceError from an error.

func NewGetEndpoint

func NewGetEndpoint(s Service) goa.Endpoint

NewGetEndpoint returns an endpoint function that calls the method "get" of service "creatures".

func NewListEndpoint

func NewListEndpoint(s Service) goa.Endpoint

NewListEndpoint returns an endpoint function that calls the method "list" of service "creatures".

func NewRandomFactsEndpoint

func NewRandomFactsEndpoint(s Service) goa.Endpoint

NewRandomFactsEndpoint returns an endpoint function that calls the method "random-facts" of service "creatures".

Types

type Client

type Client struct {
	ListEndpoint        goa.Endpoint
	GetEndpoint         goa.Endpoint
	RandomFactsEndpoint goa.Endpoint
}

Client is the "creatures" service client.

func NewClient

func NewClient(list, get, randomFacts goa.Endpoint) *Client

NewClient initializes a "creatures" service client given the endpoints.

func (*Client) Get

func (c *Client) Get(ctx context.Context, p *GetPayload) (res *GetResult, err error)

Get calls the "get" endpoint of the "creatures" service.

func (*Client) List

func (c *Client) List(ctx context.Context) (res *ListResult, err error)

List calls the "list" endpoint of the "creatures" service.

func (*Client) RandomFacts

func (c *Client) RandomFacts(ctx context.Context, p *RandomFactsPayload) (res *RandomFactsResult, err error)

RandomFacts calls the "random-facts" endpoint of the "creatures" service.

type Creature

type Creature struct {
	// Name of the creature
	Name string
	// Facts about the creature
	Facts []string
}

type Endpoints

type Endpoints struct {
	List        goa.Endpoint
	Get         goa.Endpoint
	RandomFacts goa.Endpoint
}

Endpoints wraps the "creatures" service endpoints.

func NewEndpoints

func NewEndpoints(s Service) *Endpoints

NewEndpoints wraps the methods of the "creatures" service with endpoints.

func (*Endpoints) Use

func (e *Endpoints) Use(m func(goa.Endpoint) goa.Endpoint)

Use applies the given middleware to all the "creatures" service endpoints.

type GetPayload

type GetPayload struct {
	// Name of the creature
	Name string
}

GetPayload is the payload type of the creatures service get method.

type GetResult

type GetResult struct {
	// The creature
	Creature *Creature
}

GetResult is the result type of the creatures service get method.

type ListResult

type ListResult struct {
	// List of creatures
	Creatures []*Creature
}

ListResult is the result type of the creatures service list method.

type RandomFactsPayload

type RandomFactsPayload struct {
	// Name of the creature
	Name string
	// Number of random facts
	N *int
}

RandomFactsPayload is the payload type of the creatures service random-facts method.

type RandomFactsResult

type RandomFactsResult struct {
	// Random facts about the creature
	Facts []string
}

RandomFactsResult is the result type of the creatures service random-facts method.

type Service

type Service interface {
	// List implements list.
	List(context.Context) (res *ListResult, err error)
	// Get implements get.
	Get(context.Context, *GetPayload) (res *GetResult, err error)
	// RandomFacts implements random-facts.
	RandomFacts(context.Context, *RandomFactsPayload) (res *RandomFactsResult, err error)
}

The creatures service provides you with farm creatures and facts about them.

Jump to

Keyboard shortcuts

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