wip(tesla_api_coverage): initial API.md generated!
This commit is contained in:
parent
4f24db9bdb
commit
10fe1969c2
230
API.md
230
API.md
|
@ -11,10 +11,230 @@ List of all known Tesla APIs, and if this crate supports it, and which of the Te
|
||||||
|
|
||||||
Currently only the Owner API is partially supported by this crate.
|
Currently only the Owner API is partially supported by this crate.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- tesla_api_coverage start table -->
|
<!-- tesla_api_coverage start table -->
|
||||||
|
| API | Teslatte | Timdorr API | Fleet API | Command Mode |
|
||||||
| API | Owner API | Fleet API | Command Mode |
|
| --- | --- | --- | --- | --- |
|
||||||
| --- | --- | --- | --- |
|
| actuate-trunk | | 🟢 | 🟢 | |
|
||||||
| honk_horn | ✅ | | |
|
| add-key | | 🟢 | | 🟢 |
|
||||||
|
| add-key-request | | | | 🟢 |
|
||||||
|
| add-managed-charging-site | | 🟢 | | |
|
||||||
|
| adjust-volume | | 🟢 | 🟢 | |
|
||||||
|
| app-feedback-entitlements | | 🟢 | | |
|
||||||
|
| app-feedback-logs | | 🟢 | | |
|
||||||
|
| app-feedback-metadata | | 🟢 | | |
|
||||||
|
| auto-conditioning-start | ✅ | 🟢 | 🟢 | |
|
||||||
|
| auto-conditioning-stop | ✅ | 🟢 | 🟢 | |
|
||||||
|
| auto-seat-and-climate | | | | 🟢 |
|
||||||
|
| autosecure-modelx | | | | 🟢 |
|
||||||
|
| backup-key | | | 🟢 | |
|
||||||
|
| backup-reserve | | 🟢 | | |
|
||||||
|
| calendar-history-data | | 🟢 | | |
|
||||||
|
| calendar-sync | | 🟢 | | |
|
||||||
|
| cancel-software-update | | 🟢 | 🟢 | 🟢 |
|
||||||
|
| charge-max-range | ✅ | | 🟢 | |
|
||||||
|
| charge-port-close | | | | 🟢 |
|
||||||
|
| charge-port-door-close | ✅ | 🟢 | 🟢 | |
|
||||||
|
| charge-port-door-open | ✅ | 🟢 | 🟢 | |
|
||||||
|
| charge-port-open | | | | 🟢 |
|
||||||
|
| charge-standard | ✅ | | 🟢 | |
|
||||||
|
| charge-start | ✅ | 🟢 | 🟢 | |
|
||||||
|
| charge-stop | ✅ | 🟢 | 🟢 | |
|
||||||
|
| charging-sessions-only-for-business-fleet-owners | | | 🟢 | |
|
||||||
|
| charging-set-limit | | | | 🟢 |
|
||||||
|
| charging-start | | | | 🟢 |
|
||||||
|
| charging-stop | | | | 🟢 |
|
||||||
|
| check-energy-product-registration | | 🟢 | | |
|
||||||
|
| climate-off | | | | 🟢 |
|
||||||
|
| climate-on | | | | 🟢 |
|
||||||
|
| climate-set-temp | | | | 🟢 |
|
||||||
|
| create-energy-site-share-invite | | 🟢 | | |
|
||||||
|
| dashcam-save-clip | | 🟢 | | |
|
||||||
|
| deactivate-device-token | | 🟢 | | |
|
||||||
|
| door-lock | ✅ | 🟢 | 🟢 | |
|
||||||
|
| door-unlock | ✅ | 🟢 | 🟢 | |
|
||||||
|
| drive | | | | 🟢 |
|
||||||
|
| driving-plan | | 🟢 | | |
|
||||||
|
| energy-event | | 🟢 | | |
|
||||||
|
| energy-register-product | | 🟢 | | |
|
||||||
|
| energy-site-backup-time-remaining | | 🟢 | | |
|
||||||
|
| energy-site-command | | 🟢 | | |
|
||||||
|
| energy-site-enroll-program | | 🟢 | | |
|
||||||
|
| energy-site-import-export-config | | 🟢 | | |
|
||||||
|
| energy-site-onboarding-tips | | 🟢 | | |
|
||||||
|
| energy-site-opt-event | | 🟢 | | |
|
||||||
|
| energy-site-preference | | 🟢 | | |
|
||||||
|
| energy-site-program-details | | 🟢 | | |
|
||||||
|
| energy-site-programs | | 🟢 | | |
|
||||||
|
| energy-site-telemetry-history | | 🟢 | | |
|
||||||
|
| energy-site-user-settings | | 🟢 | | |
|
||||||
|
| energy-sites-calendar-history | ✅ | | | |
|
||||||
|
| energy-sites-live-status | ✅ | | | |
|
||||||
|
| energy-sites-site-info | ✅ | | | |
|
||||||
|
| energy-sites-site-status | ✅ | | | |
|
||||||
|
| energy-wall-connector-firmware-download-url | | 🟢 | | |
|
||||||
|
| erase-user-data | | | 🟢 | |
|
||||||
|
| feature-config | | 🟢 | 🟢 | |
|
||||||
|
| fetch-energy-site-share-invites | | 🟢 | | |
|
||||||
|
| fetch-energy-site-shared-users | | 🟢 | | |
|
||||||
|
| fetch-vehicle-shared-drivers | | 🟢 | | |
|
||||||
|
| flash-lights | ✅ | 🟢 | 🟢 | 🟢 |
|
||||||
|
| frunk-open | | | | 🟢 |
|
||||||
|
| get | | | | 🟢 |
|
||||||
|
| get-charge-on-solar-feature | | 🟢 | | |
|
||||||
|
| get-managed-charging-sites | | 🟢 | | |
|
||||||
|
| get-ownership-xp-config | | 🟢 | | |
|
||||||
|
| get-upcoming-service-visit-data | | 🟢 | | |
|
||||||
|
| guest-mode | | | 🟢 | |
|
||||||
|
| hermes-authorization | | 🟢 | | |
|
||||||
|
| hermes-vehicle-authorization | | 🟢 | | |
|
||||||
|
| honk | | | | 🟢 |
|
||||||
|
| honk-horn | ✅ | 🟢 | 🟢 | |
|
||||||
|
| list-keys | | | | 🟢 |
|
||||||
|
| lock | | | | 🟢 |
|
||||||
|
| mattermost | | 🟢 | | |
|
||||||
|
| me | | 🟢 | 🟢 | |
|
||||||
|
| media-next-fav | | 🟢 | 🟢 | |
|
||||||
|
| media-next-track | | 🟢 | 🟢 | |
|
||||||
|
| media-prev-fav | | 🟢 | 🟢 | |
|
||||||
|
| media-prev-track | | 🟢 | 🟢 | |
|
||||||
|
| media-set-volume | | | | 🟢 |
|
||||||
|
| media-toggle-playback | | 🟢 | 🟢 | |
|
||||||
|
| media-volume-down | | 🟢 | 🟢 | |
|
||||||
|
| media-volume-up | | 🟢 | | |
|
||||||
|
| message-center-message | | 🟢 | | |
|
||||||
|
| message-center-message-action-update | | 🟢 | | |
|
||||||
|
| message-center-message-count | | 🟢 | | |
|
||||||
|
| message-center-message-list | | 🟢 | | |
|
||||||
|
| mobile-enabled | | | 🟢 | |
|
||||||
|
| navigation-gps-request | | 🟢 | 🟢 | |
|
||||||
|
| navigation-request | | | 🟢 | |
|
||||||
|
| navigation-route | | 🟢 | | |
|
||||||
|
| navigation-sc-request | | 🟢 | 🟢 | |
|
||||||
|
| nearby-charging-sites | | 🟢 | 🟢 | |
|
||||||
|
| off-grid-vehicle-charging-reserve | | 🟢 | | |
|
||||||
|
| onboarding-experience | | 🟢 | | |
|
||||||
|
| onboarding-experience-page | | 🟢 | | |
|
||||||
|
| operation-mode | | 🟢 | | |
|
||||||
|
| orders | | 🟢 | 🟢 | |
|
||||||
|
| ping | | | | 🟢 |
|
||||||
|
| place-suggestions | | 🟢 | | |
|
||||||
|
| plan-trip | | 🟢 | | |
|
||||||
|
| post | | | | 🟢 |
|
||||||
|
| powerwall-energy-history | ✅ | | | |
|
||||||
|
| powerwall-order-page | | 🟢 | | |
|
||||||
|
| powerwall-order-session-data | | 🟢 | | |
|
||||||
|
| powerwall-status | ✅ | | | |
|
||||||
|
| product-info | | | | 🟢 |
|
||||||
|
| products | ✅ | 🟢 | | |
|
||||||
|
| public-key | | | 🟢 | |
|
||||||
|
| rate-tariffs | | 🟢 | | |
|
||||||
|
| redeem-energy-site-share-invite | | 🟢 | | |
|
||||||
|
| redeem-vehicle-share-invite | | 🟢 | | |
|
||||||
|
| referral-data | | 🟢 | | |
|
||||||
|
| referral-page | | 🟢 | | |
|
||||||
|
| region | | | 🟢 | |
|
||||||
|
| register | | | 🟢 | |
|
||||||
|
| release-notes | | 🟢 | | |
|
||||||
|
| remote-auto-seat-climate-request | | 🟢 | 🟢 | |
|
||||||
|
| remote-auto-steering-wheel-heat-climate-request | | 🟢 | 🟢 | |
|
||||||
|
| remote-boombox | | 🟢 | 🟢 | |
|
||||||
|
| remote-seat-cooler-request | | 🟢 | 🟢 | |
|
||||||
|
| remote-seat-heater-request | | 🟢 | 🟢 | |
|
||||||
|
| remote-start-drive | ✅ | 🟢 | 🟢 | |
|
||||||
|
| remote-steering-wheel-heat-level-request | | 🟢 | 🟢 | |
|
||||||
|
| remote-steering-wheel-heater-request | | 🟢 | 🟢 | |
|
||||||
|
| remove-energy-site-share-user | | 🟢 | | |
|
||||||
|
| remove-key | | | | 🟢 |
|
||||||
|
| remove-managed-charging-site | | 🟢 | | |
|
||||||
|
| remove-vehicle-share-driver | | 🟢 | | |
|
||||||
|
| rename-key | | | | 🟢 |
|
||||||
|
| reset-pin-to-drive-pin | | | 🟢 | |
|
||||||
|
| reset-valet-pin | | 🟢 | 🟢 | |
|
||||||
|
| retrieve-notification-preferences | | 🟢 | | |
|
||||||
|
| reverse-geocoding | | 🟢 | | |
|
||||||
|
| revoke-energy-site-share-invite | | 🟢 | | |
|
||||||
|
| revoke-vehicle-share-invite | | 🟢 | | |
|
||||||
|
| roadside-assistance-data | | 🟢 | | |
|
||||||
|
| roadside-assistance-page | | 🟢 | | |
|
||||||
|
| schedule-software-update | | 🟢 | 🟢 | |
|
||||||
|
| seat-heater | | | | 🟢 |
|
||||||
|
| send-device-key | | 🟢 | | |
|
||||||
|
| send-notification-confirmation | | 🟢 | | |
|
||||||
|
| send-notification-preferences | | 🟢 | | |
|
||||||
|
| send-to-vehicle | | 🟢 | | |
|
||||||
|
| sentry-mode | | | | 🟢 |
|
||||||
|
| service-data | | 🟢 | 🟢 | |
|
||||||
|
| session-info | | | | 🟢 |
|
||||||
|
| set-bioweapon-mode | | 🟢 | 🟢 | |
|
||||||
|
| set-cabin-overheat-protection | | 🟢 | 🟢 | |
|
||||||
|
| set-charge-limit | ✅ | 🟢 | 🟢 | |
|
||||||
|
| set-charging-amps | ✅ | 🟢 | 🟢 | |
|
||||||
|
| set-climate-keeper-mode | | 🟢 | 🟢 | |
|
||||||
|
| set-cop-temp | | 🟢 | 🟢 | |
|
||||||
|
| set-managed-charge-current-request | | | 🟢 | |
|
||||||
|
| set-managed-charger-location | | | 🟢 | |
|
||||||
|
| set-managed-scheduled-charging-time | | | 🟢 | |
|
||||||
|
| set-pin-to-drive | | | 🟢 | |
|
||||||
|
| set-preconditioning-max | | 🟢 | 🟢 | |
|
||||||
|
| set-scheduled-charging | ✅ | 🟢 | 🟢 | |
|
||||||
|
| set-scheduled-departure | ✅ | 🟢 | 🟢 | |
|
||||||
|
| set-sentry-mode | | 🟢 | 🟢 | |
|
||||||
|
| set-temps | ✅ | 🟢 | 🟢 | |
|
||||||
|
| set-valet-mode | | 🟢 | 🟢 | |
|
||||||
|
| set-vehicle-name | | | 🟢 | |
|
||||||
|
| share-invites | | 🟢 | 🟢 | |
|
||||||
|
| share-invites-create | | 🟢 | 🟢 | |
|
||||||
|
| share-invites-revoke | | | 🟢 | |
|
||||||
|
| site-address | | 🟢 | | |
|
||||||
|
| site-config | | 🟢 | | |
|
||||||
|
| site-data | | 🟢 | | |
|
||||||
|
| site-name | | 🟢 | | |
|
||||||
|
| site-tariff | | 🟢 | | |
|
||||||
|
| software-update-start | | | | 🟢 |
|
||||||
|
| solar-savings-forecast | | 🟢 | | |
|
||||||
|
| speed-limit-activate | | 🟢 | 🟢 | |
|
||||||
|
| speed-limit-clear-pin | | 🟢 | 🟢 | |
|
||||||
|
| speed-limit-deactivate | | 🟢 | 🟢 | |
|
||||||
|
| speed-limit-set-limit | | 🟢 | 🟢 | |
|
||||||
|
| splunk-telemetry | | 🟢 | | |
|
||||||
|
| static-charger-file | | 🟢 | | |
|
||||||
|
| static-supercharger-file | | 🟢 | | |
|
||||||
|
| status | | 🟢 | | |
|
||||||
|
| steering-wheel-heater | | | | 🟢 |
|
||||||
|
| storm-mode-settings | | 🟢 | | |
|
||||||
|
| sun-roof-control | | 🟢 | 🟢 | |
|
||||||
|
| take-drivenote | | 🟢 | 🟢 | |
|
||||||
|
| time-of-use-settings | | 🟢 | | |
|
||||||
|
| trigger-homelink | | 🟢 | 🟢 | |
|
||||||
|
| trigger-vehicle-screenshot | | 🟢 | | |
|
||||||
|
| trunk-close | | | | 🟢 |
|
||||||
|
| trunk-move | | | | 🟢 |
|
||||||
|
| trunk-open | | | | 🟢 |
|
||||||
|
| unlock | | | | 🟢 |
|
||||||
|
| update-calendar-entries | | | 🟢 | |
|
||||||
|
| update-charge-on-solar-feature | | 🟢 | | |
|
||||||
|
| user-account-upload-profile-picture | | 🟢 | | |
|
||||||
|
| user-reset-vault | | 🟢 | | |
|
||||||
|
| vehicle | | | 🟢 | |
|
||||||
|
| vehicle-charge-history | | 🟢 | | |
|
||||||
|
| vehicle-data | ✅ | 🟢 | 🟢 | |
|
||||||
|
| vehicle-download-vault | | 🟢 | | |
|
||||||
|
| vehicle-energy-sites | | 🟢 | | |
|
||||||
|
| vehicle-subscriptions | | | 🟢 | |
|
||||||
|
| vehicle-subscriptions-set | | | 🟢 | |
|
||||||
|
| vehicle-summary | | 🟢 | | |
|
||||||
|
| vehicle-upload-vault | | 🟢 | | |
|
||||||
|
| vehicles | ✅ | 🟢 | 🟢 | |
|
||||||
|
| wake | | | | 🟢 |
|
||||||
|
| wake-up | ✅ | 🟢 | 🟢 | |
|
||||||
|
| warranty-details | | | 🟢 | |
|
||||||
|
| window-control | | 🟢 | 🟢 | |
|
||||||
<!-- tesla_api_coverage end table -->
|
<!-- tesla_api_coverage end table -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,77 @@ use crate::fleet::FleetEndpoint;
|
||||||
use crate::teslatte::TeslatteEndpoint;
|
use crate::teslatte::TeslatteEndpoint;
|
||||||
use crate::timdorr::TimdorrEndpoint;
|
use crate::timdorr::TimdorrEndpoint;
|
||||||
use crate::vehicle_command::VehicleCommandEndpoint;
|
use crate::vehicle_command::VehicleCommandEndpoint;
|
||||||
|
use crate::Endpoint;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
use std::fs::File;
|
||||||
|
use std::io::{Read, Write};
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
pub fn generate_api_md(
|
const START: &str = "<!-- tesla_api_coverage start table -->";
|
||||||
teslatte: Vec<TeslatteEndpoint>,
|
const END: &str = "<!-- tesla_api_coverage end table -->";
|
||||||
fleet: HashMap<String, FleetEndpoint>,
|
|
||||||
vehicle_command: HashMap<String, VehicleCommandEndpoint>,
|
pub fn generate(merged: &HashMap<String, Endpoint>) -> anyhow::Result<()> {
|
||||||
timdorr: HashMap<String, TimdorrEndpoint>,
|
let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
||||||
) -> anyhow::Result<()> {
|
path.push("..");
|
||||||
todo!()
|
path.push("API.md");
|
||||||
|
|
||||||
|
let mut file = File::open(&path)?;
|
||||||
|
let mut contents = String::new();
|
||||||
|
file.read_to_string(&mut contents)?;
|
||||||
|
drop(file);
|
||||||
|
|
||||||
|
// Split the file into before and after the table.
|
||||||
|
let mut parts = contents.split(START);
|
||||||
|
let before = parts.next().unwrap();
|
||||||
|
let mut parts = parts.next().unwrap().split(END);
|
||||||
|
let table = parts.next().unwrap();
|
||||||
|
let after = parts.next().unwrap();
|
||||||
|
|
||||||
|
let mut table = vec![];
|
||||||
|
table.push("| API | Teslatte | Timdorr API | Fleet API | Command Mode |".to_string());
|
||||||
|
table.push("| --- | --- | --- | --- | --- |".to_string());
|
||||||
|
|
||||||
|
// Sort by URL for into a Vec for now. Keep the key.
|
||||||
|
let mut endpoints = merged.iter().collect::<Vec<(&String, &Endpoint)>>();
|
||||||
|
endpoints.sort_by(|a, b| a.1.name.cmp(&b.1.name));
|
||||||
|
|
||||||
|
for (name, endpoint) in endpoints {
|
||||||
|
let mut row = vec![];
|
||||||
|
row.push(format!("{}", name));
|
||||||
|
|
||||||
|
if endpoint.teslatte.is_some() {
|
||||||
|
row.push("✅".to_string());
|
||||||
|
} else {
|
||||||
|
row.push("".to_string());
|
||||||
|
}
|
||||||
|
|
||||||
|
if endpoint.timdorr.is_some() {
|
||||||
|
row.push("🟢".to_string());
|
||||||
|
} else {
|
||||||
|
row.push("".to_string());
|
||||||
|
}
|
||||||
|
|
||||||
|
if endpoint.fleet.is_some() {
|
||||||
|
row.push("🟢".to_string());
|
||||||
|
} else {
|
||||||
|
row.push("".to_string());
|
||||||
|
}
|
||||||
|
|
||||||
|
if endpoint.vehicle_command.is_some() {
|
||||||
|
row.push("🟢".to_string());
|
||||||
|
} else {
|
||||||
|
row.push("".to_string());
|
||||||
|
}
|
||||||
|
|
||||||
|
table.push(format!("| {} |", row.join(" | ")));
|
||||||
|
}
|
||||||
|
|
||||||
|
let table = table.join("\n");
|
||||||
|
|
||||||
|
// Now join them together and write the whole file back.
|
||||||
|
let contents = format!("{before}\n{START}\n{table}\n{END}\n{after}");
|
||||||
|
let mut file = File::create(&path)?;
|
||||||
|
file.write_all(contents.as_bytes())?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ async fn main() {
|
||||||
let teslatte_endpoints = teslatte::parse(&teslatte_project_path).unwrap();
|
let teslatte_endpoints = teslatte::parse(&teslatte_project_path).unwrap();
|
||||||
|
|
||||||
let mut fleet_endpoints = fleet::parse(&fleet_html);
|
let mut fleet_endpoints = fleet::parse(&fleet_html);
|
||||||
let command_endpoints = vehicle_command::parse(&command_golang);
|
let mut command_endpoints = vehicle_command::parse(&command_golang);
|
||||||
let mut timdorr_endpoints = timdorr::parse(&timdorr);
|
let mut timdorr_endpoints = timdorr::parse(&timdorr);
|
||||||
|
|
||||||
info!("TOTALS: (before filtering and merging)");
|
info!("TOTALS: (before filtering and merging)");
|
||||||
|
@ -73,6 +73,8 @@ async fn main() {
|
||||||
rename_keys_based_on_uri(&teslatte_endpoints, &mut fleet_endpoints);
|
rename_keys_based_on_uri(&teslatte_endpoints, &mut fleet_endpoints);
|
||||||
info!("-- rename timdorr based on fleet");
|
info!("-- rename timdorr based on fleet");
|
||||||
rename_keys_based_on_uri(&fleet_endpoints, &mut timdorr_endpoints);
|
rename_keys_based_on_uri(&fleet_endpoints, &mut timdorr_endpoints);
|
||||||
|
info!("-- rename vehicle command");
|
||||||
|
rename_vehicle_command(&mut command_endpoints);
|
||||||
|
|
||||||
let mut merged = merge(
|
let mut merged = merge(
|
||||||
teslatte_endpoints,
|
teslatte_endpoints,
|
||||||
|
@ -87,7 +89,16 @@ async fn main() {
|
||||||
|
|
||||||
dbg!(&merged);
|
dbg!(&merged);
|
||||||
|
|
||||||
todo!();
|
api_md::generate(&merged).unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn rename_vehicle_command(endpoints: &mut HashMap<String, VehicleCommandEndpoint>) {
|
||||||
|
let mut renames = vec![("software-update-cancel", "cancel-software-update")];
|
||||||
|
|
||||||
|
for (old_key, new_key) in renames {
|
||||||
|
let endpoint = endpoints.remove(old_key).unwrap();
|
||||||
|
endpoints.insert(new_key.to_string(), endpoint);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn rename_keys_based_on_uri(
|
fn rename_keys_based_on_uri(
|
||||||
|
@ -155,9 +166,13 @@ pub fn remove_unwanted_endpoints(mut endpoints: &mut HashMap<String, Endpoint>)
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
let uri = &timdorr.uri;
|
let uri = &timdorr.uri;
|
||||||
!uri.starts_with("/api/1/directives")
|
true // rustfmt hax :)
|
||||||
|
&& !uri.starts_with("/commerce-api")
|
||||||
|
&& !uri.starts_with("/api/1/directives")
|
||||||
&& !uri.starts_with("/api/1/subscriptions")
|
&& !uri.starts_with("/api/1/subscriptions")
|
||||||
&& !uri.starts_with("/api/1/dx/")
|
&& !uri.starts_with("/api/1/dx/")
|
||||||
|
&& !uri.starts_with("/mobile-app")
|
||||||
|
&& !uri.starts_with("/bff/mobile-app")
|
||||||
&& !uri.starts_with("/bff/v2/mobile-app")
|
&& !uri.starts_with("/bff/v2/mobile-app")
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue