Documentation ¶
Overview ¶
Implements various Alexa home automation APIs in AWS Lambda and serves as an anti-corruption layer hiding the misery (overcomplicated comms), sending only the relevant commands to Hautomo via SQS queue (so no direct connection required)
Index ¶
- type ExternalSystems
- type HandlerOutput
- type Handlers
- func (h *Handlers) AlexaAuthorizationAcceptGrantInput(ctx context.Context, directiveMsg *alexatypes.DirectiveInput, ...) (*alexatypes.AlexaResponse, error)
- func (h *Handlers) AlexaBrightnessControllerSetBrightness(ctx context.Context, directiveMsg *alexatypes.DirectiveInput, ...) (*alexatypes.AlexaResponse, error)
- func (h *Handlers) AlexaColorControllerSetColor(ctx context.Context, directiveMsg *alexatypes.DirectiveInput, ...) (*alexatypes.AlexaResponse, error)
- func (h *Handlers) AlexaColorTemperatureControllerSetColorTemperature(ctx context.Context, directiveMsg *alexatypes.DirectiveInput, ...) (*alexatypes.AlexaResponse, error)
- func (h *Handlers) AlexaDiscoveryDiscoverInput(ctx context.Context, directiveMsg *alexatypes.DirectiveInput, ...) (*alexatypes.AlexaResponse, error)
- func (h *Handlers) AlexaPercentageControllerSetPercentage(ctx context.Context, directiveMsg *alexatypes.DirectiveInput, ...) (*alexatypes.AlexaResponse, error)
- func (h *Handlers) AlexaPlaybackControllerFastForward(ctx context.Context, directiveMsg *alexatypes.DirectiveInput, ...) (*alexatypes.AlexaResponse, error)
- func (h *Handlers) AlexaPlaybackControllerNext(ctx context.Context, directiveMsg *alexatypes.DirectiveInput, ...) (*alexatypes.AlexaResponse, error)
- func (h *Handlers) AlexaPlaybackControllerPause(ctx context.Context, directiveMsg *alexatypes.DirectiveInput, ...) (*alexatypes.AlexaResponse, error)
- func (h *Handlers) AlexaPlaybackControllerPlay(ctx context.Context, directiveMsg *alexatypes.DirectiveInput, ...) (*alexatypes.AlexaResponse, error)
- func (h *Handlers) AlexaPlaybackControllerPrevious(ctx context.Context, directiveMsg *alexatypes.DirectiveInput, ...) (*alexatypes.AlexaResponse, error)
- func (h *Handlers) AlexaPlaybackControllerRewind(ctx context.Context, directiveMsg *alexatypes.DirectiveInput, ...) (*alexatypes.AlexaResponse, error)
- func (h *Handlers) AlexaPlaybackControllerStartOver(ctx context.Context, directiveMsg *alexatypes.DirectiveInput, ...) (*alexatypes.AlexaResponse, error)
- func (h *Handlers) AlexaPlaybackControllerStop(ctx context.Context, directiveMsg *alexatypes.DirectiveInput, ...) (*alexatypes.AlexaResponse, error)
- func (h *Handlers) AlexaPowerControllerTurnOff(ctx context.Context, directiveMsg *alexatypes.DirectiveInput, ...) (*alexatypes.AlexaResponse, error)
- func (h *Handlers) AlexaPowerControllerTurnOn(ctx context.Context, directiveMsg *alexatypes.DirectiveInput, ...) (*alexatypes.AlexaResponse, error)
- func (h *Handlers) AlexaReportStateInput(ctx context.Context, directiveMsg *alexatypes.DirectiveInput, ...) (*alexatypes.AlexaResponse, error)
- func (h *Handlers) Handle(ctx context.Context, input []byte) (*alexatypes.AlexaResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExternalSystems ¶
type ExternalSystems interface { TokenToUserId(ctx context.Context, token string) (string, error) FetchDiscoveryFile(ctx context.Context, userId string) (io.ReadCloser, error) SendCommand(ctx context.Context, queue string, command aamessages.Message) error }
abstracts away external side effects, so core logic can be tested
func NewExternalSystems ¶
func NewExternalSystems() (ExternalSystems, error)
type HandlerOutput ¶
type HandlerOutput struct { Queue string QueueMsg aamessages.Message Response *alexatypes.AlexaResponse }
type Handlers ¶
type Handlers struct {
// contains filtered or unexported fields
}
func New ¶
func New(extSystems ExternalSystems, msgIdGenerator messageIdGenerator, now timeGetter) *Handlers
func (*Handlers) AlexaAuthorizationAcceptGrantInput ¶
func (h *Handlers) AlexaAuthorizationAcceptGrantInput( ctx context.Context, directiveMsg *alexatypes.DirectiveInput, payload *alexatypes.AlexaAuthorizationAcceptGrantInput, ) (*alexatypes.AlexaResponse, error)
func (*Handlers) AlexaBrightnessControllerSetBrightness ¶
func (h *Handlers) AlexaBrightnessControllerSetBrightness( ctx context.Context, directiveMsg *alexatypes.DirectiveInput, payload *alexatypes.AlexaBrightnessControllerSetBrightness, ) (*alexatypes.AlexaResponse, error)
func (*Handlers) AlexaColorControllerSetColor ¶
func (h *Handlers) AlexaColorControllerSetColor( ctx context.Context, directiveMsg *alexatypes.DirectiveInput, payload *alexatypes.AlexaColorControllerSetColor, ) (*alexatypes.AlexaResponse, error)
func (*Handlers) AlexaColorTemperatureControllerSetColorTemperature ¶
func (h *Handlers) AlexaColorTemperatureControllerSetColorTemperature( ctx context.Context, directiveMsg *alexatypes.DirectiveInput, payload *alexatypes.AlexaColorTemperatureControllerSetColorTemperature, ) (*alexatypes.AlexaResponse, error)
func (*Handlers) AlexaDiscoveryDiscoverInput ¶
func (h *Handlers) AlexaDiscoveryDiscoverInput( ctx context.Context, directiveMsg *alexatypes.DirectiveInput, payload *alexatypes.AlexaDiscoveryDiscoverInput, ) (*alexatypes.AlexaResponse, error)
func (*Handlers) AlexaPercentageControllerSetPercentage ¶
func (h *Handlers) AlexaPercentageControllerSetPercentage( ctx context.Context, directiveMsg *alexatypes.DirectiveInput, payload *alexatypes.AlexaPercentageControllerSetPercentage, ) (*alexatypes.AlexaResponse, error)
func (*Handlers) AlexaPlaybackControllerFastForward ¶
func (h *Handlers) AlexaPlaybackControllerFastForward( ctx context.Context, directiveMsg *alexatypes.DirectiveInput, payload *alexatypes.AlexaPlaybackControllerFastForward, ) (*alexatypes.AlexaResponse, error)
func (*Handlers) AlexaPlaybackControllerNext ¶
func (h *Handlers) AlexaPlaybackControllerNext( ctx context.Context, directiveMsg *alexatypes.DirectiveInput, payload *alexatypes.AlexaPlaybackControllerNext, ) (*alexatypes.AlexaResponse, error)
func (*Handlers) AlexaPlaybackControllerPause ¶
func (h *Handlers) AlexaPlaybackControllerPause( ctx context.Context, directiveMsg *alexatypes.DirectiveInput, payload *alexatypes.AlexaPlaybackControllerPause, ) (*alexatypes.AlexaResponse, error)
func (*Handlers) AlexaPlaybackControllerPlay ¶
func (h *Handlers) AlexaPlaybackControllerPlay( ctx context.Context, directiveMsg *alexatypes.DirectiveInput, payload *alexatypes.AlexaPlaybackControllerPlay, ) (*alexatypes.AlexaResponse, error)
func (*Handlers) AlexaPlaybackControllerPrevious ¶
func (h *Handlers) AlexaPlaybackControllerPrevious( ctx context.Context, directiveMsg *alexatypes.DirectiveInput, payload *alexatypes.AlexaPlaybackControllerPrevious, ) (*alexatypes.AlexaResponse, error)
func (*Handlers) AlexaPlaybackControllerRewind ¶
func (h *Handlers) AlexaPlaybackControllerRewind( ctx context.Context, directiveMsg *alexatypes.DirectiveInput, payload *alexatypes.AlexaPlaybackControllerRewind, ) (*alexatypes.AlexaResponse, error)
func (*Handlers) AlexaPlaybackControllerStartOver ¶
func (h *Handlers) AlexaPlaybackControllerStartOver( ctx context.Context, directiveMsg *alexatypes.DirectiveInput, payload *alexatypes.AlexaPlaybackControllerStartOver, ) (*alexatypes.AlexaResponse, error)
func (*Handlers) AlexaPlaybackControllerStop ¶
func (h *Handlers) AlexaPlaybackControllerStop( ctx context.Context, directiveMsg *alexatypes.DirectiveInput, payload *alexatypes.AlexaPlaybackControllerStop, ) (*alexatypes.AlexaResponse, error)
func (*Handlers) AlexaPowerControllerTurnOff ¶
func (h *Handlers) AlexaPowerControllerTurnOff( ctx context.Context, directiveMsg *alexatypes.DirectiveInput, payload *alexatypes.AlexaPowerControllerTurnOff, ) (*alexatypes.AlexaResponse, error)
func (*Handlers) AlexaPowerControllerTurnOn ¶
func (h *Handlers) AlexaPowerControllerTurnOn( ctx context.Context, directiveMsg *alexatypes.DirectiveInput, payload *alexatypes.AlexaPowerControllerTurnOn, ) (*alexatypes.AlexaResponse, error)
func (*Handlers) AlexaReportStateInput ¶
func (h *Handlers) AlexaReportStateInput( ctx context.Context, directiveMsg *alexatypes.DirectiveInput, payload *alexatypes.AlexaReportStateInput, ) (*alexatypes.AlexaResponse, error)
func (*Handlers) Handle ¶
func (h *Handlers) Handle(ctx context.Context, input []byte) (*alexatypes.AlexaResponse, error)
Click to show internal directories.
Click to hide internal directories.