diff --git a/src/cli/vehicle.rs b/src/cli/vehicle.rs index e592897..6d2a7b5 100644 --- a/src/cli/vehicle.rs +++ b/src/cli/vehicle.rs @@ -40,6 +40,9 @@ pub enum VehicleCommand { /// Set scheduled departure. SetScheduledDeparture(SetScheduledDeparture), + /// Wake up + WakeUp, + /// Honk! HonkHorn, @@ -110,6 +113,9 @@ impl VehicleArgs { VehicleCommand::SetScheduledDeparture(departure) => { api.set_scheduled_departure(&self.id, &departure).await?; } + VehicleCommand::WakeUp => { + api.wake_up(&self.id).await?; + } VehicleCommand::HonkHorn => { api.honk_horn(&self.id).await?; } diff --git a/src/products.rs b/src/products.rs index 53e4545..01a84fc 100644 --- a/src/products.rs +++ b/src/products.rs @@ -213,7 +213,7 @@ mod tests { assert_eq!(v.option_codes.unwrap(), "ASDF,SDFG,DFGH"); assert_eq!(v.color, None); assert_eq!(v.access_type, "OWNER"); - assert_eq!(v.tokens, vec!["asdf1234"]); + assert_eq!(v.tokens, Some(vec!["asdf1234".to_string()])); assert_eq!(v.state, "online"); assert!(!v.in_service); assert!(v.calendar_enabled); @@ -276,4 +276,12 @@ mod tests { OwnerApi::parse_json::>(&request_data, s.to_string(), PrintResponses::Pretty) .unwrap(); } + + #[test] + fn json_products_ulr_2024_08_14() { + let s = include_str!("../testdata/products_ulr_2024_08_14.json"); + let request_data = RequestData::Get { url: "" }; + OwnerApi::parse_json::>(&request_data, s.to_string(), PrintResponses::Pretty) + .unwrap(); + } } diff --git a/src/vehicles.rs b/src/vehicles.rs index bbd93f6..1593220 100644 --- a/src/vehicles.rs +++ b/src/vehicles.rs @@ -132,7 +132,7 @@ pub struct VehicleData { pub color: Option, pub access_type: String, pub granular_access: Option, - pub tokens: Vec, + pub tokens: Option>, pub state: String, pub in_service: bool, pub id_s: String, @@ -155,6 +155,8 @@ pub struct VehicleData { pub cached_data: Option, pub command_signing: Option, pub release_notes_supported: Option, + + pub mobile_access_disabled: Option, } #[derive(Debug, Clone, Deserialize)] diff --git a/testdata/products_ulr_2024_08_14.json b/testdata/products_ulr_2024_08_14.json new file mode 100644 index 0000000..455d986 --- /dev/null +++ b/testdata/products_ulr_2024_08_14.json @@ -0,0 +1,55 @@ +{ + "count": 2, + "response": [ + { + "access_type": "OWNER", + "api_version": 36, + "backseat_token": null, + "backseat_token_updated_at": null, + "ble_autopair_enrolled": false, + "cached_data": null, + "calendar_enabled": true, + "color": null, + "command_signing": "off", + "display_name": "", + "granular_access": { + "hide_private": false + }, + "id": 1492932717794313, + "id_s": "1492932717794313", + "in_service": false, + "mobile_access_disabled": true, + "option_codes": null, + "state": "asleep", + "tokens": null, + "user_id": 219663, + "vehicle_id": 415321864, + "vin": "5YJSA2DN0DFP21224" + }, + { + "access_type": "OWNER", + "api_version": 36, + "backseat_token": null, + "backseat_token_updated_at": null, + "ble_autopair_enrolled": false, + "cached_data": null, + "calendar_enabled": true, + "color": null, + "command_signing": "off", + "display_name": "", + "granular_access": { + "hide_private": false + }, + "id": 1492931365719407, + "id_s": "1492931365719407", + "in_service": false, + "mobile_access_disabled": true, + "option_codes": null, + "state": "asleep", + "tokens": null, + "user_id": 219663, + "vehicle_id": 1328174702, + "vin": "5YJSA7H4XFF088491" + } + ] +}