Documentation ¶
Index ¶
- func EnsureApiConfigDefaults(config *ApiConfig) bool
- type ApiConfig
- type Authenticator
- type AuthorizedSession
- func (session *AuthorizedSession) GetChimeHealth(chime *ring_types.Chime) (*ring_types.DoorBotHealthResponse, error)
- func (session *AuthorizedSession) GetDevices() (*ring_types.DevicesResponse, error)
- func (session *AuthorizedSession) GetDoorBotHealth(bot *ring_types.DoorBot) (*ring_types.DoorBotHealthResponse, error)
- func (session *AuthorizedSession) GetDoorBotHistory(bot *ring_types.DoorBot) ([]ring_types.DoorBotDing, error)
- func (session *AuthorizedSession) GetSessionInfo() (*ring_types.SessionResponse, error)
- type TokenHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureApiConfigDefaults ¶
EnsureApiConfigDefaults handles setting sane defaults and migrating the config forward. It returns `true` if any changes were made.
Types ¶
type ApiConfig ¶
type ApiConfig struct {
HardwareId string `json:"hardware_id"`
}
ApiConfig provides a way to alter API behaviors. This is a serializable structure.
type Authenticator ¶
type Authenticator interface { PromptCredentials() (string, string, error) Prompt2FACode() (string, error) }
Authenticator implements routines for capturing info necessary to authenticate the user and authorize the token for use with this application.
type AuthorizedSession ¶
type AuthorizedSession struct {
// contains filtered or unexported fields
}
AuthorizedSession is necessary to perform ring API calls. Retreive this instance by calling OpenAuthorizedSession.
func OpenAuthorizedSession ¶
func OpenAuthorizedSession(cfg ApiConfig, t TokenHandler, a Authenticator) (*AuthorizedSession, error)
OpenAuthorizedSession creates a new AuthorizedSession instance by retreiving an OAUTH2 Token. This token might already exist, in which case the Authenticator is not needed. If the token does not exist and the Authenticator is nil (maybe because your application is not user-interactive) this function will fail.
func (*AuthorizedSession) GetChimeHealth ¶
func (session *AuthorizedSession) GetChimeHealth(chime *ring_types.Chime) (*ring_types.DoorBotHealthResponse, error)
GetChimeHealth fetches the health info for a particular id.
func (*AuthorizedSession) GetDevices ¶
func (session *AuthorizedSession) GetDevices() (*ring_types.DevicesResponse, error)
GetDevices fetches the ring devices in the current API session.
func (*AuthorizedSession) GetDoorBotHealth ¶
func (session *AuthorizedSession) GetDoorBotHealth(bot *ring_types.DoorBot) (*ring_types.DoorBotHealthResponse, error)
GetDoorBotHealth fetches the health info for a particular id.
func (*AuthorizedSession) GetDoorBotHistory ¶
func (session *AuthorizedSession) GetDoorBotHistory(bot *ring_types.DoorBot) ([]ring_types.DoorBotDing, error)
func (*AuthorizedSession) GetSessionInfo ¶
func (session *AuthorizedSession) GetSessionInfo() (*ring_types.SessionResponse, error)
GetSessionInfo fetches information about the current API session