diff --git a/examples/rpc/partner-plugin/server.go b/examples/rpc/partner-plugin/server.go index 16fbcd33..a1ab6d84 100644 --- a/examples/rpc/partner-plugin/server.go +++ b/examples/rpc/partner-plugin/server.go @@ -22,7 +22,8 @@ import ( "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/notification/v1/notificationv1grpc" "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/partner/v2/partnerv2grpc" "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/ping/v1/pingv1grpc" - "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/seat_map/v2/seat_mapv2grpc" + "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/seat_map/v3/seat_mapv3grpc" + "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/transport/v2/transportv2grpc" "buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/transport/v3/transportv3grpc" accommodationv2 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/accommodation/v2" @@ -35,7 +36,7 @@ import ( notificationv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/notification/v1" partnerv2 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/partner/v2" pingv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/ping/v1" - seat_mapv2 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/seat_map/v2" + seat_mapv3 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/seat_map/v3" transportv3 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/services/transport/v3" typesv1 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/types/v1" typesv2 "buf.build/gen/go/chain4travel/camino-messenger-protocol/protocolbuffers/go/cmp/types/v2" @@ -61,8 +62,8 @@ type partnerPlugin struct { accommodationv3grpc.AccommodationSearchServiceServer partnerv2grpc.GetPartnerConfigurationServiceServer transportv2grpc.TransportSearchServiceServer - seat_mapv2grpc.SeatMapServiceServer - seat_mapv2grpc.SeatMapAvailabilityServiceServer + seat_mapv3grpc.SeatMapServiceServer + seat_mapv3grpc.SeatMapAvailabilityServiceServer infov2grpc.CountryEntryRequirementsServiceServer activityv3grpc.ActivityProductInfoServiceServer notificationv1grpc.NotificationServiceServer @@ -759,7 +760,7 @@ func (p *partnerPlugin) TransportProductList(ctx context.Context, _ *transportv3 return &response, nil } -func (p *partnerPlugin) SeatMap(ctx context.Context, request *seat_mapv2.SeatMapRequest) (*seat_mapv2.SeatMapResponse, error) { +func (p *partnerPlugin) SeatMap(ctx context.Context, request *seat_mapv3.SeatMapRequest) (*seat_mapv3.SeatMapResponse, error) { md := metadata.Metadata{} err := md.ExtractMetadata(ctx) if err != nil { @@ -768,13 +769,13 @@ func (p *partnerPlugin) SeatMap(ctx context.Context, request *seat_mapv2.SeatMap md.Stamp(fmt.Sprintf("%s-%s", "ext-system", "response")) log.Printf("Responding to request: %s (SeatMap)", md.RequestID) - response := seat_mapv2.SeatMapResponse{ + response := seat_mapv3.SeatMapResponse{ Header: &typesv1.ResponseHeader{ Status: typesv1.StatusType_STATUS_TYPE_SUCCESS, }, - SeatMap: &typesv2.SeatMap{ + SeatMap: &typesv3.SeatMap{ Id: md.RequestID, - Sections: []*typesv2.Section{ + Sections: []*typesv3.Section{ { Id: "123ST", Names: []*typesv1.LocalizedString{ @@ -787,14 +788,14 @@ func (p *partnerPlugin) SeatMap(ctx context.Context, request *seat_mapv2.SeatMap Text: "Nordtribüne", }, }, - SeatInfo: &typesv2.Section_SeatList{ - SeatList: &typesv2.SeatList{ - Seats: []*typesv2.Seat{ + SeatInfo: &typesv3.Section_SeatList{ + SeatList: &typesv3.SeatList{ + Seats: []*typesv3.Seat{ { Id: "1A", - Location: &typesv2.SeatLocation{ - Location: &typesv2.SeatLocation_Vector{ - Vector: &typesv2.VectorSeatLocation{ + Location: &typesv3.SeatLocation{ + Location: &typesv3.SeatLocation_Vector{ + Vector: &typesv3.VectorSeatLocation{ Label: "section-North-Stand-26-34-2-label", }, }, @@ -802,17 +803,17 @@ func (p *partnerPlugin) SeatMap(ctx context.Context, request *seat_mapv2.SeatMap }, { Id: "2A", - Location: &typesv2.SeatLocation{ - Location: &typesv2.SeatLocation_Vector{ - Vector: &typesv2.VectorSeatLocation{ + Location: &typesv3.SeatLocation{ + Location: &typesv3.SeatLocation_Vector{ + Vector: &typesv3.VectorSeatLocation{ Label: "section-North-Stand-26-34-2-label", }, }, }, - Restrictions: []*typesv2.LocalizedSeatAttributeSet{ + Restrictions: []*typesv3.LocalizedSeatAttributeSet{ { Language: typesv1.Language_LANGUAGE_EN, - SeatAttributes: []*typesv2.SeatAttribute{ + SeatAttributes: []*typesv3.SeatAttribute{ { Name: "Restricted Vision", Description: "Seat behind a column", @@ -820,10 +821,10 @@ func (p *partnerPlugin) SeatMap(ctx context.Context, request *seat_mapv2.SeatMap }, }, }, - Features: []*typesv2.LocalizedSeatAttributeSet{ + Features: []*typesv3.LocalizedSeatAttributeSet{ { Language: typesv1.Language_LANGUAGE_EN, - SeatAttributes: []*typesv2.SeatAttribute{ + SeatAttributes: []*typesv3.SeatAttribute{ { Name: "Discount", Description: "Discount due to restricted vision up to 80%", @@ -833,7 +834,7 @@ func (p *partnerPlugin) SeatMap(ctx context.Context, request *seat_mapv2.SeatMap }, { Language: typesv1.Language_LANGUAGE_DE, - SeatAttributes: []*typesv2.SeatAttribute{ + SeatAttributes: []*typesv3.SeatAttribute{ { Name: "Rabatt", Description: "Hinter der Säule - bis zu 80% Rabatt", @@ -846,11 +847,12 @@ func (p *partnerPlugin) SeatMap(ctx context.Context, request *seat_mapv2.SeatMap }, }, }, - Image: &typesv2.Image{ - File: &typesv2.File{ + Image: &typesv3.Image{ + File: &typesv3.File{ Name: "String", Url: "https://camino.network/static/images/6HibYS9gzR-1800.webp", // TODO: replace with an actual image LastModified: timestamppb.New(time.Now()), + Description: "Image Description", }, Width: 50, Height: 50, @@ -874,14 +876,14 @@ func (p *partnerPlugin) SeatMap(ctx context.Context, request *seat_mapv2.SeatMap Language: typesv1.Language_LANGUAGE_DE, Text: "Osttribüne", }}, - SeatInfo: &typesv2.Section_SeatList{ - SeatList: &typesv2.SeatList{ - Seats: []*typesv2.Seat{ + SeatInfo: &typesv3.Section_SeatList{ + SeatList: &typesv3.SeatList{ + Seats: []*typesv3.Seat{ { Id: "31F", - Location: &typesv2.SeatLocation{ - Location: &typesv2.SeatLocation_Vector{ - Vector: &typesv2.VectorSeatLocation{ + Location: &typesv3.SeatLocation{ + Location: &typesv3.SeatLocation_Vector{ + Vector: &typesv3.VectorSeatLocation{ Label: "section-East-Stand-26-34-2-label", }, }, @@ -889,9 +891,9 @@ func (p *partnerPlugin) SeatMap(ctx context.Context, request *seat_mapv2.SeatMap }, { Id: "32F", - Location: &typesv2.SeatLocation{ - Location: &typesv2.SeatLocation_Vector{ - Vector: &typesv2.VectorSeatLocation{ + Location: &typesv3.SeatLocation{ + Location: &typesv3.SeatLocation_Vector{ + Vector: &typesv3.VectorSeatLocation{ Label: "section-East-Stand-26-34-2-label", }, }, @@ -900,8 +902,8 @@ func (p *partnerPlugin) SeatMap(ctx context.Context, request *seat_mapv2.SeatMap }, }, }, - Image: &typesv2.Image{ - File: &typesv2.File{ + Image: &typesv3.Image{ + File: &typesv3.File{ Name: "String", Url: "https://camino.network/static/images/6HibYS9gzR-1800.webp", LastModified: timestamppb.New(time.Now()), @@ -934,7 +936,7 @@ func (p *partnerPlugin) SeatMap(ctx context.Context, request *seat_mapv2.SeatMap return &response, nil } -func (p *partnerPlugin) SeatMapAvailability(ctx context.Context, request *seat_mapv2.SeatMapAvailabilityRequest) (*seat_mapv2.SeatMapAvailabilityResponse, error) { +func (p *partnerPlugin) SeatMapAvailability(ctx context.Context, request *seat_mapv3.SeatMapAvailabilityRequest) (*seat_mapv3.SeatMapAvailabilityResponse, error) { md := metadata.Metadata{} err := md.ExtractMetadata(ctx) if err != nil { @@ -943,24 +945,24 @@ func (p *partnerPlugin) SeatMapAvailability(ctx context.Context, request *seat_m md.Stamp(fmt.Sprintf("%s-%s", "ext-system", "response")) log.Printf("Responding to request: %s (SeatMapAvailability)", md.RequestID) - response := seat_mapv2.SeatMapAvailabilityResponse{ + response := seat_mapv3.SeatMapAvailabilityResponse{ Header: &typesv1.ResponseHeader{ Status: typesv1.StatusType_STATUS_TYPE_SUCCESS, }, - SeatMap: &typesv2.SeatMapInventory{ + SeatMap: &typesv3.SeatMapInventory{ Id: "123ST", - Sections: []*typesv2.SectionInventory{ + Sections: []*typesv3.SectionInventory{ { Id: "A", - SeatInfo: &typesv2.SectionInventory_SeatList{ - SeatList: &typesv2.SeatInventory{ + SeatInfo: &typesv3.SectionInventory_SeatList{ + SeatList: &typesv3.SeatInventory{ Ids: []string{"1A", "1B"}, }, }, }, { Id: "B", - SeatInfo: &typesv2.SectionInventory_SeatCount{SeatCount: &wrapperspb.Int32Value{Value: 32}}, + SeatInfo: &typesv3.SectionInventory_SeatCount{SeatCount: &wrapperspb.Int32Value{Value: 32}}, }, }, }, @@ -1153,8 +1155,8 @@ func main() { bookv2grpc.RegisterValidationServiceServer(grpcServer, &partnerPlugin{}) transportv3grpc.RegisterTransportSearchServiceServer(grpcServer, &partnerPlugin{}) transportv3grpc.RegisterTransportProductListServiceServer(grpcServer, &partnerPlugin{}) - seat_mapv2grpc.RegisterSeatMapServiceServer(grpcServer, &partnerPlugin{}) - seat_mapv2grpc.RegisterSeatMapAvailabilityServiceServer(grpcServer, &partnerPlugin{}) + seat_mapv3grpc.RegisterSeatMapServiceServer(grpcServer, &partnerPlugin{}) + seat_mapv3grpc.RegisterSeatMapAvailabilityServiceServer(grpcServer, &partnerPlugin{}) infov2grpc.RegisterCountryEntryRequirementsServiceServer(grpcServer, &partnerPlugin{}) notificationv1grpc.RegisterNotificationServiceServer(grpcServer, &partnerPlugin{})