Skip to content

Commit

Permalink
WIP - introduce search query
Browse files Browse the repository at this point in the history
  • Loading branch information
havan committed Jan 12, 2024
1 parent 82d14dd commit 99baeb4
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 84 deletions.
53 changes: 18 additions & 35 deletions proto/cmp/services/accommodation/v1alpha1/search.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,28 @@ syntax = "proto3";
// This package is a **WIP**.
package cmp.services.accommodation.v1alpha1;

import "cmp/services/accommodation/v1alpha1/search_parameters_types.proto";
import "cmp/services/accommodation/v1alpha1/search_query_types.proto";
import "cmp/services/accommodation/v1alpha1/search_result_types.proto";
import "cmp/services/accommodation/v1alpha1/unit_types.proto";
import "cmp/types/v1alpha1/common.proto";
import "cmp/types/v1alpha1/search.proto";
import "cmp/types/v1alpha1/travel_period.proto";
import "cmp/types/v1alpha1/traveller.proto";

// ### Accommodation Search Request Message Type
//
// The `Accommodation Search Request` message type facilitates the request for
// accommodations like hotel and holiday home searches within the platform. In the
// request the market, language and currency are specified at the top-level.
//
// In the Unit we specify the details of the trip like dates, properties or locations or
// filters. The purpose of such a structure is to allow for multi-room and
// multi-property searches.
// This means that there is no grouping of different room, mealplan or rateplan options
// in single room or single property searches. Each AccommodationSearchResult is one
// bookable option.
// request the market, language and currency are specified at the top-level.
//
// In the Unit we specify the details of the trip like dates, properties or
// locations or filters. The purpose of such a structure is to allow for multi-room
// and multi-property searches. This means that there is no grouping of different
// room, mealplan or rateplan options in single room or single property searches.
// Each AccommodationSearchResult is one bookable option.
//
// Several rooms or houses can be requested for the same dates and location or
// for the purpose of a tour or roadtrip, several accommodations or properties for
// sequential dates and different locations. This is done by specifying multiple Units
// for the same or different periods, the same or different accommodations or properties,
// specifying which travellers sleep in which unit.
//
//// Developers leveraging this message type should ensure proper validation and
// Several rooms or houses can be requested for the same dates and location or for
// the purpose of a tour or roadtrip, several accommodations or properties for
// sequential dates and different locations. This is done by specifying multiple
// Units for the same or different periods, the same or different accommodations or
// properties, specifying which travellers sleep in which unit.
//
// Developers leveraging this message type should ensure proper validation and
// handling, especially considering fields that are still under review, like
// `speech_request`.
message AccommodationSearchRequest {
Expand All @@ -54,22 +48,11 @@ message AccommodationSearchRequest {
// only the cheapest or all options.
cmp.types.v1alpha1.SearchParameters search_parameters_generic = 3;

// Accommodation specific search parameters Ex: Specific search parameters like
// geo location, meal plan, rate plan and rate rules.
AccommodationSearchParameters search_parameters_accommodation = 4;

// Travel period
cmp.types.v1alpha1.TravelPeriod travel_period = 5;

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

// Unit Types
repeated UnitType unit_types = 7;
// This field represents a list of search queries that can be used to create
// multiroom multi location searches.
repeated AccommodationSearchQuery queries = 4;
}

// ### Accommodation Search Response
//
// The `Accommodation Search Response` message type facilitates the response for
// accommodations like hotel and holiday home searches within the platform.
//
Expand Down
29 changes: 29 additions & 0 deletions proto/cmp/services/accommodation/v1alpha1/search_query_types.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
syntax = "proto3";

package cmp.services.accommodation.v1alpha1;

import "cmp/services/accommodation/v1alpha1/search_parameters_types.proto";
import "cmp/services/accommodation/v1alpha1/unit_types.proto";
import "cmp/types/v1alpha1/travel_period.proto";
import "cmp/types/v1alpha1/traveller.proto";

message AccommodationSearchQuery {
// Integer query ID, unique per search request
int32 query_id = 1;

// Accommodation specific search parameters Ex: Specific search parameters like
// geo location, meal plan, rate plan and rate rules.
AccommodationSearchParameters search_parameters_accommodation = 2;

// Travel period
cmp.types.v1alpha1.TravelPeriod travel_period = 3;

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

// Total number of rooms / holiday homes
int32 unit_count = 5;

// Type of the unit, like room or holiday home
UnitType unit_type = 6;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import "cmp/types/v1alpha1/cancel_policy.proto";
import "cmp/types/v1alpha1/price.proto";
import "cmp/types/v1alpha1/rate.proto";

// ### Search result type for Accommodation Search Service
//
// This type represents a search result and is used in the
// `AccommodationSearchResponse` message.
//
Expand All @@ -19,18 +17,21 @@ message AccommodationSearchResult {
// increasing by 1 for every search result.
int32 result_id = 1;

// This field represents the query ID associated with the search result.
int32 query_id = 2;

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

// ## Total price in detail, with breakdowns
cmp.types.v1alpha1.PriceDetail total_price_detail = 3;
cmp.types.v1alpha1.PriceDetail total_price_detail = 4;

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

// The cancellation conditions related to an option
cmp.types.v1alpha1.CancelPolicy cancel_policy = 5;
cmp.types.v1alpha1.CancelPolicy cancel_policy = 6;

// Freetext remarks without any functionality
string remarks = 6;
string remarks = 7;
}
6 changes: 3 additions & 3 deletions proto/cmp/services/accommodation/v1alpha1/unit_types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package cmp.services.accommodation.v1alpha1;
import "cmp/types/v1alpha1/cancel_policy.proto";
import "cmp/types/v1alpha1/meal_plan.proto";
import "cmp/types/v1alpha1/price.proto";
import "cmp/types/v1alpha1/product_code.proto";
import "cmp/types/v1alpha1/rate.proto";
import "cmp/types/v1alpha1/service_fact.proto";
import "cmp/types/v1alpha1/travel_period.proto";
Expand Down Expand Up @@ -57,7 +58,6 @@ message Unit {
// Rate Rule
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€
Expand All @@ -66,8 +66,8 @@ message Unit {
// Remaining units
int32 remaining_units = 15;

// Propert code
string property_code = 16;
// Property code
cmp.types.v1alpha1.ProductCode property_code = 16;

// Remarks
// FIXME: Is this field "per Unit" or should it be "per search request"?
Expand Down
51 changes: 27 additions & 24 deletions proto/cmp/services/transport/v1alpha1/search_parameters_types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ syntax = "proto3";

package cmp.services.transport.v1alpha1;

import "cmp/types/v1alpha1/time.proto";
import "cmp/types/v1alpha1/price.proto";
import "cmp/types/v1alpha1/product_code.proto";
import "cmp/types/v1alpha1/time.proto";

// ### Transport Search Parameters
//
Expand All @@ -15,45 +15,48 @@ message TransportSearchParameters {
// Ex: "SF"
repeated cmp.types.v1alpha1.ProductCode product_codes = 1;

// Duration
// Specify the minimal and maximum duration of an activity to be included in the search response
// The minimum duration of a transport to be included in the search response
cmp.types.v1alpha1.Time min_duration = 2;

// The maximum duration of a transport to be included in the search response
cmp.types.v1alpha1.Time max_duration = 3;

// Pricerange
// Specify the minimum and maximum price of an activity to be included in the search response
// The minimum price of a transport to be included in the search response
cmp.types.v1alpha1.Price min_price = 4;

// The maximum price of a transport to be included in the search response
cmp.types.v1alpha1.Price max_price = 5;

// Brandcode
// Specify one or more brand codes or distribution channels for which assigned product is
// One or more brand codes or distribution channels for which assigned product is
// to be included in the search response
repeated string brand_code = 6;
repeated cmp.types.v1alpha1.ProductCode brand_code = 6;

// Maximum number of segments
// Specify the maximum number of segments a trip might be containing
// if only a direct flight, transfer or train journey the maximum number of segments is set to one.
int32 max_segments = 7;
// The maximum number of segments a trip might be containing, if only a direct
// flight, transfer, or train journey the maximum number of segments is set to
// one.
int32 max_segments = 7;

// Travelling
// Specify the departure and/or arrival time of the trip
// Minimum departure time of the travelling trip
cmp.types.v1alpha1.Time travelling_min_departure_time = 8;

// Maximum departure time of the travelling trip
cmp.types.v1alpha1.Time travelling_max_departure_time = 9;

// Minimum arrival time of the travelling trip
cmp.types.v1alpha1.Time travelling_min_arrival_time = 10;

// Maximum arrival time of the travelling trip
cmp.types.v1alpha1.Time travelling_max_arrival_time = 11;

// Returning
// Specify the departure and/or arrival time of the trip
// Minimum departure time of the returning trip
cmp.types.v1alpha1.Time returning_min_departure_time = 12;

// Maximum departure time of the returning trip
cmp.types.v1alpha1.Time returning_max_departure_time = 13;

// Minimum arrival time of the returning trip
cmp.types.v1alpha1.Time returning_min_arrival_time = 14;
cmp.types.v1alpha1.Time returning_max_arrival_time = 15;

// using filters
// filters have a code, a type and a value.
// filters for business class, first class or economy flights can be set using filters and IATA codelist
// filters for private, shuttle, speedyshuttle can be based on GlobalTypes or OTA codelist
// filters for 1st or 2nd class train can be based UIC codes or OTA codelist
// filters can also be set for provider specific codes
// see filter.proto for more details
// Maximum arrival time of the returning trip
cmp.types.v1alpha1.Time returning_max_arrival_time = 15;
}
4 changes: 2 additions & 2 deletions proto/cmp/types/v1alpha1/meal_plan.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ package cmp.types.v1alpha1;

// Meal Plan message type
//
// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/mealplan.proto.dot.xs.svg)
// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/mealplan.proto.dot.svg)
// ![Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/meal_plan.proto.dot.xs.svg)
// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/meal_plan.proto.dot.svg)
message MealPlan {
// Meal Plan Code
//
Expand Down
27 changes: 15 additions & 12 deletions proto/cmp/types/v1alpha1/search.proto
Original file line number Diff line number Diff line change
Expand Up @@ -52,33 +52,36 @@ message SearchParameters {
string search_description_audio_url = 10;
}

// Search Response Metadata
// This message type is used in every search request to contain the request metadata
message SearchRequestMetadata {
// Request unique identifier
UUID request_id = 1;

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

// Search Response Metadata
// This message type is used in every search response to contain the response metadata
message SearchResponseMetadata {
// Search_id to be used in the Validation Request. This must be a UUID according
// to RFC 4122
UUID search_id = 1;

// Context for Inventory system communication.
string context = 1;
string context = 2;

// Errors encountered in the generation of the response. Standardized error list
// to be created.
string errors = 2;
string errors = 3;

// Warnings encountered in the generation of the response.
string warnings = 3;
string warnings = 4;

// Supplier code from the Inventory System for this search response.
string supplier_code = 4;
string supplier_code = 5;

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

// Search_id to be used in the Validation Request. This must be a UUID according
// to RFC 4122
UUID search_id = 6;
string external_session_id = 6;
}
2 changes: 1 addition & 1 deletion proto/cmp/types/v1alpha1/service_fact.proto
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ import "cmp/types/v1alpha1/price.proto";
// [Open Message Diagram](https://storage.googleapis.com/docs-cmp-files/diagrams/proto/cmp/types/v1alpha1/service_fact.proto.dot.svg)
message ServiceFact {
string description = 1;
Price price = 2;
PriceDetail price_detail = 2;
}

0 comments on commit 99baeb4

Please sign in to comment.