tesla-fleet-api 0.0.6 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,88 +3,172 @@ export default class VehicleSpecific {
3
3
  constructor(parent, vin) {
4
4
  this.parent = parent;
5
5
  this.vin = vin;
6
- }
7
- model() {
8
- return this.parent.model(this.vin);
9
- }
10
- pre2021() {
11
- return this.parent.pre2021(this.vin);
12
- }
6
+ this.model = this.parent.model(this.vin);
7
+ this.pre2021 = this.parent.pre2021(this.vin);
8
+ }
9
+ // Vehicle Commands
10
+ /**
11
+ * Controls the front (which_trunk: "front") or rear (which_trunk: "rear") trunk.
12
+ * @param which_trunk "front" or "rear"
13
+ */
13
14
  async actuate_truck(which_trunk) {
14
15
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/actuate_trunk`, null, { which_trunk });
15
16
  }
17
+ /**
18
+ * Adjusts vehicle media playback volume.
19
+ * @param volume A floating point number from 0.0 to 11.0.
20
+ */
16
21
  async adjust_volume(volume) {
17
22
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/adjust_volume`, null, { volume });
18
23
  }
24
+ /**
25
+ * Starts climate preconditioning.
26
+ */
19
27
  async auto_conditioning_start() {
20
28
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/auto_conditioning_start`);
21
29
  }
30
+ /**
31
+ * Stops climate preconditioning.
32
+ */
22
33
  async auto_conditioning_stop() {
23
34
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/auto_conditioning_stop`);
24
35
  }
36
+ /**
37
+ * Cancels the countdown to install the vehicle software update.
38
+ */
25
39
  async cancel_software_update() {
26
40
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/cancel_software_update`);
27
41
  }
42
+ /**
43
+ * Charges in max range mode -- we recommend limiting the use of this mode to long trips.
44
+ */
28
45
  async charge_max_range() {
29
46
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/charge_max_range`);
30
47
  }
48
+ /**
49
+ * Closes the charge port door.
50
+ */
31
51
  async charge_port_door_close() {
32
52
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/charge_port_door_close`);
33
53
  }
54
+ /**
55
+ * Opens the charge port door.
56
+ */
34
57
  async charge_port_door_open() {
35
58
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/charge_port_door_open`);
36
59
  }
60
+ /**
61
+ * Charges in Standard mode.
62
+ */
37
63
  async charge_standard() {
38
64
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/charge_standard`);
39
65
  }
66
+ /**
67
+ * Starts charging the vehicle.
68
+ */
40
69
  async charge_start() {
41
70
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/charge_start`);
42
71
  }
72
+ /**
73
+ * Stops charging the vehicle.
74
+ */
43
75
  async charge_stop() {
44
76
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/charge_stop`);
45
77
  }
78
+ /**
79
+ * Deactivates PIN to Drive and resets the associated PIN for vehicles running firmware versions 2023.44+. This command is only accessible to fleet managers or owners.
80
+ */
46
81
  async clear_pin_to_drive_admin() {
47
82
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/clear_pin_to_drive_admin`);
48
83
  }
84
+ /**
85
+ * Locks the vehicle.
86
+ */
49
87
  async door_lock() {
50
88
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/door_lock`);
51
89
  }
90
+ /**
91
+ * Unlocks the vehicle.
92
+ */
52
93
  async door_unlock() {
53
94
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/door_unlock`);
54
95
  }
96
+ /**
97
+ * Erases user's data from the user interface. Requires the vehicle to be in park.
98
+ */
55
99
  async erase_user_data() {
56
100
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/erase_user_data`);
57
101
  }
102
+ /**
103
+ * Briefly flashes the vehicle headlights. Requires the vehicle to be in park.
104
+ */
58
105
  async flash_lights() {
59
106
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/flash_lights`);
60
107
  }
108
+ /**
109
+ * Restricts certain vehicle UI functionality from guest users
110
+ * @param enable `true` or `false`
111
+ */
61
112
  async guest_mode(enable) {
62
113
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/guest_mode`, null, { enable });
63
114
  }
115
+ /**
116
+ * Honks the vehicle horn. Requires the vehicle to be in park.
117
+ */
64
118
  async honk_horn() {
65
119
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/honk_horn`);
66
120
  }
121
+ /**
122
+ * Advances media player to next favorite track.
123
+ */
67
124
  async media_next_fav() {
68
125
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/media_next_fav`);
69
126
  }
127
+ /**
128
+ * Advances media player to next track.
129
+ */
70
130
  async media_next_track() {
71
131
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/media_next_track`);
72
132
  }
