mercedes

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoDataAvailable = errors.New("no data available for this endpoint")

Functions

This section is empty.

Types

type APIClient

type APIClient struct {
	// contains filtered or unexported fields
}

func New

func New(clientID, clientSecret string, creds credential.Store) *APIClient

func (*APIClient) GetAuthStartURL

func (a *APIClient) GetAuthStartURL(redirectURL string) string

func (APIClient) GetElectricStatus added in v0.2.0

func (a APIClient) GetElectricStatus(vehicleID string) (ElectricStatus, error)

func (APIClient) GetFuelStatus

func (a APIClient) GetFuelStatus(vehicleID string) (FuelStatus, error)

func (APIClient) GetLockStatus

func (a APIClient) GetLockStatus(vehicleID string) (LockStatus, error)

func (APIClient) GetPayAsYouDriveInsurance

func (a APIClient) GetPayAsYouDriveInsurance(vehicleID string) (PayAsYouDriveInsurance, error)

func (APIClient) GetVehicleStatus

func (a APIClient) GetVehicleStatus(vehicleID string) (VehicleStatus, error)

func (*APIClient) StoreTokenFromRequest

func (a *APIClient) StoreTokenFromRequest(redirectURL string, r *http.Request) error

type Client

type Client interface {
	GetAuthStartURL(redirectURL string) string
	GetElectricStatus(vehicleID string) (ElectricStatus, error)
	GetFuelStatus(vehicleID string) (FuelStatus, error)
	GetLockStatus(vehicleID string) (LockStatus, error)
	GetPayAsYouDriveInsurance(vehicleID string) (PayAsYouDriveInsurance, error)
	GetVehicleStatus(vehicleID string) (VehicleStatus, error)
	StoreTokenFromRequest(redirectURL string, r *http.Request) error
}

type ElectricStatus added in v0.2.0

type ElectricStatus struct {
	// Displayed state of charge for the HV battery	0..100 %
	StateOfCharge TimedInt `apiField:"soc"`
	// Electric range	0..2046 km
	ElectricRange TimedInt `apiField:"rangeelectric"`
}

type FuelStatus

type FuelStatus struct {
	RangeLiquid      TimedInt `apiField:"rangeliquid"`      // Liquid fuel tank range	0..2046 km
	TanklevelPercent TimedInt `apiField:"tanklevelpercent"` // Liquid fuel tank level	0…100 %
}

type LockStatus

type LockStatus struct {
	// Lock status of the deck lid	false: locked / true: unlocked
	DeckLidUnlocked TimedBool `apiField:"doorlockstatusdecklid"`
	// Vehicle lock status
	VehicleStatus TimedEnum `apiField:"doorlockstatusvehicle" values:"unlocked,internal locked,external locked,selective unlocked"`
	// Status of gas tank door lock	false: locked / true: unlocked
	GasLidUnlocked TimedBool `apiField:"doorlockstatusgas"`
	// Vehicle heading position	0..359.9 degrees
	Heading TimedFloat `apiField:"positionHeading"`
}

type MetricValue

type MetricValue interface {
	IsValid() bool
	Time() time.Time
	ToFloat() float64
}

type PayAsYouDriveInsurance

type PayAsYouDriveInsurance struct {
	Odometer TimedInt `apiField:"odo"`
}

type TimedBool

type TimedBool struct {
	// contains filtered or unexported fields
}

func (TimedBool) Bool

func (t TimedBool) Bool() bool

func (TimedBool) IsValid

func (t TimedBool) IsValid() bool

func (TimedBool) String

func (t TimedBool) String() string

func (TimedBool) Time

func (t TimedBool) Time() time.Time

func (TimedBool) ToFloat

func (t TimedBool) ToFloat() float64

type TimedEnum

type TimedEnum struct {
	// contains filtered or unexported fields
}

func (TimedEnum) Idx

func (t TimedEnum) Idx() int64

func (TimedEnum) IsValid

func (t TimedEnum) IsValid() bool

func (TimedEnum) String

func (t TimedEnum) String() string

func (TimedEnum) Time

func (t TimedEnum) Time() time.Time

func (TimedEnum) ToFloat

func (t TimedEnum) ToFloat() float64

func (TimedEnum) Value

func (t TimedEnum) Value() string

type TimedFloat

type TimedFloat struct {
	// contains filtered or unexported fields
}

func (TimedFloat) Float

func (t TimedFloat) Float() float64

func (TimedFloat) IsValid

func (t TimedFloat) IsValid() bool

func (TimedFloat) String

func (t TimedFloat) String() string

func (TimedFloat) Time

func (t TimedFloat) Time() time.Time

func (TimedFloat) ToFloat

func (t TimedFloat) ToFloat() float64

type TimedInt

type TimedInt struct {
	// contains filtered or unexported fields
}

func (TimedInt) Int

func (t TimedInt) Int() int64

func (TimedInt) IsValid

func (t TimedInt) IsValid() bool

func (TimedInt) String

func (t TimedInt) String() string

func (TimedInt) Time

func (t TimedInt) Time() time.Time

func (TimedInt) ToFloat

func (t TimedInt) ToFloat() float64

type VehicleStatus

type VehicleStatus struct {
	// Deck lid latch status opened/closed state	false: closed / true: open
	DeckLidOpen TimedBool `apiField:"decklidstatus"`
	// Status of the front left door	false: closed / true: open
	DoorFrontLeftOpen TimedBool `apiField:"doorstatusfrontleft"`
	// Status of the front right door	false: closed / true: open
	DoorFrontRightOpen TimedBool `apiField:"doorstatusfrontright"`
	// Status of the rear left door	false: closed / true: open
	DoorRearLeftOpen TimedBool `apiField:"doorstatusrearleft"`
	// Status of the rear right door	false: closed / true: open
	DoorRearRightOpen TimedBool `apiField:"doorstatusrearright"`
	// Front light inside	false: off / true: on
	InteriorLightsFrontOn TimedBool `apiField:"interiorLightsFront"`
	// Rear light inside	false: off / true: on
	InteriorLightsRearOn TimedBool `apiField:"interiorLightsRear"`
	// Rotary light switch position
	LightSwitchPosition TimedEnum `apiField:"lightswitchposition" values:"auto,headlights,sidelight left,sidelight right,parking light"`
	// Front left reading light inside	false: off / true: on
	ReadingLampFrontLeftOn TimedBool `apiField:"readingLampFrontLeft"`
	// Front right reading light inside	false: off / true: on
	ReadingLampFrontRightOn TimedBool `apiField:"readingLampFrontRight"`
	// Status of the convertible top opened/closed
	RoofTopStatus TimedEnum `apiField:"rooftopstatus" values:"unlocked,open and locked,closed and locked"`
	// Status of the sunroof
	SunRoofStatus TimedEnum `` /* 269-byte string literal not displayed */
	// Status of the front left window
	WindowStatusFrontLeft TimedEnum `` /* 207-byte string literal not displayed */
	// Status of the front right window
	WindowStatusFrontRight TimedEnum `` /* 208-byte string literal not displayed */
	// Status of the rear left window
	WindowStatusRearLeft TimedEnum `` /* 206-byte string literal not displayed */
	// Status of the rear right window
	WindowStatusRearRight TimedEnum `` /* 207-byte string literal not displayed */
}

Jump to

Keyboard shortcuts

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