Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

making tokens optional, adding mobile_access_disabled #26

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
}
]
}
Loading