Documentation
¶
Index ¶
- Constants
- Variables
- type Client
- func (a *Client) Arm(deviceID, xCloudID string) error
- func (a *Client) Disarm(deviceID, xCloudID string) error
- func (a *Client) GetBasestation() (*Device, error)
- func (a *Client) GetCameras() ([]Device, error)
- func (a *Client) GetDevices() ([]Device, error)
- func (a *Client) Login() error
- func (a *Client) Logout() error
- func (a *Client) Notify(deviceID, xCloudID string, payload NotifyPayload) (string, error)
- func (a *Client) Register(deviceID, xCloudID string) error
- func (a *Client) Subscribe(deviceID, xCloudID string) error
- type Device
- type EventStream
- type NotifyPayload
Constants ¶
const ( ModeDeviceArm = "mode1" ModeDeviceDisarm = "mode0" )
Device modes - assumes default mode listing order.
const ( DeviceTypeBasestation = "basestation" DeviceTypeCamera = "camera" )
Variables ¶
var ( ErrRequestFailedStatusNotOK = errors.New("request failed") ErrRequestUnsuccessful = errors.New("request unsuccessful") ErrNotLoggedIn = errors.New("not logged in yet") ErrNoBasestationFound = errors.New("no basestation found") ErrNoCamerasFound = errors.New("no cameras found") )
Errors
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// For initial login
Username string
Password string
UserID string
// For request authorization
Token string
HTTPClient *http.Client
Devices []Device
EventStreams map[string]*EventStream
Verbose bool
}
Client represents a client to the Arlo API.
func (*Client) GetBasestation ¶
GetBasestation attempts to retrieve the basestation device from memory. GetDevices() should be called beforehand.
func (*Client) GetCameras ¶
GetCameras attempts to retrieve a list of camera devices from memory. GetDevices() should be called beforehand.
func (*Client) GetDevices ¶
GetDevices returns a list of available devices.
func (*Client) Login ¶
Login logs in and retrieves an access token. The login response has been stripped down to values used by the library.
func (*Client) Notify ¶
func (a *Client) Notify(deviceID, xCloudID string, payload NotifyPayload) (string, error)
Notify sends a message to the Arlo notify API. A response will be returned via the device's SSE stream.
type Device ¶
type Device struct {
UserID string `json:"userId"`
DeviceID string `json:"deviceId"`
UniqueID string `json:"uniqueId"`
DeviceType string `json:"deviceType"`
DeviceName string `json:"deviceName"`
XCloudID string `json:"xCloudId"`
}
Device represents a basestation or camera.
func (Device) IsBasestation ¶
type EventStream ¶
type EventStream struct {
Registered bool
Connected bool
SSEClient *sse.Client
Events chan *sse.Event
Verbose bool
}
func NewEventStream ¶
func NewEventStream() *EventStream
func (*EventStream) Listen ¶
func (e *EventStream) Listen() error
type NotifyPayload ¶
type NotifyPayload struct {
Action string `json:"action,omitempty"`
Resource string `json:"resource,omitempty"`
PublishResponse bool `json:"publishResponse,omitempty"`
Properties interface{} `json:"properties,omitempty"`
TransID string `json:"transId"`
From string `json:"from"`
To string `json:"to"`
}
NotifyPayload represents the message that will be sent to the Arlo servers via the Notify API.