client

package
v0.0.0-...-63cd2eb Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildDividePayload

func BuildDividePayload(calcDivideBody string) (*calc.DividePayload, error)

BuildDividePayload builds the payload for the calc divide endpoint from CLI flags.

func DecodeDivideResponse

func DecodeDivideResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (any, error)

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

  • "div_by_zero" (type *calc.DivByZero): http.StatusBadRequest
  • "timeout" (type *goa.ServiceError): http.StatusGatewayTimeout
  • error: internal error

func DivideCalcPath

func DivideCalcPath() string

DivideCalcPath returns the URL path to the calc service divide HTTP endpoint.

func EncodeDivideRequest

func EncodeDivideRequest(encoder func(*http.Request) goahttp.Encoder) func(*http.Request, any) error

EncodeDivideRequest returns an encoder for requests sent to the calc divide server.

func NewDivideDivByZero

func NewDivideDivByZero(body *DivideDivByZeroResponseBody) *calc.DivByZero

NewDivideDivByZero builds a calc service divide endpoint div_by_zero error.

func NewDivideResultOK

func NewDivideResultOK(body *DivideResponseBody) *calc.DivideResult

NewDivideResultOK builds a "calc" service "divide" endpoint result from a HTTP "OK" response.

func NewDivideTimeout

func NewDivideTimeout(body *DivideTimeoutResponseBody) *goa.ServiceError

NewDivideTimeout builds a calc service divide endpoint timeout error.

func ValidateDivideDivByZeroResponseBody

func ValidateDivideDivByZeroResponseBody(body *DivideDivByZeroResponseBody) (err error)

ValidateDivideDivByZeroResponseBody runs the validations defined on divide_div_by_zero_response_body

func ValidateDivideResponseBody

func ValidateDivideResponseBody(body *DivideResponseBody) (err error)

ValidateDivideResponseBody runs the validations defined on DivideResponseBody

func ValidateDivideTimeoutResponseBody

func ValidateDivideTimeoutResponseBody(body *DivideTimeoutResponseBody) (err error)

ValidateDivideTimeoutResponseBody runs the validations defined on divide_timeout_response_body

Types

type Client

type Client struct {
	// Divide Doer is the HTTP client used to make requests to the divide endpoint.
	DivideDoer 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 calc 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 calc service servers.

func (*Client) BuildDivideRequest

func (c *Client) BuildDivideRequest(ctx context.Context, v any) (*http.Request, error)

BuildDivideRequest instantiates a HTTP request object with method and path set to call the "calc" service "divide" endpoint

func (*Client) Divide

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

Divide returns an endpoint that makes HTTP requests to the calc service divide server.

type DivideDivByZeroResponseBody

type DivideDivByZeroResponseBody struct {
	// division by zero leads to infinity.
	Message *string `form:"message,omitempty" json:"message,omitempty" xml:"message,omitempty"`
}

DivideDivByZeroResponseBody is the type of the "calc" service "divide" endpoint HTTP response body for the "div_by_zero" error.

type DivideRequestBody

type DivideRequestBody struct {
	Dividend int `form:"dividend" json:"dividend" xml:"dividend"`
	Divisor  int `form:"divisor" json:"divisor" xml:"divisor"`
}

DivideRequestBody is the type of the "calc" service "divide" endpoint HTTP request body.

func NewDivideRequestBody

func NewDivideRequestBody(p *calc.DividePayload) *DivideRequestBody

NewDivideRequestBody builds the HTTP request body from the payload of the "divide" endpoint of the "calc" service.

type DivideResponseBody

type DivideResponseBody struct {
	Quotient *int `form:"quotient,omitempty" json:"quotient,omitempty" xml:"quotient,omitempty"`
	Reminder *int `form:"reminder,omitempty" json:"reminder,omitempty" xml:"reminder,omitempty"`
}

DivideResponseBody is the type of the "calc" service "divide" endpoint HTTP response body.

type DivideTimeoutResponseBody

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

DivideTimeoutResponseBody is the type of the "calc" service "divide" endpoint HTTP response body for the "timeout" error.

Jump to

Keyboard shortcuts

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