Skip to content

Commit

Permalink
Merge pull request #26 from ulrichard/feature/mobile_disabled_tokens_…
Browse files Browse the repository at this point in the history
…optional_wakeup

making tokens optional, adding mobile_access_disabled
  • Loading branch information
gak authored Aug 14, 2024
2 parents 13f4be3 + 4590756 commit 83f7f33
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/cli/vehicle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ pub enum VehicleCommand {
/// Set scheduled departure.
SetScheduledDeparture(SetScheduledDeparture),

/// Wake up
WakeUp,

/// Honk!
HonkHorn,

Expand Down Expand Up @@ -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?;
}
Expand Down
10 changes: 9 additions & 1 deletion src/products.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -276,4 +276,12 @@ mod tests {
OwnerApi::parse_json::<Vec<Product>>(&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::<Vec<Product>>(&request_data, s.to_string(), PrintResponses::Pretty)
.unwrap();
}
}
4 changes: 3 additions & 1 deletion src/vehicles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ pub struct VehicleData {
pub color: Option<String>,
pub access_type: String,
pub granular_access: Option<GranularAccess>,
pub tokens: Vec<String>,
pub tokens: Option<Vec<String>>,
pub state: String,
pub in_service: bool,
pub id_s: String,
Expand All @@ -155,6 +155,8 @@ pub struct VehicleData {
pub cached_data: Option<String>,
pub command_signing: Option<String>,
pub release_notes_supported: Option<bool>,

pub mobile_access_disabled: Option<bool>,
}

#[derive(Debug, Clone, Deserialize)]
Expand Down
55 changes: 55 additions & 0 deletions testdata/products_ulr_2024_08_14.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}

0 comments on commit 83f7f33

Please sign in to comment.