jlr

package
v0.0.0-...-aa513c4 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IF9_BASE_URL  = "https://if9.prod-row.jlrmotor.com/if9/jlr"
	IFOP_BASE_URL = "https://ifop.prod-row.jlrmotor.com/ifop/jlr"
)
View Source
const IFAS_BASE_URL = "https://ifas.prod-row.jlrmotor.com/ifas/jlr"

Variables

This section is empty.

Functions

func Headers

func Headers(device string, headers map[string]string) map[string]string

Types

type API

type API struct {
	*request.Helper
}

API is the Jaguar/Landrover api client

func NewAPI

func NewAPI(log *util.Logger, device string, ts oauth2.TokenSource) *API

NewAPI creates a new api client

func (*API) AuthenticateVinService

func (v *API) AuthenticateVinService(vin, user, service string) (PinResponse, error)

func (*API) ChargeAction

func (v *API) ChargeAction(vin, user string, start bool) error

func (*API) Position

func (v *API) Position(vin string) (PositionResponse, error)

Position returns the vehicle position

func (*API) Status

func (v *API) Status(vin string) (StatusResponse, error)

Status returns the vehicle status

func (*API) User

func (v *API) User(name string) (User, error)

func (*API) Vehicles

func (v *API) Vehicles(user string) ([]string, error)

type ActionResponse

type ActionResponse struct {
	FailureDescription string
}

type Identity

type Identity struct {
	*request.Helper

	oauth2.TokenSource
	// contains filtered or unexported fields
}

func NewIdentity

func NewIdentity(log *util.Logger, user, password, device string) *Identity

NewIdentity creates Fiat identity

func (*Identity) Login

func (v *Identity) Login() (Token, error)

Login authenticates with username/password

func (*Identity) RefreshToken

func (v *Identity) RefreshToken(token *oauth2.Token) (*oauth2.Token, error)

RefreshToken implements oauth.TokenRefresher

type KeyValue

type KeyValue struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type KeyValueList

type KeyValueList []KeyValue

func (KeyValueList) FloatVal

func (l KeyValueList) FloatVal(key string) (float64, error)

func (KeyValueList) IntVal

func (l KeyValueList) IntVal(key string) (int64, error)

func (KeyValueList) StringVal

func (l KeyValueList) StringVal(key string) (string, error)

type PinResponse

type PinResponse struct {
	Token string
}

type PositionResponse

type PositionResponse struct {
	Position struct {
		Latitude        float64
		Longitude       float64
		Timestamp       string
		Speed           float64
		Heading         float64
		PositionQuality interface{}
	}
}

type Provider

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

func NewProvider

func NewProvider(api *API, vin, user string, cache time.Duration) *Provider

func (*Provider) ChargeEnable

func (v *Provider) ChargeEnable(enable bool) error

ChargeEnable implements the api.ChargeController interface

func (*Provider) FinishTime

func (v *Provider) FinishTime() (time.Time, error)

FinishTime implements the api.VehicleFinishTimer interface

func (*Provider) Odometer

func (v *Provider) Odometer() (float64, error)

Odometer implements the api.VehicleOdometer interface

func (*Provider) Position

func (v *Provider) Position() (float64, float64, error)

Position implements the api.VehiclePosition interface

func (*Provider) Range

func (v *Provider) Range() (int64, error)

Range implements the api.VehicleRange interface

func (*Provider) Soc

func (v *Provider) Soc() (float64, error)

Soc implements the api.Battery interface

func (*Provider) Status

func (v *Provider) Status() (api.ChargeStatus, error)

Status implements the api.ChargeState interface

type StatusResponse

type StatusResponse struct {
	VehicleStatus struct {
		CoreStatus KeyValueList
		EvStatus   KeyValueList
	}
}

type Token

type Token struct {
	AuthToken string `json:"authorization_token"`
	ExpiresIn int    `json:"expires_in,string"`
	oauth2.Token
}

type User

type User struct {
	HomeMarket string `json:"homeMarket"`
	UserId     string `json:"userId"`
}

type Vehicle

type Vehicle struct {
	UserId string `json:"userId"`
	VIN    string `json:"vin"`
	Role   string `json:"role"`
}

type VehiclesResponse

type VehiclesResponse struct {
	Vehicles []Vehicle
}

Jump to

Keyboard shortcuts

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