ring

package
v1.9.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CloseReasonNormalClose          = 0
	CloseReasonAuthenticationFailed = 5
	CloseReasonTimeout              = 6
)

Variables

This section is empty.

Functions

func AppAPI

func AppAPI(path string) string

func ClientAPI

func ClientAPI(path string) string

func CommandsAPI

func CommandsAPI(path string) string

func DeviceAPI

func DeviceAPI(path string) string

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 Auth2faResponse struct {
	Error            string `json:"error"`
	ErrorDescription string `json:"error_description"`
	TSVState         string `json:"tsv_state"`
	Phone            string `json:"phone"`
	NextTimeInSecs   int    `json:"next_time_in_secs"`
}

type AuthConfig

type AuthConfig struct {
	RT  string `json:"rt"`  // Refresh Token
	HID string `json:"hid"` // Hardware ID
}

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"
}

type CameraData

type CameraData struct {
	ID          int    `json:"id"`
	Description string `json:"description"`
	DeviceID    string `json:"device_id"`
	Kind        string `json:"kind"`
	LocationID  string `json:"location_id"`
}

type CameraKind

type CameraKind string
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 Dial

func Dial(rawURL string) (*Client, error)

func (*Client) AddTrack

func (c *Client) AddTrack(media *core.Media, codec *core.Codec, track *core.Receiver) error

func (*Client) GetMedias

func (c *Client) GetMedias() []*core.Media

func (*Client) GetTrack

func (c *Client) GetTrack(media *core.Media, codec *core.Codec) (*core.Receiver, error)

func (*Client) MarshalJSON

func (c *Client) MarshalJSON() ([]byte, error)

func (*Client) Start

func (c *Client) Start() error

func (*Client) Stop

func (c *Client) Stop() error

type CloseRequest added in v1.9.11

type CloseRequest struct {
	Method string `json:"method"` // "close"
	Body   struct {
		SessionBody
		Reason struct {
			Code int    `json:"code"`
			Text string `json:"text"`
		} `json:"reason"`
	} `json:"body"`
}

type EmailAuth

type EmailAuth struct {
	Email    string
	Password string
}

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 RingApi added in v1.9.11

type RingApi struct {
	Using2FA     bool
	PromptFor2FA string
	RefreshToken string
	// contains filtered or unexported fields
}

func NewRestClient added in v1.9.11

func NewRestClient(auth interface{}, onTokenRefresh func(string)) (*RingApi, error)

func (*RingApi) FetchRingDevices added in v1.9.11

func (c *RingApi) FetchRingDevices() (*RingDevicesResponse, error)

func (*RingApi) GetAuth added in v1.9.11

func (c *RingApi) GetAuth(twoFactorAuthCode string) (*AuthTokenResponse, error)

func (*RingApi) GetSocketTicket added in v1.9.11

func (c *RingApi) GetSocketTicket() (*SocketTicketResponse, error)

func (*RingApi) Request added in v1.9.11

func (c *RingApi) Request(method, url string, body interface{}) ([]byte, error)

type RingDeviceType

type RingDeviceType string
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"`
}

type SessionBody

type SessionBody struct {
	DoorbotID int    `json:"doorbot_id"`
	SessionID string `json:"session_id"`
}

type SessionMessage

type SessionMessage struct {
	Method string      `json:"method"` // "session_created" or "session_started"
	Body   SessionBody `json:"body"`
}

type SessionResponse added in v1.9.11

type SessionResponse struct {
	Profile struct {
		ID        int64  `json:"id"`
		Email     string `json:"email"`
		FirstName string `json:"first_name"`
		LastName  string `json:"last_name"`
	} `json:"profile"`
}

type SnapshotProducer

type SnapshotProducer struct {
	core.Connection
	// contains filtered or unexported fields
}

func NewSnapshotProducer

func NewSnapshotProducer(client *RingApi, cameraID int) *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"`
}

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"`
}

type WSClient added in v1.9.11

type WSClient struct {
	// contains filtered or unexported fields
}

func StartWebsocket added in v1.9.11

func StartWebsocket(cameraID int, api *RingApi) (*WSClient, error)

func (*WSClient) Close added in v1.9.11

func (c *WSClient) Close() error

type WSMessage added in v1.9.11

type WSMessage struct {
	Method string         `json:"method"`
	Body   map[string]any `json:"body"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL