package mysubaru import ( "encoding/json" ) // 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,omitempty"` // string | Describes the structure which is included in Data field Data json.RawMessage `json:"data"` // Data struct } // parse . // func (r *Response) parse(b []byte, logger *slog.Logger) bool { // err := json.Unmarshal(b, &r) // if err != nil { // logger.Error("error while parsing json", "error", err.Error()) // return false // } // return true // } // Unmarshal . // func (r *Response) Unmarshal(b []byte) {} // 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 | Finance3 | RetailPHEV ]"" 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"` // "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,string"` // + "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 int `json:"tirePressureFrontLeft,string,omitempty"` // + "2275" TirePressureFrontRight int `json:"tirePressureFrontRight,string,omitempty"` // + "2344" TirePressureRearLeft int `json:"tirePressureRearLeft,string,omitempty"` // + "2413" TirePressureRearRight int `json:"tirePressureRearRight,string,omitempty"` // + "2344" TirePressureFrontLeftPsi int `json:"tirePressureFrontLeftPsi,string,omitempty"` // + "33" TirePressureFrontRightPsi int `json:"tirePressureFrontRightPsi,string,omitempty"` // + "34" TirePressureRearLeftPsi int `json:"tirePressureRearLeftPsi,string,omitempty"` // + "35" TirePressureRearRightPsi int `json:"tirePressureRearRightPsi,string,omitempty"` // + "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 | VENTED | OPEN WindowFrontRightStatus string `json:"windowFrontRightStatus"` // CLOSE | VENTED | OPEN WindowRearLeftStatus string `json:"windowRearLeftStatus"` // CLOSE | VENTED | OPEN WindowRearRightStatus string `json:"windowRearRightStatus"` // CLOSE | VENTED | OPEN WindowSunroofStatus string `json:"windowSunroofStatus"` // CLOSE | SLIDE_PARTLY_OPEN | OPEN | TILT DoorBootPosition string `json:"doorBootPosition"` // CLOSED | OPEN DoorEngineHoodPosition string `json:"doorEngineHoodPosition"` // CLOSED | OPEN DoorFrontLeftPosition string `json:"doorFrontLeftPosition"` // CLOSED | OPEN DoorFrontRightPosition string `json:"doorFrontRightPosition"` // CLOSED | OPEN DoorRearLeftPosition string `json:"doorRearLeftPosition"` // CLOSED | OPEN DoorRearRightPosition string `json:"doorRearRightPosition"` // CLOSED | OPEN DoorBootLockStatus string `json:"doorBootLockStatus"` // LOCKED | UNLOCKED DoorFrontLeftLockStatus string `json:"doorFrontLeftLockStatus"` // LOCKED | UNLOCKED DoorFrontRightLockStatus string `json:"doorFrontRightLockStatus"` // LOCKED | UNLOCKED DoorRearLeftLockStatus string `json:"doorRearLeftLockStatus"` // LOCKED | UNLOCKED DoorRearRightLockStatus string `json:"doorRearRightLockStatus"` // LOCKED | UNLOCKED } // VehicleCondition . // "dataName":"remoteServiceStatus" // "remoteServiceType":"condition" type VehicleCondition struct { VehicleStateType string `json:"vehicleStateType"` // "IGNITION_OFF | IGNITION_ON" AvgFuelConsumption float64 `json:"avgFuelConsumption,omitempty"` // null | 18.4 AvgFuelConsumptionUnit string `json:"avgFuelConsumptionUnit"` // "MPG" DistanceToEmptyFuel int `json:"distanceToEmptyFuel,omitempty"` // null | 160 DistanceToEmptyFuelUnit string `json:"distanceToEmptyFuelUnit"` // "MILES" RemainingFuelPercent int `json:"remainingFuelPercent,string"` // "66" Odometer int `json:"odometer"` // 92 OdometerUnit string `json:"odometerUnit"` // "MILES" TirePressureFrontLeft float64 `json:"tirePressureFrontLeft,omitempty"` // null | 36 TirePressureFrontLeftUnit string `json:"tirePressureFrontLeftUnit"` // "PSI" TirePressureFrontRight float64 `json:"tirePressureFrontRight,omitempty"` // null | 36 TirePressureFrontRightUnit string `json:"tirePressureFrontRightUnit"` // "PSI", TirePressureRearLeft float64 `json:"tirePressureRearLeft,omitempty"` // null | 36 TirePressureRearLeftUnit string `json:"tirePressureRearLeftUnit"` // "PSI" TirePressureRearRight float64 `json:"tirePressureRearRight,omitempty"` // null | 36 TirePressureRearRightUnit string `json:"tirePressureRearRightUnit"` // "PSI" DoorBootPosition string `json:"doorBootPosition"` // "CLOSED | OPEN" DoorEngineHoodPosition string `json:"doorEngineHoodPosition"` // "CLOSED | OPEN" DoorFrontLeftPosition string `json:"doorFrontLeftPosition"` // "CLOSED | OPEN" DoorFrontRightPosition string `json:"doorFrontRightPosition"` // "CLOSED | OPEN" DoorRearLeftPosition string `json:"doorRearLeftPosition"` // "CLOSED | OPEN" DoorRearRightPosition string `json:"doorRearRightPosition"` // "CLOSED | OPEN" WindowFrontLeftStatus string `json:"windowFrontLeftStatus"` // "CLOSE | VENTED | OPEN" WindowFrontRightStatus string `json:"windowFrontRightStatus"` // "CLOSE | VENTED | OPEN" WindowRearLeftStatus string `json:"windowRearLeftStatus"` // "CLOSE | VENTED | OPEN" WindowRearRightStatus string `json:"windowRearRightStatus"` // "CLOSE | VENTED | OPEN" WindowSunroofStatus string `json:"windowSunroofStatus"` // "CLOSE | VENTED | OPEN" 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"` // "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 // Could be in the false state while the executed request in the progress Cancelled bool `json:"cancelled"` // false | true RemoteServiceType string `json:"remoteServiceType"` // vehicleStatus | condition | locate | unlock | lock | lightsOnly | engineStart | engineStop | phevChargeNow 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"` // struct UpdateTime int64 `json:"updateTime,omitempty"` // timestamp Vin string `json:"vin"` // 4S4BTGND8L3137058 } // ErrorResponse . // "dataName":"errorResponse" // {"success":false,"errorCode":"404-soa-unableToParseResponseBody","dataName":"errorResponse","data":{"errorLabel":"404-soa-unableToParseResponseBody","errorDescription":null}} // {"success":false,"errorCode":"vehicleNotInAccount","dataName":null,"data":null} // {"success":false,"errorCode":"InvalidCredentials","dataName":"remoteServiceStatus","data":{"serviceRequestId":null,"success":false,"cancelled":false,"remoteServiceType":null,"remoteServiceState":null,"subState":null,"errorCode":null,"result":null,"updateTime":null,"vin":null,"errorDescription":"The credentials supplied are invalid, tries left 2"}} 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 VehicleHealth struct { VehicleHealthItems []VehicleHealthItem `json:"vehicleHealthItems"` LastUpdatedDate int64 `json:"lastUpdatedDate"` } type VehicleHealthItem struct { B2cCode string `json:"b2cCode"` FeatureCode string `json:"featureCode"` IsTrouble bool `json:"isTrouble"` OnDaiID int `json:"onDaiId"` // Has a number, probably id, but I couldn't find it purpose OnDates []int64 `json:"onDates,omitempty"` // List of the timestamps WarningCode int `json:"warningCode"` }