Documentation
¶
Overview ¶
Package api provides primitives to interact with the openapi HTTP API.
Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.3.0 DO NOT EDIT.
Index ¶
- func Handler(si ServerInterface) http.Handler
- func HandlerFromMux(si ServerInterface, m *http.ServeMux) http.Handler
- func HandlerFromMuxWithBaseURL(si ServerInterface, m *http.ServeMux, baseURL string) http.Handler
- func HandlerWithOptions(si ServerInterface, options StdHTTPServerOptions) http.Handler
- func NewClearMaximumCurrentsRequest(server string) (*http.Request, error)
- func NewLockOutletRequest(server string, id Id, body LockOutletJSONRequestBody) (*http.Request, error)
- func NewLockOutletRequestWithBody(server string, id Id, contentType string, body io.Reader) (*http.Request, error)
- func NewRebootOutletRequest(server string, id Id) (*http.Request, error)
- func NewStatusRequest(server string, params *StatusParams) (*http.Request, error)
- func NewSwitchOutletRequest(server string, id Id, body SwitchOutletJSONRequestBody) (*http.Request, error)
- func NewSwitchOutletRequestWithBody(server string, id Id, contentType string, body io.Reader) (*http.Request, error)
- func NewTemperatureRequest(server string) (*http.Request, error)
- func NewWhoAmIRequest(server string) (*http.Request, error)
- func OutletIDFromRequest(r any) string
- type BreakerStatus
- type ClearMaximumCurrents200Response
- type ClearMaximumCurrents400JSONResponse
- type ClearMaximumCurrents401JSONResponse
- type ClearMaximumCurrents403JSONResponse
- type ClearMaximumCurrents500JSONResponse
- type ClearMaximumCurrentsRequestObject
- type ClearMaximumCurrentsResponse
- type ClearMaximumCurrentsResponseObject
- type Client
- func (c *Client) ClearMaximumCurrents(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) LockOutlet(ctx context.Context, id Id, body LockOutletJSONRequestBody, ...) (*http.Response, error)
- func (c *Client) LockOutletWithBody(ctx context.Context, id Id, contentType string, body io.Reader, ...) (*http.Response, error)
- func (c *Client) RebootOutlet(ctx context.Context, id Id, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) Status(ctx context.Context, params *StatusParams, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) SwitchOutlet(ctx context.Context, id Id, body SwitchOutletJSONRequestBody, ...) (*http.Response, error)
- func (c *Client) SwitchOutletWithBody(ctx context.Context, id Id, contentType string, body io.Reader, ...) (*http.Response, error)
- func (c *Client) Temperature(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) WhoAmI(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
- type ClientInterface
- type ClientOption
- type ClientWithResponses
- func (c *ClientWithResponses) ClearMaximumCurrentsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ClearMaximumCurrentsResponse, error)
- func (c *ClientWithResponses) LockOutletWithBodyWithResponse(ctx context.Context, id Id, contentType string, body io.Reader, ...) (*LockOutletResponse, error)
- func (c *ClientWithResponses) LockOutletWithResponse(ctx context.Context, id Id, body LockOutletJSONRequestBody, ...) (*LockOutletResponse, error)
- func (c *ClientWithResponses) RebootOutletWithResponse(ctx context.Context, id Id, reqEditors ...RequestEditorFn) (*RebootOutletResponse, error)
- func (c *ClientWithResponses) StatusWithResponse(ctx context.Context, params *StatusParams, reqEditors ...RequestEditorFn) (*StatusResponse, error)
- func (c *ClientWithResponses) SwitchOutletWithBodyWithResponse(ctx context.Context, id Id, contentType string, body io.Reader, ...) (*SwitchOutletResponse, error)
- func (c *ClientWithResponses) SwitchOutletWithResponse(ctx context.Context, id Id, body SwitchOutletJSONRequestBody, ...) (*SwitchOutletResponse, error)
- func (c *ClientWithResponses) TemperatureWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*TemperatureResponse, error)
- func (c *ClientWithResponses) WhoAmIWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*WhoAmIResponse, error)
- type ClientWithResponsesInterface
- type Detailed
- type Error
- type ErrorJSONResponse
- type GroupStatus
- type HttpRequestDoer
- type Id
- type InvalidParamFormatError
- type LockOutlet200Response
- type LockOutlet400JSONResponse
- type LockOutlet401JSONResponse
- type LockOutlet403JSONResponse
- type LockOutlet404JSONResponse
- type LockOutlet500JSONResponse
- type LockOutletJSONBody
- type LockOutletJSONRequestBody
- type LockOutletRequestObject
- type LockOutletResponse
- type LockOutletResponseObject
- type Measurements
- type MiddlewareFunc
- type OutletStatus
- type RebootOutlet200Response
- type RebootOutlet400JSONResponse
- type RebootOutlet401JSONResponse
- type RebootOutlet403JSONResponse
- type RebootOutlet404JSONResponse
- type RebootOutlet500JSONResponse
- type RebootOutletRequestObject
- type RebootOutletResponse
- type RebootOutletResponseObject
- type RequestEditorFn
- type RequiredHeaderError
- type RequiredParamError
- type ServerInterface
- type ServerInterfaceWrapper
- func (siw *ServerInterfaceWrapper) ClearMaximumCurrents(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) LockOutlet(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) RebootOutlet(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) Status(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) SwitchOutlet(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) Temperature(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) WhoAmI(w http.ResponseWriter, r *http.Request)
- type Status
- type Status200JSONResponse
- type Status401JSONResponse
- type Status403JSONResponse
- type Status500JSONResponse
- type StatusParams
- type StatusRequestObject
- type StatusResponse
- type StatusResponseObject
- type StdHTTPServerOptions
- type StrictHTTPServerOptions
- type StrictHandlerFunc
- type StrictMiddlewareFunc
- type StrictServerInterface
- type SuccessResponse
- type SwitchOutlet200Response
- type SwitchOutlet400JSONResponse
- type SwitchOutlet401JSONResponse
- type SwitchOutlet403JSONResponse
- type SwitchOutlet404JSONResponse
- type SwitchOutlet500JSONResponse
- type SwitchOutletJSONBody
- type SwitchOutletJSONRequestBody
- type SwitchOutletRequestObject
- type SwitchOutletResponse
- type SwitchOutletResponseObject
- type Temperature200JSONResponse
- type Temperature401JSONResponse
- type Temperature403JSONResponse
- type Temperature500JSONResponse
- type TemperatureRequestObject
- type TemperatureResponse
- type TemperatureResponseObject
- type TooManyValuesForParamError
- type UnescapedCookieParamError
- type UnmarshalingParamError
- type WhoAmI200JSONResponse
- type WhoAmI401JSONResponse
- type WhoAmI403JSONResponse
- type WhoAmI500JSONResponse
- type WhoAmIRequestObject
- type WhoAmIResponse
- type WhoAmIResponseObject
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Handler ¶
func Handler(si ServerInterface) http.Handler
Handler creates http.Handler with routing matching OpenAPI spec.
func HandlerFromMux ¶
func HandlerFromMux(si ServerInterface, m *http.ServeMux) http.Handler
HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.
func HandlerWithOptions ¶
func HandlerWithOptions(si ServerInterface, options StdHTTPServerOptions) http.Handler
HandlerWithOptions creates http.Handler with additional options
func NewClearMaximumCurrentsRequest ¶
NewClearMaximumCurrentsRequest generates requests for ClearMaximumCurrents
func NewLockOutletRequest ¶
func NewLockOutletRequest(server string, id Id, body LockOutletJSONRequestBody) (*http.Request, error)
NewLockOutletRequest calls the generic LockOutlet builder with application/json body
func NewLockOutletRequestWithBody ¶
func NewLockOutletRequestWithBody(server string, id Id, contentType string, body io.Reader) (*http.Request, error)
NewLockOutletRequestWithBody generates requests for LockOutlet with any type of body
func NewRebootOutletRequest ¶
NewRebootOutletRequest generates requests for RebootOutlet
func NewStatusRequest ¶
func NewStatusRequest(server string, params *StatusParams) (*http.Request, error)
NewStatusRequest generates requests for Status
func NewSwitchOutletRequest ¶
func NewSwitchOutletRequest(server string, id Id, body SwitchOutletJSONRequestBody) (*http.Request, error)
NewSwitchOutletRequest calls the generic SwitchOutlet builder with application/json body
func NewSwitchOutletRequestWithBody ¶
func NewSwitchOutletRequestWithBody(server string, id Id, contentType string, body io.Reader) (*http.Request, error)
NewSwitchOutletRequestWithBody generates requests for SwitchOutlet with any type of body
func NewTemperatureRequest ¶
NewTemperatureRequest generates requests for Temperature
func NewWhoAmIRequest ¶
NewWhoAmIRequest generates requests for WhoAmI
func OutletIDFromRequest ¶
Types ¶
type BreakerStatus ¶
type BreakerStatus struct {
ID int `json:"id"`
Name string `json:"name"`
PeakRMSCurrent float32 `json:"peak_rms_current"`
TrueRMSCurrent float32 `json:"true_rms_current"`
}
BreakerStatus defines model for BreakerStatus.
type ClearMaximumCurrents200Response ¶
type ClearMaximumCurrents200Response = SuccessResponse
func (ClearMaximumCurrents200Response) VisitClearMaximumCurrentsResponse ¶
func (response ClearMaximumCurrents200Response) VisitClearMaximumCurrentsResponse(w http.ResponseWriter) error
type ClearMaximumCurrents400JSONResponse ¶
type ClearMaximumCurrents400JSONResponse struct{ ErrorJSONResponse }
func (ClearMaximumCurrents400JSONResponse) VisitClearMaximumCurrentsResponse ¶
func (response ClearMaximumCurrents400JSONResponse) VisitClearMaximumCurrentsResponse(w http.ResponseWriter) error
type ClearMaximumCurrents401JSONResponse ¶
type ClearMaximumCurrents401JSONResponse struct {
// Error An error message
Error string `json:"error"`
}
func (ClearMaximumCurrents401JSONResponse) VisitClearMaximumCurrentsResponse ¶
func (response ClearMaximumCurrents401JSONResponse) VisitClearMaximumCurrentsResponse(w http.ResponseWriter) error
type ClearMaximumCurrents403JSONResponse ¶
type ClearMaximumCurrents403JSONResponse struct {
// Error An error message
Error string `json:"error"`
}
func (ClearMaximumCurrents403JSONResponse) VisitClearMaximumCurrentsResponse ¶
func (response ClearMaximumCurrents403JSONResponse) VisitClearMaximumCurrentsResponse(w http.ResponseWriter) error
type ClearMaximumCurrents500JSONResponse ¶
type ClearMaximumCurrents500JSONResponse struct {
// Error An error message
Error string `json:"error"`
}
func (ClearMaximumCurrents500JSONResponse) VisitClearMaximumCurrentsResponse ¶
func (response ClearMaximumCurrents500JSONResponse) VisitClearMaximumCurrentsResponse(w http.ResponseWriter) error
type ClearMaximumCurrentsRequestObject ¶
type ClearMaximumCurrentsRequestObject struct {
}
type ClearMaximumCurrentsResponse ¶
type ClearMaximumCurrentsResponse struct {
Body []byte
HTTPResponse *http.Response
JSON400 *Error
JSON401 *Error
JSON403 *Error
JSON500 *Error
}
func ParseClearMaximumCurrentsResponse ¶
func ParseClearMaximumCurrentsResponse(rsp *http.Response) (*ClearMaximumCurrentsResponse, error)
ParseClearMaximumCurrentsResponse parses an HTTP response from a ClearMaximumCurrentsWithResponse call
func (ClearMaximumCurrentsResponse) Status ¶
func (r ClearMaximumCurrentsResponse) Status() string
Status returns HTTPResponse.Status
func (ClearMaximumCurrentsResponse) StatusCode ¶
func (r ClearMaximumCurrentsResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type ClearMaximumCurrentsResponseObject ¶
type ClearMaximumCurrentsResponseObject interface {
VisitClearMaximumCurrentsResponse(w http.ResponseWriter) error
}
type Client ¶
type Client struct {
// The endpoint of the server conforming to this interface, with scheme,
// https://api.deepmap.com for example. This can contain a path relative
// to the server, such as https://api.deepmap.com/dev-test, and all the
// paths in the swagger spec will be appended to the server.
Server string
// Doer for performing requests, typically a *http.Client with any
// customized settings, such as certificate chains.
Client HttpRequestDoer
// A list of callbacks for modifying requests which are generated before sending over
// the network.
RequestEditors []RequestEditorFn
}
Client which conforms to the OpenAPI3 specification for this service.
func NewClient ¶
func NewClient(server string, opts ...ClientOption) (*Client, error)
Creates a new Client, with reasonable defaults
func (*Client) ClearMaximumCurrents ¶
func (*Client) LockOutlet ¶
func (c *Client) LockOutlet(ctx context.Context, id Id, body LockOutletJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) LockOutletWithBody ¶
func (*Client) RebootOutlet ¶
func (*Client) Status ¶
func (c *Client) Status(ctx context.Context, params *StatusParams, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) SwitchOutlet ¶
func (c *Client) SwitchOutlet(ctx context.Context, id Id, body SwitchOutletJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) SwitchOutletWithBody ¶
func (*Client) Temperature ¶
type ClientInterface ¶
type ClientInterface interface {
// ClearMaximumCurrents request
ClearMaximumCurrents(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
// LockOutletWithBody request with any body
LockOutletWithBody(ctx context.Context, id Id, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
LockOutlet(ctx context.Context, id Id, body LockOutletJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// RebootOutlet request
RebootOutlet(ctx context.Context, id Id, reqEditors ...RequestEditorFn) (*http.Response, error)
// SwitchOutletWithBody request with any body
SwitchOutletWithBody(ctx context.Context, id Id, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
SwitchOutlet(ctx context.Context, id Id, body SwitchOutletJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// Status request
Status(ctx context.Context, params *StatusParams, reqEditors ...RequestEditorFn) (*http.Response, error)
// Temperature request
Temperature(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
// WhoAmI request
WhoAmI(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
}
The interface specification for the client above.
type ClientOption ¶
ClientOption allows setting custom parameters during construction
func WithHTTPClient ¶
func WithHTTPClient(doer HttpRequestDoer) ClientOption
WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.
func WithRequestEditorFn ¶
func WithRequestEditorFn(fn RequestEditorFn) ClientOption
WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.
type ClientWithResponses ¶
type ClientWithResponses struct {
ClientInterface
}
ClientWithResponses builds on ClientInterface to offer response payloads
func NewClientWithResponses ¶
func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)
NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling
func (*ClientWithResponses) ClearMaximumCurrentsWithResponse ¶
func (c *ClientWithResponses) ClearMaximumCurrentsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ClearMaximumCurrentsResponse, error)
ClearMaximumCurrentsWithResponse request returning *ClearMaximumCurrentsResponse
func (*ClientWithResponses) LockOutletWithBodyWithResponse ¶
func (c *ClientWithResponses) LockOutletWithBodyWithResponse(ctx context.Context, id Id, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*LockOutletResponse, error)
LockOutletWithBodyWithResponse request with arbitrary body returning *LockOutletResponse
func (*ClientWithResponses) LockOutletWithResponse ¶
func (c *ClientWithResponses) LockOutletWithResponse(ctx context.Context, id Id, body LockOutletJSONRequestBody, reqEditors ...RequestEditorFn) (*LockOutletResponse, error)
func (*ClientWithResponses) RebootOutletWithResponse ¶
func (c *ClientWithResponses) RebootOutletWithResponse(ctx context.Context, id Id, reqEditors ...RequestEditorFn) (*RebootOutletResponse, error)
RebootOutletWithResponse request returning *RebootOutletResponse
func (*ClientWithResponses) StatusWithResponse ¶
func (c *ClientWithResponses) StatusWithResponse(ctx context.Context, params *StatusParams, reqEditors ...RequestEditorFn) (*StatusResponse, error)
StatusWithResponse request returning *StatusResponse
func (*ClientWithResponses) SwitchOutletWithBodyWithResponse ¶
func (c *ClientWithResponses) SwitchOutletWithBodyWithResponse(ctx context.Context, id Id, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SwitchOutletResponse, error)
SwitchOutletWithBodyWithResponse request with arbitrary body returning *SwitchOutletResponse
func (*ClientWithResponses) SwitchOutletWithResponse ¶
func (c *ClientWithResponses) SwitchOutletWithResponse(ctx context.Context, id Id, body SwitchOutletJSONRequestBody, reqEditors ...RequestEditorFn) (*SwitchOutletResponse, error)
func (*ClientWithResponses) TemperatureWithResponse ¶
func (c *ClientWithResponses) TemperatureWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*TemperatureResponse, error)
TemperatureWithResponse request returning *TemperatureResponse
func (*ClientWithResponses) WhoAmIWithResponse ¶
func (c *ClientWithResponses) WhoAmIWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*WhoAmIResponse, error)
WhoAmIWithResponse request returning *WhoAmIResponse
type ClientWithResponsesInterface ¶
type ClientWithResponsesInterface interface {
// ClearMaximumCurrentsWithResponse request
ClearMaximumCurrentsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ClearMaximumCurrentsResponse, error)
// LockOutletWithBodyWithResponse request with any body
LockOutletWithBodyWithResponse(ctx context.Context, id Id, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*LockOutletResponse, error)
LockOutletWithResponse(ctx context.Context, id Id, body LockOutletJSONRequestBody, reqEditors ...RequestEditorFn) (*LockOutletResponse, error)
// RebootOutletWithResponse request
RebootOutletWithResponse(ctx context.Context, id Id, reqEditors ...RequestEditorFn) (*RebootOutletResponse, error)
// SwitchOutletWithBodyWithResponse request with any body
SwitchOutletWithBodyWithResponse(ctx context.Context, id Id, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SwitchOutletResponse, error)
SwitchOutletWithResponse(ctx context.Context, id Id, body SwitchOutletJSONRequestBody, reqEditors ...RequestEditorFn) (*SwitchOutletResponse, error)
// StatusWithResponse request
StatusWithResponse(ctx context.Context, params *StatusParams, reqEditors ...RequestEditorFn) (*StatusResponse, error)
// TemperatureWithResponse request
TemperatureWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*TemperatureResponse, error)
// WhoAmIWithResponse request
WhoAmIWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*WhoAmIResponse, error)
}
ClientWithResponsesInterface is the interface specification for the client with responses above.
type Error ¶
type Error struct {
// Error An error message
Error string `json:"error"`
}
Error defines model for Error.
type ErrorJSONResponse ¶
type ErrorJSONResponse struct {
// Error An error message
Error string `json:"error"`
}
type GroupStatus ¶
type GroupStatus struct {
// AveragePower Average power [W]
AveragePower float32 `json:"avg_power"`
BreakerID int `json:"breaker_id"`
// Energy Energy [kWh]
Energy float32 `json:"energy"`
ID int `json:"id"`
Name string `json:"name"`
// PeakRMSCurrent Peak RMS current [A]
PeakRMSCurrent float32 `json:"peak_rms_current"`
// Power Power [VA]
Power float32 `json:"power"`
// TrueRMSCurrent True RMS current [A]
TrueRMSCurrent float32 `json:"true_rms_current"`
// TrueRMSVoltage True RMS voltage [V]
TrueRMSVoltage float32 `json:"true_rms_voltage"`
}
GroupStatus defines model for GroupStatus.
type HttpRequestDoer ¶
Doer performs HTTP requests.
The standard http.Client implements this interface.
type InvalidParamFormatError ¶
func (*InvalidParamFormatError) Error ¶
func (e *InvalidParamFormatError) Error() string
func (*InvalidParamFormatError) Unwrap ¶
func (e *InvalidParamFormatError) Unwrap() error
type LockOutlet200Response ¶
type LockOutlet200Response = SuccessResponse
func (LockOutlet200Response) VisitLockOutletResponse ¶
func (response LockOutlet200Response) VisitLockOutletResponse(w http.ResponseWriter) error
type LockOutlet400JSONResponse ¶
type LockOutlet400JSONResponse struct{ ErrorJSONResponse }
func (LockOutlet400JSONResponse) VisitLockOutletResponse ¶
func (response LockOutlet400JSONResponse) VisitLockOutletResponse(w http.ResponseWriter) error
type LockOutlet401JSONResponse ¶
type LockOutlet401JSONResponse struct {
// Error An error message
Error string `json:"error"`
}
func (LockOutlet401JSONResponse) VisitLockOutletResponse ¶
func (response LockOutlet401JSONResponse) VisitLockOutletResponse(w http.ResponseWriter) error
type LockOutlet403JSONResponse ¶
type LockOutlet403JSONResponse struct {
// Error An error message
Error string `json:"error"`
}
func (LockOutlet403JSONResponse) VisitLockOutletResponse ¶
func (response LockOutlet403JSONResponse) VisitLockOutletResponse(w http.ResponseWriter) error
type LockOutlet404JSONResponse ¶
type LockOutlet404JSONResponse struct {
// Error An error message
Error string `json:"error"`
}
func (LockOutlet404JSONResponse) VisitLockOutletResponse ¶
func (response LockOutlet404JSONResponse) VisitLockOutletResponse(w http.ResponseWriter) error
type LockOutlet500JSONResponse ¶
type LockOutlet500JSONResponse struct {
// Error An error message
Error string `json:"error"`
}
func (LockOutlet500JSONResponse) VisitLockOutletResponse ¶
func (response LockOutlet500JSONResponse) VisitLockOutletResponse(w http.ResponseWriter) error
type LockOutletJSONBody ¶
type LockOutletJSONBody = bool
LockOutletJSONBody defines parameters for LockOutlet.
type LockOutletJSONRequestBody ¶
type LockOutletJSONRequestBody = LockOutletJSONBody
LockOutletJSONRequestBody defines body for LockOutlet for application/json ContentType.
type LockOutletRequestObject ¶
type LockOutletRequestObject struct {
Id Id `json:"id"`
Body *LockOutletJSONRequestBody
}
type LockOutletResponse ¶
type LockOutletResponse struct {
Body []byte
HTTPResponse *http.Response
JSON400 *Error
JSON401 *Error
JSON403 *Error
JSON404 *Error
JSON500 *Error
}
func ParseLockOutletResponse ¶
func ParseLockOutletResponse(rsp *http.Response) (*LockOutletResponse, error)
ParseLockOutletResponse parses an HTTP response from a LockOutletWithResponse call
func (LockOutletResponse) Status ¶
func (r LockOutletResponse) Status() string
Status returns HTTPResponse.Status
func (LockOutletResponse) StatusCode ¶
func (r LockOutletResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type LockOutletResponseObject ¶
type LockOutletResponseObject interface {
VisitLockOutletResponse(w http.ResponseWriter) error
}
type Measurements ¶
type Measurements struct {
// AveragePower Average power [W]
AveragePower float32 `json:"avg_power"`
// Energy Energy [kWh]
Energy float32 `json:"energy"`
// PeakRMSCurrent Peak RMS current [A]
PeakRMSCurrent float32 `json:"peak_rms_current"`
// Power Power [VA]
Power float32 `json:"power"`
// TrueRMSCurrent True RMS current [A]
TrueRMSCurrent float32 `json:"true_rms_current"`
// TrueRMSVoltage True RMS voltage [V]
TrueRMSVoltage float32 `json:"true_rms_voltage"`
}
Measurements defines model for Measurements.
type OutletStatus ¶
type OutletStatus struct {
// AveragePower Average power [W]
AveragePower float32 `json:"avg_power"`
BreakerID int `json:"breaker_id"`
// Energy Energy [kWh]
Energy float32 `json:"energy"`
GroupID int `json:"group_id"`
ID int `json:"id"`
Locked bool `json:"locked"`
Name string `json:"name"`
// PeakRMSCurrent Peak RMS current [A]
PeakRMSCurrent float32 `json:"peak_rms_current"`
// Power Power [VA]
Power float32 `json:"power"`
State bool `json:"state"`
// TrueRMSCurrent True RMS current [A]
TrueRMSCurrent float32 `json:"true_rms_current"`
// TrueRMSVoltage True RMS voltage [V]
TrueRMSVoltage float32 `json:"true_rms_voltage"`
}
OutletStatus defines model for OutletStatus.
type RebootOutlet200Response ¶
type RebootOutlet200Response = SuccessResponse
func (RebootOutlet200Response) VisitRebootOutletResponse ¶
func (response RebootOutlet200Response) VisitRebootOutletResponse(w http.ResponseWriter) error
type RebootOutlet400JSONResponse ¶
type RebootOutlet400JSONResponse struct{ ErrorJSONResponse }
func (RebootOutlet400JSONResponse) VisitRebootOutletResponse ¶
func (response RebootOutlet400JSONResponse) VisitRebootOutletResponse(w http.ResponseWriter) error
type RebootOutlet401JSONResponse ¶
type RebootOutlet401JSONResponse struct {
// Error An error message
Error string `json:"error"`
}
func (RebootOutlet401JSONResponse) VisitRebootOutletResponse ¶
func (response RebootOutlet401JSONResponse) VisitRebootOutletResponse(w http.ResponseWriter) error
type RebootOutlet403JSONResponse ¶
type RebootOutlet403JSONResponse struct {
// Error An error message
Error string `json:"error"`
}
func (RebootOutlet403JSONResponse) VisitRebootOutletResponse ¶
func (response RebootOutlet403JSONResponse) VisitRebootOutletResponse(w http.ResponseWriter) error
type RebootOutlet404JSONResponse ¶
type RebootOutlet404JSONResponse struct {
// Error An error message
Error string `json:"error"`
}
func (RebootOutlet404JSONResponse) VisitRebootOutletResponse ¶
func (response RebootOutlet404JSONResponse) VisitRebootOutletResponse(w http.ResponseWriter) error
type RebootOutlet500JSONResponse ¶
type RebootOutlet500JSONResponse struct {
// Error An error message
Error string `json:"error"`
}
func (RebootOutlet500JSONResponse) VisitRebootOutletResponse ¶
func (response RebootOutlet500JSONResponse) VisitRebootOutletResponse(w http.ResponseWriter) error
type RebootOutletRequestObject ¶
type RebootOutletRequestObject struct {
Id Id `json:"id"`
}
type RebootOutletResponse ¶
type RebootOutletResponse struct {
Body []byte
HTTPResponse *http.Response
JSON400 *Error
JSON401 *Error
JSON403 *Error
JSON404 *Error
JSON500 *Error
}
func ParseRebootOutletResponse ¶
func ParseRebootOutletResponse(rsp *http.Response) (*RebootOutletResponse, error)
ParseRebootOutletResponse parses an HTTP response from a RebootOutletWithResponse call
func (RebootOutletResponse) Status ¶
func (r RebootOutletResponse) Status() string
Status returns HTTPResponse.Status
func (RebootOutletResponse) StatusCode ¶
func (r RebootOutletResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type RebootOutletResponseObject ¶
type RebootOutletResponseObject interface {
VisitRebootOutletResponse(w http.ResponseWriter) error
}
type RequestEditorFn ¶
RequestEditorFn is the function signature for the RequestEditor callback function
type RequiredHeaderError ¶
func (*RequiredHeaderError) Error ¶
func (e *RequiredHeaderError) Error() string
func (*RequiredHeaderError) Unwrap ¶
func (e *RequiredHeaderError) Unwrap() error
type RequiredParamError ¶
type RequiredParamError struct {
ParamName string
}
func (*RequiredParamError) Error ¶
func (e *RequiredParamError) Error() string
type ServerInterface ¶
type ServerInterface interface {
// Clear peak RMS current
// (POST /clear)
ClearMaximumCurrents(w http.ResponseWriter, r *http.Request)
// Switch lock state of outlet
// (POST /outlet/{id}/lock)
LockOutlet(w http.ResponseWriter, r *http.Request, id Id)
// Reboot the outlet
// (POST /outlet/{id}/reboot)
RebootOutlet(w http.ResponseWriter, r *http.Request, id Id)
// Switch state of outlet
// (POST /outlet/{id}/state)
SwitchOutlet(w http.ResponseWriter, r *http.Request, id Id)
// Get status of PDU
// (GET /status)
Status(w http.ResponseWriter, r *http.Request, params StatusParams)
// Get temperature of PDU
// (GET /temperature)
Temperature(w http.ResponseWriter, r *http.Request)
// Get name of current user
// (GET /whoami)
WhoAmI(w http.ResponseWriter, r *http.Request)
}
ServerInterface represents all server handlers.
func NewStrictHandler ¶
func NewStrictHandler(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc) ServerInterface
func NewStrictHandlerWithOptions ¶
func NewStrictHandlerWithOptions(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc, options StrictHTTPServerOptions) ServerInterface
type ServerInterfaceWrapper ¶
type ServerInterfaceWrapper struct {
Handler ServerInterface
HandlerMiddlewares []MiddlewareFunc
ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}
ServerInterfaceWrapper converts contexts to parameters.
func (*ServerInterfaceWrapper) ClearMaximumCurrents ¶
func (siw *ServerInterfaceWrapper) ClearMaximumCurrents(w http.ResponseWriter, r *http.Request)
ClearMaximumCurrents operation middleware
func (*ServerInterfaceWrapper) LockOutlet ¶
func (siw *ServerInterfaceWrapper) LockOutlet(w http.ResponseWriter, r *http.Request)
LockOutlet operation middleware
func (*ServerInterfaceWrapper) RebootOutlet ¶
func (siw *ServerInterfaceWrapper) RebootOutlet(w http.ResponseWriter, r *http.Request)
RebootOutlet operation middleware
func (*ServerInterfaceWrapper) Status ¶
func (siw *ServerInterfaceWrapper) Status(w http.ResponseWriter, r *http.Request)
Status operation middleware
func (*ServerInterfaceWrapper) SwitchOutlet ¶
func (siw *ServerInterfaceWrapper) SwitchOutlet(w http.ResponseWriter, r *http.Request)
SwitchOutlet operation middleware
func (*ServerInterfaceWrapper) Temperature ¶
func (siw *ServerInterfaceWrapper) Temperature(w http.ResponseWriter, r *http.Request)
Temperature operation middleware
func (*ServerInterfaceWrapper) WhoAmI ¶
func (siw *ServerInterfaceWrapper) WhoAmI(w http.ResponseWriter, r *http.Request)
WhoAmI operation middleware
type Status ¶
type Status struct {
Breakers []BreakerStatus `json:"breakers"`
Groups []GroupStatus `json:"groups"`
Outlets []OutletStatus `json:"outlets"`
Switches []bool `json:"switches"`
// Temperature Temperature [C]
Temperature float32 `json:"temperature"`
// Timestamp Time of last update
Timestamp time.Time `json:"timestamp"`
// TotalEnergy Total energy [kWh]
TotalEnergy float32 `json:"total_energy"`
}
Status defines model for Status.
type Status200JSONResponse ¶
type Status200JSONResponse Status
func (Status200JSONResponse) VisitStatusResponse ¶
func (response Status200JSONResponse) VisitStatusResponse(w http.ResponseWriter) error
type Status401JSONResponse ¶
type Status401JSONResponse struct{ ErrorJSONResponse }
func (Status401JSONResponse) VisitStatusResponse ¶
func (response Status401JSONResponse) VisitStatusResponse(w http.ResponseWriter) error
type Status403JSONResponse ¶
type Status403JSONResponse struct {
// Error An error message
Error string `json:"error"`
}
func (Status403JSONResponse) VisitStatusResponse ¶
func (response Status403JSONResponse) VisitStatusResponse(w http.ResponseWriter) error
type Status500JSONResponse ¶
type Status500JSONResponse struct {
// Error An error message
Error string `json:"error"`
}
func (Status500JSONResponse) VisitStatusResponse ¶
func (response Status500JSONResponse) VisitStatusResponse(w http.ResponseWriter) error
type StatusParams ¶
type StatusParams struct {
// Detailed Detailed
Detailed *Detailed `form:"detailed,omitempty" json:"detailed,omitempty"`
}
StatusParams defines parameters for Status.
type StatusRequestObject ¶
type StatusRequestObject struct {
Params StatusParams
}
type StatusResponse ¶
type StatusResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *Status
JSON401 *Error
JSON403 *Error
JSON500 *Error
}
func ParseStatusResponse ¶
func ParseStatusResponse(rsp *http.Response) (*StatusResponse, error)
ParseStatusResponse parses an HTTP response from a StatusWithResponse call
func (StatusResponse) Status ¶
func (r StatusResponse) Status() string
Status returns HTTPResponse.Status
func (StatusResponse) StatusCode ¶
func (r StatusResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type StatusResponseObject ¶
type StatusResponseObject interface {
VisitStatusResponse(w http.ResponseWriter) error
}
type StdHTTPServerOptions ¶
type StdHTTPServerOptions struct {
BaseURL string
BaseRouter *http.ServeMux
Middlewares []MiddlewareFunc
ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}
type StrictHTTPServerOptions ¶
type StrictHTTPServerOptions struct {
RequestErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
ResponseErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}
type StrictHandlerFunc ¶
type StrictHandlerFunc = strictnethttp.StrictHTTPHandlerFunc
type StrictMiddlewareFunc ¶
type StrictMiddlewareFunc = strictnethttp.StrictHTTPMiddlewareFunc
type StrictServerInterface ¶
type StrictServerInterface interface {
// Clear peak RMS current
// (POST /clear)
ClearMaximumCurrents(ctx context.Context, request ClearMaximumCurrentsRequestObject) (ClearMaximumCurrentsResponseObject, error)
// Switch lock state of outlet
// (POST /outlet/{id}/lock)
LockOutlet(ctx context.Context, request LockOutletRequestObject) (LockOutletResponseObject, error)
// Reboot the outlet
// (POST /outlet/{id}/reboot)
RebootOutlet(ctx context.Context, request RebootOutletRequestObject) (RebootOutletResponseObject, error)
// Switch state of outlet
// (POST /outlet/{id}/state)
SwitchOutlet(ctx context.Context, request SwitchOutletRequestObject) (SwitchOutletResponseObject, error)
// Get status of PDU
// (GET /status)
Status(ctx context.Context, request StatusRequestObject) (StatusResponseObject, error)
// Get temperature of PDU
// (GET /temperature)
Temperature(ctx context.Context, request TemperatureRequestObject) (TemperatureResponseObject, error)
// Get name of current user
// (GET /whoami)
WhoAmI(ctx context.Context, request WhoAmIRequestObject) (WhoAmIResponseObject, error)
}
StrictServerInterface represents all server handlers.
type SuccessResponse ¶
type SuccessResponse struct {
}
type SwitchOutlet200Response ¶
type SwitchOutlet200Response = SuccessResponse
func (SwitchOutlet200Response) VisitSwitchOutletResponse ¶
func (response SwitchOutlet200Response) VisitSwitchOutletResponse(w http.ResponseWriter) error
type SwitchOutlet400JSONResponse ¶
type SwitchOutlet400JSONResponse struct{ ErrorJSONResponse }
func (SwitchOutlet400JSONResponse) VisitSwitchOutletResponse ¶
func (response SwitchOutlet400JSONResponse) VisitSwitchOutletResponse(w http.ResponseWriter) error
type SwitchOutlet401JSONResponse ¶
type SwitchOutlet401JSONResponse struct {
// Error An error message
Error string `json:"error"`
}
func (SwitchOutlet401JSONResponse) VisitSwitchOutletResponse ¶
func (response SwitchOutlet401JSONResponse) VisitSwitchOutletResponse(w http.ResponseWriter) error
type SwitchOutlet403JSONResponse ¶
type SwitchOutlet403JSONResponse struct {
// Error An error message
Error string `json:"error"`
}
func (SwitchOutlet403JSONResponse) VisitSwitchOutletResponse ¶
func (response SwitchOutlet403JSONResponse) VisitSwitchOutletResponse(w http.ResponseWriter) error
type SwitchOutlet404JSONResponse ¶
type SwitchOutlet404JSONResponse struct {
// Error An error message
Error string `json:"error"`
}
func (SwitchOutlet404JSONResponse) VisitSwitchOutletResponse ¶
func (response SwitchOutlet404JSONResponse) VisitSwitchOutletResponse(w http.ResponseWriter) error
type SwitchOutlet500JSONResponse ¶
type SwitchOutlet500JSONResponse struct {
// Error An error message
Error string `json:"error"`
}
func (SwitchOutlet500JSONResponse) VisitSwitchOutletResponse ¶
func (response SwitchOutlet500JSONResponse) VisitSwitchOutletResponse(w http.ResponseWriter) error
type SwitchOutletJSONBody ¶
type SwitchOutletJSONBody = bool
SwitchOutletJSONBody defines parameters for SwitchOutlet.
type SwitchOutletJSONRequestBody ¶
type SwitchOutletJSONRequestBody = SwitchOutletJSONBody
SwitchOutletJSONRequestBody defines body for SwitchOutlet for application/json ContentType.
type SwitchOutletRequestObject ¶
type SwitchOutletRequestObject struct {
Id Id `json:"id"`
Body *SwitchOutletJSONRequestBody
}
type SwitchOutletResponse ¶
type SwitchOutletResponse struct {
Body []byte
HTTPResponse *http.Response
JSON400 *Error
JSON401 *Error
JSON403 *Error
JSON404 *Error
JSON500 *Error
}
func ParseSwitchOutletResponse ¶
func ParseSwitchOutletResponse(rsp *http.Response) (*SwitchOutletResponse, error)
ParseSwitchOutletResponse parses an HTTP response from a SwitchOutletWithResponse call
func (SwitchOutletResponse) Status ¶
func (r SwitchOutletResponse) Status() string
Status returns HTTPResponse.Status
func (SwitchOutletResponse) StatusCode ¶
func (r SwitchOutletResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type SwitchOutletResponseObject ¶
type SwitchOutletResponseObject interface {
VisitSwitchOutletResponse(w http.ResponseWriter) error
}
type Temperature200JSONResponse ¶
type Temperature200JSONResponse struct {
// Temperature Temperature [C]
Temperature float32 `json:"temperature"`
}
func (Temperature200JSONResponse) VisitTemperatureResponse ¶
func (response Temperature200JSONResponse) VisitTemperatureResponse(w http.ResponseWriter) error
type Temperature401JSONResponse ¶
type Temperature401JSONResponse struct{ ErrorJSONResponse }
func (Temperature401JSONResponse) VisitTemperatureResponse ¶
func (response Temperature401JSONResponse) VisitTemperatureResponse(w http.ResponseWriter) error
type Temperature403JSONResponse ¶
type Temperature403JSONResponse struct {
// Error An error message
Error string `json:"error"`
}
func (Temperature403JSONResponse) VisitTemperatureResponse ¶
func (response Temperature403JSONResponse) VisitTemperatureResponse(w http.ResponseWriter) error
type Temperature500JSONResponse ¶
type Temperature500JSONResponse struct {
// Error An error message
Error string `json:"error"`
}
func (Temperature500JSONResponse) VisitTemperatureResponse ¶
func (response Temperature500JSONResponse) VisitTemperatureResponse(w http.ResponseWriter) error
type TemperatureRequestObject ¶
type TemperatureRequestObject struct {
}
type TemperatureResponse ¶
type TemperatureResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *struct {
// Temperature Temperature [C]
Temperature float32 `json:"temperature"`
}
JSON401 *Error
JSON403 *Error
JSON500 *Error
}
func ParseTemperatureResponse ¶
func ParseTemperatureResponse(rsp *http.Response) (*TemperatureResponse, error)
ParseTemperatureResponse parses an HTTP response from a TemperatureWithResponse call
func (TemperatureResponse) Status ¶
func (r TemperatureResponse) Status() string
Status returns HTTPResponse.Status
func (TemperatureResponse) StatusCode ¶
func (r TemperatureResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type TemperatureResponseObject ¶
type TemperatureResponseObject interface {
VisitTemperatureResponse(w http.ResponseWriter) error
}
type TooManyValuesForParamError ¶
func (*TooManyValuesForParamError) Error ¶
func (e *TooManyValuesForParamError) Error() string
type UnescapedCookieParamError ¶
func (*UnescapedCookieParamError) Error ¶
func (e *UnescapedCookieParamError) Error() string
func (*UnescapedCookieParamError) Unwrap ¶
func (e *UnescapedCookieParamError) Unwrap() error
type UnmarshalingParamError ¶
func (*UnmarshalingParamError) Error ¶
func (e *UnmarshalingParamError) Error() string
func (*UnmarshalingParamError) Unwrap ¶
func (e *UnmarshalingParamError) Unwrap() error
type WhoAmI200JSONResponse ¶
type WhoAmI200JSONResponse struct {
// Username The username of the current user
Username string `json:"username"`
}
func (WhoAmI200JSONResponse) VisitWhoAmIResponse ¶
func (response WhoAmI200JSONResponse) VisitWhoAmIResponse(w http.ResponseWriter) error
type WhoAmI401JSONResponse ¶
type WhoAmI401JSONResponse struct{ ErrorJSONResponse }
func (WhoAmI401JSONResponse) VisitWhoAmIResponse ¶
func (response WhoAmI401JSONResponse) VisitWhoAmIResponse(w http.ResponseWriter) error
type WhoAmI403JSONResponse ¶
type WhoAmI403JSONResponse struct {
// Error An error message
Error string `json:"error"`
}
func (WhoAmI403JSONResponse) VisitWhoAmIResponse ¶
func (response WhoAmI403JSONResponse) VisitWhoAmIResponse(w http.ResponseWriter) error
type WhoAmI500JSONResponse ¶
type WhoAmI500JSONResponse struct {
// Error An error message
Error string `json:"error"`
}
func (WhoAmI500JSONResponse) VisitWhoAmIResponse ¶
func (response WhoAmI500JSONResponse) VisitWhoAmIResponse(w http.ResponseWriter) error
type WhoAmIRequestObject ¶
type WhoAmIRequestObject struct {
}
type WhoAmIResponse ¶
type WhoAmIResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *struct {
// Username The username of the current user
Username string `json:"username"`
}
JSON401 *Error
JSON403 *Error
JSON500 *Error
}
func ParseWhoAmIResponse ¶
func ParseWhoAmIResponse(rsp *http.Response) (*WhoAmIResponse, error)
ParseWhoAmIResponse parses an HTTP response from a WhoAmIWithResponse call
func (WhoAmIResponse) Status ¶
func (r WhoAmIResponse) Status() string
Status returns HTTPResponse.Status
func (WhoAmIResponse) StatusCode ¶
func (r WhoAmIResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type WhoAmIResponseObject ¶
type WhoAmIResponseObject interface {
VisitWhoAmIResponse(w http.ResponseWriter) error
}