133
+ /**
134
+ * Advances media player to previous favorite track.
135
+ */
73
136
  async media_prev_fav() {
74
137
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/media_prev_fav`);
75
138
  }
139
+ /**
140
+ * Advances media player to previous track.
141
+ */
76
142
  async media_prev_track() {
77
143
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/media_prev_track`);
78
144
  }
145
+ /**
146
+ * Toggles current play/pause state.
147
+ */
79
148
  async media_toggle_playback() {
80
149
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/media_toggle_playback`);
81
150
  }
151
+ /**
152
+ * Turns the volume down by one.
153
+ */
82
154
  async media_volume_down() {
83
155
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/media_volume_down`);
84
156
  }
157
+ /**
158
+ * Start navigation to given coordinates. Order can be used to specify order of multiple stops.
159
+ * @param lat Latitude
160
+ * @param lon Longitude
161
+ * @param order Order of multiple stops
162
+ */
85
163
  async navigation_gps_request(lat, lon, order) {
86
164
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/navigation_gps_request`, null, { lat, lon, order });
87
165
  }
166
+ /**
167
+ * Sends a location to the in-vehicle navigation system.
168
+ * @param type "share_ext_content_raw"
169
+ * @param locale ISO locale such as "en-US"
170
+ * @param timestamp_ms
171
+ */
88
172
  async navigation_request(value, locale, type = "share_ext_content_raw") {
89
173
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/navigation_request`, null, {
90
174
  type,
@@ -95,9 +179,20 @@ export default class VehicleSpecific {
95
179
  },
96
180
  });
97
181
  }
182
+ /**
183
+ * Start navigation to a supercharger.
184
+ * @param id Supercharger ID
185
+ * @param order Order of multiple stops
186
+ * @returns
187
+ */
98
188
  async navigation_sc_request(id, order) {
99
189
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/navigation_sc_request`, null, { id, order });
100
190
  }
191
+ /**
192
+ * Sets automatic seat heating and cooling.
193
+ * @param auto_seat_position Seat position
194
+ * @param auto_climate_on `true` or `false`
195
+ */
101
196
  async remote_auto_seat_climate_request(auto_seat_position, auto_climate_on) {
102
197
  if (typeof auto_seat_position === "string") {
103
198
  auto_seat_position = Seats[auto_seat_position];
@@ -107,12 +202,25 @@ export default class VehicleSpecific {
107
202
  auto_climate_on,
108
203
  });
109
204
  }
205
+ /**
206
+ * Sets automatic steering wheel heating on/off.
207
+ * @param on `true` or `false`
208
+ */
110
209
  async remote_auto_steering_wheel_heat_climate_request(on) {
111
210
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/remote_auto_steering_wheel_heat_climate_request`, null, { on });
112
211
  }
212
+ /**
213
+ * Plays a sound through the vehicle external speaker.
214
+ * @param sound Fart is `0`, Locate ping is `2000`
215
+ */
113
216
  async remote_boombox(sound = 0) {
114
217
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/remote_boombox`, null, { sound });
115
218
  }
219
+ /**
220
+ * Sets seat cooling.
221
+ * @param seat_position Seat position
222
+ * @param seat_cooler_level Cooling level
223
+ */
116
224
  async remote_seat_cooler_request(seat_position, seat_cooler_level) {
117
225
  if (typeof seat_position === "string") {
118
226
  seat_position = Seats[seat_position];
@@ -122,6 +230,11 @@ export default class VehicleSpecific {
122
230
  seat_cooler_level,
123
231
  });
124
232
  }
233
+ /**
234
+ * Sets seat heating.
235
+ * @param seat_position Seat position
236
+ * @param seat_heater_level Heating level
237
+ */
125
238
  async remote_seat_heater_request(seat_position, seat_heater_level) {
126
239
  if (typeof seat_position === "string") {
127
240
  seat_position = Seats[seat_position];
@@ -131,42 +244,89 @@ export default class VehicleSpecific {
131
244
  seat_heater_level,
132
245
  });
133
246
  }
247
+ /**
248
+ * Starts the vehicle remotely. Requires keyless driving to be enabled.
249
+ */
134
250
  async remote_start_drive() {
135
251
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/remote_start_drive`);
136
252
  }
