ringapimodels

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// Ring API base URIs
	RingAPIBaseURI = "https://api.ring.com"
	RingOAuthURI   = "https://oauth.ring.com/oauth/token"

	// Ring API endpoints
	RingDevicesEndpoint      = "/clients_api/ring_devices"
	RingDingsActiveEndpoint  = "/clients_api/dings/active"
	RingDingsHistoryEndpoint = "/clients_api/dings/history"
	RingRecordingEndpoint    = "/clients_api/dings/{id}/recording"

	// RTC Streaming endpoints
	RingAppAPIURI                     = "https://prd-api-us.prd.rings.solutions"
	RingRTCStreamingTicketEndpoint    = "/api/v1/clap/ticket/request/signalsocket"
	RingRTCStreamingWebSocketEndpoint = "" /* 140-byte string literal not displayed */

	// Default user agent
	DefaultUserAgent = "android:com.ringapp"

	// OAuth constants
	RingClientID = "ring_official_android"
	RingScope    = "client"
)

Variables

This section is empty.

Functions

func IsAuthenticationError

func IsAuthenticationError(err error) bool

IsAuthenticationError checks if an error is an AuthenticationError

func IsBadRequestError

func IsBadRequestError(err error) bool

IsBadRequestError checks if an error is a BadRequestError

func IsClosedError

func IsClosedError(err error) bool

IsClosedError checks if an error is a ClosedError

func IsConnectionError

func IsConnectionError(err error) bool

IsConnectionError checks if an error is a ConnectionError

func IsHTTPError

func IsHTTPError(err error) bool

IsHTTPError checks if an error is an HTTPError

func IsHTTPStatusCode

func IsHTTPStatusCode(err error, code int) bool

IsHTTPStatusCode checks if an error is an HTTPError with a specific status code

func IsInternalServerError

func IsInternalServerError(err error) bool

IsInternalServerError checks if an error is a InternalServerError

func IsNetworkError

func IsNetworkError(err error) bool

IsNetworkError checks if an error is a NetworkError

func IsNotFoundError

func IsNotFoundError(err error) bool

IsNotFoundError checks if an error is a NotFoundError

func IsRateLimitError

func IsRateLimitError(err error) bool

func IsRequires2FAError

func IsRequires2FAError(err error) bool

IsRequires2FAError checks if an error is a Requires2FAError

func IsTokenError

func IsTokenError(err error) bool

IsTokenError checks if an error is a TokenError

func IsUnauthorizedError

func IsUnauthorizedError(err error) bool

IsUnauthorizedError checks if an error is a UnauthorizedError

Types

type AuthResponse

type AuthResponse struct {
	AccessToken  string
	RefreshToken string
	ExpiresIn    int
	TokenType    string
}

AuthResponse represents an authentication response

type AuthenticationError

type AuthenticationError struct {
	Message string
	Status  int
}

AuthenticationError represents an authentication failure

func NewAuthenticationError

func NewAuthenticationError(message string, status int) *AuthenticationError

NewAuthenticationError creates a new AuthenticationError

func (*AuthenticationError) Error

func (e *AuthenticationError) Error() string

type BadRequestError

type BadRequestError struct {
	Message string
	Err     error
}

BadRequestError represents a bad request error

func NewBadRequestError

func NewBadRequestError(message string, err error) *BadRequestError

NewBadRequestError creates a new BadRequestError

func (*BadRequestError) Error

func (e *BadRequestError) Error() string

func (*BadRequestError) Unwrap

func (e *BadRequestError) Unwrap() error

type Chime

type Chime struct {
	ID                 string        `json:"id"`
	Name               string        `json:"name"`
	Family             string        `json:"family"`
	Address            string        `json:"address"`
	Timezone           string        `json:"timezone"`
	WifiName           string        `json:"wifi_name"`
	WifiSignalStrength int           `json:"wifi_signal_strength"`
	Volume             int           `json:"volume"`
	Health             *DeviceHealth `json:"health,omitempty"`
}

Chime represents a Ring chime device

func (*Chime) GetAddress

func (c *Chime) GetAddress() string

func (*Chime) GetFamily

func (c *Chime) GetFamily() DeviceFamily

func (*Chime) GetID

func (c *Chime) GetID() string

func (*Chime) GetName

func (c *Chime) GetName() string

func (*Chime) GetTimezone

func (c *Chime) GetTimezone() string

type ClosedError

type ClosedError struct {
	Message string
}

ClosedError represents an error when trying to use a closed connection

func NewClosedError

func NewClosedError(message string) *ClosedError

NewClosedError creates a new ClosedError

func (*ClosedError) Error

func (e *ClosedError) Error() string

type ConnectionError

type ConnectionError struct {
	Message string
	Err     error
}

ConnectionError represents a connection failure

func NewConnectionError

func NewConnectionError(message string, err error) *ConnectionError

