mercedes-byocar-exporter/internal/mercedes/pay_as_you_drive.go

27 lines
495 B
Go
Raw Normal View History

2022-11-19 23:47:19 +00:00
package mercedes
import (
"fmt"
"github.com/pkg/errors"
)
type (
PayAsYouDriveInsurance struct {
Odometer TimedInt `apiField:"odo"`
}
)
func (a APIClient) GetPayAsYouDriveInsurance(vehicleID string) (PayAsYouDriveInsurance, error) {
var (
path = fmt.Sprintf("/vehicles/%s/containers/payasyoudrive", vehicleID)
out PayAsYouDriveInsurance
)
if err := a.request(path, &out); err != nil {
return out, errors.Wrap(err, "getting pay-as-you-drive response")
}
return out, nil
}