Skip to content

Commit

Permalink
pull search request related fields out of search result types
Browse files Browse the repository at this point in the history
  • Loading branch information
havan committed Dec 12, 2023
1 parent 0aa1c5f commit fb9692d
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 87 deletions.
6 changes: 2 additions & 4 deletions proto/cmp/services/accommodation/v1alpha1/search.proto
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ message AccommodationSearchRequest {
// Message Header. Contains api version, message info string and end-user wallet address
cmp.types.v1alpha1.Header header = 1;

// An identifier for external sessions, aiding in tracking and continuity across messages.
string external_session_id = 2;

//FIXME: Should we also need to have `freetext` field here? Yes, we need the freetext and audio fields here
// Search request metadata
cmp.types.v1alpha1.SearchRequestMetadata metadata = 2;

// Search parameters. Example: inclusion of OnRequest options and inclusion of only the cheapest or all options.
cmp.types.v1alpha1.SearchParameters search_parameters = 3;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@ import "cmp/services/accommodation/v1alpha1/unit_types.proto";
import "cmp/types/v1alpha1/cancel_policy.proto";
import "cmp/types/v1alpha1/rate.proto";

// ### Search option type for Accommodation Search Service
// ### Search result type for Accommodation Search Service
//
// This type represents a search result and is used in the
// `AccommodationSearchResponse` message.
//
// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/accommodation/v1alpha1/search_result_types.proto.dot.xs.svg)
// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/accommodation/v1alpha1/search_result_types.proto.dot.svg)
message AccommodationSearchResult {
// Option ID for the search option. This is an increasing number starting at 0 and
// ID for the search result. This is an increasing number starting at 0 and
// increasing by 1 for every search result.
int32 option_id = 1;
int32 result_id = 1;

// Property information
PropertyInfo property_info = 2;

// Units for this search option.
// Units for this search result.
repeated Unit units = 3;

// The RateRule specifies whether an option is non-refundable or not
// The RateRule specifies whether a search result is non-refundable or not
repeated cmp.types.v1alpha1.RateRule rate_rules = 4;

// The cancellation conditions related to an option
Expand Down
87 changes: 25 additions & 62 deletions proto/cmp/services/accommodation/v1alpha1/unit_types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ syntax = "proto3";
package cmp.services.accommodation.v1alpha1;

import "cmp/types/v1alpha1/cancel_policy.proto";
import "cmp/types/v1alpha1/filter.proto";
import "cmp/types/v1alpha1/location.proto";
import "cmp/types/v1alpha1/mealplan.proto";
import "cmp/types/v1alpha1/meal_plan.proto";
import "cmp/types/v1alpha1/price.proto";
import "cmp/types/v1alpha1/rate.proto";
import "cmp/types/v1alpha1/service_fact.proto";
Expand All @@ -18,94 +16,59 @@ import "cmp/types/v1alpha1/traveller.proto";
// multi-room requests Ex: one request for 2 rooms for 4 adults, 2 in each room.
// A unit can also be a different property in a multi-property request for holiday homes.
// Ex: 1 house for 4 persons and another house for 6 persons.
//
// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/accommodation/v1alpha1/unit_types.proto.dot.xs.svg)
// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/services/accommodation/v1alpha1/unit_types.proto.dot.svg)
message Unit {
// Unit Type
// Used to distinguish between hotel rooms and holiday homes.
// Ex: `UnitType.UNIT_TYPE_ROOM`
UnitType type = 1;

// Unit code. Room code of the unit in case of hotel. Ex: "RMSDDB0000"
string unit_code = 2;

// Unit description. In case of enrichment additional description of the unit code.
// Ex: "Double Standard Room"
string unit_description = 3;

// Travel period
cmp.types.v1alpha1.TravelPeriod travel_period = 2;
cmp.types.v1alpha1.TravelPeriod travel_period = 4;

// Travellers
repeated cmp.types.v1alpha1.Traveller travellers = 3;
repeated cmp.types.v1alpha1.Traveller travellers = 5;

// Beds
repeated Bed beds = 4;

// Geo Location for search, set only one of the fields at once.
//
// This one of field enforces only one of the fields below. They all share memory,
// setting one will remove the others.
oneof geo_location {
// FIXME: Do we need a list of location code here? Other fields are not lists.
cmp.types.v1alpha1.LocationCodes location_codes = 5;

// Single geographic point represented by two double fields.
cmp.types.v1alpha1.Coordinate location_coordinate = 6;

// Geo tree type, representted by Country, Region, and City_or_Resort.
cmp.types.v1alpha1.GeoTree location_geo_tree = 7;

// Geo circle. Represented by a coordinate and a distance for radius
cmp.types.v1alpha1.GeoCircle location_geo_circle = 8;

// Geo polygon. Represented by a list of coordinate points.
cmp.types.v1alpha1.GeoPolygon location_geo_polygon = 9;
}
repeated Bed beds = 6;

// Price in detail with breakdowns etc
cmp.types.v1alpha1.PriceDetail price_detail = 10;
cmp.types.v1alpha1.PriceDetail price_detail = 7;

// Services
repeated cmp.types.v1alpha1.ServiceFact included_services = 11;
repeated cmp.types.v1alpha1.ServiceFact compulsory_extras = 12;
repeated cmp.types.v1alpha1.ServiceFact optional_extras = 13;

// Unit code. Room code of the unit in case of hotel. Ex: "RMSDDB0000"
string unit_code = 14;
repeated cmp.types.v1alpha1.ServiceFact included_services = 8;
repeated cmp.types.v1alpha1.ServiceFact compulsory_extras = 9;
repeated cmp.types.v1alpha1.ServiceFact optional_extras = 10;

// Unit description. In case of enrichment additional description of the unit code.
// Ex: "Double Standard Room"
string unit_description = 15;
// Mealplan code
cmp.types.v1alpha1.MealPlan meal_plan_code = 11;

// Mealplan codes
repeated cmp.types.v1alpha1.MealPlan meal_plan_codes = 16;

// Rate plans
repeated cmp.types.v1alpha1.RatePlan rate_plan = 17;
// Rate plan
cmp.types.v1alpha1.RatePlan rate_plan = 12;

// Rate Rules
repeated cmp.types.v1alpha1.RateRule rate_rules = 18;

// Various provider and product specific filters can be provided here in
// agreed name/value pairs
// FIXME: Should this be in SearchParameters valid for the request and all units
// instead of Unit or in both? Do we need per Unit filters?
// We have this also in `SearchParameters` now.
repeated cmp.types.v1alpha1.Filter filters = 19;
cmp.types.v1alpha1.RateRule rate_rule = 13;

// Cancel Policies
// This is a list so that various policies can be expressed
// Ex. 10-5 days before arrival x€, 4-1 days before arrival y€ and 0 days before arrival z€
repeated cmp.types.v1alpha1.CancelPolicy cancel_policies = 20;

// Free-text field to provide more detials for better offer personalization.
// This field can be provided in combination with a Geo location or as stand-alone.
string request_description_text = 21;

// The speech request is provided as a link to a recording to process for
// better offer personalization. This field can be provided in combination
// with a Geo location or as stand-alone.
string request_description_audio_url = 22;
repeated cmp.types.v1alpha1.CancelPolicy cancel_policies = 14;

// Remaining units
int32 remaining_units = 23;
int32 remaining_units = 15;

// Remarks
// FIXME: Is this field "per Unit" or should it be "per search request"?
string remarks = 24;
string remarks = 16;
}

message Bed {
Expand Down
4 changes: 2 additions & 2 deletions proto/cmp/services/activity/v1alpha1/search.proto
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ message ActivitySearchRequest {
// Message Header. Contains api version, message info string and end-user wallet address
cmp.types.v1alpha1.Header header = 1;

// An identifier for external sessions, aiding in tracking and continuity across sessions.
string external_session_id = 2;
// Search request metadata
cmp.types.v1alpha1.SearchRequestMetadata metadata = 2;

// Search parameters. Example: inclusion of OnRequest options and inclusion of only the cheapest or all options.
cmp.types.v1alpha1.SearchParameters search_parameters = 3;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import "google/protobuf/timestamp.proto";
message ActivitySearchResult {
// Option ID for the search option. This is an increasing number starting at 0 and
// increasing by 1 for every search result.
int32 option_id = 1;
int32 result_id = 1;

// Activity basic info
ActivityInfo info = 2;
Expand Down
17 changes: 5 additions & 12 deletions proto/cmp/services/transport/v1alpha1/search.proto
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,18 @@ message TransportSearchRequest {
// Message Header. Contains api version, message info string and end-user wallet address
cmp.types.v1alpha1.Header header = 1;

// An identifier for external sessions, aiding in tracking and continuity across sessions.
string external_session_id = 2;
// Search request metadata
cmp.types.v1alpha1.SearchRequestMetadata metadata = 2;

// Free-text field to provide more detials for better offer personalization.
string search_request_description_text = 3;

// The speech request is provided as a link to a recording to process for
// better offer personalization.
string search_request_description_audio_url = 4;
// Search parameters. Example: inclusion of OnRequest options and inclusion of only
// the cheapest or all options.
cmp.types.v1alpha1.SearchParameters search_parameters = 6;

// Content source types for this search request to specify which sources to include
// Ex: ContentSourceType.CONTENT_SOURCE_TYPE_GDS, ContentSourceType.CONTENT_SOURCE_TYPE_NDC
// ContentSourceType.CONTENT_SOURCE_TYPE_3RD_PARTY
repeated ContentSourceType conten_source_types = 5;

// Search parameters. Example: inclusion of OnRequest options and inclusion of only
// the cheapest or all options.
cmp.types.v1alpha1.SearchParameters search_parameters = 6;

// Travellers
repeated cmp.types.v1alpha1.Traveller travellers = 7;

Expand Down
File renamed without changes.
53 changes: 52 additions & 1 deletion proto/cmp/types/v1alpha1/search.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ import "cmp/types/v1alpha1/country.proto";
import "cmp/types/v1alpha1/currency.proto";
import "cmp/types/v1alpha1/filter.proto";
import "cmp/types/v1alpha1/language.proto";
import "cmp/types/v1alpha1/location.proto";
import "cmp/types/v1alpha1/meal_plan.proto";
import "cmp/types/v1alpha1/rate.proto";
import "cmp/types/v1alpha1/sorting.proto";
import "cmp/types/v1alpha1/uuid.proto";

// Search parameters for the search requests
//
// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/search.proto.dot.xs.svg)
// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/search.proto.dot.svg)
message SearchParameters {
Expand All @@ -35,7 +39,54 @@ message SearchParameters {
Sorting sorting = 7;

// Filters for the search
// Various provider and product specific filters can be provided here in
// agreed name/value pairs
repeated Filter filters = 8;

// Geo Location for search, set only one of the fields at once.
//
// This one of field enforces only one of the fields below. They all share memory,
// setting one will remove the others.
oneof geo_location {
// FIXME: Do we need a list of location code here? Other fields are not lists.
LocationCodes location_codes = 9;

// Single geographic point represented by two double fields.
Coordinate location_coordinate = 10;

// Geo tree type, representted by Country, Region, and City_or_Resort.
GeoTree location_geo_tree = 11;

// Geo circle. Represented by a coordinate and a distance for radius
GeoCircle location_geo_circle = 12;

// Geo polygon. Represented by a list of coordinate points.
GeoPolygon location_geo_polygon = 13;
}

// Free-text field to provide more detials for better offer personalization.
// This field can be provided in combination with a Geo location or as stand-alone.
string search_description_text = 14;

// The speech is provided as a link to a recording to process for better offer
// personalization. This field can be provided in combination with a Geo
// location or as stand-alone.
string search_description_audio_url = 15;

// Mealplan codes
repeated MealPlan meal_plan_codes = 16;

// Rate plans
repeated RatePlan rate_plan = 17;

// Rate Rules
repeated RateRule rate_rules = 18;
}

// Search Response Metadata
message SearchRequestMetadata {
// An identifier for external sessions, aiding in tracking and continuity across sessions.
string external_session_id = 1;
}

// Search Response Metadata
Expand All @@ -56,5 +107,5 @@ message SearchResponseMetadata {
string external_session_id = 5;

// Search_id to be used in the Validation Request. This must be a UUID according to RFC 4122
cmp.types.v1alpha1.UUID search_id = 6;
UUID search_id = 6;
}

0 comments on commit fb9692d

Please sign in to comment.