client

package
v0.0.8-rc6 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddLocationPollerPath

func AddLocationPollerPath() string

AddLocationPollerPath returns the URL path to the Poller service add_location HTTP endpoint.

func AddWorkerPollerPath

func AddWorkerPollerPath() string

AddWorkerPollerPath returns the URL path to the Poller service add_worker HTTP endpoint.

func BuildAddLocationPayload

func BuildAddLocationPayload(pollerAddLocationCity string, pollerAddLocationState string) (*poller.CityAndState, error)

BuildAddLocationPayload builds the payload for the Poller add_location endpoint from CLI flags.

func BuildSubscribePayload

func BuildSubscribePayload(pollerSubscribeCity string, pollerSubscribeState string) (*poller.CityAndState, error)

BuildSubscribePayload builds the payload for the Poller subscribe endpoint from CLI flags.

func DecodeAddLocationResponse

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

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

  • "location_exists" (type *goa.ServiceError): http.StatusConflict
  • error: internal error

func DecodeAddWorkerResponse

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

DecodeAddWorkerResponse returns a decoder for responses returned by the Poller add_worker endpoint. restoreBody controls whether the response body should be restored after having been read.

func DecodeRemoveWorkerResponse

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

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

  • "too_few" (type *goa.ServiceError): http.StatusExpectationFailed
  • error: internal error

func DecodeStatusResponse

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

DecodeStatusResponse returns a decoder for responses returned by the Poller status endpoint. restoreBody controls whether the response body should be restored after having been read.

func DecodeSubscribeResponse

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

DecodeSubscribeResponse returns a decoder for responses returned by the Poller subscribe endpoint. restoreBody controls whether the response body should be restored after having been read.

func EncodeAddLocationRequest

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

EncodeAddLocationRequest returns an encoder for requests sent to the Poller add_location server.

func EncodeSubscribeRequest

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

EncodeSubscribeRequest returns an encoder for requests sent to the Poller subscribe server.

func NewAddLocationLocationExists

func NewAddLocationLocationExists(body *AddLocationLocationExistsResponseBody) *goa.ServiceError

NewAddLocationLocationExists builds a Poller service add_location endpoint location_exists error.

func NewAddWorkerWorkerOK

func NewAddWorkerWorkerOK(body *AddWorkerResponseBody) *poller.Worker

NewAddWorkerWorkerOK builds a "Poller" service "add_worker" endpoint result from a HTTP "OK" response.

func NewRemoveWorkerTooFew

func NewRemoveWorkerTooFew(body *RemoveWorkerTooFewResponseBody) *goa.ServiceError

NewRemoveWorkerTooFew builds a Poller service remove_worker endpoint too_few error.

func NewStatusPollerStatusOK

func NewStatusPollerStatusOK(body *StatusResponseBody) *poller.PollerStatus

NewStatusPollerStatusOK builds a "Poller" service "status" endpoint result from a HTTP "OK" response.

func NewSubscribeForecastOK

func NewSubscribeForecastOK(body *SubscribeResponseBody) *poller.Forecast

NewSubscribeForecastOK builds a "Poller" service "subscribe" endpoint result from a HTTP "OK" response.

func RemoveWorkerPollerPath

func RemoveWorkerPollerPath() string

RemoveWorkerPollerPath returns the URL path to the Poller service remove_worker HTTP endpoint.

func StatusPollerPath

func StatusPollerPath() string

StatusPollerPath returns the URL path to the Poller service status HTTP endpoint.

func SubscribePollerPath

func SubscribePollerPath() string

SubscribePollerPath returns the URL path to the Poller service subscribe HTTP endpoint.

func ValidateAddLocationLocationExistsResponseBody

func ValidateAddLocationLocationExistsResponseBody(body *AddLocationLocationExistsResponseBody) (err error)

ValidateAddLocationLocationExistsResponseBody runs the validations defined on add_location_location_exists_response_body

func ValidateAddWorkerResponseBody

func ValidateAddWorkerResponseBody(body *AddWorkerResponseBody) (err error)

ValidateAddWorkerResponseBody runs the validations defined on add_worker_response_body

func ValidateJobResponseBody

func ValidateJobResponseBody(body *JobResponseBody) (err error)

ValidateJobResponseBody runs the validations defined on JobResponseBody

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

func ValidateRemoveWorkerTooFewResponseBody

func ValidateRemoveWorkerTooFewResponseBody(body *RemoveWorkerTooFewResponseBody) (err error)

ValidateRemoveWorkerTooFewResponseBody runs the validations defined on remove_worker_too_few_response_body

func ValidateStatusResponseBody

func ValidateStatusResponseBody(body *StatusResponseBody) (err error)

ValidateStatusResponseBody runs the validations defined on StatusResponseBody

func ValidateSubscribeResponseBody

func ValidateSubscribeResponseBody(body *SubscribeResponseBody) (err error)

ValidateSubscribeResponseBody runs the validations defined on SubscribeResponseBody

func ValidateWorkerResponseBody

func ValidateWorkerResponseBody(body *WorkerResponseBody) (err error)

ValidateWorkerResponseBody runs the validations defined on WorkerResponseBody

Types

type AddLocationLocationExistsResponseBody

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

AddLocationLocationExistsResponseBody is the type of the "Poller" service "add_location" endpoint HTTP response body for the "location_exists" error.

type AddWorkerResponseBody

