package module
v0.0.0-...-8bd1255 Latest Latest

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

Go to latest
Published: Apr 15, 2021 License: BSD-2-Clause Imports: 15 Imported by: 0




This section is empty.


View Source
var (
	ErrNotImplemented       = errors.New("function not implemented")
	ErrNotAuthenticated     = errors.New("client not authenticated")
	ErrAuthenticationFailed = errors.New("client authentication failed")
	ErrUnknownBrand         = errors.New("unknown brand")
	ErrNoVehicleFound       = errors.New("no vehicle found")
View Source
var JSONEncoding = map[string]string{
	"Content-Type": "application/json",
	"Accept":       "application/json",

JSONEncoding specifies application/json


func GetStampFromList

func GetStampFromList(b Brand) (string, error)


type Brand

type Brand string
const (
	BrandUnknown Brand = "unknown"
	BrandHyundai Brand = "hyundai"
	BrandKia     Brand = "kia"

type Client

type Client struct {
	// contains filtered or unexported fields

func NewClient

func NewClient(cfg Config, opts ...ClientOptions) (*Client, error)

func (*Client) Authenticate

func (c *Client) Authenticate() error

func (*Client) Vehicles

func (c *Client) Vehicles() ([]*Vehicle, error)

type ClientOptions

type ClientOptions func(*Client) error

func WithTimeout

func WithTimeout(d time.Duration) ClientOptions

func WithTransport

func WithTransport(rt http.RoundTripper) ClientOptions

type Config

type Config struct {
	Username string `json:"username"`
	Password string `json:"password"`
	Pin      string `json:"pin"`
	Brand    Brand  `json:"brand"`
	Region   Region `json:"region"`

type HttpClient

type HttpClient interface {
	Do(req *http.Request) (*http.Response, error)

type PlugType

type PlugType int
const (
	PlugTypeAC PlugType = iota

type Region

type Region string
const (
	RegionUnknown Region = "unknown"
	RegionEU      Region = "eu"
	RegionUS      Region = "us"
	RegionCA      Region = "ca"

type StartOptions

type StartOptions struct{} // ClimateOptions || StartOptions

type Vehicle

type Vehicle struct {
	// contains filtered or unexported fields

func NewVehicle

func NewVehicle(
	id, vin, name, vtype string,
	b Brand,
	opts ...VehicleOption,
) *Vehicle

func (*Vehicle) Brand

func (v *Vehicle) Brand() Brand

func (*Vehicle) ID

func (v *Vehicle) ID() string

func (*Vehicle) Location

func (v *Vehicle) Location() (string, error)

func (*Vehicle) Lock

func (v *Vehicle) Lock() error

func (*Vehicle) Name

func (v *Vehicle) Name() string

func (*Vehicle) Odometer

func (v *Vehicle) Odometer() (string, error)

func (*Vehicle) Start

func (v *Vehicle) Start(...StartOptions) error

func (*Vehicle) Status

func (v *Vehicle) Status() (*VehicleStatus, error)

func (*Vehicle) Stop

func (v *Vehicle) Stop() error

func (*Vehicle) Type

func (v *Vehicle) Type() string

func (*Vehicle) Unlock

func (v *Vehicle) Unlock() error

func (*Vehicle) VIN

func (v *Vehicle) VIN() string

type VehicleOption

type VehicleOption func(*Vehicle)

func WithVehicleAuth

func WithVehicleAuth(a auth) VehicleOption

func WithVehicleClient

func WithVehicleClient(h HttpClient) VehicleOption

func WithVehicleEndpoints

func WithVehicleEndpoints(e endpoints) VehicleOption

type VehicleStatus

type VehicleStatus struct {
	// contains filtered or unexported fields

func (*VehicleStatus) DoorIsLocked

func (v *VehicleStatus) DoorIsLocked() bool

func (*VehicleStatus) IsCharging

func (v *VehicleStatus) IsCharging() bool

func (*VehicleStatus) MaxRange

func (v *VehicleStatus) MaxRange() int

func (*VehicleStatus) RangeLeft

func (v *VehicleStatus) RangeLeft() int

func (*VehicleStatus) SoC

func (v *VehicleStatus) SoC() int

func (*VehicleStatus) TargetSocAC

func (v *VehicleStatus) TargetSocAC() int

func (*VehicleStatus) TargetSocDC

func (v *VehicleStatus) TargetSocDC() int

func (*VehicleStatus) UpdatedAt

func (v *VehicleStatus) UpdatedAt() time.Time


Path Synopsis

Jump to

Keyboard shortcuts

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