client

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildGetPayload

func BuildGetPayload(creaturesGetName string) (*creatures.GetPayload, error)

BuildGetPayload builds the payload for the creatures get endpoint from CLI flags.

func BuildRandomFactsPayload

func BuildRandomFactsPayload(creaturesRandomFactsName string, creaturesRandomFactsN string) (*creatures.RandomFactsPayload, error)

BuildRandomFactsPayload builds the payload for the creatures random-facts endpoint from CLI flags.

func DecodeGetResponse

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

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

  • "not_found" (type *goa.ServiceError): http.StatusNotFound
  • error: internal error

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 creatures list endpoint. restoreBody controls whether the response body should be restored after having been read.

func DecodeRandomFactsResponse

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

DecodeRandomFactsResponse returns a decoder for responses returned by the creatures random-facts endpoint. restoreBody controls whether the response body should be restored after having been read. DecodeRandomFactsResponse may return the following errors:

  • "bad_request" (type *goa.ServiceError): http.StatusBadRequest
  • "not_found" (type *goa.ServiceError): http.StatusNotFound
  • error: internal error

func EncodeRandomFactsRequest

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

EncodeRandomFactsRequest returns an encoder for requests sent to the creatures random-facts server.

func GetCreaturesPath

func GetCreaturesPath(name string) string

GetCreaturesPath returns the URL path to the creatures service get HTTP endpoint.

func ListCreaturesPath

func ListCreaturesPath() string

ListCreaturesPath returns the URL path to the creatures service list HTTP endpoint.

func NewGetNotFound

func NewGetNotFound(body *GetNotFoundResponseBody) *goa.ServiceError

NewGetNotFound builds a creatures service get endpoint not_found error.

func NewGetResultOK

func NewGetResultOK(body *GetResponseBody) *creatures.GetResult

NewGetResultOK builds a "creatures" service "get" endpoint result from a HTTP "OK" response.

func NewListResultOK

func NewListResultOK(body *ListResponseBody) *creatures.ListResult

NewListResultOK builds a "creatures" service "list" endpoint result from a HTTP "OK" response.

func NewRandomFactsBadRequest

func NewRandomFactsBadRequest(body *RandomFactsBadRequestResponseBody) *goa.ServiceError

NewRandomFactsBadRequest builds a creatures service random-facts endpoint bad_request error.

func NewRandomFactsNotFound

func NewRandomFactsNotFound(body *RandomFactsNotFoundResponseBody) *goa.ServiceError

NewRandomFactsNotFound builds a creatures service random-facts endpoint not_found error.

func NewRandomFactsResultOK

func NewRandomFactsResultOK(body *RandomFactsResponseBody) *creatures.RandomFactsResult

NewRandomFactsResultOK builds a "creatures" service "random-facts" endpoint result from a HTTP "OK" response.

func RandomFactsCreaturesPath

func RandomFactsCreaturesPath(name string) string

RandomFactsCreaturesPath returns the URL path to the creatures service random-facts HTTP endpoint.

func ValidateCreatureResponseBody

func ValidateCreatureResponseBody(body *CreatureResponseBody) (err error)

ValidateCreatureResponseBody runs the validations defined on CreatureResponseBody

func ValidateGetNotFoundResponseBody

func ValidateGetNotFoundResponseBody(body *GetNotFoundResponseBody) (err error)

ValidateGetNotFoundResponseBody runs the validations defined on get_not_found_response_body

func ValidateGetResponseBody

func ValidateGetResponseBody(body *GetResponseBody) (err error)

ValidateGetResponseBody runs the validations defined on GetResponseBody

func ValidateListResponseBody

func ValidateListResponseBody(body *ListResponseBody) (err error)

ValidateListResponseBody runs the validations defined on ListResponseBody

func ValidateRandomFactsBadRequestResponseBody

func ValidateRandomFactsBadRequestResponseBody(body *RandomFactsBadRequestResponseBody) (err error)

ValidateRandomFactsBadRequestResponseBody runs the validations defined on random-facts_bad_request_response_body

func ValidateRandomFactsNotFoundResponseBody

func ValidateRandomFactsNotFoundResponseBody(body *RandomFactsNotFoundResponseBody) (err error)

ValidateRandomFactsNotFoundResponseBody runs the validations defined on random-facts_not_found_response_body

func ValidateRandomFactsResponseBody

func ValidateRandomFactsResponseBody(body *RandomFactsResponseBody) (err error)

ValidateRandomFactsResponseBody runs the validations defined on Random-FactsResponseBody

Types

