@@ -10,6 +10,7 @@ import (
1010 "net/url"
1111
1212 "github.com/way-platform/mbz-go/api/vehiclesv1"
13+ mbzv1 "github.com/way-platform/mbz-go/proto/gen/go/wayplatform/connect/mbz/v1"
1314)
1415
1516// GetVehicleCompatibilityRequest is the request for [Client.GetVehicleCompatibility].
@@ -18,27 +19,12 @@ type GetVehicleCompatibilityRequest struct {
1819 VIN string `json:"vin"`
1920}
2021
21- // GetVehicleCompatibilityResponse is the response for [Client.GetVehicleCompatibility].
22- type GetVehicleCompatibilityResponse struct {
23- // VIN of the requested vehicle.
24- VIN string `json:"vin"`
25-
26- // VehicleType is the type of the requested vehicle.
27- VehicleType string `json:"vehicleType,omitempty"`
28-
29- // VehicleProvidesConnectivity indicates the base compatibility to data-services for the requested vehicle.
30- VehicleProvidesConnectivity bool `json:"vehicleProvidesConnectivity"`
31-
32- // Services with the service availability.
33- Services []vehiclesv1.CompatibilityGenericService `json:"services"`
34- }
35-
3622// GetVehicleCompatibility gets the compatibility of a vehicle.
3723func (c * Client ) GetVehicleCompatibility (
3824 ctx context.Context ,
3925 request * GetVehicleCompatibilityRequest ,
4026 opts ... ClientOption ,
41- ) (_ * GetVehicleCompatibilityResponse , err error ) {
27+ ) (_ * mbzv1. VehicleCompatibility , err error ) {
4228 defer func () {
4329 if err != nil {
4430 err = fmt .Errorf ("mbz: get vehicle compatibility: %w" , err )
@@ -79,10 +65,5 @@ func (c *Client) GetVehicleCompatibility(
7965 if err := json .Unmarshal (data , & responseBody ); err != nil {
8066 return nil , err
8167 }
82- return & GetVehicleCompatibilityResponse {
83- VIN : responseBody .VIN ,
84- VehicleType : responseBody .VehicleType ,
85- VehicleProvidesConnectivity : responseBody .VehicleProvidesConnectivity ,
86- Services : responseBody .Services ,
87- }, nil
68+ return compatibilityResponseToProto (request .VIN , & responseBody ), nil
8869}
0 commit comments