feat(high-mobility): Implement get battery level action
This commit is contained in:
@@ -0,0 +1,20 @@
|
|||||||
|
import defineAction from '../../../../helpers/define-action';
|
||||||
|
|
||||||
|
export default defineAction({
|
||||||
|
name: 'Get Battery Level',
|
||||||
|
key: 'getBatteryLevel',
|
||||||
|
description: 'Get the battery level of a vehicle',
|
||||||
|
|
||||||
|
async run($) {
|
||||||
|
const response = await $.http.get(
|
||||||
|
`https://sandbox.rest-api.high-mobility.com/v5/charging`
|
||||||
|
);
|
||||||
|
|
||||||
|
$.setActionItem({
|
||||||
|
raw: {
|
||||||
|
batteryLevel: response.data.batteryLevel.data,
|
||||||
|
estimatedRange: response.data.estimatedRange.data,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
@@ -1,3 +1,4 @@
|
|||||||
import getVehicleLocation from './get-vehicle-location';
|
import getVehicleLocation from './get-vehicle-location';
|
||||||
|
import getBatteryLevel from './get-battery-level';
|
||||||
|
|
||||||
export default [getVehicleLocation];
|
export default [getVehicleLocation, getBatteryLevel];
|
||||||
|
Reference in New Issue
Block a user