tesla-fleet-api 0.3.0 → 0.4.0

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.
Files changed (192) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +22 -0
  2. package/dist/_virtual/_rolldown/runtime.mjs +12 -0
  3. package/dist/charging.cjs +53 -0
  4. package/dist/charging.d.cts +31 -0
  5. package/dist/charging.d.mts +30 -0
  6. package/dist/charging.mjs +53 -0
  7. package/dist/commands.cjs +802 -0
  8. package/dist/commands.d.cts +350 -0
  9. package/dist/commands.d.mts +349 -0
  10. package/dist/commands.mjs +800 -0
  11. package/dist/const.cjs +300 -0
  12. package/dist/const.d.cts +287 -0
  13. package/dist/const.d.mts +287 -0
  14. package/dist/const.mjs +263 -0
  15. package/dist/energy.cjs +137 -0
  16. package/dist/energy.d.cts +95 -0
  17. package/{src/energy.ts → dist/energy.d.mts} +17 -140
  18. package/dist/energy.mjs +137 -0
  19. package/dist/energyspecific.cjs +99 -0
  20. package/dist/energyspecific.d.cts +78 -0
  21. package/dist/energyspecific.d.mts +77 -0
  22. package/dist/energyspecific.mjs +99 -0
  23. package/dist/exceptions.cjs +1487 -0
  24. package/dist/exceptions.d.cts +1142 -0
  25. package/dist/exceptions.d.mts +1142 -0
  26. package/dist/exceptions.mjs +1324 -0
  27. package/dist/index.cjs +226 -0
  28. package/dist/index.d.cts +14 -0
  29. package/dist/index.d.mts +14 -0
  30. package/dist/index.mjs +14 -0
  31. package/dist/partner.cjs +32 -0
  32. package/dist/partner.d.cts +24 -0
  33. package/dist/partner.d.mts +23 -0
  34. package/dist/partner.mjs +32 -0
  35. package/dist/router.cjs +0 -0
  36. package/dist/router.d.cts +1 -0
  37. package/dist/router.d.mts +1 -0
  38. package/dist/router.mjs +1 -0
  39. package/dist/signing/crypto.cjs +31 -0
  40. package/dist/signing/crypto.mjs +27 -0
  41. package/dist/signing/session.cjs +112 -0
  42. package/dist/signing/session.d.cts +69 -0
  43. package/dist/signing/session.d.mts +69 -0
  44. package/dist/signing/session.mjs +110 -0
  45. package/dist/tariff.cjs +292 -0
  46. package/dist/{tariff.d.ts → tariff.d.cts} +17 -17
  47. package/dist/tariff.d.mts +29 -0
  48. package/dist/tariff.mjs +291 -0
  49. package/dist/teslafleetapi.cjs +125 -0
  50. package/dist/teslafleetapi.d.cts +64 -0
  51. package/dist/teslafleetapi.d.mts +64 -0
  52. package/dist/teslafleetapi.mjs +125 -0
  53. package/dist/teslemetry.cjs +36 -0
  54. package/dist/teslemetry.d.cts +23 -0
  55. package/dist/teslemetry.d.mts +23 -0
  56. package/dist/teslemetry.mjs +36 -0
  57. package/dist/tessie.cjs +34 -0
  58. package/dist/tessie.d.cts +23 -0
  59. package/dist/tessie.d.mts +23 -0
  60. package/dist/tessie.mjs +34 -0
  61. package/dist/types/commands.d.cts +28 -0
  62. package/dist/types/commands.d.mts +28 -0
  63. package/dist/types/live_status.d.cts +30 -0
  64. package/dist/types/live_status.d.mts +30 -0
  65. package/dist/types/products.d.cts +58 -0
  66. package/dist/types/products.d.mts +58 -0
  67. package/dist/types/responses.d.cts +9 -0
  68. package/dist/types/responses.d.mts +9 -0
  69. package/dist/types/site_info.d.cts +154 -0
  70. package/dist/types/site_info.d.mts +154 -0
  71. package/dist/types/vehicle.d.cts +27 -0
  72. package/dist/types/vehicle.d.mts +27 -0
  73. package/dist/types/vehicle_data.d.cts +278 -0
  74. package/dist/types/vehicle_data.d.mts +278 -0
  75. package/dist/types.cjs +0 -0
  76. package/dist/types.d.cts +9 -0
  77. package/dist/types.d.mts +9 -0
  78. package/dist/types.mjs +1 -0
  79. package/dist/user.cjs +28 -0
  80. package/dist/user.d.cts +17 -0
  81. package/dist/user.d.mts +16 -0
  82. package/dist/user.mjs +28 -0
  83. package/dist/vehicle.cjs +804 -0
  84. package/dist/vehicle.d.cts +550 -0
  85. package/dist/vehicle.d.mts +549 -0
  86. package/dist/vehicle.mjs +804 -0
  87. package/dist/vehiclesigned.cjs +20 -0
  88. package/dist/vehiclesigned.d.cts +14 -0
  89. package/dist/{vehiclesigned.d.ts → vehiclesigned.d.mts} +3 -3
  90. package/dist/vehiclesigned.mjs +20 -0
  91. package/dist/vehiclespecific.cjs +604 -0
  92. package/dist/vehiclespecific.d.cts +433 -0
  93. package/dist/vehiclespecific.d.mts +432 -0
  94. package/dist/vehiclespecific.mjs +604 -0
  95. package/package.json +108 -35
  96. package/dist/charging.d.ts +0 -30
  97. package/dist/charging.js +0 -51
  98. package/dist/charging.js.map +0 -1
  99. package/dist/commands.d.ts +0 -352
  100. package/dist/commands.js +0 -875
  101. package/dist/commands.js.map +0 -1
  102. package/dist/energy.d.ts +0 -94
  103. package/dist/energy.js +0 -125
  104. package/dist/energy.js.map +0 -1
  105. package/dist/energyspecific.d.ts +0 -77
  106. package/dist/energyspecific.js +0 -97
  107. package/dist/energyspecific.js.map +0 -1
  108. package/dist/helpers.d.ts +0 -2
  109. package/dist/helpers.js +0 -10
  110. package/dist/helpers.js.map +0 -1
  111. package/dist/index.d.ts +0 -15
  112. package/dist/index.js +0 -15
  113. package/dist/index.js.map +0 -1
  114. package/dist/partner.d.ts +0 -23
  115. package/dist/partner.js +0 -31
  116. package/dist/partner.js.map +0 -1
  117. package/dist/signing/crypto.d.ts +0 -10
  118. package/dist/signing/crypto.js +0 -26
  119. package/dist/signing/crypto.js.map +0 -1
  120. package/dist/signing/errors.d.ts +0 -29
  121. package/dist/signing/errors.js +0 -40
  122. package/dist/signing/errors.js.map +0 -1
  123. package/dist/signing/session.d.ts +0 -69
  124. package/dist/signing/session.js +0 -102
  125. package/dist/signing/session.js.map +0 -1
  126. package/dist/tariff.js +0 -302
  127. package/dist/tariff.js.map +0 -1
  128. package/dist/teslafleetapi.d.ts +0 -58
  129. package/dist/teslafleetapi.js +0 -120
  130. package/dist/teslafleetapi.js.map +0 -1
  131. package/dist/teslemetry.d.ts +0 -29
  132. package/dist/teslemetry.js +0 -39
  133. package/dist/teslemetry.js.map +0 -1
  134. package/dist/tessie.d.ts +0 -23
  135. package/dist/tessie.js +0 -28
  136. package/dist/tessie.js.map +0 -1
  137. package/dist/types/commands.d.ts +0 -44
  138. package/dist/types/commands.js +0 -11
  139. package/dist/types/commands.js.map +0 -1
  140. package/dist/types/live_status.d.ts +0 -26
  141. package/dist/types/live_status.js +0 -2
  142. package/dist/types/live_status.js.map +0 -1
  143. package/dist/types/products.d.ts +0 -54
  144. package/dist/types/products.js +0 -2
  145. package/dist/types/products.js.map +0 -1
  146. package/dist/types/responses.d.ts +0 -5
  147. package/dist/types/responses.js +0 -2
  148. package/dist/types/responses.js.map +0 -1
  149. package/dist/types/site_info.d.ts +0 -150
  150. package/dist/types/site_info.js +0 -2
  151. package/dist/types/site_info.js.map +0 -1
  152. package/dist/types/vehicle.d.ts +0 -23
  153. package/dist/types/vehicle.js +0 -10
  154. package/dist/types/vehicle.js.map +0 -1
  155. package/dist/types/vehicle_data.d.ts +0 -274
  156. package/dist/types/vehicle_data.js +0 -2
  157. package/dist/types/vehicle_data.js.map +0 -1
  158. package/dist/user.d.ts +0 -16
  159. package/dist/user.js +0 -26
  160. package/dist/user.js.map +0 -1
  161. package/dist/vehicle.d.ts +0 -548
  162. package/dist/vehicle.js +0 -774
  163. package/dist/vehicle.js.map +0 -1
  164. package/dist/vehiclesigned.js +0 -19
  165. package/dist/vehiclesigned.js.map +0 -1
  166. package/dist/vehiclespecific.d.ts +0 -432
  167. package/dist/vehiclespecific.js +0 -601
  168. package/dist/vehiclespecific.js.map +0 -1
  169. package/src/charging.ts +0 -66
  170. package/src/commands.ts +0 -1134
  171. package/src/energyspecific.ts +0 -116
  172. package/src/helpers.ts +0 -11
  173. package/src/index.ts +0 -21
  174. package/src/partner.ts +0 -37
  175. package/src/signing/crypto.ts +0 -29
  176. package/src/signing/errors.ts +0 -50
  177. package/src/signing/session.ts +0 -132
  178. package/src/tariff.ts +0 -375
  179. package/src/teslafleetapi.ts +0 -182
  180. package/src/teslemetry.ts +0 -54
  181. package/src/tessie.ts +0 -42
  182. package/src/types/commands.ts +0 -62
  183. package/src/types/live_status.ts +0 -27
  184. package/src/types/products.ts +0 -61
  185. package/src/types/responses.ts +0 -1
  186. package/src/types/site_info.ts +0 -159
  187. package/src/types/vehicle.ts +0 -33
  188. package/src/types/vehicle_data.ts +0 -286
  189. package/src/user.ts +0 -35
  190. package/src/vehicle.ts +0 -886
  191. package/src/vehiclesigned.ts +0 -20
  192. package/src/vehiclespecific.ts +0 -818