253
+ /**
254
+ * Sets steering wheel heat level.
255
+ * @param level Heating level
256
+ */
137
257
  async remote_steering_wheel_heat_level_request(level) {
138
258
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/remote_steering_wheel_heat_level_request`, null, { level });
139
259
  }
260
+ /**
261
+ * Sets steering wheel heating on/off. For vehicles that do not support auto steering wheel heat.
262
+ * @param on `true` or `false`
263
+ */
140
264
  async remote_steering_wheel_heater_request(on) {
141
265
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/remote_steering_wheel_heater_request`, null, { on });
142
266
  }
267
+ /**
268
+ * Removes PIN to Drive. Requires the car to be in Pin to Drive mode and not in Valet mode. Note that this only works if PIN to Drive is not active. This command also requires the Tesla Vehicle Command Protocol - for more information, please see refer to the documentation here.
269
+ */
143
270
  async reset_pin_to_drive_pin() {
144
271
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/reset_pin_to_drive_pin`);
145
272
  }
273
+ /**
274
+ * Removes PIN for Valet Mode.
275
+ */
146
276
  async reset_valet_pin() {
147
277
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/reset_valet_pin`);
148
278
  }
279
+ /**
280
+ * Schedules a vehicle software update (over the air "OTA") to be installed in the future.
281
+ * @param offset_sec Offset in seconds
282
+ */
149
283
  async schedule_software_update(offset_sec) {
150
284
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/schedule_software_update`, null, { offset_sec });
151
285
  }
286
+ /**
287
+ * Turns Bioweapon Defense Mode on and off.
288
+ * @param on `true` or `false`
289
+ * @param manual_override `true` or `false`
290
+ */
152
291
  async set_bioweapon_mode(on, manual_override) {
153
292
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/set_bioweapon_mode`, null, { on, manual_override });
154
293
  }
294
+ /**
295
+ * Sets the vehicle overheat protection.
296
+ * @param on `true` or `false`
297
+ * @param fan_only `true` or `false`
298
+ */
155
299
  async set_cabin_overheat_protection(on, fan_only) {
156
300
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/set_cabin_overheat_protection`, null, { on, fan_only });
157
301
  }
302
+ /**
303
+ * Sets the vehicle's charge limit to a custom percentage.
304
+ * @param percent Charge limit percentage typically between 50-100
305
+ */
158
306
  async set_charge_limit(percent) {
159
307
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/set_charge_limit`, null, { percent });
160
308
  }
309
+ /**
310
+ * Sets the charge limit to the standard setting.
311
+ * @param percent Current limit in Amps typically between 5-32
312
+ */
161
313
  async set_charging_amps(charging_amps) {
162
314
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/set_charging_amps`, null, { charging_amps });
163
315
  }
316
+ /**
317
+ * Enables climate keeper mode.
318
+ * @param climate_keeper_mode `0` is Off, `1` is Keep, `2` is Dog, `3` is Camp
319
+ */
164
320
  async set_climate_keeper_mode(climate_keeper_mode) {
165
321
  if (typeof climate_keeper_mode === "string") {
166
322
  climate_keeper_mode = ClimateModes[climate_keeper_mode];
167
323
  }
168
324
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/set_climate_keeper_mode`, null, { climate_keeper_mode });
169
325
  }
326
+ /**
327
+ * Adjusts the Cabin Overheat Protection temperature (COP).
328
+ * @param cop_temp Integer representing Low (0/30C/90F), Medium (1/35C/95F), or High (2/40C/100F)
329
+ */
170
330
  async set_cop_temp(cop_temp) {
171
331
  if (cop_temp >= 90) {
172
332
  cop_temp = (cop_temp - 90) / 5;
@@ -176,15 +336,41 @@ export default class VehicleSpecific {
176
336
  }
177
337
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/set_cop_temp`, null, { cop_temp });
178
338
  }
339
+ /**
340
+ * Sets a four-digit passcode for PIN to Drive. This PIN must then be entered before the vehicle can be driven.
341
+ * @param on `true` or `false`
342
+ * @param password Four-digit passcode
343
+ */
179
344
  async set_pin_to_drive(on, password) {
180
345
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/set_pin_to_drive`, null, { on, password: String(password) });
181
346
  }
347
+ /**
348
+ * Sets an override for preconditioning — it should default to empty if no override is used.
349
+ * Also known as "Defrost Mode"
350
+ * @param on `true` or `false`
351
+ * @param manual_override `true` or `false`
352
+ */
182
353
  async set_preconditioning_max(on, manual_override) {
183
354
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/set_preconditioning_max`, null, { on, manual_override });
184
355
  }
356
+ /**
357
+ * Sets a time at which charging should be completed. The time parameter is minutes after midnight (e.g: time=120 schedules charging for 2:00am vehicle local time).
358
+ * @param enable `true` or `false`
359
+ * @param time Minutes after midnight
360
+ */
185
361
  async set_scheduled_charging(enable, time) {
186
362
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/set_scheduled_charging`, null, { enable, time });
187
363
  }
