Versions in this module Expand all Collapse all v0 v0.0.1 Oct 26, 2018 Changes in this version + const CorrelationHeader + const CorrelationKey + const MediaTypeJsonV1 + const SmartThingsHost + var IllegalArgumentPingChallengeError = errors.New("illegal_argument_ping_challenge") + var UnsupportedLifecyleError = errors.New("unsupported_app_lifecycle") + func DebugInterceptor(log logger.Logger, original http.RoundTripper) http.RoundTripper + func ParsePublicKeyBase64(publicKeyBase64 string) *rsa.PublicKey + func RequestInterceptor(original http.RoundTripper) http.RoundTripper + type Authenticator struct + Verifier *httpsig.Verifier + func NewAuthenticator(publicKey *rsa.PublicKey) *Authenticator + type DefaultEventHandler struct + Chain []PredicateEventHandler + FailOnError FailOnError + OnError OnError + OnSuccess OnSuccess + func (h *DefaultEventHandler) AddEventHandler(handler PredicateEventHandler) + func (h *DefaultEventHandler) BuildHandler() Handler + func (h *DefaultEventHandler) DoOnError(onError OnError) + func (h *DefaultEventHandler) DoOnSuccess(onSuccess OnSuccess) + func (h *DefaultEventHandler) GetChainSize() int + func (h *DefaultEventHandler) Handle(params *SmartAppParams) (*smartapp.ExecutionResponse, error) + func (h *DefaultEventHandler) SetFailOnErrorPredicate(failOnError FailOnError) + func (h *DefaultEventHandler) SetHandlerChain(chain []PredicateEventHandler) + func (h *DefaultEventHandler) Test(params *SmartAppParams) bool + type DefaultPredicateHandler struct + Handler Handle + Tester Test + func (h *DefaultPredicateHandler) Handle(params *SmartAppParams) (*smartapp.ExecutionResponse, error) + func (h *DefaultPredicateHandler) Test(params *SmartAppParams) bool + type DefaultSmartApp struct + Chain []PredicateHandler + func (s *DefaultSmartApp) Handle(params *SmartAppParams) (*smartapp.ExecutionResponse, error) + type DefaultSmartAppDefinition struct + AdditionalHandlers []PredicateHandler + ConfigurationHandler PredicateHandler + EventHandler PredicateHandler + InstallHandler PredicateHandler + OAuthCallbackHandler PredicateHandler + PingHandler PredicateHandler + UninstallHandler PredicateHandler + UpdateHandler PredicateHandler + func (h *DefaultSmartAppDefinition) AddHandler(handler PredicateHandler) + func (h *DefaultSmartAppDefinition) BuildChain() []PredicateHandler + func (h *DefaultSmartAppDefinition) SetConfigurationHandler(handler Handler) + func (h *DefaultSmartAppDefinition) SetEventHandler(handler Handler) + func (h *DefaultSmartAppDefinition) SetInstallHandler(handler Handler) + func (h *DefaultSmartAppDefinition) SetOAuthCallbackHandler(handler Handler) + func (h *DefaultSmartAppDefinition) SetPingHandler(handler Handler) + func (h *DefaultSmartAppDefinition) SetUninstallHandler(handler Handler) + func (h *DefaultSmartAppDefinition) SetUpdateHandler(handler Handler) + type DefaultSmartThingsApi struct + Client *apiclient.SmartThings + Logger logger.Logger + RequestTimeout time.Duration + func (s *DefaultSmartThingsApi) CreateDeviceEvents(params *devices.CreateDeviceEventsParams) error + func (s *DefaultSmartThingsApi) CreateSchedule(params *schedules.CreateScheduleParams) (*models.Schedule, error) + func (s *DefaultSmartThingsApi) ExecuteDeviceCommands(params *devices.ExecuteDeviceCommandsParams) error + func (s *DefaultSmartThingsApi) ExecuteScene(params *scenes.ExecuteSceneParams) error + func (s *DefaultSmartThingsApi) GetLocation(params *locations.GetLocationParams) (*models.Location, error) + func (s *DefaultSmartThingsApi) InstallDevice(params *devices.InstallDeviceParams) (*models.Device, error) + func (s *DefaultSmartThingsApi) SaveSubscription(params *subscriptions.SaveSubscriptionParams) error + type EventHandler interface + AddEventHandler func(handler PredicateEventHandler) + BuildHandler func() Handler + DoOnError func(onError OnError) + DoOnSuccess func(onSuccess OnSuccess) + GetChainSize func() int + SetFailOnErrorPredicate func(failOnError FailOnError) + SetHandlerChain func(chain []PredicateEventHandler) + func NewEventHandler() EventHandler + type FailOnError func(err error) bool + type Handle func(params *SmartAppParams) (*smartapp.ExecutionResponse, error) + type Handler func(params *SmartAppParams) (*smartapp.ExecutionResponse, error) + type KeyResolver struct + PublicKey *rsa.PublicKey + func (k KeyResolver) GetKey(id string) interface{} + type NoopLifecycleHandler struct + Lifecycle smartapp.AppLifecycle + func (h *NoopLifecycleHandler) Handle(params *SmartAppParams) (*smartapp.ExecutionResponse, error) + func (h *NoopLifecycleHandler) Test(params *SmartAppParams) bool + type NotFoundHandler struct + func (h *NotFoundHandler) Handle(params *SmartAppParams) (*smartapp.ExecutionResponse, error) + func (h *NotFoundHandler) Test(params *SmartAppParams) bool + type OnError func(params *SmartAppParams, err error) (*smartapp.ExecutionResponse, error) + type OnSuccess func(params *SmartAppParams) (*smartapp.ExecutionResponse, error) + type PingHandler struct + func (h *PingHandler) Handle(params *SmartAppParams) (*smartapp.ExecutionResponse, error) + func (h *PingHandler) Test(params *SmartAppParams) bool + type PredicateEventHandler interface + Handle func(params *SmartAppParams, event *smartapp.Event) error + Test func(event *smartapp.Event) bool + type PredicateHandler interface + Handle func(params *SmartAppParams) (*smartapp.ExecutionResponse, error) + Test func(params *SmartAppParams) bool + type SmartApp interface + Handle func(request *SmartAppParams) (*smartapp.ExecutionResponse, error) + func NewSmartApp(definition SmartAppDefinition) SmartApp + type SmartAppDefinition interface + AddHandler func(handler PredicateHandler) + BuildChain func() []PredicateHandler + SetConfigurationHandler func(handler Handler) + SetEventHandler func(handler Handler) + SetInstallHandler func(handler Handler) + SetOAuthCallbackHandler func(handler Handler) + SetPingHandler func(handler Handler) + SetUninstallHandler func(handler Handler) + SetUpdateHandler func(handler Handler) + func NewSmartAppDefinition() SmartAppDefinition + type SmartAppParams struct + Context context.Context + Request *smartapp.ExecutionRequest + func (p *SmartAppParams) GetSetting(key string) string + type SmartThingsApi interface + CreateDeviceEvents func(params *devices.CreateDeviceEventsParams) error + CreateSchedule func(params *schedules.CreateScheduleParams) (*models.Schedule, error) + ExecuteDeviceCommands func(params *devices.ExecuteDeviceCommandsParams) error + ExecuteScene func(params *scenes.ExecuteSceneParams) error + GetLocation func(params *locations.GetLocationParams) (*models.Location, error) + InstallDevice func(params *devices.InstallDeviceParams) (*models.Device, error) + SaveSubscription func(params *subscriptions.SaveSubscriptionParams) error + func NewSmartThingsApi(params *SmartThingsApiParams) SmartThingsApi + type SmartThingsApiParams struct + Debug bool + Host string + Logger logger.Logger + Schemes []string + type Test func(params *SmartAppParams) bool