blink

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	Email     string
	Password  string
	AuthToken string
	Tier      string
	UniqueID  string

	ID       int
	ClientID int
}

func NewAccount

func NewAccount(email, pass string) *Account

Creates an account object that can be used to login

func (*Account) DownloadVideoByClipID

func (account *Account) DownloadVideoByClipID(networkID, syncModuleID int, manifestID, clipID, fileName string) error

func (*Account) DownloadVideosByPage added in v0.11.0

func (account *Account) DownloadVideosByPage(pages int, downloadDir string) error

func (*Account) GetCameras

func (account *Account) GetCameras() ([]Camera, error)

Lists Cameras from manifest

func (*Account) GetListOfNetworks

func (account *Account) GetListOfNetworks() (*[]Network, error)

Lists networks and cameras

func (*Account) GetLocalStorageManifest

func (account *Account) GetLocalStorageManifest(networkID, syncModuleID int) (*LocalStorageManifest, error)

Returns the local storage manifest, can take a little while depending on network availability Returns Object contaiting version, manifestID, and list of clips for sync module

func (*Account) GetManifest

func (account *Account) GetManifest() (*DeviceManifest, error)

Returns full manifest of all networks, syncmodules, cameras, devices This is generally what you would use post login to then use information To download or other activities

func (*Account) GetMedia

func (account *Account) GetMedia(sinceTimestamp string, pageNum int) (*AllMedia, error)

func (*Account) GetSyncModules

func (account *Account) GetSyncModules() (*[]SyncModule, error)

Returns sync modules from manifest

func (*Account) GetVideoEvents

func (account *Account) GetVideoEvents(pages int) (*VideoEvents, error)

func (*Account) GetVideos

func (account *Account) GetVideos(sinceTimestamp string, pageNum int) (*[]Video, error)

func (*Account) Login

func (account *Account) Login() (*LoginResponse, error)

Completes a login request, might require a verify pin authentication as well

func (*Account) Logout

func (account *Account) Logout() error

Logs user out

func (*Account) RefreshToken

func (account *Account) RefreshToken() (*LoginResponse, error)

Fetches new auth token

func (*Account) VerifyPin

func (account *Account) VerifyPin(pin string) (*VerifyResponse, error)

Verifies pin sent via email or sms

type AllMedia

type AllMedia struct {
	Limit        int64 `json:"limit"`
	PurgeID      int64 `json:"purge_id"`
	RefreshCount int64 `json:"refresh_count"`
	MediaList    []struct {
		AdditionalDevices []interface{} `json:"additional_devices"`
		CreatedAt         string        `json:"created_at"`
		Deleted           bool          `json:"deleted"`
		Device            string        `json:"device"`
		DeviceID          int64         `json:"device_id"`
		DeviceName        string        `json:"device_name"`
		ID                int64         `json:"id"`
		Media             string        `json:"media"`
		NetworkID         int64         `json:"network_id"`
		NetworkName       string        `json:"network_name"`
		Partial           bool          `json:"partial"`
		Source            string        `json:"source"`
		Thumbnail         string        `json:"thumbnail"`
		TimeZone          string        `json:"time_zone"`
		Type              string        `json:"type"`
		UpdatedAt         string        `json:"updated_at"`
		Watched           bool          `json:"watched"`
	} `json:"media"`
	Videos []Video `json:"videos"`
}

type Camera

type Camera struct {
	ID        int           `json:"id"`
	CreatedAt time.Time     `json:"created_at"`
	UpdatedAt time.Time     `json:"updated_at"`
	Name      string        `json:"name"`
	Serial    string        `json:"serial"`
	FwVersion string        `json:"fw_version"`
	Type      string        `json:"type"`
	Enabled   bool          `json:"enabled"`
	Thumbnail string        `json:"thumbnail"`
	Status    string        `json:"status"`
	Battery   string        `json:"battery"`
	UsageRate bool          `json:"usage_rate"`
	NetworkID int           `json:"network_id"`
	Issues    []interface{} `json:"issues"`
	Signals   struct {
		Lfr     int `json:"lfr"`
		Wifi    int `json:"wifi"`
		Temp    int `json:"temp"`
		Battery int `json:"battery"`
	} `json:"signals"`
	LocalStorageEnabled    bool        `json:"local_storage_enabled"`
	LocalStorageCompatible bool        `json:"local_storage_compatible"`
	Snooze                 bool        `json:"snooze"`
	SnoozeTimeRemaining    interface{} `json:"snooze_time_remaining"`
	Revision               string      `json:"revision"`
	Color                  string      `json:"color"`
}