364
+ /**
365
+ * Sets a time at which departure should be completed. The time parameter is minutes after midnight (e.g: time=120 schedules departure for 2:00am vehicle local time).
366
+ * @param enable `true` or `false`
367
+ * @param preconditioning_enabled `true` or `false`
368
+ * @param preconditioning_weekdays_only `true` or `false`
369
+ * @param departure_time Minutes after midnight
370
+ * @param off_peak_charging_enabled `true` or `false`
371
+ * @param off_peak_charging_weekdays_only `true` or `false`
372
+ * @param end_off_peak_time Minutes after midnight
373
+ */
188
374
  async set_scheduled_departure(enable = true, preconditioning_enabled = false, preconditioning_weekdays_only = false, departure_time = 0, off_peak_charging_enabled = false, off_peak_charging_weekdays_only = false, end_off_peak_time = 0) {
189
375
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/set_scheduled_departure`, null, {
190
376
  enable,
@@ -196,119 +382,275 @@ export default class VehicleSpecific {
196
382
  end_off_peak_time,
197
383
  });
198
384
  }
385
+ /**
386
+ * Enables and disables Sentry Mode. Sentry Mode allows customers to watch the vehicle cameras live from the mobile app, as well as record sentry events.
387
+ * @param on `true` or `false`
388
+ */
199
389
  async set_sentry_mode(on) {
200
390
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/set_sentry_mode`, null, { on });
201
391
  }
392
+ /**
393
+ * Sets the driver and/or passenger-side cabin temperature (and other zones if sync is enabled).
394
+ * @param driver_temp Driver temperature
395
+ * @param passenger_temp Passenger temperature
396
+ */
202
397
  async set_temps(driver_temp, passenger_temp) {
203
398
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/set_temps`, null, { driver_temp, passenger_temp });
204
399
  }
400
+ /**
401
+ * Turns on Valet Mode and sets a four-digit passcode that must then be entered to disable Valet Mode.
402
+ * @param on `true` or `false`
403
+ * @param password Four-digit passcode
404
+ */
205
405
  async set_valet_mode(on, password) {
206
406
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/set_valet_mode`, null, { on, password: String(password) });
207
407
  }
408
+ /**
409
+ * Changes the name of a vehicle. This command also requires the Tesla Vehicle Command Protocol - for more information, please see refer to the documentation here.
410
+ * @param vehicle_name New name
411
+ */
208
412
  async set_vehicle_name(vehicle_name) {
209
413
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/set_vehicle_name`, null, { vehicle_name });
210
414
  }
415
+ /**
416
+ * Activates Speed Limit Mode with a four-digit PIN.
417
+ * @param pin Four-digit PIN
418
+ */
211
419
  async speed_limit_activate(pin) {
212
420
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/speed_limit_activate`, null, { pin: String(pin) });
213
421
  }
422
+ /**
423
+ * Deactivates Speed Limit Mode and resets the associated PIN.
424
+ * @param pin Four-digit PIN
425
+ */
214
426
  async speed_limit_clear_pin(pin) {
215
427
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/speed_limit_clear_pin`, null, { pin: String(pin) });
216
428
  }
429
+ /**
430
+ * Deactivates Speed Limit Mode and resets the associated PIN for vehicles running firmware versions 2023.38+. This command is only accessible to fleet managers or owners.
431
+ */
217
432
  async speed_limit_clear_pin_admin() {
218
433
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/speed_limit_clear_pin_admin`);
219
434
  }
435
+ /**
436
+ * Deactivates Speed Limit Mode.
437
+ * @param pin Four-digit PIN
438
+ */
220
439
  async speed_limit_deactivate(pin) {
221
440
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/speed_limit_deactivate`, null, { pin: String(pin) });
222
441
  }
442
+ /**
443
+ * Sets the maximum speed allowed when Speed Limit Mode is active.
444
+ * @param limit_mph Maximum speed in MPH
445
+ */
223
446
  async speed_limit_set_limit(limit_mph) {
224
447
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/speed_limit_set_limit`, null, { limit_mph });
225
448
  }
