Documentation
¶
Index ¶
- Constants
- func AppAPI(path string) string
- func ClientAPI(path string) string
- func CommandsAPI(path string) string
- func DeviceAPI(path string) string
- type AnswerMessage
- type Auth2faResponse
- type AuthConfig
- type AuthTokenResponse
- type BaseMessage
- type CameraData
- type CameraKind
- type Client
- func (c *Client) AddTrack(media *core.Media, codec *core.Codec, track *core.Receiver) error
- func (c *Client) GetMedias() []*core.Media
- func (c *Client) GetTrack(media *core.Media, codec *core.Codec) (*core.Receiver, error)
- func (c *Client) MarshalJSON() ([]byte, error)
- func (c *Client) Start() error
- func (c *Client) Stop() error
- type CloseMessage
- type EmailAuth
- type IceCandidateMessage
- type NotificationMessage
- type PongMessage
- type RefreshTokenAuth
- type RingDeviceType
- type RingDevicesResponse
- type RingRestClient
- func (c *RingRestClient) FetchRingDevices() (*RingDevicesResponse, error)
- func (c *RingRestClient) GetAuth(twoFactorAuthCode string) (*AuthTokenResponse, error)
- func (c *RingRestClient) GetSocketTicket() (*SocketTicketResponse, error)
- func (c *RingRestClient) Request(method, url string, body interface{}) ([]byte, error)
- type SessionBody
- type SessionMessage
- type SnapshotProducer
- type SocketTicketResponse
- type StreamInfoMessage
Constants ¶
const ( CloseReasonNormalClose = 0 CloseReasonAuthenticationFailed = 5 CloseReasonTimeout = 6 )
Close reason codes
Variables ¶
This section is empty.
Functions ¶
func CommandsAPI ¶
Types ¶
type AnswerMessage ¶
type AnswerMessage struct {
Method string `json:"method"` // "sdp"
Body struct {
SessionBody
SDP string `json:"sdp"`
Type string `json:"type"` // "answer"
} `json:"body"`
}
type Auth2faResponse ¶
type AuthConfig ¶
type AuthConfig struct {
RT string `json:"rt"` // Refresh Token
HID string `json:"hid"` // Hardware ID
}
AuthConfig represents the decoded refresh token data
type AuthTokenResponse ¶
type AuthTokenResponse struct {
AccessToken string `json:"access_token"`
ExpiresIn int `json:"expires_in"`
RefreshToken string `json:"refresh_token"`
Scope string `json:"scope"` // Always "client"
TokenType string `json:"token_type"` // Always "Bearer"
}
AuthTokenResponse represents the response from the authentication endpoint
type BaseMessage ¶
type CameraData ¶
type CameraData struct {
ID float64 `json:"id"`
Description string `json:"description"`
DeviceID string `json:"device_id"`
Kind string `json:"kind"`
LocationID string `json:"location_id"`
}
CameraData contains common fields for all camera types
type CameraKind ¶
type CameraKind string
CameraKind represents the different types of Ring cameras
const ( Doorbot CameraKind = "doorbot" Doorbell CameraKind = "doorbell" DoorbellV3 CameraKind = "doorbell_v3" DoorbellV4 CameraKind = "doorbell_v4" DoorbellV5 CameraKind = "doorbell_v5" DoorbellOyster CameraKind = "doorbell_oyster" DoorbellPortal CameraKind = "doorbell_portal" DoorbellScallop CameraKind = "doorbell_scallop" DoorbellScallopLite CameraKind = "doorbell_scallop_lite" DoorbellGraham CameraKind = "doorbell_graham_cracker" LpdV1 CameraKind = "lpd_v1" LpdV2 CameraKind = "lpd_v2" LpdV4 CameraKind = "lpd_v4" JboxV1 CameraKind = "jbox_v1" StickupCam CameraKind = "stickup_cam" StickupCamV3 CameraKind = "stickup_cam_v3" StickupCamElite CameraKind = "stickup_cam_elite" StickupCamLongfin CameraKind = "stickup_cam_longfin" StickupCamLunar CameraKind = "stickup_cam_lunar" SpotlightV2 CameraKind = "spotlightw_v2" HpCamV1 CameraKind = "hp_cam_v1" HpCamV2 CameraKind = "hp_cam_v2" StickupCamV4 CameraKind = "stickup_cam_v4" FloodlightV1 CameraKind = "floodlight_v1" FloodlightV2 CameraKind = "floodlight_v2" FloodlightPro CameraKind = "floodlight_pro" CocoaCamera CameraKind = "cocoa_camera" CocoaDoorbell CameraKind = "cocoa_doorbell" CocoaFloodlight CameraKind = "cocoa_floodlight" CocoaSpotlight CameraKind = "cocoa_spotlight" StickupCamMini CameraKind = "stickup_cam_mini" OnvifCamera CameraKind = "onvif_camera" )
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) MarshalJSON ¶
type CloseMessage ¶
type CloseMessage struct {
Method string `json:"method"` // "close"
Body struct {
SessionBody
Reason struct {
Code int `json:"code"`
Text string `json:"text"`
} `json:"reason"`
} `json:"body"`
}
type IceCandidateMessage ¶
type IceCandidateMessage struct {
Method string `json:"method"` // "ice"
Body struct {
SessionBody
Ice string `json:"ice"`
MLineIndex int `json:"mlineindex"`
} `json:"body"`
}
type NotificationMessage ¶
type NotificationMessage struct {
Method string `json:"method"` // "notification"
Body struct {
SessionBody
IsOK bool `json:"is_ok"`
Text string `json:"text"`
} `json:"body"`
}
type PongMessage ¶
type PongMessage struct {
Method string `json:"method"` // "pong"
Body SessionBody `json:"body"`
}
type RefreshTokenAuth ¶
type RefreshTokenAuth struct {
RefreshToken string
}
type RingDeviceType ¶
type RingDeviceType string
RingDeviceType represents different types of Ring devices
const ( IntercomHandsetAudio RingDeviceType = "intercom_handset_audio" OnvifCameraType RingDeviceType = "onvif_camera" )
type RingDevicesResponse ¶
type RingDevicesResponse struct {
Doorbots []CameraData `json:"doorbots"`
AuthorizedDoorbots []CameraData `json:"authorized_doorbots"`
StickupCams []CameraData `json:"stickup_cams"`
AllCameras []CameraData `json:"all_cameras"`
Chimes []CameraData `json:"chimes"`
Other []map[string]interface{} `json:"other"`
}
RingDevicesResponse represents the response from the Ring API
type RingRestClient ¶
type RingRestClient struct {
Using2FA bool
PromptFor2FA string
RefreshToken string
// contains filtered or unexported fields
}
RingRestClient handles authentication and requests to Ring API
func NewRingRestClient ¶
func NewRingRestClient(auth interface{}, onTokenRefresh func(string)) (*RingRestClient, error)
NewRingRestClient creates a new Ring client instance
func (*RingRestClient) FetchRingDevices ¶
func (c *RingRestClient) FetchRingDevices() (*RingDevicesResponse, error)
FetchRingDevices gets all Ring devices and categorizes them
func (*RingRestClient) GetAuth ¶
func (c *RingRestClient) GetAuth(twoFactorAuthCode string) (*AuthTokenResponse, error)
getAuth makes an authentication request to the Ring API
func (*RingRestClient) GetSocketTicket ¶
func (c *RingRestClient) GetSocketTicket() (*SocketTicketResponse, error)
type SessionBody ¶
type SessionMessage ¶
type SessionMessage struct {
Method string `json:"method"` // "session_created" or "session_started"
Body SessionBody `json:"body"`
}
type SnapshotProducer ¶
type SnapshotProducer struct {
core.Connection
// contains filtered or unexported fields
}
func NewSnapshotProducer ¶
func NewSnapshotProducer(client *RingRestClient, camera *CameraData) *SnapshotProducer
func (*SnapshotProducer) Start ¶
func (p *SnapshotProducer) Start() error
func (*SnapshotProducer) Stop ¶
func (p *SnapshotProducer) Stop() error
type SocketTicketResponse ¶
type SocketTicketResponse struct {
Ticket string `json:"ticket"`
ResponseTimestamp int64 `json:"response_timestamp"`
}
SocketTicketRequest represents the request to get a socket ticket
type StreamInfoMessage ¶
type StreamInfoMessage struct {
Method string `json:"method"` // "stream_info"
Body struct {
SessionBody
Transcoding bool `json:"transcoding"`
TranscodingReason string `json:"transcoding_reason"`
} `json:"body"`
}