tesla-fleet-api 0.2.2 → 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 -14
  112. package/dist/index.js +0 -14
  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 -22
  153. package/dist/types/vehicle.js +0 -2
  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 -781
  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 -20
  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 -23
  188. package/src/types/vehicle_data.ts +0 -286
  189. package/src/user.ts +0 -35
  190. package/src/vehicle.ts +0 -895
  191. package/src/vehiclesigned.ts +0 -20
  192. package/src/vehiclespecific.ts +0 -818
@@ -0,0 +1,22 @@
1
+ // \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+ exports.__toESM = __toESM;
@@ -0,0 +1,12 @@
1
+ // \0rolldown/runtime.js
2
+ var __defProp = Object.defineProperty;
3
+ var __exportAll = (all, no_symbols) => {
4
+ let target = {};
5
+ for (var name in all) __defProp(target, name, {
6
+ get: all[name],
7
+ enumerable: true
8
+ });
9
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
10
+ return target;
11
+ };
12
+ export { __exportAll };
@@ -0,0 +1,53 @@
1
+ // src/charging.ts
2
+ var Charging = class {
3
+ parent;
4
+ constructor(parent) {
5
+ this.parent = parent;
6
+ }
7
+ /**
8
+ * Returns the paginated charging history.
9
+ * @param vin Vehicle Identification Number (VIN) of the selected vehicle.
10
+ * @param startTime Start time of the windows to download charging history for (i,e "2023-07-27T11:43:45-07:00").
11
+ * @param endTime End time of the windows to download charging history for (i,e "2023-07-28T11:43:45-07:00").
12
+ * @param pageNo Current page number.
13
+ * @param pageSize Number of records per page.
14
+ * @param sortBy Field to sort by.
15
+ * @param sortOrder Sort order (ASC or DESC).
16
+ */
17
+ async history(vin, startTime, endTime, pageNo, pageSize, sortBy, sortOrder) {
18
+ return await this.parent._request("GET", "api/1/dx/charging/history", {
19
+ vin,
20
+ startTime,
21
+ endTime,
22
+ pageNo,
23
+ pageSize,
24
+ sortBy,
25
+ sortOrder
26
+ });
27
+ }
28
+ /**
29
+ * Returns a charging invoice pdf for an event from charging history.
30
+ * @param id Content ID. This can be obtained from the invoices.contentId of a charging history event.
31
+ */
32
+ async invoice(id) {
33
+ return await this.parent._request("GET", `api/1/dx/charging/invoices/${id}`);
34
+ }
35
+ /**
36
+ * Returns the charging session information including pricing and energy data. This endpoint is only available for business accounts that own a fleet of vehicles.
37
+ * @param vin Vehicle Identification Number (VIN) of the selected vehicle.
38
+ * @param date_from Start date of the windows to download charging sessions.
39
+ * @param date_to End date of the windows to download charging sessions.
40
+ * @param limit Number of entities to be returned.
41
+ * @param offset Number of entities to be skipped.
42
+ */
43
+ async sessions(vin, date_from, date_to, limit, offset) {
44
+ return await this.parent._request("GET", "api/1/dx/charging/sessions", {
45
+ vin,
46
+ date_from,
47
+ date_to,
48
+ limit,
49
+ offset
50
+ });
51
+ }
52
+ };
53
+ exports.default = Charging;
@@ -0,0 +1,31 @@
1
+ import TeslaFleetApi from "./teslafleetapi.cjs";
2
+ declare class Charging {
3
+ parent: TeslaFleetApi;
4
+ constructor(parent: TeslaFleetApi);
5
+ /**
6
+ * Returns the paginated charging history.
7
+ * @param vin Vehicle Identification Number (VIN) of the selected vehicle.
8
+ * @param startTime Start time of the windows to download charging history for (i,e "2023-07-27T11:43:45-07:00").
9
+ * @param endTime End time of the windows to download charging history for (i,e "2023-07-28T11:43:45-07:00").
10
+ * @param pageNo Current page number.
11
+ * @param pageSize Number of records per page.
12
+ * @param sortBy Field to sort by.
13
+ * @param sortOrder Sort order (ASC or DESC).
14
+ */
15
+ history(vin?: string, startTime?: string, endTime?: string, pageNo?: number, pageSize?: number, sortBy?: string, sortOrder?: string): Promise<Record<string, any>>;
16
+ /**
17
+ * Returns a charging invoice pdf for an event from charging history.
18
+ * @param id Content ID. This can be obtained from the invoices.contentId of a charging history event.
19
+ */
20
+ invoice(id: string): Promise<Record<string, any>>;
21
+ /**
22
+ * Returns the charging session information including pricing and energy data. This endpoint is only available for business accounts that own a fleet of vehicles.
23
+ * @param vin Vehicle Identification Number (VIN) of the selected vehicle.
24
+ * @param date_from Start date of the windows to download charging sessions.
25
+ * @param date_to End date of the windows to download charging sessions.
26
+ * @param limit Number of entities to be returned.
27
+ * @param offset Number of entities to be skipped.
28
+ */
29
+ sessions(vin?: string, date_from?: string, date_to?: string, limit?: number, offset?: number): Promise<Record<string, any>>;
30
+ }
31
+ export = Charging;
@@ -0,0 +1,30 @@
1
+ import TeslaFleetApi from "./teslafleetapi.mjs";
2
+ export default class Charging {
3
+ parent: TeslaFleetApi;
4
+ constructor(parent: TeslaFleetApi);
5
+ /**
6
+ * Returns the paginated charging history.
7
+ * @param vin Vehicle Identification Number (VIN) of the selected vehicle.
8
+ * @param startTime Start time of the windows to download charging history for (i,e "2023-07-27T11:43:45-07:00").
9
+ * @param endTime End time of the windows to download charging history for (i,e "2023-07-28T11:43:45-07:00").
10
+ * @param pageNo Current page number.
11
+ * @param pageSize Number of records per page.
12
+ * @param sortBy Field to sort by.
13
+ * @param sortOrder Sort order (ASC or DESC).
14
+ */
15
+ history(vin?: string, startTime?: string, endTime?: string, pageNo?: number, pageSize?: number, sortBy?: string, sortOrder?: string): Promise<Record<string, any>>;
16
+ /**
17
+ * Returns a charging invoice pdf for an event from charging history.
18
+ * @param id Content ID. This can be obtained from the invoices.contentId of a charging history event.
19
+ */
20
+ invoice(id: string): Promise<Record<string, any>>;
21
+ /**
22
+ * Returns the charging session information including pricing and energy data. This endpoint is only available for business accounts that own a fleet of vehicles.
23
+ * @param vin Vehicle Identification Number (VIN) of the selected vehicle.
24
+ * @param date_from Start date of the windows to download charging sessions.
25
+ * @param date_to End date of the windows to download charging sessions.
26
+ * @param limit Number of entities to be returned.
27
+ * @param offset Number of entities to be skipped.
28
+ */
29
+ sessions(vin?: string, date_from?: string, date_to?: string, limit?: number, offset?: number): Promise<Record<string, any>>;
30
+ }
@@ -0,0 +1,53 @@
1
+ // src/charging.ts
2
+ var Charging = class {
3
+ parent;
4
+ constructor(parent) {
5
+ this.parent = parent;
6
+ }
7
+ /**
8
+ * Returns the paginated charging history.
9
+ * @param vin Vehicle Identification Number (VIN) of the selected vehicle.
10
+ * @param startTime Start time of the windows to download charging history for (i,e "2023-07-27T11:43:45-07:00").
11
+ * @param endTime End time of the windows to download charging history for (i,e "2023-07-28T11:43:45-07:00").
12
+ * @param pageNo Current page number.
13
+ * @param pageSize Number of records per page.
14
+ * @param sortBy Field to sort by.
15
+ * @param sortOrder Sort order (ASC or DESC).
16
+ */
17
+ async history(vin, startTime, endTime, pageNo, pageSize, sortBy, sortOrder) {
18
+ return await this.parent._request("GET", "api/1/dx/charging/history", {
19
+ vin,
20
+ startTime,
21
+ endTime,
22
+ pageNo,
23
+ pageSize,
24
+ sortBy,
25
+ sortOrder
26
+ });
27
+ }
28
+ /**
29
+ * Returns a charging invoice pdf for an event from charging history.
30
+ * @param id Content ID. This can be obtained from the invoices.contentId of a charging history event.
31
+ */
32
+ async invoice(id) {
33
+ return await this.parent._request("GET", `api/1/dx/charging/invoices/${id}`);
34
+ }
35
+ /**
36
+ * Returns the charging session information including pricing and energy data. This endpoint is only available for business accounts that own a fleet of vehicles.
37
+ * @param vin Vehicle Identification Number (VIN) of the selected vehicle.
38
+ * @param date_from Start date of the windows to download charging sessions.
39
+ * @param date_to End date of the windows to download charging sessions.
40
+ * @param limit Number of entities to be returned.
41
+ * @param offset Number of entities to be skipped.
42
+ */
43
+ async sessions(vin, date_from, date_to, limit, offset) {
44
+ return await this.parent._request("GET", "api/1/dx/charging/sessions", {
45
+ vin,
46
+ date_from,
47
+ date_to,
48
+ limit,
49
+ offset
50
+ });
51
+ }
52
+ };
53
+ export { Charging as default };