package/src/vehicle.ts DELETED
@@ -1,886 +0,0 @@
1
- import TeslaFleetApi from "./teslafleetapi.js";
2
- import { ClimateMode, ClimateModes, CommandResponse, FleetTelemetryConfig, Level, Seat, Seats, Trunk, VehicleDataEndpoint } from "./types/commands.js";
3
- import { OptionsResponse } from "./types/responses.js";
4
- import { Models, VehicleResponse } from "./types/vehicle.js";
5
- import { VehicleDataResponse } from "./types/vehicle_data.js";
6
- import VehicleSpecific from "./vehiclespecific.js";
7
- import VehicleSigned from "./vehiclesigned.js";
8
-
9
- export default class Vehicle {
10
- parent: TeslaFleetApi;
11
- /** Fallback private key for `signed()` when a call site doesn't pass one explicitly. */
12
- private_key?: Buffer;
13
-
14
- constructor(parent: TeslaFleetApi) {
15
- this.parent = parent;
16
- }
17
-
18
- /**
19
- * Returns a class for a single vehicle.
20
- * @param vin
21
- * @returns
22
- */
23
- specific(vin: string): VehicleSpecific {
24
- return new VehicleSpecific(this, vin);
25
- }
26
-
27
- /**
28
- * Returns a class for a single vehicle that signs commands with the
29
- * Tesla Vehicle Command Protocol and dispatches them through the Fleet
30
- * API `/signed_command` endpoint, instead of the plaintext REST commands.
31
- * @param vin
32
- * @param private_key Raw 32-byte P-256 private key scalar. Falls back to `this.private_key`.
33
- * @param public_key Uncompressed P-256 public key point. Derived from `private_key` if omitted.
34
- */
35
- signed(vin: string, private_key?: Buffer, public_key?: Buffer): VehicleSigned {
36
- return new VehicleSigned(this, vin, private_key, public_key);
37
- }
38
-
39
- /**
40
- * Return the vehicle model name
41
- * @param vin
42
- * @returns
43
- */
44
- model(vin: string): string {
45
- return Models?.[vin[3]] || "Unknown";
46
- }
47
-
48
- /**
49
- * Return if the vehicle was build before 2021 and cannot sleep without a break
50
- * @param vin
51
- * @returns
52
- */
53
- pre2021(vin: string): boolean {
54
- return (vin[3] === "S" || vin[3] === "X") && vin[9] < "L";
55
- }
56
-
57
- // Vehicle Commands
58
-
59
- /**
60
- * Controls the front (which_trunk: "front") or rear (which_trunk: "rear") trunk.
61
- * @param vehicle_tag VIN or id field of a vehicle
62
- * @param which_trunk "front" or "rear"
63
- */
64
- async actuate_truck(vehicle_tag: string | number, which_trunk: Trunk): Promise<CommandResponse> {
65
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/actuate_trunk`, null, { which_trunk });
66
- }
67
-
68
- /**
69
- * Adjusts vehicle media playback volume.
70
- * @param vehicle_tag VIN or id field of a vehicle
71
- * @param volume A floating point number from 0.0 to 11.0.
72
- */
73
- async adjust_volume(vehicle_tag: string | number, volume: number): Promise<CommandResponse> {
74
- if (volume < 0 || volume > 11) {
75
- throw new Error("Volume must a number from 0.0 to 11.0");
76
- }
77
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/adjust_volume`, null, { volume });
78
- }
79
-
80
- /**
81
- * Starts climate preconditioning.
82
- * @param vehicle_tag VIN or id field of a vehicle
83
- */
84
- async auto_conditioning_start(vehicle_tag: string | number): Promise<CommandResponse> {
85
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/auto_conditioning_start`);
86
- }
87
-
88
- /**
89
- * Stops climate preconditioning.
90
- * @param vehicle_tag VIN or id field of a vehicle
91
- */
92
- async auto_conditioning_stop(vehicle_tag: string | number): Promise<CommandResponse> {
93
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/auto_conditioning_stop`);
94
- }
95
-
96
- /**
97
- * Cancels the countdown to install the vehicle software update.
98
- * @param vehicle_tag VIN or id field of a vehicle
99
- */
100
- async cancel_software_update(vehicle_tag: string | number): Promise<CommandResponse> {
101
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/cancel_software_update`);
102
- }
103
-
104
- /**
105
- * Charges in max range mode -- we recommend limiting the use of this mode to long trips.
106
- * @param vehicle_tag VIN or id field of a vehicle
107
- */
108
- async charge_max_range(vehicle_tag: string | number): Promise<CommandResponse> {
109
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/charge_max_range`);
110
- }
111
-
112
- /**
113
- * Closes the charge port door.
114
- * @param vehicle_tag VIN or id field of a vehicle
115
- */
116
- async charge_port_door_close(vehicle_tag: string | number): Promise<CommandResponse> {
117
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/charge_port_door_close`);
118
- }
119
-
120
- /**
121
- * Opens the charge port door.
122
- * @param vehicle_tag VIN or id field of a vehicle
123
- */
124
- async charge_port_door_open(vehicle_tag: string | number): Promise<CommandResponse> {
125
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/charge_port_door_open`);
126
- }
127
-
128
- /**
129
- * Charges in Standard mode.
130
- * @param vehicle_tag VIN or id field of a vehicle
131
- */
132
- async charge_standard(vehicle_tag: string | number): Promise<CommandResponse> {
133
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/charge_standard`);
134
- }
135
-
136
- /**
137
- * Starts charging the vehicle.
138
- * @param vehicle_tag VIN or id field of a vehicle
139
- */
140
- async charge_start(vehicle_tag: string | number): Promise<CommandResponse> {
141
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/charge_start`);
142
- }
143
-
144
- /**
145
- * Stops charging the vehicle.
146
- * @param vehicle_tag VIN or id field of a vehicle
147
- */
148
- async charge_stop(vehicle_tag: string | number): Promise<CommandResponse> {
149
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/charge_stop`);
150
- }
151
-
152
- /**
153
- * 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.
154
- * @param vehicle_tag VIN or id field of a vehicle
155
- */
156
- async clear_pin_to_drive_admin(vehicle_tag: string | number): Promise<CommandResponse> {
157
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/clear_pin_to_drive_admin`);
158
- }
159
-
160
- /**
161
- * Locks the vehicle.
162
- * @param vehicle_tag VIN or id field of a vehicle
163
- */
164
- async door_lock(vehicle_tag: string | number): Promise<CommandResponse> {
165
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/door_lock`);
166
- }
167
-
168
- /**
169
- * Unlocks the vehicle.
170
- * @param vehicle_tag VIN or id field of a vehicle
171
- */
172
- async door_unlock(vehicle_tag: string | number): Promise<CommandResponse> {
173
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/door_unlock`);
174
- }
175
-
176
- /**
177
- * Erases user's data from the user interface. Requires the vehicle to be in park.
178
- * @param vehicle_tag VIN or id field of a vehicle
179
- */
180
- async erase_user_data(vehicle_tag: string | number): Promise<CommandResponse> {
181
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/erase_user_data`);
182
- }
183
-
184
- /**
185
- * Briefly flashes the vehicle headlights. Requires the vehicle to be in park.
186
- * @param vehicle_tag VIN or id field of a vehicle
187
- */
188
- async flash_lights(vehicle_tag: string | number): Promise<CommandResponse> {
189
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/flash_lights`);
190
- }
191
-
192
- /**
193
- * Restricts certain vehicle UI functionality from guest users
194
- * @param vehicle_tag VIN or id field of a vehicle
195
- * @param enable `true` or `false`
196
- */
197
- async guest_mode(vehicle_tag: string | number, enable: boolean): Promise<CommandResponse> {
198
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/guest_mode`, null, { enable });
199
- }
200
-
201
- /**
202
- * Honks the vehicle horn. Requires the vehicle to be in park.
203
- * @param vehicle_tag VIN or id field of a vehicle
204
- */
205
- async honk_horn(vehicle_tag: string | number): Promise<CommandResponse> {
206
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/honk_horn`);
207
- }
208
-
209
- /**
210
- * Advances media player to next favorite track.
211
- * @param vehicle_tag VIN or id field of a vehicle
212
- */
213
- async media_next_fav(vehicle_tag: string | number): Promise<CommandResponse> {
214
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/media_next_fav`);
215
- }
216
-
217
- /**
218
- * Advances media player to next track.
219
- * @param vehicle_tag VIN or id field of a vehicle
220
- */
221
- async media_next_track(vehicle_tag: string | number): Promise<CommandResponse> {
222
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/media_next_track`);
223
- }
224
-
225
- /**
226
- * Advances media player to previous favorite track.
227
- * @param vehicle_tag VIN or id field of a vehicle
228
- */
229
- async media_prev_fav(vehicle_tag: string | number): Promise<CommandResponse> {
230
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/media_prev_fav`);
231
- }
232
-
233
- /**
234
- * Advances media player to previous track.
235
- * @param vehicle_tag VIN or id field of a vehicle
236
- */
237
- async media_prev_track(vehicle_tag: string | number): Promise<CommandResponse> {
238
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/media_prev_track`);
239
- }
240
-
241
- /**
242
- * Toggles current play/pause state.
243
- * @param vehicle_tag VIN or id field of a vehicle
244
- */
245
- async media_toggle_playback(vehicle_tag: string | number): Promise<CommandResponse> {
246
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/media_toggle_playback`);
247
- }
248
-
249
- /**
250
- * Turns the volume down by one.
251
- * @param vehicle_tag VIN or id field of a vehicle
252
- */
253
- async media_volume_down(vehicle_tag: string | number): Promise<CommandResponse> {
254
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/media_volume_down`);
255
- }
256
-
257
- /**
258
- * Start navigation to given coordinates. Order can be used to specify order of multiple stops.
259
- * @param vehicle_tag VIN or id field of a vehicle
260
- * @param lat Latitude
261
- * @param lon Longitude
262
- * @param order Order of multiple stops
263
- */
264
- async navigation_gps_request(vehicle_tag: string | number, lat: number, lon: number, order?: number): Promise<CommandResponse> {
265
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/navigation_gps_request`, null, { lat, lon, order });
266
- }
267
-
268
- /**
269
- * Sends a location to the in-vehicle navigation system.
270
- * @param vehicle_tag VIN or id field of a vehicle
271
- * @param type "share_ext_content_raw"
272
- * @param locale ISO locale such as "en-US"
273
- * @param timestamp_ms
274
- */
275
- async navigation_request(vehicle_tag: string | number, value: string, locale: string, type: string = "share_ext_content_raw"): Promise<CommandResponse> {
276
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/navigation_request`, null, {
277
- type,
278
- locale,
279
- timestamp_ms: String(Date.now()),
280
- value: {
281
- "android.intent.extra.TEXT": value,
282
- },
283
- });
284
- }
285
-
286
- /**
287
- * Start navigation to a supercharger.
288
- * @param vehicle_tag VIN or id field of a vehicle
289
- * @param id Supercharger ID
290
- * @param order Order of multiple stops
291
- * @returns
292
- */
293
- async navigation_sc_request(vehicle_tag: string | number, id: number, order?: number): Promise<CommandResponse> {
294
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/navigation_sc_request`, null, { id, order });
295
- }
296
-
297
- /**
298
- * Sets automatic seat heating and cooling.
299
- * @param vehicle_tag VIN or id field of a vehicle
300
- * @param auto_seat_position Seat position
301
- * @param auto_climate_on `true` or `false`
302
- */
303
- async remote_auto_seat_climate_request(
304
- vehicle_tag: string | number,
305
- auto_seat_position: Seat | number,
306
- auto_climate_on: boolean
307
- ): Promise<CommandResponse> {
308
- if (typeof auto_seat_position === "string") {
309
- auto_seat_position = Seats[auto_seat_position];
310
- }
311
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/remote_auto_seat_climate_request`, null, {
312
- auto_seat_position,
313
- auto_climate_on,
314
- });
315
- }
316
-
317
- /**
318
- * Sets automatic steering wheel heating on/off.
319
- * @param vehicle_tag VIN or id field of a vehicle
320
- * @param on `true` or `false`
321
- */
322
- async remote_auto_steering_wheel_heat_climate_request(vehicle_tag: string | number, on: boolean): Promise<CommandResponse> {
323
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/remote_auto_steering_wheel_heat_climate_request`, null, { on });
324
- }
325
-
326
- /**
327
- * Plays a sound through the vehicle external speaker.
328
- * @param vehicle_tag VIN or id field of a vehicle
329
- * @param sound Fart is `0`, Locate ping is `2000`
330
- */
331
- async remote_boombox(vehicle_tag: string | number, sound: number = 0): Promise<CommandResponse> {
332
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/remote_boombox`, null, { sound });
333
- }
334
-
335
- /**
336
- * Sets seat cooling.
337
- * @param vehicle_tag VIN or id field of a vehicle
338
- * @param seat_position Seat position
339
- * @param seat_cooler_level Cooling level
340
- */
341
- async remote_seat_cooler_request(vehicle_tag: string | number, seat_position: Seat | number, seat_cooler_level: Level): Promise<CommandResponse> {
342
- if (typeof seat_position === "string") {
343
- seat_position = Seats[seat_position];
344
- }
345
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/remote_seat_cooler_request`, null, {
346
- seat_position,
347
- seat_cooler_level,
348
- });
349
- }
350
-
351
- /**
352
- * Sets seat heating.
353
- * @param vehicle_tag VIN or id field of a vehicle
354
- * @param seat_position Seat position
355
- * @param seat_heater_level Heating level
356
- */
357
- async remote_seat_heater_request(vehicle_tag: string | number, seat_position: Seat | number, seat_heater_level: Level): Promise<CommandResponse> {
358
- if (typeof seat_position === "string") {
359
- seat_position = Seats[seat_position];
360
- }
361
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/remote_seat_heater_request`, null, {
362
- seat_position,
363
- seat_heater_level,
364
- });
365
- }
366
-
367
- /**
368
- * Starts the vehicle remotely. Requires keyless driving to be enabled.
369
- * @param vehicle_tag VIN or id field of a vehicle
370
- */
371
- async remote_start_drive(vehicle_tag: string | number): Promise<CommandResponse> {
372
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/remote_start_drive`);
373
- }
374
-
375
- /**
376
- * Sets steering wheel heat level.
377
- * @param vehicle_tag VIN or id field of a vehicle
378
- * @param level Heating level
379
- */
380
- async remote_steering_wheel_heat_level_request(vehicle_tag: string | number, level: Level): Promise<CommandResponse> {
381
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/remote_steering_wheel_heat_level_request`, null, { level });
382
- }
383
-
384
- /**
385
- * Sets steering wheel heating on/off. For vehicles that do not support auto steering wheel heat.
386
- * @param vehicle_tag VIN or id field of a vehicle
387
- * @param on `true` or `false`
388
- */
389
- async remote_steering_wheel_heater_request(vehicle_tag: string | number, on: boolean): Promise<CommandResponse> {
390
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/remote_steering_wheel_heater_request`, null, { on });
391
- }
392
-
393
- /**
394
- * 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.
395
- * @param vehicle_tag VIN or id field of a vehicle
396
- */
397
- async reset_pin_to_drive_pin(vehicle_tag: string | number): Promise<CommandResponse> {
398
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/reset_pin_to_drive_pin`);
399
- }
400
-
401
- /**
402
- * Removes PIN for Valet Mode.
403
- * @param vehicle_tag VIN or id field of a vehicle
404
- */
405
- async reset_valet_pin(vehicle_tag: string | number): Promise<CommandResponse> {
406
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/reset_valet_pin`);
407
- }
408
-
409
- /**
410
- * Schedules a vehicle software update (over the air "OTA") to be installed in the future.
411
- * @param vehicle_tag VIN or id field of a vehicle
412
- * @param offset_sec Offset in seconds
413
- */
414
- async schedule_software_update(vehicle_tag: string | number, offset_sec: number): Promise<CommandResponse> {
415
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/schedule_software_update`, null, { offset_sec });
416
- }
417
-
418
- /**
419
- * Turns Bioweapon Defense Mode on and off.
420
- * @param vehicle_tag VIN or id field of a vehicle
421
- * @param on `true` or `false`
422
- * @param manual_override `true` or `false`
423
- */
424
- async set_bioweapon_mode(vehicle_tag: string | number, on: boolean, manual_override: boolean): Promise<CommandResponse> {
425
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/set_bioweapon_mode`, null, { on, manual_override });
426
- }
427
-
428
- /**
429
- * Sets the vehicle overheat protection.
430
- * @param vehicle_tag VIN or id field of a vehicle
431
- * @param on `true` or `false`
432
- * @param fan_only `true` or `false`
433
- */
434
- async set_cabin_overheat_protection(vehicle_tag: string | number, on: boolean, fan_only: boolean): Promise<CommandResponse> {
435
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/set_cabin_overheat_protection`, null, { on, fan_only });
436
- }
437
-
438
- /**
439
- * Sets the vehicle's charge limit to a custom percentage.
440
- * @param vehicle_tag VIN or id field of a vehicle
441
- * @param percent Charge limit percentage typically between 50-100
442
- */
443
- async set_charge_limit(vehicle_tag: string | number, percent: number): Promise<CommandResponse> {
444
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/set_charge_limit`, null, { percent });
445
- }
446
-
447
- /**
448
- * Sets the charge limit to the standard setting.
449
- * @param vehicle_tag VIN or id field of a vehicle
450
- * @param percent Current limit in Amps typically between 5-32
451
- */
452
- async set_charging_amps(vehicle_tag: string | number, charging_amps: number): Promise<CommandResponse> {
453
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/set_charging_amps`, null, { charging_amps });
454
- }
455
-
456
- /**
457
- * Enables climate keeper mode.
458
- * @param vehicle_tag VIN or id field of a vehicle
459
- * @param climate_keeper_mode `0` is Off, `1` is Keep, `2` is Dog, `3` is Camp
460
- */
461
- async set_climate_keeper_mode(vehicle_tag: string | number, climate_keeper_mode: number | ClimateMode): Promise<CommandResponse> {
462
- if (typeof climate_keeper_mode === "string") {
463
- climate_keeper_mode = ClimateModes[climate_keeper_mode];
464
- }
465
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/set_climate_keeper_mode`, null, { climate_keeper_mode });
466
- }
467
-
468
- /**
469
- * Adjusts the Cabin Overheat Protection temperature (COP).
470
- * @param vehicle_tag VIN or id field of a vehicle
471
- * @param cop_temp Integer representing Low (0/30C/90F), Medium (1/35C/95F), or High (2/40C/100F)
472
- */
473
- async set_cop_temp(vehicle_tag: string | number, cop_temp: 0 | 1 | 2 | 30 | 35 | 40 | 90 | 95 | 100): Promise<CommandResponse> {
474
- if (cop_temp >= 90) {
475
- cop_temp = (cop_temp - 90) / 5;
476
- } else if (cop_temp >= 30) {
477
- cop_temp = (cop_temp - 30) / 5;
478
- }
479
-
480
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/set_cop_temp`, null, { cop_temp });
481
- }
482
-
483
- /**
484
- * Sets a four-digit passcode for PIN to Drive. This PIN must then be entered before the vehicle can be driven.
485
- * @param vehicle_tag VIN or id field of a vehicle
486
- * @param on `true` or `false`
487
- * @param password Four-digit passcode
488
- */
489
- async set_pin_to_drive(vehicle_tag: string | number, on: boolean, password: string | number): Promise<CommandResponse> {
490
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/set_pin_to_drive`, null, { on, password: String(password) });
491
- }
492
-
493
- /**
494
- * Sets an override for preconditioning — it should default to empty if no override is used.
495
- * Also known as "Defrost Mode"
496
- * @param vehicle_tag VIN or id field of a vehicle
497
- * @param on `true` or `false`
498
- * @param manual_override `true` or `false`
499
- */
500
- async set_preconditioning_max(vehicle_tag: string | number, on: boolean, manual_override: boolean): Promise<CommandResponse> {
501
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/set_preconditioning_max`, null, { on, manual_override });
502
- }
503
-
504
- /**
505
- * 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).
506
- * @param vehicle_tag VIN or id field of a vehicle
507
- * @param enable `true` or `false`
508
- * @param time Minutes after midnight
509
- */
510
- async set_scheduled_charging(vehicle_tag: string | number, enable: boolean, time: number): Promise<CommandResponse> {
511
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/set_scheduled_charging`, null, { enable, time });
512
- }
513
-
514
- /**
515
- * 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).
516
- * @param vehicle_tag VIN or id field of a vehicle
517
- * @param enable `true` or `false`
518
- * @param preconditioning_enabled `true` or `false`
519
- * @param preconditioning_weekdays_only `true` or `false`
520
- * @param departure_time Minutes after midnight
521
- * @param off_peak_charging_enabled `true` or `false`
522
- * @param off_peak_charging_weekdays_only `true` or `false`
523
- * @param end_off_peak_time Minutes after midnight
524
- */
525
- async set_scheduled_departure(
526
- vehicle_tag: string | number,
527
- enable: boolean = true,
528
- preconditioning_enabled: boolean = false,
529
- preconditioning_weekdays_only: boolean = false,
530
- departure_time: number = 0,
531
- off_peak_charging_enabled: boolean = false,
532
- off_peak_charging_weekdays_only: boolean = false,
533
- end_off_peak_time: number = 0
534
- ): Promise<CommandResponse> {
535
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/set_scheduled_departure`, null, {
536
- enable,
537
- preconditioning_enabled,
538
- preconditioning_weekdays_only,
539
- departure_time,
540
- off_peak_charging_enabled,
541
- off_peak_charging_weekdays_only,
542
- end_off_peak_time,
543
- });
544
- }
545
-
546
- /**
547
- * 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.
548
- * @param vehicle_tag VIN or id field of a vehicle
549
- * @param on `true` or `false`
550
- */
551
- async set_sentry_mode(vehicle_tag: string | number, on: boolean): Promise<CommandResponse> {
552
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/set_sentry_mode`, null, { on });
553
- }
554
-
555
- /**
556
- * Sets the driver and/or passenger-side cabin temperature (and other zones if sync is enabled).
557
- * @param vehicle_tag VIN or id field of a vehicle
558
- * @param driver_temp Driver temperature
559
- * @param passenger_temp Passenger temperature
560
- */
561
- async set_temps(vehicle_tag: string | number, driver_temp: number, passenger_temp: number): Promise<CommandResponse> {
562
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/set_temps`, null, { driver_temp, passenger_temp });
563
- }
564
-
565
- /**
566
- * Turns on Valet Mode and sets a four-digit passcode that must then be entered to disable Valet Mode.
567
- * @param vehicle_tag VIN or id field of a vehicle
568
- * @param on `true` or `false`
569
- * @param password Four-digit passcode
570
- */
571
- async set_valet_mode(vehicle_tag: string | number, on: boolean, password: string | number): Promise<CommandResponse> {
572
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/set_valet_mode`, null, { on, password: String(password) });
573
- }
574
-
575
- /**
576
- * 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.
577
- * @param vehicle_tag VIN or id field of a vehicle
578
- * @param vehicle_name New name
579
- */
580
- async set_vehicle_name(vehicle_tag: string | number, vehicle_name: string): Promise<CommandResponse> {
581
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/set_vehicle_name`, null, { vehicle_name });
582
- }
583
-
584
- /**
585
- * Activates Speed Limit Mode with a four-digit PIN.
586
- * @param vehicle_tag VIN or id field of a vehicle
587
- * @param pin Four-digit PIN
588
- */
589
- async speed_limit_activate(vehicle_tag: string | number, pin: string | number): Promise<CommandResponse> {
590
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/speed_limit_activate`, null, { pin: String(pin) });
591
- }
592
-
593
- /**
594
- * Deactivates Speed Limit Mode and resets the associated PIN.
595
- * @param vehicle_tag VIN or id field of a vehicle
596
- * @param pin Four-digit PIN
597
- */
598
- async speed_limit_clear_pin(vehicle_tag: string | number, pin: string | number): Promise<CommandResponse> {
599
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/speed_limit_clear_pin`, null, { pin: String(pin) });
600
- }
601
-
602
- /**
603
- * 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.
604
- * @param vehicle_tag VIN or id field of a vehicle
605
- */
606
- async speed_limit_clear_pin_admin(vehicle_tag: string | number): Promise<CommandResponse> {
607
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/speed_limit_clear_pin_admin`);
608
- }
609
-
610
- /**
611
- * Deactivates Speed Limit Mode.
612
- * @param vehicle_tag VIN or id field of a vehicle
613
- * @param pin Four-digit PIN
614
- */
615
- async speed_limit_deactivate(vehicle_tag: string | number, pin: string | number): Promise<CommandResponse> {
616
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/speed_limit_deactivate`, null, { pin: String(pin) });
617
- }
618
-
619
- /**
620
- * Sets the maximum speed allowed when Speed Limit Mode is active.
621
- * @param vehicle_tag VIN or id field of a vehicle
622
- * @param limit_mph Maximum speed in MPH
623
- */
624
- async speed_limit_set_limit(vehicle_tag: string | number, limit_mph: number): Promise<CommandResponse> {
625
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/speed_limit_set_limit`, null, { limit_mph });
626
- }
627
-
628
- /**
629
- * Controls the panoramic sunroof on the Model S.
630
- * @param vehicle_tag VIN or id field of a vehicle
631
- * @param state "stop", "close" or "vent"
632
- */
633
- async sun_roof_control(vehicle_tag: string | number, state: "stop" | "close" | "vent"): Promise<CommandResponse> {
634
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/sun_roof_control`, null, { state });
635
- }
636
-
637
- /**
638
- * Records a drive note. The note parameter is truncated to 80 characters in length.
639
- * @param vehicle_tag VIN or id field of a vehicle
640
- * @param note Drive note
641
- */
642
- async take_drivenote(vehicle_tag: string | number, note: string): Promise<CommandResponse> {
643
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/take_drivenote`, null, { note });
644
- }
645
-
646
- /**
647
- * Turns on HomeLink (used to open and close garage doors).
648
- * @param vehicle_tag VIN or id field of a vehicle
649
- * @param token
650
- * @param lat Latitude
651
- * @param lon Longitude
652
- */
653
- async trigger_homelink(vehicle_tag: string | number, lat: number, lon: number, token?: string): Promise<CommandResponse> {
654
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/trigger_homelink`, null, { token, lat, lon });
655
- }
656
-
657
- /**
658
- * Upcoming calendar entries stored on the vehicle.
659
- * @param vehicle_tag VIN or id field of a vehicle
660
- * @param calendar_data Calendar data
661
- */
662
- async upcoming_calendar_entries(vehicle_tag: string | number, calendar_data: string): Promise<CommandResponse> {
663
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/upcoming_calendar_entries`, null, { calendar_data });
664
- }
665
-
666
- /**
667
- * 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).
668
- * @param vehicle_tag VIN or id field of a vehicle
669
- * @param command "vent" or "close"
670
- * @param lat Latitude
671
- * @param lon Longitude
672
- */
673
- async window_control(vehicle_tag: string | number, command: "vent" | "close", lat: number, lon: number): Promise<CommandResponse> {
674
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/window_control`, null, { command, lat, lon });
675
- }
676
-
677
- // Vehicle Endpoints
678
-
679
- /**
680
- * Returns all allowed drivers for a vehicle. This endpoint is only available for the vehicle owner.
681
- * @param vehicle_tag VIN or id field of a vehicle
682
- */
683
- async drivers(vehicle_tag: string | number): Promise<Record<string, any>[]> {
684
- return this.parent._request("GET", `api/1/vehicles/${vehicle_tag}/drivers`).then(({ response }) => response);
685
- }
686
-
687
- /**
688
- * Removes driver access from a vehicle. Share users can only remove their own access. Owners can remove share access or their own.
689
- * @param vehicle_tag VIN or id field of a vehicle
690
- * @param share_user_id
691
- */
692
- async drivers_remove(vehicle_tag: string | number, share_user_id?: number): Promise<Record<string, any>> {
693
- return this.parent._request("DELETE", `api/1/vehicles/${vehicle_tag}/drivers`, null, { share_user_id });
694
- }
695
-
696
- /**
697
- * Returns eligible vehicle subscriptions.
698
- * @param vin Vehicle Identification Number
699
- */
700
- async eligible_subscriptions(vin: string): Promise<Record<string, any>> {
701
- return this.parent._request("GET", "/api/1/dx/vehicles/subscriptions/eligibility", { vin });
702
- }
703
-
704
- /**
705
- * Returns eligibile vehicle upgrades.
706
- * @param vin Vehicle Identification Number
707
- */
708
- async eligible_upgrades(vin: string): Promise<Record<string, any>> {
709
- return this.parent._request("GET", "/api/1/dx/vehicles/upgrades/eligibility", { vin });
710
- }
711
-
712
- /**
713
- * Checks whether vehicles can accept Tesla commands protocol for the partner's public key
714
- * @param vins list of Vehicle Identification Number
715
- * @returns
716
- */
717
- async fleet_status(vins: Array<string>): Promise<Record<string, any>> {
718
- return this.parent._request("POST", "api/1/vehicles/fleet_status", null, { vins });
719
- }
720
-
721
- /**
722
- * 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.
723
- * @param config A dictionary description the fleet telemetry configuration
724
- * @returns
725
- */
726
- async fleet_telemetry_config(config: FleetTelemetryConfig): Promise<Record<string, any>> {
727
- return this.parent._request("POST", "api/1/vehicles/fleet_telemetry_config", null, config);
728
- }
729
-
730
- /**
731
- * Disconnects vehicles to stream telemetry data to self hosted fleet-telemetry server.
732
- * @param vehicle_tag VIN or id field of a vehicle
733
- * @returns
734
- */
735
- async fleet_telemetry_config_delete(vehicle_tag: string | number): Promise<Record<string, any>> {
736
- return this.parent._request("DELETE", `api/1/vehicles/${vehicle_tag}/fleet_telemetry_config`);
737
- }
738
-
739
- /**
740
- * 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.
741
- * @param vehicle_tag VIN or id field of a vehicle
742
- * @returns
743
- */
744
- async fleet_telemetry_config_get(vehicle_tag: string | number): Promise<Record<string, any>> {
745
- return this.parent._request("GET", `api/1/vehicles/${vehicle_tag}/fleet_telemetry_config`);
746
- }
747
-
748
- /**
749
- * Returns vehicles belonging to the account.
750
- * @param page Page number
751
- * @param per_page Number of items per page
752
- */
753
- async list(page?: number, per_page?: number): Promise<Record<string, any>> {
754
- return this.parent._request("GET", "api/1/vehicles", { page, per_page });
755
- }
756
-
757
- /**
758
- * Returns whether or not mobile access is enabled for the vehicle.
759
- * @param vehicle_tag VIN or id field of a vehicle
760
- */
761
- async mobile_enabled(vehicle_tag: string | number): Promise<Record<string, any>> {
762
- return this.parent._request("GET", `api/1/vehicles/${vehicle_tag}/mobile_enabled`);
763
- }
764
-
765
- /**
766
- * Returns the charging sites near the current location of the vehicle.
767
- * @param vehicle_tag VIN or id field of a vehicle
768
- * @param count
769
- * @param radius
770
- * @param detail
771
- */
772
- async nearby_charging_sites(vehicle_tag: string | number, count?: number, radius?: number, detail?: boolean): Promise<Record<string, any>> {
773
- return this.parent._request("GET", `api/1/vehicles/${vehicle_tag}/nearby_charging_sites`, { count, radius, detail });
774
- }
775
-
776
- /**
777
- * Returns vehicle option details.
778
- * @param vin Vehicle Identification Number
779
- */
780
- async options(vin: string): Promise<OptionsResponse> {
781
- return this.parent._request("GET", "api/1/dx/vehicles/options", { vin }).then(({ codes }) => codes);
782
- }
783
-
784
- /**
785
- * List of recent alerts
786
- * @param vehicle_tag VIN or id field of a vehicle
787
- */
788
- async recent_alerts(vehicle_tag: string | number): Promise<Record<string, any>> {
789
- return this.parent._request("GET", `api/1/vehicles/${vehicle_tag}/recent_alerts`);
790
- }
791
-
792
- /**
793
- * Returns firmware release notes.
794
- * @param vehicle_tag VIN or id field of a vehicle
795
- * @param staged
796
- * @param language
797
- */
798
-
799
- async release_notes(vehicle_tag: string | number, staged?: boolean, language?: string): Promise<Record<string, any>> {
800
- return this.parent._request("GET", `api/1/vehicles/${vehicle_tag}/release_notes`, { staged, language });
801
- }
802
-
803
- /**
804
- * Returns service data.
805
- * @param vehicle_tag VIN or id field of a vehicle
806
- */
807
- async service_data(vehicle_tag: string | number): Promise<Record<string, any>> {
808
- return this.parent._request("GET", `api/1/vehicles/${vehicle_tag}/service_data`);
809
- }
810
-
811
- /**
812
- * Returns the share invites for a vehicle.
813
- * @param vehicle_tag VIN or id field of a vehicle
814
- */
815
- async share_invites(vehicle_tag: string | number): Promise<Record<string, any>> {
816
- return this.parent._request("GET", `api/1/vehicles/${vehicle_tag}/invitations`);
817
- }
818
-
819
- /**
820
- * Creates a share invite for a vehicle.
821
- * @param vehicle_tag VIN or id field of a vehicle
822
- */
823
- async share_invites_create(vehicle_tag: string | number): Promise<Record<string, any>> {
824
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/invitations`);
825
- }
826
-
827
- /**
828
- * Redeems a share invite.
829
- * @param code
830
- */
831
- async share_invites_redeem(code: string): Promise<Record<string, any>> {
832
- return this.parent._request("POST", "api/1/invitations/redeem", { code });
833
- }
834
-
835
- /**
836
- * Revokes a share invite.
837
- * @param vehicle_tag VIN or id field of a vehicle
838
- * @param id
839
- */
840
- async share_invites_revoke(vehicle_tag: string | number, id: string): Promise<Record<string, any>> {
841
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/invitations/${id}/revoke`);
842
- }
843
-
844
- /**
845
- * Signed Commands is a generic endpoint replacing legacy commands.
846
- * @param vehicle_tag VIN or id field of a vehicle
847
- * @param routable_message
848
- */
849
- async signed_command(vehicle_tag: string | number, routable_message: string): Promise<Record<string, any>> {
850
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/signed_command`, null, { routable_message });
851
- }
852
-
853
- /**
854
- * Returns information about a vehicle.
855
- * @param vehicle_tag VIN or id field of a vehicle
856
- */
857
- async vehicle(vehicle_tag: string | number): Promise<VehicleResponse> {
858
- return this.parent._request("GET", `api/1/vehicles/${vehicle_tag}`).then(({ response }) => response);
859
- }
860
-
861
- /**
862
- * 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.
863
- * @param vehicle_tag VIN or id field of a vehicle
864
- * @param endpoints
865
- */
866
- async vehicle_data(vehicle_tag: string | number, endpoints?: VehicleDataEndpoint[] | string): Promise<VehicleDataResponse> {
867
- if (typeof endpoints === "object") endpoints = endpoints.join(";");
868
- return this.parent._request("GET", `api/1/vehicles/${vehicle_tag}/vehicle_data`, { endpoints }).then(({ response }) => response);
869
- }
870
-
871
- /**
872
- * Wakes the vehicle from sleep, which is a state to minimize idle energy consumption.
873
- * @param vehicle_tag VIN or id field of a vehicle
874
- */
875
- async wake_up(vehicle_tag: string | number): Promise<Record<string, any>> {
876
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/wake_up`);
877
- }
878
-
879
- /**
880
- * Returns warranty details.
881
- * @param vin
882
- */
883
- async warranty_details(vin: string): Promise<Record<string, any>> {
884
- return this.parent._request("GET", "api/1/dx/warranty/details", { vin });
885
- }
886
- }