tesla-fleet-api 0.0.6 → 0.0.7
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.
- package/dist/charging.d.ts +22 -0
- package/dist/charging.js +22 -0
- package/dist/charging.js.map +1 -1
- package/dist/energy.d.ts +75 -0
- package/dist/energy.js +76 -0
- package/dist/energy.js.map +1 -1
- package/dist/energyspecific.d.ts +59 -0
- package/dist/energyspecific.js +60 -0
- package/dist/energyspecific.js.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/partner.d.ts +15 -0
- package/dist/partner.js +16 -0
- package/dist/partner.js.map +1 -1
- package/dist/teslafleetapi.d.ts +8 -0
- package/dist/teslafleetapi.js +9 -0
- package/dist/teslafleetapi.js.map +1 -1
- package/dist/teslemetry.d.ts +7 -0
- package/dist/teslemetry.js +7 -0
- package/dist/teslemetry.js.map +1 -1
- package/dist/tessie.d.ts +3 -0
- package/dist/tessie.js +3 -0
- package/dist/tessie.js.map +1 -1
- package/dist/user.d.ts +5 -0
- package/dist/user.js +5 -0
- package/dist/user.js.map +1 -1
- package/dist/vehicle.d.ts +437 -0
- package/dist/vehicle.js +439 -0
- package/dist/vehicle.js.map +1 -1
- package/dist/vehiclespecific.d.ts +346 -2
- package/dist/vehiclespecific.js +349 -7
- package/dist/vehiclespecific.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +5 -1
- package/src/vehiclespecific.ts +4 -19
package/dist/charging.d.ts
CHANGED
|
@@ -2,7 +2,29 @@ import TeslaFleetApi from "./teslafleetapi.js";
|
|
|
2
2
|
export default class Charging {
|
|
3
3
|
parent: TeslaFleetApi;
|
|
4
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
|
+
*/
|
|
5
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
|
+
*/
|
|
6
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
|
+
*/
|
|
7
29
|
sessions(vin?: string, date_from?: string, date_to?: string, limit?: number, offset?: number): Promise<Record<string, any>>;
|
|
8
30
|
}
|
package/dist/charging.js
CHANGED
|
@@ -2,6 +2,16 @@ export default class Charging {
|
|
|
2
2
|
constructor(parent) {
|
|
3
3
|
this.parent = parent;
|
|
4
4
|
}
|
|
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
|
+
*/
|
|
5
15
|
async history(vin, startTime, endTime, pageNo, pageSize, sortBy, sortOrder) {
|
|
6
16
|
return await this.parent._request("GET", "api/1/dx/charging/history", {
|
|
7
17
|
vin,
|
|
@@ -13,9 +23,21 @@ export default class Charging {
|
|
|
13
23
|
sortOrder,
|
|
14
24
|
});
|
|
15
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Returns a charging invoice pdf for an event from charging history.
|
|
28
|
+
* @param id Content ID. This can be obtained from the invoices.contentId of a charging history event.
|
|
29
|
+
*/
|
|
16
30
|
async invoice(id) {
|
|
17
31
|
return await this.parent._request("GET", `api/1/dx/charging/invoices/${id}`);
|
|
18
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Returns the charging session information including pricing and energy data. This endpoint is only available for business accounts that own a fleet of vehicles.
|
|
35
|
+
* @param vin Vehicle Identification Number (VIN) of the selected vehicle.
|
|
36
|
+
* @param date_from Start date of the windows to download charging sessions.
|
|
37
|
+
* @param date_to End date of the windows to download charging sessions.
|
|
38
|
+
* @param limit Number of entities to be returned.
|
|
39
|
+
* @param offset Number of entities to be skipped.
|
|
40
|
+
*/
|
|
19
41
|
async sessions(vin, date_from, date_to, limit, offset) {
|
|
20
42
|
return await this.parent._request("GET", "api/1/dx/charging/sessions", {
|
|
21
43
|
vin,
|
package/dist/charging.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"charging.js","sourceRoot":"","sources":["../src/charging.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,OAAO,QAAQ;IAGzB,YAAY,MAAqB;QAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;
|
|
1
|
+
{"version":3,"file":"charging.js","sourceRoot":"","sources":["../src/charging.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,OAAO,QAAQ;IAGzB,YAAY,MAAqB;QAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,OAAO,CACT,GAAY,EACZ,SAAkB,EAClB,OAAgB,EAChB,MAAe,EACf,QAAiB,EACjB,MAAe,EACf,SAAkB;QAElB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,2BAA2B,EAAE;YAClE,GAAG;YACH,SAAS;YACT,OAAO;YACP,MAAM;YACN,QAAQ;YACR,MAAM;YACN,SAAS;SACZ,CAAC,CAAC;IACP,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,OAAO,CAAC,EAAU;QACpB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,8BAA8B,EAAE,EAAE,CAAC,CAAC;IACjF,CAAC;IAED;;;;;;;OAOG;IAEH,KAAK,CAAC,QAAQ,CAAC,GAAY,EAAE,SAAkB,EAAE,OAAgB,EAAE,KAAc,EAAE,MAAe;QAC9F,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,4BAA4B,EAAE;YACnE,GAAG;YACH,SAAS;YACT,OAAO;YACP,KAAK;YACL,MAAM;SACT,CAAC,CAAC;IACP,CAAC;CACJ"}
|
package/dist/energy.d.ts
CHANGED
|
@@ -3,15 +3,90 @@ import TeslaFleetApi from "./teslafleetapi.js";
|
|
|
3
3
|
export default class Energy {
|
|
4
4
|
parent: TeslaFleetApi;
|
|
5
5
|
constructor(parent: TeslaFleetApi);
|
|
6
|
+
/**
|
|
7
|
+
* Create an Energy class for a specific site.
|
|
8
|
+
* @param energy_site_id ID field of an energy site from /api/1/products endpoint.
|
|
9
|
+
* @returns `EnergySpecific` class
|
|
10
|
+
*/
|
|
6
11
|
specific(energy_site_id: number): EnergySpecific;
|
|
12
|
+
/**
|
|
13
|
+
* Adjust the site's backup reserve.
|
|
14
|
+
* @param energy_site_id ID field of an energy site from /api/1/products endpoint.ID field of an energy site from /api/1/products endpoint.
|
|
15
|
+
* @param backup_reserve_percent The desired backup reserve percent.
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
7
18
|
backup(energy_site_id: number, backup_reserve_percent: number): Promise<Record<string, any>>;
|
|
19
|
+
/**
|
|
20
|
+
* Returns the backup (off-grid) event history of the site in duration of seconds.
|
|
21
|
+
* @param energy_site_id ID field of an energy site from /api/1/products endpoint.
|
|
22
|
+
* @param kind The kind of history to be requested. 'backup', 'charge', 'energy' are all supported.
|
|
23
|
+
* @param start_date Start date of the window to retrieve backup events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00
|
|
24
|
+
* @param end_date End date of the window to retrieve backup events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00
|
|
25
|
+
* @param period Period of the window to retrieve backup events. This can be day, week, month, year, lifetime and should align with the window requested.
|
|
26
|
+
* @param time_zone Timezone of the requested window in IANA name format. i.e. 'America/Los_Angeles'
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
8
29
|
backup_history(energy_site_id: number, kind: string, start_date: string, end_date: string, period: string, time_zone: string): Promise<Record<string, any>>;
|
|
30
|
+
/**
|
|
31
|
+
* Returns the charging history of a wall connector.
|
|
32
|
+
* @param energy_site_id ID field of an energy site from /api/1/products endpoint.
|
|
33
|
+
* @param kind The kind of history to be requested. 'backup', 'charge', 'energy' are all supported.
|
|
34
|
+
* @param start_date Start date of the window to retrieve backup events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00
|
|
35
|
+
* @param end_date End date of the window to retrieve backup events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00
|
|
36
|
+
* @param time_zone Timezone of the requested window in IANA name format. i.e. 'America/Los_Angeles'
|
|
37
|
+
* @returns
|
|
38
|
+
*/
|
|
9
39
|
charge_history(energy_site_id: number, kind: string, start_date: string, end_date: string, time_zone: string): Promise<Record<string, any>>;
|
|
40
|
+
/**
|
|
41
|
+
* Returns the energy measurements of the site, aggregated to the requested period.
|
|
42
|
+
* @param energy_site_id ID field of an energy site from /api/1/products endpoint.
|
|
43
|
+
* @param kind The kind of history to be requested. 'backup', 'charge', 'energy' are all supported.
|
|
44
|
+
* @param start_dateStart date of the window to retrieve backup events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00
|
|
45
|
+
* @param end_date End date of the window to retrieve backup events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00
|
|
46
|
+
* @param period Period of the window to retrieve backup events. This can be day, week, month, year, lifetime and should align with the window requested.
|
|
47
|
+
* @param time_zone Timezone of the requested window in IANA name format. i.e. 'America/Los_Angeles'
|
|
48
|
+
* @returns
|
|
49
|
+
*/
|
|
10
50
|
energy_history(energy_site_id: number, kind: string, start_date: string, end_date: string, period: string, time_zone: string): Promise<Record<string, any>>;
|
|
51
|
+
/**
|
|
52
|
+
* Allow/disallow charging from the grid and exporting energy to the grid.
|
|
53
|
+
* @param energy_site_id
|
|
54
|
+
* @param disallow_charge_from_grid_with_solar_installed The desired behavior towards importing from the grid. Charging from the grid is disabled when set to true and enabled when set to false.
|
|
55
|
+
* @param customer_preferred_export_rule The desired behavior for grid exporting. The available options are battery_ok, pv_only, and never.
|
|
56
|
+
* @returns
|
|
57
|
+
*/
|
|
11
58
|
grid_import_export(energy_site_id: number, disallow_charge_from_grid_with_solar_installed?: boolean | null, customer_preferred_export_rule?: string | null): Promise<Record<string, any>>;
|
|
59
|
+
/**
|
|
60
|
+
* Returns the live status of the site (power, state of energy, grid status, storm mode).
|
|
61
|
+
* @param energy_site_id
|
|
62
|
+
* @returns
|
|
63
|
+
*/
|
|
12
64
|
live_status(energy_site_id: number): Promise<Record<string, any>>;
|
|
65
|
+
/**
|
|
66
|
+
* Adjust the site's off-grid vehicle charging backup reserve.
|
|
67
|
+
* @param energy_site_id ID field of an energy site from /api/1/products endpoint.
|
|
68
|
+
* @param off_grid_vehicle_charging_reserve_percent The desired off grid vehicle charging reserve percent.
|
|
69
|
+
* @returns
|
|
70
|
+
*/
|
|
13
71
|
off_grid_vehicle_charging_reserve(energy_site_id: number, off_grid_vehicle_charging_reserve_percent: number): Promise<Record<string, any>>;
|
|
72
|
+
/**
|
|
73
|
+
* Set the site's mode.
|
|
74
|
+
* @param energy_site_id ID field of an energy site from /api/1/products endpoint.
|
|
75
|
+
* @param default_real_mode The desired operation mode. Use autonomous for time-based control and self_consumption for self-powered mode.
|
|
76
|
+
* @returns
|
|
77
|
+
*/
|
|
14
78
|
operation(energy_site_id: number, default_real_mode: string): Promise<Record<string, any>>;
|
|
79
|
+
/**
|
|
80
|
+
* Returns information about the site. Things like assets (has solar, etc), settings (backup reserve, etc), and features (storm_mode_capable, etc).
|
|
81
|
+
* @param energy_site_id ID field of an energy site from /api/1/products endpoint.
|
|
82
|
+
* @returns
|
|
83
|
+
*/
|
|
15
84
|
site_info(energy_site_id: number): Promise<Record<string, any>>;
|
|
85
|
+
/**
|
|
86
|
+
* Update storm watch participation.
|
|
87
|
+
* @param energy_site_id ID field of an energy site from /api/1/products endpoint.
|
|
88
|
+
* @param enabled The storm mode participation value to set.
|
|
89
|
+
* @returns
|
|
90
|
+
*/
|
|
16
91
|
storm_mode(energy_site_id: number, enabled: boolean): Promise<Record<string, any>>;
|
|
17
92
|
}
|
package/dist/energy.js
CHANGED
|
@@ -1,43 +1,119 @@
|
|
|
1
1
|
import EnergySpecific from "./energyspecific.js";
|
|
2
|
+
// Energy Class
|
|
2
3
|
export default class Energy {
|
|
3
4
|
constructor(parent) {
|
|
4
5
|
this.parent = parent;
|
|
5
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* Create an Energy class for a specific site.
|
|
9
|
+
* @param energy_site_id ID field of an energy site from /api/1/products endpoint.
|
|
10
|
+
* @returns `EnergySpecific` class
|
|
11
|
+
*/
|
|
6
12
|
specific(energy_site_id) {
|
|
7
13
|
return new EnergySpecific(this, energy_site_id);
|
|
8
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Adjust the site's backup reserve.
|
|
17
|
+
* @param energy_site_id ID field of an energy site from /api/1/products endpoint.ID field of an energy site from /api/1/products endpoint.
|
|
18
|
+
* @param backup_reserve_percent The desired backup reserve percent.
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
9
21
|
async backup(energy_site_id, backup_reserve_percent) {
|
|
10
22
|
return this.parent._request("POST", `api/1/energy_sites/${energy_site_id}/backup`, null, { backup_reserve_percent });
|
|
11
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Returns the backup (off-grid) event history of the site in duration of seconds.
|
|
26
|
+
* @param energy_site_id ID field of an energy site from /api/1/products endpoint.
|
|
27
|
+
* @param kind The kind of history to be requested. 'backup', 'charge', 'energy' are all supported.
|
|
28
|
+
* @param start_date Start date of the window to retrieve backup events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00
|
|
29
|
+
* @param end_date End date of the window to retrieve backup events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00
|
|
30
|
+
* @param period Period of the window to retrieve backup events. This can be day, week, month, year, lifetime and should align with the window requested.
|
|
31
|
+
* @param time_zone Timezone of the requested window in IANA name format. i.e. 'America/Los_Angeles'
|
|
32
|
+
* @returns
|
|
33
|
+
*/
|
|
12
34
|
async backup_history(energy_site_id, kind, start_date, end_date, period, time_zone) {
|
|
13
35
|
return this.parent._request("GET", `api/1/energy_sites/${energy_site_id}/calendar_history`, null, { kind, start_date, end_date, period, time_zone });
|
|
14
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Returns the charging history of a wall connector.
|
|
39
|
+
* @param energy_site_id ID field of an energy site from /api/1/products endpoint.
|
|
40
|
+
* @param kind The kind of history to be requested. 'backup', 'charge', 'energy' are all supported.
|
|
41
|
+
* @param start_date Start date of the window to retrieve backup events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00
|
|
42
|
+
* @param end_date End date of the window to retrieve backup events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00
|
|
43
|
+
* @param time_zone Timezone of the requested window in IANA name format. i.e. 'America/Los_Angeles'
|
|
44
|
+
* @returns
|
|
45
|
+
*/
|
|
15
46
|
async charge_history(energy_site_id, kind, start_date, end_date, time_zone) {
|
|
16
47
|
return this.parent._request("GET", `api/1/energy_sites/${energy_site_id}/telemetry_history`, null, { kind, start_date, end_date, time_zone });
|
|
17
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Returns the energy measurements of the site, aggregated to the requested period.
|
|
51
|
+
* @param energy_site_id ID field of an energy site from /api/1/products endpoint.
|
|
52
|
+
* @param kind The kind of history to be requested. 'backup', 'charge', 'energy' are all supported.
|
|
53
|
+
* @param start_dateStart date of the window to retrieve backup events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00
|
|
54
|
+
* @param end_date End date of the window to retrieve backup events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00
|
|
55
|
+
* @param period Period of the window to retrieve backup events. This can be day, week, month, year, lifetime and should align with the window requested.
|
|
56
|
+
* @param time_zone Timezone of the requested window in IANA name format. i.e. 'America/Los_Angeles'
|
|
57
|
+
* @returns
|
|
58
|
+
*/
|
|
18
59
|
async energy_history(energy_site_id, kind, start_date, end_date, period, time_zone) {
|
|
19
60
|
return this.parent._request("GET", `api/1/energy_sites/${energy_site_id}/calendar_history`, null, { kind, start_date, end_date, period, time_zone });
|
|
20
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Allow/disallow charging from the grid and exporting energy to the grid.
|
|
64
|
+
* @param energy_site_id
|
|
65
|
+
* @param disallow_charge_from_grid_with_solar_installed The desired behavior towards importing from the grid. Charging from the grid is disabled when set to true and enabled when set to false.
|
|
66
|
+
* @param customer_preferred_export_rule The desired behavior for grid exporting. The available options are battery_ok, pv_only, and never.
|
|
67
|
+
* @returns
|
|
68
|
+
*/
|
|
21
69
|
async grid_import_export(energy_site_id, disallow_charge_from_grid_with_solar_installed = null, customer_preferred_export_rule = null) {
|
|
22
70
|
return this.parent._request("POST", `api/1/energy_sites/${energy_site_id}/grid_import_export`, null, {
|
|
23
71
|
disallow_charge_from_grid_with_solar_installed,
|
|
24
72
|
customer_preferred_export_rule,
|
|
25
73
|
});
|
|
26
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Returns the live status of the site (power, state of energy, grid status, storm mode).
|
|
77
|
+
* @param energy_site_id
|
|
78
|
+
* @returns
|
|
79
|
+
*/
|
|
27
80
|
async live_status(energy_site_id) {
|
|
28
81
|
return this.parent._request("GET", `api/1/energy_sites/${energy_site_id}/live_status`);
|
|
29
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Adjust the site's off-grid vehicle charging backup reserve.
|
|
85
|
+
* @param energy_site_id ID field of an energy site from /api/1/products endpoint.
|
|
86
|
+
* @param off_grid_vehicle_charging_reserve_percent The desired off grid vehicle charging reserve percent.
|
|
87
|
+
* @returns
|
|
88
|
+
*/
|
|
30
89
|
async off_grid_vehicle_charging_reserve(energy_site_id, off_grid_vehicle_charging_reserve_percent) {
|
|
31
90
|
return this.parent._request("POST", `api/1/energy_sites/${energy_site_id}/off_grid_vehicle_charging_reserve`, null, {
|
|
32
91
|
off_grid_vehicle_charging_reserve_percent,
|
|
33
92
|
});
|
|
34
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Set the site's mode.
|
|
96
|
+
* @param energy_site_id ID field of an energy site from /api/1/products endpoint.
|
|
97
|
+
* @param default_real_mode The desired operation mode. Use autonomous for time-based control and self_consumption for self-powered mode.
|
|
98
|
+
* @returns
|
|
99
|
+
*/
|
|
35
100
|
async operation(energy_site_id, default_real_mode) {
|
|
36
101
|
return this.parent._request("POST", `api/1/energy_sites/${energy_site_id}/operation`, null, { default_real_mode });
|
|
37
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* Returns information about the site. Things like assets (has solar, etc), settings (backup reserve, etc), and features (storm_mode_capable, etc).
|
|
105
|
+
* @param energy_site_id ID field of an energy site from /api/1/products endpoint.
|
|
106
|
+
* @returns
|
|
107
|
+
*/
|
|
38
108
|
async site_info(energy_site_id) {
|
|
39
109
|
return this.parent._request("GET", `api/1/energy_sites/${energy_site_id}/site_info`);
|
|
40
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* Update storm watch participation.
|
|
113
|
+
* @param energy_site_id ID field of an energy site from /api/1/products endpoint.
|
|
114
|
+
* @param enabled The storm mode participation value to set.
|
|
115
|
+
* @returns
|
|
116
|
+
*/
|
|
41
117
|
async storm_mode(energy_site_id, enabled) {
|
|
42
118
|
return this.parent._request("POST", `api/1/energy_sites/${energy_site_id}/storm_mode`, null, { enabled });
|
|
43
119
|
}
|
package/dist/energy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"energy.js","sourceRoot":"","sources":["../src/energy.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"energy.js","sourceRoot":"","sources":["../src/energy.ts"],"names":[],"mappings":"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"}
|
package/dist/energyspecific.d.ts
CHANGED
|
@@ -3,14 +3,73 @@ export default class EnergySpecific {
|
|
|
3
3
|
parent: Energy;
|
|
4
4
|
energy_site_id: number;
|
|
5
5
|
constructor(parent: Energy, energy_site_id: number);
|
|
6
|
+
/**
|
|
7
|
+
* Adjust the site's backup reserve.
|
|
8
|
+
* @param backup_reserve_percent The desired backup reserve percent.
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
6
11
|
backup(backup_reserve_percent: number): Promise<Record<string, any>>;
|
|
12
|
+
/**
|
|
13
|
+
* Returns the backup (off-grid) event history of the site in duration of seconds.
|
|
14
|
+
* @param kind The kind of history to be requested. 'backup', 'charge', 'energy' are all supported.
|
|
15
|
+
* @param start_date Start date of the window to retrieve backup events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00
|
|
16
|
+
* @param end_date End date of the window to retrieve backup events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00
|
|
17
|
+
* @param period Period of the window to retrieve backup events. This can be day, week, month, year, lifetime and should align with the window requested.
|
|
18
|
+
* @param time_zone Timezone of the requested window in IANA name format. i.e. 'America/Los_Angeles'
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
7
21
|
backup_history(kind: string, start_date: string, end_date: string, period: string, time_zone: string): Promise<Record<string, any>>;
|
|
22
|
+
/**
|
|
23
|
+
* Returns the charging history of a wall connector.
|
|
24
|
+
* @param kind The kind of history to be requested. 'backup', 'charge', 'energy' are all supported.
|
|
25
|
+
* @param start_date Start date of the window to retrieve backup events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00
|
|
26
|
+
* @param end_date End date of the window to retrieve backup events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00
|
|
27
|
+
* @param time_zone Timezone of the requested window in IANA name format. i.e. 'America/Los_Angeles'
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
8
30
|
charge_history(kind: string, start_date: string, end_date: string, time_zone: string): Promise<Record<string, any>>;
|
|
31
|
+
/**
|
|
32
|
+
* Returns the energy history of the site in duration of seconds.
|
|
33
|
+
* @param kind The kind of history to be requested. 'backup', 'charge', 'energy' are all supported.
|
|
34
|
+
* @param start_date Start date of the window to retrieve backup events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00
|
|
35
|
+
* @param end_date End date of the window to retrieve backup events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00
|
|
36
|
+
* @param period Period of the window to retrieve backup events. This can be day, week, month, year, lifetime and should align with the window requested.
|
|
37
|
+
* @param time_zone Timezone of the requested window in IANA name format. i.e. 'America/Los_Angeles'
|
|
38
|
+
* @returns
|
|
39
|
+
*/
|
|
9
40
|
energy_history(kind: string, start_date: string, end_date: string, period: string, time_zone: string): Promise<Record<string, any>>;
|
|
41
|
+
/**
|
|
42
|
+
* Allow/disallow charging from the grid and exporting energy to the grid.
|
|
43
|
+
* @param disallow_charge_from_grid_with_solar_installed The desired behavior towards importing from the grid. Charging from the grid is disabled when set to true and enabled when set to false.
|
|
44
|
+
* @param customer_preferred_export_rule The desired behavior for grid exporting. The available options are battery_ok, pv_only, and never.
|
|
45
|
+
* @returns
|
|
46
|
+
*/
|
|
10
47
|
grid_import_export(disallow_charge_from_grid_with_solar_installed?: boolean | null, customer_preferred_export_rule?: string | null): Promise<Record<string, any>>;
|
|
48
|
+
/**
|
|
49
|
+
* Returns the live status of the site.
|
|
50
|
+
* @returns
|
|
51
|
+
*/
|
|
11
52
|
live_status(): Promise<Record<string, any>>;
|
|
53
|
+
/**
|
|
54
|
+
* Adjust the site's off-grid vehicle charging backup reserve.
|
|
55
|
+
* @param off_grid_vehicle_charging_reserve_percent The desired off grid vehicle charging reserve percent.
|
|
56
|
+
* @returns
|
|
57
|
+
*/
|
|
12
58
|
off_grid_vehicle_charging_reserve(off_grid_vehicle_charging_reserve_percent: number): Promise<Record<string, any>>;
|
|
59
|
+
/**
|
|
60
|
+
* Set the site's mode.
|
|
61
|
+
* @param default_real_mode
|
|
62
|
+
* @returns
|
|
63
|
+
*/
|
|
13
64
|
operation(default_real_mode: string): Promise<Record<string, any>>;
|
|
65
|
+
/**
|
|
66
|
+
* Returns information about the site. Things like assets (has solar, etc), settings (backup reserve, etc), and features (storm_mode_capable, etc).
|
|
67
|
+
*/
|
|
14
68
|
site_info(): Promise<Record<string, any>>;
|
|
69
|
+
/**
|
|
70
|
+
* Update storm watch participation.
|
|
71
|
+
* @param enabled The storm mode participation value to set.
|
|
72
|
+
* @returns
|
|
73
|
+
*/
|
|
15
74
|
storm_mode(enabled: boolean): Promise<Record<string, any>>;
|
|
16
75
|
}
|
package/dist/energyspecific.js
CHANGED
|
@@ -1,11 +1,26 @@
|
|
|
1
|
+
// Energy Class
|
|
1
2
|
export default class EnergySpecific {
|
|
2
3
|
constructor(parent, energy_site_id) {
|
|
3
4
|
this.parent = parent;
|
|
4
5
|
this.energy_site_id = energy_site_id;
|
|
5
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* Adjust the site's backup reserve.
|
|
9
|
+
* @param backup_reserve_percent The desired backup reserve percent.
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
6
12
|
async backup(backup_reserve_percent) {
|
|
7
13
|
return this.parent.parent._request("POST", `api/1/energy_sites/${this.energy_site_id}/backup`, null, { backup_reserve_percent });
|
|
8
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Returns the backup (off-grid) event history of the site in duration of seconds.
|
|
17
|
+
* @param kind The kind of history to be requested. 'backup', 'charge', 'energy' are all supported.
|
|
18
|
+
* @param start_date Start date of the window to retrieve backup events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00
|
|
19
|
+
* @param end_date End date of the window to retrieve backup events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00
|
|
20
|
+
* @param period Period of the window to retrieve backup events. This can be day, week, month, year, lifetime and should align with the window requested.
|
|
21
|
+
* @param time_zone Timezone of the requested window in IANA name format. i.e. 'America/Los_Angeles'
|
|
22
|
+
* @returns
|
|
23
|
+
*/
|
|
9
24
|
async backup_history(kind, start_date, end_date, period, time_zone) {
|
|
10
25
|
return this.parent.parent._request("GET", `api/1/energy_sites/${this.energy_site_id}/calendar_history`, null, {
|
|
11
26
|
kind,
|
|
@@ -15,6 +30,14 @@ export default class EnergySpecific {
|
|
|
15
30
|
time_zone,
|
|
16
31
|
});
|
|
17
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Returns the charging history of a wall connector.
|
|
35
|
+
* @param kind The kind of history to be requested. 'backup', 'charge', 'energy' are all supported.
|
|
36
|
+
* @param start_date Start date of the window to retrieve backup events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00
|
|
37
|
+
* @param end_date End date of the window to retrieve backup events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00
|
|
38
|
+
* @param time_zone Timezone of the requested window in IANA name format. i.e. 'America/Los_Angeles'
|
|
39
|
+
* @returns
|
|
40
|
+
*/
|
|
18
41
|
async charge_history(kind, start_date, end_date, time_zone) {
|
|
19
42
|
return this.parent.parent._request("GET", `api/1/energy_sites/${this.energy_site_id}/telemetry_history`, null, {
|
|
20
43
|
kind,
|
|
@@ -23,6 +46,15 @@ export default class EnergySpecific {
|
|
|
23
46
|
time_zone,
|
|
24
47
|
});
|
|
25
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Returns the energy history of the site in duration of seconds.
|
|
51
|
+
* @param kind The kind of history to be requested. 'backup', 'charge', 'energy' are all supported.
|
|
52
|
+
* @param start_date Start date of the window to retrieve backup events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00
|
|
53
|
+
* @param end_date End date of the window to retrieve backup events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00
|
|
54
|
+
* @param period Period of the window to retrieve backup events. This can be day, week, month, year, lifetime and should align with the window requested.
|
|
55
|
+
* @param time_zone Timezone of the requested window in IANA name format. i.e. 'America/Los_Angeles'
|
|
56
|
+
* @returns
|
|
57
|
+
*/
|
|
26
58
|
async energy_history(kind, start_date, end_date, period, time_zone) {
|
|
27
59
|
return this.parent.parent._request("GET", `api/1/energy_sites/${this.energy_site_id}/calendar_history`, null, {
|
|
28
60
|
kind,
|
|
@@ -32,26 +64,54 @@ export default class EnergySpecific {
|
|
|
32
64
|
time_zone,
|
|
33
65
|
});
|
|
34
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Allow/disallow charging from the grid and exporting energy to the grid.
|
|
69
|
+
* @param disallow_charge_from_grid_with_solar_installed The desired behavior towards importing from the grid. Charging from the grid is disabled when set to true and enabled when set to false.
|
|
70
|
+
* @param customer_preferred_export_rule The desired behavior for grid exporting. The available options are battery_ok, pv_only, and never.
|
|
71
|
+
* @returns
|
|
72
|
+
*/
|
|
35
73
|
async grid_import_export(disallow_charge_from_grid_with_solar_installed = null, customer_preferred_export_rule = null) {
|
|
36
74
|
return this.parent.parent._request("POST", `api/1/energy_sites/${this.energy_site_id}/grid_import_export`, null, {
|
|
37
75
|
disallow_charge_from_grid_with_solar_installed,
|
|
38
76
|
customer_preferred_export_rule,
|
|
39
77
|
});
|
|
40
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Returns the live status of the site.
|
|
81
|
+
* @returns
|
|
82
|
+
*/
|
|
41
83
|
async live_status() {
|
|
42
84
|
return this.parent.parent._request("GET", `api/1/energy_sites/${this.energy_site_id}/live_status`);
|
|
43
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Adjust the site's off-grid vehicle charging backup reserve.
|
|
88
|
+
* @param off_grid_vehicle_charging_reserve_percent The desired off grid vehicle charging reserve percent.
|
|
89
|
+
* @returns
|
|
90
|
+
*/
|
|
44
91
|
async off_grid_vehicle_charging_reserve(off_grid_vehicle_charging_reserve_percent) {
|
|
45
92
|
return this.parent.parent._request("POST", `api/1/energy_sites/${this.energy_site_id}/off_grid_vehicle_charging_reserve`, null, {
|
|
46
93
|
off_grid_vehicle_charging_reserve_percent,
|
|
47
94
|
});
|
|
48
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Set the site's mode.
|
|
98
|
+
* @param default_real_mode
|
|
99
|
+
* @returns
|
|
100
|
+
*/
|
|
49
101
|
async operation(default_real_mode) {
|
|
50
102
|
return this.parent.parent._request("POST", `api/1/energy_sites/${this.energy_site_id}/operation`, null, { default_real_mode });
|
|
51
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* Returns information about the site. Things like assets (has solar, etc), settings (backup reserve, etc), and features (storm_mode_capable, etc).
|
|
106
|
+
*/
|
|
52
107
|
async site_info() {
|
|
53
108
|
return this.parent.parent._request("GET", `api/1/energy_sites/${this.energy_site_id}/site_info`);
|
|
54
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* Update storm watch participation.
|
|
112
|
+
* @param enabled The storm mode participation value to set.
|
|
113
|
+
* @returns
|
|
114
|
+
*/
|
|
55
115
|
async storm_mode(enabled) {
|
|
56
116
|
return this.parent.parent._request("POST", `api/1/energy_sites/${this.energy_site_id}/storm_mode`, null, { enabled });
|
|
57
117
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"energyspecific.js","sourceRoot":"","sources":["../src/energyspecific.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"energyspecific.js","sourceRoot":"","sources":["../src/energyspecific.ts"],"names":[],"mappings":"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"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import Energy from "./energy.js";
|
|
2
|
+
import EnergySpecific from "./energyspecific.js";
|
|
1
3
|
import TeslaFleetApi from "./teslafleetapi.js";
|
|
2
4
|
import Teslemetry from "./teslemetry.js";
|
|
3
5
|
import Tessie from "./tessie.js";
|
|
4
|
-
|
|
6
|
+
import Vehicle from "./vehicle.js";
|
|
7
|
+
import VehicleSpecific from "./vehiclespecific.js";
|
|
8
|
+
export { Energy, EnergySpecific, TeslaFleetApi, Teslemetry, Tessie, Vehicle, VehicleSpecific };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import Energy from "./energy.js";
|
|
2
|
+
import EnergySpecific from "./energyspecific.js";
|
|
1
3
|
import TeslaFleetApi from "./teslafleetapi.js";
|
|
2
4
|
import Teslemetry from "./teslemetry.js";
|
|
3
5
|
import Tessie from "./tessie.js";
|
|
4
|
-
|
|
6
|
+
import Vehicle from "./vehicle.js";
|
|
7
|
+
import VehicleSpecific from "./vehiclespecific.js";
|
|
8
|
+
export { Energy, EnergySpecific, TeslaFleetApi, Teslemetry, Tessie, Vehicle, VehicleSpecific };
|
|
5
9
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAC/C,OAAO,UAAU,MAAM,iBAAiB,CAAC;AACzC,OAAO,MAAM,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,cAAc,MAAM,qBAAqB,CAAC;AACjD,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAC/C,OAAO,UAAU,MAAM,iBAAiB,CAAC;AACzC,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,eAAe,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
package/dist/partner.d.ts
CHANGED
|
@@ -2,7 +2,22 @@ import TeslaFleetApi from "./teslafleetapi.js";
|
|
|
2
2
|
export default class Partner {
|
|
3
3
|
parent: TeslaFleetApi;
|
|
4
4
|
constructor(parent: TeslaFleetApi);
|
|
5
|
+
/**
|
|
6
|
+
* Returns the public key associated with a domain. It can be used to ensure the registration was successful.
|
|
7
|
+
* @param domain Domain of the partner account.
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
5
10
|
public_key(domain?: string | null): Promise<Record<string, any>>;
|
|
11
|
+
/**
|
|
12
|
+
* Registers an existing account before it can be used for general API access. Each application from developer.tesla.com must complete this step.
|
|
13
|
+
* @param domain Domain of the partner account.
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
6
16
|
register(domain: string): Promise<Record<string, any>>;
|
|
17
|
+
/**
|
|
18
|
+
* Returns recent fleet telemetry errors reported by vehicles after receiving the config.
|
|
19
|
+
* @param domain Domain of the partner account.
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
7
22
|
fleet_telemetry_errors(domain: string): Promise<Record<string, any>>;
|
|
8
23
|
}
|
package/dist/partner.js
CHANGED
|
@@ -1,13 +1,29 @@
|
|
|
1
|
+
// Partner Class
|
|
1
2
|
export default class Partner {
|
|
2
3
|
constructor(parent) {
|
|
3
4
|
this.parent = parent;
|
|
4
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* Returns the public key associated with a domain. It can be used to ensure the registration was successful.
|
|
8
|
+
* @param domain Domain of the partner account.
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
5
11
|
async public_key(domain = null) {
|
|
6
12
|
return this.parent._request("GET", "api/1/partner_accounts/public_key", { domain });
|
|
7
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Registers an existing account before it can be used for general API access. Each application from developer.tesla.com must complete this step.
|
|
16
|
+
* @param domain Domain of the partner account.
|
|
17
|
+
* @returns
|
|
18
|
+
*/
|
|
8
19
|
async register(domain) {
|
|
9
20
|
return this.parent._request("POST", "api/1/partner_accounts", null, { domain });
|
|
10
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Returns recent fleet telemetry errors reported by vehicles after receiving the config.
|
|
24
|
+
* @param domain Domain of the partner account.
|
|
25
|
+
* @returns
|
|
26
|
+
*/
|
|
11
27
|
async fleet_telemetry_errors(domain) {
|
|
12
28
|
return this.parent._request("GET", "api/1/partner_accounts/fleet_telemetry_errors", { domain });
|
|
13
29
|
}
|
package/dist/partner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"partner.js","sourceRoot":"","sources":["../src/partner.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"partner.js","sourceRoot":"","sources":["../src/partner.ts"],"names":[],"mappings":"AAEA,gBAAgB;AAChB,MAAM,CAAC,OAAO,OAAO,OAAO;IAGxB,YAAY,MAAqB;QAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,UAAU,CAAC,SAAwB,IAAI;QACzC,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,mCAAmC,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IACxF,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,QAAQ,CAAC,MAAc;QACzB,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,wBAAwB,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IACpF,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,sBAAsB,CAAC,MAAc;QACvC,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,+CAA+C,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IACpG,CAAC;CACJ"}
|
package/dist/teslafleetapi.d.ts
CHANGED
|
@@ -23,6 +23,14 @@ export default class TeslaFleetApi {
|
|
|
23
23
|
userScope?: boolean;
|
|
24
24
|
vehicleScope?: boolean;
|
|
25
25
|
});
|
|
26
|
+
/**
|
|
27
|
+
* Make a request to the Tesla Fleet API.
|
|
28
|
+
* @param method
|
|
29
|
+
* @param path
|
|
30
|
+
* @param params
|
|
31
|
+
* @param json
|
|
32
|
+
* @returns
|
|
33
|
+
*/
|
|
26
34
|
_request(method: Method, path: string, params?: Record<string, any> | null, json?: Record<string, any> | null): Promise<any>;
|
|
27
35
|
products(): Promise<Record<string, any>>;
|
|
28
36
|
}
|
package/dist/teslafleetapi.js
CHANGED
|
@@ -38,6 +38,14 @@ export default class TeslaFleetApi {
|
|
|
38
38
|
this.vehicle = new Vehicle(this);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Make a request to the Tesla Fleet API.
|
|
43
|
+
* @param method
|
|
44
|
+
* @param path
|
|
45
|
+
* @param params
|
|
46
|
+
* @param json
|
|
47
|
+
* @returns
|
|
48
|
+
*/
|
|
41
49
|
async _request(method, path, params = null, json = null) {
|
|
42
50
|
if (!this.server) {
|
|
43
51
|
throw new Error("Server was not set at init. Call findServer() first.");
|
|
@@ -46,6 +54,7 @@ export default class TeslaFleetApi {
|
|
|
46
54
|
throw new Error("GET requests cannot have a body.");
|
|
47
55
|
}
|
|
48
56
|
console.debug(`Sending request to ${path}`);
|
|
57
|
+
// Remove null and undefined values from params and json
|
|
49
58
|
if (params) {
|
|
50
59
|
params = Object.fromEntries(Object.entries(params).filter(([_, v]) => v != null));
|
|
51
60
|
console.debug(`Parameters: ${JSON.stringify(params)}`);
|