forecaster

package
v0.0.8-rc12 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const APIName = "Weather Forecaster Service API"

APIName is the name of the API as defined in the design.

View Source
const APIVersion = "0.0.1"

APIVersion is the version of the API as defined in the design.

View Source
const ServiceName = "Forecaster"

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 = [1]string{"forecast"}

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 MakeTimeout

func MakeTimeout(err error) *goa.ServiceError

MakeTimeout builds a goa.ServiceError from an error.

func NewForecastEndpoint

func NewForecastEndpoint(s Service) goa.Endpoint

NewForecastEndpoint returns an endpoint function that calls the method "forecast" of service "Forecaster".

Types

type Client

type Client struct {
	ForecastEndpoint goa.Endpoint
}

Client is the "Forecaster" service client.

func NewClient

func NewClient(forecast goa.Endpoint) *Client

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

func (*Client) Forecast

func (c *Client) Forecast(ctx context.Context, p *ForecastPayload) (res *Forecast2, err error)

Forecast calls the "forecast" endpoint of the "Forecaster" service. Forecast may return the following errors:

  • "timeout" (type *goa.ServiceError): Timeout retrieving forecast
  • error: internal error

type Endpoints

type Endpoints struct {
	Forecast goa.Endpoint
}

Endpoints wraps the "Forecaster" service endpoints.

func NewEndpoints

func NewEndpoints(s Service) *Endpoints

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

func (*Endpoints) Use

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

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

type Forecast2

type Forecast2 struct {
	// Forecast location
	Location *Location
	// Weather forecast periods
	Periods []*Period
}

Forecast2 is the result type of the Forecaster service forecast method.

type ForecastPayload

type ForecastPayload struct {
	// State
	State string
	// City
	City string
}

ForecastPayload is the payload type of the Forecaster service forecast method.

type Location

type Location struct {
	// Latitude
	Lat float64
	// Longitude
	Long float64
	// City
	City string
	// State
	State string
}

Geographical location

type Period

type Period struct {
	// Period name
	Name string
	// Start time
	StartTime string
	// End time
	EndTime string
	// Temperature
	Temperature int
	// Temperature unit
	TemperatureUnit string
	// Summary
	Summary string
}

Weather forecast period

type Service

type Service interface {
	// Retrieve weather forecast for a given US city
	Forecast(context.Context, *ForecastPayload) (res *Forecast2, err error)
}

Service that provides weather forecasts

Jump to

Keyboard shortcuts

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