mirror of
https://github.com/Luzifer/mercedes-byocar-exporter.git
synced 2024-11-08 22:10:07 +00:00
27 lines
582 B
Go
27 lines
582 B
Go
package mercedes
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
type (
|
|
FuelStatus struct {
|
|
RangeLiquid TimedInt `apiField:"rangeliquid"` // Liquid fuel tank range 0..2046 km
|
|
TanklevelPercent TimedInt `apiField:"tanklevelpercent"` // Liquid fuel tank level 0…100 %
|
|
}
|
|
)
|
|
|
|
func (a APIClient) GetFuelStatus(vehicleID string) (FuelStatus, error) {
|
|
var (
|
|
path = fmt.Sprintf("/vehicles/%s/containers/fuelstatus", vehicleID)
|
|
out FuelStatus
|
|
)
|
|
|
|
if err := a.request(path, &out); err != nil {
|
|
return out, errors.Wrap(err, "getting fuel status")
|
|
}
|
|
|
|
return out, nil
|
|
}
|