Documentation ¶
Index ¶
- func NewFailedHTTPRequestError(method, endpoint string, err error) error
- func NewUnexpectedHTTPStatusCodeError(method, endpoint string, statusCode int) error
- type DeviceState
- type DevicesStateRes
- type DevicesStateResult
- type Handler
- type Namespace
- type NamespacesRes
- type Object
- type ObjectsRes
- type TokenHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DeviceState ¶
type DevicesStateRes ¶
type DevicesStateRes struct {
Result DevicesStateResult `json:"result"`
}
type DevicesStateResult ¶
type DevicesStateResult struct {
ReportedState DeviceState `json:"reportedState"`
}
type Handler ¶
type Handler interface { GetNamespaces() (*NamespacesRes, error) GetObjects(namespaceID string) (*ObjectsRes, error) GetDevicesStateStream(deviceID string) (<-chan *DevicesStateRes, error) }
func NewHandler ¶
func NewHandler(tokenHandler TokenHandler, apiUrl string) Handler
type NamespacesRes ¶
type NamespacesRes struct {
Namespaces []Namespace `json:"namespaces"`
}
type ObjectsRes ¶
type ObjectsRes struct {
Objects []Object `json:"objects"`
}
type TokenHandler ¶
func NewTokenHandler ¶
func NewTokenHandler(username, password, apiUrl string, refreshInterval time.Duration) TokenHandler
NewTokenHandler returns a new TokenHandler
Tokens are synchronously retrieved on init, and refreshed automatically per tick duration
If a token retrieval attempt fails, GetToken returns the previous token
Click to show internal directories.
Click to hide internal directories.