type AddWorkerResponseBody struct {
	// Worker ID
	ID *string `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
	// Worker poll jobs
	Jobs []*JobResponseBody `form:"jobs,omitempty" json:"jobs,omitempty" xml:"jobs,omitempty"`
	// Creation timestamp
	CreatedAt *string `form:"created_at,omitempty" json:"created_at,omitempty" xml:"created_at,omitempty"`
}

AddWorkerResponseBody is the type of the "Poller" service "add_worker" endpoint HTTP response body.

type Client

type Client struct {
	// AddLocation Doer is the HTTP client used to make requests to the
	// add_location endpoint.
	AddLocationDoer goahttp.Doer

	// Subscribe Doer is the HTTP client used to make requests to the subscribe
	// endpoint.
	SubscribeDoer goahttp.Doer

	// AddWorker Doer is the HTTP client used to make requests to the add_worker
	// endpoint.
	AddWorkerDoer goahttp.Doer

	// RemoveWorker Doer is the HTTP client used to make requests to the
	// remove_worker endpoint.
	RemoveWorkerDoer goahttp.Doer

	// Status Doer is the HTTP client used to make requests to the status endpoint.
	StatusDoer 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 Poller 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,
	dialer goahttp.Dialer,
	cfn *ConnConfigurer,
) *Client

NewClient instantiates HTTP clients for all the Poller service servers.

func (*Client) AddLocation

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

AddLocation returns an endpoint that makes HTTP requests to the Poller service add_location server.

func (*Client) AddWorker

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

AddWorker returns an endpoint that makes HTTP requests to the Poller service add_worker server.

func (*Client) BuildAddLocationRequest

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

BuildAddLocationRequest instantiates a HTTP request object with method and path set to call the "Poller" service "add_location" endpoint

func (*Client) BuildAddWorkerRequest

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

BuildAddWorkerRequest instantiates a HTTP request object with method and path set to call the "Poller" service "add_worker" endpoint

func (*Client) BuildRemoveWorkerRequest

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

BuildRemoveWorkerRequest instantiates a HTTP request object with method and path set to call the "Poller" service "remove_worker" endpoint

func (*Client) BuildStatusRequest

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

BuildStatusRequest instantiates a HTTP request object with method and path set to call the "Poller" service "status" endpoint

func (*Client) BuildSubscribeRequest

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

BuildSubscribeRequest instantiates a HTTP request object with method and path set to call the "Poller" service "subscribe" endpoint

func (*Client) RemoveWorker

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

RemoveWorker returns an endpoint that makes HTTP requests to the Poller service remove_worker server.

func (*Client) Status

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

Status returns an endpoint that makes HTTP requests to the Poller service status server.

func (*Client) Subscribe

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

Subscribe returns an endpoint that makes HTTP requests to the Poller service subscribe server.

type ConnConfigurer

type ConnConfigurer struct {
	SubscribeFn goahttp.ConnConfigureFunc
}

ConnConfigurer holds the websocket connection configurer functions for the streaming endpoints in "Poller" service.

func NewConnConfigurer

func NewConnConfigurer(fn goahttp.ConnConfigureFunc) *ConnConfigurer

NewConnConfigurer initializes the websocket connection configurer function with fn for all the streaming endpoints in "Poller" service.

type JobResponseBody

type JobResponseBody struct {
	// Job key
	Key *string `form:"key,omitempty" json:"key,omitempty" xml:"key,omitempty"`
	// Job payload
	Payload []byte `form:"payload,omitempty" json:"payload,omitempty" xml:"payload,omitempty"`
	// Creation timestamp
	CreatedAt *string `form:"created_at,omitempty" json:"created_at,omitempty" xml:"created_at,omitempty"`
}

JobResponseBody is used to define fields on response body types.

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.

type RemoveWorkerTooFewResponseBody

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

RemoveWorkerTooFewResponseBody is the type of the "Poller" service "remove_worker" endpoint HTTP response body for the "too_few" error.

type StatusResponseBody

type StatusResponseBody struct {
	// Poller workers
	Workers []*WorkerResponseBody `form:"workers,omitempty" json:"workers,omitempty" xml:"workers,omitempty"`
	// Location poll jobs
	Jobs []*JobResponseBody `form:"jobs,omitempty" json:"jobs,omitempty" xml:"jobs,omitempty"`
}

StatusResponseBody is the type of the "Poller" service "status" endpoint HTTP response body.

type SubscribeClientStream

type SubscribeClientStream struct {
	// contains filtered or unexported fields
}

SubscribeClientStream implements the poller.SubscribeClientStream interface.

func (*SubscribeClientStream) Recv

Recv reads instances of "poller.Forecast" from the "subscribe" endpoint websocket connection.

type SubscribeResponseBody

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

SubscribeResponseBody is the type of the "Poller" service "subscribe" endpoint HTTP response body.

type WorkerResponseBody

type WorkerResponseBody struct {
	// Worker ID
	ID *string `form:"id,omitempty" json:"id,omitempty" xml:"id,omitempty"`
	// Worker poll jobs
	Jobs []*JobResponseBody `form:"jobs,omitempty" json:"jobs,omitempty" xml:"jobs,omitempty"`
	// Creation timestamp
	CreatedAt *string `form:"created_at,omitempty" json:"created_at,omitempty" xml:"created_at,omitempty"`
}

WorkerResponseBody 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