toyota

package
v0.0.0-...-13bb846 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BaseUrl                  = "https://oneapp:oneapp@b2c-login.toyota-europe.com"
	ApiBaseUrl               = "https://ctpa-oneapi.tceu-ctp-prd.toyotaconnectedeurope.io"
	AccessTokenPath          = "oauth2/realms/root/realms/tme/access_token"
	AuthenticationPath       = "json/realms/root/realms/tme/authenticate?authIndexType=service&authIndexValue=oneapp"
	AuthorizationPath        = "" /* 198-byte string literal not displayed */
	VehicleGuidPath          = "v2/vehicle/guid"
	RemoteElectricStatusPath = "v1/global/remote/electric/status"
	ApiKey                   = "tTZipv6liF74PwMfk9Ed68AQ0bISswwf3iHQdqcF"
)
View Source
const (
	APIVersion   = "protocol=1.0,resource=2.1"
	ClientID     = "oneapp"
	ClientSecret = "6GKIax7fGT5yPHuNmWNVOc4q5POBw1WRSW39ubRA8WPBmQ7MOxhm75EsmKMKENem"
	Scope        = "openid profile vehicles"
	Realm        = "a-ncb-prod"
	RedirectURI  = "com.toyota.oneapp:/oauth2Callback"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

func NewAPI

func NewAPI(log *util.Logger, identity *Identity) *API

func (*API) Status

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

func (*API) Vehicles

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

type Auth

type Auth struct {
	AuthID    string         `json:"authId"`
	Callbacks []AuthCallback `json:"callbacks"`
}

type AuthCallback

type AuthCallback struct {
	Id     int8                `json:"_id"`
	Type   string              `json:"type"`
	Output []AuthCallbackValue `json:"output"`
	Input  []AuthCallbackValue `json:"input"`
}

type AuthCallbackValue

type AuthCallbackValue struct {
	Name  string      `json:"name"`
	Value interface{} `json:"value"`
}

type EvRange

type EvRange struct {
	Unit  string  `json:"unit"`
	Value float64 `json:"value"`
}

type Identity

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

func NewIdentity

func NewIdentity(log *util.Logger) *Identity

func (*Identity) Login

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

type Provider

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

func NewProvider

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

func (*Provider) Soc

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

type Status

type Status struct {
	Status struct {
		Messages []struct {
			ResponseCode        string `json:"responseCode"`
			Description         string `json:"description"`
			DetailedDescription string `json:"detailedDescription"`
		} `json:"messages"`
	} `json:"status"`
	Payload struct {
		BatteryLevel        int     `json:"batteryLevel"`
		ChargingStatus      string  `json:"chargingStatus"`
		EvRange             EvRange `json:"evRange"`
		EvRangeWithAc       EvRange `json:"evRangeWithAc"`
		LastUpdateTimestamp string  `json:"lastUpdateTimestamp"`
	} `json:"payload"`
}

type Token

type Token struct {
	TokenID    string `json:"tokenId"`
	SuccessURL string `json:"successUrl"`
	Code       int    `json:"code"`    // error response
	Reason     string `json:"reason"`  // error response
	Message    string `json:"message"` // error response
}

func (*Token) Error

func (t *Token) Error() error

func (*Token) SessionExpired

func (t *Token) SessionExpired() bool

type Vehicle

type Vehicle struct {
	VIN string `json:"vin"`
}

type Vehicles

type Vehicles struct {
	Status struct {
		Messages []struct {
			ResponseCode        string `json:"responseCode"`
			Description         string `json:"description"`
			DetailedDescription string `json:"detailedDescription"`
		} `json:"messages"`
	} `json:"status"`
	Payload []Vehicle `json:"payload"`
}

Jump to

Keyboard shortcuts

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