diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..e6fc3d8 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,16 @@ +# yaml-language-server: $schema=https://golangci-lint.run/jsonschema/golangci.jsonschema.json +version: "2" + +issues: + exclude-dirs: + - proto/gen + +formatters: + enable: + - gci + - gofumpt + - goimports + - golines + settings: + golines: + max-len: 120 diff --git a/cli/command.go b/cli/command.go index c429f5d..d251720 100644 --- a/cli/command.go +++ b/cli/command.go @@ -10,9 +10,11 @@ import ( "github.com/spf13/cobra" rfms "github.com/way-platform/rfms-go" + rfmsv5 "github.com/way-platform/rfms-go/proto/gen/go/wayplatform/connect/rfms/v5" "golang.org/x/oauth2" "golang.org/x/term" "google.golang.org/protobuf/encoding/protojson" + "google.golang.org/protobuf/types/known/timestamppb" ) // NewCommand builds the full CLI command tree for the rFMS SDK. @@ -225,20 +227,21 @@ func newVehiclesCommand(cfg *config) *cobra.Command { if err != nil { return err } - moreDataAvailable, lastVIN, count := true, "", 0 - for moreDataAvailable && count < *limit { - response, err := client.Vehicles(cmd.Context(), rfms.VehiclesRequest{ - LastVIN: lastVIN, - }) + request := rfmsv5.VehiclesRequest_builder{}.Build() + count := 0 + for count < *limit { + response, err := client.Vehicles(cmd.Context(), request) if err != nil { return err } - for _, vehicle := range response.Vehicles { + for _, vehicle := range response.GetVehicles() { fmt.Println(protojson.Format(vehicle)) } - count += len(response.Vehicles) - moreDataAvailable = response.MoreDataAvailable - lastVIN = response.Vehicles[len(response.Vehicles)-1].GetVin() + count += len(response.GetVehicles()) + if !response.GetMoreDataAvailable() || len(response.GetVehicles()) == 0 { + break + } + request.SetLastVin(response.GetVehicles()[len(response.GetVehicles())-1].GetVin()) } return nil } @@ -265,27 +268,29 @@ func newVehiclePositionsCommand(cfg *config) *cobra.Command { if len(args) > 0 { vin = args[0] } - moreDataAvailable, lastVIN := true, "" - for moreDataAvailable { - request := rfms.VehiclePositionsRequest{ - LastVIN: lastVIN, - VIN: vin, - LatestOnly: startTime.IsZero() && stopTime.IsZero(), - StartTime: *startTime, - StopTime: *stopTime, - } + b := rfmsv5.VehiclePositionsRequest_builder{ + Vin: new(vin), + LatestOnly: new(startTime.IsZero() && stopTime.IsZero()), + } + if !startTime.IsZero() { + b.StartTime = timestamppb.New(*startTime) + } + if !stopTime.IsZero() { + b.StopTime = timestamppb.New(*stopTime) + } + request := b.Build() + for { response, err := client.VehiclePositions(cmd.Context(), request) if err != nil { return err } - for _, vehiclePosition := range response.VehiclePositions { + for _, vehiclePosition := range response.GetVehiclePositions() { fmt.Println(protojson.Format(vehiclePosition)) } - moreDataAvailable = response.MoreDataAvailable - if !moreDataAvailable { + if !response.GetMoreDataAvailable() || len(response.GetVehiclePositions()) == 0 { break } - lastVIN = response.VehiclePositions[len(response.VehiclePositions)-1].GetVin() + request.SetLastVin(response.GetVehiclePositions()[len(response.GetVehiclePositions())-1].GetVin()) } return nil } @@ -312,27 +317,29 @@ func newVehicleStatusesCommand(cfg *config) *cobra.Command { if len(args) > 0 { vin = args[0] } - moreDataAvailable, lastVIN := true, "" - for moreDataAvailable { - request := rfms.VehicleStatusesRequest{ - LastVIN: lastVIN, - VIN: vin, - LatestOnly: startTime.IsZero() && stopTime.IsZero(), - StartTime: *startTime, - StopTime: *stopTime, - } + b := rfmsv5.VehicleStatusesRequest_builder{ + Vin: new(vin), + LatestOnly: new(startTime.IsZero() && stopTime.IsZero()), + } + if !startTime.IsZero() { + b.StartTime = timestamppb.New(*startTime) + } + if !stopTime.IsZero() { + b.StopTime = timestamppb.New(*stopTime) + } + request := b.Build() + for { response, err := client.VehicleStatuses(cmd.Context(), request) if err != nil { return err } - for _, vehicleStatus := range response.VehicleStatuses { + for _, vehicleStatus := range response.GetVehicleStatuses() { fmt.Println(protojson.Format(vehicleStatus)) } - moreDataAvailable = response.MoreDataAvailable - if !moreDataAvailable { + if !response.GetMoreDataAvailable() || len(response.GetVehicleStatuses()) == 0 { break } - lastVIN = response.VehicleStatuses[len(response.VehicleStatuses)-1].GetVin() + request.SetLastVin(response.GetVehicleStatuses()[len(response.GetVehicleStatuses())-1].GetVin()) } return nil } diff --git a/cli/go.mod b/cli/go.mod index 54fdb5d..e3bb2ed 100644 --- a/cli/go.mod +++ b/cli/go.mod @@ -1,8 +1,6 @@ module github.com/way-platform/rfms-go/cli -go 1.25.0 - -toolchain go1.26.0 +go 1.26.0 require ( github.com/spf13/cobra v1.10.2 @@ -13,6 +11,7 @@ require ( ) require ( + connectrpc.com/connect v1.19.1 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/spf13/pflag v1.0.9 // indirect golang.org/x/sys v0.42.0 // indirect diff --git a/cli/go.sum b/cli/go.sum index e4a542b..7e56d11 100644 --- a/cli/go.sum +++ b/cli/go.sum @@ -1,3 +1,5 @@ +connectrpc.com/connect v1.19.1 h1:R5M57z05+90EfEvCY1b7hBxDVOUl45PrtXtAV2fOC14= +connectrpc.com/connect v1.19.1/go.mod h1:tN20fjdGlewnSFeZxLKb0xwIZ6ozc3OQs2hTXy4du9w= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= diff --git a/client.go b/client.go index c22829d..46f9d1d 100644 --- a/client.go +++ b/client.go @@ -7,9 +7,12 @@ import ( "runtime/debug" "time" + rfmsv5connect "github.com/way-platform/rfms-go/proto/gen/go/wayplatform/connect/rfms/v5/rfmsv5connect" "golang.org/x/oauth2" ) +var _ rfmsv5connect.RfmsApiClient = (*Client)(nil) + // Client is an rFMS API client. type Client struct { config ClientConfig @@ -36,15 +39,6 @@ func newClientConfig() ClientConfig { } } -// with returns a new ClientConfig with the given options applied. -// This enables per-request configuration overrides. -func (cc ClientConfig) with(opts ...ClientOption) ClientConfig { - for _, opt := range opts { - opt(&cc) - } - return cc -} - // ClientOption is an option that configures a [Client]. type ClientOption func(*ClientConfig) diff --git a/client_example_test.go b/client_example_test.go index a14dc28..065c65f 100644 --- a/client_example_test.go +++ b/client_example_test.go @@ -5,7 +5,8 @@ import ( "fmt" "os" - "github.com/way-platform/rfms-go" + rfms "github.com/way-platform/rfms-go" + rfmsv5 "github.com/way-platform/rfms-go/proto/gen/go/wayplatform/connect/rfms/v5" ) func ExampleClient_scania() { @@ -15,21 +16,19 @@ func ExampleClient_scania() { if err != nil { panic(err) } - lastVIN, moreDataAvailable := "", true - for moreDataAvailable { - response, err := client.Vehicles(context.Background(), rfms.VehiclesRequest{ - LastVIN: lastVIN, - }) + request := rfmsv5.VehiclesRequest_builder{}.Build() + for { + response, err := client.Vehicles(context.Background(), request) if err != nil { panic(err) } - for _, vehicle := range response.Vehicles { + for _, vehicle := range response.GetVehicles() { fmt.Println(vehicle.GetVin()) } - moreDataAvailable = response.MoreDataAvailable - if moreDataAvailable { - lastVIN = response.Vehicles[len(response.Vehicles)-1].GetVin() + if !response.GetMoreDataAvailable() || len(response.GetVehicles()) == 0 { + break } + request.SetLastVin(response.GetVehicles()[len(response.GetVehicles())-1].GetVin()) } } @@ -43,20 +42,18 @@ func ExampleClient_volvoTrucks() { if err != nil { panic(err) } - lastVIN, moreDataAvailable := "", true - for moreDataAvailable { - response, err := client.Vehicles(context.Background(), rfms.VehiclesRequest{ - LastVIN: lastVIN, - }) + request := rfmsv5.VehiclesRequest_builder{}.Build() + for { + response, err := client.Vehicles(context.Background(), request) if err != nil { panic(err) } - for _, vehicle := range response.Vehicles { + for _, vehicle := range response.GetVehicles() { fmt.Println(vehicle.GetVin()) } - moreDataAvailable = response.MoreDataAvailable - if moreDataAvailable { - lastVIN = response.Vehicles[len(response.Vehicles)-1].GetVin() + if !response.GetMoreDataAvailable() || len(response.GetVehicles()) == 0 { + break } + request.SetLastVin(response.GetVehicles()[len(response.GetVehicles())-1].GetVin()) } } diff --git a/client_vehiclepositions.go b/client_vehiclepositions.go index aef3691..5d50edc 100644 --- a/client_vehiclepositions.go +++ b/client_vehiclepositions.go @@ -14,213 +14,170 @@ import ( "github.com/way-platform/rfms-go/internal/openapi/rfmsv2oapi" "github.com/way-platform/rfms-go/internal/openapi/rfmsv4oapi" rfmsv5 "github.com/way-platform/rfms-go/proto/gen/go/wayplatform/connect/rfms/v5" + "google.golang.org/protobuf/types/known/timestamppb" ) -// VehiclePositionsRequest is the request for the [Client.VehiclePositions] method. -type VehiclePositionsRequest struct { - // LastVIN is the last VIN included in the previous response. - LastVIN string - // DateType indicates whether the start/stop times are compared to created or received time. - DateType string - // StartTime to filter positions (only positions after this time). - StartTime time.Time - // StopTime to filter positions (only positions before this time). - StopTime time.Time - // VIN to filter positions for a specific vehicle. - VIN string - // LatestOnly returns only the latest position for each vehicle. - LatestOnly bool - // TriggerFilter filters positions by trigger type. - TriggerFilter string -} - -// VehiclePositionsResponse is the response for the [Client.VehiclePositions] method. -type VehiclePositionsResponse struct { - // VehiclePositions in the response. - VehiclePositions []*rfmsv5.VehiclePosition `json:"vehiclePositions"` - // MoreDataAvailable indicates if there is more data available. - MoreDataAvailable bool `json:"moreDataAvailable"` - // RequestServerDateTime is the server time when the request was received. - RequestServerDateTime time.Time `json:"requestServerDateTime,omitzero"` -} - // VehiclePositions implements the rFMS API method "GET /vehiclepositions". func (c *Client) VehiclePositions( ctx context.Context, - request VehiclePositionsRequest, - opts ...ClientOption, -) (_ VehiclePositionsResponse, err error) { - cfg := c.config.with(opts...) - switch cfg.apiVersion { + request *rfmsv5.VehiclePositionsRequest, +) (_ *rfmsv5.VehiclePositionsResponse, err error) { + switch c.config.apiVersion { case V2_1: - return c.vehiclePositionsV2(ctx, request, cfg) + return c.vehiclePositionsV2(ctx, request) case V4: - return c.vehiclePositionsV4(ctx, request, cfg) + return c.vehiclePositionsV4(ctx, request) default: - return VehiclePositionsResponse{}, fmt.Errorf("unsupported API version") + return nil, fmt.Errorf("unsupported API version") } } func (c *Client) vehiclePositionsV2( ctx context.Context, - request VehiclePositionsRequest, - cfg ClientConfig, -) (_ VehiclePositionsResponse, err error) { + request *rfmsv5.VehiclePositionsRequest, +) (_ *rfmsv5.VehiclePositionsResponse, err error) { defer func() { if err != nil { err = fmt.Errorf("rFMS v2 vehicle positions: %w", err) } }() - // Build query parameters query := url.Values{} - if request.LastVIN != "" { - query.Set("lastVin", request.LastVIN) + if request.GetLastVin() != "" { + query.Set("lastVin", request.GetLastVin()) } - if request.DateType != "" { - query.Set("datetype", request.DateType) + if request.GetDateType() != "" { + query.Set("datetype", request.GetDateType()) } - if !request.StartTime.IsZero() { - query.Set("starttime", rfmsv4oapi.Time(request.StartTime).String()) + if request.HasStartTime() { + query.Set("starttime", rfmsv4oapi.Time(request.GetStartTime().AsTime()).String()) } - if !request.StopTime.IsZero() { - query.Set("stoptime", rfmsv4oapi.Time(request.StopTime).String()) + if request.HasStopTime() { + query.Set("stoptime", rfmsv4oapi.Time(request.GetStopTime().AsTime()).String()) } - if request.VIN != "" { - query.Set("vin", request.VIN) + if request.GetVin() != "" { + query.Set("vin", request.GetVin()) } - if request.LatestOnly { + if request.GetLatestOnly() { query.Set("latestOnly", "true") } - if request.TriggerFilter != "" { - query.Set("triggerFilter", request.TriggerFilter) + if request.GetTriggerFilter() != "" { + query.Set("triggerFilter", request.GetTriggerFilter()) } - // Build path with query parameters path := "/vehiclepositions" if len(query) > 0 { path += "?" + query.Encode() } - // Apply per-request configuration overrides - fullURL := cfg.baseURL + path - // Create the request + fullURL := c.config.baseURL + path httpRequest, err := http.NewRequestWithContext(ctx, http.MethodGet, fullURL, nil) if err != nil { - return VehiclePositionsResponse{}, fmt.Errorf("http request: %w", err) + return nil, fmt.Errorf("http request: %w", err) } - // Set headers httpRequest.Header.Set("User-Agent", getUserAgent()) httpRequest.Header.Set("Accept", "application/vnd.fmsstandard.com.Vehiclepositions.v2.1+json") - // Create HTTP client and make request - client := c.httpClient(cfg) - httpResponse, err := client.Do(httpRequest) + httpResponse, err := c.httpClient(c.config).Do(httpRequest) if err != nil { - return VehiclePositionsResponse{}, fmt.Errorf("http request: %w", err) + return nil, fmt.Errorf("http request: %w", err) } defer func() { _ = httpResponse.Body.Close() }() if httpResponse.StatusCode != http.StatusOK { - return VehiclePositionsResponse{}, newHTTPError(httpResponse) + return nil, newHTTPError(httpResponse) } data, err := io.ReadAll(httpResponse.Body) if err != nil { - return VehiclePositionsResponse{}, fmt.Errorf("read response body: %w", err) + return nil, fmt.Errorf("read response body: %w", err) } var response rfmsv2oapi.VehiclePositions if err := json.Unmarshal(data, &response); err != nil { - return VehiclePositionsResponse{}, fmt.Errorf("unmarshal response body: %w", err) + return nil, fmt.Errorf("unmarshal response body: %w", err) } - var result VehiclePositionsResponse - result.MoreDataAvailable = response.MoreDataAvailable != nil && *response.MoreDataAvailable + resp := &rfmsv5.VehiclePositionsResponse{} + positions := make([]*rfmsv5.VehiclePosition, 0, len(response.VehiclePosition)) for _, vehiclePosition := range response.VehiclePosition { - result.VehiclePositions = append( - result.VehiclePositions, - convertv2.VehiclePosition(&vehiclePosition), - ) + positions = append(positions, convertv2.VehiclePosition(&vehiclePosition)) + } + resp.SetVehiclePositions(positions) + if response.MoreDataAvailable != nil { + resp.SetMoreDataAvailable(*response.MoreDataAvailable) } if response.RequestServerDateTime != nil { - result.RequestServerDateTime = *response.RequestServerDateTime + resp.SetRequestServerDateTime(timestamppb.New(*response.RequestServerDateTime)) } - return result, nil + return resp, nil } func (c *Client) vehiclePositionsV4( ctx context.Context, - request VehiclePositionsRequest, - cfg ClientConfig, -) (_ VehiclePositionsResponse, err error) { + request *rfmsv5.VehiclePositionsRequest, +) (_ *rfmsv5.VehiclePositionsResponse, err error) { defer func() { if err != nil { err = fmt.Errorf("rFMS v4 vehicle positions: %w", err) } }() - // Build query parameters query := url.Values{} - if request.LastVIN != "" { - query.Set("lastVin", request.LastVIN) + if request.GetLastVin() != "" { + query.Set("lastVin", request.GetLastVin()) } - if request.DateType != "" { - query.Set("datetype", request.DateType) + if request.GetDateType() != "" { + query.Set("datetype", request.GetDateType()) } - if !request.StartTime.IsZero() { - query.Set("starttime", rfmsv4oapi.Time(request.StartTime).String()) + if request.HasStartTime() { + query.Set("starttime", rfmsv4oapi.Time(request.GetStartTime().AsTime()).String()) } - if !request.StopTime.IsZero() { - query.Set("stoptime", rfmsv4oapi.Time(request.StopTime).String()) + if request.HasStopTime() { + query.Set("stoptime", rfmsv4oapi.Time(request.GetStopTime().AsTime()).String()) } - if request.VIN != "" { - query.Set("vin", request.VIN) + if request.GetVin() != "" { + query.Set("vin", request.GetVin()) } - if request.LatestOnly { + if request.GetLatestOnly() { query.Set("latestOnly", "true") } - if request.TriggerFilter != "" { - query.Set("triggerFilter", request.TriggerFilter) + if request.GetTriggerFilter() != "" { + query.Set("triggerFilter", request.GetTriggerFilter()) } - // Build path with query parameters path := "/vehiclepositions" if len(query) > 0 { path += "?" + query.Encode() } - // Apply per-request configuration overrides - fullURL := cfg.baseURL + path - // Create the request + fullURL := c.config.baseURL + path httpRequest, err := http.NewRequestWithContext(ctx, http.MethodGet, fullURL, nil) if err != nil { - return VehiclePositionsResponse{}, fmt.Errorf("http request: %w", err) + return nil, fmt.Errorf("http request: %w", err) } - // Set headers httpRequest.Header.Set("User-Agent", getUserAgent()) httpRequest.Header.Set("Accept", "application/json; rfms=vehiclepositions.v4.0") - // Create HTTP client and make request - client := c.httpClient(cfg) - httpResponse, err := client.Do(httpRequest) + httpResponse, err := c.httpClient(c.config).Do(httpRequest) if err != nil { - return VehiclePositionsResponse{}, fmt.Errorf("http request: %w", err) + return nil, fmt.Errorf("http request: %w", err) } defer func() { _ = httpResponse.Body.Close() }() if httpResponse.StatusCode != http.StatusOK { - return VehiclePositionsResponse{}, newHTTPError(httpResponse) + return nil, newHTTPError(httpResponse) } data, err := io.ReadAll(httpResponse.Body) if err != nil { - return VehiclePositionsResponse{}, fmt.Errorf("read response body: %w", err) + return nil, fmt.Errorf("read response body: %w", err) } var response rfmsv4oapi.VehiclePositionResponseObject if err := json.Unmarshal(data, &response); err != nil { - return VehiclePositionsResponse{}, fmt.Errorf("unmarshal response body: %w", err) + return nil, fmt.Errorf("unmarshal response body: %w", err) } - var result VehiclePositionsResponse - result.MoreDataAvailable = response.MoreDataAvailable != nil && *response.MoreDataAvailable + resp := &rfmsv5.VehiclePositionsResponse{} + positions := make([]*rfmsv5.VehiclePosition, 0, len(response.VehiclePositionResponse.VehiclePositions)) for _, vehiclePosition := range response.VehiclePositionResponse.VehiclePositions { - result.VehiclePositions = append( - result.VehiclePositions, - convertv4.VehiclePosition(&vehiclePosition), - ) + positions = append(positions, convertv4.VehiclePosition(&vehiclePosition)) + } + resp.SetVehiclePositions(positions) + if response.MoreDataAvailable != nil { + resp.SetMoreDataAvailable(*response.MoreDataAvailable) } if response.RequestServerDateTime != nil { - result.RequestServerDateTime = time.Time(*response.RequestServerDateTime) + resp.SetRequestServerDateTime(timestamppb.New(time.Time(*response.RequestServerDateTime))) } - return result, nil + return resp, nil } diff --git a/client_vehicles.go b/client_vehicles.go index 9778e41..21c4b84 100644 --- a/client_vehicles.go +++ b/client_vehicles.go @@ -16,155 +16,126 @@ import ( rfmsv5 "github.com/way-platform/rfms-go/proto/gen/go/wayplatform/connect/rfms/v5" ) -// VehiclesRequest is the request for the [Client.Vehicles] method. -type VehiclesRequest struct { - // LastVIN is the last VIN included in the previous response. - LastVIN string `json:"lastVin"` -} - -// VehiclesResponse is the response for the [Client.Vehicles] method. -type VehiclesResponse struct { - // Vehicles in the response. - Vehicles []*rfmsv5.Vehicle `json:"vehicles"` - // MoreDataAvailable indicates if there is more data available. - MoreDataAvailable bool `json:"moreDataAvailable"` -} - // Vehicles implements the rFMS API method "GET /vehicles". func (c *Client) Vehicles( ctx context.Context, - request VehiclesRequest, - opts ...ClientOption, -) (_ VehiclesResponse, err error) { - cfg := c.config.with(opts...) - switch cfg.apiVersion { + request *rfmsv5.VehiclesRequest, +) (_ *rfmsv5.VehiclesResponse, err error) { + switch c.config.apiVersion { case V2_1: - return c.vehiclesV2(ctx, request, cfg) + return c.vehiclesV2(ctx, request) case V4: - return c.vehiclesV4(ctx, request, cfg) + return c.vehiclesV4(ctx, request) default: - return VehiclesResponse{}, fmt.Errorf("unsupported API version") + return nil, fmt.Errorf("unsupported API version") } } func (c *Client) vehiclesV2( ctx context.Context, - request VehiclesRequest, - cfg ClientConfig, -) (_ VehiclesResponse, err error) { + request *rfmsv5.VehiclesRequest, +) (_ *rfmsv5.VehiclesResponse, err error) { defer func() { if err != nil { err = fmt.Errorf("rFMS v2 vehicles: %w", err) } }() - // Build query parameters query := url.Values{} - if request.LastVIN != "" { - query.Set("lastVin", request.LastVIN) + if request.GetLastVin() != "" { + query.Set("lastVin", request.GetLastVin()) } - - // Build path with query parameters path := "/vehicles" if len(query) > 0 { path += "?" + query.Encode() } - // Apply per-request configuration overrides - fullURL := cfg.baseURL + path - // Create the request + fullURL := c.config.baseURL + path httpRequest, err := http.NewRequestWithContext(ctx, http.MethodGet, fullURL, nil) if err != nil { - return VehiclesResponse{}, fmt.Errorf("http request: %w", err) + return nil, fmt.Errorf("http request: %w", err) } - // Set headers httpRequest.Header.Set("User-Agent", getUserAgent()) httpRequest.Header.Set("Accept", "application/vnd.fmsstandard.com.Vehicles.v2.1+json") - // Create HTTP client and make request - client := c.httpClient(cfg) - httpResponse, err := client.Do(httpRequest) + httpResponse, err := c.httpClient(c.config).Do(httpRequest) if err != nil { - return VehiclesResponse{}, fmt.Errorf("http request: %w", err) + return nil, fmt.Errorf("http request: %w", err) } defer func() { _ = httpResponse.Body.Close() }() if httpResponse.StatusCode != http.StatusOK { - return VehiclesResponse{}, newHTTPError(httpResponse) + return nil, newHTTPError(httpResponse) } data, err := io.ReadAll(httpResponse.Body) if err != nil { - return VehiclesResponse{}, fmt.Errorf("read response body: %w", err) + return nil, fmt.Errorf("read response body: %w", err) } var response rfmsv2oapi.Vehicles if err := json.Unmarshal(data, &response); err != nil { - return VehiclesResponse{}, fmt.Errorf("unmarshal v2 response body: %w", err) - } - result := VehiclesResponse{ - MoreDataAvailable: response.MoreDataAvailable != nil && *response.MoreDataAvailable, - Vehicles: make([]*rfmsv5.Vehicle, 0, len(response.Vehicle)), + return nil, fmt.Errorf("unmarshal v2 response body: %w", err) } + resp := &rfmsv5.VehiclesResponse{} + vehicles := make([]*rfmsv5.Vehicle, 0, len(response.Vehicle)) for _, vehicle := range response.Vehicle { - result.Vehicles = append(result.Vehicles, convertv2.Vehicle(&vehicle)) + vehicles = append(vehicles, convertv2.Vehicle(&vehicle)) + } + resp.SetVehicles(vehicles) + if response.MoreDataAvailable != nil { + resp.SetMoreDataAvailable(*response.MoreDataAvailable) } - return result, nil + return resp, nil } func (c *Client) vehiclesV4( ctx context.Context, - request VehiclesRequest, - cfg ClientConfig, -) (_ VehiclesResponse, err error) { + request *rfmsv5.VehiclesRequest, +) (_ *rfmsv5.VehiclesResponse, err error) { defer func() { if err != nil { err = fmt.Errorf("rFMS v4 vehicles: %w", err) } }() - // Build query parameters query := url.Values{} - if request.LastVIN != "" { - query.Set("lastVin", request.LastVIN) + if request.GetLastVin() != "" { + query.Set("lastVin", request.GetLastVin()) } - // Build path with query parameters path := "/vehicles" if len(query) > 0 { path += "?" + query.Encode() } - // Apply per-request configuration overrides - fullURL := cfg.baseURL + path - // Create the request + fullURL := c.config.baseURL + path httpRequest, err := http.NewRequestWithContext(ctx, http.MethodGet, fullURL, nil) if err != nil { - return VehiclesResponse{}, fmt.Errorf("http request: %w", err) + return nil, fmt.Errorf("http request: %w", err) } - // Set headers httpRequest.Header.Set("User-Agent", getUserAgent()) httpRequest.Header.Set("Accept", "application/json; rfms=vehicles.v4.0") - // Create HTTP client and make request - client := c.httpClient(cfg) - httpResponse, err := client.Do(httpRequest) + httpResponse, err := c.httpClient(c.config).Do(httpRequest) if err != nil { - return VehiclesResponse{}, fmt.Errorf("http request: %w", err) + return nil, fmt.Errorf("http request: %w", err) } defer func() { _ = httpResponse.Body.Close() }() if httpResponse.StatusCode != http.StatusOK { - return VehiclesResponse{}, newHTTPError(httpResponse) + return nil, newHTTPError(httpResponse) } data, err := io.ReadAll(httpResponse.Body) if err != nil { - return VehiclesResponse{}, fmt.Errorf("read response body: %w", err) + return nil, fmt.Errorf("read response body: %w", err) } slog.Debug("vehicles v4 response", "body", json.RawMessage(data)) var response rfmsv4oapi.VehicleResponseObject if err := json.Unmarshal(data, &response); err != nil { - return VehiclesResponse{}, fmt.Errorf("unmarshal v4 response body: %w", err) - } - result := VehiclesResponse{ - MoreDataAvailable: response.MoreDataAvailable != nil && *response.MoreDataAvailable, - Vehicles: make([]*rfmsv5.Vehicle, 0, len(response.VehicleResponse.Vehicles)), + return nil, fmt.Errorf("unmarshal v4 response body: %w", err) } + resp := &rfmsv5.VehiclesResponse{} + vehicles := make([]*rfmsv5.Vehicle, 0, len(response.VehicleResponse.Vehicles)) for _, vehicle := range response.VehicleResponse.Vehicles { - result.Vehicles = append(result.Vehicles, convertv4.Vehicle(&vehicle)) + vehicles = append(vehicles, convertv4.Vehicle(&vehicle)) + } + resp.SetVehicles(vehicles) + if response.MoreDataAvailable != nil { + resp.SetMoreDataAvailable(*response.MoreDataAvailable) } - return result, nil + return resp, nil } diff --git a/client_vehiclestatuses.go b/client_vehiclestatuses.go index 90bb6d3..218309f 100644 --- a/client_vehiclestatuses.go +++ b/client_vehiclestatuses.go @@ -15,220 +15,176 @@ import ( "github.com/way-platform/rfms-go/internal/openapi/rfmsv2oapi" "github.com/way-platform/rfms-go/internal/openapi/rfmsv4oapi" rfmsv5 "github.com/way-platform/rfms-go/proto/gen/go/wayplatform/connect/rfms/v5" + "google.golang.org/protobuf/types/known/timestamppb" ) -// VehicleStatusesRequest is the request for the [Client.VehicleStatuses] method. -type VehicleStatusesRequest struct { - // LastVIN is the last VIN included in the previous response. - LastVIN string - // DateType indicates whether the start/stop times are compared to created or received time. - DateType string - // StartTime to filter statuses (only statuses after this time). - StartTime time.Time - // StopTime to filter statuses (only statuses before this time). - StopTime time.Time - // VIN to filter statuses for a specific vehicle. - VIN string - // ContentFilter filters statuses by content type (ACCUMULATED, SNAPSHOT, UPTIME). - ContentFilter []string - // TriggerFilter filters statuses by trigger type. - TriggerFilter []string - // LatestOnly returns only the latest status for each vehicle. - LatestOnly bool -} - -// VehicleStatusesResponse is the response for the [Client.VehicleStatuses] method. -type VehicleStatusesResponse struct { - // VehicleStatuses in the response. - VehicleStatuses []*rfmsv5.VehicleStatus `json:"vehicleStatuses"` - // MoreDataAvailable indicates if there is more data available. - MoreDataAvailable bool `json:"moreDataAvailable"` - // RequestServerDateTime is the server time when the request was received. - RequestServerDateTime time.Time `json:"requestServerDateTime,omitzero"` -} - +// VehicleStatuses implements the rFMS API method "GET /vehiclestatuses". func (c *Client) VehicleStatuses( ctx context.Context, - request VehicleStatusesRequest, - opts ...ClientOption, -) (_ VehicleStatusesResponse, err error) { - cfg := c.config.with(opts...) - switch cfg.apiVersion { + request *rfmsv5.VehicleStatusesRequest, +) (_ *rfmsv5.VehicleStatusesResponse, err error) { + switch c.config.apiVersion { case V2_1: - return c.vehicleStatusesV2(ctx, request, cfg) + return c.vehicleStatusesV2(ctx, request) case V4: - return c.vehicleStatusesV4(ctx, request, cfg) + return c.vehicleStatusesV4(ctx, request) default: - return VehicleStatusesResponse{}, fmt.Errorf("unsupported API version") + return nil, fmt.Errorf("unsupported API version") } } func (c *Client) vehicleStatusesV2( ctx context.Context, - request VehicleStatusesRequest, - cfg ClientConfig, -) (_ VehicleStatusesResponse, err error) { + request *rfmsv5.VehicleStatusesRequest, +) (_ *rfmsv5.VehicleStatusesResponse, err error) { defer func() { if err != nil { err = fmt.Errorf("rFMS v2 vehicle statuses: %w", err) } }() - // Build query parameters query := url.Values{} - if request.LastVIN != "" { - query.Set("lastVin", request.LastVIN) + if request.GetLastVin() != "" { + query.Set("lastVin", request.GetLastVin()) } - if request.DateType != "" { - query.Set("datetype", request.DateType) + if request.GetDateType() != "" { + query.Set("datetype", request.GetDateType()) } - if !request.StartTime.IsZero() { - query.Set("starttime", rfmsv4oapi.Time(request.StartTime).String()) + if request.HasStartTime() { + query.Set("starttime", rfmsv4oapi.Time(request.GetStartTime().AsTime()).String()) } - if !request.StopTime.IsZero() { - query.Set("stoptime", rfmsv4oapi.Time(request.StopTime).String()) + if request.HasStopTime() { + query.Set("stoptime", rfmsv4oapi.Time(request.GetStopTime().AsTime()).String()) } - if request.VIN != "" { - query.Set("vin", request.VIN) + if request.GetVin() != "" { + query.Set("vin", request.GetVin()) } - if len(request.ContentFilter) > 0 { - query.Set("contentFilter", strings.Join(request.ContentFilter, ",")) + if len(request.GetContentFilter()) > 0 { + query.Set("contentFilter", strings.Join(request.GetContentFilter(), ",")) } - if len(request.TriggerFilter) > 0 { - query.Set("triggerFilter", strings.Join(request.TriggerFilter, ",")) + if len(request.GetTriggerFilter()) > 0 { + query.Set("triggerFilter", strings.Join(request.GetTriggerFilter(), ",")) } - if request.LatestOnly { + if request.GetLatestOnly() { query.Set("latestOnly", "true") } - // Build path with query parameters path := "/vehiclestatuses" if len(query) > 0 { path += "?" + query.Encode() } - // Apply per-request configuration overrides - fullURL := cfg.baseURL + path - // Create the request + fullURL := c.config.baseURL + path httpRequest, err := http.NewRequestWithContext(ctx, http.MethodGet, fullURL, nil) if err != nil { - return VehicleStatusesResponse{}, fmt.Errorf("http request: %w", err) + return nil, fmt.Errorf("http request: %w", err) } - // Set headers httpRequest.Header.Set("User-Agent", getUserAgent()) httpRequest.Header.Set("Accept", "application/vnd.fmsstandard.com.Vehiclestatuses.v2.1+json") - // Create HTTP client and make request - client := c.httpClient(cfg) - httpResponse, err := client.Do(httpRequest) + httpResponse, err := c.httpClient(c.config).Do(httpRequest) if err != nil { - return VehicleStatusesResponse{}, fmt.Errorf("http request: %w", err) + return nil, fmt.Errorf("http request: %w", err) } defer func() { _ = httpResponse.Body.Close() }() if httpResponse.StatusCode != http.StatusOK { - return VehicleStatusesResponse{}, newHTTPError(httpResponse) + return nil, newHTTPError(httpResponse) } data, err := io.ReadAll(httpResponse.Body) if err != nil { - return VehicleStatusesResponse{}, fmt.Errorf("read response body: %w", err) + return nil, fmt.Errorf("read response body: %w", err) } var response rfmsv2oapi.VehicleStatuses if err := json.Unmarshal(data, &response); err != nil { - return VehicleStatusesResponse{}, fmt.Errorf("unmarshal v4 response body: %w", err) + return nil, fmt.Errorf("unmarshal v2 response body: %w", err) } - var result VehicleStatusesResponse - result.MoreDataAvailable = response.MoreDataAvailable != nil && *response.MoreDataAvailable + resp := &rfmsv5.VehicleStatusesResponse{} + statuses := make([]*rfmsv5.VehicleStatus, 0, len(response.VehicleStatus)) for _, vehicleStatus := range response.VehicleStatus { - result.VehicleStatuses = append( - result.VehicleStatuses, - convertv2.VehicleStatus(&vehicleStatus), - ) + statuses = append(statuses, convertv2.VehicleStatus(&vehicleStatus)) + } + resp.SetVehicleStatuses(statuses) + if response.MoreDataAvailable != nil { + resp.SetMoreDataAvailable(*response.MoreDataAvailable) } if response.RequestServerDateTime != nil { - result.RequestServerDateTime = *response.RequestServerDateTime + resp.SetRequestServerDateTime(timestamppb.New(*response.RequestServerDateTime)) } - return result, nil + return resp, nil } func (c *Client) vehicleStatusesV4( ctx context.Context, - request VehicleStatusesRequest, - cfg ClientConfig, -) (_ VehicleStatusesResponse, err error) { + request *rfmsv5.VehicleStatusesRequest, +) (_ *rfmsv5.VehicleStatusesResponse, err error) { defer func() { if err != nil { err = fmt.Errorf("rFMS v4 vehicle statuses: %w", err) } }() - // Build query parameters query := url.Values{} - if request.LastVIN != "" { - query.Set("lastVin", request.LastVIN) + if request.GetLastVin() != "" { + query.Set("lastVin", request.GetLastVin()) } - if request.DateType != "" { - query.Set("datetype", request.DateType) + if request.GetDateType() != "" { + query.Set("datetype", request.GetDateType()) } - if !request.StartTime.IsZero() { - query.Set("starttime", rfmsv4oapi.Time(request.StartTime).String()) + if request.HasStartTime() { + query.Set("starttime", rfmsv4oapi.Time(request.GetStartTime().AsTime()).String()) } - if !request.StopTime.IsZero() { - query.Set("stoptime", rfmsv4oapi.Time(request.StopTime).String()) + if request.HasStopTime() { + query.Set("stoptime", rfmsv4oapi.Time(request.GetStopTime().AsTime()).String()) } - if request.VIN != "" { - query.Set("vin", request.VIN) + if request.GetVin() != "" { + query.Set("vin", request.GetVin()) } - if len(request.ContentFilter) > 0 { - query.Set("contentFilter", strings.Join(request.ContentFilter, ",")) + if len(request.GetContentFilter()) > 0 { + query.Set("contentFilter", strings.Join(request.GetContentFilter(), ",")) } - if len(request.TriggerFilter) > 0 { - query.Set("triggerFilter", strings.Join(request.TriggerFilter, ",")) + if len(request.GetTriggerFilter()) > 0 { + query.Set("triggerFilter", strings.Join(request.GetTriggerFilter(), ",")) } - if request.LatestOnly { + if request.GetLatestOnly() { query.Set("latestOnly", "true") } - // Build path with query parameters path := "/vehiclestatuses" if len(query) > 0 { path += "?" + query.Encode() } - // Apply per-request configuration overrides - fullURL := cfg.baseURL + path - // Create the request + fullURL := c.config.baseURL + path httpRequest, err := http.NewRequestWithContext(ctx, http.MethodGet, fullURL, nil) if err != nil { - return VehicleStatusesResponse{}, fmt.Errorf("http request: %w", err) + return nil, fmt.Errorf("http request: %w", err) } - // Set headers httpRequest.Header.Set("User-Agent", getUserAgent()) httpRequest.Header.Set("Accept", "application/json; rfms=vehiclestatuses.v4.0") - // Create HTTP client and make request - client := c.httpClient(cfg) - httpResponse, err := client.Do(httpRequest) + httpResponse, err := c.httpClient(c.config).Do(httpRequest) if err != nil { - return VehicleStatusesResponse{}, fmt.Errorf("http request: %w", err) + return nil, fmt.Errorf("http request: %w", err) } defer func() { _ = httpResponse.Body.Close() }() if httpResponse.StatusCode != http.StatusOK { - return VehicleStatusesResponse{}, newHTTPError(httpResponse) + return nil, newHTTPError(httpResponse) } data, err := io.ReadAll(httpResponse.Body) if err != nil { - return VehicleStatusesResponse{}, fmt.Errorf("read response body: %w", err) + return nil, fmt.Errorf("read response body: %w", err) } var response rfmsv4oapi.VehicleStatusResponseObject if err := json.Unmarshal(data, &response); err != nil { - return VehicleStatusesResponse{}, fmt.Errorf("unmarshal v4 response body: %w", err) + return nil, fmt.Errorf("unmarshal v4 response body: %w", err) } - var result VehicleStatusesResponse - result.MoreDataAvailable = response.MoreDataAvailable != nil && *response.MoreDataAvailable + resp := &rfmsv5.VehicleStatusesResponse{} + statuses := make([]*rfmsv5.VehicleStatus, 0, len(response.VehicleStatusResponse.VehicleStatuses)) for _, vehicleStatus := range response.VehicleStatusResponse.VehicleStatuses { - result.VehicleStatuses = append( - result.VehicleStatuses, - convertv4.VehicleStatus(&vehicleStatus), - ) + statuses = append(statuses, convertv4.VehicleStatus(&vehicleStatus)) + } + resp.SetVehicleStatuses(statuses) + if response.MoreDataAvailable != nil { + resp.SetMoreDataAvailable(*response.MoreDataAvailable) } if response.RequestServerDateTime != nil { - result.RequestServerDateTime = time.Time(*response.RequestServerDateTime) + resp.SetRequestServerDateTime(timestamppb.New(time.Time(*response.RequestServerDateTime))) } - return result, nil + return resp, nil } diff --git a/cmd/rfms/go.mod b/cmd/rfms/go.mod index a4395e7..903f5bf 100644 --- a/cmd/rfms/go.mod +++ b/cmd/rfms/go.mod @@ -1,8 +1,6 @@ module github.com/way-platform/rfms-go/cmd/rfms -go 1.25.0 - -toolchain go1.26.0 +go 1.26.0 require ( charm.land/fang/v2 v2.0.1 @@ -13,6 +11,7 @@ require ( ) require ( + connectrpc.com/connect v1.19.1 // indirect github.com/charmbracelet/colorprofile v0.4.2 // indirect github.com/charmbracelet/ultraviolet v0.0.0-20260205113103-524a6607adb8 // indirect github.com/charmbracelet/x/ansi v0.11.6 // indirect diff --git a/cmd/rfms/go.sum b/cmd/rfms/go.sum index 44f7b19..d8d794f 100644 --- a/cmd/rfms/go.sum +++ b/cmd/rfms/go.sum @@ -2,6 +2,8 @@ charm.land/fang/v2 v2.0.1 h1:zQCM8JQJ1JnQX/66B5jlCYBUxL2as5JXQZ2KJ6EL0mY= charm.land/fang/v2 v2.0.1/go.mod h1:S1GmkpcvK+OB5w9caywUnJcsMew45Ot8FXqoz8ALrII= charm.land/lipgloss/v2 v2.0.2 h1:xFolbF8JdpNkM2cEPTfXEcW1p6NRzOWTSamRfYEw8cs= charm.land/lipgloss/v2 v2.0.2/go.mod h1:KjPle2Qd3YmvP1KL5OMHiHysGcNwq6u83MUjYkFvEkM= +connectrpc.com/connect v1.19.1 h1:R5M57z05+90EfEvCY1b7hBxDVOUl45PrtXtAV2fOC14= +connectrpc.com/connect v1.19.1/go.mod h1:tN20fjdGlewnSFeZxLKb0xwIZ6ozc3OQs2hTXy4du9w= github.com/adrg/xdg v0.5.3 h1:xRnxJXne7+oWDatRhR1JLnvuccuIeCoBu2rtuLqQB78= github.com/adrg/xdg v0.5.3/go.mod h1:nlTsY+NNiCBGCK2tpm09vRqfVzrc2fLmXGpBLF0zlTQ= github.com/aymanbagabas/go-udiff v0.4.1 h1:OEIrQ8maEeDBXQDoGCbbTTXYJMYRCRO1fnodZ12Gv5o= diff --git a/go.mod b/go.mod index 5fa3395..6d98d0d 100644 --- a/go.mod +++ b/go.mod @@ -1,12 +1,11 @@ module github.com/way-platform/rfms-go -go 1.25.0 - -toolchain go1.26.0 +go 1.26.0 require ( + connectrpc.com/connect v1.19.1 golang.org/x/oauth2 v0.31.0 - google.golang.org/protobuf v1.36.6 + google.golang.org/protobuf v1.36.9 ) require github.com/google/go-cmp v0.7.0 // indirect diff --git a/go.sum b/go.sum index d58d5a8..2fec869 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,8 @@ +connectrpc.com/connect v1.19.1 h1:R5M57z05+90EfEvCY1b7hBxDVOUl45PrtXtAV2fOC14= +connectrpc.com/connect v1.19.1/go.mod h1:tN20fjdGlewnSFeZxLKb0xwIZ6ozc3OQs2hTXy4du9w= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= golang.org/x/oauth2 v0.31.0 h1:8Fq0yVZLh4j4YA47vHKFTa9Ew5XIrCP8LC6UeNZnLxo= golang.org/x/oauth2 v0.31.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= -google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= -google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= +google.golang.org/protobuf v1.36.9 h1:w2gp2mA27hUeUzj9Ex9FBjsBm40zfaDtEWow293U7Iw= +google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= diff --git a/proto/buf.gen.yaml b/proto/buf.gen.yaml index cf1f8e2..19769a5 100644 --- a/proto/buf.gen.yaml +++ b/proto/buf.gen.yaml @@ -17,3 +17,8 @@ plugins: opt: - module=github.com/way-platform/rfms-go/proto/gen/go - default_api_level=API_OPAQUE + - local: ["go", "tool", "-modfile", "../tools/go.mod", "protoc-gen-connect-go"] + out: gen/go + opt: + - module=github.com/way-platform/rfms-go/proto/gen/go + - simple diff --git a/proto/gen/go/wayplatform/connect/rfms/v5/accumulated_data.pb.go b/proto/gen/go/wayplatform/connect/rfms/v5/accumulated_data.pb.go index add47c9..4b9360b 100644 --- a/proto/gen/go/wayplatform/connect/rfms/v5/accumulated_data.pb.go +++ b/proto/gen/go/wayplatform/connect/rfms/v5/accumulated_data.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.8 +// protoc-gen-go v1.36.9 // protoc (unknown) // source: wayplatform/connect/rfms/v5/accumulated_data.proto diff --git a/proto/gen/go/wayplatform/connect/rfms/v5/brand.pb.go b/proto/gen/go/wayplatform/connect/rfms/v5/brand.pb.go index a09ad50..1afc969 100644 --- a/proto/gen/go/wayplatform/connect/rfms/v5/brand.pb.go +++ b/proto/gen/go/wayplatform/connect/rfms/v5/brand.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.8 +// protoc-gen-go v1.36.9 // protoc (unknown) // source: wayplatform/connect/rfms/v5/brand.proto diff --git a/proto/gen/go/wayplatform/connect/rfms/v5/charging_connection_state.pb.go b/proto/gen/go/wayplatform/connect/rfms/v5/charging_connection_state.pb.go index bef9310..6a27d01 100644 --- a/proto/gen/go/wayplatform/connect/rfms/v5/charging_connection_state.pb.go +++ b/proto/gen/go/wayplatform/connect/rfms/v5/charging_connection_state.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.8 +// protoc-gen-go v1.36.9 // protoc (unknown) // source: wayplatform/connect/rfms/v5/charging_connection_state.proto diff --git a/proto/gen/go/wayplatform/connect/rfms/v5/charging_device.pb.go b/proto/gen/go/wayplatform/connect/rfms/v5/charging_device.pb.go index 31b9248..3fcb299 100644 --- a/proto/gen/go/wayplatform/connect/rfms/v5/charging_device.pb.go +++ b/proto/gen/go/wayplatform/connect/rfms/v5/charging_device.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.8 +// protoc-gen-go v1.36.9 // protoc (unknown) // source: wayplatform/connect/rfms/v5/charging_device.proto diff --git a/proto/gen/go/wayplatform/connect/rfms/v5/charging_state.pb.go b/proto/gen/go/wayplatform/connect/rfms/v5/charging_state.pb.go index d2853c8..7d038bb 100644 --- a/proto/gen/go/wayplatform/connect/rfms/v5/charging_state.pb.go +++ b/proto/gen/go/wayplatform/connect/rfms/v5/charging_state.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.8 +// protoc-gen-go v1.36.9 // protoc (unknown) // source: wayplatform/connect/rfms/v5/charging_state.proto diff --git a/proto/gen/go/wayplatform/connect/rfms/v5/date.pb.go b/proto/gen/go/wayplatform/connect/rfms/v5/date.pb.go index e8e9c48..0e2097c 100644 --- a/proto/gen/go/wayplatform/connect/rfms/v5/date.pb.go +++ b/proto/gen/go/wayplatform/connect/rfms/v5/date.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.8 +// protoc-gen-go v1.36.9 // protoc (unknown) // source: wayplatform/connect/rfms/v5/date.proto diff --git a/proto/gen/go/wayplatform/connect/rfms/v5/driver_identification.pb.go b/proto/gen/go/wayplatform/connect/rfms/v5/driver_identification.pb.go index ba1fa5b..60f62c9 100644 --- a/proto/gen/go/wayplatform/connect/rfms/v5/driver_identification.pb.go +++ b/proto/gen/go/wayplatform/connect/rfms/v5/driver_identification.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.8 +// protoc-gen-go v1.36.9 // protoc (unknown) // source: wayplatform/connect/rfms/v5/driver_identification.proto diff --git a/proto/gen/go/wayplatform/connect/rfms/v5/driver_working_state.pb.go b/proto/gen/go/wayplatform/connect/rfms/v5/driver_working_state.pb.go index 05252dd..80a26f8 100644 --- a/proto/gen/go/wayplatform/connect/rfms/v5/driver_working_state.pb.go +++ b/proto/gen/go/wayplatform/connect/rfms/v5/driver_working_state.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.8 +// protoc-gen-go v1.36.9 // protoc (unknown) // source: wayplatform/connect/rfms/v5/driver_working_state.proto diff --git a/proto/gen/go/wayplatform/connect/rfms/v5/emission_level.pb.go b/proto/gen/go/wayplatform/connect/rfms/v5/emission_level.pb.go index 099b7f4..cd78d15 100644 --- a/proto/gen/go/wayplatform/connect/rfms/v5/emission_level.pb.go +++ b/proto/gen/go/wayplatform/connect/rfms/v5/emission_level.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.8 +// protoc-gen-go v1.36.9 // protoc (unknown) // source: wayplatform/connect/rfms/v5/emission_level.proto diff --git a/proto/gen/go/wayplatform/connect/rfms/v5/fuel_type.pb.go b/proto/gen/go/wayplatform/connect/rfms/v5/fuel_type.pb.go index 0f8a15d..f569397 100644 --- a/proto/gen/go/wayplatform/connect/rfms/v5/fuel_type.pb.go +++ b/proto/gen/go/wayplatform/connect/rfms/v5/fuel_type.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.8 +// protoc-gen-go v1.36.9 // protoc (unknown) // source: wayplatform/connect/rfms/v5/fuel_type.proto diff --git a/proto/gen/go/wayplatform/connect/rfms/v5/gearbox_type.pb.go b/proto/gen/go/wayplatform/connect/rfms/v5/gearbox_type.pb.go index c8e3506..c63ac05 100644 --- a/proto/gen/go/wayplatform/connect/rfms/v5/gearbox_type.pb.go +++ b/proto/gen/go/wayplatform/connect/rfms/v5/gearbox_type.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.8 +// protoc-gen-go v1.36.9 // protoc (unknown) // source: wayplatform/connect/rfms/v5/gearbox_type.proto diff --git a/proto/gen/go/wayplatform/connect/rfms/v5/gnss_position.pb.go b/proto/gen/go/wayplatform/connect/rfms/v5/gnss_position.pb.go index c78fc6f..2c73af7 100644 --- a/proto/gen/go/wayplatform/connect/rfms/v5/gnss_position.pb.go +++ b/proto/gen/go/wayplatform/connect/rfms/v5/gnss_position.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.8 +// protoc-gen-go v1.36.9 // protoc (unknown) // source: wayplatform/connect/rfms/v5/gnss_position.proto diff --git a/proto/gen/go/wayplatform/connect/rfms/v5/ignition_state.pb.go b/proto/gen/go/wayplatform/connect/rfms/v5/ignition_state.pb.go index 9acab17..9f21097 100644 --- a/proto/gen/go/wayplatform/connect/rfms/v5/ignition_state.pb.go +++ b/proto/gen/go/wayplatform/connect/rfms/v5/ignition_state.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.8 +// protoc-gen-go v1.36.9 // protoc (unknown) // source: wayplatform/connect/rfms/v5/ignition_state.proto diff --git a/proto/gen/go/wayplatform/connect/rfms/v5/rfms_api.pb.go b/proto/gen/go/wayplatform/connect/rfms/v5/rfms_api.pb.go new file mode 100644 index 0000000..3c9f7f7 --- /dev/null +++ b/proto/gen/go/wayplatform/connect/rfms/v5/rfms_api.pb.go @@ -0,0 +1,1070 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.9 +// protoc (unknown) +// source: wayplatform/connect/rfms/v5/rfms_api.proto + +package rfmsv5 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Request for Vehicles. +type VehiclesRequest struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_LastVin *string `protobuf:"bytes,1,opt,name=last_vin,json=lastVin"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *VehiclesRequest) Reset() { + *x = VehiclesRequest{} + mi := &file_wayplatform_connect_rfms_v5_rfms_api_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *VehiclesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VehiclesRequest) ProtoMessage() {} + +func (x *VehiclesRequest) ProtoReflect() protoreflect.Message { + mi := &file_wayplatform_connect_rfms_v5_rfms_api_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *VehiclesRequest) GetLastVin() string { + if x != nil { + if x.xxx_hidden_LastVin != nil { + return *x.xxx_hidden_LastVin + } + return "" + } + return "" +} + +func (x *VehiclesRequest) SetLastVin(v string) { + x.xxx_hidden_LastVin = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 1) +} + +func (x *VehiclesRequest) HasLastVin() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *VehiclesRequest) ClearLastVin() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_LastVin = nil +} + +type VehiclesRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Last VIN included in the previous response, for pagination. + LastVin *string +} + +func (b0 VehiclesRequest_builder) Build() *VehiclesRequest { + m0 := &VehiclesRequest{} + b, x := &b0, m0 + _, _ = b, x + if b.LastVin != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 1) + x.xxx_hidden_LastVin = b.LastVin + } + return m0 +} + +// Response for Vehicles. +type VehiclesResponse struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Vehicles *[]*Vehicle `protobuf:"bytes,1,rep,name=vehicles"` + xxx_hidden_MoreDataAvailable bool `protobuf:"varint,2,opt,name=more_data_available,json=moreDataAvailable"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *VehiclesResponse) Reset() { + *x = VehiclesResponse{} + mi := &file_wayplatform_connect_rfms_v5_rfms_api_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *VehiclesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VehiclesResponse) ProtoMessage() {} + +func (x *VehiclesResponse) ProtoReflect() protoreflect.Message { + mi := &file_wayplatform_connect_rfms_v5_rfms_api_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *VehiclesResponse) GetVehicles() []*Vehicle { + if x != nil { + if x.xxx_hidden_Vehicles != nil { + return *x.xxx_hidden_Vehicles + } + } + return nil +} + +func (x *VehiclesResponse) GetMoreDataAvailable() bool { + if x != nil { + return x.xxx_hidden_MoreDataAvailable + } + return false +} + +func (x *VehiclesResponse) SetVehicles(v []*Vehicle) { + x.xxx_hidden_Vehicles = &v +} + +func (x *VehiclesResponse) SetMoreDataAvailable(v bool) { + x.xxx_hidden_MoreDataAvailable = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 2) +} + +func (x *VehiclesResponse) HasMoreDataAvailable() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *VehiclesResponse) ClearMoreDataAvailable() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_MoreDataAvailable = false +} + +type VehiclesResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // The vehicles. + Vehicles []*Vehicle + // Whether more data is available for pagination. + MoreDataAvailable *bool +} + +func (b0 VehiclesResponse_builder) Build() *VehiclesResponse { + m0 := &VehiclesResponse{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Vehicles = &b.Vehicles + if b.MoreDataAvailable != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 2) + x.xxx_hidden_MoreDataAvailable = *b.MoreDataAvailable + } + return m0 +} + +// Request for VehiclePositions. +type VehiclePositionsRequest struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_LastVin *string `protobuf:"bytes,1,opt,name=last_vin,json=lastVin"` + xxx_hidden_DateType *string `protobuf:"bytes,2,opt,name=date_type,json=dateType"` + xxx_hidden_StartTime *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=start_time,json=startTime"` + xxx_hidden_StopTime *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=stop_time,json=stopTime"` + xxx_hidden_Vin *string `protobuf:"bytes,5,opt,name=vin"` + xxx_hidden_LatestOnly bool `protobuf:"varint,6,opt,name=latest_only,json=latestOnly"` + xxx_hidden_TriggerFilter *string `protobuf:"bytes,7,opt,name=trigger_filter,json=triggerFilter"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *VehiclePositionsRequest) Reset() { + *x = VehiclePositionsRequest{} + mi := &file_wayplatform_connect_rfms_v5_rfms_api_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *VehiclePositionsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VehiclePositionsRequest) ProtoMessage() {} + +func (x *VehiclePositionsRequest) ProtoReflect() protoreflect.Message { + mi := &file_wayplatform_connect_rfms_v5_rfms_api_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *VehiclePositionsRequest) GetLastVin() string { + if x != nil { + if x.xxx_hidden_LastVin != nil { + return *x.xxx_hidden_LastVin + } + return "" + } + return "" +} + +func (x *VehiclePositionsRequest) GetDateType() string { + if x != nil { + if x.xxx_hidden_DateType != nil { + return *x.xxx_hidden_DateType + } + return "" + } + return "" +} + +func (x *VehiclePositionsRequest) GetStartTime() *timestamppb.Timestamp { + if x != nil { + return x.xxx_hidden_StartTime + } + return nil +} + +func (x *VehiclePositionsRequest) GetStopTime() *timestamppb.Timestamp { + if x != nil { + return x.xxx_hidden_StopTime + } + return nil +} + +func (x *VehiclePositionsRequest) GetVin() string { + if x != nil { + if x.xxx_hidden_Vin != nil { + return *x.xxx_hidden_Vin + } + return "" + } + return "" +} + +func (x *VehiclePositionsRequest) GetLatestOnly() bool { + if x != nil { + return x.xxx_hidden_LatestOnly + } + return false +} + +func (x *VehiclePositionsRequest) GetTriggerFilter() string { + if x != nil { + if x.xxx_hidden_TriggerFilter != nil { + return *x.xxx_hidden_TriggerFilter + } + return "" + } + return "" +} + +func (x *VehiclePositionsRequest) SetLastVin(v string) { + x.xxx_hidden_LastVin = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 7) +} + +func (x *VehiclePositionsRequest) SetDateType(v string) { + x.xxx_hidden_DateType = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 7) +} + +func (x *VehiclePositionsRequest) SetStartTime(v *timestamppb.Timestamp) { + x.xxx_hidden_StartTime = v +} + +func (x *VehiclePositionsRequest) SetStopTime(v *timestamppb.Timestamp) { + x.xxx_hidden_StopTime = v +} + +func (x *VehiclePositionsRequest) SetVin(v string) { + x.xxx_hidden_Vin = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 4, 7) +} + +func (x *VehiclePositionsRequest) SetLatestOnly(v bool) { + x.xxx_hidden_LatestOnly = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 5, 7) +} + +func (x *VehiclePositionsRequest) SetTriggerFilter(v string) { + x.xxx_hidden_TriggerFilter = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 6, 7) +} + +func (x *VehiclePositionsRequest) HasLastVin() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *VehiclePositionsRequest) HasDateType() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *VehiclePositionsRequest) HasStartTime() bool { + if x == nil { + return false + } + return x.xxx_hidden_StartTime != nil +} + +func (x *VehiclePositionsRequest) HasStopTime() bool { + if x == nil { + return false + } + return x.xxx_hidden_StopTime != nil +} + +func (x *VehiclePositionsRequest) HasVin() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 4) +} + +func (x *VehiclePositionsRequest) HasLatestOnly() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 5) +} + +func (x *VehiclePositionsRequest) HasTriggerFilter() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 6) +} + +func (x *VehiclePositionsRequest) ClearLastVin() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_LastVin = nil +} + +func (x *VehiclePositionsRequest) ClearDateType() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_DateType = nil +} + +func (x *VehiclePositionsRequest) ClearStartTime() { + x.xxx_hidden_StartTime = nil +} + +func (x *VehiclePositionsRequest) ClearStopTime() { + x.xxx_hidden_StopTime = nil +} + +func (x *VehiclePositionsRequest) ClearVin() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 4) + x.xxx_hidden_Vin = nil +} + +func (x *VehiclePositionsRequest) ClearLatestOnly() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 5) + x.xxx_hidden_LatestOnly = false +} + +func (x *VehiclePositionsRequest) ClearTriggerFilter() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 6) + x.xxx_hidden_TriggerFilter = nil +} + +type VehiclePositionsRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Last VIN included in the previous response, for pagination. + LastVin *string + // Whether start/stop times are compared to created or received time. + DateType *string + // Start of the time window. + StartTime *timestamppb.Timestamp + // End of the time window. + StopTime *timestamppb.Timestamp + // Filter positions for a specific vehicle VIN. + Vin *string + // Return only the latest position for each vehicle. + LatestOnly *bool + // Filter positions by trigger type. + TriggerFilter *string +} + +func (b0 VehiclePositionsRequest_builder) Build() *VehiclePositionsRequest { + m0 := &VehiclePositionsRequest{} + b, x := &b0, m0 + _, _ = b, x + if b.LastVin != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 7) + x.xxx_hidden_LastVin = b.LastVin + } + if b.DateType != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 7) + x.xxx_hidden_DateType = b.DateType + } + x.xxx_hidden_StartTime = b.StartTime + x.xxx_hidden_StopTime = b.StopTime + if b.Vin != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 4, 7) + x.xxx_hidden_Vin = b.Vin + } + if b.LatestOnly != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 5, 7) + x.xxx_hidden_LatestOnly = *b.LatestOnly + } + if b.TriggerFilter != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 6, 7) + x.xxx_hidden_TriggerFilter = b.TriggerFilter + } + return m0 +} + +// Response for VehiclePositions. +type VehiclePositionsResponse struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_VehiclePositions *[]*VehiclePosition `protobuf:"bytes,1,rep,name=vehicle_positions,json=vehiclePositions"` + xxx_hidden_MoreDataAvailable bool `protobuf:"varint,2,opt,name=more_data_available,json=moreDataAvailable"` + xxx_hidden_RequestServerDateTime *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=request_server_date_time,json=requestServerDateTime"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *VehiclePositionsResponse) Reset() { + *x = VehiclePositionsResponse{} + mi := &file_wayplatform_connect_rfms_v5_rfms_api_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *VehiclePositionsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VehiclePositionsResponse) ProtoMessage() {} + +func (x *VehiclePositionsResponse) ProtoReflect() protoreflect.Message { + mi := &file_wayplatform_connect_rfms_v5_rfms_api_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *VehiclePositionsResponse) GetVehiclePositions() []*VehiclePosition { + if x != nil { + if x.xxx_hidden_VehiclePositions != nil { + return *x.xxx_hidden_VehiclePositions + } + } + return nil +} + +func (x *VehiclePositionsResponse) GetMoreDataAvailable() bool { + if x != nil { + return x.xxx_hidden_MoreDataAvailable + } + return false +} + +func (x *VehiclePositionsResponse) GetRequestServerDateTime() *timestamppb.Timestamp { + if x != nil { + return x.xxx_hidden_RequestServerDateTime + } + return nil +} + +func (x *VehiclePositionsResponse) SetVehiclePositions(v []*VehiclePosition) { + x.xxx_hidden_VehiclePositions = &v +} + +func (x *VehiclePositionsResponse) SetMoreDataAvailable(v bool) { + x.xxx_hidden_MoreDataAvailable = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 3) +} + +func (x *VehiclePositionsResponse) SetRequestServerDateTime(v *timestamppb.Timestamp) { + x.xxx_hidden_RequestServerDateTime = v +} + +func (x *VehiclePositionsResponse) HasMoreDataAvailable() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *VehiclePositionsResponse) HasRequestServerDateTime() bool { + if x == nil { + return false + } + return x.xxx_hidden_RequestServerDateTime != nil +} + +func (x *VehiclePositionsResponse) ClearMoreDataAvailable() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_MoreDataAvailable = false +} + +func (x *VehiclePositionsResponse) ClearRequestServerDateTime() { + x.xxx_hidden_RequestServerDateTime = nil +} + +type VehiclePositionsResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // The vehicle positions. + VehiclePositions []*VehiclePosition + // Whether more data is available for pagination. + MoreDataAvailable *bool + // Server time when the request was received. + RequestServerDateTime *timestamppb.Timestamp +} + +func (b0 VehiclePositionsResponse_builder) Build() *VehiclePositionsResponse { + m0 := &VehiclePositionsResponse{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_VehiclePositions = &b.VehiclePositions + if b.MoreDataAvailable != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 3) + x.xxx_hidden_MoreDataAvailable = *b.MoreDataAvailable + } + x.xxx_hidden_RequestServerDateTime = b.RequestServerDateTime + return m0 +} + +// Request for VehicleStatuses. +type VehicleStatusesRequest struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_LastVin *string `protobuf:"bytes,1,opt,name=last_vin,json=lastVin"` + xxx_hidden_DateType *string `protobuf:"bytes,2,opt,name=date_type,json=dateType"` + xxx_hidden_StartTime *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=start_time,json=startTime"` + xxx_hidden_StopTime *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=stop_time,json=stopTime"` + xxx_hidden_Vin *string `protobuf:"bytes,5,opt,name=vin"` + xxx_hidden_ContentFilter []string `protobuf:"bytes,6,rep,name=content_filter,json=contentFilter"` + xxx_hidden_TriggerFilter []string `protobuf:"bytes,7,rep,name=trigger_filter,json=triggerFilter"` + xxx_hidden_LatestOnly bool `protobuf:"varint,8,opt,name=latest_only,json=latestOnly"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *VehicleStatusesRequest) Reset() { + *x = VehicleStatusesRequest{} + mi := &file_wayplatform_connect_rfms_v5_rfms_api_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *VehicleStatusesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VehicleStatusesRequest) ProtoMessage() {} + +func (x *VehicleStatusesRequest) ProtoReflect() protoreflect.Message { + mi := &file_wayplatform_connect_rfms_v5_rfms_api_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *VehicleStatusesRequest) GetLastVin() string { + if x != nil { + if x.xxx_hidden_LastVin != nil { + return *x.xxx_hidden_LastVin + } + return "" + } + return "" +} + +func (x *VehicleStatusesRequest) GetDateType() string { + if x != nil { + if x.xxx_hidden_DateType != nil { + return *x.xxx_hidden_DateType + } + return "" + } + return "" +} + +func (x *VehicleStatusesRequest) GetStartTime() *timestamppb.Timestamp { + if x != nil { + return x.xxx_hidden_StartTime + } + return nil +} + +func (x *VehicleStatusesRequest) GetStopTime() *timestamppb.Timestamp { + if x != nil { + return x.xxx_hidden_StopTime + } + return nil +} + +func (x *VehicleStatusesRequest) GetVin() string { + if x != nil { + if x.xxx_hidden_Vin != nil { + return *x.xxx_hidden_Vin + } + return "" + } + return "" +} + +func (x *VehicleStatusesRequest) GetContentFilter() []string { + if x != nil { + return x.xxx_hidden_ContentFilter + } + return nil +} + +func (x *VehicleStatusesRequest) GetTriggerFilter() []string { + if x != nil { + return x.xxx_hidden_TriggerFilter + } + return nil +} + +func (x *VehicleStatusesRequest) GetLatestOnly() bool { + if x != nil { + return x.xxx_hidden_LatestOnly + } + return false +} + +func (x *VehicleStatusesRequest) SetLastVin(v string) { + x.xxx_hidden_LastVin = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 0, 8) +} + +func (x *VehicleStatusesRequest) SetDateType(v string) { + x.xxx_hidden_DateType = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 8) +} + +func (x *VehicleStatusesRequest) SetStartTime(v *timestamppb.Timestamp) { + x.xxx_hidden_StartTime = v +} + +func (x *VehicleStatusesRequest) SetStopTime(v *timestamppb.Timestamp) { + x.xxx_hidden_StopTime = v +} + +func (x *VehicleStatusesRequest) SetVin(v string) { + x.xxx_hidden_Vin = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 4, 8) +} + +func (x *VehicleStatusesRequest) SetContentFilter(v []string) { + x.xxx_hidden_ContentFilter = v +} + +func (x *VehicleStatusesRequest) SetTriggerFilter(v []string) { + x.xxx_hidden_TriggerFilter = v +} + +func (x *VehicleStatusesRequest) SetLatestOnly(v bool) { + x.xxx_hidden_LatestOnly = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 7, 8) +} + +func (x *VehicleStatusesRequest) HasLastVin() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 0) +} + +func (x *VehicleStatusesRequest) HasDateType() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *VehicleStatusesRequest) HasStartTime() bool { + if x == nil { + return false + } + return x.xxx_hidden_StartTime != nil +} + +func (x *VehicleStatusesRequest) HasStopTime() bool { + if x == nil { + return false + } + return x.xxx_hidden_StopTime != nil +} + +func (x *VehicleStatusesRequest) HasVin() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 4) +} + +func (x *VehicleStatusesRequest) HasLatestOnly() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 7) +} + +func (x *VehicleStatusesRequest) ClearLastVin() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 0) + x.xxx_hidden_LastVin = nil +} + +func (x *VehicleStatusesRequest) ClearDateType() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_DateType = nil +} + +func (x *VehicleStatusesRequest) ClearStartTime() { + x.xxx_hidden_StartTime = nil +} + +func (x *VehicleStatusesRequest) ClearStopTime() { + x.xxx_hidden_StopTime = nil +} + +func (x *VehicleStatusesRequest) ClearVin() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 4) + x.xxx_hidden_Vin = nil +} + +func (x *VehicleStatusesRequest) ClearLatestOnly() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 7) + x.xxx_hidden_LatestOnly = false +} + +type VehicleStatusesRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Last VIN included in the previous response, for pagination. + LastVin *string + // Whether start/stop times are compared to created or received time. + DateType *string + // Start of the time window. + StartTime *timestamppb.Timestamp + // End of the time window. + StopTime *timestamppb.Timestamp + // Filter statuses for a specific vehicle VIN. + Vin *string + // Filter statuses by content type (ACCUMULATED, SNAPSHOT, UPTIME). + ContentFilter []string + // Filter statuses by trigger type. + TriggerFilter []string + // Return only the latest status for each vehicle. + LatestOnly *bool +} + +func (b0 VehicleStatusesRequest_builder) Build() *VehicleStatusesRequest { + m0 := &VehicleStatusesRequest{} + b, x := &b0, m0 + _, _ = b, x + if b.LastVin != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 0, 8) + x.xxx_hidden_LastVin = b.LastVin + } + if b.DateType != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 8) + x.xxx_hidden_DateType = b.DateType + } + x.xxx_hidden_StartTime = b.StartTime + x.xxx_hidden_StopTime = b.StopTime + if b.Vin != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 4, 8) + x.xxx_hidden_Vin = b.Vin + } + x.xxx_hidden_ContentFilter = b.ContentFilter + x.xxx_hidden_TriggerFilter = b.TriggerFilter + if b.LatestOnly != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 7, 8) + x.xxx_hidden_LatestOnly = *b.LatestOnly + } + return m0 +} + +// Response for VehicleStatuses. +type VehicleStatusesResponse struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_VehicleStatuses *[]*VehicleStatus `protobuf:"bytes,1,rep,name=vehicle_statuses,json=vehicleStatuses"` + xxx_hidden_MoreDataAvailable bool `protobuf:"varint,2,opt,name=more_data_available,json=moreDataAvailable"` + xxx_hidden_RequestServerDateTime *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=request_server_date_time,json=requestServerDateTime"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *VehicleStatusesResponse) Reset() { + *x = VehicleStatusesResponse{} + mi := &file_wayplatform_connect_rfms_v5_rfms_api_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *VehicleStatusesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VehicleStatusesResponse) ProtoMessage() {} + +func (x *VehicleStatusesResponse) ProtoReflect() protoreflect.Message { + mi := &file_wayplatform_connect_rfms_v5_rfms_api_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *VehicleStatusesResponse) GetVehicleStatuses() []*VehicleStatus { + if x != nil { + if x.xxx_hidden_VehicleStatuses != nil { + return *x.xxx_hidden_VehicleStatuses + } + } + return nil +} + +func (x *VehicleStatusesResponse) GetMoreDataAvailable() bool { + if x != nil { + return x.xxx_hidden_MoreDataAvailable + } + return false +} + +func (x *VehicleStatusesResponse) GetRequestServerDateTime() *timestamppb.Timestamp { + if x != nil { + return x.xxx_hidden_RequestServerDateTime + } + return nil +} + +func (x *VehicleStatusesResponse) SetVehicleStatuses(v []*VehicleStatus) { + x.xxx_hidden_VehicleStatuses = &v +} + +func (x *VehicleStatusesResponse) SetMoreDataAvailable(v bool) { + x.xxx_hidden_MoreDataAvailable = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 3) +} + +func (x *VehicleStatusesResponse) SetRequestServerDateTime(v *timestamppb.Timestamp) { + x.xxx_hidden_RequestServerDateTime = v +} + +func (x *VehicleStatusesResponse) HasMoreDataAvailable() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *VehicleStatusesResponse) HasRequestServerDateTime() bool { + if x == nil { + return false + } + return x.xxx_hidden_RequestServerDateTime != nil +} + +func (x *VehicleStatusesResponse) ClearMoreDataAvailable() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_MoreDataAvailable = false +} + +func (x *VehicleStatusesResponse) ClearRequestServerDateTime() { + x.xxx_hidden_RequestServerDateTime = nil +} + +type VehicleStatusesResponse_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // The vehicle statuses. + VehicleStatuses []*VehicleStatus + // Whether more data is available for pagination. + MoreDataAvailable *bool + // Server time when the request was received. + RequestServerDateTime *timestamppb.Timestamp +} + +func (b0 VehicleStatusesResponse_builder) Build() *VehicleStatusesResponse { + m0 := &VehicleStatusesResponse{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_VehicleStatuses = &b.VehicleStatuses + if b.MoreDataAvailable != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 3) + x.xxx_hidden_MoreDataAvailable = *b.MoreDataAvailable + } + x.xxx_hidden_RequestServerDateTime = b.RequestServerDateTime + return m0 +} + +var File_wayplatform_connect_rfms_v5_rfms_api_proto protoreflect.FileDescriptor + +const file_wayplatform_connect_rfms_v5_rfms_api_proto_rawDesc = "" + + "\n" + + "*wayplatform/connect/rfms/v5/rfms_api.proto\x12\x1bwayplatform.connect.rfms.v5\x1a\x1fgoogle/protobuf/timestamp.proto\x1a)wayplatform/connect/rfms/v5/vehicle.proto\x1a2wayplatform/connect/rfms/v5/vehicle_position.proto\x1a0wayplatform/connect/rfms/v5/vehicle_status.proto\",\n" + + "\x0fVehiclesRequest\x12\x19\n" + + "\blast_vin\x18\x01 \x01(\tR\alastVin\"\x84\x01\n" + + "\x10VehiclesResponse\x12@\n" + + "\bvehicles\x18\x01 \x03(\v2$.wayplatform.connect.rfms.v5.VehicleR\bvehicles\x12.\n" + + "\x13more_data_available\x18\x02 \x01(\bR\x11moreDataAvailable\"\x9f\x02\n" + + "\x17VehiclePositionsRequest\x12\x19\n" + + "\blast_vin\x18\x01 \x01(\tR\alastVin\x12\x1b\n" + + "\tdate_type\x18\x02 \x01(\tR\bdateType\x129\n" + + "\n" + + "start_time\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampR\tstartTime\x127\n" + + "\tstop_time\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampR\bstopTime\x12\x10\n" + + "\x03vin\x18\x05 \x01(\tR\x03vin\x12\x1f\n" + + "\vlatest_only\x18\x06 \x01(\bR\n" + + "latestOnly\x12%\n" + + "\x0etrigger_filter\x18\a \x01(\tR\rtriggerFilter\"\xfa\x01\n" + + "\x18VehiclePositionsResponse\x12Y\n" + + "\x11vehicle_positions\x18\x01 \x03(\v2,.wayplatform.connect.rfms.v5.VehiclePositionR\x10vehiclePositions\x12.\n" + + "\x13more_data_available\x18\x02 \x01(\bR\x11moreDataAvailable\x12S\n" + + "\x18request_server_date_time\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampR\x15requestServerDateTime\"\xc5\x02\n" + + "\x16VehicleStatusesRequest\x12\x19\n" + + "\blast_vin\x18\x01 \x01(\tR\alastVin\x12\x1b\n" + + "\tdate_type\x18\x02 \x01(\tR\bdateType\x129\n" + + "\n" + + "start_time\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampR\tstartTime\x127\n" + + "\tstop_time\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampR\bstopTime\x12\x10\n" + + "\x03vin\x18\x05 \x01(\tR\x03vin\x12%\n" + + "\x0econtent_filter\x18\x06 \x03(\tR\rcontentFilter\x12%\n" + + "\x0etrigger_filter\x18\a \x03(\tR\rtriggerFilter\x12\x1f\n" + + "\vlatest_only\x18\b \x01(\bR\n" + + "latestOnly\"\xf5\x01\n" + + "\x17VehicleStatusesResponse\x12U\n" + + "\x10vehicle_statuses\x18\x01 \x03(\v2*.wayplatform.connect.rfms.v5.VehicleStatusR\x0fvehicleStatuses\x12.\n" + + "\x13more_data_available\x18\x02 \x01(\bR\x11moreDataAvailable\x12S\n" + + "\x18request_server_date_time\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampR\x15requestServerDateTime2\xf1\x02\n" + + "\aRfmsApi\x12g\n" + + "\bVehicles\x12,.wayplatform.connect.rfms.v5.VehiclesRequest\x1a-.wayplatform.connect.rfms.v5.VehiclesResponse\x12\x7f\n" + + "\x10VehiclePositions\x124.wayplatform.connect.rfms.v5.VehiclePositionsRequest\x1a5.wayplatform.connect.rfms.v5.VehiclePositionsResponse\x12|\n" + + "\x0fVehicleStatuses\x123.wayplatform.connect.rfms.v5.VehicleStatusesRequest\x1a4.wayplatform.connect.rfms.v5.VehicleStatusesResponseB\x8f\x02\n" + + "\x1fcom.wayplatform.connect.rfms.v5B\fRfmsApiProtoP\x01ZOgithub.com/way-platform/rfms-go/proto/gen/go/wayplatform/connect/rfms/v5;rfmsv5\xa2\x02\x03WCR\xaa\x02\x1bWayplatform.Connect.Rfms.V5\xca\x02\x1bWayplatform\\Connect\\Rfms\\V5\xe2\x02'Wayplatform\\Connect\\Rfms\\V5\\GPBMetadata\xea\x02\x1eWayplatform::Connect::Rfms::V5b\beditionsp\xe8\a" + +var file_wayplatform_connect_rfms_v5_rfms_api_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_wayplatform_connect_rfms_v5_rfms_api_proto_goTypes = []any{ + (*VehiclesRequest)(nil), // 0: wayplatform.connect.rfms.v5.VehiclesRequest + (*VehiclesResponse)(nil), // 1: wayplatform.connect.rfms.v5.VehiclesResponse + (*VehiclePositionsRequest)(nil), // 2: wayplatform.connect.rfms.v5.VehiclePositionsRequest + (*VehiclePositionsResponse)(nil), // 3: wayplatform.connect.rfms.v5.VehiclePositionsResponse + (*VehicleStatusesRequest)(nil), // 4: wayplatform.connect.rfms.v5.VehicleStatusesRequest + (*VehicleStatusesResponse)(nil), // 5: wayplatform.connect.rfms.v5.VehicleStatusesResponse + (*Vehicle)(nil), // 6: wayplatform.connect.rfms.v5.Vehicle + (*timestamppb.Timestamp)(nil), // 7: google.protobuf.Timestamp + (*VehiclePosition)(nil), // 8: wayplatform.connect.rfms.v5.VehiclePosition + (*VehicleStatus)(nil), // 9: wayplatform.connect.rfms.v5.VehicleStatus +} +var file_wayplatform_connect_rfms_v5_rfms_api_proto_depIdxs = []int32{ + 6, // 0: wayplatform.connect.rfms.v5.VehiclesResponse.vehicles:type_name -> wayplatform.connect.rfms.v5.Vehicle + 7, // 1: wayplatform.connect.rfms.v5.VehiclePositionsRequest.start_time:type_name -> google.protobuf.Timestamp + 7, // 2: wayplatform.connect.rfms.v5.VehiclePositionsRequest.stop_time:type_name -> google.protobuf.Timestamp + 8, // 3: wayplatform.connect.rfms.v5.VehiclePositionsResponse.vehicle_positions:type_name -> wayplatform.connect.rfms.v5.VehiclePosition + 7, // 4: wayplatform.connect.rfms.v5.VehiclePositionsResponse.request_server_date_time:type_name -> google.protobuf.Timestamp + 7, // 5: wayplatform.connect.rfms.v5.VehicleStatusesRequest.start_time:type_name -> google.protobuf.Timestamp + 7, // 6: wayplatform.connect.rfms.v5.VehicleStatusesRequest.stop_time:type_name -> google.protobuf.Timestamp + 9, // 7: wayplatform.connect.rfms.v5.VehicleStatusesResponse.vehicle_statuses:type_name -> wayplatform.connect.rfms.v5.VehicleStatus + 7, // 8: wayplatform.connect.rfms.v5.VehicleStatusesResponse.request_server_date_time:type_name -> google.protobuf.Timestamp + 0, // 9: wayplatform.connect.rfms.v5.RfmsApi.Vehicles:input_type -> wayplatform.connect.rfms.v5.VehiclesRequest + 2, // 10: wayplatform.connect.rfms.v5.RfmsApi.VehiclePositions:input_type -> wayplatform.connect.rfms.v5.VehiclePositionsRequest + 4, // 11: wayplatform.connect.rfms.v5.RfmsApi.VehicleStatuses:input_type -> wayplatform.connect.rfms.v5.VehicleStatusesRequest + 1, // 12: wayplatform.connect.rfms.v5.RfmsApi.Vehicles:output_type -> wayplatform.connect.rfms.v5.VehiclesResponse + 3, // 13: wayplatform.connect.rfms.v5.RfmsApi.VehiclePositions:output_type -> wayplatform.connect.rfms.v5.VehiclePositionsResponse + 5, // 14: wayplatform.connect.rfms.v5.RfmsApi.VehicleStatuses:output_type -> wayplatform.connect.rfms.v5.VehicleStatusesResponse + 12, // [12:15] is the sub-list for method output_type + 9, // [9:12] is the sub-list for method input_type + 9, // [9:9] is the sub-list for extension type_name + 9, // [9:9] is the sub-list for extension extendee + 0, // [0:9] is the sub-list for field type_name +} + +func init() { file_wayplatform_connect_rfms_v5_rfms_api_proto_init() } +func file_wayplatform_connect_rfms_v5_rfms_api_proto_init() { + if File_wayplatform_connect_rfms_v5_rfms_api_proto != nil { + return + } + file_wayplatform_connect_rfms_v5_vehicle_proto_init() + file_wayplatform_connect_rfms_v5_vehicle_position_proto_init() + file_wayplatform_connect_rfms_v5_vehicle_status_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_wayplatform_connect_rfms_v5_rfms_api_proto_rawDesc), len(file_wayplatform_connect_rfms_v5_rfms_api_proto_rawDesc)), + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_wayplatform_connect_rfms_v5_rfms_api_proto_goTypes, + DependencyIndexes: file_wayplatform_connect_rfms_v5_rfms_api_proto_depIdxs, + MessageInfos: file_wayplatform_connect_rfms_v5_rfms_api_proto_msgTypes, + }.Build() + File_wayplatform_connect_rfms_v5_rfms_api_proto = out.File + file_wayplatform_connect_rfms_v5_rfms_api_proto_goTypes = nil + file_wayplatform_connect_rfms_v5_rfms_api_proto_depIdxs = nil +} diff --git a/proto/gen/go/wayplatform/connect/rfms/v5/rfmsv5connect/rfms_api.connect.go b/proto/gen/go/wayplatform/connect/rfms/v5/rfmsv5connect/rfms_api.connect.go new file mode 100644 index 0000000..c2aac4c --- /dev/null +++ b/proto/gen/go/wayplatform/connect/rfms/v5/rfmsv5connect/rfms_api.connect.go @@ -0,0 +1,183 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: wayplatform/connect/rfms/v5/rfms_api.proto + +package rfmsv5connect + +import ( + connect "connectrpc.com/connect" + context "context" + errors "errors" + v5 "github.com/way-platform/rfms-go/proto/gen/go/wayplatform/connect/rfms/v5" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect.IsAtLeastVersion1_13_0 + +const ( + // RfmsApiName is the fully-qualified name of the RfmsApi service. + RfmsApiName = "wayplatform.connect.rfms.v5.RfmsApi" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // RfmsApiVehiclesProcedure is the fully-qualified name of the RfmsApi's Vehicles RPC. + RfmsApiVehiclesProcedure = "/wayplatform.connect.rfms.v5.RfmsApi/Vehicles" + // RfmsApiVehiclePositionsProcedure is the fully-qualified name of the RfmsApi's VehiclePositions + // RPC. + RfmsApiVehiclePositionsProcedure = "/wayplatform.connect.rfms.v5.RfmsApi/VehiclePositions" + // RfmsApiVehicleStatusesProcedure is the fully-qualified name of the RfmsApi's VehicleStatuses RPC. + RfmsApiVehicleStatusesProcedure = "/wayplatform.connect.rfms.v5.RfmsApi/VehicleStatuses" +) + +// RfmsApiClient is a client for the wayplatform.connect.rfms.v5.RfmsApi service. +type RfmsApiClient interface { + // Vehicles lists vehicles registered in the fleet. + Vehicles(context.Context, *v5.VehiclesRequest) (*v5.VehiclesResponse, error) + // VehiclePositions lists vehicle positions. + VehiclePositions(context.Context, *v5.VehiclePositionsRequest) (*v5.VehiclePositionsResponse, error) + // VehicleStatuses lists vehicle statuses. + VehicleStatuses(context.Context, *v5.VehicleStatusesRequest) (*v5.VehicleStatusesResponse, error) +} + +// NewRfmsApiClient constructs a client for the wayplatform.connect.rfms.v5.RfmsApi service. By +// default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, +// and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the +// connect.WithGRPC() or connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewRfmsApiClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) RfmsApiClient { + baseURL = strings.TrimRight(baseURL, "/") + rfmsApiMethods := v5.File_wayplatform_connect_rfms_v5_rfms_api_proto.Services().ByName("RfmsApi").Methods() + return &rfmsApiClient{ + vehicles: connect.NewClient[v5.VehiclesRequest, v5.VehiclesResponse]( + httpClient, + baseURL+RfmsApiVehiclesProcedure, + connect.WithSchema(rfmsApiMethods.ByName("Vehicles")), + connect.WithClientOptions(opts...), + ), + vehiclePositions: connect.NewClient[v5.VehiclePositionsRequest, v5.VehiclePositionsResponse]( + httpClient, + baseURL+RfmsApiVehiclePositionsProcedure, + connect.WithSchema(rfmsApiMethods.ByName("VehiclePositions")), + connect.WithClientOptions(opts...), + ), + vehicleStatuses: connect.NewClient[v5.VehicleStatusesRequest, v5.VehicleStatusesResponse]( + httpClient, + baseURL+RfmsApiVehicleStatusesProcedure, + connect.WithSchema(rfmsApiMethods.ByName("VehicleStatuses")), + connect.WithClientOptions(opts...), + ), + } +} + +// rfmsApiClient implements RfmsApiClient. +type rfmsApiClient struct { + vehicles *connect.Client[v5.VehiclesRequest, v5.VehiclesResponse] + vehiclePositions *connect.Client[v5.VehiclePositionsRequest, v5.VehiclePositionsResponse] + vehicleStatuses *connect.Client[v5.VehicleStatusesRequest, v5.VehicleStatusesResponse] +} + +// Vehicles calls wayplatform.connect.rfms.v5.RfmsApi.Vehicles. +func (c *rfmsApiClient) Vehicles(ctx context.Context, req *v5.VehiclesRequest) (*v5.VehiclesResponse, error) { + response, err := c.vehicles.CallUnary(ctx, connect.NewRequest(req)) + if response != nil { + return response.Msg, err + } + return nil, err +} + +// VehiclePositions calls wayplatform.connect.rfms.v5.RfmsApi.VehiclePositions. +func (c *rfmsApiClient) VehiclePositions(ctx context.Context, req *v5.VehiclePositionsRequest) (*v5.VehiclePositionsResponse, error) { + response, err := c.vehiclePositions.CallUnary(ctx, connect.NewRequest(req)) + if response != nil { + return response.Msg, err + } + return nil, err +} + +// VehicleStatuses calls wayplatform.connect.rfms.v5.RfmsApi.VehicleStatuses. +func (c *rfmsApiClient) VehicleStatuses(ctx context.Context, req *v5.VehicleStatusesRequest) (*v5.VehicleStatusesResponse, error) { + response, err := c.vehicleStatuses.CallUnary(ctx, connect.NewRequest(req)) + if response != nil { + return response.Msg, err + } + return nil, err +} + +// RfmsApiHandler is an implementation of the wayplatform.connect.rfms.v5.RfmsApi service. +type RfmsApiHandler interface { + // Vehicles lists vehicles registered in the fleet. + Vehicles(context.Context, *v5.VehiclesRequest) (*v5.VehiclesResponse, error) + // VehiclePositions lists vehicle positions. + VehiclePositions(context.Context, *v5.VehiclePositionsRequest) (*v5.VehiclePositionsResponse, error) + // VehicleStatuses lists vehicle statuses. + VehicleStatuses(context.Context, *v5.VehicleStatusesRequest) (*v5.VehicleStatusesResponse, error) +} + +// NewRfmsApiHandler builds an HTTP handler from the service implementation. It returns the path on +// which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewRfmsApiHandler(svc RfmsApiHandler, opts ...connect.HandlerOption) (string, http.Handler) { + rfmsApiMethods := v5.File_wayplatform_connect_rfms_v5_rfms_api_proto.Services().ByName("RfmsApi").Methods() + rfmsApiVehiclesHandler := connect.NewUnaryHandlerSimple( + RfmsApiVehiclesProcedure, + svc.Vehicles, + connect.WithSchema(rfmsApiMethods.ByName("Vehicles")), + connect.WithHandlerOptions(opts...), + ) + rfmsApiVehiclePositionsHandler := connect.NewUnaryHandlerSimple( + RfmsApiVehiclePositionsProcedure, + svc.VehiclePositions, + connect.WithSchema(rfmsApiMethods.ByName("VehiclePositions")), + connect.WithHandlerOptions(opts...), + ) + rfmsApiVehicleStatusesHandler := connect.NewUnaryHandlerSimple( + RfmsApiVehicleStatusesProcedure, + svc.VehicleStatuses, + connect.WithSchema(rfmsApiMethods.ByName("VehicleStatuses")), + connect.WithHandlerOptions(opts...), + ) + return "/wayplatform.connect.rfms.v5.RfmsApi/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case RfmsApiVehiclesProcedure: + rfmsApiVehiclesHandler.ServeHTTP(w, r) + case RfmsApiVehiclePositionsProcedure: + rfmsApiVehiclePositionsHandler.ServeHTTP(w, r) + case RfmsApiVehicleStatusesProcedure: + rfmsApiVehicleStatusesHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedRfmsApiHandler returns CodeUnimplemented from all methods. +type UnimplementedRfmsApiHandler struct{} + +func (UnimplementedRfmsApiHandler) Vehicles(context.Context, *v5.VehiclesRequest) (*v5.VehiclesResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("wayplatform.connect.rfms.v5.RfmsApi.Vehicles is not implemented")) +} + +func (UnimplementedRfmsApiHandler) VehiclePositions(context.Context, *v5.VehiclePositionsRequest) (*v5.VehiclePositionsResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("wayplatform.connect.rfms.v5.RfmsApi.VehiclePositions is not implemented")) +} + +func (UnimplementedRfmsApiHandler) VehicleStatuses(context.Context, *v5.VehicleStatusesRequest) (*v5.VehicleStatusesResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("wayplatform.connect.rfms.v5.RfmsApi.VehicleStatuses is not implemented")) +} diff --git a/proto/gen/go/wayplatform/connect/rfms/v5/snapshot_data.pb.go b/proto/gen/go/wayplatform/connect/rfms/v5/snapshot_data.pb.go index 3ebd0c6..b53001f 100644 --- a/proto/gen/go/wayplatform/connect/rfms/v5/snapshot_data.pb.go +++ b/proto/gen/go/wayplatform/connect/rfms/v5/snapshot_data.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.8 +// protoc-gen-go v1.36.9 // protoc (unknown) // source: wayplatform/connect/rfms/v5/snapshot_data.proto diff --git a/proto/gen/go/wayplatform/connect/rfms/v5/tachograph_type.pb.go b/proto/gen/go/wayplatform/connect/rfms/v5/tachograph_type.pb.go index 97ace82..8ad40c3 100644 --- a/proto/gen/go/wayplatform/connect/rfms/v5/tachograph_type.pb.go +++ b/proto/gen/go/wayplatform/connect/rfms/v5/tachograph_type.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.8 +// protoc-gen-go v1.36.9 // protoc (unknown) // source: wayplatform/connect/rfms/v5/tachograph_type.proto diff --git a/proto/gen/go/wayplatform/connect/rfms/v5/tell_tale.pb.go b/proto/gen/go/wayplatform/connect/rfms/v5/tell_tale.pb.go index 6d62dc1..0d5c6cb 100644 --- a/proto/gen/go/wayplatform/connect/rfms/v5/tell_tale.pb.go +++ b/proto/gen/go/wayplatform/connect/rfms/v5/tell_tale.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.8 +// protoc-gen-go v1.36.9 // protoc (unknown) // source: wayplatform/connect/rfms/v5/tell_tale.proto diff --git a/proto/gen/go/wayplatform/connect/rfms/v5/trailer.pb.go b/proto/gen/go/wayplatform/connect/rfms/v5/trailer.pb.go index dc752e1..3be63a5 100644 --- a/proto/gen/go/wayplatform/connect/rfms/v5/trailer.pb.go +++ b/proto/gen/go/wayplatform/connect/rfms/v5/trailer.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.8 +// protoc-gen-go v1.36.9 // protoc (unknown) // source: wayplatform/connect/rfms/v5/trailer.proto diff --git a/proto/gen/go/wayplatform/connect/rfms/v5/trigger.pb.go b/proto/gen/go/wayplatform/connect/rfms/v5/trigger.pb.go index 4189cc4..34e264f 100644 --- a/proto/gen/go/wayplatform/connect/rfms/v5/trigger.pb.go +++ b/proto/gen/go/wayplatform/connect/rfms/v5/trigger.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.8 +// protoc-gen-go v1.36.9 // protoc (unknown) // source: wayplatform/connect/rfms/v5/trigger.proto diff --git a/proto/gen/go/wayplatform/connect/rfms/v5/uptime_data.pb.go b/proto/gen/go/wayplatform/connect/rfms/v5/uptime_data.pb.go index 4e83e8a..14c71fd 100644 --- a/proto/gen/go/wayplatform/connect/rfms/v5/uptime_data.pb.go +++ b/proto/gen/go/wayplatform/connect/rfms/v5/uptime_data.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.8 +// protoc-gen-go v1.36.9 // protoc (unknown) // source: wayplatform/connect/rfms/v5/uptime_data.proto diff --git a/proto/gen/go/wayplatform/connect/rfms/v5/vehicle.pb.go b/proto/gen/go/wayplatform/connect/rfms/v5/vehicle.pb.go index 06ec0b3..749025a 100644 --- a/proto/gen/go/wayplatform/connect/rfms/v5/vehicle.pb.go +++ b/proto/gen/go/wayplatform/connect/rfms/v5/vehicle.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.8 +// protoc-gen-go v1.36.9 // protoc (unknown) // source: wayplatform/connect/rfms/v5/vehicle.proto diff --git a/proto/gen/go/wayplatform/connect/rfms/v5/vehicle_axle.pb.go b/proto/gen/go/wayplatform/connect/rfms/v5/vehicle_axle.pb.go index 71ffa41..4c0952d 100644 --- a/proto/gen/go/wayplatform/connect/rfms/v5/vehicle_axle.pb.go +++ b/proto/gen/go/wayplatform/connect/rfms/v5/vehicle_axle.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.8 +// protoc-gen-go v1.36.9 // protoc (unknown) // source: wayplatform/connect/rfms/v5/vehicle_axle.proto diff --git a/proto/gen/go/wayplatform/connect/rfms/v5/vehicle_position.pb.go b/proto/gen/go/wayplatform/connect/rfms/v5/vehicle_position.pb.go index 89275fc..5a2ae1a 100644 --- a/proto/gen/go/wayplatform/connect/rfms/v5/vehicle_position.pb.go +++ b/proto/gen/go/wayplatform/connect/rfms/v5/vehicle_position.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.8 +// protoc-gen-go v1.36.9 // protoc (unknown) // source: wayplatform/connect/rfms/v5/vehicle_position.proto diff --git a/proto/gen/go/wayplatform/connect/rfms/v5/vehicle_status.pb.go b/proto/gen/go/wayplatform/connect/rfms/v5/vehicle_status.pb.go index 383c5a2..3391236 100644 --- a/proto/gen/go/wayplatform/connect/rfms/v5/vehicle_status.pb.go +++ b/proto/gen/go/wayplatform/connect/rfms/v5/vehicle_status.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.8 +// protoc-gen-go v1.36.9 // protoc (unknown) // source: wayplatform/connect/rfms/v5/vehicle_status.proto diff --git a/proto/gen/go/wayplatform/connect/scania/rfms/v1/credentials.pb.go b/proto/gen/go/wayplatform/connect/scania/rfms/v1/credentials.pb.go index 582a156..afe85b2 100644 --- a/proto/gen/go/wayplatform/connect/scania/rfms/v1/credentials.pb.go +++ b/proto/gen/go/wayplatform/connect/scania/rfms/v1/credentials.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.8 +// protoc-gen-go v1.36.9 // protoc (unknown) // source: wayplatform/connect/scania/rfms/v1/credentials.proto diff --git a/proto/gen/go/wayplatform/connect/volvotrucks/rfms/v1/credentials.pb.go b/proto/gen/go/wayplatform/connect/volvotrucks/rfms/v1/credentials.pb.go index 5bd8e80..056f3bf 100644 --- a/proto/gen/go/wayplatform/connect/volvotrucks/rfms/v1/credentials.pb.go +++ b/proto/gen/go/wayplatform/connect/volvotrucks/rfms/v1/credentials.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.8 +// protoc-gen-go v1.36.9 // protoc (unknown) // source: wayplatform/connect/volvotrucks/rfms/v1/credentials.proto diff --git a/proto/wayplatform/connect/rfms/v5/rfms_api.proto b/proto/wayplatform/connect/rfms/v5/rfms_api.proto new file mode 100644 index 0000000..b070d0c --- /dev/null +++ b/proto/wayplatform/connect/rfms/v5/rfms_api.proto @@ -0,0 +1,110 @@ +edition = "2023"; + +package wayplatform.connect.rfms.v5; + +import "google/protobuf/timestamp.proto"; +import "wayplatform/connect/rfms/v5/vehicle.proto"; +import "wayplatform/connect/rfms/v5/vehicle_position.proto"; +import "wayplatform/connect/rfms/v5/vehicle_status.proto"; + +// RfmsApi is the interface definition for the rFMS Fleet Management Standard API. +service RfmsApi { + // Vehicles lists vehicles registered in the fleet. + rpc Vehicles(VehiclesRequest) returns (VehiclesResponse); + + // VehiclePositions lists vehicle positions. + rpc VehiclePositions(VehiclePositionsRequest) returns (VehiclePositionsResponse); + + // VehicleStatuses lists vehicle statuses. + rpc VehicleStatuses(VehicleStatusesRequest) returns (VehicleStatusesResponse); +} + +// Request for Vehicles. +message VehiclesRequest { + // Last VIN included in the previous response, for pagination. + string last_vin = 1; +} + +// Response for Vehicles. +message VehiclesResponse { + // The vehicles. + repeated Vehicle vehicles = 1; + + // Whether more data is available for pagination. + bool more_data_available = 2; +} + +// Request for VehiclePositions. +message VehiclePositionsRequest { + // Last VIN included in the previous response, for pagination. + string last_vin = 1; + + // Whether start/stop times are compared to created or received time. + string date_type = 2; + + // Start of the time window. + google.protobuf.Timestamp start_time = 3; + + // End of the time window. + google.protobuf.Timestamp stop_time = 4; + + // Filter positions for a specific vehicle VIN. + string vin = 5; + + // Return only the latest position for each vehicle. + bool latest_only = 6; + + // Filter positions by trigger type. + string trigger_filter = 7; +} + +// Response for VehiclePositions. +message VehiclePositionsResponse { + // The vehicle positions. + repeated VehiclePosition vehicle_positions = 1; + + // Whether more data is available for pagination. + bool more_data_available = 2; + + // Server time when the request was received. + google.protobuf.Timestamp request_server_date_time = 3; +} + +// Request for VehicleStatuses. +message VehicleStatusesRequest { + // Last VIN included in the previous response, for pagination. + string last_vin = 1; + + // Whether start/stop times are compared to created or received time. + string date_type = 2; + + // Start of the time window. + google.protobuf.Timestamp start_time = 3; + + // End of the time window. + google.protobuf.Timestamp stop_time = 4; + + // Filter statuses for a specific vehicle VIN. + string vin = 5; + + // Filter statuses by content type (ACCUMULATED, SNAPSHOT, UPTIME). + repeated string content_filter = 6; + + // Filter statuses by trigger type. + repeated string trigger_filter = 7; + + // Return only the latest status for each vehicle. + bool latest_only = 8; +} + +// Response for VehicleStatuses. +message VehicleStatusesResponse { + // The vehicle statuses. + repeated VehicleStatus vehicle_statuses = 1; + + // Whether more data is available for pagination. + bool more_data_available = 2; + + // Server time when the request was received. + google.protobuf.Timestamp request_server_date_time = 3; +} diff --git a/tools/go.mod b/tools/go.mod index f1f20f6..f5687d5 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -1,10 +1,9 @@ module github.com/way-platform/rfms-go/tools -go 1.25.0 - -toolchain go1.26.0 +go 1.26.0 tool ( + connectrpc.com/connect/cmd/protoc-gen-connect-go github.com/bufbuild/buf/cmd/buf github.com/charmbracelet/vhs github.com/golangci/golangci-lint/v2/cmd/golangci-lint @@ -34,7 +33,7 @@ require ( cel.dev/expr v0.24.0 // indirect codeberg.org/chavacava/garif v0.2.0 // indirect codeberg.org/polyfloyd/go-errorlint v1.9.0 // indirect - connectrpc.com/connect v1.18.1 // indirect + connectrpc.com/connect v1.19.1 // indirect connectrpc.com/otelconnect v0.7.2 // indirect dev.gaijin.team/go/exhaustruct/v4 v4.0.0 // indirect dev.gaijin.team/go/golib v0.6.0 // indirect @@ -348,7 +347,7 @@ require ( golang.org/x/tools v0.42.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20250707201910-8d1bb00bc6a7 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20250818200422-3122310a409c // indirect - google.golang.org/protobuf v1.36.8 // indirect + google.golang.org/protobuf v1.36.9 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/tools/go.sum b/tools/go.sum index 39fda71..1418620 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -32,8 +32,8 @@ codeberg.org/chavacava/garif v0.2.0 h1:F0tVjhYbuOCnvNcU3YSpO6b3Waw6Bimy4K0mM8y6M codeberg.org/chavacava/garif v0.2.0/go.mod h1:P2BPbVbT4QcvLZrORc2T29szK3xEOlnl0GiPTJmEqBQ= codeberg.org/polyfloyd/go-errorlint v1.9.0 h1:VkdEEmA1VBpH6ecQoMR4LdphVI3fA4RrCh2an7YmodI= codeberg.org/polyfloyd/go-errorlint v1.9.0/go.mod h1:GPRRu2LzVijNn4YkrZYJfatQIdS+TrcK8rL5Xs24qw8= -connectrpc.com/connect v1.18.1 h1:PAg7CjSAGvscaf6YZKUefjoih5Z/qYkyaTrBW8xvYPw= -connectrpc.com/connect v1.18.1/go.mod h1:0292hj1rnx8oFrStN7cB4jjVBeqs+Yx5yDIC2prWDO8= +connectrpc.com/connect v1.19.1 h1:R5M57z05+90EfEvCY1b7hBxDVOUl45PrtXtAV2fOC14= +connectrpc.com/connect v1.19.1/go.mod h1:tN20fjdGlewnSFeZxLKb0xwIZ6ozc3OQs2hTXy4du9w= connectrpc.com/otelconnect v0.7.2 h1:WlnwFzaW64dN06JXU+hREPUGeEzpz3Acz2ACOmN8cMI= connectrpc.com/otelconnect v0.7.2/go.mod h1:JS7XUKfuJs2adhCnXhNHPHLz6oAaZniCJdSF00OZSew= dev.gaijin.team/go/exhaustruct/v4 v4.0.0 h1:873r7aNneqoBB3IaFIzhvt2RFYTuHgmMjoKfwODoI1Y= @@ -961,8 +961,8 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc= -google.golang.org/protobuf v1.36.8/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= +google.golang.org/protobuf v1.36.9 h1:w2gp2mA27hUeUzj9Ex9FBjsBm40zfaDtEWow293U7Iw= +google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= diff --git a/tools/magefile.go b/tools/magefile.go index ba46ad0..569c34f 100644 --- a/tools/magefile.go +++ b/tools/magefile.go @@ -50,7 +50,10 @@ func Generate() error { func Lint() error { log.Println("linting and fixing code") return forEachGoMod(func(dir string) error { - return tool(dir, "golangci-lint", "run", "--fix", "--path-prefix", dir, "--build-tags", "mage").Run() + return toolWith( + map[string]string{"GOFLAGS": "-mod=mod"}, + dir, "golangci-lint", "run", "--fix", "--path-prefix", dir, "--build-tags", "mage", + ).Run() }) }