NewConnectionError creates a new ConnectionError

func (*ConnectionError) Error

func (e *ConnectionError) Error() string

func (*ConnectionError) Unwrap

func (e *ConnectionError) Unwrap() error

type Device

type Device interface {
	GetID() string
	GetName() string
	GetFamily() DeviceFamily
	GetAddress() string
	GetTimezone() string
}

Device represents a generic Ring device

type DeviceFamily

type DeviceFamily string

DeviceFamily represents the family/type of a Ring device

const (
	DeviceFamilyDoorbell   DeviceFamily = "doorbots"
	DeviceFamilyChime      DeviceFamily = "chimes"
	DeviceFamilyStickUpCam DeviceFamily = "stickup_cams"
	DeviceFamilyOther      DeviceFamily = "other"
)

type DeviceHealth

type DeviceHealth struct {
	BatteryLevel    *int    `json:"battery_level,omitempty"`
	BatteryStatus   *string `json:"battery_status,omitempty"`
	SignalStrength  *int    `json:"signal_strength,omitempty"`
	FirmwareVersion *string `json:"firmware_version,omitempty"`
	LastUpdate      *string `json:"last_update,omitempty"`
}

DeviceHealth represents health information for a device

type DevicesResponse

type DevicesResponse struct {
	Doorbells   []*Doorbell   `json:"doorbots"`
	Chimes      []*Chime      `json:"chimes"`
	StickUpCams []*StickUpCam `json:"stickup_cams"`
	Other       []*Other      `json:"other"`
}

DevicesResponse represents the response from listing devices

func (*DevicesResponse) GetAllDevices

func (d *DevicesResponse) GetAllDevices() []Device

GetAllDevices returns all devices as a slice of Device interfaces

type Doorbell

type Doorbell struct {
	ID                     string        `json:"id"`
	Name                   string        `json:"name"`
	Family                 string        `json:"family"`
	Address                string        `json:"address"`
	Timezone               string        `json:"timezone"`
	WifiName               string        `json:"wifi_name"`
	WifiSignalStrength     int           `json:"wifi_signal_strength"`
	Volume                 int           `json:"volume"`
	HasLight               bool          `json:"has_light"`
	LightBrightness        *int          `json:"light_brightness,omitempty"`
	MotionDetectionEnabled bool          `json:"motion_detection_enabled"`
	Health                 *DeviceHealth `json:"health,omitempty"`
}

Doorbell represents a Ring doorbell device

func (*Doorbell) GetAddress

func (d *Doorbell) GetAddress() string

func (*Doorbell) GetFamily

func (d *Doorbell) GetFamily() DeviceFamily

func (*Doorbell) GetID

func (d *Doorbell) GetID() string

func (*Doorbell) GetName

func (d *Doorbell) GetName() string

func (*Doorbell) GetTimezone

func (d *Doorbell) GetTimezone() string

type Event

type Event struct {
	Kind      EventKind              `json:"kind"` // "motion", "ding", "on_demand"
	DeviceID  int64                  `json:"device_id"`
	Timestamp string                 `json:"timestamp"`
	Data      map[string]interface{} `json:"data,omitempty"`
}

Event represents a Ring event

type EventCallback

type EventCallback func(*Event) error

EventCallback is a function type for handling events

type EventKind

type EventKind string

EventKind represents the type of event

const (
	EventKindMotion   EventKind = "motion"
	EventKindDing     EventKind = "ding"
	EventKindOnDemand EventKind = "on_demand"
)

type HTTPError

type HTTPError struct {
	StatusCode int
	Status     string
	Body       string
	Message    string
}

HTTPError represents an HTTP-level error with status code

func NewHTTPError

func NewHTTPError(resp *http.Response, body string) *HTTPError

NewHTTPError creates a new HTTPError from an HTTP response

func (*HTTPError) Error

func (e *HTTPError) Error() string

type InternalServerError

type InternalServerError struct {
	Message string
	Err     error
}

InternalServerError represents an internal server error

func NewInternalServerError

func NewInternalServerError(message string, err error) *InternalServerError

NewInternalServerError creates a new InternalServerError

func (*InternalServerError) Error

func (e *InternalServerError) Error() string

func (*InternalServerError) Unwrap

func (e *InternalServerError) Unwrap() error

type NetworkError

type NetworkError struct {
	Message string
	Err     error
}

NetworkError represents a network-level error

func NewNetworkError

func NewNetworkError(message string, err error) *NetworkError

NewNetworkError creates a new NetworkError

func (*NetworkError) Error

func (e *NetworkError) Error() string

func (*NetworkError) Unwrap

func (e *NetworkError) Unwrap() error

type NotFoundError

type NotFoundError struct {
	Message string
	Err     error
}

NotFoundError represents a not found error

func NewNotFoundError

func NewNotFoundError(message string, err error) *NotFoundError

