diff --git a/examples/rpc/partner-plugin/server.go b/examples/rpc/partner-plugin/server.go index cfcf5c42..1a04708c 100644 --- a/examples/rpc/partner-plugin/server.go +++ b/examples/rpc/partner-plugin/server.go @@ -77,7 +77,9 @@ func (p *partnerPlugin) Validation(ctx context.Context, _ *bookv2.ValidationRequ log.Printf("Responding to request: %s (Validation)", md.RequestID) response := bookv2.ValidationResponse{ - Header: nil, + Header: &typesv1.ResponseHeader{ + Status: typesv1.StatusType_STATUS_TYPE_SUCCESS, + }, ValidationId: &typesv1.UUID{Value: md.RequestID}, ValidationObject: nil, PriceDetail: &typesv2.PriceDetail{ @@ -106,7 +108,9 @@ func (p *partnerPlugin) ActivityProductInfo(ctx context.Context, request *activi log.Printf("Responding to request: %s (ActivityProductInfo)", md.RequestID) response := activityv2.ActivityProductInfoResponse{ - Header: nil, + Header: &typesv1.ResponseHeader{ + Status: typesv1.StatusType_STATUS_TYPE_SUCCESS, + }, Activities: []*activityv2.ActivityExtendedInfo{ { Activity: &activityv2.Activity{ @@ -282,7 +286,9 @@ func (p *partnerPlugin) ActivityProductList(ctx context.Context, _ *activityv2.A log.Printf("Responding to request: %s (ActivityProductList)", md.RequestID) response := activityv2.ActivityProductListResponse{ - Header: nil, + Header: &typesv1.ResponseHeader{ + Status: typesv1.StatusType_STATUS_TYPE_SUCCESS, + }, Activities: []*activityv2.Activity{ { Context: "ActivityTest", // context @@ -319,7 +325,9 @@ func (p *partnerPlugin) ActivitySearch(ctx context.Context, _ *activityv2.Activi log.Printf("Responding to request: %s (ActivitySearch)", md.RequestID) response := activityv2.ActivitySearchResponse{ - Header: nil, + Header: &typesv1.ResponseHeader{ + Status: typesv1.StatusType_STATUS_TYPE_SUCCESS, + }, Metadata: &typesv2.SearchResponseMetadata{SearchId: &typesv1.UUID{Value: md.RequestID}}, } log.Printf("CMAccount %s received request from CMAccount %s", md.Recipient, md.Sender) @@ -375,7 +383,9 @@ func (p *partnerPlugin) AccommodationSearch(ctx context.Context, _ *accommodatio log.Printf("Responding to request: %s (AccommodationSearch)", md.RequestID) response := accommodationv2.AccommodationSearchResponse{ - Header: nil, + Header: &typesv1.ResponseHeader{ + Status: typesv1.StatusType_STATUS_TYPE_SUCCESS, + }, Metadata: &typesv2.SearchResponseMetadata{ SearchId: &typesv1.UUID{Value: md.RequestID}, }, @@ -472,7 +482,9 @@ func (p *partnerPlugin) Ping(ctx context.Context, request *pingv1.PingRequest) ( log.Printf("Responding to request: %s (Ping)", md.RequestID) return &pingv1.PingResponse{ - Header: nil, + Header: &typesv1.ResponseHeader{ + Status: typesv1.StatusType_STATUS_TYPE_SUCCESS, + }, PingMessage: fmt.Sprintf("Ping response to [%s] with request ID: %s", request.PingMessage, md.RequestID), }, nil } @@ -488,7 +500,9 @@ func (p *partnerPlugin) TransportSearch(ctx context.Context, _ *transportv3.Tran // TODO: finish example response response := transportv3.TransportSearchResponse{ - Header: nil, + Header: &typesv1.ResponseHeader{ + Status: typesv1.StatusType_STATUS_TYPE_SUCCESS, + }, Metadata: &typesv2.SearchResponseMetadata{SearchId: &typesv1.UUID{Value: md.RequestID}}, Results: []*transportv3.TransportSearchResult{{ ResultId: 0, @@ -562,7 +576,9 @@ func (p *partnerPlugin) TransportProductList(ctx context.Context, _ *transportv3 log.Printf("Responding to request: %s (TransportProductList)", md.RequestID) response := transportv3.TransportProductListResponse{ - Header: nil, + Header: &typesv1.ResponseHeader{ + Status: typesv1.StatusType_STATUS_TYPE_SUCCESS, + }, Trips: []*transportv3.TripBasic{{ SupplierCode: &typesv2.SupplierProductCode{ SupplierCode: "XY", @@ -608,83 +624,85 @@ func (p *partnerPlugin) TransportProductList(ctx context.Context, _ *transportv3 SupplierCode: "XY", SupplierNumber: 456, }, - Segments: []*transportv3.Segment{{ - SegmentId: "SEG456", - ProviderCode: "I2", - RetailerCode: "IB", - ProductCode: &typesv2.ProductCode{ - Code: "XY", - Number: 456, - Type: typesv2.ProductCodeType_PRODUCT_CODE_TYPE_UNSPECIFIED, - }, - SupplierCode: &typesv2.SupplierProductCode{ - SupplierCode: "XY", - SupplierNumber: 456, - }, - Departure: &transportv3.TransitEvent{ - DateTime: timestamppb.New(time.Date(2024, 9, 27, 23, 55, 0, 0, time.UTC)), - LocationCode: &typesv2.LocationCode{ - Code: "SIN", - Type: typesv2.LocationCodeType_LOCATION_CODE_TYPE_ICAO_CODE, + Segments: []*transportv3.Segment{ + { + SegmentId: "SEG456", + ProviderCode: "I2", + RetailerCode: "IB", + ProductCode: &typesv2.ProductCode{ + Code: "XY", + Number: 456, + Type: typesv2.ProductCodeType_PRODUCT_CODE_TYPE_UNSPECIFIED, }, - }, - Arrival: &transportv3.TransitEvent{ - DateTime: timestamppb.New(time.Date(2024, 9, 28, 9, 30, 0, 0, time.UTC)), - LocationCode: &typesv2.LocationCode{ - Code: "MEL", - Type: typesv2.LocationCodeType_LOCATION_CODE_TYPE_ICAO_CODE, + SupplierCode: &typesv2.SupplierProductCode{ + SupplierCode: "XY", + SupplierNumber: 456, + }, + Departure: &transportv3.TransitEvent{ + DateTime: timestamppb.New(time.Date(2024, 9, 27, 23, 55, 0, 0, time.UTC)), + LocationCode: &typesv2.LocationCode{ + Code: "SIN", + Type: typesv2.LocationCodeType_LOCATION_CODE_TYPE_ICAO_CODE, + }, + }, + Arrival: &transportv3.TransitEvent{ + DateTime: timestamppb.New(time.Date(2024, 9, 28, 9, 30, 0, 0, time.UTC)), + LocationCode: &typesv2.LocationCode{ + Code: "MEL", + Type: typesv2.LocationCodeType_LOCATION_CODE_TYPE_ICAO_CODE, + }, + }, + SegmentDuration: &typesv1.Duration{ + Minutes: 455, + }, + SegmentDistance: &typesv1.Length{ + Value: 6024, + Unit: typesv1.LengthUnit_LENGTH_UNIT_KILOMETER, }, - }, - SegmentDuration: &typesv1.Duration{ - Minutes: 455, - }, - SegmentDistance: &typesv1.Length{ - Value: 6024, - Unit: typesv1.LengthUnit_LENGTH_UNIT_KILOMETER, }, }, - }, }, { SupplierCode: &typesv2.SupplierProductCode{ SupplierCode: "XY", SupplierNumber: 789, }, - Segments: []*transportv3.Segment{{ - SegmentId: "SEG789", - ProviderCode: "DB", - RetailerCode: "NS", - SubSupplierCode: "SNCF", - ProductCode: &typesv2.ProductCode{ - Code: "XY", - Number: 789, - Type: typesv2.ProductCodeType_PRODUCT_CODE_TYPE_UNSPECIFIED, - }, - SupplierCode: &typesv2.SupplierProductCode{ - SupplierCode: "XY", - SupplierNumber: 789, - }, - Departure: &transportv3.TransitEvent{ - DateTime: timestamppb.New(time.Date(2024, 9, 27, 15, 30, 0, 0, time.UTC)), - LocationCode: &typesv2.LocationCode{ - Code: "PAR", - Type: typesv2.LocationCodeType_LOCATION_CODE_TYPE_UNSPECIFIED, + Segments: []*transportv3.Segment{ + { + SegmentId: "SEG789", + ProviderCode: "DB", + RetailerCode: "NS", + SubSupplierCode: "SNCF", + ProductCode: &typesv2.ProductCode{ + Code: "XY", + Number: 789, + Type: typesv2.ProductCodeType_PRODUCT_CODE_TYPE_UNSPECIFIED, }, - }, - Arrival: &transportv3.TransitEvent{ - DateTime: timestamppb.New(time.Date(2024, 9, 28, 16, 47, 0, 0, time.UTC)), - LocationCode: &typesv2.LocationCode{ - Code: "LON", - Type: typesv2.LocationCodeType_LOCATION_CODE_TYPE_UNSPECIFIED, + SupplierCode: &typesv2.SupplierProductCode{ + SupplierCode: "XY", + SupplierNumber: 789, + }, + Departure: &transportv3.TransitEvent{ + DateTime: timestamppb.New(time.Date(2024, 9, 27, 15, 30, 0, 0, time.UTC)), + LocationCode: &typesv2.LocationCode{ + Code: "PAR", + Type: typesv2.LocationCodeType_LOCATION_CODE_TYPE_UNSPECIFIED, + }, + }, + Arrival: &transportv3.TransitEvent{ + DateTime: timestamppb.New(time.Date(2024, 9, 28, 16, 47, 0, 0, time.UTC)), + LocationCode: &typesv2.LocationCode{ + Code: "LON", + Type: typesv2.LocationCodeType_LOCATION_CODE_TYPE_UNSPECIFIED, + }, + }, + SegmentDuration: &typesv1.Duration{ + Minutes: 137, + }, + SegmentDistance: &typesv1.Length{ + Value: 495, + Unit: typesv1.LengthUnit_LENGTH_UNIT_KILOMETER, }, }, - SegmentDuration: &typesv1.Duration{ - Minutes: 137, - }, - SegmentDistance: &typesv1.Length{ - Value: 495, - Unit: typesv1.LengthUnit_LENGTH_UNIT_KILOMETER, - }, - }, }, }}, } @@ -692,7 +710,6 @@ func (p *partnerPlugin) TransportProductList(ctx context.Context, _ *transportv3 grpc.SendHeader(ctx, md.ToGrpcMD()) return &response, nil - } func (p *partnerPlugin) SeatMap(ctx context.Context, request *seat_mapv2.SeatMapRequest) (*seat_mapv2.SeatMapResponse, error) { @@ -705,7 +722,9 @@ func (p *partnerPlugin) SeatMap(ctx context.Context, request *seat_mapv2.SeatMap log.Printf("Responding to request: %s (SeatMap)", md.RequestID) response := seat_mapv2.SeatMapResponse{ - Header: nil, + Header: &typesv1.ResponseHeader{ + Status: typesv1.StatusType_STATUS_TYPE_SUCCESS, + }, SeatMap: &typesv2.SeatMap{ Id: md.RequestID, Sections: []*typesv2.Section{ @@ -878,7 +897,9 @@ func (p *partnerPlugin) SeatMapAvailability(ctx context.Context, request *seat_m log.Printf("Responding to request: %s (SeatMapAvailability)", md.RequestID) response := seat_mapv2.SeatMapAvailabilityResponse{ - Header: nil, + Header: &typesv1.ResponseHeader{ + Status: typesv1.StatusType_STATUS_TYPE_SUCCESS, + }, SeatMap: &typesv2.SeatMapInventory{ Id: "123ST", Sections: []*typesv2.SectionInventory{ @@ -914,7 +935,9 @@ func (p *partnerPlugin) CountryEntryRequirements(ctx context.Context, request *i log.Printf("Responding to request: %s (CountryEntryRequirements)", md.RequestID) response := infov2.CountryEntryRequirementsResponse{ - Header: nil, + Header: &typesv1.ResponseHeader{ + Status: typesv1.StatusType_STATUS_TYPE_SUCCESS, + }, Categories: []*infov2.CountryEntryRequirementCategory{{ Key: "entry", Names: []*typesv1.LocalizedString{{