From 82e140cea2e8a6c32650b25a0c9160e8755b2164 Mon Sep 17 00:00:00 2001 From: George Barnett Date: Tue, 1 Oct 2024 12:31:50 +0100 Subject: [PATCH] Fix naming Motivation: Some names were changed in https://github.com/grpc/grpc-swift/pull/2076 which we need to update here. Modifications: - Update names of request/response types - Regenerate code Result: Compiles --- .../Generated/health.grpc.swift | 80 ++-- Sources/GRPCHealthService/HealthService.swift | 14 +- .../ClientTracingInterceptor.swift | 10 +- .../ServerTracingInterceptor.swift | 8 +- .../Generated/empty_service.grpc.swift | 18 +- .../Generated/test.grpc.swift | 386 +++++++++--------- .../InteroperabilityTestCases.swift | 38 +- Sources/GRPCInteropTests/TestService.swift | 42 +- .../GRPCHealthServiceTests/HealthTests.swift | 22 +- .../TracingInterceptorTests.swift | 16 +- .../InProcessInteroperabilityTests.swift | 2 +- 11 files changed, 318 insertions(+), 318 deletions(-) diff --git a/Sources/GRPCHealthService/Generated/health.grpc.swift b/Sources/GRPCHealthService/Generated/health.grpc.swift index a2f625c..696532a 100644 --- a/Sources/GRPCHealthService/Generated/health.grpc.swift +++ b/Sources/GRPCHealthService/Generated/health.grpc.swift @@ -52,13 +52,13 @@ package enum Grpc_Health_V1_Health { ] } @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) - package typealias StreamingServiceProtocol = Grpc_Health_V1_HealthStreamingServiceProtocol + package typealias StreamingServiceProtocol = Grpc_Health_V1_Health_StreamingServiceProtocol @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) - package typealias ServiceProtocol = Grpc_Health_V1_HealthServiceProtocol + package typealias ServiceProtocol = Grpc_Health_V1_Health_ServiceProtocol @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) - package typealias ClientProtocol = Grpc_Health_V1_HealthClientProtocol + package typealias ClientProtocol = Grpc_Health_V1_Health_ClientProtocol @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) - package typealias Client = Grpc_Health_V1_HealthClient + package typealias Client = Grpc_Health_V1_Health_Client } extension GRPCCore.ServiceDescriptor { @@ -72,7 +72,7 @@ extension GRPCCore.ServiceDescriptor { /// RPCs. Its semantics are documented in /// https://github.com/grpc/grpc/blob/master/doc/health-checking.md. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) -package protocol Grpc_Health_V1_HealthStreamingServiceProtocol: GRPCCore.RegistrableRPCService { +package protocol Grpc_Health_V1_Health_StreamingServiceProtocol: GRPCCore.RegistrableRPCService { /// Check gets the health of the specified service. If the requested service /// is unknown, the call will fail with status NOT_FOUND. If the caller does /// not specify a service name, the server should respond with its overall @@ -83,9 +83,9 @@ package protocol Grpc_Health_V1_HealthStreamingServiceProtocol: GRPCCore.Registr /// /// Check implementations should be idempotent and side effect free. func check( - request: GRPCCore.ServerRequest.Stream, + request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext - ) async throws -> GRPCCore.ServerResponse.Stream + ) async throws -> GRPCCore.StreamingServerResponse /// Performs a watch for the serving status of the requested service. /// The server will immediately send back a message indicating the current @@ -103,9 +103,9 @@ package protocol Grpc_Health_V1_HealthStreamingServiceProtocol: GRPCCore.Registr /// call. If the call terminates with any other status (including OK), /// clients should retry the call with appropriate exponential backoff. func watch( - request: GRPCCore.ServerRequest.Stream, + request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext - ) async throws -> GRPCCore.ServerResponse.Stream + ) async throws -> GRPCCore.StreamingServerResponse } /// Conformance to `GRPCCore.RegistrableRPCService`. @@ -142,7 +142,7 @@ extension Grpc_Health_V1_Health.StreamingServiceProtocol { /// RPCs. Its semantics are documented in /// https://github.com/grpc/grpc/blob/master/doc/health-checking.md. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) -package protocol Grpc_Health_V1_HealthServiceProtocol: Grpc_Health_V1_Health.StreamingServiceProtocol { +package protocol Grpc_Health_V1_Health_ServiceProtocol: Grpc_Health_V1_Health.StreamingServiceProtocol { /// Check gets the health of the specified service. If the requested service /// is unknown, the call will fail with status NOT_FOUND. If the caller does /// not specify a service name, the server should respond with its overall @@ -153,9 +153,9 @@ package protocol Grpc_Health_V1_HealthServiceProtocol: Grpc_Health_V1_Health.Str /// /// Check implementations should be idempotent and side effect free. func check( - request: GRPCCore.ServerRequest.Single, + request: GRPCCore.ServerRequest, context: GRPCCore.ServerContext - ) async throws -> GRPCCore.ServerResponse.Single + ) async throws -> GRPCCore.ServerResponse /// Performs a watch for the serving status of the requested service. /// The server will immediately send back a message indicating the current @@ -173,31 +173,31 @@ package protocol Grpc_Health_V1_HealthServiceProtocol: Grpc_Health_V1_Health.Str /// call. If the call terminates with any other status (including OK), /// clients should retry the call with appropriate exponential backoff. func watch( - request: GRPCCore.ServerRequest.Single, + request: GRPCCore.ServerRequest, context: GRPCCore.ServerContext - ) async throws -> GRPCCore.ServerResponse.Stream + ) async throws -> GRPCCore.StreamingServerResponse } -/// Partial conformance to `Grpc_Health_V1_HealthStreamingServiceProtocol`. +/// Partial conformance to `Grpc_Health_V1_Health_StreamingServiceProtocol`. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) extension Grpc_Health_V1_Health.ServiceProtocol { package func check( - request: GRPCCore.ServerRequest.Stream, + request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext - ) async throws -> GRPCCore.ServerResponse.Stream { + ) async throws -> GRPCCore.StreamingServerResponse { let response = try await self.check( - request: GRPCCore.ServerRequest.Single(stream: request), + request: GRPCCore.ServerRequest(stream: request), context: context ) - return GRPCCore.ServerResponse.Stream(single: response) + return GRPCCore.StreamingServerResponse(single: response) } package func watch( - request: GRPCCore.ServerRequest.Stream, + request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext - ) async throws -> GRPCCore.ServerResponse.Stream { + ) async throws -> GRPCCore.StreamingServerResponse { let response = try await self.watch( - request: GRPCCore.ServerRequest.Single(stream: request), + request: GRPCCore.ServerRequest(stream: request), context: context ) return response @@ -208,7 +208,7 @@ extension Grpc_Health_V1_Health.ServiceProtocol { /// RPCs. Its semantics are documented in /// https://github.com/grpc/grpc/blob/master/doc/health-checking.md. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) -package protocol Grpc_Health_V1_HealthClientProtocol: Sendable { +package protocol Grpc_Health_V1_Health_ClientProtocol: Sendable { /// Check gets the health of the specified service. If the requested service /// is unknown, the call will fail with status NOT_FOUND. If the caller does /// not specify a service name, the server should respond with its overall @@ -219,11 +219,11 @@ package protocol Grpc_Health_V1_HealthClientProtocol: Sendable { /// /// Check implementations should be idempotent and side effect free. func check( - request: GRPCCore.ClientRequest.Single, + request: GRPCCore.ClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions, - _ body: @Sendable @escaping (GRPCCore.ClientResponse.Single) async throws -> R + _ body: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> R ) async throws -> R where R: Sendable /// Performs a watch for the serving status of the requested service. @@ -242,20 +242,20 @@ package protocol Grpc_Health_V1_HealthClientProtocol: Sendable { /// call. If the call terminates with any other status (including OK), /// clients should retry the call with appropriate exponential backoff. func watch( - request: GRPCCore.ClientRequest.Single, + request: GRPCCore.ClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions, - _ body: @Sendable @escaping (GRPCCore.ClientResponse.Stream) async throws -> R + _ body: @Sendable @escaping (GRPCCore.StreamingClientResponse) async throws -> R ) async throws -> R where R: Sendable } @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) extension Grpc_Health_V1_Health.ClientProtocol { package func check( - request: GRPCCore.ClientRequest.Single, + request: GRPCCore.ClientRequest, options: GRPCCore.CallOptions = .defaults, - _ body: @Sendable @escaping (GRPCCore.ClientResponse.Single) async throws -> R = { + _ body: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> R = { try $0.message } ) async throws -> R where R: Sendable { @@ -269,9 +269,9 @@ extension Grpc_Health_V1_Health.ClientProtocol { } package func watch( - request: GRPCCore.ClientRequest.Single, + request: GRPCCore.ClientRequest, options: GRPCCore.CallOptions = .defaults, - _ body: @Sendable @escaping (GRPCCore.ClientResponse.Stream) async throws -> R + _ body: @Sendable @escaping (GRPCCore.StreamingClientResponse) async throws -> R ) async throws -> R where R: Sendable { try await self.watch( request: request, @@ -298,11 +298,11 @@ extension Grpc_Health_V1_Health.ClientProtocol { _ message: Grpc_Health_V1_HealthCheckRequest, metadata: GRPCCore.Metadata = [:], options: GRPCCore.CallOptions = .defaults, - onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse.Single) async throws -> Result = { + onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> Result = { try $0.message } ) async throws -> Result where Result: Sendable { - let request = GRPCCore.ClientRequest.Single( + let request = GRPCCore.ClientRequest( message: message, metadata: metadata ) @@ -332,9 +332,9 @@ extension Grpc_Health_V1_Health.ClientProtocol { _ message: Grpc_Health_V1_HealthCheckRequest, metadata: GRPCCore.Metadata = [:], options: GRPCCore.CallOptions = .defaults, - onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse.Stream) async throws -> Result + onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse) async throws -> Result ) async throws -> Result where Result: Sendable { - let request = GRPCCore.ClientRequest.Single( + let request = GRPCCore.ClientRequest( message: message, metadata: metadata ) @@ -350,7 +350,7 @@ extension Grpc_Health_V1_Health.ClientProtocol { /// RPCs. Its semantics are documented in /// https://github.com/grpc/grpc/blob/master/doc/health-checking.md. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) -package struct Grpc_Health_V1_HealthClient: Grpc_Health_V1_Health.ClientProtocol { +package struct Grpc_Health_V1_Health_Client: Grpc_Health_V1_Health.ClientProtocol { private let client: GRPCCore.GRPCClient package init(wrapping client: GRPCCore.GRPCClient) { @@ -367,11 +367,11 @@ package struct Grpc_Health_V1_HealthClient: Grpc_Health_V1_Health.ClientProtocol /// /// Check implementations should be idempotent and side effect free. package func check( - request: GRPCCore.ClientRequest.Single, + request: GRPCCore.ClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions = .defaults, - _ body: @Sendable @escaping (GRPCCore.ClientResponse.Single) async throws -> R = { + _ body: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> R = { try $0.message } ) async throws -> R where R: Sendable { @@ -401,11 +401,11 @@ package struct Grpc_Health_V1_HealthClient: Grpc_Health_V1_Health.ClientProtocol /// call. If the call terminates with any other status (including OK), /// clients should retry the call with appropriate exponential backoff. package func watch( - request: GRPCCore.ClientRequest.Single, + request: GRPCCore.ClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions = .defaults, - _ body: @Sendable @escaping (GRPCCore.ClientResponse.Stream) async throws -> R + _ body: @Sendable @escaping (GRPCCore.StreamingClientResponse) async throws -> R ) async throws -> R where R: Sendable { try await self.client.serverStreaming( request: request, diff --git a/Sources/GRPCHealthService/HealthService.swift b/Sources/GRPCHealthService/HealthService.swift index 362e707..a512ddb 100644 --- a/Sources/GRPCHealthService/HealthService.swift +++ b/Sources/GRPCHealthService/HealthService.swift @@ -18,13 +18,13 @@ internal import GRPCCore private import Synchronization @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) -internal struct HealthService: Grpc_Health_V1_HealthServiceProtocol { +internal struct HealthService: Grpc_Health_V1_Health_ServiceProtocol { private let state = HealthService.State() func check( - request: ServerRequest.Single, + request: ServerRequest, context: ServerContext - ) async throws -> ServerResponse.Single { + ) async throws -> ServerResponse { let service = request.message.service guard let status = self.state.currentStatus(ofService: service) else { @@ -34,19 +34,19 @@ internal struct HealthService: Grpc_Health_V1_HealthServiceProtocol { var response = Grpc_Health_V1_HealthCheckResponse() response.status = status - return ServerResponse.Single(message: response) + return ServerResponse(message: response) } func watch( - request: ServerRequest.Single, + request: ServerRequest, context: ServerContext - ) async -> ServerResponse.Stream { + ) async -> StreamingServerResponse { let service = request.message.service let statuses = AsyncStream.makeStream(of: Grpc_Health_V1_HealthCheckResponse.ServingStatus.self) self.state.addContinuation(statuses.continuation, forService: service) - return ServerResponse.Stream(of: Grpc_Health_V1_HealthCheckResponse.self) { writer in + return StreamingServerResponse(of: Grpc_Health_V1_HealthCheckResponse.self) { writer in var response = Grpc_Health_V1_HealthCheckResponse() for await status in statuses.stream { diff --git a/Sources/GRPCInterceptors/ClientTracingInterceptor.swift b/Sources/GRPCInterceptors/ClientTracingInterceptor.swift index 9da8a1f..21da5c3 100644 --- a/Sources/GRPCInterceptors/ClientTracingInterceptor.swift +++ b/Sources/GRPCInterceptors/ClientTracingInterceptor.swift @@ -44,13 +44,13 @@ public struct ClientTracingInterceptor: ClientInterceptor { /// Which key-value pairs are injected will depend on the specific tracing implementation /// that has been configured when bootstrapping `swift-distributed-tracing` in your application. public func intercept( - request: ClientRequest.Stream, + request: StreamingClientRequest, context: ClientContext, next: ( - ClientRequest.Stream, + StreamingClientRequest, ClientContext - ) async throws -> ClientResponse.Stream - ) async throws -> ClientResponse.Stream where Input: Sendable, Output: Sendable { + ) async throws -> StreamingClientResponse + ) async throws -> StreamingClientResponse where Input: Sendable, Output: Sendable { var request = request let tracer = InstrumentationSystem.tracer let serviceContext = ServiceContext.current ?? .topLevel @@ -92,7 +92,7 @@ public struct ClientTracingInterceptor: ClientInterceptor { } } - var response: ClientResponse.Stream + var response: StreamingClientResponse do { response = try await next(request, context) } catch { diff --git a/Sources/GRPCInterceptors/ServerTracingInterceptor.swift b/Sources/GRPCInterceptors/ServerTracingInterceptor.swift index a2ebe45..34067f8 100644 --- a/Sources/GRPCInterceptors/ServerTracingInterceptor.swift +++ b/Sources/GRPCInterceptors/ServerTracingInterceptor.swift @@ -43,11 +43,11 @@ public struct ServerTracingInterceptor: ServerInterceptor { /// Which key-value pairs are extracted and made available will depend on the specific tracing implementation /// that has been configured when bootstrapping `swift-distributed-tracing` in your application. public func intercept( - request: ServerRequest.Stream, + request: StreamingServerRequest, context: ServerContext, - next: @Sendable (ServerRequest.Stream, ServerContext) async throws -> - ServerResponse.Stream - ) async throws -> ServerResponse.Stream where Input: Sendable, Output: Sendable { + next: @Sendable (StreamingServerRequest, ServerContext) async throws -> + StreamingServerResponse + ) async throws -> StreamingServerResponse where Input: Sendable, Output: Sendable { var serviceContext = ServiceContext.topLevel let tracer = InstrumentationSystem.tracer diff --git a/Sources/GRPCInteropTests/Generated/empty_service.grpc.swift b/Sources/GRPCInteropTests/Generated/empty_service.grpc.swift index ede7a37..89133fa 100644 --- a/Sources/GRPCInteropTests/Generated/empty_service.grpc.swift +++ b/Sources/GRPCInteropTests/Generated/empty_service.grpc.swift @@ -30,13 +30,13 @@ public enum Grpc_Testing_EmptyService { public static let descriptors: [GRPCCore.MethodDescriptor] = [] } @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) - public typealias StreamingServiceProtocol = Grpc_Testing_EmptyServiceStreamingServiceProtocol + public typealias StreamingServiceProtocol = Grpc_Testing_EmptyService_StreamingServiceProtocol @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) - public typealias ServiceProtocol = Grpc_Testing_EmptyServiceServiceProtocol + public typealias ServiceProtocol = Grpc_Testing_EmptyService_ServiceProtocol @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) - public typealias ClientProtocol = Grpc_Testing_EmptyServiceClientProtocol + public typealias ClientProtocol = Grpc_Testing_EmptyService_ClientProtocol @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) - public typealias Client = Grpc_Testing_EmptyServiceClient + public typealias Client = Grpc_Testing_EmptyService_Client } extension GRPCCore.ServiceDescriptor { @@ -49,7 +49,7 @@ extension GRPCCore.ServiceDescriptor { /// A service that has zero methods. /// See https://github.com/grpc/grpc/issues/15574 @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) -public protocol Grpc_Testing_EmptyServiceStreamingServiceProtocol: GRPCCore.RegistrableRPCService {} +public protocol Grpc_Testing_EmptyService_StreamingServiceProtocol: GRPCCore.RegistrableRPCService {} /// Conformance to `GRPCCore.RegistrableRPCService`. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) @@ -61,9 +61,9 @@ extension Grpc_Testing_EmptyService.StreamingServiceProtocol { /// A service that has zero methods. /// See https://github.com/grpc/grpc/issues/15574 @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) -public protocol Grpc_Testing_EmptyServiceServiceProtocol: Grpc_Testing_EmptyService.StreamingServiceProtocol {} +public protocol Grpc_Testing_EmptyService_ServiceProtocol: Grpc_Testing_EmptyService.StreamingServiceProtocol {} -/// Partial conformance to `Grpc_Testing_EmptyServiceStreamingServiceProtocol`. +/// Partial conformance to `Grpc_Testing_EmptyService_StreamingServiceProtocol`. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) extension Grpc_Testing_EmptyService.ServiceProtocol { } @@ -71,7 +71,7 @@ extension Grpc_Testing_EmptyService.ServiceProtocol { /// A service that has zero methods. /// See https://github.com/grpc/grpc/issues/15574 @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) -public protocol Grpc_Testing_EmptyServiceClientProtocol: Sendable {} +public protocol Grpc_Testing_EmptyService_ClientProtocol: Sendable {} @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) extension Grpc_Testing_EmptyService.ClientProtocol { @@ -84,7 +84,7 @@ extension Grpc_Testing_EmptyService.ClientProtocol { /// A service that has zero methods. /// See https://github.com/grpc/grpc/issues/15574 @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) -public struct Grpc_Testing_EmptyServiceClient: Grpc_Testing_EmptyService.ClientProtocol { +public struct Grpc_Testing_EmptyService_Client: Grpc_Testing_EmptyService.ClientProtocol { private let client: GRPCCore.GRPCClient public init(wrapping client: GRPCCore.GRPCClient) { diff --git a/Sources/GRPCInteropTests/Generated/test.grpc.swift b/Sources/GRPCInteropTests/Generated/test.grpc.swift index bbdbf3e..177b6be 100644 --- a/Sources/GRPCInteropTests/Generated/test.grpc.swift +++ b/Sources/GRPCInteropTests/Generated/test.grpc.swift @@ -52,13 +52,13 @@ public enum Grpc_Testing_ReconnectService { ] } @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) - public typealias StreamingServiceProtocol = Grpc_Testing_ReconnectServiceStreamingServiceProtocol + public typealias StreamingServiceProtocol = Grpc_Testing_ReconnectService_StreamingServiceProtocol @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) - public typealias ServiceProtocol = Grpc_Testing_ReconnectServiceServiceProtocol + public typealias ServiceProtocol = Grpc_Testing_ReconnectService_ServiceProtocol @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) - public typealias ClientProtocol = Grpc_Testing_ReconnectServiceClientProtocol + public typealias ClientProtocol = Grpc_Testing_ReconnectService_ClientProtocol @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) - public typealias Client = Grpc_Testing_ReconnectServiceClient + public typealias Client = Grpc_Testing_ReconnectService_Client } extension GRPCCore.ServiceDescriptor { @@ -147,13 +147,13 @@ public enum Grpc_Testing_TestService { ] } @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) - public typealias StreamingServiceProtocol = Grpc_Testing_TestServiceStreamingServiceProtocol + public typealias StreamingServiceProtocol = Grpc_Testing_TestService_StreamingServiceProtocol @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) - public typealias ServiceProtocol = Grpc_Testing_TestServiceServiceProtocol + public typealias ServiceProtocol = Grpc_Testing_TestService_ServiceProtocol @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) - public typealias ClientProtocol = Grpc_Testing_TestServiceClientProtocol + public typealias ClientProtocol = Grpc_Testing_TestService_ClientProtocol @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) - public typealias Client = Grpc_Testing_TestServiceClient + public typealias Client = Grpc_Testing_TestService_Client } extension GRPCCore.ServiceDescriptor { @@ -179,13 +179,13 @@ public enum Grpc_Testing_UnimplementedService { ] } @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) - public typealias StreamingServiceProtocol = Grpc_Testing_UnimplementedServiceStreamingServiceProtocol + public typealias StreamingServiceProtocol = Grpc_Testing_UnimplementedService_StreamingServiceProtocol @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) - public typealias ServiceProtocol = Grpc_Testing_UnimplementedServiceServiceProtocol + public typealias ServiceProtocol = Grpc_Testing_UnimplementedService_ServiceProtocol @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) - public typealias ClientProtocol = Grpc_Testing_UnimplementedServiceClientProtocol + public typealias ClientProtocol = Grpc_Testing_UnimplementedService_ClientProtocol @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) - public typealias Client = Grpc_Testing_UnimplementedServiceClient + public typealias Client = Grpc_Testing_UnimplementedService_Client } extension GRPCCore.ServiceDescriptor { @@ -198,64 +198,64 @@ extension GRPCCore.ServiceDescriptor { /// A simple service to test the various types of RPCs and experiment with /// performance with various types of payload. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) -public protocol Grpc_Testing_TestServiceStreamingServiceProtocol: GRPCCore.RegistrableRPCService { +public protocol Grpc_Testing_TestService_StreamingServiceProtocol: GRPCCore.RegistrableRPCService { /// One empty request followed by one empty response. func emptyCall( - request: GRPCCore.ServerRequest.Stream, + request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext - ) async throws -> GRPCCore.ServerResponse.Stream + ) async throws -> GRPCCore.StreamingServerResponse /// One request followed by one response. func unaryCall( - request: GRPCCore.ServerRequest.Stream, + request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext - ) async throws -> GRPCCore.ServerResponse.Stream + ) async throws -> GRPCCore.StreamingServerResponse /// One request followed by one response. Response has cache control /// headers set such that a caching HTTP proxy (such as GFE) can /// satisfy subsequent requests. func cacheableUnaryCall( - request: GRPCCore.ServerRequest.Stream, + request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext - ) async throws -> GRPCCore.ServerResponse.Stream + ) async throws -> GRPCCore.StreamingServerResponse /// One request followed by a sequence of responses (streamed download). /// The server returns the payload with client desired type and sizes. func streamingOutputCall( - request: GRPCCore.ServerRequest.Stream, + request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext - ) async throws -> GRPCCore.ServerResponse.Stream + ) async throws -> GRPCCore.StreamingServerResponse /// A sequence of requests followed by one response (streamed upload). /// The server returns the aggregated size of client payload as the result. func streamingInputCall( - request: GRPCCore.ServerRequest.Stream, + request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext - ) async throws -> GRPCCore.ServerResponse.Stream + ) async throws -> GRPCCore.StreamingServerResponse /// A sequence of requests with each request served by the server immediately. /// As one request could lead to multiple responses, this interface /// demonstrates the idea of full duplexing. func fullDuplexCall( - request: GRPCCore.ServerRequest.Stream, + request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext - ) async throws -> GRPCCore.ServerResponse.Stream + ) async throws -> GRPCCore.StreamingServerResponse /// A sequence of requests followed by a sequence of responses. /// The server buffers all the client requests and then serves them in order. A /// stream of responses are returned to the client when the server starts with /// first request. func halfDuplexCall( - request: GRPCCore.ServerRequest.Stream, + request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext - ) async throws -> GRPCCore.ServerResponse.Stream + ) async throws -> GRPCCore.StreamingServerResponse /// The test server will not implement this method. It will be used /// to test the behavior when clients call unimplemented methods. func unimplementedCall( - request: GRPCCore.ServerRequest.Stream, + request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext - ) async throws -> GRPCCore.ServerResponse.Stream + ) async throws -> GRPCCore.StreamingServerResponse } /// Conformance to `GRPCCore.RegistrableRPCService`. @@ -357,145 +357,145 @@ extension Grpc_Testing_TestService.StreamingServiceProtocol { /// A simple service to test the various types of RPCs and experiment with /// performance with various types of payload. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) -public protocol Grpc_Testing_TestServiceServiceProtocol: Grpc_Testing_TestService.StreamingServiceProtocol { +public protocol Grpc_Testing_TestService_ServiceProtocol: Grpc_Testing_TestService.StreamingServiceProtocol { /// One empty request followed by one empty response. func emptyCall( - request: GRPCCore.ServerRequest.Single, + request: GRPCCore.ServerRequest, context: GRPCCore.ServerContext - ) async throws -> GRPCCore.ServerResponse.Single + ) async throws -> GRPCCore.ServerResponse /// One request followed by one response. func unaryCall( - request: GRPCCore.ServerRequest.Single, + request: GRPCCore.ServerRequest, context: GRPCCore.ServerContext - ) async throws -> GRPCCore.ServerResponse.Single + ) async throws -> GRPCCore.ServerResponse /// One request followed by one response. Response has cache control /// headers set such that a caching HTTP proxy (such as GFE) can /// satisfy subsequent requests. func cacheableUnaryCall( - request: GRPCCore.ServerRequest.Single, + request: GRPCCore.ServerRequest, context: GRPCCore.ServerContext - ) async throws -> GRPCCore.ServerResponse.Single + ) async throws -> GRPCCore.ServerResponse /// One request followed by a sequence of responses (streamed download). /// The server returns the payload with client desired type and sizes. func streamingOutputCall( - request: GRPCCore.ServerRequest.Single, + request: GRPCCore.ServerRequest, context: GRPCCore.ServerContext - ) async throws -> GRPCCore.ServerResponse.Stream + ) async throws -> GRPCCore.StreamingServerResponse /// A sequence of requests followed by one response (streamed upload). /// The server returns the aggregated size of client payload as the result. func streamingInputCall( - request: GRPCCore.ServerRequest.Stream, + request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext - ) async throws -> GRPCCore.ServerResponse.Single + ) async throws -> GRPCCore.ServerResponse /// A sequence of requests with each request served by the server immediately. /// As one request could lead to multiple responses, this interface /// demonstrates the idea of full duplexing. func fullDuplexCall( - request: GRPCCore.ServerRequest.Stream, + request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext - ) async throws -> GRPCCore.ServerResponse.Stream + ) async throws -> GRPCCore.StreamingServerResponse /// A sequence of requests followed by a sequence of responses. /// The server buffers all the client requests and then serves them in order. A /// stream of responses are returned to the client when the server starts with /// first request. func halfDuplexCall( - request: GRPCCore.ServerRequest.Stream, + request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext - ) async throws -> GRPCCore.ServerResponse.Stream + ) async throws -> GRPCCore.StreamingServerResponse /// The test server will not implement this method. It will be used /// to test the behavior when clients call unimplemented methods. func unimplementedCall( - request: GRPCCore.ServerRequest.Single, + request: GRPCCore.ServerRequest, context: GRPCCore.ServerContext - ) async throws -> GRPCCore.ServerResponse.Single + ) async throws -> GRPCCore.ServerResponse } -/// Partial conformance to `Grpc_Testing_TestServiceStreamingServiceProtocol`. +/// Partial conformance to `Grpc_Testing_TestService_StreamingServiceProtocol`. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) extension Grpc_Testing_TestService.ServiceProtocol { public func emptyCall( - request: GRPCCore.ServerRequest.Stream, + request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext - ) async throws -> GRPCCore.ServerResponse.Stream { + ) async throws -> GRPCCore.StreamingServerResponse { let response = try await self.emptyCall( - request: GRPCCore.ServerRequest.Single(stream: request), + request: GRPCCore.ServerRequest(stream: request), context: context ) - return GRPCCore.ServerResponse.Stream(single: response) + return GRPCCore.StreamingServerResponse(single: response) } public func unaryCall( - request: GRPCCore.ServerRequest.Stream, + request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext - ) async throws -> GRPCCore.ServerResponse.Stream { + ) async throws -> GRPCCore.StreamingServerResponse { let response = try await self.unaryCall( - request: GRPCCore.ServerRequest.Single(stream: request), + request: GRPCCore.ServerRequest(stream: request), context: context ) - return GRPCCore.ServerResponse.Stream(single: response) + return GRPCCore.StreamingServerResponse(single: response) } public func cacheableUnaryCall( - request: GRPCCore.ServerRequest.Stream, + request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext - ) async throws -> GRPCCore.ServerResponse.Stream { + ) async throws -> GRPCCore.StreamingServerResponse { let response = try await self.cacheableUnaryCall( - request: GRPCCore.ServerRequest.Single(stream: request), + request: GRPCCore.ServerRequest(stream: request), context: context ) - return GRPCCore.ServerResponse.Stream(single: response) + return GRPCCore.StreamingServerResponse(single: response) } public func streamingOutputCall( - request: GRPCCore.ServerRequest.Stream, + request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext - ) async throws -> GRPCCore.ServerResponse.Stream { + ) async throws -> GRPCCore.StreamingServerResponse { let response = try await self.streamingOutputCall( - request: GRPCCore.ServerRequest.Single(stream: request), + request: GRPCCore.ServerRequest(stream: request), context: context ) return response } public func streamingInputCall( - request: GRPCCore.ServerRequest.Stream, + request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext - ) async throws -> GRPCCore.ServerResponse.Stream { + ) async throws -> GRPCCore.StreamingServerResponse { let response = try await self.streamingInputCall( request: request, context: context ) - return GRPCCore.ServerResponse.Stream(single: response) + return GRPCCore.StreamingServerResponse(single: response) } public func unimplementedCall( - request: GRPCCore.ServerRequest.Stream, + request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext - ) async throws -> GRPCCore.ServerResponse.Stream { + ) async throws -> GRPCCore.StreamingServerResponse { let response = try await self.unimplementedCall( - request: GRPCCore.ServerRequest.Single(stream: request), + request: GRPCCore.ServerRequest(stream: request), context: context ) - return GRPCCore.ServerResponse.Stream(single: response) + return GRPCCore.StreamingServerResponse(single: response) } } /// A simple service NOT implemented at servers so clients can test for /// that case. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) -public protocol Grpc_Testing_UnimplementedServiceStreamingServiceProtocol: GRPCCore.RegistrableRPCService { +public protocol Grpc_Testing_UnimplementedService_StreamingServiceProtocol: GRPCCore.RegistrableRPCService { /// A call that no server should implement func unimplementedCall( - request: GRPCCore.ServerRequest.Stream, + request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext - ) async throws -> GRPCCore.ServerResponse.Stream + ) async throws -> GRPCCore.StreamingServerResponse } /// Conformance to `GRPCCore.RegistrableRPCService`. @@ -520,41 +520,41 @@ extension Grpc_Testing_UnimplementedService.StreamingServiceProtocol { /// A simple service NOT implemented at servers so clients can test for /// that case. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) -public protocol Grpc_Testing_UnimplementedServiceServiceProtocol: Grpc_Testing_UnimplementedService.StreamingServiceProtocol { +public protocol Grpc_Testing_UnimplementedService_ServiceProtocol: Grpc_Testing_UnimplementedService.StreamingServiceProtocol { /// A call that no server should implement func unimplementedCall( - request: GRPCCore.ServerRequest.Single, + request: GRPCCore.ServerRequest, context: GRPCCore.ServerContext - ) async throws -> GRPCCore.ServerResponse.Single + ) async throws -> GRPCCore.ServerResponse } -/// Partial conformance to `Grpc_Testing_UnimplementedServiceStreamingServiceProtocol`. +/// Partial conformance to `Grpc_Testing_UnimplementedService_StreamingServiceProtocol`. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) extension Grpc_Testing_UnimplementedService.ServiceProtocol { public func unimplementedCall( - request: GRPCCore.ServerRequest.Stream, + request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext - ) async throws -> GRPCCore.ServerResponse.Stream { + ) async throws -> GRPCCore.StreamingServerResponse { let response = try await self.unimplementedCall( - request: GRPCCore.ServerRequest.Single(stream: request), + request: GRPCCore.ServerRequest(stream: request), context: context ) - return GRPCCore.ServerResponse.Stream(single: response) + return GRPCCore.StreamingServerResponse(single: response) } } /// A service used to control reconnect server. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) -public protocol Grpc_Testing_ReconnectServiceStreamingServiceProtocol: GRPCCore.RegistrableRPCService { +public protocol Grpc_Testing_ReconnectService_StreamingServiceProtocol: GRPCCore.RegistrableRPCService { func start( - request: GRPCCore.ServerRequest.Stream, + request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext - ) async throws -> GRPCCore.ServerResponse.Stream + ) async throws -> GRPCCore.StreamingServerResponse func stop( - request: GRPCCore.ServerRequest.Stream, + request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext - ) async throws -> GRPCCore.ServerResponse.Stream + ) async throws -> GRPCCore.StreamingServerResponse } /// Conformance to `GRPCCore.RegistrableRPCService`. @@ -589,106 +589,106 @@ extension Grpc_Testing_ReconnectService.StreamingServiceProtocol { /// A service used to control reconnect server. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) -public protocol Grpc_Testing_ReconnectServiceServiceProtocol: Grpc_Testing_ReconnectService.StreamingServiceProtocol { +public protocol Grpc_Testing_ReconnectService_ServiceProtocol: Grpc_Testing_ReconnectService.StreamingServiceProtocol { func start( - request: GRPCCore.ServerRequest.Single, + request: GRPCCore.ServerRequest, context: GRPCCore.ServerContext - ) async throws -> GRPCCore.ServerResponse.Single + ) async throws -> GRPCCore.ServerResponse func stop( - request: GRPCCore.ServerRequest.Single, + request: GRPCCore.ServerRequest, context: GRPCCore.ServerContext - ) async throws -> GRPCCore.ServerResponse.Single + ) async throws -> GRPCCore.ServerResponse } -/// Partial conformance to `Grpc_Testing_ReconnectServiceStreamingServiceProtocol`. +/// Partial conformance to `Grpc_Testing_ReconnectService_StreamingServiceProtocol`. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) extension Grpc_Testing_ReconnectService.ServiceProtocol { public func start( - request: GRPCCore.ServerRequest.Stream, + request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext - ) async throws -> GRPCCore.ServerResponse.Stream { + ) async throws -> GRPCCore.StreamingServerResponse { let response = try await self.start( - request: GRPCCore.ServerRequest.Single(stream: request), + request: GRPCCore.ServerRequest(stream: request), context: context ) - return GRPCCore.ServerResponse.Stream(single: response) + return GRPCCore.StreamingServerResponse(single: response) } public func stop( - request: GRPCCore.ServerRequest.Stream, + request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext - ) async throws -> GRPCCore.ServerResponse.Stream { + ) async throws -> GRPCCore.StreamingServerResponse { let response = try await self.stop( - request: GRPCCore.ServerRequest.Single(stream: request), + request: GRPCCore.ServerRequest(stream: request), context: context ) - return GRPCCore.ServerResponse.Stream(single: response) + return GRPCCore.StreamingServerResponse(single: response) } } /// A simple service to test the various types of RPCs and experiment with /// performance with various types of payload. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) -public protocol Grpc_Testing_TestServiceClientProtocol: Sendable { +public protocol Grpc_Testing_TestService_ClientProtocol: Sendable { /// One empty request followed by one empty response. func emptyCall( - request: GRPCCore.ClientRequest.Single, + request: GRPCCore.ClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions, - _ body: @Sendable @escaping (GRPCCore.ClientResponse.Single) async throws -> R + _ body: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> R ) async throws -> R where R: Sendable /// One request followed by one response. func unaryCall( - request: GRPCCore.ClientRequest.Single, + request: GRPCCore.ClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions, - _ body: @Sendable @escaping (GRPCCore.ClientResponse.Single) async throws -> R + _ body: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> R ) async throws -> R where R: Sendable /// One request followed by one response. Response has cache control /// headers set such that a caching HTTP proxy (such as GFE) can /// satisfy subsequent requests. func cacheableUnaryCall( - request: GRPCCore.ClientRequest.Single, + request: GRPCCore.ClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions, - _ body: @Sendable @escaping (GRPCCore.ClientResponse.Single) async throws -> R + _ body: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> R ) async throws -> R where R: Sendable /// One request followed by a sequence of responses (streamed download). /// The server returns the payload with client desired type and sizes. func streamingOutputCall( - request: GRPCCore.ClientRequest.Single, + request: GRPCCore.ClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions, - _ body: @Sendable @escaping (GRPCCore.ClientResponse.Stream) async throws -> R + _ body: @Sendable @escaping (GRPCCore.StreamingClientResponse) async throws -> R ) async throws -> R where R: Sendable /// A sequence of requests followed by one response (streamed upload). /// The server returns the aggregated size of client payload as the result. func streamingInputCall( - request: GRPCCore.ClientRequest.Stream, + request: GRPCCore.StreamingClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions, - _ body: @Sendable @escaping (GRPCCore.ClientResponse.Single) async throws -> R + _ body: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> R ) async throws -> R where R: Sendable /// A sequence of requests with each request served by the server immediately. /// As one request could lead to multiple responses, this interface /// demonstrates the idea of full duplexing. func fullDuplexCall( - request: GRPCCore.ClientRequest.Stream, + request: GRPCCore.StreamingClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions, - _ body: @Sendable @escaping (GRPCCore.ClientResponse.Stream) async throws -> R + _ body: @Sendable @escaping (GRPCCore.StreamingClientResponse) async throws -> R ) async throws -> R where R: Sendable /// A sequence of requests followed by a sequence of responses. @@ -696,30 +696,30 @@ public protocol Grpc_Testing_TestServiceClientProtocol: Sendable { /// stream of responses are returned to the client when the server starts with /// first request. func halfDuplexCall( - request: GRPCCore.ClientRequest.Stream, + request: GRPCCore.StreamingClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions, - _ body: @Sendable @escaping (GRPCCore.ClientResponse.Stream) async throws -> R + _ body: @Sendable @escaping (GRPCCore.StreamingClientResponse) async throws -> R ) async throws -> R where R: Sendable /// The test server will not implement this method. It will be used /// to test the behavior when clients call unimplemented methods. func unimplementedCall( - request: GRPCCore.ClientRequest.Single, + request: GRPCCore.ClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions, - _ body: @Sendable @escaping (GRPCCore.ClientResponse.Single) async throws -> R + _ body: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> R ) async throws -> R where R: Sendable } @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) extension Grpc_Testing_TestService.ClientProtocol { public func emptyCall( - request: GRPCCore.ClientRequest.Single, + request: GRPCCore.ClientRequest, options: GRPCCore.CallOptions = .defaults, - _ body: @Sendable @escaping (GRPCCore.ClientResponse.Single) async throws -> R = { + _ body: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> R = { try $0.message } ) async throws -> R where R: Sendable { @@ -733,9 +733,9 @@ extension Grpc_Testing_TestService.ClientProtocol { } public func unaryCall( - request: GRPCCore.ClientRequest.Single, + request: GRPCCore.ClientRequest, options: GRPCCore.CallOptions = .defaults, - _ body: @Sendable @escaping (GRPCCore.ClientResponse.Single) async throws -> R = { + _ body: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> R = { try $0.message } ) async throws -> R where R: Sendable { @@ -749,9 +749,9 @@ extension Grpc_Testing_TestService.ClientProtocol { } public func cacheableUnaryCall( - request: GRPCCore.ClientRequest.Single, + request: GRPCCore.ClientRequest, options: GRPCCore.CallOptions = .defaults, - _ body: @Sendable @escaping (GRPCCore.ClientResponse.Single) async throws -> R = { + _ body: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> R = { try $0.message } ) async throws -> R where R: Sendable { @@ -765,9 +765,9 @@ extension Grpc_Testing_TestService.ClientProtocol { } public func streamingOutputCall( - request: GRPCCore.ClientRequest.Single, + request: GRPCCore.ClientRequest, options: GRPCCore.CallOptions = .defaults, - _ body: @Sendable @escaping (GRPCCore.ClientResponse.Stream) async throws -> R + _ body: @Sendable @escaping (GRPCCore.StreamingClientResponse) async throws -> R ) async throws -> R where R: Sendable { try await self.streamingOutputCall( request: request, @@ -779,9 +779,9 @@ extension Grpc_Testing_TestService.ClientProtocol { } public func streamingInputCall( - request: GRPCCore.ClientRequest.Stream, + request: GRPCCore.StreamingClientRequest, options: GRPCCore.CallOptions = .defaults, - _ body: @Sendable @escaping (GRPCCore.ClientResponse.Single) async throws -> R = { + _ body: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> R = { try $0.message } ) async throws -> R where R: Sendable { @@ -795,9 +795,9 @@ extension Grpc_Testing_TestService.ClientProtocol { } public func fullDuplexCall( - request: GRPCCore.ClientRequest.Stream, + request: GRPCCore.StreamingClientRequest, options: GRPCCore.CallOptions = .defaults, - _ body: @Sendable @escaping (GRPCCore.ClientResponse.Stream) async throws -> R + _ body: @Sendable @escaping (GRPCCore.StreamingClientResponse) async throws -> R ) async throws -> R where R: Sendable { try await self.fullDuplexCall( request: request, @@ -809,9 +809,9 @@ extension Grpc_Testing_TestService.ClientProtocol { } public func halfDuplexCall( - request: GRPCCore.ClientRequest.Stream, + request: GRPCCore.StreamingClientRequest, options: GRPCCore.CallOptions = .defaults, - _ body: @Sendable @escaping (GRPCCore.ClientResponse.Stream) async throws -> R + _ body: @Sendable @escaping (GRPCCore.StreamingClientResponse) async throws -> R ) async throws -> R where R: Sendable { try await self.halfDuplexCall( request: request, @@ -823,9 +823,9 @@ extension Grpc_Testing_TestService.ClientProtocol { } public func unimplementedCall( - request: GRPCCore.ClientRequest.Single, + request: GRPCCore.ClientRequest, options: GRPCCore.CallOptions = .defaults, - _ body: @Sendable @escaping (GRPCCore.ClientResponse.Single) async throws -> R = { + _ body: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> R = { try $0.message } ) async throws -> R where R: Sendable { @@ -846,11 +846,11 @@ extension Grpc_Testing_TestService.ClientProtocol { _ message: Grpc_Testing_Empty, metadata: GRPCCore.Metadata = [:], options: GRPCCore.CallOptions = .defaults, - onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse.Single) async throws -> Result = { + onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> Result = { try $0.message } ) async throws -> Result where Result: Sendable { - let request = GRPCCore.ClientRequest.Single( + let request = GRPCCore.ClientRequest( message: message, metadata: metadata ) @@ -866,11 +866,11 @@ extension Grpc_Testing_TestService.ClientProtocol { _ message: Grpc_Testing_SimpleRequest, metadata: GRPCCore.Metadata = [:], options: GRPCCore.CallOptions = .defaults, - onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse.Single) async throws -> Result = { + onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> Result = { try $0.message } ) async throws -> Result where Result: Sendable { - let request = GRPCCore.ClientRequest.Single( + let request = GRPCCore.ClientRequest( message: message, metadata: metadata ) @@ -888,11 +888,11 @@ extension Grpc_Testing_TestService.ClientProtocol { _ message: Grpc_Testing_SimpleRequest, metadata: GRPCCore.Metadata = [:], options: GRPCCore.CallOptions = .defaults, - onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse.Single) async throws -> Result = { + onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> Result = { try $0.message } ) async throws -> Result where Result: Sendable { - let request = GRPCCore.ClientRequest.Single( + let request = GRPCCore.ClientRequest( message: message, metadata: metadata ) @@ -909,9 +909,9 @@ extension Grpc_Testing_TestService.ClientProtocol { _ message: Grpc_Testing_StreamingOutputCallRequest, metadata: GRPCCore.Metadata = [:], options: GRPCCore.CallOptions = .defaults, - onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse.Stream) async throws -> Result + onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse) async throws -> Result ) async throws -> Result where Result: Sendable { - let request = GRPCCore.ClientRequest.Single( + let request = GRPCCore.ClientRequest( message: message, metadata: metadata ) @@ -928,11 +928,11 @@ extension Grpc_Testing_TestService.ClientProtocol { metadata: GRPCCore.Metadata = [:], options: GRPCCore.CallOptions = .defaults, requestProducer: @Sendable @escaping (GRPCCore.RPCWriter) async throws -> Void, - onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse.Single) async throws -> Result = { + onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> Result = { try $0.message } ) async throws -> Result where Result: Sendable { - let request = GRPCCore.ClientRequest.Stream( + let request = GRPCCore.StreamingClientRequest( metadata: metadata, producer: requestProducer ) @@ -950,9 +950,9 @@ extension Grpc_Testing_TestService.ClientProtocol { metadata: GRPCCore.Metadata = [:], options: GRPCCore.CallOptions = .defaults, requestProducer: @Sendable @escaping (GRPCCore.RPCWriter) async throws -> Void, - onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse.Stream) async throws -> Result + onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse) async throws -> Result ) async throws -> Result where Result: Sendable { - let request = GRPCCore.ClientRequest.Stream( + let request = GRPCCore.StreamingClientRequest( metadata: metadata, producer: requestProducer ) @@ -971,9 +971,9 @@ extension Grpc_Testing_TestService.ClientProtocol { metadata: GRPCCore.Metadata = [:], options: GRPCCore.CallOptions = .defaults, requestProducer: @Sendable @escaping (GRPCCore.RPCWriter) async throws -> Void, - onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse.Stream) async throws -> Result + onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse) async throws -> Result ) async throws -> Result where Result: Sendable { - let request = GRPCCore.ClientRequest.Stream( + let request = GRPCCore.StreamingClientRequest( metadata: metadata, producer: requestProducer ) @@ -990,11 +990,11 @@ extension Grpc_Testing_TestService.ClientProtocol { _ message: Grpc_Testing_Empty, metadata: GRPCCore.Metadata = [:], options: GRPCCore.CallOptions = .defaults, - onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse.Single) async throws -> Result = { + onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> Result = { try $0.message } ) async throws -> Result where Result: Sendable { - let request = GRPCCore.ClientRequest.Single( + let request = GRPCCore.ClientRequest( message: message, metadata: metadata ) @@ -1009,7 +1009,7 @@ extension Grpc_Testing_TestService.ClientProtocol { /// A simple service to test the various types of RPCs and experiment with /// performance with various types of payload. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) -public struct Grpc_Testing_TestServiceClient: Grpc_Testing_TestService.ClientProtocol { +public struct Grpc_Testing_TestService_Client: Grpc_Testing_TestService.ClientProtocol { private let client: GRPCCore.GRPCClient public init(wrapping client: GRPCCore.GRPCClient) { @@ -1018,11 +1018,11 @@ public struct Grpc_Testing_TestServiceClient: Grpc_Testing_TestService.ClientPro /// One empty request followed by one empty response. public func emptyCall( - request: GRPCCore.ClientRequest.Single, + request: GRPCCore.ClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions = .defaults, - _ body: @Sendable @escaping (GRPCCore.ClientResponse.Single) async throws -> R = { + _ body: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> R = { try $0.message } ) async throws -> R where R: Sendable { @@ -1038,11 +1038,11 @@ public struct Grpc_Testing_TestServiceClient: Grpc_Testing_TestService.ClientPro /// One request followed by one response. public func unaryCall( - request: GRPCCore.ClientRequest.Single, + request: GRPCCore.ClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions = .defaults, - _ body: @Sendable @escaping (GRPCCore.ClientResponse.Single) async throws -> R = { + _ body: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> R = { try $0.message } ) async throws -> R where R: Sendable { @@ -1060,11 +1060,11 @@ public struct Grpc_Testing_TestServiceClient: Grpc_Testing_TestService.ClientPro /// headers set such that a caching HTTP proxy (such as GFE) can /// satisfy subsequent requests. public func cacheableUnaryCall( - request: GRPCCore.ClientRequest.Single, + request: GRPCCore.ClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions = .defaults, - _ body: @Sendable @escaping (GRPCCore.ClientResponse.Single) async throws -> R = { + _ body: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> R = { try $0.message } ) async throws -> R where R: Sendable { @@ -1081,11 +1081,11 @@ public struct Grpc_Testing_TestServiceClient: Grpc_Testing_TestService.ClientPro /// One request followed by a sequence of responses (streamed download). /// The server returns the payload with client desired type and sizes. public func streamingOutputCall( - request: GRPCCore.ClientRequest.Single, + request: GRPCCore.ClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions = .defaults, - _ body: @Sendable @escaping (GRPCCore.ClientResponse.Stream) async throws -> R + _ body: @Sendable @escaping (GRPCCore.StreamingClientResponse) async throws -> R ) async throws -> R where R: Sendable { try await self.client.serverStreaming( request: request, @@ -1100,11 +1100,11 @@ public struct Grpc_Testing_TestServiceClient: Grpc_Testing_TestService.ClientPro /// A sequence of requests followed by one response (streamed upload). /// The server returns the aggregated size of client payload as the result. public func streamingInputCall( - request: GRPCCore.ClientRequest.Stream, + request: GRPCCore.StreamingClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions = .defaults, - _ body: @Sendable @escaping (GRPCCore.ClientResponse.Single) async throws -> R = { + _ body: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> R = { try $0.message } ) async throws -> R where R: Sendable { @@ -1122,11 +1122,11 @@ public struct Grpc_Testing_TestServiceClient: Grpc_Testing_TestService.ClientPro /// As one request could lead to multiple responses, this interface /// demonstrates the idea of full duplexing. public func fullDuplexCall( - request: GRPCCore.ClientRequest.Stream, + request: GRPCCore.StreamingClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions = .defaults, - _ body: @Sendable @escaping (GRPCCore.ClientResponse.Stream) async throws -> R + _ body: @Sendable @escaping (GRPCCore.StreamingClientResponse) async throws -> R ) async throws -> R where R: Sendable { try await self.client.bidirectionalStreaming( request: request, @@ -1143,11 +1143,11 @@ public struct Grpc_Testing_TestServiceClient: Grpc_Testing_TestService.ClientPro /// stream of responses are returned to the client when the server starts with /// first request. public func halfDuplexCall( - request: GRPCCore.ClientRequest.Stream, + request: GRPCCore.StreamingClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions = .defaults, - _ body: @Sendable @escaping (GRPCCore.ClientResponse.Stream) async throws -> R + _ body: @Sendable @escaping (GRPCCore.StreamingClientResponse) async throws -> R ) async throws -> R where R: Sendable { try await self.client.bidirectionalStreaming( request: request, @@ -1162,11 +1162,11 @@ public struct Grpc_Testing_TestServiceClient: Grpc_Testing_TestService.ClientPro /// The test server will not implement this method. It will be used /// to test the behavior when clients call unimplemented methods. public func unimplementedCall( - request: GRPCCore.ClientRequest.Single, + request: GRPCCore.ClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions = .defaults, - _ body: @Sendable @escaping (GRPCCore.ClientResponse.Single) async throws -> R = { + _ body: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> R = { try $0.message } ) async throws -> R where R: Sendable { @@ -1184,23 +1184,23 @@ public struct Grpc_Testing_TestServiceClient: Grpc_Testing_TestService.ClientPro /// A simple service NOT implemented at servers so clients can test for /// that case. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) -public protocol Grpc_Testing_UnimplementedServiceClientProtocol: Sendable { +public protocol Grpc_Testing_UnimplementedService_ClientProtocol: Sendable { /// A call that no server should implement func unimplementedCall( - request: GRPCCore.ClientRequest.Single, + request: GRPCCore.ClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions, - _ body: @Sendable @escaping (GRPCCore.ClientResponse.Single) async throws -> R + _ body: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> R ) async throws -> R where R: Sendable } @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) extension Grpc_Testing_UnimplementedService.ClientProtocol { public func unimplementedCall( - request: GRPCCore.ClientRequest.Single, + request: GRPCCore.ClientRequest, options: GRPCCore.CallOptions = .defaults, - _ body: @Sendable @escaping (GRPCCore.ClientResponse.Single) async throws -> R = { + _ body: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> R = { try $0.message } ) async throws -> R where R: Sendable { @@ -1221,11 +1221,11 @@ extension Grpc_Testing_UnimplementedService.ClientProtocol { _ message: Grpc_Testing_Empty, metadata: GRPCCore.Metadata = [:], options: GRPCCore.CallOptions = .defaults, - onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse.Single) async throws -> Result = { + onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> Result = { try $0.message } ) async throws -> Result where Result: Sendable { - let request = GRPCCore.ClientRequest.Single( + let request = GRPCCore.ClientRequest( message: message, metadata: metadata ) @@ -1240,7 +1240,7 @@ extension Grpc_Testing_UnimplementedService.ClientProtocol { /// A simple service NOT implemented at servers so clients can test for /// that case. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) -public struct Grpc_Testing_UnimplementedServiceClient: Grpc_Testing_UnimplementedService.ClientProtocol { +public struct Grpc_Testing_UnimplementedService_Client: Grpc_Testing_UnimplementedService.ClientProtocol { private let client: GRPCCore.GRPCClient public init(wrapping client: GRPCCore.GRPCClient) { @@ -1249,11 +1249,11 @@ public struct Grpc_Testing_UnimplementedServiceClient: Grpc_Testing_Unimplemente /// A call that no server should implement public func unimplementedCall( - request: GRPCCore.ClientRequest.Single, + request: GRPCCore.ClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions = .defaults, - _ body: @Sendable @escaping (GRPCCore.ClientResponse.Single) async throws -> R = { + _ body: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> R = { try $0.message } ) async throws -> R where R: Sendable { @@ -1270,30 +1270,30 @@ public struct Grpc_Testing_UnimplementedServiceClient: Grpc_Testing_Unimplemente /// A service used to control reconnect server. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) -public protocol Grpc_Testing_ReconnectServiceClientProtocol: Sendable { +public protocol Grpc_Testing_ReconnectService_ClientProtocol: Sendable { func start( - request: GRPCCore.ClientRequest.Single, + request: GRPCCore.ClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions, - _ body: @Sendable @escaping (GRPCCore.ClientResponse.Single) async throws -> R + _ body: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> R ) async throws -> R where R: Sendable func stop( - request: GRPCCore.ClientRequest.Single, + request: GRPCCore.ClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions, - _ body: @Sendable @escaping (GRPCCore.ClientResponse.Single) async throws -> R + _ body: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> R ) async throws -> R where R: Sendable } @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) extension Grpc_Testing_ReconnectService.ClientProtocol { public func start( - request: GRPCCore.ClientRequest.Single, + request: GRPCCore.ClientRequest, options: GRPCCore.CallOptions = .defaults, - _ body: @Sendable @escaping (GRPCCore.ClientResponse.Single) async throws -> R = { + _ body: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> R = { try $0.message } ) async throws -> R where R: Sendable { @@ -1307,9 +1307,9 @@ extension Grpc_Testing_ReconnectService.ClientProtocol { } public func stop( - request: GRPCCore.ClientRequest.Single, + request: GRPCCore.ClientRequest, options: GRPCCore.CallOptions = .defaults, - _ body: @Sendable @escaping (GRPCCore.ClientResponse.Single) async throws -> R = { + _ body: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> R = { try $0.message } ) async throws -> R where R: Sendable { @@ -1329,11 +1329,11 @@ extension Grpc_Testing_ReconnectService.ClientProtocol { _ message: Grpc_Testing_ReconnectParams, metadata: GRPCCore.Metadata = [:], options: GRPCCore.CallOptions = .defaults, - onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse.Single) async throws -> Result = { + onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> Result = { try $0.message } ) async throws -> Result where Result: Sendable { - let request = GRPCCore.ClientRequest.Single( + let request = GRPCCore.ClientRequest( message: message, metadata: metadata ) @@ -1348,11 +1348,11 @@ extension Grpc_Testing_ReconnectService.ClientProtocol { _ message: Grpc_Testing_Empty, metadata: GRPCCore.Metadata = [:], options: GRPCCore.CallOptions = .defaults, - onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse.Single) async throws -> Result = { + onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> Result = { try $0.message } ) async throws -> Result where Result: Sendable { - let request = GRPCCore.ClientRequest.Single( + let request = GRPCCore.ClientRequest( message: message, metadata: metadata ) @@ -1366,7 +1366,7 @@ extension Grpc_Testing_ReconnectService.ClientProtocol { /// A service used to control reconnect server. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) -public struct Grpc_Testing_ReconnectServiceClient: Grpc_Testing_ReconnectService.ClientProtocol { +public struct Grpc_Testing_ReconnectService_Client: Grpc_Testing_ReconnectService.ClientProtocol { private let client: GRPCCore.GRPCClient public init(wrapping client: GRPCCore.GRPCClient) { @@ -1374,11 +1374,11 @@ public struct Grpc_Testing_ReconnectServiceClient: Grpc_Testing_ReconnectService } public func start( - request: GRPCCore.ClientRequest.Single, + request: GRPCCore.ClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions = .defaults, - _ body: @Sendable @escaping (GRPCCore.ClientResponse.Single) async throws -> R = { + _ body: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> R = { try $0.message } ) async throws -> R where R: Sendable { @@ -1393,11 +1393,11 @@ public struct Grpc_Testing_ReconnectServiceClient: Grpc_Testing_ReconnectService } public func stop( - request: GRPCCore.ClientRequest.Single, + request: GRPCCore.ClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions = .defaults, - _ body: @Sendable @escaping (GRPCCore.ClientResponse.Single) async throws -> R = { + _ body: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> R = { try $0.message } ) async throws -> R where R: Sendable { diff --git a/Sources/GRPCInteropTests/InteroperabilityTestCases.swift b/Sources/GRPCInteropTests/InteroperabilityTestCases.swift index b1be0be..8d6ff48 100644 --- a/Sources/GRPCInteropTests/InteroperabilityTestCases.swift +++ b/Sources/GRPCInteropTests/InteroperabilityTestCases.swift @@ -36,7 +36,7 @@ struct EmptyUnary: InteroperabilityTest { func run(client: GRPCClient) async throws { let testServiceClient = Grpc_Testing_TestService.Client(wrapping: client) try await testServiceClient.emptyCall( - request: ClientRequest.Single(message: Grpc_Testing_Empty()) + request: ClientRequest(message: Grpc_Testing_Empty()) ) { response in try assertEqual(response.message, Grpc_Testing_Empty()) } @@ -76,7 +76,7 @@ struct LargeUnary: InteroperabilityTest { } } try await testServiceClient.unaryCall( - request: ClientRequest.Single(message: request) + request: ClientRequest(message: request) ) { response in try assertEqual( response.message.payload, @@ -160,7 +160,7 @@ class ClientCompressedUnary: InteroperabilityTest { // With compression expected but *disabled*. options.compression = CompressionAlgorithm.none try await testServiceClient.unaryCall( - request: ClientRequest.Single(message: compressedRequest), + request: ClientRequest(message: compressedRequest), options: options ) { response in switch response.accepted { @@ -175,7 +175,7 @@ class ClientCompressedUnary: InteroperabilityTest { options.compression = .gzip try await testServiceClient.unaryCall( - request: ClientRequest.Single(message: compressedRequest), + request: ClientRequest(message: compressedRequest), options: options ) { response in switch response.accepted { @@ -189,7 +189,7 @@ class ClientCompressedUnary: InteroperabilityTest { // With compression not expected and disabled. options.compression = CompressionAlgorithm.none try await testServiceClient.unaryCall( - request: ClientRequest.Single(message: uncompressedRequest), + request: ClientRequest(message: uncompressedRequest), options: options ) { response in switch response.accepted { @@ -262,7 +262,7 @@ class ServerCompressedUnary: InteroperabilityTest { } try await testServiceClient.unaryCall( - request: ClientRequest.Single(message: compressedRequest) + request: ClientRequest(message: compressedRequest) ) { response in // We can't verify that the compression bit was set, instead we verify that the encoding header // was sent by the server. This isn't quite the same since as it can still be set but the @@ -280,7 +280,7 @@ class ServerCompressedUnary: InteroperabilityTest { var uncompressedRequest = compressedRequest uncompressedRequest.responseCompressed.value = false try await testServiceClient.unaryCall( - request: ClientRequest.Single(message: compressedRequest) + request: ClientRequest(message: compressedRequest) ) { response in // We can't even check for the 'grpc-encoding' header here since it could be set with the // compression bit on the message not set. @@ -344,7 +344,7 @@ class ServerCompressedUnary: InteroperabilityTest { struct ClientStreaming: InteroperabilityTest { func run(client: GRPCClient) async throws { let testServiceClient = Grpc_Testing_TestService.Client(wrapping: client) - let request = ClientRequest.Stream { writer in + let request = StreamingClientRequest { writer in for bytes in [27182, 8, 1828, 45904] { let message = Grpc_Testing_StreamingInputCallRequest.with { $0.payload = Grpc_Testing_Payload.with { @@ -405,7 +405,7 @@ struct ServerStreaming: InteroperabilityTest { } try await testServiceClient.streamingOutputCall( - request: ClientRequest.Single(message: request) + request: ClientRequest(message: request) ) { response in var responseParts = response.messages.makeAsyncIterator() // There are 4 response sizes, so if there isn't a message for each one, @@ -486,7 +486,7 @@ class ServerCompressedStreaming: InteroperabilityTest { let responseSizes = [31415, 92653] try await testServiceClient.streamingOutputCall( - request: ClientRequest.Single(message: request) + request: ClientRequest(message: request) ) { response in var payloads = [Grpc_Testing_Payload]() @@ -586,7 +586,7 @@ struct PingPong: InteroperabilityTest { let testServiceClient = Grpc_Testing_TestService.Client(wrapping: client) let ids = AsyncStream.makeStream(of: Int.self) - let request = ClientRequest.Stream { writer in + let request = StreamingClientRequest { writer in let sizes = [(31_415, 27_182), (9, 8), (2_653, 1_828), (58_979, 45_904)] for try await id in ids.stream { var message = Grpc_Testing_StreamingOutputCallRequest() @@ -651,7 +651,7 @@ struct PingPong: InteroperabilityTest { struct EmptyStream: InteroperabilityTest { func run(client: GRPCClient) async throws { let testServiceClient = Grpc_Testing_TestService.Client(wrapping: client) - let request = ClientRequest.Stream { _ in } + let request = StreamingClientRequest { _ in } try await testServiceClient.fullDuplexCall(request: request) { response in var messages = response.messages.makeAsyncIterator() @@ -736,7 +736,7 @@ struct CustomMetadata: InteroperabilityTest { ] try await testServiceClient.unaryCall( - request: ClientRequest.Single(message: unaryRequest, metadata: metadata) + request: ClientRequest(message: unaryRequest, metadata: metadata) ) { response in // Check the initial metadata. let receivedInitialMetadata = response.metadata @@ -749,7 +749,7 @@ struct CustomMetadata: InteroperabilityTest { try checkTrailingMetadata(response.trailingMetadata) } - let streamingRequest = ClientRequest.Stream(metadata: metadata) { writer in + let streamingRequest = StreamingClientRequest(metadata: metadata) { writer in let message = Grpc_Testing_StreamingOutputCallRequest.with { $0.responseParameters = [ Grpc_Testing_ResponseParameters.with { @@ -840,7 +840,7 @@ struct StatusCodeAndMessage: InteroperabilityTest { } try await testServiceClient.unaryCall( - request: ClientRequest.Single(message: message) + request: ClientRequest(message: message) ) { response in switch response.accepted { case .failure(let error): @@ -854,7 +854,7 @@ struct StatusCodeAndMessage: InteroperabilityTest { } } - let request = ClientRequest.Stream { writer in + let request = StreamingClientRequest { writer in let message = Grpc_Testing_StreamingOutputCallRequest.with { $0.responseStatus = Grpc_Testing_EchoStatus.with { $0.code = Int32(self.expectedCode) @@ -915,7 +915,7 @@ struct SpecialStatusMessage: InteroperabilityTest { } } try await testServiceClient.unaryCall( - request: ClientRequest.Single(message: message) + request: ClientRequest(message: message) ) { response in switch response.accepted { case .success: @@ -950,7 +950,7 @@ struct UnimplementedMethod: InteroperabilityTest { func run(client: GRPCClient) async throws { let testServiceClient = Grpc_Testing_TestService.Client(wrapping: client) try await testServiceClient.unimplementedCall( - request: ClientRequest.Single(message: Grpc_Testing_Empty()) + request: ClientRequest(message: Grpc_Testing_Empty()) ) { response in switch response.accepted { case .success: @@ -983,7 +983,7 @@ struct UnimplementedService: InteroperabilityTest { func run(client: GRPCClient) async throws { let unimplementedServiceClient = Grpc_Testing_UnimplementedService.Client(wrapping: client) try await unimplementedServiceClient.unimplementedCall( - request: ClientRequest.Single(message: Grpc_Testing_Empty()) + request: ClientRequest(message: Grpc_Testing_Empty()) ) { response in switch response.accepted { case .success: diff --git a/Sources/GRPCInteropTests/TestService.swift b/Sources/GRPCInteropTests/TestService.swift index f4c79b7..6af999c 100644 --- a/Sources/GRPCInteropTests/TestService.swift +++ b/Sources/GRPCInteropTests/TestService.swift @@ -22,20 +22,20 @@ public struct TestService: Grpc_Testing_TestService.ServiceProtocol { public init() {} public func unimplementedCall( - request: ServerRequest.Single, + request: ServerRequest, context: ServerContext - ) async throws -> ServerResponse.Single { + ) async throws -> ServerResponse { throw RPCError(code: .unimplemented, message: "The RPC is not implemented.") } /// Server implements `emptyCall` which immediately returns the empty message. public func emptyCall( - request: ServerRequest.Single, + request: ServerRequest, context: ServerContext - ) async throws -> ServerResponse.Single { + ) async throws -> ServerResponse { let message = Grpc_Testing_Empty() let (initialMetadata, trailingMetadata) = request.metadata.makeInitialAndTrailingMetadata() - return ServerResponse.Single( + return ServerResponse( message: message, metadata: initialMetadata, trailingMetadata: trailingMetadata @@ -49,9 +49,9 @@ public struct TestService: Grpc_Testing_TestService.ServiceProtocol { /// If the server does not support the `responseType`, then it should fail the RPC with /// `INVALID_ARGUMENT`. public func unaryCall( - request: ServerRequest.Single, + request: ServerRequest, context: ServerContext - ) async throws -> ServerResponse.Single { + ) async throws -> ServerResponse { // We can't validate messages at the wire-encoding layer (i.e. where the compression byte is // set), so we have to check via the encoding header. Note that it is possible for the header // to be set and for the message to not be compressed. @@ -94,7 +94,7 @@ public struct TestService: Grpc_Testing_TestService.ServiceProtocol { let (initialMetadata, trailingMetadata) = request.metadata.makeInitialAndTrailingMetadata() - return ServerResponse.Single( + return ServerResponse( message: responseMessage, metadata: initialMetadata, trailingMetadata: trailingMetadata @@ -109,9 +109,9 @@ public struct TestService: Grpc_Testing_TestService.ServiceProtocol { /// headers such that the response can be cached by proxies in the response path. Server should /// be behind a caching proxy for this test to pass. Currently we set the max-age to 60 seconds. public func cacheableUnaryCall( - request: ServerRequest.Single, + request: ServerRequest, context: ServerContext - ) async throws -> ServerResponse.Single { + ) async throws -> ServerResponse { throw RPCError(code: .unimplemented, message: "The RPC is not implemented.") } @@ -121,11 +121,11 @@ public struct TestService: Grpc_Testing_TestService.ServiceProtocol { /// bytes, as specified by its respective `ResponseParameter`. After sending all responses, it /// closes with OK. public func streamingOutputCall( - request: ServerRequest.Single, + request: ServerRequest, context: ServerContext - ) async throws -> ServerResponse.Stream { + ) async throws -> StreamingServerResponse { let (initialMetadata, trailingMetadata) = request.metadata.makeInitialAndTrailingMetadata() - return ServerResponse.Stream(metadata: initialMetadata) { writer in + return StreamingServerResponse(metadata: initialMetadata) { writer in for responseParameter in request.message.responseParameters { let response = Grpc_Testing_StreamingOutputCallResponse.with { response in response.payload = Grpc_Testing_Payload.with { payload in @@ -144,9 +144,9 @@ public struct TestService: Grpc_Testing_TestService.ServiceProtocol { /// `StreamingInputCallResponse` where `aggregatedPayloadSize` is the sum of all request payload /// bodies received. public func streamingInputCall( - request: ServerRequest.Stream, + request: StreamingServerRequest, context: ServerContext - ) async throws -> ServerResponse.Single { + ) async throws -> ServerResponse { let isRequestCompressed = request.metadata["grpc-encoding"].filter({ $0 != "identity" }).count > 0 var aggregatedPayloadSize = 0 @@ -170,7 +170,7 @@ public struct TestService: Grpc_Testing_TestService.ServiceProtocol { } let (initialMetadata, trailingMetadata) = request.metadata.makeInitialAndTrailingMetadata() - return ServerResponse.Single( + return ServerResponse( message: responseMessage, metadata: initialMetadata, trailingMetadata: trailingMetadata @@ -183,11 +183,11 @@ public struct TestService: Grpc_Testing_TestService.ServiceProtocol { /// of size `ResponseParameter.size` bytes, as specified by its respective `ResponseParameter`s. /// After receiving half close and sending all responses, it closes with OK. public func fullDuplexCall( - request: ServerRequest.Stream, + request: StreamingServerRequest, context: ServerContext - ) async throws -> ServerResponse.Stream { + ) async throws -> StreamingServerResponse { let (initialMetadata, trailingMetadata) = request.metadata.makeInitialAndTrailingMetadata() - return ServerResponse.Stream(metadata: initialMetadata) { writer in + return StreamingServerResponse(metadata: initialMetadata) { writer in for try await message in request.messages { // If a request message has a responseStatus set, the server should return that status. // If the code is an error code, the server will throw an error containing that code @@ -221,9 +221,9 @@ public struct TestService: Grpc_Testing_TestService.ServiceProtocol { /// /// See: https://github.com/grpc/grpc/blob/master/doc/interop-test-descriptions.md public func halfDuplexCall( - request: ServerRequest.Stream, + request: StreamingServerRequest, context: ServerContext - ) async throws -> ServerResponse.Stream { + ) async throws -> StreamingServerResponse { throw RPCError(code: .unimplemented, message: "The RPC is not implemented.") } } diff --git a/Tests/GRPCHealthServiceTests/HealthTests.swift b/Tests/GRPCHealthServiceTests/HealthTests.swift index 85242af..c555ebd 100644 --- a/Tests/GRPCHealthServiceTests/HealthTests.swift +++ b/Tests/GRPCHealthServiceTests/HealthTests.swift @@ -21,13 +21,13 @@ import XCTest @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) final class HealthTests: XCTestCase { private func withHealthClient( - _ body: @Sendable (Grpc_Health_V1_HealthClient, Health.Provider) async throws -> Void + _ body: @Sendable (Grpc_Health_V1_Health_Client, Health.Provider) async throws -> Void ) async throws { let health = Health() - let inProcess = InProcessTransport.makePair() + let inProcess = InProcessTransport() let server = GRPCServer(transport: inProcess.server, services: [health.service]) let client = GRPCClient(transport: inProcess.client) - let healthClient = Grpc_Health_V1_HealthClient(wrapping: client) + let healthClient = Grpc_Health_V1_Health_Client(wrapping: client) try await withThrowingDiscardingTaskGroup { group in group.addTask { @@ -58,7 +58,7 @@ final class HealthTests: XCTestCase { $0.service = testServiceDescriptor.fullyQualifiedService } - try await healthClient.check(request: ClientRequest.Single(message: message)) { response in + try await healthClient.check(request: ClientRequest(message: message)) { response in try XCTAssertEqual(response.message.status, .serving) } } @@ -70,7 +70,7 @@ final class HealthTests: XCTestCase { $0.service = "does.not.Exist" } - try await healthClient.check(request: ClientRequest.Single(message: message)) { response in + try await healthClient.check(request: ClientRequest(message: message)) { response in try XCTAssertThrowsError(ofType: RPCError.self, response.message) { error in XCTAssertEqual(error.code, .notFound) } @@ -85,7 +85,7 @@ final class HealthTests: XCTestCase { let message = Grpc_Health_V1_HealthCheckRequest() - try await healthClient.check(request: ClientRequest.Single(message: message)) { response in + try await healthClient.check(request: ClientRequest(message: message)) { response in try XCTAssertEqual(response.message.status, .notServing) } } @@ -104,7 +104,7 @@ final class HealthTests: XCTestCase { $0.service = testServiceDescriptor.fullyQualifiedService } - try await healthClient.watch(request: ClientRequest.Single(message: message)) { response in + try await healthClient.watch(request: ClientRequest(message: message)) { response in var responseStreamIterator = response.messages.makeAsyncIterator() for i in 0 ..< statusesToBeSent.count { @@ -130,7 +130,7 @@ final class HealthTests: XCTestCase { $0.service = testServiceDescriptor.fullyQualifiedService } - try await healthClient.watch(request: ClientRequest.Single(message: message)) { response in + try await healthClient.watch(request: ClientRequest(message: message)) { response in var responseStreamIterator = response.messages.makeAsyncIterator() var next = try await responseStreamIterator.next() var message = try XCTUnwrap(next) @@ -171,7 +171,7 @@ final class HealthTests: XCTestCase { for _ in 0 ..< numberOfWatches { group.addTask { return try await healthClient.watch( - request: ClientRequest.Single(message: message) + request: ClientRequest(message: message) ) { response in signal.continuation.yield() // Make signal @@ -235,7 +235,7 @@ final class HealthTests: XCTestCase { } try await healthClient.watch( - request: ClientRequest.Single(message: message) + request: ClientRequest(message: message) ) { response in // Send all status updates. for status in statusesToBeSent { @@ -263,7 +263,7 @@ final class HealthTests: XCTestCase { let message = Grpc_Health_V1_HealthCheckRequest() - try await healthClient.watch(request: ClientRequest.Single(message: message)) { response in + try await healthClient.watch(request: ClientRequest(message: message)) { response in var responseStreamIterator = response.messages.makeAsyncIterator() for i in 0 ..< statusesToBeSent.count { diff --git a/Tests/GRPCInterceptorsTests/TracingInterceptorTests.swift b/Tests/GRPCInterceptorsTests/TracingInterceptorTests.swift index 5535c2d..864e30e 100644 --- a/Tests/GRPCInterceptorsTests/TracingInterceptorTests.swift +++ b/Tests/GRPCInterceptorsTests/TracingInterceptorTests.swift @@ -56,7 +56,7 @@ final class TracingInterceptorTests: XCTestCase { return .init( metadata: [], bodyParts: RPCAsyncSequence( - wrapping: AsyncThrowingStream { + wrapping: AsyncThrowingStream { $0.yield(.message(["response"])) $0.finish() } @@ -121,7 +121,7 @@ final class TracingInterceptorTests: XCTestCase { return .init( metadata: [], bodyParts: RPCAsyncSequence( - wrapping: AsyncThrowingStream { + wrapping: AsyncThrowingStream { $0.yield(.message(["response"])) $0.finish() } @@ -173,12 +173,12 @@ final class TracingInterceptorTests: XCTestCase { method: "testServerInterceptorErrorResponse" ) let interceptor = ServerTracingInterceptor(emitEventOnEachWrite: false) - let single = ServerRequest.Single(metadata: ["trace-id": "some-trace-id"], message: [UInt8]()) + let single = ServerRequest(metadata: ["trace-id": "some-trace-id"], message: [UInt8]()) let response = try await interceptor.intercept( request: .init(single: single), context: .init(descriptor: methodDescriptor) ) { _, _ in - ServerResponse.Stream(error: .init(code: .unknown, message: "Test error")) + StreamingServerResponse(error: .init(code: .unknown, message: "Test error")) } XCTAssertThrowsError(try response.accepted.get()) @@ -202,13 +202,13 @@ final class TracingInterceptorTests: XCTestCase { ) let (stream, continuation) = AsyncStream.makeStream() let interceptor = ServerTracingInterceptor(emitEventOnEachWrite: false) - let single = ServerRequest.Single(metadata: ["trace-id": "some-trace-id"], message: [UInt8]()) + let single = ServerRequest(metadata: ["trace-id": "some-trace-id"], message: [UInt8]()) let response = try await interceptor.intercept( request: .init(single: single), context: .init(descriptor: methodDescriptor) ) { _, _ in { [serviceContext = ServiceContext.current] in - return ServerResponse.Stream( + return StreamingServerResponse( accepted: .success( .init( metadata: [], @@ -267,13 +267,13 @@ final class TracingInterceptorTests: XCTestCase { ) let (stream, continuation) = AsyncStream.makeStream() let interceptor = ServerTracingInterceptor(emitEventOnEachWrite: true) - let single = ServerRequest.Single(metadata: ["trace-id": "some-trace-id"], message: [UInt8]()) + let single = ServerRequest(metadata: ["trace-id": "some-trace-id"], message: [UInt8]()) let response = try await interceptor.intercept( request: .init(single: single), context: .init(descriptor: methodDescriptor) ) { _, _ in { [serviceContext = ServiceContext.current] in - return ServerResponse.Stream( + return StreamingServerResponse( accepted: .success( .init( metadata: [], diff --git a/Tests/InProcessInteropTests/InProcessInteroperabilityTests.swift b/Tests/InProcessInteropTests/InProcessInteroperabilityTests.swift index 56d4146..dbb51f3 100644 --- a/Tests/InProcessInteropTests/InProcessInteroperabilityTests.swift +++ b/Tests/InProcessInteropTests/InProcessInteroperabilityTests.swift @@ -25,7 +25,7 @@ final class InProcessInteroperabilityTests: XCTestCase { interopTestCase: InteroperabilityTestCase ) async throws { do { - let inProcess = InProcessTransport.makePair() + let inProcess = InProcessTransport() try await withThrowingTaskGroup(of: Void.self) { group in group.addTask { let server = GRPCServer(transport: inProcess.server, services: [TestService()])