ford

package
v0.0.0-...-4b6ff7e Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TokenURI      = "https://api.mps.ford.com"
	LoginUri      = "https://login.ford.com/4566605f-43a7-400a-946e-89cc9fdb0bd7/B2C_1A_SignInSignUp_de-DE"
	ClientID      = "09852200-05fd-41f6-8c21-d36d3497dc64"
	ApplicationID = "1E8C7794-FF5F-49BC-9596-A1E0C86C5B19"
)
View Source
const ApiURI = "https://usapi.cv.ford.com"

Variables

View Source
var OAuth2Config = &oauth2.Config{
	ClientID: ClientID,
	Endpoint: oauth2.Endpoint{
		AuthURL:  fmt.Sprintf("%s/oauth2/v2.0/authorize", LoginUri),
		TokenURL: fmt.Sprintf("%s/oauth2/v2.0/token", LoginUri),
	},
	RedirectURL: "fordapp://userauthorized",
	Scopes:      []string{ClientID, "openid"},
}

Functions

This section is empty.

Types

type API

type API struct {
	*request.Helper
}

API is the Ford api client

func NewAPI

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

NewAPI creates a new api client

func (*API) Vehicles

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

Vehicles returns the list of user vehicles

type Identity

type Identity struct {
	*request.Helper

	oauth2.TokenSource
	// contains filtered or unexported fields
}

func NewIdentity

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

NewIdentity creates Ford identity

func (*Identity) Login

func (v *Identity) Login() error

Login authenticates with username/password to get new aws credentials

func (*Identity) RefreshToken

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

RefreshToken implements oauth.TokenRefresher

type Provider

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

func NewProvider

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

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

func (*Provider) WakeUp

func (v *Provider) WakeUp() error

WakeUp implements the api.Resurrector interface

type Settings

type Settings struct {
	TransId string `json:"transId"`
	Csrf    string `json:"csrf"`
}

type VehiclesResponse

type VehiclesResponse struct {
	UserVehicles struct {
		VehicleDetails []struct {
			VIN string
		}
	}
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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