connected

package
v0.0.0-...-cba36cc Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ApiURL = "https://api.volvocars.com"
)

api constants

Variables

View Source
var Oauth2Config = oauth2.Config{
	Endpoint: oauth2.Endpoint{
		AuthURL:  "https://volvoid.eu.volvocars.com/as/authorization.oauth2",
		TokenURL: "https://volvoid.eu.volvocars.com/as/token.oauth2",
	},
	Scopes: []string{
		oidc.ScopeOpenID, "vehicle:attributes",
		"energy:recharge_status", "energy:battery_charge_level", "energy:electric_range", "energy:estimated_charging_time", "energy:charging_connection_status", "energy:charging_system_status",
		"conve:fuel_status", "conve:odometer_status", "conve:environment",
	},
}

Functions

This section is empty.

Types

type API

type API struct {
	*request.Helper
}

API is the Volvo client

func NewAPI

func NewAPI(log *util.Logger, identity oauth2.TokenSource, vccapikey string) *API

NewAPI creates a new api client

func (*API) RechargeStatus

func (v *API) RechargeStatus(vin string) (RechargeStatus, error)

Range provides range status api response

func (*API) Vehicles

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

type Identity

type Identity struct {
	*request.Helper
	// contains filtered or unexported fields
}

func NewIdentity

func NewIdentity(log *util.Logger) (*Identity, error)

func (*Identity) Login

func (v *Identity) Login(user, password string) (oauth2.TokenSource, error)

func (*Identity) RefreshToken

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

type Provider

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

Provider implements the vehicle api

func NewProvider

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

NewProvider creates a vehicle api provider

func (*Provider) FinishTime

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

FinishTime implements the api.VehicleFinishTimer interface

func (*Provider) Range

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

Range implements the api.VehicleRange interface

func (*Provider) Soc

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

Soc implements the api.Vehicle interface

func (*Provider) Status

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

Range implements the api.ChargeState interface

type RechargeStatus

type RechargeStatus struct {
	Status      int
	OperationID string
	Data        struct {
		BatteryChargeLevel struct {
			Value     float64 `json:",string"`
			Unit      string
			Timestamp time.Time
		}
		ElectricRange struct {
			Value     int64 `json:",string"`
			Unit      string
			Timestamp time.Time
		}
		EstimatedChargingTime struct {
			Value     int64 `json:",string"`
			Unit      string
			Timestamp time.Time
		}
		ChargingConnectionStatus struct {
			Value     string
			Timestamp time.Time
		}
		ChargingSystemStatus struct {
			Value     string
			Timestamp time.Time
		}
	}
}

type ReuseTokenSource

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

func (*ReuseTokenSource) Apply

func (ts *ReuseTokenSource) Apply(t *oauth2.Token)

func (*ReuseTokenSource) Token

func (ts *ReuseTokenSource) Token() (*oauth2.Token, error)

Jump to

Keyboard shortcuts

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