client

package
v0.0.8-rc13 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildForecastPayload

func BuildForecastPayload(forecasterForecastState string, forecasterForecastCity string) (*forecaster.ForecastPayload, error)

BuildForecastPayload builds the payload for the Forecaster forecast endpoint from CLI flags.

func DecodeForecastResponse

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

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

  • "timeout" (type *goa.ServiceError): http.StatusGatewayTimeout
  • error: internal error

func ForecastForecasterPath

func ForecastForecasterPath(state string, city string) string

ForecastForecasterPath returns the URL path to the Forecaster service forecast HTTP endpoint.

func NewForecast2OK

func NewForecast2OK(body *ForecastResponseBody) *forecaster.Forecast2

NewForecast2OK builds a "Forecaster" service "forecast" endpoint result from a HTTP "OK" response.

func NewForecastTimeout

func NewForecastTimeout(body *ForecastTimeoutResponseBody) *goa.ServiceError

NewForecastTimeout builds a Forecaster service forecast endpoint timeout error.

func ValidateForecastResponseBody

func ValidateForecastResponseBody(body *ForecastResponseBody) (err error)

ValidateForecastResponseBody runs the validations defined on ForecastResponseBody

func ValidateForecastTimeoutResponseBody

func ValidateForecastTimeoutResponseBody(body *ForecastTimeoutResponseBody) (err error)

ValidateForecastTimeoutResponseBody runs the validations defined on forecast_timeout_response_body

func ValidateLocationResponseBody

func ValidateLocationResponseBody(body *LocationResponseBody) (err error)

ValidateLocationResponseBody runs the validations defined on LocationResponseBody

func ValidatePeriodResponseBody

func ValidatePeriodResponseBody(body *PeriodResponseBody) (err error)

ValidatePeriodResponseBody runs the validations defined on PeriodResponseBody

Types

type Client

type Client struct {
	// Forecast Doer is the HTTP client used to make requests to the forecast
	// endpoint.
	ForecastDoer 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 Forecaster 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 Forecaster service servers.

func (*Client) BuildForecastRequest

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

BuildForecastRequest instantiates a HTTP request object with method and path set to call the "Forecaster" service "forecast" endpoint

func (*Client) Forecast

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

Forecast returns an endpoint that makes HTTP requests to the Forecaster service forecast server.

type ForecastResponseBody

type ForecastResponseBody struct {
	// Forecast location
	Location *LocationResponseBody `form:"location,omitempty" json:"location,omitempty" xml:"location,omitempty"`
	// Weather forecast periods
	Periods []*PeriodResponseBody `form:"periods,omitempty" json:"periods,omitempty" xml:"periods,omitempty"`
}

ForecastResponseBody is the type of the "Forecaster" service "forecast" endpoint HTTP response body.

type ForecastTimeoutResponseBody

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

ForecastTimeoutResponseBody is the type of the "Forecaster" service "forecast" endpoint HTTP response body for the "timeout" error.

type LocationResponseBody

type LocationResponseBody struct {
	// Latitude
	Lat *float64 `form:"lat,omitempty" json:"lat,omitempty" xml:"lat,omitempty"`
	// Longitude
	Long *float64 `form:"long,omitempty" json:"long,omitempty" xml:"long,omitempty"`
	// City
	City *string `form:"city,omitempty" json:"city,omitempty" xml:"city,omitempty"`
	// State
	State *string `form:"state,omitempty" json:"state,omitempty" xml:"state,omitempty"`
}

LocationResponseBody is used to define fields on response body types.

type PeriodResponseBody

type PeriodResponseBody struct {
	// Period name
	Name *string `form:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"`
	// Start time
	StartTime *string `form:"startTime,omitempty" json:"startTime,omitempty" xml:"startTime,omitempty"`
	// End time
	EndTime *string `form:"endTime,omitempty" json:"endTime,omitempty" xml:"endTime,omitempty"`
	// Temperature
	Temperature *int `form:"temperature,omitempty" json:"temperature,omitempty" xml:"temperature,omitempty"`
	// Temperature unit
	TemperatureUnit *string `form:"temperatureUnit,omitempty" json:"temperatureUnit,omitempty" xml:"temperatureUnit,omitempty"`
	// Summary
	Summary *string `form:"summary,omitempty" json:"summary,omitempty" xml:"summary,omitempty"`
}

PeriodResponseBody is used to define fields on response body types.

Jump to

Keyboard shortcuts

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