449
+ /**
450
+ * Controls the panoramic sunroof on the Model S.
451
+ * @param state "stop", "close" or "vent"
452
+ */
226
453
  async sun_roof_control(state) {
227
454
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/sun_roof_control`, null, { state });
228
455
  }
456
+ /**
457
+ * Records a drive note. The note parameter is truncated to 80 characters in length.
458
+ * @param note Drive note
459
+ */
229
460
  async take_drivenote(note) {
230
461
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/take_drivenote`, null, { note });
231
462
  }
463
+ /**
464
+ * Turns on HomeLink (used to open and close garage doors).
465
+ * @param token
466
+ * @param lat Latitude
467
+ * @param lon Longitude
468
+ */
232
469
  async trigger_homelink(lat, lon, token) {
233
470
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/trigger_homelink`, null, { token, lat, lon });
234
471
  }
472
+ /**
473
+ * Upcoming calendar entries stored on the vehicle.
474
+ * @param calendar_data Calendar data
475
+ */
235
476
  async upcoming_calendar_entries(calendar_data) {
236
477
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/upcoming_calendar_entries`, null, { calendar_data });
237
478
  }
479
+ /**
480
+ * Control the windows of a parked vehicle. Supported commands: vent and close. When closing, specify lat and lon of user to ensure they are within range of vehicle (unless this is an M3 platform vehicle).
481
+ * @param command "vent" or "close"
482
+ * @param lat Latitude
483
+ * @param lon Longitude
484
+ */
238
485
  async window_control(command, lat, lon) {
239
486
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/window_control`, null, { command, lat, lon });
240
487
  }
488
+ // Vehicle Endpoints
489
+ /**
490
+ * Returns all allowed drivers for a vehicle. This endpoint is only available for the vehicle owner.
491
+ */
241
492
  async drivers() {
242
493
  return this.parent.parent._request("GET", `api/1/vehicles/${this.vin}/drivers`);
243
494
  }
495
+ /**
496
+ * Removes driver access from a vehicle. Share users can only remove their own access. Owners can remove share access or their own.
497
+ * @param share_user_id
498
+ */
244
499
  async drivers_remove(share_user_id) {
245
500
  return this.parent.parent._request("DELETE", `api/1/vehicles/${this.vin}/drivers`, null, { share_user_id });
246
501
  }
502
+ /**
503
+ * Returns eligible vehicle subscriptions.
504
+ * @param vin Vehicle Identification Number
505
+ */
247
506
  async eligible_subscriptions(vin) {
248
507
  return this.parent.parent._request("GET", "/api/1/dx/vehicles/subscriptions/eligibility", { vin });
249
508
  }
509
+ /**
510
+ * Returns eligibile vehicle upgrades.
511
+ * @param vin Vehicle Identification Number
512
+ */
250
513
  async eligible_upgrades(vin) {
251
514
  return this.parent.parent._request("GET", "/api/1/dx/vehicles/upgrades/eligibility", { vin });
252
515
  }
516
+ /**
517
+ * Checks whether vehicles can accept Tesla commands protocol for the partner's public key
518
+ * @param vins list of Vehicle Identification Number
519
+ * @returns
520
+ */
253
521
  async fleet_status(vins) {
254
522
  return this.parent.parent._request("POST", "api/1/vehicles/fleet_status", null, { vins });
255
523
  }
524
+ /**
525
+ * Configures vehicles to connect to self-hosted fleet-telemetry server. This endpoint has concurrency 1 (status 429 will be returned if many calls are made at the same time). Multiple vehicles can be configured with a single call.
526
+ * @param config A dictionary description the fleet telemetry configuration
527
+ * @returns
528
+ */
256
529
  async fleet_telemetry_config(config) {
257
530
  return this.parent.parent._request("POST", "api/1/vehicles/fleet_telemetry_config", null, { vins: [this.vin], config });
258
531
  }
532
+ /**
533
+ * Disconnects vehicles to stream telemetry data to self hosted fleet-telemetry server.
534
+ * @returns
535
+ */
259
536
  async fleet_telemetry_config_delete() {
260
537
  return this.parent.parent._request("DELETE", `api/1/vehicles/${this.vin}/fleet_telemetry_config`);
261
538
  }
539
+ /**
540
+ * Fetches a vehicle's fleet telemetry config. synced set to true means the vehicle has adopted the target config. synced set to false means the vehicle will attempt to adopt the target config when it next establishes a backend connection.
541
+ * @returns
542
+ */
262
543
  async fleet_telemetry_config_get() {
263
544
  return this.parent.parent._request("GET", `api/1/vehicles/${this.vin}/fleet_telemetry_config`);
264
545
  }
546
+ /**
547
+ * Create a Vehicle class for a specific vehicle.
548
+ * @param page Page number
549
+ * @param per_page Number of items per page
550
+ */
265
551
  async list(page, per_page) {
266
552
  return this.parent.parent._request("GET", "api/1/vehicles", { page, per_page });
267
553
  }
554
+ /**
555
+ * Returns whether or not mobile access is enabled for the vehicle.
556
+ */
268
557
  async mobile_enabled() {
269
558
  return this.parent.parent._request("GET", `api/1/vehicles/${this.vin}/mobile_enabled`);
270
559
  }
560
+ /**
561
+ * Returns the charging sites near the current location of the vehicle.
562
+ * @param count
563
+ * @param radius
564
+ * @param detail
565
+ */
271
566
  async nearby_charging_sites(count, radius, detail) {
272
567
  return this.parent.parent._request("GET", `api/1/vehicles/${this.vin}/nearby_charging_sites`, { count, radius, detail });
273
568
  }
569
+ /**
570
+ * Returns vehicle option details.
571
+ * @param vin Vehicle Identification Number
572
+ */
274
573
  async options(vin) {
275
574
  return this.parent.parent._request("GET", "api/1/dx/vehicles/options", { vin });
276
575
  }
576
+ /**
577
+ * List of recent alerts
578
+ */
277
579
  async recent_alerts() {
278
580
  return this.parent.parent._request("GET", `api/1/vehicles/${this.vin}/recent_alerts`);
279
581
  }
582
+ /**
583
+ * Returns firmware release notes.
584
+ * @param staged
585
+ * @param language
586
+ */
280
587
  async release_notes(staged, language) {
281
588
  return this.parent.parent._request("GET", `api/1/vehicles/${this.vin}/release_notes`, { staged, language });
282
589
  }
590
+ /**
591
+ * Returns service data.
592
+ */
283
593
  async service_data() {
284
594
  return this.parent.parent._request("GET", `api/1/vehicles/${this.vin}/service_data`);
285
595
  }
596
+ /**
597
+ * Returns the share invites for a vehicle.
598
+ */
286
599
  async share_invites() {
287
600
  return this.parent.parent._request("GET", `api/1/vehicles/${this.vin}/invitations`);
288
601
  }
602
+ /**
603
+ * Creates a share invite for a vehicle.
604
+ */
289
605
  async share_invites_create() {
290
606
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/invitations`);
291
607
  }
