All checks were successful
Golan Testing / testing (1.24.x, ubuntu-latest) (push) Successful in 26s
296 lines
20 KiB
Go
296 lines
20 KiB
Go
package mysubaru
|
|
|
|
import (
|
|
"encoding/json"
|
|
"time"
|
|
)
|
|
|
|
// Response .
|
|
type Response struct {
|
|
Success bool `json:"success"` // true | false
|
|
ErrorCode string `json:"errorCode,omitempty"` // string | Error message if Success is false
|
|
DataName string `json:"dataName"` // string | Describes the structure which is incleded in Data field
|
|
Data json.RawMessage `json:"data"` // Data struct
|
|
}
|
|
|
|
// Account .
|
|
type Account struct {
|
|
MarketID int `json:"marketId"`
|
|
AccountKey int `json:"accountKey"`
|
|
FirstName string `json:"firstName"`
|
|
LastName string `json:"lastName"`
|
|
ZipCode string `json:"zipCode"`
|
|
ZipCode5 string `json:"zipCode5"`
|
|
LastLoginDate int64 `json:"lastLoginDate"`
|
|
CreatedDate int64 `json:"createdDate"`
|
|
}
|
|
|
|
// Customer .
|
|
type Customer struct {
|
|
SessionCustomer string `json:"sessionCustomer"`
|
|
Email string `json:"email"`
|
|
FirstName string `json:"firstName"`
|
|
LastName string `json:"lastName"`
|
|
Zip string `json:"zip"`
|
|
OemCustID string `json:"oemCustId"`
|
|
Phone string `json:"phone"`
|
|
}
|
|
|
|
// SessionData .
|
|
// "dataName": "sessionData"
|
|
type SessionData struct {
|
|
SessionChanged bool `json:"sessionChanged"`
|
|
VehicleInactivated bool `json:"vehicleInactivated"`
|
|
Account Account `json:"account"`
|
|
ResetPassword bool `json:"resetPassword"`
|
|
DeviceID string `json:"deviceId"`
|
|
SessionID string `json:"sessionId"`
|
|
DeviceRegistered bool `json:"deviceRegistered"`
|
|
PasswordToken string `json:"passwordToken"`
|
|
Vehicles []VehicleData `json:"vehicles"`
|
|
RightToRepairEnabled bool `json:"rightToRepairEnabled"`
|
|
RightToRepairStates string `json:"rightToRepairStates"`
|
|
CurrentVehicleIndex int `json:"currentVehicleIndex"`
|
|
HandoffToken string `json:"handoffToken"`
|
|
EnableXtime bool `json:"enableXtime"`
|
|
TermsAndConditionsAccepted bool `json:"termsAndConditionsAccepted"`
|
|
RightToRepairStartYear int `json:"rightToRepairStartYear"`
|
|
DigitalGlobeConnectID string `json:"digitalGlobeConnectId"`
|
|
DigitalGlobeImageTileService string `json:"digitalGlobeImageTileService"`
|
|
DigitalGlobeTransparentTileService string `json:"digitalGlobeTransparentTileService"`
|
|
TomtomKey string `json:"tomtomKey"`
|
|
SatelliteViewEnabled bool `json:"satelliteViewEnabled"`
|
|
RegisteredDevicePermanent bool `json:"registeredDevicePermanent"`
|
|
}
|
|
|
|
// Vehicle .
|
|
// "dataName": "vehicle"
|
|
type VehicleData struct {
|
|
Customer Customer `json:"customer"` // Customer struct
|
|
UserOemCustID string `json:"userOemCustId"` // CRM-631-HQN48K
|
|
OemCustID string `json:"oemCustId"` // CRM-631-HQN48K
|
|
Active bool `json:"active"` // true | false
|
|
Email string `json:"email"` // null | email@address.com
|
|
FirstName string `json:"firstName"` // null | First Name
|
|
LastName string `json:"lastName"` // null | Last Name
|
|
Zip string `json:"zip"` // 12345
|
|
Phone string `json:"phone"` // null | 123-456-7890
|
|
StolenVehicle bool `json:"stolenVehicle"` // true | false
|
|
VehicleName string `json:"vehicleName"` // Subaru Outback LXT
|
|
Features []string `json:"features"` // "11.6MMAN", "ABS_MIL", "ACCS", "AHBL_MIL", "ATF_MIL", "AWD_MIL", "BSD", "BSDRCT_MIL", "CEL_MIL", "EBD_MIL", "EOL_MIL", "EPAS_MIL", "EPB_MIL", "ESS_MIL", "EYESIGHT", "ISS_MIL", "NAV_TOMTOM", "OPL_MIL", "RAB_MIL", "RCC", "REARBRK", "RES", "RESCC", "RHSF", "RPOI", "RPOIA", "SRH_MIL", "SRS_MIL", "TEL_MIL", "TPMS_MIL", "VDC_MIL", "WASH_MIL", "g2"
|
|
Vin string `json:"vin"` // 4Y1SL65848Z411439
|
|
VehicleKey int64 `json:"vehicleKey"` // 3832950
|
|
Nickname string `json:"nickname"` // Subaru Outback LXT
|
|
ModelName string `json:"modelName"` // Outback
|
|
ModelYear string `json:"modelYear"` // 2020
|
|
ModelCode string `json:"modelCode"` // LDJ
|
|
ExtDescrip string `json:"extDescrip"` // Abyss Blue Pearl (ext color)
|
|
IntDescrip string `json:"intDescrip"` // Gray (int color)
|
|
TransCode string `json:"transCode"` // CVT
|
|
EngineSize float64 `json:"engineSize"` // 2.4
|
|
Phev bool `json:"phev"` // null
|
|
CachedStateCode string `json:"cachedStateCode"` // NJ
|
|
LicensePlate string `json:"licensePlate"` // NJ
|
|
LicensePlateState string `json:"licensePlateState"` // ABCDEF
|
|
SubscriptionStatus string `json:"subscriptionStatus"` // ACTIVE
|
|
SubscriptionFeatures []string `json:"subscriptionFeatures"` // "REMOTE", "SAFETY", "Retail"
|
|
SubscriptionPlans []string `json:"subscriptionPlans"` // []
|
|
VehicleGeoPosition GeoPosition `json:"vehicleGeoPosition"` // GeoPosition struct
|
|
AccessLevel int `json:"accessLevel"` // -1
|
|
VehicleMileage int `json:"vehicleMileage"` // null
|
|
CrmRightToRepair bool `json:"crmRightToRepair"` // true | false
|
|
AuthorizedVehicle bool `json:"authorizedVehicle"` // false | true
|
|
NeedMileagePrompt bool `json:"needMileagePrompt"` // false | true
|
|
RemoteServicePinExist bool `json:"remoteServicePinExist"` // true | false
|
|
NeedEmergencyContactPrompt bool `json:"needEmergencyContactPrompt"` // false | true
|
|
Show3GSunsetBanner bool `json:"show3gSunsetBanner"` // false | true
|
|
Provisioned bool `json:"provisioned"` // true | false
|
|
TimeZone string `json:"timeZone"` // America/New_York
|
|
SunsetUpgraded bool `json:"sunsetUpgraded"` // true | false
|
|
PreferredDealer string `json:"preferredDealer"` // null |
|
|
}
|
|
|
|
// GeoPosition .
|
|
type GeoPosition struct {
|
|
Latitude float64 `json:"latitude"` // 40.700184
|
|
Longitude float64 `json:"longitude"` // -74.401375
|
|
Speed float64 `json:"speed,omitempty"` // 62
|
|
Heading int `json:"heading,omitempty"` // 155
|
|
Timestamp string `json:"timestamp,string"` // "2021-12-22T13:14:47"
|
|
}
|
|
|
|
// type GeoPositionTime time.Time
|
|
|
|
// func (g *GeoPositionTime) UnmarshalJSON(b []byte) error {
|
|
// s := strings.Trim(string(b), "\"")
|
|
// t, err := time.Parse("2006-01-02T15:04:05", s)
|
|
// if err != nil {
|
|
// panic(err)
|
|
// }
|
|
// *g = GeoPositionTime(t)
|
|
|
|
// return nil
|
|
// }
|
|
|
|
// VehicleStatus .
|
|
// "dataName":null
|
|
// parts = []{"door", "tire", "tyre", "window"}
|
|
// prefix = []{"pressure", "status"}
|
|
// suffix = []{"status", "position", "unit", "psi"}
|
|
// positions = []{"front", "rear", "sunroof", "boot", "enginehood"}
|
|
// subPositions []{"left", "right"}
|
|
|
|
type VehicleStatus struct {
|
|
VehicleId int64 `json:"vhsId"` // + 9969776690 5198812434
|
|
OdometerValue int `json:"odometerValue"` // + 23787
|
|
OdometerValueKm int `json:"odometerValueKilometers"` // + 38273
|
|
EventDate int64 `json:"eventDate"` // + 1701896993000
|
|
EventDateStr string `json:"eventDateStr"` // + 2023-12-06T21:09+0000
|
|
EventDateCarUser int64 `json:"eventDateCarUser"` // + 1701896993000
|
|
EventDateStrCarUser string `json:"eventDateStrCarUser"` // + 2023-12-06T21:09+0000
|
|
Latitude float64 `json:"latitude"` // + 40.700183
|
|
Longitude float64 `json:"longitude"` // + -74.401372
|
|
Heading int `json:"positionHeadingDegree"` // + "154"
|
|
DistanceToEmptyFuelMiles float64 `json:"distanceToEmptyFuelMiles"` // + 209.4
|
|
DistanceToEmptyFuelKilometers int `json:"distanceToEmptyFuelKilometers"` // + 337
|
|
DistanceToEmptyFuelMiles10s int `json:"distanceToEmptyFuelMiles10s"` // + 210
|
|
DistanceToEmptyFuelKilometers10s int `json:"distanceToEmptyFuelKilometers10s"` // + 340
|
|
AvgFuelConsumptionMpg float64 `json:"avgFuelConsumptionMpg"` // + 18.4
|
|
AvgFuelConsumptionLitersPer100Kilometers float64 `json:"avgFuelConsumptionLitersPer100Kilometers"` // + 12.8
|
|
RemainingFuelPercent int `json:"remainingFuelPercent"` // + 82
|
|
TirePressureFrontLeft string `json:"tirePressureFrontLeft"` // + "2275"
|
|
TirePressureFrontRight string `json:"tirePressureFrontRight"` // + "2344"
|
|
TirePressureRearLeft string `json:"tirePressureRearLeft"` // + "2413"
|
|
TirePressureRearRight string `json:"tirePressureRearRight"` // + "2344"
|
|
TirePressureFrontLeftPsi string `json:"tirePressureFrontLeftPsi"` // + "33"
|
|
TirePressureFrontRightPsi string `json:"tirePressureFrontRightPsi"` // + "34"
|
|
TirePressureRearLeftPsi string `json:"tirePressureRearLeftPsi"` // + "35"
|
|
TirePressureRearRightPsi string `json:"tirePressureRearRightPsi"` // + "34"
|
|
TyreStatusFrontLeft string `json:"tyreStatusFrontLeft"` // + "UNKNOWN"
|
|
TyreStatusFrontRight string `json:"tyreStatusFrontRight"` // + "UNKNOWN"
|
|
TyreStatusRearLeft string `json:"tyreStatusRearLeft"` // + "UNKNOWN"
|
|
TyreStatusRearRight string `json:"tyreStatusRearRight"` // + "UNKNOWN"
|
|
EvStateOfChargePercent float64 `json:"evStateOfChargePercent,omitempty"` // + null
|
|
EvDistanceToEmptyMiles int `json:"evDistanceToEmptyMiles,omitempty"` // + null
|
|
EvDistanceToEmptyKilometers int `json:"evDistanceToEmptyKilometers,omitempty"` // + null
|
|
EvDistanceToEmptyByStateMiles int `json:"evDistanceToEmptyByStateMiles,omitempty"` // + null
|
|
EvDistanceToEmptyByStateKilometers int `json:"evDistanceToEmptyByStateKilometers,omitempty"` // + null
|
|
VehicleStateType string `json:"vehicleStateType"` // + "IGNITION_OFF | IGNITION_ON"
|
|
WindowFrontLeftStatus string `json:"windowFrontLeftStatus"` // + "CLOSE"
|
|
WindowFrontRightStatus string `json:"windowFrontRightStatus"` // + "CLOSE"
|
|
WindowRearLeftStatus string `json:"windowRearLeftStatus"` // + "CLOSE"
|
|
WindowRearRightStatus string `json:"windowRearRightStatus"` // + "CLOSE"
|
|
WindowSunroofStatus string `json:"windowSunroofStatus"` // + "CLOSE"
|
|
DoorBootPosition string `json:"doorBootPosition"` // CLOSED
|
|
DoorEngineHoodPosition string `json:"doorEngineHoodPosition"` // CLOSED
|
|
DoorFrontLeftPosition string `json:"doorFrontLeftPosition"` // CLOSED
|
|
DoorFrontRightPosition string `json:"doorFrontRightPosition"` // CLOSED
|
|
DoorRearLeftPosition string `json:"doorRearLeftPosition"` // CLOSED
|
|
DoorRearRightPosition string `json:"doorRearRightPosition"` // CLOSED
|
|
DoorBootLockStatus string `json:"doorBootLockStatus"` // LOCKED
|
|
DoorFrontLeftLockStatus string `json:"doorFrontLeftLockStatus"` // LOCKED
|
|
DoorFrontRightLockStatus string `json:"doorFrontRightLockStatus"` // LOCKED
|
|
DoorRearLeftLockStatus string `json:"doorRearLeftLockStatus"` // LOCKED
|
|
DoorRearRightLockStatus string `json:"doorRearRightLockStatus"` // LOCKED
|
|
}
|
|
|
|
// VehicleCondition .
|
|
// "dataName":"remoteServiceStatus"
|
|
// "remoteServiceType":"condition"
|
|
type VehicleCondition struct {
|
|
VehicleStateType string `json:"vehicleStateType"` // "IGNITION_OFF",
|
|
AvgFuelConsumption float64 `json:"avgFuelConsumption,omitempty"` // null,
|
|
AvgFuelConsumptionUnit string `json:"avgFuelConsumptionUnit"` // "MPG",
|
|
DistanceToEmptyFuel int `json:"distanceToEmptyFuel,omitempty"` // null,
|
|
DistanceToEmptyFuelUnit string `json:"distanceToEmptyFuelUnit"` // "MILES",
|
|
RemainingFuelPercent int `json:"remainingFuelPercent"` // "66",
|
|
Odometer int `json:"odometer"` // 92,
|
|
OdometerUnit string `json:"odometerUnit"` // "MILES",
|
|
TirePressureFrontLeft float64 `json:"tirePressureFrontLeft,omitempty"` // null,
|
|
TirePressureFrontLeftUnit string `json:"tirePressureFrontLeftUnit"` // "PSI",
|
|
TirePressureFrontRight float64 `json:"tirePressureFrontRight,omitempty"` // null,
|
|
TirePressureFrontRightUnit string `json:"tirePressureFrontRightUnit"` // "PSI",
|
|
TirePressureRearLeft float64 `json:"tirePressureRearLeft,omitempty"` // null,
|
|
TirePressureRearLeftUnit string `json:"tirePressureRearLeftUnit"` // "PSI",
|
|
TirePressureRearRight float64 `json:"tirePressureRearRight,omitempty"` // null,
|
|
TirePressureRearRightUnit string `json:"tirePressureRearRightUnit"` // "PSI",
|
|
DoorBootPosition string `json:"doorBootPosition"` // "CLOSED",
|
|
DoorEngineHoodPosition string `json:"doorEngineHoodPosition"` // "CLOSED",
|
|
DoorFrontLeftPosition string `json:"doorFrontLeftPosition"` // "CLOSED",
|
|
DoorFrontRightPosition string `json:"doorFrontRightPosition"` // "CLOSED",
|
|
DoorRearLeftPosition string `json:"doorRearLeftPosition"` // "CLOSED",
|
|
DoorRearRightPosition string `json:"doorRearRightPosition"` // "CLOSED"
|
|
WindowFrontLeftStatus string `json:"windowFrontLeftStatus"` // "CLOSE",
|
|
WindowFrontRightStatus string `json:"windowFrontRightStatus"` // "CLOSE",
|
|
WindowRearLeftStatus string `json:"windowRearLeftStatus"` // "CLOSE",
|
|
WindowRearRightStatus string `json:"windowRearRightStatus"` // "CLOSE",
|
|
WindowSunroofStatus string `json:"windowSunroofStatus"` // "CLOSE",
|
|
EvDistanceToEmpty int `json:"evDistanceToEmpty,omitempty"` // null,
|
|
EvDistanceToEmptyUnit string `json:"evDistanceToEmptyUnit,omitempty"` // null,
|
|
EvChargerStateType string `json:"evChargerStateType,omitempty"` // null,
|
|
EvIsPluggedIn bool `json:"evIsPluggedIn,omitempty"` // null,
|
|
EvStateOfChargeMode string `json:"evStateOfChargeMode,omitempty"` // null,
|
|
EvTimeToFullyCharged string `json:"evTimeToFullyCharged,omitempty"` // null,
|
|
EvStateOfChargePercent int `json:"evStateOfChargePercent,omitempty"` // null,
|
|
LastUpdatedTime string `json:"lastUpdatedTime,string"` // "2023-04-10T17:50:54+0000",
|
|
}
|
|
|
|
// ClimateSettings .
|
|
// "dataName":null
|
|
// type ClimateSettings struct {
|
|
// RunTimeMinutes string `json:"runTimeMinutes"`
|
|
// StartConfiguration string `json:"startConfiguration"`
|
|
// AirConditionOn string `json:"airConditionOn"`
|
|
// OuterAirCirculation string `json:"outerAirCirculation"`
|
|
// ClimateZoneFrontAirMode string `json:"climateZoneFrontAirMode"`
|
|
// ClimateZoneFrontTemp string `json:"climateZoneFrontTemp"`
|
|
// ClimateZoneFrontAirVolume string `json:"climateZoneFrontAirVolume"`
|
|
// HeatedSeatFrontLeft string `json:"heatedSeatFrontLeft"`
|
|
// HeatedSeatFrontRight string `json:"heatedSeatFrontRight"`
|
|
// HeatedRearWindowActive string `json:"heatedRearWindowActive"`
|
|
// }
|
|
|
|
// ServiceRequest .
|
|
// "dataName": "remoteServiceStatus"
|
|
type ServiceRequest struct {
|
|
ServiceRequestID *string `json:"serviceRequestId,omitempty"` // 4S4BTGND8L3137058_1640294426029_19_@NGTP
|
|
Success bool `json:"success"` // false | true
|
|
Cancelled bool `json:"cancelled"` // false | true
|
|
RemoteServiceType string `json:"remoteServiceType"` // unlock | lock | locate | vehicleStatus | lightsOnly | engineStart | engineStop | phevChargeNow | condition
|
|
RemoteServiceState string `json:"remoteServiceState"` // started | finished | stopping
|
|
SubState *string `json:"subState,omitempty"` // null
|
|
ErrorCode *string `json:"errorCode,omitempty"` // null:null
|
|
Result json.RawMessage `json:"result,omitempty"` // null
|
|
UpdateTime *time.Time `json:"updateTime,omitempty"` // timestamp
|
|
Vin string `json:"vin"` // 4S4BTGND8L3137058
|
|
}
|
|
|
|
// ErrorResponse .
|
|
// "dataName":"errorResponse"
|
|
type ErrorResponse struct {
|
|
ErrorLabel string `json:"errorLabel"` // "404-soa-unableToParseResponseBody"
|
|
ErrorDescription *string `json:"errorDescription,omitempty"` // null
|
|
}
|
|
|
|
// climateSettings: [ climateSettings ]
|
|
// climateZoneFrontTempCelsius: [for _ in range(15, 30 + 1)]
|
|
// climateZoneFrontTemp: [for _ in range(60, 85 + 1)]
|
|
// climateZoneFrontAirVolume: [ AUTO | 2 | 4 | 7 ]
|
|
// heatedSeatFrontLeft: [ OFF | LOW_HEAT | MEDIUM_HEAT | HIGH_HEAT ]
|
|
// heatedSeatFrontRight: [ OFF | LOW_HEAT | MEDIUM_HEAT | HIGH_HEAT ]
|
|
// climateZoneFrontAirMode: [ WINDOW | FEET_WINDOW | FACE | FEET | FEET_FACE_BALANCED | AUTO ]
|
|
// outerAirCirculation: [ outsideAir, recirculation ]
|
|
// airConditionOn: [ false | true ]
|
|
// heatedRearWindowActive: [ false | true ]
|
|
// startConfiguration: [ START_CLIMATE_CONTROL_ONLY_ALLOW_KEY_IN_IGNITION | START_ENGINE_ALLOW_KEY_IN_IGNITION ]
|
|
// runTimeMinutes: [ 10 ]
|
|
|
|
type VehicleHealthItem struct {
|
|
B2cCode string `json:"b2cCode"`
|
|
FeatureCode string `json:"featureCode"`
|
|
IsTrouble bool `json:"isTrouble"`
|
|
OnDaiID int `json:"onDaiId"`
|
|
OnDates []string `json:"onDates"`
|
|
WarningCode int `json:"warningCode"`
|
|
}
|