NewNotFoundError creates a new NotFoundError

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

func (*NotFoundError) Unwrap

func (e *NotFoundError) Unwrap() error

type Other

type Other struct {
	ID       string        `json:"id"`
	Name     string        `json:"name"`
	Family   string        `json:"family"`
	Address  string        `json:"address"`
	Timezone string        `json:"timezone"`
	Kind     string        `json:"kind"`
	Health   *DeviceHealth `json:"health,omitempty"`
}

Other represents a Ring "other" device (e.g., Intercom)

func (*Other) GetAddress

func (o *Other) GetAddress() string

func (*Other) GetFamily

func (o *Other) GetFamily() DeviceFamily

func (*Other) GetID

func (o *Other) GetID() string

func (*Other) GetName

func (o *Other) GetName() string

func (*Other) GetTimezone

func (o *Other) GetTimezone() string

type RTCStream

type RTCStream struct {
	StreamID      string
	DeviceID      int64
	SDPOffer      string
	SDPAnswer     string
	ICECandidates []string
	StreamURL     string
}

RTCStream represents a WebRTC stream for live video

type RTCStreamConfig

type RTCStreamConfig struct {
	DeviceID int64
}

RTCStreamConfig represents configuration for starting an RTC stream

type RateLimitError

type RateLimitError struct {
	Message string
}

func NewRateLimitError

func NewRateLimitError(message string) *RateLimitError

func (*RateLimitError) Error

func (e *RateLimitError) Error() string

type Recording

type Recording struct {
	ID        int64  `json:"id"`
	Kind      string `json:"kind"` // "motion", "ding", "on_demand"
	Answered  bool   `json:"answered"`
	CreatedAt string `json:"created_at"`
	DeviceID  int64  `json:"device_id"`
}

Recording represents a recording/event from a Ring device

type RecordingHistoryResponse

type RecordingHistoryResponse struct {
	Recordings []*Recording `json:"recordings"`
}

RecordingHistoryResponse represents the response from listing recordings

type Requires2FAError

type Requires2FAError struct {
	Message string
}

Requires2FAError represents an error when 2FA is required

func NewRequires2FAError

func NewRequires2FAError(message string) *Requires2FAError

NewRequires2FAError creates a new Requires2FAError

func (*Requires2FAError) Error

func (e *Requires2FAError) Error() string

type SoundKind

type SoundKind string

SoundKind represents the type of sound for chime testing

const (
	SoundKindDing   SoundKind = "ding"
	SoundKindMotion SoundKind = "motion"
)

type StickUpCam

type StickUpCam struct {
	ID                     string        `json:"id"`
	Name                   string        `json:"name"`
	Description            string        `json:"description,omitempty"`
	Family                 string        `json:"family"`
	Address                string        `json:"address"`
	Timezone               string        `json:"timezone"`
	WifiName               string        `json:"wifi_name"`
	WifiSignalStrength     int           `json:"wifi_signal_strength"`
	Volume                 int           `json:"volume"`
	HasLight               bool          `json:"has_light"`
	LightBrightness        *int          `json:"light_brightness,omitempty"`
	MotionDetectionEnabled bool          `json:"motion_detection_enabled"`
	Health                 *DeviceHealth `json:"health,omitempty"`
}

StickUpCam represents a Ring StickUp camera device

func (*StickUpCam) GetAddress

func (s *StickUpCam) GetAddress() string

func (*StickUpCam) GetFamily

func (s *StickUpCam) GetFamily() DeviceFamily

func (*StickUpCam) GetID

func (s *StickUpCam) GetID() string

func (*StickUpCam) GetName

func (s *StickUpCam) GetName() string

func (*StickUpCam) GetTimezone

func (s *StickUpCam) GetTimezone() string

type TokenError

type TokenError struct {
	Message string
	Err     error
}

TokenError represents a token retrieval or validation error

func NewTokenError

func NewTokenError(message string, err error) *TokenError

NewTokenError creates a new TokenError

func (*TokenError) Error

func (e *TokenError) Error() string

func (*TokenError) Unwrap

func (e *TokenError) Unwrap() error

type UnauthorizedError

type UnauthorizedError struct {
	Message string
	Err     error
}

UnauthorizedError represents an unauthorized error

func NewUnauthorizedError

func NewUnauthorizedError(message string, err error) *UnauthorizedError

NewUnauthorizedError creates a new UnauthorizedError

func (*UnauthorizedError) Error

func (e *UnauthorizedError) Error() string

func (*UnauthorizedError) Unwrap

func (e *UnauthorizedError) Unwrap() error

type VideoStream

type VideoStream struct {
	Body        io.ReadCloser
	ContentType string
	ContentLen  int64
	Headers     http.Header
}

VideoStream represents a video stream response from the Ring API

Jump to

Keyboard shortcuts

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