Skip to content

Commit

Permalink
Generalized measurement types for lengths and weights
Browse files Browse the repository at this point in the history
  • Loading branch information
havan committed Dec 21, 2023
1 parent cc57ee7 commit 04cc8a4
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 31 deletions.
4 changes: 2 additions & 2 deletions proto/cmp/services/accommodation/v1alpha1/list.proto
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ message AccommodationProductListResponse {

// ### Accommodation Product List Service
//
// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/list.proto.dot.xs.svg)
// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/list.proto.dot.svg)
// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/accommodation/v1alpha1/list.proto.dot.xs.svg)
// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/accommodation/v1alpha1/list.proto.dot.svg)
service AccommodationProductListService {
// Returns product list for accommodation (properties)
rpc AccommodationProductList(AccommodationProductListRequest) returns (AccommodationProductListResponse);
Expand Down
10 changes: 5 additions & 5 deletions proto/cmp/services/transport/v1alpha1/trip_types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ syntax = "proto3";

package cmp.services.transport.v1alpha1;

import "cmp/types/v1alpha1/distance.proto";
import "cmp/types/v1alpha1/baggage.proto";
import "cmp/types/v1alpha1/location.proto";
import "cmp/types/v1alpha1/measurement.proto";
import "cmp/types/v1alpha1/price.proto";
import "cmp/types/v1alpha1/time.proto";
import "cmp/types/v1alpha1/baggage.proto";
import "google/protobuf/timestamp.proto";

// ### Trip message type
Expand Down Expand Up @@ -84,8 +84,8 @@ message TripSegment {

// Trip Distance
//
// Ex: `Distance(value=15, unit=DistanceType.DISTANCE_UNIT_KILOMETERS)`
cmp.types.v1alpha1.Distance trip_distance = 11;
// Ex: `Length(value=15, unit=LengthUnit.DISTANCE_UNIT_KILOMETERS)`
cmp.types.v1alpha1.Length trip_distance = 11;

// Min PAX
//
Expand Down Expand Up @@ -117,4 +117,4 @@ message TransitEvent {

// Event location
cmp.types.v1alpha1.LocationCode location_code = 2;
}
}
22 changes: 0 additions & 22 deletions proto/cmp/types/v1alpha1/distance.proto

This file was deleted.

4 changes: 2 additions & 2 deletions proto/cmp/types/v1alpha1/location.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ syntax = "proto3";
package cmp.types.v1alpha1;

import "cmp/types/v1alpha1/country.proto";
import "cmp/types/v1alpha1/distance.proto";
import "cmp/types/v1alpha1/measurement.proto";

// ### Coordinate
//
Expand All @@ -21,7 +21,7 @@ message Coordinate {
// Geo Circle
message GeoCircle {
cmp.types.v1alpha1.Coordinate center = 1;
cmp.types.v1alpha1.Distance radius = 2;
cmp.types.v1alpha1.Length radius = 2;
}

// Geo Polygon
Expand Down
40 changes: 40 additions & 0 deletions proto/cmp/types/v1alpha1/measurement.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
syntax = "proto3";

package cmp.types.v1alpha1;

// Length
//
// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/measurement.proto.dot.xs.svg)
// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/measurement.proto.dot.svg)
message Length {
int32 value = 1;
LengthUnit unit = 2;
}

// Length Unit
enum LengthUnit {
LENGTH_UNIT_UNSPECIFIED = 0;
LENGTH_UNIT_MILLIMETER = 1;
LENGTH_UNIT_CENTIMETER = 2;
LENGTH_UNIT_METER = 3;
LENGTH_UNIT_KILOMETER = 4;
LENGTH_UNIT_INCH = 5;
LENGTH_UNIT_FEET = 6;
LENGTH_UNIT_YARD = 7;
LENGTH_UNIT_MILE = 8;
}

// Weight type
//
// Used for weight
message Weight {
int32 value = 1;
WeightUnit unit = 2;
}

// Weight Unit
enum WeightUnit {
WEIGHT_UNIT_UNSPECIFIED = 0;
WEIGHT_UNIT_GRAM = 1;
WEIGHT_UNIT_KILOGRAM = 2;
}

0 comments on commit 04cc8a4

Please sign in to comment.