type Clip

type Clip struct {
	ID         string    `json:"id"`
	Size       string    `json:"size"`
	CameraName string    `json:"camera_name"`
	CreatedAt  time.Time `json:"created_at"`
}

type DeviceManifest

type DeviceManifest struct {
	Account struct {
		ID                        int  `json:"id"`
		EmailVerified             bool `json:"email_verified"`
		EmailVerificationRequired bool `json:"email_verification_required"`
		AmazonAccountLinked       bool `json:"amazon_account_linked"`
	} `json:"account"`
	Networks []struct {
		ID        int       `json:"id"`
		CreatedAt time.Time `json:"created_at"`
		UpdatedAt time.Time `json:"updated_at"`
		Name      string    `json:"name"`
		TimeZone  string    `json:"time_zone"`
		Dst       bool      `json:"dst"`
		Armed     bool      `json:"armed"`
		LvSave    bool      `json:"lv_save"`
	} `json:"networks"`
	SyncModules []SyncModule  `json:"sync_modules"`
	Cameras     []Camera      `json:"cameras"`
	Sirens      []interface{} `json:"sirens"`
	Chimes      []interface{} `json:"chimes"`
	VideoStats  struct {
		Storage              int   `json:"storage"`
		AutoDeleteDays       int   `json:"auto_delete_days"`
		AutoDeleteDayOptions []int `json:"auto_delete_day_options"`
	} `json:"video_stats"`
	DoorbellButtons []interface{} `json:"doorbell_buttons"`
	Owls            []interface{} `json:"owls"`
	Doorbells       []interface{} `json:"doorbells"`
	AppUpdates      struct {
		Message         string `json:"message"`
		Code            int    `json:"code"`
		UpdateAvailable bool   `json:"update_available"`
		UpdateRequired  bool   `json:"update_required"`
	} `json:"app_updates"`
	DeviceLimits struct {
		Camera         int `json:"camera"`
		Chime          int `json:"chime"`
		Doorbell       int `json:"doorbell"`
		DoorbellButton int `json:"doorbell_button"`
		Owl            int `json:"owl"`
		Siren          int `json:"siren"`
		TotalDevices   int `json:"total_devices"`
	} `json:"device_limits"`
	WhatsNew struct {
		UpdatedAt int    `json:"updated_at"`
		URL       string `json:"url"`
	} `json:"whats_new"`
	Subscriptions struct {
		UpdatedAt time.Time `json:"updated_at"`
	} `json:"subscriptions"`
	Entitlements struct {
		UpdatedAt time.Time `json:"updated_at"`
	} `json:"entitlements"`
	TivLockEnable bool `json:"tiv_lock_enable"`
	TivLockStatus struct {
		Locked bool `json:"locked"`
	} `json:"tiv_lock_status"`
	Accessories struct {
		Storm []interface{} `json:"storm"`
		Rosie []interface{} `json:"rosie"`
	} `json:"accessories"`
}

type LocalStorageManifest

type LocalStorageManifest struct {
	Version    string `json:"version"`
	ManifestID string `json:"manifest_id"`
	Clips      []Clip `json:"clips"`
}

type LoginResponse

