myq

package module
v0.0.0-...-b62a2f2 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2022 License: MIT Imports: 15 Imported by: 1

README

myq-golang

Provides a goLang API Client Library for MyQ Services

Sourced from https://github.com/joeshaw/myq but removes the cmd code

Documentation

Index

Constants

View Source
const (
	ActionClose = "close"
	ActionOpen  = "open"

	StateUnknown = "unknown"
	StateOpen    = "open"
	StateClosed  = "closed"
	StateStopped = "stopped"
	StateOpening = "opening"
	StateClosing = "closing"
)

Variables

View Source
var (
	// Debug indicates whether to log HTTP responses to stderr
	Debug = false

	// ErrNotLoggedIn is returned whenever an operation is run the
	// user has not logged in
	ErrNotLoggedIn = errors.New("not logged in")
)

Functions

This section is empty.

Types

type Account

type Account struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type Device

type Device struct {
	Account      *Account
	SerialNumber string
	Type         string
	Name         string
	DoorState    string
}

Device defines a MyQ device

type Session

type Session struct {
	Username string
	Password string
	// contains filtered or unexported fields
}

Session represents an authenticated session to the MyQ service.

func (*Session) DeviceState

func (s *Session) DeviceState(serialNumber string) (string, error)

DeviceState returns the device state (open, closed, etc.) for the provided device serial number

func (*Session) Devices

func (s *Session) Devices() ([]Device, error)

Devices returns the list of MyQ devices

func (*Session) Login

func (s *Session) Login() error

Login establishes an authenticated Session with the MyQ service

func (*Session) SetDoorState

func (s *Session) SetDoorState(serialNumber string, action string) error

SetDoorState sets the target door state (open or closed) for the provided device serial number

Jump to

Keyboard shortcuts

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