syntax = "proto3"; option csharp_namespace = "vestige.api.v1"; package vestige.api.v1; import "google/protobuf/timestamp.proto"; service ApiService { rpc GetAssets (GetAssetsRequest) returns (GetAssetsReply); rpc GetAssetStatuses (GetAssetStatusRequest) returns (GetAssetStatusReply); rpc GetAssetExtendedProperties (GetAssetExtendedPropertiesRequest) returns (GetAssetExtendedPropertiesReply); rpc GetAssetDiagnosticTroubleCodeDailyBuckets (GetAssetDiagnosticTroubleCodeDailyBucketsRequest) returns (GetAssetDiagnosticTroubleCodeDailyBucketsReply); rpc GetDrivers (GetDriversRequest) returns (GetDriversReply); rpc PushDriverAssignment (PushDriverAssignmentRequest) returns (PushDriverAssignmentReply); rpc UnassignVehicle (UnassignVehicleRequest) returns (UnassignVehicleReply); rpc UnassignDriver (UnassignDriverRequest) returns (UnassignDriverReply); } message GetAssetsRequest{} message GetAssetsReply{ repeated Asset Assets = 1; message Asset{ string Id = 1; string Name = 2; } } message GetAssetStatusRequest{ string AssetId = 1; repeated AssetStatusTypes StatusTypes = 2; } message GetAssetStatusReply{ optional OdometerStatus Odometer = 1; optional IgnitionStatus Ignition = 2; optional LocationStatus Location = 3; optional EngineOnDurationStatus EngineOnDuration = 4; optional EngineBatteryLevelStatus EngineBatteryLevel = 5; message OdometerStatus{ google.protobuf.Timestamp Date = 1; double Value = 2; //kilometers } message EngineOnDurationStatus{ google.protobuf.Timestamp Date = 1; double Value = 2; //hours } message IgnitionStatus{ google.protobuf.Timestamp Date = 1; bool Value = 2; } message LocationStatus{ google.protobuf.Timestamp Date = 1; string Address = 2; optional double Latitude = 3; optional double Longitude = 4; optional double Speed = 5; //km/h string DisplayName = 6; } message EngineBatteryLevelStatus{ google.protobuf.Timestamp Date = 1; double Value = 2; //volts } } enum AssetStatusTypes { NONE = 0; ODOMETER = 1; IGNITION = 2; LOCATION = 3; ENGINEONDURATION = 4; ENGINEBATTERYLEVEL = 5; } message GetAssetExtendedPropertiesRequest{ string AssetId = 1; repeated string Keys = 2; } message GetAssetExtendedPropertiesReply{ repeated AssetExtendedProperty Properties = 1; } message AssetExtendedProperty{ string Key = 1; string Value = 2; } message GetAssetDiagnosticTroubleCodeDailyBucketsRequest{ string AssetId = 1; string FromDate = 2; string ToDate = 3; } message GetAssetDiagnosticTroubleCodeDailyBucketsReply{ repeated GetAssetDiagnosticTroubleCodeDailyBucketsReplyItem Items = 1; message GetAssetDiagnosticTroubleCodeDailyBucketsReplyItem{ string Date = 1; repeated Code Codes = 2; message Code{ string Code = 1; } } } //GetAssets omits drivers, so this is where a driver's Id comes from. message GetDriversRequest{} message GetDriversReply{ repeated Driver Drivers = 1; message Driver{ string Id = 1; string Name = 2; } } message PushDriverAssignmentRequest{ string VehicleId = 1; //Id from GetAssets string DriverId = 2; //Id from GetDrivers google.protobuf.Timestamp Date = 3; //when the driver took the vehicle; whole seconds, sub-second is rejected } message PushDriverAssignmentReply{ bool Accepted = 1; //queued for processing, not yet applied } //Unassignment is one-sided, so there are two separate calls rather than one with optional fields. //UnassignVehicle says the vehicle has no driver; it does not say where its previous driver went. //UnassignDriver says the driver has no vehicle; it does not say who now has the vehicle they left. message UnassignVehicleRequest{ string VehicleId = 1; //Id from GetAssets google.protobuf.Timestamp Date = 2; //whole seconds, sub-second is rejected } message UnassignVehicleReply{ bool Accepted = 1; //queued for processing, not yet applied } message UnassignDriverRequest{ string DriverId = 1; //Id from GetDrivers google.protobuf.Timestamp Date = 2; //whole seconds, sub-second is rejected } message UnassignDriverReply{ bool Accepted = 1; //queued for processing, not yet applied }