type LoginResponse struct {
	Account struct {
		AccountID                   int    `json:"account_id"`
		UserID                      int    `json:"user_id"`
		ClientID                    int    `json:"client_id"`
		ClientTrusted               bool   `json:"client_trusted"`
		NewAccount                  bool   `json:"new_account"`
		Tier                        string `json:"tier"`
		Region                      string `json:"region"`
		AccountVerificationRequired bool   `json:"account_verification_required"`
		PhoneVerificationRequired   bool   `json:"phone_verification_required"`
		ClientVerificationRequired  bool   `json:"client_verification_required"`
		RequireTrustClientDevice    bool   `json:"require_trust_client_device"`
		CountryRequired             bool   `json:"country_required"`
		VerificationChannel         string `json:"verification_channel"`
		User                        struct {
			UserID  int    `json:"user_id"`
			Country string `json:"country"`
		} `json:"user"`
		AmazonAccountLinked bool `json:"amazon_account_linked"`
	} `json:"account"`
	Auth struct {
		Token string `json:"token"`
	} `json:"auth"`
	Phone struct {
		Number             string `json:"number"`
		Last4Digits        string `json:"last_4_digits"`
		CountryCallingCode string `json:"country_calling_code"`
		Valid              bool   `json:"valid"`
	} `json:"phone"`
	Verification struct {
		Email struct {
			Required bool `json:"required"`
		} `json:"email"`
		Phone struct {
			Required bool   `json:"required"`
			Channel  string `json:"channel"`
		} `json:"phone"`
	} `json:"verification"`
	LockoutTimeRemaining  int  `json:"lockout_time_remaining"`
	ForcePasswordReset    bool `json:"force_password_reset"`
	AllowPinResendSeconds int  `json:"allow_pin_resend_seconds"`
}

type Network

type Network struct {
	ID      int    `json:"network_id"`
	Name    string `json:"name"`
	Cameras []struct {
		ID          int    `json:"id"`
		Name        string `json:"name"`
		Usage       int    `json:"usage"`
		LvSeconds   int    `json:"lv_seconds"`
		ClipSeconds int    `json:"clip_seconds"`
	} `json:"cameras"`
}

type NetworkList

type NetworkList struct {
	RangeDays int `json:"range_days"`
	Reference struct {
		Usage int `json:"usage"`
	} `json:"reference"`
	Networks []Network `json:"networks"`
}

type SyncModule

type SyncModule struct {
	ID                     int       `json:"id"`
	CreatedAt              time.Time `json:"created_at"`
	UpdatedAt              time.Time `json:"updated_at"`
	Onboarded              bool      `json:"onboarded"`
	Status                 string    `json:"status"`
	Name                   string    `json:"name"`
	Serial                 string    `json:"serial"`
	FwVersion              string    `json:"fw_version"`
	Type                   string    `json:"type"`
	Subtype                string    `json:"subtype"`
	LastHb                 time.Time `json:"last_hb"`
	WifiStrength           int       `json:"wifi_strength"`
	NetworkID              int       `json:"network_id"`
	EnableTempAlerts       bool      `json:"enable_temp_alerts"`
	LocalStorageEnabled    bool      `json:"local_storage_enabled"`
	LocalStorageCompatible bool      `json:"local_storage_compatible"`
	LocalStorageStatus     string    `json:"local_storage_status"`
	Revision               string    `json:"revision"`
}

type VerifyResponse

type VerifyResponse struct {
	Valid         bool   `json:"valid"`
	RequireNewPin bool   `json:"require_new_pin"`
	Message       string `json:"message"`
	Code          int    `json:"code"`
}

type Video

type Video struct {
	AccountID       int64       `json:"account_id"`
	Address         string      `json:"address"`
	CameraID        int64       `json:"camera_id"`
	CameraName      string      `json:"camera_name"`
	CreatedAt       string      `json:"created_at"`
	Deleted         bool        `json:"deleted"`
	Description     string      `json:"description"`
	Encryption      string      `json:"encryption"`
	EncryptionKey   interface{} `json:"encryption_key"`
	EventID         interface{} `json:"event_id"`
	ID              int64       `json:"id"`
	Length          int64       `json:"length"`
	Locked          bool        `json:"locked"`
	NetworkID       int64       `json:"network_id"`
	NetworkName     string      `json:"network_name"`
	Partial         bool        `json:"partial"`
	Ready           bool        `json:"ready"`
	Size            int64       `json:"size"`
	StorageLocation string      `json:"storage_location"`
	Thumbnail       string      `json:"thumbnail"`
	TimeZone        string      `json:"time_zone"`
	UpdatedAt       string      `json:"updated_at"`
	UploadTime      int64       `json:"upload_time"`
	Viewed          string      `json:"viewed"`
}

type VideoEvents

type VideoEvents struct {
	Limit        int           `json:"limit"`
	PurgeID      int64         `json:"purge_id"`
	RefreshCount int           `json:"refresh_count"`
	Media        []interface{} `json:"media"`
}

Jump to

Keyboard shortcuts

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