608
+ /**
609
+ * Redeems a share invite.
610
+ * @param code
611
+ */
292
612
  async share_invites_redeem(code) {
293
613
  return this.parent.parent._request("POST", "api/1/invitations/redeem", { code });
294
614
  }
615
+ /**
616
+ * Revokes a share invite.
617
+ * @param id
618
+ */
295
619
  async share_invites_revoke(id) {
296
620
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/invitations/${id}/revoke`);
297
621
  }
622
+ /**
623
+ * Signed Commands is a generic endpoint replacing legacy commands.
624
+ * @param routable_message
625
+ */
298
626
  async signed_command(routable_message) {
299
627
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/signed_command`, null, { routable_message });
300
628
  }
629
+ /**
630
+ * Returns information about a vehicle.
631
+ */
301
632
  async vehicle() {
302
633
  return this.parent.parent._request("GET", `api/1/vehicles/${this.vin}`);
303
634
  }
635
+ /**
636
+ * Makes a live call to the vehicle. This may return cached data if the vehicle is offline. For vehicles running firmware versions 2023.38+, location_data is required to fetch vehicle location. This will result in a location sharing icon to show on the vehicle UI.
637
+ * @param endpoints
638
+ */
304
639
  async vehicle_data(endpoints) {
305
640
  if (typeof endpoints === "object")
306
641
  endpoints = endpoints.join(";");
307
642
  return this.parent.parent._request("GET", `api/1/vehicles/${this.vin}/vehicle_data`, null, { endpoints });
308
643
  }
644
+ /**
645
+ * Wakes the vehicle from sleep, which is a state to minimize idle energy consumption.
646
+ */
309
647
  async wake_up() {
310
648
  return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/wake_up`);
311
649
  }
650
+ /**
651
+ * Returns warranty details.
652
+ * @param vin
653
+ */
312
654
  async warranty_details(vin) {
313
655
  return this.parent.parent._request("GET", "api/1/dx/warranty/details", { vin });
314
656
  }