type Client

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

	// Get Doer is the HTTP client used to make requests to the get endpoint.
	GetDoer goahttp.Doer

	// RandomFacts Doer is the HTTP client used to make requests to the
	// random-facts endpoint.
	RandomFactsDoer goahttp.Doer

	// CORS Doer is the HTTP client used to make requests to the  endpoint.
	CORSDoer 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 creatures 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 creatures service servers.

func (*Client) BuildGetRequest

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

BuildGetRequest instantiates a HTTP request object with method and path set to call the "creatures" service "get" 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 "creatures" service "list" endpoint

func (*Client) BuildRandomFactsRequest

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

BuildRandomFactsRequest instantiates a HTTP request object with method and path set to call the "creatures" service "random-facts" endpoint

func (*Client) Get

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

Get returns an endpoint that makes HTTP requests to the creatures service get server.

func (*Client) List

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

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

func (*Client) RandomFacts

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

RandomFacts returns an endpoint that makes HTTP requests to the creatures service random-facts server.

type CreatureResponseBody

type CreatureResponseBody struct {
	// Name of the creature
	Name *string `form:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"`
	// Facts about the creature
	Facts []string `form:"facts,omitempty" json:"facts,omitempty" xml:"facts,omitempty"`
}

CreatureResponseBody is used to define fields on response body types.

type GetNotFoundResponseBody

type GetNotFoundResponseBody struct {
	// Name is the name of this class of errors.
	Name *string `form:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID *string `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message *string `form:"message,omitempty" json:"message,omitempty" xml:"message,omitempty"`
	// Is the error temporary?
	Temporary *bool `form:"temporary,omitempty" json:"temporary,omitempty" xml:"temporary,omitempty"`
	// Is the error a timeout?
	Timeout *bool `form:"timeout,omitempty" json:"timeout,omitempty" xml:"timeout,omitempty"`
	// Is the error a server-side fault?
	Fault *bool `form:"fault,omitempty" json:"fault,omitempty" xml:"fault,omitempty"`
}

GetNotFoundResponseBody is the type of the "creatures" service "get" endpoint HTTP response body for the "not_found" error.

type GetResponseBody

type GetResponseBody struct {
	// The creature
	Creature *CreatureResponseBody `form:"creature,omitempty" json:"creature,omitempty" xml:"creature,omitempty"`
}

GetResponseBody is the type of the "creatures" service "get" endpoint HTTP response body.

type ListResponseBody

type ListResponseBody struct {
	// List of creatures
	Creatures []*CreatureResponseBody `form:"creatures,omitempty" json:"creatures,omitempty" xml:"creatures,omitempty"`
}

ListResponseBody is the type of the "creatures" service "list" endpoint HTTP response body.

type RandomFactsBadRequestResponseBody

type RandomFactsBadRequestResponseBody struct {
	// Name is the name of this class of errors.
	Name *string `form:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID *string `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message *string `form:"message,omitempty" json:"message,omitempty" xml:"message,omitempty"`
	// Is the error temporary?
	Temporary *bool `form:"temporary,omitempty" json:"temporary,omitempty" xml:"temporary,omitempty"`
	// Is the error a timeout?
	Timeout *bool `form:"timeout,omitempty" json:"timeout,omitempty" xml:"timeout,omitempty"`
	// Is the error a server-side fault?
	Fault *bool `form:"fault,omitempty" json:"fault,omitempty" xml:"fault,omitempty"`
}

RandomFactsBadRequestResponseBody is the type of the "creatures" service "random-facts" endpoint HTTP response body for the "bad_request" error.

type RandomFactsNotFoundResponseBody

type RandomFactsNotFoundResponseBody struct {
	// Name is the name of this class of errors.
	Name *string `form:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"`
	// ID is a unique identifier for this particular occurrence of the problem.
	ID *string `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
	// Message is a human-readable explanation specific to this occurrence of the
	// problem.
	Message *string `form:"message,omitempty" json:"message,omitempty" xml:"message,omitempty"`
	// Is the error temporary?
	Temporary *bool `form:"temporary,omitempty" json:"temporary,omitempty" xml:"temporary,omitempty"`
	// Is the error a timeout?
	Timeout *bool `form:"timeout,omitempty" json:"timeout,omitempty" xml:"timeout,omitempty"`
	// Is the error a server-side fault?
	Fault *bool `form:"fault,omitempty" json:"fault,omitempty" xml:"fault,omitempty"`
}

RandomFactsNotFoundResponseBody is the type of the "creatures" service "random-facts" endpoint HTTP response body for the "not_found" error.

type RandomFactsResponseBody

type RandomFactsResponseBody struct {
	// Random facts about the creature
	Facts []string `form:"facts,omitempty" json:"facts,omitempty" xml:"facts,omitempty"`
}

RandomFactsResponseBody is the type of the "creatures" service "random-facts" endpoint HTTP response body.

Jump to

Keyboard shortcuts

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