diff --git a/.dockerignore b/.dockerignore index 94fdc73a30..5a21f3878f 100644 --- a/.dockerignore +++ b/.dockerignore @@ -22,3 +22,7 @@ src/*/*/Dockerfile ./src/shipping/target ################################### +################################### +# cart +./src/cart/.build/ +################################### diff --git a/.env b/.env index c631f81a54..3ee0ca6f7a 100644 --- a/.env +++ b/.env @@ -56,7 +56,7 @@ AD_DOCKERFILE=./src/ad/Dockerfile # Cart Service CART_PORT=7070 CART_ADDR=cart:${CART_PORT} -CART_DOCKERFILE=./src/cart/src/Dockerfile +CART_DOCKERFILE=./src/cart/Dockerfile # Checkout Service CHECKOUT_PORT=5050 @@ -147,8 +147,9 @@ KAFKA_ADDR=${KAFKA_HOST}:${KAFKA_PORT} KAFKA_DOCKERFILE=./src/kafka/Dockerfile # Valkey +VALKEY_HOST=valkey-cart VALKEY_PORT=6379 -VALKEY_ADDR=valkey-cart:${VALKEY_PORT} +VALKEY_ADDR=${VALKEY_HOST}:${VALKEY_PORT} # ******************** # Telemetry Components diff --git a/.gitignore b/.gitignore index 4dacf35195..ad967aec30 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,7 @@ obj/ .gradle/ .idea/ build/ +.build/ node_modules/ coverage .next/ @@ -42,7 +43,6 @@ test/tracetesting/tracetesting-vars.yaml # Ignore copied/generated protobuf files /src/accounting/src/protos/ -/src/cart/src/protos/ /src/fraud-detection/src/main/proto /src/payment/demo.proto /src/shipping/proto/ diff --git a/docker-compose.minimal.yml b/docker-compose.minimal.yml index 9921830b9b..6f95da5e8a 100644 --- a/docker-compose.minimal.yml +++ b/docker-compose.minimal.yml @@ -74,7 +74,6 @@ services: - OTEL_EXPORTER_OTLP_ENDPOINT - OTEL_RESOURCE_ATTRIBUTES - OTEL_SERVICE_NAME=cart - - ASPNETCORE_URLS=http://*:${CART_PORT} depends_on: valkey-cart: condition: service_started diff --git a/docker-compose.yml b/docker-compose.yml index d8549520bb..a59109a1a7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -101,12 +101,13 @@ services: environment: - CART_PORT - FLAGD_HOST - - FLAGD_PORT - - VALKEY_ADDR - - OTEL_EXPORTER_OTLP_ENDPOINT + - FLAGD_OFREP_PORT + - VALKEY_HOST + - VALKEY_PORT + - OTEL_EXPORTER_OTLP_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_HTTP} - OTEL_RESOURCE_ATTRIBUTES - OTEL_SERVICE_NAME=cart - - ASPNETCORE_URLS=http://*:${CART_PORT} + - OTEL_LOG_LEVEL=debug depends_on: valkey-cart: condition: service_started diff --git a/docker-gen-proto.sh b/docker-gen-proto.sh index ed2e3032c5..6dc64db660 100755 --- a/docker-gen-proto.sh +++ b/docker-gen-proto.sh @@ -43,10 +43,24 @@ gen_proto_ts() { /build/pb/demo.proto' } +gen_proto_swift() { + echo "Generating Swift protobuf files for $1" + docker build -f "src/$1/genproto/Dockerfile" -t "$1-genproto" . + docker run --rm -e SERVICE=$1 -v $(pwd):/build "$1-genproto" /bin/sh -c ' + mkdir -p /build/src/$SERVICE/Sources/CTL/Generated && \ + protoc -I /build/pb \ + --plugin="$(swift build --show-bin-path)/protoc-gen-swift" \ + --plugin="$(swift build --show-bin-path)/protoc-gen-grpc-swift-2" \ + --swift_out="/build/src/$SERVICE/Sources/CTL/Generated" \ + --grpc-swift-2_opt=Client=false \ + --grpc-swift-2_out="/build/src/$SERVICE/Sources/CTL/Generated" \ + /build/pb/demo.proto' +} + if [ -z "$1" ]; then #gen_proto_dotnet accounting #gen_proto_java ad - #gen_proto_dotnet cart + gen_proto_swift cart gen_proto_go checkout gen_proto_cpp currency #gen_proto_ruby email diff --git a/src/cart/.dockerignore b/src/cart/.dockerignore new file mode 100644 index 0000000000..3de0d9ffb4 --- /dev/null +++ b/src/cart/.dockerignore @@ -0,0 +1,3 @@ +**/.build/ +**/.swiftpm/ +Dockerfile* diff --git a/src/cart/.gitignore b/src/cart/.gitignore new file mode 100644 index 0000000000..ea0f7b605e --- /dev/null +++ b/src/cart/.gitignore @@ -0,0 +1 @@ +.swiftpm/ diff --git a/src/cart/Directory.Build.props b/src/cart/Directory.Build.props deleted file mode 100644 index bfd1cab4dd..0000000000 --- a/src/cart/Directory.Build.props +++ /dev/null @@ -1,11 +0,0 @@ - - - true - all - low - - - - true - - diff --git a/src/cart/Dockerfile b/src/cart/Dockerfile new file mode 100644 index 0000000000..a447dae164 --- /dev/null +++ b/src/cart/Dockerfile @@ -0,0 +1,75 @@ +# ================================ +# Build image +# ================================ +FROM swift:6.1-noble AS build + +# Install OS updates +RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \ + && apt-get -q update \ + && apt-get -q dist-upgrade -y \ + && apt-get install -y libjemalloc-dev \ + && rm -rf /var/lib/apt/lists/* + +# Set up a build area +WORKDIR /build + +# First just resolve dependencies. +# This creates a cached layer that can be reused +# as long as your Package.swift/Package.resolved +# files do not change. +COPY ./src/cart/Package.* ./ +RUN swift package resolve + +# Copy entire repo into container +COPY ./src/cart . + +# Build the application, with optimizations, with static linking, and using jemalloc +RUN swift build -c release \ + --product "cart" \ + --static-swift-stdlib \ + -Xlinker -ljemalloc + +# Switch to the staging area +WORKDIR /staging + +# Copy main executable to staging area +RUN cp "$(swift build --package-path /build -c release --show-bin-path)/cart" ./ + +# Copy static swift backtracer binary to staging area +RUN cp "/usr/libexec/swift/linux/swift-backtrace-static" ./ + +# ================================ +# Run image +# ================================ +FROM ubuntu:noble + +# Make sure all system packages are up to date, and install only essential packages. +RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \ + && apt-get -q update \ + && apt-get -q dist-upgrade -y \ + && apt-get -q install -y \ + libjemalloc2 \ + ca-certificates \ + tzdata \ + && rm -r /var/lib/apt/lists/* + +# Create a cart user and group with /app as its home directory +RUN useradd --user-group --create-home --system --skel /dev/null --home-dir /app cart + +# Switch to the new home directory +WORKDIR /app + +# Copy built executable and any staged resources from builder +COPY --from=build --chown=cart:cart /staging /app + +# Provide configuration needed by the built-in crash reporter and some sensible default behaviors. +ENV SWIFT_BACKTRACE=enable=yes,sanitize=yes,threads=all,images=all,interactive=no,swift-backtrace=./swift-backtrace-static + +# Ensure all further commands run as the cart user +USER cart:cart + +# Let Docker bind to the cart port +EXPOSE ${CART_PORT} + +# Start the cart service when the image is run +ENTRYPOINT ["./cart"] diff --git a/src/cart/NuGet.config b/src/cart/NuGet.config deleted file mode 100644 index adcb2a925f..0000000000 --- a/src/cart/NuGet.config +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/src/cart/Package.resolved b/src/cart/Package.resolved new file mode 100644 index 0000000000..e5c485a3a3 --- /dev/null +++ b/src/cart/Package.resolved @@ -0,0 +1,321 @@ +{ + "originHash" : "4291195db0b1cbe39e2dcf442d07ad9295f392ada40950197bfff511b85879d0", + "pins" : [ + { + "identity" : "async-http-client", + "kind" : "remoteSourceControl", + "location" : "https://github.com/slashmo/async-http-client.git", + "state" : { + "branch" : "feature/context-propagation", + "revision" : "17883809e29b5d6a79fcda5045069cf288490d63" + } + }, + { + "identity" : "grpc-swift-2", + "kind" : "remoteSourceControl", + "location" : "https://github.com/grpc/grpc-swift-2.git", + "state" : { + "revision" : "0e52abf7ea0fca7ffe876953aa41feff84cc6e29", + "version" : "2.1.0" + } + }, + { + "identity" : "grpc-swift-extras", + "kind" : "remoteSourceControl", + "location" : "https://github.com/grpc/grpc-swift-extras.git", + "state" : { + "revision" : "dd34dae247c0b49db0e81dca5da64033b02cb49c", + "version" : "2.0.0" + } + }, + { + "identity" : "grpc-swift-nio-transport", + "kind" : "remoteSourceControl", + "location" : "https://github.com/grpc/grpc-swift-nio-transport.git", + "state" : { + "revision" : "108495b705a68f6931281a96156532029ff8b9ed", + "version" : "2.1.1" + } + }, + { + "identity" : "grpc-swift-protobuf", + "kind" : "remoteSourceControl", + "location" : "https://github.com/grpc/grpc-swift-protobuf.git", + "state" : { + "revision" : "c008d356d9e9c2255602711888bf25b542a30919", + "version" : "2.1.1" + } + }, + { + "identity" : "swift-algorithms", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-algorithms.git", + "state" : { + "revision" : "87e50f483c54e6efd60e885f7f5aa946cee68023", + "version" : "1.2.1" + } + }, + { + "identity" : "swift-argument-parser", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-argument-parser.git", + "state" : { + "revision" : "309a47b2b1d9b5e991f36961c983ecec72275be3", + "version" : "1.6.1" + } + }, + { + "identity" : "swift-asn1", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-asn1.git", + "state" : { + "revision" : "f70225981241859eb4aa1a18a75531d26637c8cc", + "version" : "1.4.0" + } + }, + { + "identity" : "swift-async-algorithms", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-async-algorithms.git", + "state" : { + "revision" : "042e1c4d9d19748c9c228f8d4ebc97bb1e339b0b", + "version" : "1.0.4" + } + }, + { + "identity" : "swift-atomics", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-atomics.git", + "state" : { + "revision" : "b601256eab081c0f92f059e12818ac1d4f178ff7", + "version" : "1.3.0" + } + }, + { + "identity" : "swift-certificates", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-certificates.git", + "state" : { + "revision" : "20c451f1ad8e344e61ddbb34ef196653d4b73ea6", + "version" : "1.13.0" + } + }, + { + "identity" : "swift-collections", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-collections.git", + "state" : { + "revision" : "8c0c0a8b49e080e54e5e328cc552821ff07cd341", + "version" : "1.2.1" + } + }, + { + "identity" : "swift-crypto", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-crypto.git", + "state" : { + "revision" : "d1c6b70f7c5f19fb0b8750cb8dcdf2ea6e2d8c34", + "version" : "3.15.0" + } + }, + { + "identity" : "swift-distributed-tracing", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-distributed-tracing.git", + "state" : { + "branch" : "feature/tracing-test-kit", + "revision" : "b80efc1c718e51620c394fedbf4fe644cf71b81f" + } + }, + { + "identity" : "swift-http-structured-headers", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-http-structured-headers.git", + "state" : { + "revision" : "1625f271afb04375bf48737a5572613248d0e7a0", + "version" : "1.4.0" + } + }, + { + "identity" : "swift-http-types", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-http-types.git", + "state" : { + "revision" : "a0a57e949a8903563aba4615869310c0ebf14c03", + "version" : "1.4.0" + } + }, + { + "identity" : "swift-log", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-log.git", + "state" : { + "revision" : "ce592ae52f982c847a4efc0dd881cc9eb32d29f2", + "version" : "1.6.4" + } + }, + { + "identity" : "swift-metrics", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-metrics.git", + "state" : { + "revision" : "4c83e1cdf4ba538ef6e43a9bbd0bcc33a0ca46e3", + "version" : "2.7.0" + } + }, + { + "identity" : "swift-nio", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-nio.git", + "state" : { + "revision" : "1c30f0f2053b654e3d1302492124aa6d242cdba7", + "version" : "2.86.0" + } + }, + { + "identity" : "swift-nio-extras", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-nio-extras.git", + "state" : { + "revision" : "a55c3dd3a81d035af8a20ce5718889c0dcab073d", + "version" : "1.29.0" + } + }, + { + "identity" : "swift-nio-http2", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-nio-http2.git", + "state" : { + "revision" : "5e9e99ec96c53bc2c18ddd10c1e25a3cd97c55e5", + "version" : "1.38.0" + } + }, + { + "identity" : "swift-nio-ssl", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-nio-ssl.git", + "state" : { + "revision" : "737e550e607d82bf15bdfddf158ec61652ce836f", + "version" : "2.34.0" + } + }, + { + "identity" : "swift-nio-transport-services", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-nio-transport-services.git", + "state" : { + "revision" : "e645014baea2ec1c2db564410c51a656cf47c923", + "version" : "1.25.1" + } + }, + { + "identity" : "swift-numerics", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-numerics.git", + "state" : { + "revision" : "bbadd4b853a33fd78c4ae977d17bb2af15eb3f2a", + "version" : "1.1.0" + } + }, + { + "identity" : "swift-ofrep", + "kind" : "remoteSourceControl", + "location" : "https://github.com/swift-open-feature/swift-ofrep.git", + "state" : { + "branch" : "main", + "revision" : "cafc6f407e89bec0c8d474ac369024235ff0b241" + } + }, + { + "identity" : "swift-open-feature", + "kind" : "remoteSourceControl", + "location" : "https://github.com/swift-open-feature/swift-open-feature.git", + "state" : { + "branch" : "main", + "revision" : "7fbef4bd2560f1161078312db70237f5c83d4ce8" + } + }, + { + "identity" : "swift-openapi-async-http-client", + "kind" : "remoteSourceControl", + "location" : "https://github.com/swift-server/swift-openapi-async-http-client.git", + "state" : { + "revision" : "915aeff168625b0f88a5810ee7ab8e9c00af671b", + "version" : "1.1.0" + } + }, + { + "identity" : "swift-openapi-runtime", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-openapi-runtime.git", + "state" : { + "revision" : "8f33cc5dfe81169fb167da73584b9c72c3e8bc23", + "version" : "1.8.2" + } + }, + { + "identity" : "swift-otel", + "kind" : "remoteSourceControl", + "location" : "https://github.com/swift-otel/swift-otel.git", + "state" : { + "revision" : "6e908cb34cab2a0b739c4d6db4c1a4faad0a6ec4", + "version" : "1.0.0-alpha.2" + } + }, + { + "identity" : "swift-protobuf", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-protobuf.git", + "state" : { + "revision" : "e3f69fd321d0c9fcdc16fb576a0cdd956675face", + "version" : "1.31.0" + } + }, + { + "identity" : "swift-service-context", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-service-context.git", + "state" : { + "revision" : "1983448fefc717a2bc2ebde5490fe99873c5b8a6", + "version" : "1.2.1" + } + }, + { + "identity" : "swift-service-lifecycle", + "kind" : "remoteSourceControl", + "location" : "https://github.com/swift-server/swift-service-lifecycle.git", + "state" : { + "revision" : "e7187309187695115033536e8fc9b2eb87fd956d", + "version" : "2.8.0" + } + }, + { + "identity" : "swift-system", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-system.git", + "state" : { + "revision" : "890830fff1a577dc83134890c7984020c5f6b43b", + "version" : "1.6.2" + } + }, + { + "identity" : "swift-w3c-trace-context", + "kind" : "remoteSourceControl", + "location" : "https://github.com/swift-otel/swift-w3c-trace-context.git", + "state" : { + "revision" : "3da4b79545b38cf5551f1c525d800756f38cb697", + "version" : "1.0.0-beta.3" + } + }, + { + "identity" : "valkey-swift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/slashmo/valkey-swift.git", + "state" : { + "branch" : "feature/distributed-tracing", + "revision" : "6ca1b36c5e4df39b40d2a732bd599df03c5780ab" + } + } + ], + "version" : 3 +} diff --git a/src/cart/Package.swift b/src/cart/Package.swift new file mode 100644 index 0000000000..64ebcfb733 --- /dev/null +++ b/src/cart/Package.swift @@ -0,0 +1,43 @@ +// swift-tools-version:6.1 +import PackageDescription + +let package = Package( + name: "cart", + platforms: [.macOS(.v15)], + products: [ + .executable(name: "cart", targets: ["CTL"]) + ], + dependencies: [ + .package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.0.0"), + .package(url: "https://github.com/swift-server/swift-service-lifecycle.git", from: "2.0.0"), + .package(url: "https://github.com/grpc/grpc-swift-2.git", from: "2.0.0"), + .package(url: "https://github.com/grpc/grpc-swift-protobuf.git", from: "2.0.0"), + .package(url: "https://github.com/grpc/grpc-swift-nio-transport.git", from: "2.0.0"), + .package(url: "https://github.com/grpc/grpc-swift-extras.git", from: "2.0.0"), + .package(url: "https://github.com/swift-otel/swift-otel.git", exact: "1.0.0-alpha.2", traits: ["OTLPHTTP"]), + .package(url: "https://github.com/swift-open-feature/swift-open-feature.git", branch: "main"), + .package(url: "https://github.com/swift-open-feature/swift-ofrep.git", branch: "main"), + .package(url: "https://github.com/slashmo/async-http-client.git", branch: "feature/context-propagation"), + .package(url: "https://github.com/slashmo/valkey-swift.git", branch: "feature/distributed-tracing"), + ], + targets: [ + .executableTarget( + name: "CTL", + dependencies: [ + .product(name: "ArgumentParser", package: "swift-argument-parser"), + .product(name: "ServiceLifecycle", package: "swift-service-lifecycle"), + .product(name: "GRPCCore", package: "grpc-swift-2"), + .product(name: "GRPCNIOTransportHTTP2", package: "grpc-swift-nio-transport"), + .product(name: "GRPCProtobuf", package: "grpc-swift-protobuf"), + .product(name: "GRPCServiceLifecycle", package: "grpc-swift-extras"), + .product(name: "GRPCOTelTracingInterceptors", package: "grpc-swift-extras"), + .product(name: "OTel", package: "swift-otel"), + .product(name: "OpenFeature", package: "swift-open-feature"), + .product(name: "OpenFeatureTracing", package: "swift-open-feature"), + .product(name: "OFREP", package: "swift-ofrep"), + .product(name: "Valkey", package: "valkey-swift"), + ] + ) + ], + swiftLanguageModes: [.v6] +) diff --git a/src/cart/README.md b/src/cart/README.md index f2b2db6484..1f9738da40 100644 --- a/src/cart/README.md +++ b/src/cart/README.md @@ -4,7 +4,7 @@ This service stores user shopping carts in Valkey. ## Local Build -Run `dotnet restore` and `dotnet build`. +Run `swift build`. ## Docker Build diff --git a/src/cart/Sources/CTL/CartCTL.swift b/src/cart/Sources/CTL/CartCTL.swift new file mode 100644 index 0000000000..b97451b163 --- /dev/null +++ b/src/cart/Sources/CTL/CartCTL.swift @@ -0,0 +1,131 @@ +import ArgumentParser +import Foundation +import Logging +import GRPCCore +import GRPCNIOTransportHTTP2 +import ServiceLifecycle +import GRPCServiceLifecycle +import GRPCOTelTracingInterceptors +import OTel +import OpenFeature +import OpenFeatureTracing +import OFREP +import Tracing +import Valkey + +@main +struct CartCTL: AsyncParsableCommand { + func run() async throws { + let observability = try OTel.bootstrap() + let logger = Logger(label: "cart") + + guard let port = ProcessInfo.processInfo.environment["CART_PORT"].flatMap(Int.init), + let ofrepHost = ProcessInfo.processInfo.environment["FLAGD_HOST"], + let ofrepPort = ProcessInfo.processInfo.environment["FLAGD_OFREP_PORT"], + let valkeyHost = ProcessInfo.processInfo.environment["VALKEY_HOST"], + let valkeyPort = ProcessInfo.processInfo.environment["VALKEY_PORT"].flatMap(Int.init) else { + Self.exit() + } + + let valkeyClient = ValkeyClient(.hostname(valkeyHost, port: valkeyPort), logger: logger) + + let ofrepProvider = OFREPProvider(serverURL: URL(string: "http://\(ofrepHost):\(ofrepPort)")!) + OpenFeatureSystem.setProvider(ofrepProvider) + OpenFeatureSystem.addHooks([OpenFeatureTracingHook()]) + + let service = CartService( + openFeatureClient: OpenFeatureSystem.client(), + valkeyClient: valkeyClient + ) + let server = GRPCServer( + transport: .http2NIOPosix( + address: .ipv4(host: "0.0.0.0", port: port), + transportSecurity: .plaintext + ), + services: [service], + interceptors: [ + GRPCMetricsInterceptor(serverHostname: "0.0.0.0", networkTransportMethod: "tcp"), + ServerOTelTracingInterceptor(serverHostname: "0.0.0.0", networkTransportMethod: "tcp") + ] + ) + + let serviceGroup = ServiceGroup( + services: [observability, valkeyClient, ofrepProvider, server], + gracefulShutdownSignals: [.sigint, .sigterm], + logger: Logger(label: "cart") + ) + + try await serviceGroup.run() + } +} + +struct CartService: Oteldemo_CartService.SimpleServiceProtocol { + let openFeatureClient: OpenFeatureClient + let valkeyClient: ValkeyClient + private let logger = Logger(label: "CartService") + + func addItem( + request: Oteldemo_AddItemRequest, + context: ServerContext + ) async throws -> Oteldemo_Empty { + var cart = try await cart(userID: request.userID) ?? Oteldemo_Cart.with { $0.userID = request.userID } + + if let existingIndex = cart.items.firstIndex(where: { $0.productID == request.item.productID }) { + cart.items[existingIndex].quantity += request.item.quantity + } else { + cart.items.append(request.item) + } + + let serializedCart: [UInt8] = try cart.serializedBytes() + try await valkeyClient.hset(ValkeyKey(request.userID), data: [.init(field: "cart", value: serializedCart)]) + try await valkeyClient.expire(ValkeyKey(request.userID), seconds: 60 * 60) + + return Oteldemo_Empty() + } + + func getCart( + request: Oteldemo_GetCartRequest, + context: ServerContext + ) async throws -> Oteldemo_Cart { + logger.info("Fetch cart.", metadata: ["user.id": "\(request.userID)"]) + + if let cart = try await cart(userID: request.userID) { + return cart + } else { + // We decided to return empty cart in cases when user wasn't in the cache before + return Oteldemo_Cart() + } + } + + func emptyCart( + request: Oteldemo_EmptyCartRequest, + context: ServerContext + ) async throws -> Oteldemo_Empty { + let useExperimentalAlgorithm = await openFeatureClient.value( + for: "cartExperimentalClearing", + defaultingTo: false + ) + + if useExperimentalAlgorithm { + logger.info("Using experimental algorithm to clear cart.") + throw RPCError(code: .unimplemented, message: "Experimental cart clearing algorithm not yet implemented.") + } + + let emptyCartBytes: [UInt8] = try Oteldemo_Cart().serializedBytes() + try await valkeyClient.hset(ValkeyKey(request.userID), data: [.init(field: "cart", value: emptyCartBytes)]) + try await valkeyClient.expire(ValkeyKey(request.userID), seconds: 60 * 60) + + return Oteldemo_Empty() + } + + private func cart(userID: String) async throws -> Oteldemo_Cart? { + try await withSpan("Cart") { span in + span.attributes["user.id"] = userID + + guard let buffer = try await valkeyClient.hget(ValkeyKey(userID), field: "cart") else { + return nil + } + return try Oteldemo_Cart(serializedBytes: Array(buffer.readableBytesView)) + } + } +} diff --git a/src/cart/Sources/CTL/GRPCMetricsInterceptor.swift b/src/cart/Sources/CTL/GRPCMetricsInterceptor.swift new file mode 100644 index 0000000000..76d23b9f3b --- /dev/null +++ b/src/cart/Sources/CTL/GRPCMetricsInterceptor.swift @@ -0,0 +1,66 @@ +import Dispatch +import GRPCCore +import Metrics + +struct GRPCMetricsInterceptor: ServerInterceptor { + let serverHostname: String + let networkTransportMethod: String + + func intercept( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext, + next: @Sendable ( + GRPCCore.StreamingServerRequest, + GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse + ) async throws -> GRPCCore.StreamingServerResponse { + let startTime = DispatchTime.now().uptimeNanoseconds + var dimensions = [ + ("rpc.system", "grpc"), + ("rpc.method", context.descriptor.method), + ("rpc.service", context.descriptor.service.fullyQualifiedService), + ("server.address", serverHostname), + ("network.transport", networkTransportMethod), + ("unit", "ms") + ] + + do { + let response = try await next(request, context) + let statusCode: Int + switch response.accepted { + case .success: + statusCode = 0 + case .failure(let error): + statusCode = error.code.rawValue + } + dimensions.append(("rpc.grpc.status_code", "\(statusCode)")) + + Timer( + label: "rpc.server.duration", + dimensions: dimensions, + preferredDisplayUnit: .milliseconds + ) + .recordNanoseconds(DispatchTime.now().uptimeNanoseconds - startTime) + + return response + } catch let error as Error & RPCErrorConvertible { + dimensions.append(("rpc.grpc.status_code", "\(error.rpcErrorCode.rawValue)")) + Timer( + label: "rpc.server.duration", + dimensions: dimensions, + preferredDisplayUnit: .milliseconds + ) + .recordNanoseconds(DispatchTime.now().uptimeNanoseconds - startTime) + throw error + } catch { + dimensions.append(("rpc.grpc.status_code", "\(RPCError.Code.unknown.rawValue)")) + Timer( + label: "rpc.server.duration", + dimensions: dimensions, + preferredDisplayUnit: .milliseconds + ) + .recordNanoseconds(DispatchTime.now().uptimeNanoseconds - startTime) + throw error + } + } +} diff --git a/src/cart/Sources/CTL/Generated/demo.grpc.swift b/src/cart/Sources/CTL/Generated/demo.grpc.swift new file mode 100644 index 0000000000..0f6da06516 --- /dev/null +++ b/src/cart/Sources/CTL/Generated/demo.grpc.swift @@ -0,0 +1,2516 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// DO NOT EDIT. +// swift-format-ignore-file +// swiftlint:disable all +// +// Generated by the gRPC Swift generator plugin for the protocol buffer compiler. +// Source: demo.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/grpc/grpc-swift + +import GRPCCore +import GRPCProtobuf + +// MARK: - oteldemo.CartService + +/// Namespace containing generated types for the "oteldemo.CartService" service. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +internal enum Oteldemo_CartService { + /// Service descriptor for the "oteldemo.CartService" service. + internal static let descriptor = GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.CartService") + /// Namespace for method metadata. + internal enum Method { + /// Namespace for "AddItem" metadata. + internal enum AddItem { + /// Request type for "AddItem". + internal typealias Input = Oteldemo_AddItemRequest + /// Response type for "AddItem". + internal typealias Output = Oteldemo_Empty + /// Descriptor for "AddItem". + internal static let descriptor = GRPCCore.MethodDescriptor( + service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.CartService"), + method: "AddItem" + ) + } + /// Namespace for "GetCart" metadata. + internal enum GetCart { + /// Request type for "GetCart". + internal typealias Input = Oteldemo_GetCartRequest + /// Response type for "GetCart". + internal typealias Output = Oteldemo_Cart + /// Descriptor for "GetCart". + internal static let descriptor = GRPCCore.MethodDescriptor( + service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.CartService"), + method: "GetCart" + ) + } + /// Namespace for "EmptyCart" metadata. + internal enum EmptyCart { + /// Request type for "EmptyCart". + internal typealias Input = Oteldemo_EmptyCartRequest + /// Response type for "EmptyCart". + internal typealias Output = Oteldemo_Empty + /// Descriptor for "EmptyCart". + internal static let descriptor = GRPCCore.MethodDescriptor( + service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.CartService"), + method: "EmptyCart" + ) + } + /// Descriptors for all methods in the "oteldemo.CartService" service. + internal static let descriptors: [GRPCCore.MethodDescriptor] = [ + AddItem.descriptor, + GetCart.descriptor, + EmptyCart.descriptor + ] + } +} + +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension GRPCCore.ServiceDescriptor { + /// Service descriptor for the "oteldemo.CartService" service. + internal static let oteldemo_CartService = GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.CartService") +} + +// MARK: oteldemo.CartService (server) + +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_CartService { + /// Streaming variant of the service protocol for the "oteldemo.CartService" service. + /// + /// This protocol is the lowest-level of the service protocols generated for this service + /// giving you the most flexibility over the implementation of your service. This comes at + /// the cost of more verbose and less strict APIs. Each RPC requires you to implement it in + /// terms of a request stream and response stream. Where only a single request or response + /// message is expected, you are responsible for enforcing this invariant is maintained. + /// + /// Where possible, prefer using the stricter, less-verbose ``ServiceProtocol`` + /// or ``SimpleServiceProtocol`` instead. + internal protocol StreamingServiceProtocol: GRPCCore.RegistrableRPCService { + /// Handle the "AddItem" method. + /// + /// - Parameters: + /// - request: A streaming request of `Oteldemo_AddItemRequest` messages. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A streaming response of `Oteldemo_Empty` messages. + func addItem( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse + + /// Handle the "GetCart" method. + /// + /// - Parameters: + /// - request: A streaming request of `Oteldemo_GetCartRequest` messages. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A streaming response of `Oteldemo_Cart` messages. + func getCart( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse + + /// Handle the "EmptyCart" method. + /// + /// - Parameters: + /// - request: A streaming request of `Oteldemo_EmptyCartRequest` messages. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A streaming response of `Oteldemo_Empty` messages. + func emptyCart( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse + } + + /// Service protocol for the "oteldemo.CartService" service. + /// + /// This protocol is higher level than ``StreamingServiceProtocol`` but lower level than + /// the ``SimpleServiceProtocol``, it provides access to request and response metadata and + /// trailing response metadata. If you don't need these then consider using + /// the ``SimpleServiceProtocol``. If you need fine grained control over your RPCs then + /// use ``StreamingServiceProtocol``. + internal protocol ServiceProtocol: Oteldemo_CartService.StreamingServiceProtocol { + /// Handle the "AddItem" method. + /// + /// - Parameters: + /// - request: A request containing a single `Oteldemo_AddItemRequest` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A response containing a single `Oteldemo_Empty` message. + func addItem( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse + + /// Handle the "GetCart" method. + /// + /// - Parameters: + /// - request: A request containing a single `Oteldemo_GetCartRequest` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A response containing a single `Oteldemo_Cart` message. + func getCart( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse + + /// Handle the "EmptyCart" method. + /// + /// - Parameters: + /// - request: A request containing a single `Oteldemo_EmptyCartRequest` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A response containing a single `Oteldemo_Empty` message. + func emptyCart( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse + } + + /// Simple service protocol for the "oteldemo.CartService" service. + /// + /// This is the highest level protocol for the service. The API is the easiest to use but + /// doesn't provide access to request or response metadata. If you need access to these + /// then use ``ServiceProtocol`` instead. + internal protocol SimpleServiceProtocol: Oteldemo_CartService.ServiceProtocol { + /// Handle the "AddItem" method. + /// + /// - Parameters: + /// - request: A `Oteldemo_AddItemRequest` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A `Oteldemo_Empty` to respond with. + func addItem( + request: Oteldemo_AddItemRequest, + context: GRPCCore.ServerContext + ) async throws -> Oteldemo_Empty + + /// Handle the "GetCart" method. + /// + /// - Parameters: + /// - request: A `Oteldemo_GetCartRequest` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A `Oteldemo_Cart` to respond with. + func getCart( + request: Oteldemo_GetCartRequest, + context: GRPCCore.ServerContext + ) async throws -> Oteldemo_Cart + + /// Handle the "EmptyCart" method. + /// + /// - Parameters: + /// - request: A `Oteldemo_EmptyCartRequest` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A `Oteldemo_Empty` to respond with. + func emptyCart( + request: Oteldemo_EmptyCartRequest, + context: GRPCCore.ServerContext + ) async throws -> Oteldemo_Empty + } +} + +// Default implementation of 'registerMethods(with:)'. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_CartService.StreamingServiceProtocol { + internal func registerMethods(with router: inout GRPCCore.RPCRouter) where Transport: GRPCCore.ServerTransport { + router.registerHandler( + forMethod: Oteldemo_CartService.Method.AddItem.descriptor, + deserializer: GRPCProtobuf.ProtobufDeserializer(), + serializer: GRPCProtobuf.ProtobufSerializer(), + handler: { request, context in + try await self.addItem( + request: request, + context: context + ) + } + ) + router.registerHandler( + forMethod: Oteldemo_CartService.Method.GetCart.descriptor, + deserializer: GRPCProtobuf.ProtobufDeserializer(), + serializer: GRPCProtobuf.ProtobufSerializer(), + handler: { request, context in + try await self.getCart( + request: request, + context: context + ) + } + ) + router.registerHandler( + forMethod: Oteldemo_CartService.Method.EmptyCart.descriptor, + deserializer: GRPCProtobuf.ProtobufDeserializer(), + serializer: GRPCProtobuf.ProtobufSerializer(), + handler: { request, context in + try await self.emptyCart( + request: request, + context: context + ) + } + ) + } +} + +// Default implementation of streaming methods from 'StreamingServiceProtocol'. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_CartService.ServiceProtocol { + internal func addItem( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse { + let response = try await self.addItem( + request: GRPCCore.ServerRequest(stream: request), + context: context + ) + return GRPCCore.StreamingServerResponse(single: response) + } + + internal func getCart( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse { + let response = try await self.getCart( + request: GRPCCore.ServerRequest(stream: request), + context: context + ) + return GRPCCore.StreamingServerResponse(single: response) + } + + internal func emptyCart( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse { + let response = try await self.emptyCart( + request: GRPCCore.ServerRequest(stream: request), + context: context + ) + return GRPCCore.StreamingServerResponse(single: response) + } +} + +// Default implementation of methods from 'ServiceProtocol'. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_CartService.SimpleServiceProtocol { + internal func addItem( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse { + return GRPCCore.ServerResponse( + message: try await self.addItem( + request: request.message, + context: context + ), + metadata: [:] + ) + } + + internal func getCart( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse { + return GRPCCore.ServerResponse( + message: try await self.getCart( + request: request.message, + context: context + ), + metadata: [:] + ) + } + + internal func emptyCart( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse { + return GRPCCore.ServerResponse( + message: try await self.emptyCart( + request: request.message, + context: context + ), + metadata: [:] + ) + } +} + +// MARK: - oteldemo.RecommendationService + +/// Namespace containing generated types for the "oteldemo.RecommendationService" service. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +internal enum Oteldemo_RecommendationService { + /// Service descriptor for the "oteldemo.RecommendationService" service. + internal static let descriptor = GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.RecommendationService") + /// Namespace for method metadata. + internal enum Method { + /// Namespace for "ListRecommendations" metadata. + internal enum ListRecommendations { + /// Request type for "ListRecommendations". + internal typealias Input = Oteldemo_ListRecommendationsRequest + /// Response type for "ListRecommendations". + internal typealias Output = Oteldemo_ListRecommendationsResponse + /// Descriptor for "ListRecommendations". + internal static let descriptor = GRPCCore.MethodDescriptor( + service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.RecommendationService"), + method: "ListRecommendations" + ) + } + /// Descriptors for all methods in the "oteldemo.RecommendationService" service. + internal static let descriptors: [GRPCCore.MethodDescriptor] = [ + ListRecommendations.descriptor + ] + } +} + +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension GRPCCore.ServiceDescriptor { + /// Service descriptor for the "oteldemo.RecommendationService" service. + internal static let oteldemo_RecommendationService = GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.RecommendationService") +} + +// MARK: oteldemo.RecommendationService (server) + +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_RecommendationService { + /// Streaming variant of the service protocol for the "oteldemo.RecommendationService" service. + /// + /// This protocol is the lowest-level of the service protocols generated for this service + /// giving you the most flexibility over the implementation of your service. This comes at + /// the cost of more verbose and less strict APIs. Each RPC requires you to implement it in + /// terms of a request stream and response stream. Where only a single request or response + /// message is expected, you are responsible for enforcing this invariant is maintained. + /// + /// Where possible, prefer using the stricter, less-verbose ``ServiceProtocol`` + /// or ``SimpleServiceProtocol`` instead. + internal protocol StreamingServiceProtocol: GRPCCore.RegistrableRPCService { + /// Handle the "ListRecommendations" method. + /// + /// - Parameters: + /// - request: A streaming request of `Oteldemo_ListRecommendationsRequest` messages. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A streaming response of `Oteldemo_ListRecommendationsResponse` messages. + func listRecommendations( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse + } + + /// Service protocol for the "oteldemo.RecommendationService" service. + /// + /// This protocol is higher level than ``StreamingServiceProtocol`` but lower level than + /// the ``SimpleServiceProtocol``, it provides access to request and response metadata and + /// trailing response metadata. If you don't need these then consider using + /// the ``SimpleServiceProtocol``. If you need fine grained control over your RPCs then + /// use ``StreamingServiceProtocol``. + internal protocol ServiceProtocol: Oteldemo_RecommendationService.StreamingServiceProtocol { + /// Handle the "ListRecommendations" method. + /// + /// - Parameters: + /// - request: A request containing a single `Oteldemo_ListRecommendationsRequest` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A response containing a single `Oteldemo_ListRecommendationsResponse` message. + func listRecommendations( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse + } + + /// Simple service protocol for the "oteldemo.RecommendationService" service. + /// + /// This is the highest level protocol for the service. The API is the easiest to use but + /// doesn't provide access to request or response metadata. If you need access to these + /// then use ``ServiceProtocol`` instead. + internal protocol SimpleServiceProtocol: Oteldemo_RecommendationService.ServiceProtocol { + /// Handle the "ListRecommendations" method. + /// + /// - Parameters: + /// - request: A `Oteldemo_ListRecommendationsRequest` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A `Oteldemo_ListRecommendationsResponse` to respond with. + func listRecommendations( + request: Oteldemo_ListRecommendationsRequest, + context: GRPCCore.ServerContext + ) async throws -> Oteldemo_ListRecommendationsResponse + } +} + +// Default implementation of 'registerMethods(with:)'. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_RecommendationService.StreamingServiceProtocol { + internal func registerMethods(with router: inout GRPCCore.RPCRouter) where Transport: GRPCCore.ServerTransport { + router.registerHandler( + forMethod: Oteldemo_RecommendationService.Method.ListRecommendations.descriptor, + deserializer: GRPCProtobuf.ProtobufDeserializer(), + serializer: GRPCProtobuf.ProtobufSerializer(), + handler: { request, context in + try await self.listRecommendations( + request: request, + context: context + ) + } + ) + } +} + +// Default implementation of streaming methods from 'StreamingServiceProtocol'. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_RecommendationService.ServiceProtocol { + internal func listRecommendations( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse { + let response = try await self.listRecommendations( + request: GRPCCore.ServerRequest(stream: request), + context: context + ) + return GRPCCore.StreamingServerResponse(single: response) + } +} + +// Default implementation of methods from 'ServiceProtocol'. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_RecommendationService.SimpleServiceProtocol { + internal func listRecommendations( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse { + return GRPCCore.ServerResponse( + message: try await self.listRecommendations( + request: request.message, + context: context + ), + metadata: [:] + ) + } +} + +// MARK: - oteldemo.ProductCatalogService + +/// Namespace containing generated types for the "oteldemo.ProductCatalogService" service. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +internal enum Oteldemo_ProductCatalogService { + /// Service descriptor for the "oteldemo.ProductCatalogService" service. + internal static let descriptor = GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.ProductCatalogService") + /// Namespace for method metadata. + internal enum Method { + /// Namespace for "ListProducts" metadata. + internal enum ListProducts { + /// Request type for "ListProducts". + internal typealias Input = Oteldemo_Empty + /// Response type for "ListProducts". + internal typealias Output = Oteldemo_ListProductsResponse + /// Descriptor for "ListProducts". + internal static let descriptor = GRPCCore.MethodDescriptor( + service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.ProductCatalogService"), + method: "ListProducts" + ) + } + /// Namespace for "GetProduct" metadata. + internal enum GetProduct { + /// Request type for "GetProduct". + internal typealias Input = Oteldemo_GetProductRequest + /// Response type for "GetProduct". + internal typealias Output = Oteldemo_Product + /// Descriptor for "GetProduct". + internal static let descriptor = GRPCCore.MethodDescriptor( + service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.ProductCatalogService"), + method: "GetProduct" + ) + } + /// Namespace for "SearchProducts" metadata. + internal enum SearchProducts { + /// Request type for "SearchProducts". + internal typealias Input = Oteldemo_SearchProductsRequest + /// Response type for "SearchProducts". + internal typealias Output = Oteldemo_SearchProductsResponse + /// Descriptor for "SearchProducts". + internal static let descriptor = GRPCCore.MethodDescriptor( + service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.ProductCatalogService"), + method: "SearchProducts" + ) + } + /// Descriptors for all methods in the "oteldemo.ProductCatalogService" service. + internal static let descriptors: [GRPCCore.MethodDescriptor] = [ + ListProducts.descriptor, + GetProduct.descriptor, + SearchProducts.descriptor + ] + } +} + +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension GRPCCore.ServiceDescriptor { + /// Service descriptor for the "oteldemo.ProductCatalogService" service. + internal static let oteldemo_ProductCatalogService = GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.ProductCatalogService") +} + +// MARK: oteldemo.ProductCatalogService (server) + +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_ProductCatalogService { + /// Streaming variant of the service protocol for the "oteldemo.ProductCatalogService" service. + /// + /// This protocol is the lowest-level of the service protocols generated for this service + /// giving you the most flexibility over the implementation of your service. This comes at + /// the cost of more verbose and less strict APIs. Each RPC requires you to implement it in + /// terms of a request stream and response stream. Where only a single request or response + /// message is expected, you are responsible for enforcing this invariant is maintained. + /// + /// Where possible, prefer using the stricter, less-verbose ``ServiceProtocol`` + /// or ``SimpleServiceProtocol`` instead. + internal protocol StreamingServiceProtocol: GRPCCore.RegistrableRPCService { + /// Handle the "ListProducts" method. + /// + /// - Parameters: + /// - request: A streaming request of `Oteldemo_Empty` messages. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A streaming response of `Oteldemo_ListProductsResponse` messages. + func listProducts( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse + + /// Handle the "GetProduct" method. + /// + /// - Parameters: + /// - request: A streaming request of `Oteldemo_GetProductRequest` messages. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A streaming response of `Oteldemo_Product` messages. + func getProduct( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse + + /// Handle the "SearchProducts" method. + /// + /// - Parameters: + /// - request: A streaming request of `Oteldemo_SearchProductsRequest` messages. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A streaming response of `Oteldemo_SearchProductsResponse` messages. + func searchProducts( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse + } + + /// Service protocol for the "oteldemo.ProductCatalogService" service. + /// + /// This protocol is higher level than ``StreamingServiceProtocol`` but lower level than + /// the ``SimpleServiceProtocol``, it provides access to request and response metadata and + /// trailing response metadata. If you don't need these then consider using + /// the ``SimpleServiceProtocol``. If you need fine grained control over your RPCs then + /// use ``StreamingServiceProtocol``. + internal protocol ServiceProtocol: Oteldemo_ProductCatalogService.StreamingServiceProtocol { + /// Handle the "ListProducts" method. + /// + /// - Parameters: + /// - request: A request containing a single `Oteldemo_Empty` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A response containing a single `Oteldemo_ListProductsResponse` message. + func listProducts( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse + + /// Handle the "GetProduct" method. + /// + /// - Parameters: + /// - request: A request containing a single `Oteldemo_GetProductRequest` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A response containing a single `Oteldemo_Product` message. + func getProduct( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse + + /// Handle the "SearchProducts" method. + /// + /// - Parameters: + /// - request: A request containing a single `Oteldemo_SearchProductsRequest` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A response containing a single `Oteldemo_SearchProductsResponse` message. + func searchProducts( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse + } + + /// Simple service protocol for the "oteldemo.ProductCatalogService" service. + /// + /// This is the highest level protocol for the service. The API is the easiest to use but + /// doesn't provide access to request or response metadata. If you need access to these + /// then use ``ServiceProtocol`` instead. + internal protocol SimpleServiceProtocol: Oteldemo_ProductCatalogService.ServiceProtocol { + /// Handle the "ListProducts" method. + /// + /// - Parameters: + /// - request: A `Oteldemo_Empty` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A `Oteldemo_ListProductsResponse` to respond with. + func listProducts( + request: Oteldemo_Empty, + context: GRPCCore.ServerContext + ) async throws -> Oteldemo_ListProductsResponse + + /// Handle the "GetProduct" method. + /// + /// - Parameters: + /// - request: A `Oteldemo_GetProductRequest` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A `Oteldemo_Product` to respond with. + func getProduct( + request: Oteldemo_GetProductRequest, + context: GRPCCore.ServerContext + ) async throws -> Oteldemo_Product + + /// Handle the "SearchProducts" method. + /// + /// - Parameters: + /// - request: A `Oteldemo_SearchProductsRequest` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A `Oteldemo_SearchProductsResponse` to respond with. + func searchProducts( + request: Oteldemo_SearchProductsRequest, + context: GRPCCore.ServerContext + ) async throws -> Oteldemo_SearchProductsResponse + } +} + +// Default implementation of 'registerMethods(with:)'. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_ProductCatalogService.StreamingServiceProtocol { + internal func registerMethods(with router: inout GRPCCore.RPCRouter) where Transport: GRPCCore.ServerTransport { + router.registerHandler( + forMethod: Oteldemo_ProductCatalogService.Method.ListProducts.descriptor, + deserializer: GRPCProtobuf.ProtobufDeserializer(), + serializer: GRPCProtobuf.ProtobufSerializer(), + handler: { request, context in + try await self.listProducts( + request: request, + context: context + ) + } + ) + router.registerHandler( + forMethod: Oteldemo_ProductCatalogService.Method.GetProduct.descriptor, + deserializer: GRPCProtobuf.ProtobufDeserializer(), + serializer: GRPCProtobuf.ProtobufSerializer(), + handler: { request, context in + try await self.getProduct( + request: request, + context: context + ) + } + ) + router.registerHandler( + forMethod: Oteldemo_ProductCatalogService.Method.SearchProducts.descriptor, + deserializer: GRPCProtobuf.ProtobufDeserializer(), + serializer: GRPCProtobuf.ProtobufSerializer(), + handler: { request, context in + try await self.searchProducts( + request: request, + context: context + ) + } + ) + } +} + +// Default implementation of streaming methods from 'StreamingServiceProtocol'. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_ProductCatalogService.ServiceProtocol { + internal func listProducts( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse { + let response = try await self.listProducts( + request: GRPCCore.ServerRequest(stream: request), + context: context + ) + return GRPCCore.StreamingServerResponse(single: response) + } + + internal func getProduct( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse { + let response = try await self.getProduct( + request: GRPCCore.ServerRequest(stream: request), + context: context + ) + return GRPCCore.StreamingServerResponse(single: response) + } + + internal func searchProducts( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse { + let response = try await self.searchProducts( + request: GRPCCore.ServerRequest(stream: request), + context: context + ) + return GRPCCore.StreamingServerResponse(single: response) + } +} + +// Default implementation of methods from 'ServiceProtocol'. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_ProductCatalogService.SimpleServiceProtocol { + internal func listProducts( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse { + return GRPCCore.ServerResponse( + message: try await self.listProducts( + request: request.message, + context: context + ), + metadata: [:] + ) + } + + internal func getProduct( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse { + return GRPCCore.ServerResponse( + message: try await self.getProduct( + request: request.message, + context: context + ), + metadata: [:] + ) + } + + internal func searchProducts( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse { + return GRPCCore.ServerResponse( + message: try await self.searchProducts( + request: request.message, + context: context + ), + metadata: [:] + ) + } +} + +// MARK: - oteldemo.ShippingService + +/// Namespace containing generated types for the "oteldemo.ShippingService" service. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +internal enum Oteldemo_ShippingService { + /// Service descriptor for the "oteldemo.ShippingService" service. + internal static let descriptor = GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.ShippingService") + /// Namespace for method metadata. + internal enum Method { + /// Namespace for "GetQuote" metadata. + internal enum GetQuote { + /// Request type for "GetQuote". + internal typealias Input = Oteldemo_GetQuoteRequest + /// Response type for "GetQuote". + internal typealias Output = Oteldemo_GetQuoteResponse + /// Descriptor for "GetQuote". + internal static let descriptor = GRPCCore.MethodDescriptor( + service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.ShippingService"), + method: "GetQuote" + ) + } + /// Namespace for "ShipOrder" metadata. + internal enum ShipOrder { + /// Request type for "ShipOrder". + internal typealias Input = Oteldemo_ShipOrderRequest + /// Response type for "ShipOrder". + internal typealias Output = Oteldemo_ShipOrderResponse + /// Descriptor for "ShipOrder". + internal static let descriptor = GRPCCore.MethodDescriptor( + service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.ShippingService"), + method: "ShipOrder" + ) + } + /// Descriptors for all methods in the "oteldemo.ShippingService" service. + internal static let descriptors: [GRPCCore.MethodDescriptor] = [ + GetQuote.descriptor, + ShipOrder.descriptor + ] + } +} + +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension GRPCCore.ServiceDescriptor { + /// Service descriptor for the "oteldemo.ShippingService" service. + internal static let oteldemo_ShippingService = GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.ShippingService") +} + +// MARK: oteldemo.ShippingService (server) + +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_ShippingService { + /// Streaming variant of the service protocol for the "oteldemo.ShippingService" service. + /// + /// This protocol is the lowest-level of the service protocols generated for this service + /// giving you the most flexibility over the implementation of your service. This comes at + /// the cost of more verbose and less strict APIs. Each RPC requires you to implement it in + /// terms of a request stream and response stream. Where only a single request or response + /// message is expected, you are responsible for enforcing this invariant is maintained. + /// + /// Where possible, prefer using the stricter, less-verbose ``ServiceProtocol`` + /// or ``SimpleServiceProtocol`` instead. + internal protocol StreamingServiceProtocol: GRPCCore.RegistrableRPCService { + /// Handle the "GetQuote" method. + /// + /// - Parameters: + /// - request: A streaming request of `Oteldemo_GetQuoteRequest` messages. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A streaming response of `Oteldemo_GetQuoteResponse` messages. + func getQuote( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse + + /// Handle the "ShipOrder" method. + /// + /// - Parameters: + /// - request: A streaming request of `Oteldemo_ShipOrderRequest` messages. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A streaming response of `Oteldemo_ShipOrderResponse` messages. + func shipOrder( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse + } + + /// Service protocol for the "oteldemo.ShippingService" service. + /// + /// This protocol is higher level than ``StreamingServiceProtocol`` but lower level than + /// the ``SimpleServiceProtocol``, it provides access to request and response metadata and + /// trailing response metadata. If you don't need these then consider using + /// the ``SimpleServiceProtocol``. If you need fine grained control over your RPCs then + /// use ``StreamingServiceProtocol``. + internal protocol ServiceProtocol: Oteldemo_ShippingService.StreamingServiceProtocol { + /// Handle the "GetQuote" method. + /// + /// - Parameters: + /// - request: A request containing a single `Oteldemo_GetQuoteRequest` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A response containing a single `Oteldemo_GetQuoteResponse` message. + func getQuote( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse + + /// Handle the "ShipOrder" method. + /// + /// - Parameters: + /// - request: A request containing a single `Oteldemo_ShipOrderRequest` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A response containing a single `Oteldemo_ShipOrderResponse` message. + func shipOrder( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse + } + + /// Simple service protocol for the "oteldemo.ShippingService" service. + /// + /// This is the highest level protocol for the service. The API is the easiest to use but + /// doesn't provide access to request or response metadata. If you need access to these + /// then use ``ServiceProtocol`` instead. + internal protocol SimpleServiceProtocol: Oteldemo_ShippingService.ServiceProtocol { + /// Handle the "GetQuote" method. + /// + /// - Parameters: + /// - request: A `Oteldemo_GetQuoteRequest` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A `Oteldemo_GetQuoteResponse` to respond with. + func getQuote( + request: Oteldemo_GetQuoteRequest, + context: GRPCCore.ServerContext + ) async throws -> Oteldemo_GetQuoteResponse + + /// Handle the "ShipOrder" method. + /// + /// - Parameters: + /// - request: A `Oteldemo_ShipOrderRequest` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A `Oteldemo_ShipOrderResponse` to respond with. + func shipOrder( + request: Oteldemo_ShipOrderRequest, + context: GRPCCore.ServerContext + ) async throws -> Oteldemo_ShipOrderResponse + } +} + +// Default implementation of 'registerMethods(with:)'. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_ShippingService.StreamingServiceProtocol { + internal func registerMethods(with router: inout GRPCCore.RPCRouter) where Transport: GRPCCore.ServerTransport { + router.registerHandler( + forMethod: Oteldemo_ShippingService.Method.GetQuote.descriptor, + deserializer: GRPCProtobuf.ProtobufDeserializer(), + serializer: GRPCProtobuf.ProtobufSerializer(), + handler: { request, context in + try await self.getQuote( + request: request, + context: context + ) + } + ) + router.registerHandler( + forMethod: Oteldemo_ShippingService.Method.ShipOrder.descriptor, + deserializer: GRPCProtobuf.ProtobufDeserializer(), + serializer: GRPCProtobuf.ProtobufSerializer(), + handler: { request, context in + try await self.shipOrder( + request: request, + context: context + ) + } + ) + } +} + +// Default implementation of streaming methods from 'StreamingServiceProtocol'. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_ShippingService.ServiceProtocol { + internal func getQuote( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse { + let response = try await self.getQuote( + request: GRPCCore.ServerRequest(stream: request), + context: context + ) + return GRPCCore.StreamingServerResponse(single: response) + } + + internal func shipOrder( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse { + let response = try await self.shipOrder( + request: GRPCCore.ServerRequest(stream: request), + context: context + ) + return GRPCCore.StreamingServerResponse(single: response) + } +} + +// Default implementation of methods from 'ServiceProtocol'. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_ShippingService.SimpleServiceProtocol { + internal func getQuote( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse { + return GRPCCore.ServerResponse( + message: try await self.getQuote( + request: request.message, + context: context + ), + metadata: [:] + ) + } + + internal func shipOrder( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse { + return GRPCCore.ServerResponse( + message: try await self.shipOrder( + request: request.message, + context: context + ), + metadata: [:] + ) + } +} + +// MARK: - oteldemo.CurrencyService + +/// Namespace containing generated types for the "oteldemo.CurrencyService" service. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +internal enum Oteldemo_CurrencyService { + /// Service descriptor for the "oteldemo.CurrencyService" service. + internal static let descriptor = GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.CurrencyService") + /// Namespace for method metadata. + internal enum Method { + /// Namespace for "GetSupportedCurrencies" metadata. + internal enum GetSupportedCurrencies { + /// Request type for "GetSupportedCurrencies". + internal typealias Input = Oteldemo_Empty + /// Response type for "GetSupportedCurrencies". + internal typealias Output = Oteldemo_GetSupportedCurrenciesResponse + /// Descriptor for "GetSupportedCurrencies". + internal static let descriptor = GRPCCore.MethodDescriptor( + service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.CurrencyService"), + method: "GetSupportedCurrencies" + ) + } + /// Namespace for "Convert" metadata. + internal enum Convert { + /// Request type for "Convert". + internal typealias Input = Oteldemo_CurrencyConversionRequest + /// Response type for "Convert". + internal typealias Output = Oteldemo_Money + /// Descriptor for "Convert". + internal static let descriptor = GRPCCore.MethodDescriptor( + service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.CurrencyService"), + method: "Convert" + ) + } + /// Descriptors for all methods in the "oteldemo.CurrencyService" service. + internal static let descriptors: [GRPCCore.MethodDescriptor] = [ + GetSupportedCurrencies.descriptor, + Convert.descriptor + ] + } +} + +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension GRPCCore.ServiceDescriptor { + /// Service descriptor for the "oteldemo.CurrencyService" service. + internal static let oteldemo_CurrencyService = GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.CurrencyService") +} + +// MARK: oteldemo.CurrencyService (server) + +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_CurrencyService { + /// Streaming variant of the service protocol for the "oteldemo.CurrencyService" service. + /// + /// This protocol is the lowest-level of the service protocols generated for this service + /// giving you the most flexibility over the implementation of your service. This comes at + /// the cost of more verbose and less strict APIs. Each RPC requires you to implement it in + /// terms of a request stream and response stream. Where only a single request or response + /// message is expected, you are responsible for enforcing this invariant is maintained. + /// + /// Where possible, prefer using the stricter, less-verbose ``ServiceProtocol`` + /// or ``SimpleServiceProtocol`` instead. + internal protocol StreamingServiceProtocol: GRPCCore.RegistrableRPCService { + /// Handle the "GetSupportedCurrencies" method. + /// + /// - Parameters: + /// - request: A streaming request of `Oteldemo_Empty` messages. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A streaming response of `Oteldemo_GetSupportedCurrenciesResponse` messages. + func getSupportedCurrencies( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse + + /// Handle the "Convert" method. + /// + /// - Parameters: + /// - request: A streaming request of `Oteldemo_CurrencyConversionRequest` messages. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A streaming response of `Oteldemo_Money` messages. + func convert( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse + } + + /// Service protocol for the "oteldemo.CurrencyService" service. + /// + /// This protocol is higher level than ``StreamingServiceProtocol`` but lower level than + /// the ``SimpleServiceProtocol``, it provides access to request and response metadata and + /// trailing response metadata. If you don't need these then consider using + /// the ``SimpleServiceProtocol``. If you need fine grained control over your RPCs then + /// use ``StreamingServiceProtocol``. + internal protocol ServiceProtocol: Oteldemo_CurrencyService.StreamingServiceProtocol { + /// Handle the "GetSupportedCurrencies" method. + /// + /// - Parameters: + /// - request: A request containing a single `Oteldemo_Empty` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A response containing a single `Oteldemo_GetSupportedCurrenciesResponse` message. + func getSupportedCurrencies( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse + + /// Handle the "Convert" method. + /// + /// - Parameters: + /// - request: A request containing a single `Oteldemo_CurrencyConversionRequest` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A response containing a single `Oteldemo_Money` message. + func convert( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse + } + + /// Simple service protocol for the "oteldemo.CurrencyService" service. + /// + /// This is the highest level protocol for the service. The API is the easiest to use but + /// doesn't provide access to request or response metadata. If you need access to these + /// then use ``ServiceProtocol`` instead. + internal protocol SimpleServiceProtocol: Oteldemo_CurrencyService.ServiceProtocol { + /// Handle the "GetSupportedCurrencies" method. + /// + /// - Parameters: + /// - request: A `Oteldemo_Empty` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A `Oteldemo_GetSupportedCurrenciesResponse` to respond with. + func getSupportedCurrencies( + request: Oteldemo_Empty, + context: GRPCCore.ServerContext + ) async throws -> Oteldemo_GetSupportedCurrenciesResponse + + /// Handle the "Convert" method. + /// + /// - Parameters: + /// - request: A `Oteldemo_CurrencyConversionRequest` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A `Oteldemo_Money` to respond with. + func convert( + request: Oteldemo_CurrencyConversionRequest, + context: GRPCCore.ServerContext + ) async throws -> Oteldemo_Money + } +} + +// Default implementation of 'registerMethods(with:)'. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_CurrencyService.StreamingServiceProtocol { + internal func registerMethods(with router: inout GRPCCore.RPCRouter) where Transport: GRPCCore.ServerTransport { + router.registerHandler( + forMethod: Oteldemo_CurrencyService.Method.GetSupportedCurrencies.descriptor, + deserializer: GRPCProtobuf.ProtobufDeserializer(), + serializer: GRPCProtobuf.ProtobufSerializer(), + handler: { request, context in + try await self.getSupportedCurrencies( + request: request, + context: context + ) + } + ) + router.registerHandler( + forMethod: Oteldemo_CurrencyService.Method.Convert.descriptor, + deserializer: GRPCProtobuf.ProtobufDeserializer(), + serializer: GRPCProtobuf.ProtobufSerializer(), + handler: { request, context in + try await self.convert( + request: request, + context: context + ) + } + ) + } +} + +// Default implementation of streaming methods from 'StreamingServiceProtocol'. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_CurrencyService.ServiceProtocol { + internal func getSupportedCurrencies( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse { + let response = try await self.getSupportedCurrencies( + request: GRPCCore.ServerRequest(stream: request), + context: context + ) + return GRPCCore.StreamingServerResponse(single: response) + } + + internal func convert( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse { + let response = try await self.convert( + request: GRPCCore.ServerRequest(stream: request), + context: context + ) + return GRPCCore.StreamingServerResponse(single: response) + } +} + +// Default implementation of methods from 'ServiceProtocol'. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_CurrencyService.SimpleServiceProtocol { + internal func getSupportedCurrencies( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse { + return GRPCCore.ServerResponse( + message: try await self.getSupportedCurrencies( + request: request.message, + context: context + ), + metadata: [:] + ) + } + + internal func convert( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse { + return GRPCCore.ServerResponse( + message: try await self.convert( + request: request.message, + context: context + ), + metadata: [:] + ) + } +} + +// MARK: - oteldemo.PaymentService + +/// Namespace containing generated types for the "oteldemo.PaymentService" service. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +internal enum Oteldemo_PaymentService { + /// Service descriptor for the "oteldemo.PaymentService" service. + internal static let descriptor = GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.PaymentService") + /// Namespace for method metadata. + internal enum Method { + /// Namespace for "Charge" metadata. + internal enum Charge { + /// Request type for "Charge". + internal typealias Input = Oteldemo_ChargeRequest + /// Response type for "Charge". + internal typealias Output = Oteldemo_ChargeResponse + /// Descriptor for "Charge". + internal static let descriptor = GRPCCore.MethodDescriptor( + service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.PaymentService"), + method: "Charge" + ) + } + /// Descriptors for all methods in the "oteldemo.PaymentService" service. + internal static let descriptors: [GRPCCore.MethodDescriptor] = [ + Charge.descriptor + ] + } +} + +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension GRPCCore.ServiceDescriptor { + /// Service descriptor for the "oteldemo.PaymentService" service. + internal static let oteldemo_PaymentService = GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.PaymentService") +} + +// MARK: oteldemo.PaymentService (server) + +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_PaymentService { + /// Streaming variant of the service protocol for the "oteldemo.PaymentService" service. + /// + /// This protocol is the lowest-level of the service protocols generated for this service + /// giving you the most flexibility over the implementation of your service. This comes at + /// the cost of more verbose and less strict APIs. Each RPC requires you to implement it in + /// terms of a request stream and response stream. Where only a single request or response + /// message is expected, you are responsible for enforcing this invariant is maintained. + /// + /// Where possible, prefer using the stricter, less-verbose ``ServiceProtocol`` + /// or ``SimpleServiceProtocol`` instead. + internal protocol StreamingServiceProtocol: GRPCCore.RegistrableRPCService { + /// Handle the "Charge" method. + /// + /// - Parameters: + /// - request: A streaming request of `Oteldemo_ChargeRequest` messages. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A streaming response of `Oteldemo_ChargeResponse` messages. + func charge( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse + } + + /// Service protocol for the "oteldemo.PaymentService" service. + /// + /// This protocol is higher level than ``StreamingServiceProtocol`` but lower level than + /// the ``SimpleServiceProtocol``, it provides access to request and response metadata and + /// trailing response metadata. If you don't need these then consider using + /// the ``SimpleServiceProtocol``. If you need fine grained control over your RPCs then + /// use ``StreamingServiceProtocol``. + internal protocol ServiceProtocol: Oteldemo_PaymentService.StreamingServiceProtocol { + /// Handle the "Charge" method. + /// + /// - Parameters: + /// - request: A request containing a single `Oteldemo_ChargeRequest` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A response containing a single `Oteldemo_ChargeResponse` message. + func charge( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse + } + + /// Simple service protocol for the "oteldemo.PaymentService" service. + /// + /// This is the highest level protocol for the service. The API is the easiest to use but + /// doesn't provide access to request or response metadata. If you need access to these + /// then use ``ServiceProtocol`` instead. + internal protocol SimpleServiceProtocol: Oteldemo_PaymentService.ServiceProtocol { + /// Handle the "Charge" method. + /// + /// - Parameters: + /// - request: A `Oteldemo_ChargeRequest` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A `Oteldemo_ChargeResponse` to respond with. + func charge( + request: Oteldemo_ChargeRequest, + context: GRPCCore.ServerContext + ) async throws -> Oteldemo_ChargeResponse + } +} + +// Default implementation of 'registerMethods(with:)'. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_PaymentService.StreamingServiceProtocol { + internal func registerMethods(with router: inout GRPCCore.RPCRouter) where Transport: GRPCCore.ServerTransport { + router.registerHandler( + forMethod: Oteldemo_PaymentService.Method.Charge.descriptor, + deserializer: GRPCProtobuf.ProtobufDeserializer(), + serializer: GRPCProtobuf.ProtobufSerializer(), + handler: { request, context in + try await self.charge( + request: request, + context: context + ) + } + ) + } +} + +// Default implementation of streaming methods from 'StreamingServiceProtocol'. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_PaymentService.ServiceProtocol { + internal func charge( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse { + let response = try await self.charge( + request: GRPCCore.ServerRequest(stream: request), + context: context + ) + return GRPCCore.StreamingServerResponse(single: response) + } +} + +// Default implementation of methods from 'ServiceProtocol'. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_PaymentService.SimpleServiceProtocol { + internal func charge( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse { + return GRPCCore.ServerResponse( + message: try await self.charge( + request: request.message, + context: context + ), + metadata: [:] + ) + } +} + +// MARK: - oteldemo.EmailService + +/// Namespace containing generated types for the "oteldemo.EmailService" service. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +internal enum Oteldemo_EmailService { + /// Service descriptor for the "oteldemo.EmailService" service. + internal static let descriptor = GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.EmailService") + /// Namespace for method metadata. + internal enum Method { + /// Namespace for "SendOrderConfirmation" metadata. + internal enum SendOrderConfirmation { + /// Request type for "SendOrderConfirmation". + internal typealias Input = Oteldemo_SendOrderConfirmationRequest + /// Response type for "SendOrderConfirmation". + internal typealias Output = Oteldemo_Empty + /// Descriptor for "SendOrderConfirmation". + internal static let descriptor = GRPCCore.MethodDescriptor( + service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.EmailService"), + method: "SendOrderConfirmation" + ) + } + /// Descriptors for all methods in the "oteldemo.EmailService" service. + internal static let descriptors: [GRPCCore.MethodDescriptor] = [ + SendOrderConfirmation.descriptor + ] + } +} + +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension GRPCCore.ServiceDescriptor { + /// Service descriptor for the "oteldemo.EmailService" service. + internal static let oteldemo_EmailService = GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.EmailService") +} + +// MARK: oteldemo.EmailService (server) + +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_EmailService { + /// Streaming variant of the service protocol for the "oteldemo.EmailService" service. + /// + /// This protocol is the lowest-level of the service protocols generated for this service + /// giving you the most flexibility over the implementation of your service. This comes at + /// the cost of more verbose and less strict APIs. Each RPC requires you to implement it in + /// terms of a request stream and response stream. Where only a single request or response + /// message is expected, you are responsible for enforcing this invariant is maintained. + /// + /// Where possible, prefer using the stricter, less-verbose ``ServiceProtocol`` + /// or ``SimpleServiceProtocol`` instead. + internal protocol StreamingServiceProtocol: GRPCCore.RegistrableRPCService { + /// Handle the "SendOrderConfirmation" method. + /// + /// - Parameters: + /// - request: A streaming request of `Oteldemo_SendOrderConfirmationRequest` messages. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A streaming response of `Oteldemo_Empty` messages. + func sendOrderConfirmation( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse + } + + /// Service protocol for the "oteldemo.EmailService" service. + /// + /// This protocol is higher level than ``StreamingServiceProtocol`` but lower level than + /// the ``SimpleServiceProtocol``, it provides access to request and response metadata and + /// trailing response metadata. If you don't need these then consider using + /// the ``SimpleServiceProtocol``. If you need fine grained control over your RPCs then + /// use ``StreamingServiceProtocol``. + internal protocol ServiceProtocol: Oteldemo_EmailService.StreamingServiceProtocol { + /// Handle the "SendOrderConfirmation" method. + /// + /// - Parameters: + /// - request: A request containing a single `Oteldemo_SendOrderConfirmationRequest` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A response containing a single `Oteldemo_Empty` message. + func sendOrderConfirmation( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse + } + + /// Simple service protocol for the "oteldemo.EmailService" service. + /// + /// This is the highest level protocol for the service. The API is the easiest to use but + /// doesn't provide access to request or response metadata. If you need access to these + /// then use ``ServiceProtocol`` instead. + internal protocol SimpleServiceProtocol: Oteldemo_EmailService.ServiceProtocol { + /// Handle the "SendOrderConfirmation" method. + /// + /// - Parameters: + /// - request: A `Oteldemo_SendOrderConfirmationRequest` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A `Oteldemo_Empty` to respond with. + func sendOrderConfirmation( + request: Oteldemo_SendOrderConfirmationRequest, + context: GRPCCore.ServerContext + ) async throws -> Oteldemo_Empty + } +} + +// Default implementation of 'registerMethods(with:)'. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_EmailService.StreamingServiceProtocol { + internal func registerMethods(with router: inout GRPCCore.RPCRouter) where Transport: GRPCCore.ServerTransport { + router.registerHandler( + forMethod: Oteldemo_EmailService.Method.SendOrderConfirmation.descriptor, + deserializer: GRPCProtobuf.ProtobufDeserializer(), + serializer: GRPCProtobuf.ProtobufSerializer(), + handler: { request, context in + try await self.sendOrderConfirmation( + request: request, + context: context + ) + } + ) + } +} + +// Default implementation of streaming methods from 'StreamingServiceProtocol'. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_EmailService.ServiceProtocol { + internal func sendOrderConfirmation( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse { + let response = try await self.sendOrderConfirmation( + request: GRPCCore.ServerRequest(stream: request), + context: context + ) + return GRPCCore.StreamingServerResponse(single: response) + } +} + +// Default implementation of methods from 'ServiceProtocol'. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_EmailService.SimpleServiceProtocol { + internal func sendOrderConfirmation( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse { + return GRPCCore.ServerResponse( + message: try await self.sendOrderConfirmation( + request: request.message, + context: context + ), + metadata: [:] + ) + } +} + +// MARK: - oteldemo.CheckoutService + +/// Namespace containing generated types for the "oteldemo.CheckoutService" service. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +internal enum Oteldemo_CheckoutService { + /// Service descriptor for the "oteldemo.CheckoutService" service. + internal static let descriptor = GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.CheckoutService") + /// Namespace for method metadata. + internal enum Method { + /// Namespace for "PlaceOrder" metadata. + internal enum PlaceOrder { + /// Request type for "PlaceOrder". + internal typealias Input = Oteldemo_PlaceOrderRequest + /// Response type for "PlaceOrder". + internal typealias Output = Oteldemo_PlaceOrderResponse + /// Descriptor for "PlaceOrder". + internal static let descriptor = GRPCCore.MethodDescriptor( + service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.CheckoutService"), + method: "PlaceOrder" + ) + } + /// Descriptors for all methods in the "oteldemo.CheckoutService" service. + internal static let descriptors: [GRPCCore.MethodDescriptor] = [ + PlaceOrder.descriptor + ] + } +} + +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension GRPCCore.ServiceDescriptor { + /// Service descriptor for the "oteldemo.CheckoutService" service. + internal static let oteldemo_CheckoutService = GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.CheckoutService") +} + +// MARK: oteldemo.CheckoutService (server) + +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_CheckoutService { + /// Streaming variant of the service protocol for the "oteldemo.CheckoutService" service. + /// + /// This protocol is the lowest-level of the service protocols generated for this service + /// giving you the most flexibility over the implementation of your service. This comes at + /// the cost of more verbose and less strict APIs. Each RPC requires you to implement it in + /// terms of a request stream and response stream. Where only a single request or response + /// message is expected, you are responsible for enforcing this invariant is maintained. + /// + /// Where possible, prefer using the stricter, less-verbose ``ServiceProtocol`` + /// or ``SimpleServiceProtocol`` instead. + internal protocol StreamingServiceProtocol: GRPCCore.RegistrableRPCService { + /// Handle the "PlaceOrder" method. + /// + /// - Parameters: + /// - request: A streaming request of `Oteldemo_PlaceOrderRequest` messages. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A streaming response of `Oteldemo_PlaceOrderResponse` messages. + func placeOrder( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse + } + + /// Service protocol for the "oteldemo.CheckoutService" service. + /// + /// This protocol is higher level than ``StreamingServiceProtocol`` but lower level than + /// the ``SimpleServiceProtocol``, it provides access to request and response metadata and + /// trailing response metadata. If you don't need these then consider using + /// the ``SimpleServiceProtocol``. If you need fine grained control over your RPCs then + /// use ``StreamingServiceProtocol``. + internal protocol ServiceProtocol: Oteldemo_CheckoutService.StreamingServiceProtocol { + /// Handle the "PlaceOrder" method. + /// + /// - Parameters: + /// - request: A request containing a single `Oteldemo_PlaceOrderRequest` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A response containing a single `Oteldemo_PlaceOrderResponse` message. + func placeOrder( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse + } + + /// Simple service protocol for the "oteldemo.CheckoutService" service. + /// + /// This is the highest level protocol for the service. The API is the easiest to use but + /// doesn't provide access to request or response metadata. If you need access to these + /// then use ``ServiceProtocol`` instead. + internal protocol SimpleServiceProtocol: Oteldemo_CheckoutService.ServiceProtocol { + /// Handle the "PlaceOrder" method. + /// + /// - Parameters: + /// - request: A `Oteldemo_PlaceOrderRequest` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A `Oteldemo_PlaceOrderResponse` to respond with. + func placeOrder( + request: Oteldemo_PlaceOrderRequest, + context: GRPCCore.ServerContext + ) async throws -> Oteldemo_PlaceOrderResponse + } +} + +// Default implementation of 'registerMethods(with:)'. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_CheckoutService.StreamingServiceProtocol { + internal func registerMethods(with router: inout GRPCCore.RPCRouter) where Transport: GRPCCore.ServerTransport { + router.registerHandler( + forMethod: Oteldemo_CheckoutService.Method.PlaceOrder.descriptor, + deserializer: GRPCProtobuf.ProtobufDeserializer(), + serializer: GRPCProtobuf.ProtobufSerializer(), + handler: { request, context in + try await self.placeOrder( + request: request, + context: context + ) + } + ) + } +} + +// Default implementation of streaming methods from 'StreamingServiceProtocol'. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_CheckoutService.ServiceProtocol { + internal func placeOrder( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse { + let response = try await self.placeOrder( + request: GRPCCore.ServerRequest(stream: request), + context: context + ) + return GRPCCore.StreamingServerResponse(single: response) + } +} + +// Default implementation of methods from 'ServiceProtocol'. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_CheckoutService.SimpleServiceProtocol { + internal func placeOrder( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse { + return GRPCCore.ServerResponse( + message: try await self.placeOrder( + request: request.message, + context: context + ), + metadata: [:] + ) + } +} + +// MARK: - oteldemo.AdService + +/// Namespace containing generated types for the "oteldemo.AdService" service. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +internal enum Oteldemo_AdService { + /// Service descriptor for the "oteldemo.AdService" service. + internal static let descriptor = GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.AdService") + /// Namespace for method metadata. + internal enum Method { + /// Namespace for "GetAds" metadata. + internal enum GetAds { + /// Request type for "GetAds". + internal typealias Input = Oteldemo_AdRequest + /// Response type for "GetAds". + internal typealias Output = Oteldemo_AdResponse + /// Descriptor for "GetAds". + internal static let descriptor = GRPCCore.MethodDescriptor( + service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.AdService"), + method: "GetAds" + ) + } + /// Descriptors for all methods in the "oteldemo.AdService" service. + internal static let descriptors: [GRPCCore.MethodDescriptor] = [ + GetAds.descriptor + ] + } +} + +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension GRPCCore.ServiceDescriptor { + /// Service descriptor for the "oteldemo.AdService" service. + internal static let oteldemo_AdService = GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.AdService") +} + +// MARK: oteldemo.AdService (server) + +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_AdService { + /// Streaming variant of the service protocol for the "oteldemo.AdService" service. + /// + /// This protocol is the lowest-level of the service protocols generated for this service + /// giving you the most flexibility over the implementation of your service. This comes at + /// the cost of more verbose and less strict APIs. Each RPC requires you to implement it in + /// terms of a request stream and response stream. Where only a single request or response + /// message is expected, you are responsible for enforcing this invariant is maintained. + /// + /// Where possible, prefer using the stricter, less-verbose ``ServiceProtocol`` + /// or ``SimpleServiceProtocol`` instead. + internal protocol StreamingServiceProtocol: GRPCCore.RegistrableRPCService { + /// Handle the "GetAds" method. + /// + /// - Parameters: + /// - request: A streaming request of `Oteldemo_AdRequest` messages. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A streaming response of `Oteldemo_AdResponse` messages. + func getAds( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse + } + + /// Service protocol for the "oteldemo.AdService" service. + /// + /// This protocol is higher level than ``StreamingServiceProtocol`` but lower level than + /// the ``SimpleServiceProtocol``, it provides access to request and response metadata and + /// trailing response metadata. If you don't need these then consider using + /// the ``SimpleServiceProtocol``. If you need fine grained control over your RPCs then + /// use ``StreamingServiceProtocol``. + internal protocol ServiceProtocol: Oteldemo_AdService.StreamingServiceProtocol { + /// Handle the "GetAds" method. + /// + /// - Parameters: + /// - request: A request containing a single `Oteldemo_AdRequest` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A response containing a single `Oteldemo_AdResponse` message. + func getAds( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse + } + + /// Simple service protocol for the "oteldemo.AdService" service. + /// + /// This is the highest level protocol for the service. The API is the easiest to use but + /// doesn't provide access to request or response metadata. If you need access to these + /// then use ``ServiceProtocol`` instead. + internal protocol SimpleServiceProtocol: Oteldemo_AdService.ServiceProtocol { + /// Handle the "GetAds" method. + /// + /// - Parameters: + /// - request: A `Oteldemo_AdRequest` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A `Oteldemo_AdResponse` to respond with. + func getAds( + request: Oteldemo_AdRequest, + context: GRPCCore.ServerContext + ) async throws -> Oteldemo_AdResponse + } +} + +// Default implementation of 'registerMethods(with:)'. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_AdService.StreamingServiceProtocol { + internal func registerMethods(with router: inout GRPCCore.RPCRouter) where Transport: GRPCCore.ServerTransport { + router.registerHandler( + forMethod: Oteldemo_AdService.Method.GetAds.descriptor, + deserializer: GRPCProtobuf.ProtobufDeserializer(), + serializer: GRPCProtobuf.ProtobufSerializer(), + handler: { request, context in + try await self.getAds( + request: request, + context: context + ) + } + ) + } +} + +// Default implementation of streaming methods from 'StreamingServiceProtocol'. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_AdService.ServiceProtocol { + internal func getAds( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse { + let response = try await self.getAds( + request: GRPCCore.ServerRequest(stream: request), + context: context + ) + return GRPCCore.StreamingServerResponse(single: response) + } +} + +// Default implementation of methods from 'ServiceProtocol'. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_AdService.SimpleServiceProtocol { + internal func getAds( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse { + return GRPCCore.ServerResponse( + message: try await self.getAds( + request: request.message, + context: context + ), + metadata: [:] + ) + } +} + +// MARK: - oteldemo.FeatureFlagService + +/// Namespace containing generated types for the "oteldemo.FeatureFlagService" service. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +internal enum Oteldemo_FeatureFlagService { + /// Service descriptor for the "oteldemo.FeatureFlagService" service. + internal static let descriptor = GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.FeatureFlagService") + /// Namespace for method metadata. + internal enum Method { + /// Namespace for "GetFlag" metadata. + internal enum GetFlag { + /// Request type for "GetFlag". + internal typealias Input = Oteldemo_GetFlagRequest + /// Response type for "GetFlag". + internal typealias Output = Oteldemo_GetFlagResponse + /// Descriptor for "GetFlag". + internal static let descriptor = GRPCCore.MethodDescriptor( + service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.FeatureFlagService"), + method: "GetFlag" + ) + } + /// Namespace for "CreateFlag" metadata. + internal enum CreateFlag { + /// Request type for "CreateFlag". + internal typealias Input = Oteldemo_CreateFlagRequest + /// Response type for "CreateFlag". + internal typealias Output = Oteldemo_CreateFlagResponse + /// Descriptor for "CreateFlag". + internal static let descriptor = GRPCCore.MethodDescriptor( + service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.FeatureFlagService"), + method: "CreateFlag" + ) + } + /// Namespace for "UpdateFlag" metadata. + internal enum UpdateFlag { + /// Request type for "UpdateFlag". + internal typealias Input = Oteldemo_UpdateFlagRequest + /// Response type for "UpdateFlag". + internal typealias Output = Oteldemo_UpdateFlagResponse + /// Descriptor for "UpdateFlag". + internal static let descriptor = GRPCCore.MethodDescriptor( + service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.FeatureFlagService"), + method: "UpdateFlag" + ) + } + /// Namespace for "ListFlags" metadata. + internal enum ListFlags { + /// Request type for "ListFlags". + internal typealias Input = Oteldemo_ListFlagsRequest + /// Response type for "ListFlags". + internal typealias Output = Oteldemo_ListFlagsResponse + /// Descriptor for "ListFlags". + internal static let descriptor = GRPCCore.MethodDescriptor( + service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.FeatureFlagService"), + method: "ListFlags" + ) + } + /// Namespace for "DeleteFlag" metadata. + internal enum DeleteFlag { + /// Request type for "DeleteFlag". + internal typealias Input = Oteldemo_DeleteFlagRequest + /// Response type for "DeleteFlag". + internal typealias Output = Oteldemo_DeleteFlagResponse + /// Descriptor for "DeleteFlag". + internal static let descriptor = GRPCCore.MethodDescriptor( + service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.FeatureFlagService"), + method: "DeleteFlag" + ) + } + /// Descriptors for all methods in the "oteldemo.FeatureFlagService" service. + internal static let descriptors: [GRPCCore.MethodDescriptor] = [ + GetFlag.descriptor, + CreateFlag.descriptor, + UpdateFlag.descriptor, + ListFlags.descriptor, + DeleteFlag.descriptor + ] + } +} + +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension GRPCCore.ServiceDescriptor { + /// Service descriptor for the "oteldemo.FeatureFlagService" service. + internal static let oteldemo_FeatureFlagService = GRPCCore.ServiceDescriptor(fullyQualifiedService: "oteldemo.FeatureFlagService") +} + +// MARK: oteldemo.FeatureFlagService (server) + +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_FeatureFlagService { + /// Streaming variant of the service protocol for the "oteldemo.FeatureFlagService" service. + /// + /// This protocol is the lowest-level of the service protocols generated for this service + /// giving you the most flexibility over the implementation of your service. This comes at + /// the cost of more verbose and less strict APIs. Each RPC requires you to implement it in + /// terms of a request stream and response stream. Where only a single request or response + /// message is expected, you are responsible for enforcing this invariant is maintained. + /// + /// Where possible, prefer using the stricter, less-verbose ``ServiceProtocol`` + /// or ``SimpleServiceProtocol`` instead. + internal protocol StreamingServiceProtocol: GRPCCore.RegistrableRPCService { + /// Handle the "GetFlag" method. + /// + /// - Parameters: + /// - request: A streaming request of `Oteldemo_GetFlagRequest` messages. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A streaming response of `Oteldemo_GetFlagResponse` messages. + func getFlag( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse + + /// Handle the "CreateFlag" method. + /// + /// - Parameters: + /// - request: A streaming request of `Oteldemo_CreateFlagRequest` messages. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A streaming response of `Oteldemo_CreateFlagResponse` messages. + func createFlag( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse + + /// Handle the "UpdateFlag" method. + /// + /// - Parameters: + /// - request: A streaming request of `Oteldemo_UpdateFlagRequest` messages. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A streaming response of `Oteldemo_UpdateFlagResponse` messages. + func updateFlag( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse + + /// Handle the "ListFlags" method. + /// + /// - Parameters: + /// - request: A streaming request of `Oteldemo_ListFlagsRequest` messages. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A streaming response of `Oteldemo_ListFlagsResponse` messages. + func listFlags( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse + + /// Handle the "DeleteFlag" method. + /// + /// - Parameters: + /// - request: A streaming request of `Oteldemo_DeleteFlagRequest` messages. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A streaming response of `Oteldemo_DeleteFlagResponse` messages. + func deleteFlag( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse + } + + /// Service protocol for the "oteldemo.FeatureFlagService" service. + /// + /// This protocol is higher level than ``StreamingServiceProtocol`` but lower level than + /// the ``SimpleServiceProtocol``, it provides access to request and response metadata and + /// trailing response metadata. If you don't need these then consider using + /// the ``SimpleServiceProtocol``. If you need fine grained control over your RPCs then + /// use ``StreamingServiceProtocol``. + internal protocol ServiceProtocol: Oteldemo_FeatureFlagService.StreamingServiceProtocol { + /// Handle the "GetFlag" method. + /// + /// - Parameters: + /// - request: A request containing a single `Oteldemo_GetFlagRequest` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A response containing a single `Oteldemo_GetFlagResponse` message. + func getFlag( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse + + /// Handle the "CreateFlag" method. + /// + /// - Parameters: + /// - request: A request containing a single `Oteldemo_CreateFlagRequest` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A response containing a single `Oteldemo_CreateFlagResponse` message. + func createFlag( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse + + /// Handle the "UpdateFlag" method. + /// + /// - Parameters: + /// - request: A request containing a single `Oteldemo_UpdateFlagRequest` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A response containing a single `Oteldemo_UpdateFlagResponse` message. + func updateFlag( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse + + /// Handle the "ListFlags" method. + /// + /// - Parameters: + /// - request: A request containing a single `Oteldemo_ListFlagsRequest` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A response containing a single `Oteldemo_ListFlagsResponse` message. + func listFlags( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse + + /// Handle the "DeleteFlag" method. + /// + /// - Parameters: + /// - request: A request containing a single `Oteldemo_DeleteFlagRequest` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A response containing a single `Oteldemo_DeleteFlagResponse` message. + func deleteFlag( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse + } + + /// Simple service protocol for the "oteldemo.FeatureFlagService" service. + /// + /// This is the highest level protocol for the service. The API is the easiest to use but + /// doesn't provide access to request or response metadata. If you need access to these + /// then use ``ServiceProtocol`` instead. + internal protocol SimpleServiceProtocol: Oteldemo_FeatureFlagService.ServiceProtocol { + /// Handle the "GetFlag" method. + /// + /// - Parameters: + /// - request: A `Oteldemo_GetFlagRequest` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A `Oteldemo_GetFlagResponse` to respond with. + func getFlag( + request: Oteldemo_GetFlagRequest, + context: GRPCCore.ServerContext + ) async throws -> Oteldemo_GetFlagResponse + + /// Handle the "CreateFlag" method. + /// + /// - Parameters: + /// - request: A `Oteldemo_CreateFlagRequest` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A `Oteldemo_CreateFlagResponse` to respond with. + func createFlag( + request: Oteldemo_CreateFlagRequest, + context: GRPCCore.ServerContext + ) async throws -> Oteldemo_CreateFlagResponse + + /// Handle the "UpdateFlag" method. + /// + /// - Parameters: + /// - request: A `Oteldemo_UpdateFlagRequest` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A `Oteldemo_UpdateFlagResponse` to respond with. + func updateFlag( + request: Oteldemo_UpdateFlagRequest, + context: GRPCCore.ServerContext + ) async throws -> Oteldemo_UpdateFlagResponse + + /// Handle the "ListFlags" method. + /// + /// - Parameters: + /// - request: A `Oteldemo_ListFlagsRequest` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A `Oteldemo_ListFlagsResponse` to respond with. + func listFlags( + request: Oteldemo_ListFlagsRequest, + context: GRPCCore.ServerContext + ) async throws -> Oteldemo_ListFlagsResponse + + /// Handle the "DeleteFlag" method. + /// + /// - Parameters: + /// - request: A `Oteldemo_DeleteFlagRequest` message. + /// - context: Context providing information about the RPC. + /// - Throws: Any error which occurred during the processing of the request. Thrown errors + /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted + /// to an internal error. + /// - Returns: A `Oteldemo_DeleteFlagResponse` to respond with. + func deleteFlag( + request: Oteldemo_DeleteFlagRequest, + context: GRPCCore.ServerContext + ) async throws -> Oteldemo_DeleteFlagResponse + } +} + +// Default implementation of 'registerMethods(with:)'. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_FeatureFlagService.StreamingServiceProtocol { + internal func registerMethods(with router: inout GRPCCore.RPCRouter) where Transport: GRPCCore.ServerTransport { + router.registerHandler( + forMethod: Oteldemo_FeatureFlagService.Method.GetFlag.descriptor, + deserializer: GRPCProtobuf.ProtobufDeserializer(), + serializer: GRPCProtobuf.ProtobufSerializer(), + handler: { request, context in + try await self.getFlag( + request: request, + context: context + ) + } + ) + router.registerHandler( + forMethod: Oteldemo_FeatureFlagService.Method.CreateFlag.descriptor, + deserializer: GRPCProtobuf.ProtobufDeserializer(), + serializer: GRPCProtobuf.ProtobufSerializer(), + handler: { request, context in + try await self.createFlag( + request: request, + context: context + ) + } + ) + router.registerHandler( + forMethod: Oteldemo_FeatureFlagService.Method.UpdateFlag.descriptor, + deserializer: GRPCProtobuf.ProtobufDeserializer(), + serializer: GRPCProtobuf.ProtobufSerializer(), + handler: { request, context in + try await self.updateFlag( + request: request, + context: context + ) + } + ) + router.registerHandler( + forMethod: Oteldemo_FeatureFlagService.Method.ListFlags.descriptor, + deserializer: GRPCProtobuf.ProtobufDeserializer(), + serializer: GRPCProtobuf.ProtobufSerializer(), + handler: { request, context in + try await self.listFlags( + request: request, + context: context + ) + } + ) + router.registerHandler( + forMethod: Oteldemo_FeatureFlagService.Method.DeleteFlag.descriptor, + deserializer: GRPCProtobuf.ProtobufDeserializer(), + serializer: GRPCProtobuf.ProtobufSerializer(), + handler: { request, context in + try await self.deleteFlag( + request: request, + context: context + ) + } + ) + } +} + +// Default implementation of streaming methods from 'StreamingServiceProtocol'. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_FeatureFlagService.ServiceProtocol { + internal func getFlag( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse { + let response = try await self.getFlag( + request: GRPCCore.ServerRequest(stream: request), + context: context + ) + return GRPCCore.StreamingServerResponse(single: response) + } + + internal func createFlag( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse { + let response = try await self.createFlag( + request: GRPCCore.ServerRequest(stream: request), + context: context + ) + return GRPCCore.StreamingServerResponse(single: response) + } + + internal func updateFlag( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse { + let response = try await self.updateFlag( + request: GRPCCore.ServerRequest(stream: request), + context: context + ) + return GRPCCore.StreamingServerResponse(single: response) + } + + internal func listFlags( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse { + let response = try await self.listFlags( + request: GRPCCore.ServerRequest(stream: request), + context: context + ) + return GRPCCore.StreamingServerResponse(single: response) + } + + internal func deleteFlag( + request: GRPCCore.StreamingServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.StreamingServerResponse { + let response = try await self.deleteFlag( + request: GRPCCore.ServerRequest(stream: request), + context: context + ) + return GRPCCore.StreamingServerResponse(single: response) + } +} + +// Default implementation of methods from 'ServiceProtocol'. +@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) +extension Oteldemo_FeatureFlagService.SimpleServiceProtocol { + internal func getFlag( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse { + return GRPCCore.ServerResponse( + message: try await self.getFlag( + request: request.message, + context: context + ), + metadata: [:] + ) + } + + internal func createFlag( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse { + return GRPCCore.ServerResponse( + message: try await self.createFlag( + request: request.message, + context: context + ), + metadata: [:] + ) + } + + internal func updateFlag( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse { + return GRPCCore.ServerResponse( + message: try await self.updateFlag( + request: request.message, + context: context + ), + metadata: [:] + ) + } + + internal func listFlags( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse { + return GRPCCore.ServerResponse( + message: try await self.listFlags( + request: request.message, + context: context + ), + metadata: [:] + ) + } + + internal func deleteFlag( + request: GRPCCore.ServerRequest, + context: GRPCCore.ServerContext + ) async throws -> GRPCCore.ServerResponse { + return GRPCCore.ServerResponse( + message: try await self.deleteFlag( + request: request.message, + context: context + ), + metadata: [:] + ) + } +} \ No newline at end of file diff --git a/src/cart/Sources/CTL/Generated/demo.pb.swift b/src/cart/Sources/CTL/Generated/demo.pb.swift new file mode 100644 index 0000000000..7d3a84a80c --- /dev/null +++ b/src/cart/Sources/CTL/Generated/demo.pb.swift @@ -0,0 +1,2290 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// swiftlint:disable all +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: demo.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import SwiftProtobuf + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +struct Oteldemo_CartItem: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var productID: String = String() + + var quantity: Int32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Oteldemo_AddItemRequest: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var userID: String = String() + + var item: Oteldemo_CartItem { + get {return _item ?? Oteldemo_CartItem()} + set {_item = newValue} + } + /// Returns true if `item` has been explicitly set. + var hasItem: Bool {return self._item != nil} + /// Clears the value of `item`. Subsequent reads from it will return its default value. + mutating func clearItem() {self._item = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _item: Oteldemo_CartItem? = nil +} + +struct Oteldemo_EmptyCartRequest: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var userID: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Oteldemo_GetCartRequest: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var userID: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Oteldemo_Cart: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var userID: String = String() + + var items: [Oteldemo_CartItem] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Oteldemo_Empty: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Oteldemo_ListRecommendationsRequest: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var userID: String = String() + + var productIds: [String] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Oteldemo_ListRecommendationsResponse: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var productIds: [String] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Oteldemo_Product: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var id: String = String() + + var name: String = String() + + var description_p: String = String() + + var picture: String = String() + + var priceUsd: Oteldemo_Money { + get {return _priceUsd ?? Oteldemo_Money()} + set {_priceUsd = newValue} + } + /// Returns true if `priceUsd` has been explicitly set. + var hasPriceUsd: Bool {return self._priceUsd != nil} + /// Clears the value of `priceUsd`. Subsequent reads from it will return its default value. + mutating func clearPriceUsd() {self._priceUsd = nil} + + /// Categories such as "clothing" or "kitchen" that can be used to look up + /// other related products. + var categories: [String] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _priceUsd: Oteldemo_Money? = nil +} + +struct Oteldemo_ListProductsResponse: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var products: [Oteldemo_Product] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Oteldemo_GetProductRequest: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var id: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Oteldemo_SearchProductsRequest: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var query: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Oteldemo_SearchProductsResponse: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var results: [Oteldemo_Product] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Oteldemo_GetQuoteRequest: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var address: Oteldemo_Address { + get {return _address ?? Oteldemo_Address()} + set {_address = newValue} + } + /// Returns true if `address` has been explicitly set. + var hasAddress: Bool {return self._address != nil} + /// Clears the value of `address`. Subsequent reads from it will return its default value. + mutating func clearAddress() {self._address = nil} + + var items: [Oteldemo_CartItem] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _address: Oteldemo_Address? = nil +} + +struct Oteldemo_GetQuoteResponse: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var costUsd: Oteldemo_Money { + get {return _costUsd ?? Oteldemo_Money()} + set {_costUsd = newValue} + } + /// Returns true if `costUsd` has been explicitly set. + var hasCostUsd: Bool {return self._costUsd != nil} + /// Clears the value of `costUsd`. Subsequent reads from it will return its default value. + mutating func clearCostUsd() {self._costUsd = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _costUsd: Oteldemo_Money? = nil +} + +struct Oteldemo_ShipOrderRequest: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var address: Oteldemo_Address { + get {return _address ?? Oteldemo_Address()} + set {_address = newValue} + } + /// Returns true if `address` has been explicitly set. + var hasAddress: Bool {return self._address != nil} + /// Clears the value of `address`. Subsequent reads from it will return its default value. + mutating func clearAddress() {self._address = nil} + + var items: [Oteldemo_CartItem] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _address: Oteldemo_Address? = nil +} + +struct Oteldemo_ShipOrderResponse: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var trackingID: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Oteldemo_Address: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var streetAddress: String = String() + + var city: String = String() + + var state: String = String() + + var country: String = String() + + var zipCode: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +/// Represents an amount of money with its currency type. +struct Oteldemo_Money: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The 3-letter currency code defined in ISO 4217. + var currencyCode: String = String() + + /// The whole units of the amount. + /// For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar. + var units: Int64 = 0 + + /// Number of nano (10^-9) units of the amount. + /// The value must be between -999,999,999 and +999,999,999 inclusive. + /// If `units` is positive, `nanos` must be positive or zero. + /// If `units` is zero, `nanos` can be positive, zero, or negative. + /// If `units` is negative, `nanos` must be negative or zero. + /// For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000. + var nanos: Int32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Oteldemo_GetSupportedCurrenciesResponse: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The 3-letter currency code defined in ISO 4217. + var currencyCodes: [String] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Oteldemo_CurrencyConversionRequest: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var from: Oteldemo_Money { + get {return _from ?? Oteldemo_Money()} + set {_from = newValue} + } + /// Returns true if `from` has been explicitly set. + var hasFrom: Bool {return self._from != nil} + /// Clears the value of `from`. Subsequent reads from it will return its default value. + mutating func clearFrom() {self._from = nil} + + /// The 3-letter currency code defined in ISO 4217. + var toCode: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _from: Oteldemo_Money? = nil +} + +struct Oteldemo_CreditCardInfo: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var creditCardNumber: String = String() + + var creditCardCvv: Int32 = 0 + + var creditCardExpirationYear: Int32 = 0 + + var creditCardExpirationMonth: Int32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Oteldemo_ChargeRequest: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var amount: Oteldemo_Money { + get {return _amount ?? Oteldemo_Money()} + set {_amount = newValue} + } + /// Returns true if `amount` has been explicitly set. + var hasAmount: Bool {return self._amount != nil} + /// Clears the value of `amount`. Subsequent reads from it will return its default value. + mutating func clearAmount() {self._amount = nil} + + var creditCard: Oteldemo_CreditCardInfo { + get {return _creditCard ?? Oteldemo_CreditCardInfo()} + set {_creditCard = newValue} + } + /// Returns true if `creditCard` has been explicitly set. + var hasCreditCard: Bool {return self._creditCard != nil} + /// Clears the value of `creditCard`. Subsequent reads from it will return its default value. + mutating func clearCreditCard() {self._creditCard = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _amount: Oteldemo_Money? = nil + fileprivate var _creditCard: Oteldemo_CreditCardInfo? = nil +} + +struct Oteldemo_ChargeResponse: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var transactionID: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Oteldemo_OrderItem: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var item: Oteldemo_CartItem { + get {return _item ?? Oteldemo_CartItem()} + set {_item = newValue} + } + /// Returns true if `item` has been explicitly set. + var hasItem: Bool {return self._item != nil} + /// Clears the value of `item`. Subsequent reads from it will return its default value. + mutating func clearItem() {self._item = nil} + + var cost: Oteldemo_Money { + get {return _cost ?? Oteldemo_Money()} + set {_cost = newValue} + } + /// Returns true if `cost` has been explicitly set. + var hasCost: Bool {return self._cost != nil} + /// Clears the value of `cost`. Subsequent reads from it will return its default value. + mutating func clearCost() {self._cost = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _item: Oteldemo_CartItem? = nil + fileprivate var _cost: Oteldemo_Money? = nil +} + +struct Oteldemo_OrderResult: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var orderID: String = String() + + var shippingTrackingID: String = String() + + var shippingCost: Oteldemo_Money { + get {return _shippingCost ?? Oteldemo_Money()} + set {_shippingCost = newValue} + } + /// Returns true if `shippingCost` has been explicitly set. + var hasShippingCost: Bool {return self._shippingCost != nil} + /// Clears the value of `shippingCost`. Subsequent reads from it will return its default value. + mutating func clearShippingCost() {self._shippingCost = nil} + + var shippingAddress: Oteldemo_Address { + get {return _shippingAddress ?? Oteldemo_Address()} + set {_shippingAddress = newValue} + } + /// Returns true if `shippingAddress` has been explicitly set. + var hasShippingAddress: Bool {return self._shippingAddress != nil} + /// Clears the value of `shippingAddress`. Subsequent reads from it will return its default value. + mutating func clearShippingAddress() {self._shippingAddress = nil} + + var items: [Oteldemo_OrderItem] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _shippingCost: Oteldemo_Money? = nil + fileprivate var _shippingAddress: Oteldemo_Address? = nil +} + +struct Oteldemo_SendOrderConfirmationRequest: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var email: String = String() + + var order: Oteldemo_OrderResult { + get {return _order ?? Oteldemo_OrderResult()} + set {_order = newValue} + } + /// Returns true if `order` has been explicitly set. + var hasOrder: Bool {return self._order != nil} + /// Clears the value of `order`. Subsequent reads from it will return its default value. + mutating func clearOrder() {self._order = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _order: Oteldemo_OrderResult? = nil +} + +struct Oteldemo_PlaceOrderRequest: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var userID: String = String() + + var userCurrency: String = String() + + var address: Oteldemo_Address { + get {return _address ?? Oteldemo_Address()} + set {_address = newValue} + } + /// Returns true if `address` has been explicitly set. + var hasAddress: Bool {return self._address != nil} + /// Clears the value of `address`. Subsequent reads from it will return its default value. + mutating func clearAddress() {self._address = nil} + + var email: String = String() + + var creditCard: Oteldemo_CreditCardInfo { + get {return _creditCard ?? Oteldemo_CreditCardInfo()} + set {_creditCard = newValue} + } + /// Returns true if `creditCard` has been explicitly set. + var hasCreditCard: Bool {return self._creditCard != nil} + /// Clears the value of `creditCard`. Subsequent reads from it will return its default value. + mutating func clearCreditCard() {self._creditCard = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _address: Oteldemo_Address? = nil + fileprivate var _creditCard: Oteldemo_CreditCardInfo? = nil +} + +struct Oteldemo_PlaceOrderResponse: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var order: Oteldemo_OrderResult { + get {return _order ?? Oteldemo_OrderResult()} + set {_order = newValue} + } + /// Returns true if `order` has been explicitly set. + var hasOrder: Bool {return self._order != nil} + /// Clears the value of `order`. Subsequent reads from it will return its default value. + mutating func clearOrder() {self._order = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _order: Oteldemo_OrderResult? = nil +} + +struct Oteldemo_AdRequest: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// List of important key words from the current page describing the context. + var contextKeys: [String] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Oteldemo_AdResponse: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var ads: [Oteldemo_Ad] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Oteldemo_Ad: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// url to redirect to when an ad is clicked. + var redirectURL: String = String() + + /// short advertisement text to display. + var text: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Oteldemo_Flag: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var name: String = String() + + var description_p: String = String() + + var enabled: Bool = false + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Oteldemo_GetFlagRequest: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var name: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Oteldemo_GetFlagResponse: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var flag: Oteldemo_Flag { + get {return _flag ?? Oteldemo_Flag()} + set {_flag = newValue} + } + /// Returns true if `flag` has been explicitly set. + var hasFlag: Bool {return self._flag != nil} + /// Clears the value of `flag`. Subsequent reads from it will return its default value. + mutating func clearFlag() {self._flag = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _flag: Oteldemo_Flag? = nil +} + +struct Oteldemo_CreateFlagRequest: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var name: String = String() + + var description_p: String = String() + + var enabled: Bool = false + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Oteldemo_CreateFlagResponse: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var flag: Oteldemo_Flag { + get {return _flag ?? Oteldemo_Flag()} + set {_flag = newValue} + } + /// Returns true if `flag` has been explicitly set. + var hasFlag: Bool {return self._flag != nil} + /// Clears the value of `flag`. Subsequent reads from it will return its default value. + mutating func clearFlag() {self._flag = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _flag: Oteldemo_Flag? = nil +} + +struct Oteldemo_UpdateFlagRequest: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var name: String = String() + + var enabled: Bool = false + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Oteldemo_UpdateFlagResponse: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Oteldemo_ListFlagsRequest: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Oteldemo_ListFlagsResponse: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var flag: [Oteldemo_Flag] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Oteldemo_DeleteFlagRequest: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var name: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Oteldemo_DeleteFlagResponse: Sendable { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "oteldemo" + +extension Oteldemo_CartItem: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".CartItem" + static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}product_id\0\u{1}quantity\0") + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self.productID) }() + case 2: try { try decoder.decodeSingularInt32Field(value: &self.quantity) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.productID.isEmpty { + try visitor.visitSingularStringField(value: self.productID, fieldNumber: 1) + } + if self.quantity != 0 { + try visitor.visitSingularInt32Field(value: self.quantity, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_CartItem, rhs: Oteldemo_CartItem) -> Bool { + if lhs.productID != rhs.productID {return false} + if lhs.quantity != rhs.quantity {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_AddItemRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".AddItemRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}user_id\0\u{1}item\0") + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self.userID) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._item) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + if !self.userID.isEmpty { + try visitor.visitSingularStringField(value: self.userID, fieldNumber: 1) + } + try { if let v = self._item { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_AddItemRequest, rhs: Oteldemo_AddItemRequest) -> Bool { + if lhs.userID != rhs.userID {return false} + if lhs._item != rhs._item {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_EmptyCartRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".EmptyCartRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}user_id\0") + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self.userID) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.userID.isEmpty { + try visitor.visitSingularStringField(value: self.userID, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_EmptyCartRequest, rhs: Oteldemo_EmptyCartRequest) -> Bool { + if lhs.userID != rhs.userID {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_GetCartRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".GetCartRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}user_id\0") + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self.userID) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.userID.isEmpty { + try visitor.visitSingularStringField(value: self.userID, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_GetCartRequest, rhs: Oteldemo_GetCartRequest) -> Bool { + if lhs.userID != rhs.userID {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_Cart: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Cart" + static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}user_id\0\u{1}items\0") + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self.userID) }() + case 2: try { try decoder.decodeRepeatedMessageField(value: &self.items) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.userID.isEmpty { + try visitor.visitSingularStringField(value: self.userID, fieldNumber: 1) + } + if !self.items.isEmpty { + try visitor.visitRepeatedMessageField(value: self.items, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_Cart, rhs: Oteldemo_Cart) -> Bool { + if lhs.userID != rhs.userID {return false} + if lhs.items != rhs.items {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_Empty: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Empty" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + // Load everything into unknown fields + while try decoder.nextFieldNumber() != nil {} + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_Empty, rhs: Oteldemo_Empty) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_ListRecommendationsRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ListRecommendationsRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}user_id\0\u{3}product_ids\0") + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self.userID) }() + case 2: try { try decoder.decodeRepeatedStringField(value: &self.productIds) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.userID.isEmpty { + try visitor.visitSingularStringField(value: self.userID, fieldNumber: 1) + } + if !self.productIds.isEmpty { + try visitor.visitRepeatedStringField(value: self.productIds, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_ListRecommendationsRequest, rhs: Oteldemo_ListRecommendationsRequest) -> Bool { + if lhs.userID != rhs.userID {return false} + if lhs.productIds != rhs.productIds {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_ListRecommendationsResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ListRecommendationsResponse" + static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}product_ids\0") + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeRepeatedStringField(value: &self.productIds) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.productIds.isEmpty { + try visitor.visitRepeatedStringField(value: self.productIds, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_ListRecommendationsResponse, rhs: Oteldemo_ListRecommendationsResponse) -> Bool { + if lhs.productIds != rhs.productIds {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_Product: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Product" + static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}id\0\u{1}name\0\u{1}description\0\u{1}picture\0\u{3}price_usd\0\u{1}categories\0") + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self.id) }() + case 2: try { try decoder.decodeSingularStringField(value: &self.name) }() + case 3: try { try decoder.decodeSingularStringField(value: &self.description_p) }() + case 4: try { try decoder.decodeSingularStringField(value: &self.picture) }() + case 5: try { try decoder.decodeSingularMessageField(value: &self._priceUsd) }() + case 6: try { try decoder.decodeRepeatedStringField(value: &self.categories) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + if !self.id.isEmpty { + try visitor.visitSingularStringField(value: self.id, fieldNumber: 1) + } + if !self.name.isEmpty { + try visitor.visitSingularStringField(value: self.name, fieldNumber: 2) + } + if !self.description_p.isEmpty { + try visitor.visitSingularStringField(value: self.description_p, fieldNumber: 3) + } + if !self.picture.isEmpty { + try visitor.visitSingularStringField(value: self.picture, fieldNumber: 4) + } + try { if let v = self._priceUsd { + try visitor.visitSingularMessageField(value: v, fieldNumber: 5) + } }() + if !self.categories.isEmpty { + try visitor.visitRepeatedStringField(value: self.categories, fieldNumber: 6) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_Product, rhs: Oteldemo_Product) -> Bool { + if lhs.id != rhs.id {return false} + if lhs.name != rhs.name {return false} + if lhs.description_p != rhs.description_p {return false} + if lhs.picture != rhs.picture {return false} + if lhs._priceUsd != rhs._priceUsd {return false} + if lhs.categories != rhs.categories {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_ListProductsResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ListProductsResponse" + static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}products\0") + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeRepeatedMessageField(value: &self.products) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.products.isEmpty { + try visitor.visitRepeatedMessageField(value: self.products, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_ListProductsResponse, rhs: Oteldemo_ListProductsResponse) -> Bool { + if lhs.products != rhs.products {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_GetProductRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".GetProductRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}id\0") + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self.id) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.id.isEmpty { + try visitor.visitSingularStringField(value: self.id, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_GetProductRequest, rhs: Oteldemo_GetProductRequest) -> Bool { + if lhs.id != rhs.id {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_SearchProductsRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SearchProductsRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}query\0") + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self.query) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.query.isEmpty { + try visitor.visitSingularStringField(value: self.query, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_SearchProductsRequest, rhs: Oteldemo_SearchProductsRequest) -> Bool { + if lhs.query != rhs.query {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_SearchProductsResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SearchProductsResponse" + static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}results\0") + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeRepeatedMessageField(value: &self.results) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.results.isEmpty { + try visitor.visitRepeatedMessageField(value: self.results, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_SearchProductsResponse, rhs: Oteldemo_SearchProductsResponse) -> Bool { + if lhs.results != rhs.results {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_GetQuoteRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".GetQuoteRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}address\0\u{1}items\0") + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularMessageField(value: &self._address) }() + case 2: try { try decoder.decodeRepeatedMessageField(value: &self.items) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._address { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + if !self.items.isEmpty { + try visitor.visitRepeatedMessageField(value: self.items, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_GetQuoteRequest, rhs: Oteldemo_GetQuoteRequest) -> Bool { + if lhs._address != rhs._address {return false} + if lhs.items != rhs.items {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_GetQuoteResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".GetQuoteResponse" + static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}cost_usd\0") + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularMessageField(value: &self._costUsd) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._costUsd { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_GetQuoteResponse, rhs: Oteldemo_GetQuoteResponse) -> Bool { + if lhs._costUsd != rhs._costUsd {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_ShipOrderRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ShipOrderRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}address\0\u{1}items\0") + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularMessageField(value: &self._address) }() + case 2: try { try decoder.decodeRepeatedMessageField(value: &self.items) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._address { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + if !self.items.isEmpty { + try visitor.visitRepeatedMessageField(value: self.items, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_ShipOrderRequest, rhs: Oteldemo_ShipOrderRequest) -> Bool { + if lhs._address != rhs._address {return false} + if lhs.items != rhs.items {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_ShipOrderResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ShipOrderResponse" + static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}tracking_id\0") + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self.trackingID) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.trackingID.isEmpty { + try visitor.visitSingularStringField(value: self.trackingID, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_ShipOrderResponse, rhs: Oteldemo_ShipOrderResponse) -> Bool { + if lhs.trackingID != rhs.trackingID {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_Address: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Address" + static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}street_address\0\u{1}city\0\u{1}state\0\u{1}country\0\u{3}zip_code\0") + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self.streetAddress) }() + case 2: try { try decoder.decodeSingularStringField(value: &self.city) }() + case 3: try { try decoder.decodeSingularStringField(value: &self.state) }() + case 4: try { try decoder.decodeSingularStringField(value: &self.country) }() + case 5: try { try decoder.decodeSingularStringField(value: &self.zipCode) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.streetAddress.isEmpty { + try visitor.visitSingularStringField(value: self.streetAddress, fieldNumber: 1) + } + if !self.city.isEmpty { + try visitor.visitSingularStringField(value: self.city, fieldNumber: 2) + } + if !self.state.isEmpty { + try visitor.visitSingularStringField(value: self.state, fieldNumber: 3) + } + if !self.country.isEmpty { + try visitor.visitSingularStringField(value: self.country, fieldNumber: 4) + } + if !self.zipCode.isEmpty { + try visitor.visitSingularStringField(value: self.zipCode, fieldNumber: 5) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_Address, rhs: Oteldemo_Address) -> Bool { + if lhs.streetAddress != rhs.streetAddress {return false} + if lhs.city != rhs.city {return false} + if lhs.state != rhs.state {return false} + if lhs.country != rhs.country {return false} + if lhs.zipCode != rhs.zipCode {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_Money: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Money" + static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}currency_code\0\u{1}units\0\u{1}nanos\0") + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self.currencyCode) }() + case 2: try { try decoder.decodeSingularInt64Field(value: &self.units) }() + case 3: try { try decoder.decodeSingularInt32Field(value: &self.nanos) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.currencyCode.isEmpty { + try visitor.visitSingularStringField(value: self.currencyCode, fieldNumber: 1) + } + if self.units != 0 { + try visitor.visitSingularInt64Field(value: self.units, fieldNumber: 2) + } + if self.nanos != 0 { + try visitor.visitSingularInt32Field(value: self.nanos, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_Money, rhs: Oteldemo_Money) -> Bool { + if lhs.currencyCode != rhs.currencyCode {return false} + if lhs.units != rhs.units {return false} + if lhs.nanos != rhs.nanos {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_GetSupportedCurrenciesResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".GetSupportedCurrenciesResponse" + static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}currency_codes\0") + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeRepeatedStringField(value: &self.currencyCodes) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.currencyCodes.isEmpty { + try visitor.visitRepeatedStringField(value: self.currencyCodes, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_GetSupportedCurrenciesResponse, rhs: Oteldemo_GetSupportedCurrenciesResponse) -> Bool { + if lhs.currencyCodes != rhs.currencyCodes {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_CurrencyConversionRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".CurrencyConversionRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}from\0\u{3}to_code\0") + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularMessageField(value: &self._from) }() + case 2: try { try decoder.decodeSingularStringField(value: &self.toCode) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._from { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + if !self.toCode.isEmpty { + try visitor.visitSingularStringField(value: self.toCode, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_CurrencyConversionRequest, rhs: Oteldemo_CurrencyConversionRequest) -> Bool { + if lhs._from != rhs._from {return false} + if lhs.toCode != rhs.toCode {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_CreditCardInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".CreditCardInfo" + static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}credit_card_number\0\u{3}credit_card_cvv\0\u{3}credit_card_expiration_year\0\u{3}credit_card_expiration_month\0") + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self.creditCardNumber) }() + case 2: try { try decoder.decodeSingularInt32Field(value: &self.creditCardCvv) }() + case 3: try { try decoder.decodeSingularInt32Field(value: &self.creditCardExpirationYear) }() + case 4: try { try decoder.decodeSingularInt32Field(value: &self.creditCardExpirationMonth) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.creditCardNumber.isEmpty { + try visitor.visitSingularStringField(value: self.creditCardNumber, fieldNumber: 1) + } + if self.creditCardCvv != 0 { + try visitor.visitSingularInt32Field(value: self.creditCardCvv, fieldNumber: 2) + } + if self.creditCardExpirationYear != 0 { + try visitor.visitSingularInt32Field(value: self.creditCardExpirationYear, fieldNumber: 3) + } + if self.creditCardExpirationMonth != 0 { + try visitor.visitSingularInt32Field(value: self.creditCardExpirationMonth, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_CreditCardInfo, rhs: Oteldemo_CreditCardInfo) -> Bool { + if lhs.creditCardNumber != rhs.creditCardNumber {return false} + if lhs.creditCardCvv != rhs.creditCardCvv {return false} + if lhs.creditCardExpirationYear != rhs.creditCardExpirationYear {return false} + if lhs.creditCardExpirationMonth != rhs.creditCardExpirationMonth {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_ChargeRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ChargeRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}amount\0\u{3}credit_card\0") + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularMessageField(value: &self._amount) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._creditCard) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._amount { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + try { if let v = self._creditCard { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_ChargeRequest, rhs: Oteldemo_ChargeRequest) -> Bool { + if lhs._amount != rhs._amount {return false} + if lhs._creditCard != rhs._creditCard {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_ChargeResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ChargeResponse" + static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}transaction_id\0") + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self.transactionID) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.transactionID.isEmpty { + try visitor.visitSingularStringField(value: self.transactionID, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_ChargeResponse, rhs: Oteldemo_ChargeResponse) -> Bool { + if lhs.transactionID != rhs.transactionID {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_OrderItem: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".OrderItem" + static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}item\0\u{1}cost\0") + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularMessageField(value: &self._item) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._cost) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._item { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + try { if let v = self._cost { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_OrderItem, rhs: Oteldemo_OrderItem) -> Bool { + if lhs._item != rhs._item {return false} + if lhs._cost != rhs._cost {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_OrderResult: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".OrderResult" + static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}order_id\0\u{3}shipping_tracking_id\0\u{3}shipping_cost\0\u{3}shipping_address\0\u{1}items\0") + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self.orderID) }() + case 2: try { try decoder.decodeSingularStringField(value: &self.shippingTrackingID) }() + case 3: try { try decoder.decodeSingularMessageField(value: &self._shippingCost) }() + case 4: try { try decoder.decodeSingularMessageField(value: &self._shippingAddress) }() + case 5: try { try decoder.decodeRepeatedMessageField(value: &self.items) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + if !self.orderID.isEmpty { + try visitor.visitSingularStringField(value: self.orderID, fieldNumber: 1) + } + if !self.shippingTrackingID.isEmpty { + try visitor.visitSingularStringField(value: self.shippingTrackingID, fieldNumber: 2) + } + try { if let v = self._shippingCost { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } }() + try { if let v = self._shippingAddress { + try visitor.visitSingularMessageField(value: v, fieldNumber: 4) + } }() + if !self.items.isEmpty { + try visitor.visitRepeatedMessageField(value: self.items, fieldNumber: 5) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_OrderResult, rhs: Oteldemo_OrderResult) -> Bool { + if lhs.orderID != rhs.orderID {return false} + if lhs.shippingTrackingID != rhs.shippingTrackingID {return false} + if lhs._shippingCost != rhs._shippingCost {return false} + if lhs._shippingAddress != rhs._shippingAddress {return false} + if lhs.items != rhs.items {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_SendOrderConfirmationRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SendOrderConfirmationRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}email\0\u{1}order\0") + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self.email) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._order) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + if !self.email.isEmpty { + try visitor.visitSingularStringField(value: self.email, fieldNumber: 1) + } + try { if let v = self._order { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_SendOrderConfirmationRequest, rhs: Oteldemo_SendOrderConfirmationRequest) -> Bool { + if lhs.email != rhs.email {return false} + if lhs._order != rhs._order {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_PlaceOrderRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".PlaceOrderRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}user_id\0\u{3}user_currency\0\u{1}address\0\u{2}\u{2}email\0\u{3}credit_card\0") + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self.userID) }() + case 2: try { try decoder.decodeSingularStringField(value: &self.userCurrency) }() + case 3: try { try decoder.decodeSingularMessageField(value: &self._address) }() + case 5: try { try decoder.decodeSingularStringField(value: &self.email) }() + case 6: try { try decoder.decodeSingularMessageField(value: &self._creditCard) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + if !self.userID.isEmpty { + try visitor.visitSingularStringField(value: self.userID, fieldNumber: 1) + } + if !self.userCurrency.isEmpty { + try visitor.visitSingularStringField(value: self.userCurrency, fieldNumber: 2) + } + try { if let v = self._address { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } }() + if !self.email.isEmpty { + try visitor.visitSingularStringField(value: self.email, fieldNumber: 5) + } + try { if let v = self._creditCard { + try visitor.visitSingularMessageField(value: v, fieldNumber: 6) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_PlaceOrderRequest, rhs: Oteldemo_PlaceOrderRequest) -> Bool { + if lhs.userID != rhs.userID {return false} + if lhs.userCurrency != rhs.userCurrency {return false} + if lhs._address != rhs._address {return false} + if lhs.email != rhs.email {return false} + if lhs._creditCard != rhs._creditCard {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_PlaceOrderResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".PlaceOrderResponse" + static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}order\0") + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularMessageField(value: &self._order) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._order { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_PlaceOrderResponse, rhs: Oteldemo_PlaceOrderResponse) -> Bool { + if lhs._order != rhs._order {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_AdRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".AdRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}context_keys\0") + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeRepeatedStringField(value: &self.contextKeys) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.contextKeys.isEmpty { + try visitor.visitRepeatedStringField(value: self.contextKeys, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_AdRequest, rhs: Oteldemo_AdRequest) -> Bool { + if lhs.contextKeys != rhs.contextKeys {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_AdResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".AdResponse" + static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}ads\0") + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeRepeatedMessageField(value: &self.ads) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.ads.isEmpty { + try visitor.visitRepeatedMessageField(value: self.ads, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_AdResponse, rhs: Oteldemo_AdResponse) -> Bool { + if lhs.ads != rhs.ads {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_Ad: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Ad" + static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}redirect_url\0\u{1}text\0") + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self.redirectURL) }() + case 2: try { try decoder.decodeSingularStringField(value: &self.text) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.redirectURL.isEmpty { + try visitor.visitSingularStringField(value: self.redirectURL, fieldNumber: 1) + } + if !self.text.isEmpty { + try visitor.visitSingularStringField(value: self.text, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_Ad, rhs: Oteldemo_Ad) -> Bool { + if lhs.redirectURL != rhs.redirectURL {return false} + if lhs.text != rhs.text {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_Flag: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Flag" + static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}name\0\u{1}description\0\u{1}enabled\0") + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self.name) }() + case 2: try { try decoder.decodeSingularStringField(value: &self.description_p) }() + case 3: try { try decoder.decodeSingularBoolField(value: &self.enabled) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.name.isEmpty { + try visitor.visitSingularStringField(value: self.name, fieldNumber: 1) + } + if !self.description_p.isEmpty { + try visitor.visitSingularStringField(value: self.description_p, fieldNumber: 2) + } + if self.enabled != false { + try visitor.visitSingularBoolField(value: self.enabled, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_Flag, rhs: Oteldemo_Flag) -> Bool { + if lhs.name != rhs.name {return false} + if lhs.description_p != rhs.description_p {return false} + if lhs.enabled != rhs.enabled {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_GetFlagRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".GetFlagRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}name\0") + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self.name) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.name.isEmpty { + try visitor.visitSingularStringField(value: self.name, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_GetFlagRequest, rhs: Oteldemo_GetFlagRequest) -> Bool { + if lhs.name != rhs.name {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_GetFlagResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".GetFlagResponse" + static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}flag\0") + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularMessageField(value: &self._flag) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._flag { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_GetFlagResponse, rhs: Oteldemo_GetFlagResponse) -> Bool { + if lhs._flag != rhs._flag {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_CreateFlagRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".CreateFlagRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}name\0\u{1}description\0\u{1}enabled\0") + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self.name) }() + case 2: try { try decoder.decodeSingularStringField(value: &self.description_p) }() + case 3: try { try decoder.decodeSingularBoolField(value: &self.enabled) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.name.isEmpty { + try visitor.visitSingularStringField(value: self.name, fieldNumber: 1) + } + if !self.description_p.isEmpty { + try visitor.visitSingularStringField(value: self.description_p, fieldNumber: 2) + } + if self.enabled != false { + try visitor.visitSingularBoolField(value: self.enabled, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_CreateFlagRequest, rhs: Oteldemo_CreateFlagRequest) -> Bool { + if lhs.name != rhs.name {return false} + if lhs.description_p != rhs.description_p {return false} + if lhs.enabled != rhs.enabled {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_CreateFlagResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".CreateFlagResponse" + static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}flag\0") + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularMessageField(value: &self._flag) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._flag { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_CreateFlagResponse, rhs: Oteldemo_CreateFlagResponse) -> Bool { + if lhs._flag != rhs._flag {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_UpdateFlagRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".UpdateFlagRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}name\0\u{1}enabled\0") + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self.name) }() + case 2: try { try decoder.decodeSingularBoolField(value: &self.enabled) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.name.isEmpty { + try visitor.visitSingularStringField(value: self.name, fieldNumber: 1) + } + if self.enabled != false { + try visitor.visitSingularBoolField(value: self.enabled, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_UpdateFlagRequest, rhs: Oteldemo_UpdateFlagRequest) -> Bool { + if lhs.name != rhs.name {return false} + if lhs.enabled != rhs.enabled {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_UpdateFlagResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".UpdateFlagResponse" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + // Load everything into unknown fields + while try decoder.nextFieldNumber() != nil {} + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_UpdateFlagResponse, rhs: Oteldemo_UpdateFlagResponse) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_ListFlagsRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ListFlagsRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + // Load everything into unknown fields + while try decoder.nextFieldNumber() != nil {} + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_ListFlagsRequest, rhs: Oteldemo_ListFlagsRequest) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_ListFlagsResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ListFlagsResponse" + static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}flag\0") + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeRepeatedMessageField(value: &self.flag) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.flag.isEmpty { + try visitor.visitRepeatedMessageField(value: self.flag, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_ListFlagsResponse, rhs: Oteldemo_ListFlagsResponse) -> Bool { + if lhs.flag != rhs.flag {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_DeleteFlagRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".DeleteFlagRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}name\0") + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self.name) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.name.isEmpty { + try visitor.visitSingularStringField(value: self.name, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_DeleteFlagRequest, rhs: Oteldemo_DeleteFlagRequest) -> Bool { + if lhs.name != rhs.name {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Oteldemo_DeleteFlagResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".DeleteFlagResponse" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + // Load everything into unknown fields + while try decoder.nextFieldNumber() != nil {} + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Oteldemo_DeleteFlagResponse, rhs: Oteldemo_DeleteFlagResponse) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/src/cart/cart.sln b/src/cart/cart.sln deleted file mode 100644 index 6fedf6359f..0000000000 --- a/src/cart/cart.sln +++ /dev/null @@ -1,48 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26124.0 -MinimumVisualStudioVersion = 15.0.26124.0 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cart", "src\cart.csproj", "{2348C29F-E8D3-4955-916D-D609CBC97FCB}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cart.tests", "tests\cart.tests.csproj", "{59825342-CE64-4AFA-8744-781692C0811B}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {2348C29F-E8D3-4955-916D-D609CBC97FCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2348C29F-E8D3-4955-916D-D609CBC97FCB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2348C29F-E8D3-4955-916D-D609CBC97FCB}.Debug|x64.ActiveCfg = Debug|Any CPU - {2348C29F-E8D3-4955-916D-D609CBC97FCB}.Debug|x64.Build.0 = Debug|Any CPU - {2348C29F-E8D3-4955-916D-D609CBC97FCB}.Debug|x86.ActiveCfg = Debug|Any CPU - {2348C29F-E8D3-4955-916D-D609CBC97FCB}.Debug|x86.Build.0 = Debug|Any CPU - {2348C29F-E8D3-4955-916D-D609CBC97FCB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2348C29F-E8D3-4955-916D-D609CBC97FCB}.Release|Any CPU.Build.0 = Release|Any CPU - {2348C29F-E8D3-4955-916D-D609CBC97FCB}.Release|x64.ActiveCfg = Release|Any CPU - {2348C29F-E8D3-4955-916D-D609CBC97FCB}.Release|x64.Build.0 = Release|Any CPU - {2348C29F-E8D3-4955-916D-D609CBC97FCB}.Release|x86.ActiveCfg = Release|Any CPU - {2348C29F-E8D3-4955-916D-D609CBC97FCB}.Release|x86.Build.0 = Release|Any CPU - {59825342-CE64-4AFA-8744-781692C0811B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {59825342-CE64-4AFA-8744-781692C0811B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {59825342-CE64-4AFA-8744-781692C0811B}.Debug|x64.ActiveCfg = Debug|Any CPU - {59825342-CE64-4AFA-8744-781692C0811B}.Debug|x64.Build.0 = Debug|Any CPU - {59825342-CE64-4AFA-8744-781692C0811B}.Debug|x86.ActiveCfg = Debug|Any CPU - {59825342-CE64-4AFA-8744-781692C0811B}.Debug|x86.Build.0 = Debug|Any CPU - {59825342-CE64-4AFA-8744-781692C0811B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {59825342-CE64-4AFA-8744-781692C0811B}.Release|Any CPU.Build.0 = Release|Any CPU - {59825342-CE64-4AFA-8744-781692C0811B}.Release|x64.ActiveCfg = Release|Any CPU - {59825342-CE64-4AFA-8744-781692C0811B}.Release|x64.Build.0 = Release|Any CPU - {59825342-CE64-4AFA-8744-781692C0811B}.Release|x86.ActiveCfg = Release|Any CPU - {59825342-CE64-4AFA-8744-781692C0811B}.Release|x86.Build.0 = Release|Any CPU - EndGlobalSection -EndGlobal diff --git a/src/cart/genproto/Dockerfile b/src/cart/genproto/Dockerfile new file mode 100644 index 0000000000..35a92e3c90 --- /dev/null +++ b/src/cart/genproto/Dockerfile @@ -0,0 +1,18 @@ +FROM swift:6.1 + +WORKDIR /app + +RUN apt-get update && \ + apt-get install -y protobuf-compiler + +COPY ./pb/ /build/pb/ + +COPY ./src/cart/Package.swift Package.swift +COPY ./src/cart/Package.resolved Package.resolved + +RUN swift package resolve + +COPY ./src/cart . + +RUN swift build --product protoc-gen-swift +RUN swift build --product protoc-gen-grpc-swift-2 diff --git a/src/cart/src/.dockerignore b/src/cart/src/.dockerignore deleted file mode 100644 index 0224086eb2..0000000000 --- a/src/cart/src/.dockerignore +++ /dev/null @@ -1,6 +0,0 @@ -**/*.sh -**/*.bat -**/bin/ -**/obj/ -**/out/ -Dockerfile* \ No newline at end of file diff --git a/src/cart/src/Dockerfile b/src/cart/src/Dockerfile deleted file mode 100644 index 9e4df98450..0000000000 --- a/src/cart/src/Dockerfile +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright The OpenTelemetry Authors -# SPDX-License-Identifier: Apache-2.0 -# Copyright 2021 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# https://mcr.microsoft.com/v2/dotnet/sdk/tags/list -FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS builder -ARG TARGETARCH - -WORKDIR /usr/src/app/ - -COPY ./src/cart/ ./ -COPY ./pb/ ./pb/ - -RUN dotnet restore ./src/cart.csproj -r linux-musl-$TARGETARCH - -RUN dotnet publish ./src/cart.csproj -r linux-musl-$TARGETARCH --no-restore -o /cart - -# ----------------------------------------------------------------------------- - -# https://mcr.microsoft.com/v2/dotnet/runtime-deps/tags/list -FROM mcr.microsoft.com/dotnet/runtime-deps:8.0-alpine3.20 - -WORKDIR /usr/src/app/ -COPY --from=builder /cart/ ./ - -ENV DOTNET_HOSTBUILDER__RELOADCONFIGONCHANGE=false - -EXPOSE ${CART_PORT} -ENTRYPOINT [ "./cart" ] diff --git a/src/cart/src/Program.cs b/src/cart/src/Program.cs deleted file mode 100644 index 588bcb28f5..0000000000 --- a/src/cart/src/Program.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 -using System; - -using cart.cartstore; -using cart.services; - -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Http; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Diagnostics.HealthChecks; -using Microsoft.Extensions.Logging; -using OpenTelemetry.Instrumentation.StackExchangeRedis; -using OpenTelemetry.Logs; -using OpenTelemetry.Metrics; -using OpenTelemetry.Resources; -using OpenTelemetry.Trace; -using OpenFeature; -using OpenFeature.Contrib.Providers.Flagd; -using OpenFeature.Hooks; - -var builder = WebApplication.CreateBuilder(args); -string valkeyAddress = builder.Configuration["VALKEY_ADDR"]; -if (string.IsNullOrEmpty(valkeyAddress)) -{ - Console.WriteLine("VALKEY_ADDR environment variable is required."); - Environment.Exit(1); -} - -builder.Logging - .AddOpenTelemetry(options => options.AddOtlpExporter()) - .AddConsole(); - -builder.Services.AddSingleton(x => -{ - var store = new ValkeyCartStore(x.GetRequiredService>(), valkeyAddress); - store.Initialize(); - return store; -}); - -builder.Services.AddOpenFeature(openFeatureBuilder => -{ - openFeatureBuilder - .AddHostedFeatureLifecycle() - .AddProvider(_ => new FlagdProvider()) - .AddHook() - .AddHook(); -}); - -builder.Services.AddSingleton(x => - new CartService( - x.GetRequiredService(), - new ValkeyCartStore(x.GetRequiredService>(), "badhost:1234"), - x.GetRequiredService() -)); - - -Action appResourceBuilder = - resource => resource - .AddService(builder.Environment.ApplicationName) - .AddContainerDetector() - .AddHostDetector(); - -builder.Services.AddOpenTelemetry() - .ConfigureResource(appResourceBuilder) - .WithTracing(tracerBuilder => tracerBuilder - .AddSource("OpenTelemetry.Demo.Cart") - .AddRedisInstrumentation( - options => options.SetVerboseDatabaseStatements = true) - .AddAspNetCoreInstrumentation() - .AddGrpcClientInstrumentation() - .AddHttpClientInstrumentation() - .AddOtlpExporter()) - .WithMetrics(meterBuilder => meterBuilder - .AddMeter("OpenTelemetry.Demo.Cart") - .AddMeter("OpenFeature") - .AddProcessInstrumentation() - .AddRuntimeInstrumentation() - .AddAspNetCoreInstrumentation() - .SetExemplarFilter(ExemplarFilterType.TraceBased) - .AddOtlpExporter()); -builder.Services.AddGrpc(); -builder.Services.AddGrpcHealthChecks() - .AddCheck("Sample", () => HealthCheckResult.Healthy()); - -var app = builder.Build(); - -var ValkeyCartStore = (ValkeyCartStore)app.Services.GetRequiredService(); -app.Services.GetRequiredService().AddConnection(ValkeyCartStore.GetConnection()); - -app.MapGrpcService(); -app.MapGrpcHealthChecksService(); - -app.MapGet("/", async context => -{ - await context.Response.WriteAsync("Communication with gRPC endpoints must be made through a gRPC client. To learn how to create a client, visit: https://go.microsoft.com/fwlink/?linkid=2086909"); -}); - -app.Run(); diff --git a/src/cart/src/appsettings.json b/src/cart/src/appsettings.json deleted file mode 100644 index db76fce393..0000000000 --- a/src/cart/src/appsettings.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" - } - }, - "AllowedHosts": "*", - "Kestrel": { - "EndpointDefaults": { - "Protocols": "Http2" - } - } -} \ No newline at end of file diff --git a/src/cart/src/cart.csproj b/src/cart/src/cart.csproj deleted file mode 100644 index 4092cc1f05..0000000000 --- a/src/cart/src/cart.csproj +++ /dev/null @@ -1,41 +0,0 @@ - - - - net8.0 - false - false - true - true - false - $(ProjectDir)..\pb - - - - ..\..\..\pb - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/cart/src/cartstore/ICartStore.cs b/src/cart/src/cartstore/ICartStore.cs deleted file mode 100644 index 80e249e5d6..0000000000 --- a/src/cart/src/cartstore/ICartStore.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 -using System.Threading.Tasks; - -namespace cart.cartstore; - -public interface ICartStore -{ - void Initialize(); - - Task AddItemAsync(string userId, string productId, int quantity); - Task EmptyCartAsync(string userId); - - Task GetCartAsync(string userId); - - bool Ping(); -} diff --git a/src/cart/src/cartstore/ValkeyCartStore.cs b/src/cart/src/cartstore/ValkeyCartStore.cs deleted file mode 100644 index 8b230baaa4..0000000000 --- a/src/cart/src/cartstore/ValkeyCartStore.cs +++ /dev/null @@ -1,238 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 -using System; -using System.Linq; -using System.Threading.Tasks; -using Grpc.Core; -using StackExchange.Redis; -using Google.Protobuf; -using Microsoft.Extensions.Logging; -using System.Diagnostics.Metrics; -using System.Diagnostics; - -namespace cart.cartstore; - -public class ValkeyCartStore : ICartStore -{ - private readonly ILogger _logger; - private const string CartFieldName = "cart"; - private const int RedisRetryNumber = 30; - - private volatile ConnectionMultiplexer _redis; - private volatile bool _isRedisConnectionOpened; - - private readonly object _locker = new(); - private readonly byte[] _emptyCartBytes; - private readonly string _connectionString; - - private static readonly ActivitySource CartActivitySource = new("OpenTelemetry.Demo.Cart"); - private static readonly Meter CartMeter = new Meter("OpenTelemetry.Demo.Cart"); - private static readonly Histogram addItemHistogram = CartMeter.CreateHistogram( - "app.cart.add_item.latency", - unit: "s", - advice: new InstrumentAdvice - { - HistogramBucketBoundaries = [ 0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10 ] - }); - private static readonly Histogram getCartHistogram = CartMeter.CreateHistogram( - "app.cart.get_cart.latency", - unit: "s", - advice: new InstrumentAdvice - { - HistogramBucketBoundaries = [ 0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10 ] - }); - private readonly ConfigurationOptions _redisConnectionOptions; - - public ValkeyCartStore(ILogger logger, string valkeyAddress) - { - _logger = logger; - // Serialize empty cart into byte array. - var cart = new Oteldemo.Cart(); - _emptyCartBytes = cart.ToByteArray(); - _connectionString = $"{valkeyAddress},ssl=false,allowAdmin=true,abortConnect=false"; - - _redisConnectionOptions = ConfigurationOptions.Parse(_connectionString); - - // Try to reconnect multiple times if the first retry fails. - _redisConnectionOptions.ConnectRetry = RedisRetryNumber; - _redisConnectionOptions.ReconnectRetryPolicy = new ExponentialRetry(1000); - - _redisConnectionOptions.KeepAlive = 180; - } - - public ConnectionMultiplexer GetConnection() - { - EnsureRedisConnected(); - return _redis; - } - - public void Initialize() - { - EnsureRedisConnected(); - } - - private void EnsureRedisConnected() - { - if (_isRedisConnectionOpened) - { - return; - } - - // Connection is closed or failed - open a new one but only at the first thread - lock (_locker) - { - if (_isRedisConnectionOpened) - { - return; - } - - _logger.LogDebug("Connecting to Redis: {_connectionString}", _connectionString); - _redis = ConnectionMultiplexer.Connect(_redisConnectionOptions); - - if (_redis == null || !_redis.IsConnected) - { - _logger.LogError("Wasn't able to connect to redis"); - - // We weren't able to connect to Redis despite some retries with exponential backoff. - throw new ApplicationException("Wasn't able to connect to redis"); - } - - _logger.LogInformation("Successfully connected to Redis"); - var cache = _redis.GetDatabase(); - - _logger.LogDebug("Performing small test"); - cache.StringSet("cart", "OK" ); - object res = cache.StringGet("cart"); - _logger.LogDebug("Small test result: {res}", res); - - _redis.InternalError += (_, e) => { Console.WriteLine(e.Exception); }; - _redis.ConnectionRestored += (_, _) => - { - _isRedisConnectionOpened = true; - _logger.LogInformation("Connection to redis was restored successfully."); - }; - _redis.ConnectionFailed += (_, _) => - { - _logger.LogInformation("Connection failed. Disposing the object"); - _isRedisConnectionOpened = false; - }; - - _isRedisConnectionOpened = true; - } - } - - public async Task AddItemAsync(string userId, string productId, int quantity) - { - var stopwatch = Stopwatch.StartNew(); - _logger.LogInformation($"AddItemAsync called with userId={userId}, productId={productId}, quantity={quantity}"); - - try - { - EnsureRedisConnected(); - - var db = _redis.GetDatabase(); - - // Access the cart from the cache - var value = await db.HashGetAsync(userId, CartFieldName); - - Oteldemo.Cart cart; - if (value.IsNull) - { - cart = new Oteldemo.Cart - { - UserId = userId - }; - cart.Items.Add(new Oteldemo.CartItem { ProductId = productId, Quantity = quantity }); - } - else - { - cart = Oteldemo.Cart.Parser.ParseFrom(value); - var existingItem = cart.Items.SingleOrDefault(i => i.ProductId == productId); - if (existingItem == null) - { - cart.Items.Add(new Oteldemo.CartItem { ProductId = productId, Quantity = quantity }); - } - else - { - existingItem.Quantity += quantity; - } - } - - await db.HashSetAsync(userId, new[]{ new HashEntry(CartFieldName, cart.ToByteArray()) }); - await db.KeyExpireAsync(userId, TimeSpan.FromMinutes(60)); - } - catch (Exception ex) - { - throw new RpcException(new Status(StatusCode.FailedPrecondition, $"Can't access cart storage. {ex}")); - } - finally - { - addItemHistogram.Record(stopwatch.Elapsed.TotalSeconds); - } - } - - public async Task EmptyCartAsync(string userId) - { - _logger.LogInformation($"EmptyCartAsync called with userId={userId}"); - - try - { - EnsureRedisConnected(); - var db = _redis.GetDatabase(); - - // Update the cache with empty cart for given user - await db.HashSetAsync(userId, new[] { new HashEntry(CartFieldName, _emptyCartBytes) }); - await db.KeyExpireAsync(userId, TimeSpan.FromMinutes(60)); - } - catch (Exception ex) - { - throw new RpcException(new Status(StatusCode.FailedPrecondition, $"Can't access cart storage. {ex}")); - } - } - - public async Task GetCartAsync(string userId) - { - var stopwatch = Stopwatch.StartNew(); - _logger.LogInformation($"GetCartAsync called with userId={userId}"); - - try - { - EnsureRedisConnected(); - - var db = _redis.GetDatabase(); - - // Access the cart from the cache - var value = await db.HashGetAsync(userId, CartFieldName); - - if (!value.IsNull) - { - return Oteldemo.Cart.Parser.ParseFrom(value); - } - - // We decided to return empty cart in cases when user wasn't in the cache before - return new Oteldemo.Cart(); - } - catch (Exception ex) - { - throw new RpcException(new Status(StatusCode.FailedPrecondition, $"Can't access cart storage. {ex}")); - } - finally - { - getCartHistogram.Record(stopwatch.Elapsed.TotalSeconds); - } - } - - public bool Ping() - { - try - { - var cache = _redis.GetDatabase(); - var res = cache.Ping(); - return res != TimeSpan.Zero; - } - catch (Exception) - { - return false; - } - } -} diff --git a/src/cart/src/services/CartService.cs b/src/cart/src/services/CartService.cs deleted file mode 100644 index 5578f45fff..0000000000 --- a/src/cart/src/services/CartService.cs +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 -using System.Diagnostics; -using System.Threading.Tasks; -using System; -using Grpc.Core; -using cart.cartstore; -using OpenFeature; -using Oteldemo; - -namespace cart.services; - -public class CartService : Oteldemo.CartService.CartServiceBase -{ - private static readonly Empty Empty = new(); - private readonly Random random = new Random(); - private readonly ICartStore _badCartStore; - private readonly ICartStore _cartStore; - private readonly IFeatureClient _featureFlagHelper; - - public CartService(ICartStore cartStore, ICartStore badCartStore, IFeatureClient featureFlagService) - { - _badCartStore = badCartStore; - _cartStore = cartStore; - _featureFlagHelper = featureFlagService; - } - - public override async Task AddItem(AddItemRequest request, ServerCallContext context) - { - var activity = Activity.Current; - activity?.SetTag("app.user.id", request.UserId); - activity?.SetTag("app.product.id", request.Item.ProductId); - activity?.SetTag("app.product.quantity", request.Item.Quantity); - - try - { - await _cartStore.AddItemAsync(request.UserId, request.Item.ProductId, request.Item.Quantity); - - return Empty; - } - catch (RpcException ex) - { - activity?.AddException(ex); - activity?.SetStatus(ActivityStatusCode.Error, ex.Message); - throw; - } - } - - public override async Task GetCart(GetCartRequest request, ServerCallContext context) - { - var activity = Activity.Current; - activity?.SetTag("app.user.id", request.UserId); - activity?.AddEvent(new("Fetch cart")); - - try - { - var cart = await _cartStore.GetCartAsync(request.UserId); - var totalCart = 0; - foreach (var item in cart.Items) - { - totalCart += item.Quantity; - } - activity?.SetTag("app.cart.items.count", totalCart); - - return cart; - } - catch (RpcException ex) - { - activity?.AddException(ex); - activity?.SetStatus(ActivityStatusCode.Error, ex.Message); - throw; - } - } - - public override async Task EmptyCart(EmptyCartRequest request, ServerCallContext context) - { - var activity = Activity.Current; - activity?.SetTag("app.user.id", request.UserId); - activity?.AddEvent(new("Empty cart")); - - try - { - if (await _featureFlagHelper.GetBooleanValueAsync("cartFailure", false)) - { - await _badCartStore.EmptyCartAsync(request.UserId); - } - else - { - await _cartStore.EmptyCartAsync(request.UserId); - } - } - catch (RpcException ex) - { - Activity.Current?.AddException(ex); - Activity.Current?.SetStatus(ActivityStatusCode.Error, ex.Message); - throw; - } - - return Empty; - } -} diff --git a/src/cart/tests/CartServiceTests.cs b/src/cart/tests/CartServiceTests.cs deleted file mode 100644 index 45173d1432..0000000000 --- a/src/cart/tests/CartServiceTests.cs +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 -using System; -using System.Threading.Tasks; -using Grpc.Net.Client; -using Oteldemo; -using Microsoft.AspNetCore.TestHost; -using Microsoft.Extensions.Hosting; -using Xunit; -using static Oteldemo.CartService; - -namespace cart.tests; - -public class CartServiceTests -{ - private readonly IHostBuilder _host; - - public CartServiceTests() - { - _host = new HostBuilder().ConfigureWebHost(webBuilder => - { - webBuilder - // .UseStartup() - .UseTestServer(); - }); - } - - [Fact(Skip = "See https://github.com/open-telemetry/opentelemetry-demo/pull/746#discussion_r1107931240")] - public async Task GetItem_NoAddItemBefore_EmptyCartReturned() - { - // Setup test server and client - using var server = await _host.StartAsync(); - var httpClient = server.GetTestClient(); - - string userId = Guid.NewGuid().ToString(); - - // Create a GRPC communication channel between the client and the server - var channel = GrpcChannel.ForAddress(httpClient.BaseAddress, new GrpcChannelOptions - { - HttpClient = httpClient - }); - - var cartClient = new CartServiceClient(channel); - - var request = new GetCartRequest - { - UserId = userId, - }; - - var cart = await cartClient.GetCartAsync(request); - Assert.NotNull(cart); - - // All grpc objects implement IEquitable, so we can compare equality with by-value semantics - Assert.Equal(new Cart(), cart); - } - - [Fact(Skip = "See https://github.com/open-telemetry/opentelemetry-demo/pull/746#discussion_r1107931240")] - public async Task AddItem_ItemExists_Updated() - { - // Setup test server and client - using var server = await _host.StartAsync(); - var httpClient = server.GetTestClient(); - - string userId = Guid.NewGuid().ToString(); - - // Create a GRPC communication channel between the client and the server - var channel = GrpcChannel.ForAddress(httpClient.BaseAddress, new GrpcChannelOptions - { - HttpClient = httpClient - }); - - var client = new CartServiceClient(channel); - var request = new AddItemRequest - { - UserId = userId, - Item = new CartItem - { - ProductId = "1", - Quantity = 1 - } - }; - - // First add - nothing should fail - await client.AddItemAsync(request); - - // Second add of existing product - quantity should be updated - await client.AddItemAsync(request); - - var getCartRequest = new GetCartRequest - { - UserId = userId - }; - var cart = await client.GetCartAsync(getCartRequest); - Assert.NotNull(cart); - Assert.Equal(userId, cart.UserId); - Assert.Single(cart.Items); - Assert.Equal(2, cart.Items[0].Quantity); - - // Cleanup - await client.EmptyCartAsync(new EmptyCartRequest { UserId = userId }); - } - - [Fact(Skip = "See https://github.com/open-telemetry/opentelemetry-demo/pull/746#discussion_r1107931240")] - public async Task AddItem_New_Inserted() - { - // Setup test server and client - using var server = await _host.StartAsync(); - var httpClient = server.GetTestClient(); - - string userId = Guid.NewGuid().ToString(); - - // Create a GRPC communication channel between the client and the server - var channel = GrpcChannel.ForAddress(httpClient.BaseAddress, new GrpcChannelOptions - { - HttpClient = httpClient - }); - - // Create a proxy object to work with the server - var client = new CartServiceClient(channel); - - var request = new AddItemRequest - { - UserId = userId, - Item = new CartItem - { - ProductId = "1", - Quantity = 1 - } - }; - - await client.AddItemAsync(request); - - var getCartRequest = new GetCartRequest - { - UserId = userId - }; - var cart = await client.GetCartAsync(getCartRequest); - Assert.NotNull(cart); - Assert.Equal(userId, cart.UserId); - Assert.Single(cart.Items); - - await client.EmptyCartAsync(new EmptyCartRequest { UserId = userId }); - cart = await client.GetCartAsync(getCartRequest); - Assert.Empty(cart.Items); - } -} diff --git a/src/cart/tests/cart.tests.csproj b/src/cart/tests/cart.tests.csproj deleted file mode 100644 index 8c32df7aaa..0000000000 --- a/src/cart/tests/cart.tests.csproj +++ /dev/null @@ -1,21 +0,0 @@ - - - - net8.0 - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - diff --git a/src/flagd/demo.flagd.json b/src/flagd/demo.flagd.json index b4febb1570..9cea4373c3 100644 --- a/src/flagd/demo.flagd.json +++ b/src/flagd/demo.flagd.json @@ -56,7 +56,7 @@ "defaultVariant": "off" }, "cartFailure": { - "description": "Fail cart service", + "description": "Fail cart service by turning on the non-implemented experimental empty cart algorithm.", "state": "ENABLED", "variants": { "on": true, @@ -64,6 +64,15 @@ }, "defaultVariant": "off" }, + "cartExperimentalClearing": { + "description": "Fail cart service by turning on the non-implemented experimental empty cart algorithm.", + "state": "ENABLED", + "variants": { + "on": true, + "off": false + }, + "defaultVariant": "on" + }, "paymentFailure": { "description": "Fail payment service charge requests n%", "state": "ENABLED", @@ -107,4 +116,4 @@ "defaultVariant": "off" } } -} +} \ No newline at end of file diff --git a/src/grafana/grafana.ini b/src/grafana/grafana.ini index 0a653bde68..7daf1374a9 100644 --- a/src/grafana/grafana.ini +++ b/src/grafana/grafana.ini @@ -370,7 +370,7 @@ serve_from_sub_path = true ;password_hint = password # Default UI theme ("dark" or "light") -;default_theme = dark +default_theme = light # Path to a custom home page. Users are only redirected to this if the default home dashboard is used. It should match a frontend route and contain a leading slash. home_page = /grafana/dashboards/f/demo/?orgId=1 diff --git a/src/grafana/provisioning/dashboards/demo/apm-dashboard.json b/src/grafana/provisioning/dashboards/demo/apm-dashboard.json index 7ea2f080a9..4b6563642f 100644 --- a/src/grafana/provisioning/dashboards/demo/apm-dashboard.json +++ b/src/grafana/provisioning/dashboards/demo/apm-dashboard.json @@ -405,7 +405,7 @@ "hide": false, "instant": false, "interval": "60", - "legendFormat": "RPC errors", + "legendFormat": "{{ rpc_method }}", "range": true, "refId": "RPC Err" } @@ -1970,4 +1970,4 @@ "title": "APM Dashboard (Jaeger, Prometheus, OpenSearch)", "uid": "febljk0a32qyoa", "version": 1 -} \ No newline at end of file +}