// // DO NOT EDIT. // // Generated by the protocol buffer compiler. // Source: src/proto/grpc/testing/test.proto // // // Copyright 2018, gRPC Authors All rights reserved. // // 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 GRPC import NIO import NIOConcurrencyHelpers import SwiftProtobuf /// A simple service to test the various types of RPCs and experiment with /// performance with various types of payload. /// /// Usage: instantiate `Grpc_Testing_TestServiceClient`, then call methods of this protocol to make API calls. public protocol Grpc_Testing_TestServiceClientProtocol: GRPCClient { var serviceName: String { get } var interceptors: Grpc_Testing_TestServiceClientInterceptorFactoryProtocol? { get } func emptyCall( _ request: Grpc_Testing_Empty, callOptions: CallOptions? ) -> UnaryCall func unaryCall( _ request: Grpc_Testing_SimpleRequest, callOptions: CallOptions? ) -> UnaryCall func cacheableUnaryCall( _ request: Grpc_Testing_SimpleRequest, callOptions: CallOptions? ) -> UnaryCall func streamingOutputCall( _ request: Grpc_Testing_StreamingOutputCallRequest, callOptions: CallOptions?, handler: @escaping (Grpc_Testing_StreamingOutputCallResponse) -> Void ) -> ServerStreamingCall func streamingInputCall( callOptions: CallOptions? ) -> ClientStreamingCall func fullDuplexCall( callOptions: CallOptions?, handler: @escaping (Grpc_Testing_StreamingOutputCallResponse) -> Void ) -> BidirectionalStreamingCall func halfDuplexCall( callOptions: CallOptions?, handler: @escaping (Grpc_Testing_StreamingOutputCallResponse) -> Void ) -> BidirectionalStreamingCall func unimplementedCall( _ request: Grpc_Testing_Empty, callOptions: CallOptions? ) -> UnaryCall } extension Grpc_Testing_TestServiceClientProtocol { public var serviceName: String { return "grpc.testing.TestService" } /// One empty request followed by one empty response. /// /// - Parameters: /// - request: Request to send to EmptyCall. /// - callOptions: Call options. /// - Returns: A `UnaryCall` with futures for the metadata, status and response. public func emptyCall( _ request: Grpc_Testing_Empty, callOptions: CallOptions? = nil ) -> UnaryCall { return self.makeUnaryCall( path: Grpc_Testing_TestServiceClientMetadata.Methods.emptyCall.path, request: request, callOptions: callOptions ?? self.defaultCallOptions, interceptors: self.interceptors?.makeEmptyCallInterceptors() ?? [] ) } /// One request followed by one response. /// /// - Parameters: /// - request: Request to send to UnaryCall. /// - callOptions: Call options. /// - Returns: A `UnaryCall` with futures for the metadata, status and response. public func unaryCall( _ request: Grpc_Testing_SimpleRequest, callOptions: CallOptions? = nil ) -> UnaryCall { return self.makeUnaryCall( path: Grpc_Testing_TestServiceClientMetadata.Methods.unaryCall.path, request: request, callOptions: callOptions ?? self.defaultCallOptions, interceptors: self.interceptors?.makeUnaryCallInterceptors() ?? [] ) } /// 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. /// /// - Parameters: /// - request: Request to send to CacheableUnaryCall. /// - callOptions: Call options. /// - Returns: A `UnaryCall` with futures for the metadata, status and response. public func cacheableUnaryCall( _ request: Grpc_Testing_SimpleRequest, callOptions: CallOptions? = nil ) -> UnaryCall { return self.makeUnaryCall( path: Grpc_Testing_TestServiceClientMetadata.Methods.cacheableUnaryCall.path, request: request, callOptions: callOptions ?? self.defaultCallOptions, interceptors: self.interceptors?.makeCacheableUnaryCallInterceptors() ?? [] ) } /// One request followed by a sequence of responses (streamed download). /// The server returns the payload with client desired type and sizes. /// /// - Parameters: /// - request: Request to send to StreamingOutputCall. /// - callOptions: Call options. /// - handler: A closure called when each response is received from the server. /// - Returns: A `ServerStreamingCall` with futures for the metadata and status. public func streamingOutputCall( _ request: Grpc_Testing_StreamingOutputCallRequest, callOptions: CallOptions? = nil, handler: @escaping (Grpc_Testing_StreamingOutputCallResponse) -> Void ) -> ServerStreamingCall { return self.makeServerStreamingCall( path: Grpc_Testing_TestServiceClientMetadata.Methods.streamingOutputCall.path, request: request, callOptions: callOptions ?? self.defaultCallOptions, interceptors: self.interceptors?.makeStreamingOutputCallInterceptors() ?? [], handler: handler ) } /// A sequence of requests followed by one response (streamed upload). /// The server returns the aggregated size of client payload as the result. /// /// Callers should use the `send` method on the returned object to send messages /// to the server. The caller should send an `.end` after the final message has been sent. /// /// - Parameters: /// - callOptions: Call options. /// - Returns: A `ClientStreamingCall` with futures for the metadata, status and response. public func streamingInputCall( callOptions: CallOptions? = nil ) -> ClientStreamingCall { return self.makeClientStreamingCall( path: Grpc_Testing_TestServiceClientMetadata.Methods.streamingInputCall.path, callOptions: callOptions ?? self.defaultCallOptions, interceptors: self.interceptors?.makeStreamingInputCallInterceptors() ?? [] ) } /// 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. /// /// Callers should use the `send` method on the returned object to send messages /// to the server. The caller should send an `.end` after the final message has been sent. /// /// - Parameters: /// - callOptions: Call options. /// - handler: A closure called when each response is received from the server. /// - Returns: A `ClientStreamingCall` with futures for the metadata and status. public func fullDuplexCall( callOptions: CallOptions? = nil, handler: @escaping (Grpc_Testing_StreamingOutputCallResponse) -> Void ) -> BidirectionalStreamingCall { return self.makeBidirectionalStreamingCall( path: Grpc_Testing_TestServiceClientMetadata.Methods.fullDuplexCall.path, callOptions: callOptions ?? self.defaultCallOptions, interceptors: self.interceptors?.makeFullDuplexCallInterceptors() ?? [], handler: handler ) } /// 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. /// /// Callers should use the `send` method on the returned object to send messages /// to the server. The caller should send an `.end` after the final message has been sent. /// /// - Parameters: /// - callOptions: Call options. /// - handler: A closure called when each response is received from the server. /// - Returns: A `ClientStreamingCall` with futures for the metadata and status. public func halfDuplexCall( callOptions: CallOptions? = nil, handler: @escaping (Grpc_Testing_StreamingOutputCallResponse) -> Void ) -> BidirectionalStreamingCall { return self.makeBidirectionalStreamingCall( path: Grpc_Testing_TestServiceClientMetadata.Methods.halfDuplexCall.path, callOptions: callOptions ?? self.defaultCallOptions, interceptors: self.interceptors?.makeHalfDuplexCallInterceptors() ?? [], handler: handler ) } /// The test server will not implement this method. It will be used /// to test the behavior when clients call unimplemented methods. /// /// - Parameters: /// - request: Request to send to UnimplementedCall. /// - callOptions: Call options. /// - Returns: A `UnaryCall` with futures for the metadata, status and response. public func unimplementedCall( _ request: Grpc_Testing_Empty, callOptions: CallOptions? = nil ) -> UnaryCall { return self.makeUnaryCall( path: Grpc_Testing_TestServiceClientMetadata.Methods.unimplementedCall.path, request: request, callOptions: callOptions ?? self.defaultCallOptions, interceptors: self.interceptors?.makeUnimplementedCallInterceptors() ?? [] ) } } @available(*, deprecated) extension Grpc_Testing_TestServiceClient: @unchecked Sendable {} @available(*, deprecated, renamed: "Grpc_Testing_TestServiceNIOClient") public final class Grpc_Testing_TestServiceClient: Grpc_Testing_TestServiceClientProtocol { private let lock = Lock() private var _defaultCallOptions: CallOptions private var _interceptors: Grpc_Testing_TestServiceClientInterceptorFactoryProtocol? public let channel: GRPCChannel public var defaultCallOptions: CallOptions { get { self.lock.withLock { return self._defaultCallOptions } } set { self.lock.withLockVoid { self._defaultCallOptions = newValue } } } public var interceptors: Grpc_Testing_TestServiceClientInterceptorFactoryProtocol? { get { self.lock.withLock { return self._interceptors } } set { self.lock.withLockVoid { self._interceptors = newValue } } } /// Creates a client for the grpc.testing.TestService service. /// /// - Parameters: /// - channel: `GRPCChannel` to the service host. /// - defaultCallOptions: Options to use for each service call if the user doesn't provide them. /// - interceptors: A factory providing interceptors for each RPC. public init( channel: GRPCChannel, defaultCallOptions: CallOptions = CallOptions(), interceptors: Grpc_Testing_TestServiceClientInterceptorFactoryProtocol? = nil ) { self.channel = channel self._defaultCallOptions = defaultCallOptions self._interceptors = interceptors } } public struct Grpc_Testing_TestServiceNIOClient: Grpc_Testing_TestServiceClientProtocol { public var channel: GRPCChannel public var defaultCallOptions: CallOptions public var interceptors: Grpc_Testing_TestServiceClientInterceptorFactoryProtocol? /// Creates a client for the grpc.testing.TestService service. /// /// - Parameters: /// - channel: `GRPCChannel` to the service host. /// - defaultCallOptions: Options to use for each service call if the user doesn't provide them. /// - interceptors: A factory providing interceptors for each RPC. public init( channel: GRPCChannel, defaultCallOptions: CallOptions = CallOptions(), interceptors: Grpc_Testing_TestServiceClientInterceptorFactoryProtocol? = nil ) { self.channel = channel self.defaultCallOptions = defaultCallOptions self.interceptors = interceptors } } /// A simple service to test the various types of RPCs and experiment with /// performance with various types of payload. @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public protocol Grpc_Testing_TestServiceAsyncClientProtocol: GRPCClient { static var serviceDescriptor: GRPCServiceDescriptor { get } var interceptors: Grpc_Testing_TestServiceClientInterceptorFactoryProtocol? { get } func makeEmptyCallCall( _ request: Grpc_Testing_Empty, callOptions: CallOptions? ) -> GRPCAsyncUnaryCall func makeUnaryCallCall( _ request: Grpc_Testing_SimpleRequest, callOptions: CallOptions? ) -> GRPCAsyncUnaryCall func makeCacheableUnaryCallCall( _ request: Grpc_Testing_SimpleRequest, callOptions: CallOptions? ) -> GRPCAsyncUnaryCall func makeStreamingOutputCallCall( _ request: Grpc_Testing_StreamingOutputCallRequest, callOptions: CallOptions? ) -> GRPCAsyncServerStreamingCall func makeStreamingInputCallCall( callOptions: CallOptions? ) -> GRPCAsyncClientStreamingCall func makeFullDuplexCallCall( callOptions: CallOptions? ) -> GRPCAsyncBidirectionalStreamingCall func makeHalfDuplexCallCall( callOptions: CallOptions? ) -> GRPCAsyncBidirectionalStreamingCall func makeUnimplementedCallCall( _ request: Grpc_Testing_Empty, callOptions: CallOptions? ) -> GRPCAsyncUnaryCall } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) extension Grpc_Testing_TestServiceAsyncClientProtocol { public static var serviceDescriptor: GRPCServiceDescriptor { return Grpc_Testing_TestServiceClientMetadata.serviceDescriptor } public var interceptors: Grpc_Testing_TestServiceClientInterceptorFactoryProtocol? { return nil } public func makeEmptyCallCall( _ request: Grpc_Testing_Empty, callOptions: CallOptions? = nil ) -> GRPCAsyncUnaryCall { return self.makeAsyncUnaryCall( path: Grpc_Testing_TestServiceClientMetadata.Methods.emptyCall.path, request: request, callOptions: callOptions ?? self.defaultCallOptions, interceptors: self.interceptors?.makeEmptyCallInterceptors() ?? [] ) } public func makeUnaryCallCall( _ request: Grpc_Testing_SimpleRequest, callOptions: CallOptions? = nil ) -> GRPCAsyncUnaryCall { return self.makeAsyncUnaryCall( path: Grpc_Testing_TestServiceClientMetadata.Methods.unaryCall.path, request: request, callOptions: callOptions ?? self.defaultCallOptions, interceptors: self.interceptors?.makeUnaryCallInterceptors() ?? [] ) } public func makeCacheableUnaryCallCall( _ request: Grpc_Testing_SimpleRequest, callOptions: CallOptions? = nil ) -> GRPCAsyncUnaryCall { return self.makeAsyncUnaryCall( path: Grpc_Testing_TestServiceClientMetadata.Methods.cacheableUnaryCall.path, request: request, callOptions: callOptions ?? self.defaultCallOptions, interceptors: self.interceptors?.makeCacheableUnaryCallInterceptors() ?? [] ) } public func makeStreamingOutputCallCall( _ request: Grpc_Testing_StreamingOutputCallRequest, callOptions: CallOptions? = nil ) -> GRPCAsyncServerStreamingCall { return self.makeAsyncServerStreamingCall( path: Grpc_Testing_TestServiceClientMetadata.Methods.streamingOutputCall.path, request: request, callOptions: callOptions ?? self.defaultCallOptions, interceptors: self.interceptors?.makeStreamingOutputCallInterceptors() ?? [] ) } public func makeStreamingInputCallCall( callOptions: CallOptions? = nil ) -> GRPCAsyncClientStreamingCall { return self.makeAsyncClientStreamingCall( path: Grpc_Testing_TestServiceClientMetadata.Methods.streamingInputCall.path, callOptions: callOptions ?? self.defaultCallOptions, interceptors: self.interceptors?.makeStreamingInputCallInterceptors() ?? [] ) } public func makeFullDuplexCallCall( callOptions: CallOptions? = nil ) -> GRPCAsyncBidirectionalStreamingCall { return self.makeAsyncBidirectionalStreamingCall( path: Grpc_Testing_TestServiceClientMetadata.Methods.fullDuplexCall.path, callOptions: callOptions ?? self.defaultCallOptions, interceptors: self.interceptors?.makeFullDuplexCallInterceptors() ?? [] ) } public func makeHalfDuplexCallCall( callOptions: CallOptions? = nil ) -> GRPCAsyncBidirectionalStreamingCall { return self.makeAsyncBidirectionalStreamingCall( path: Grpc_Testing_TestServiceClientMetadata.Methods.halfDuplexCall.path, callOptions: callOptions ?? self.defaultCallOptions, interceptors: self.interceptors?.makeHalfDuplexCallInterceptors() ?? [] ) } public func makeUnimplementedCallCall( _ request: Grpc_Testing_Empty, callOptions: CallOptions? = nil ) -> GRPCAsyncUnaryCall { return self.makeAsyncUnaryCall( path: Grpc_Testing_TestServiceClientMetadata.Methods.unimplementedCall.path, request: request, callOptions: callOptions ?? self.defaultCallOptions, interceptors: self.interceptors?.makeUnimplementedCallInterceptors() ?? [] ) } } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) extension Grpc_Testing_TestServiceAsyncClientProtocol { public func emptyCall( _ request: Grpc_Testing_Empty, callOptions: CallOptions? = nil ) async throws -> Grpc_Testing_Empty { return try await self.performAsyncUnaryCall( path: Grpc_Testing_TestServiceClientMetadata.Methods.emptyCall.path, request: request, callOptions: callOptions ?? self.defaultCallOptions, interceptors: self.interceptors?.makeEmptyCallInterceptors() ?? [] ) } public func unaryCall( _ request: Grpc_Testing_SimpleRequest, callOptions: CallOptions? = nil ) async throws -> Grpc_Testing_SimpleResponse { return try await self.performAsyncUnaryCall( path: Grpc_Testing_TestServiceClientMetadata.Methods.unaryCall.path, request: request, callOptions: callOptions ?? self.defaultCallOptions, interceptors: self.interceptors?.makeUnaryCallInterceptors() ?? [] ) } public func cacheableUnaryCall( _ request: Grpc_Testing_SimpleRequest, callOptions: CallOptions? = nil ) async throws -> Grpc_Testing_SimpleResponse { return try await self.performAsyncUnaryCall( path: Grpc_Testing_TestServiceClientMetadata.Methods.cacheableUnaryCall.path, request: request, callOptions: callOptions ?? self.defaultCallOptions, interceptors: self.interceptors?.makeCacheableUnaryCallInterceptors() ?? [] ) } public func streamingOutputCall( _ request: Grpc_Testing_StreamingOutputCallRequest, callOptions: CallOptions? = nil ) -> GRPCAsyncResponseStream { return self.performAsyncServerStreamingCall( path: Grpc_Testing_TestServiceClientMetadata.Methods.streamingOutputCall.path, request: request, callOptions: callOptions ?? self.defaultCallOptions, interceptors: self.interceptors?.makeStreamingOutputCallInterceptors() ?? [] ) } public func streamingInputCall( _ requests: RequestStream, callOptions: CallOptions? = nil ) async throws -> Grpc_Testing_StreamingInputCallResponse where RequestStream: Sequence, RequestStream.Element == Grpc_Testing_StreamingInputCallRequest { return try await self.performAsyncClientStreamingCall( path: Grpc_Testing_TestServiceClientMetadata.Methods.streamingInputCall.path, requests: requests, callOptions: callOptions ?? self.defaultCallOptions, interceptors: self.interceptors?.makeStreamingInputCallInterceptors() ?? [] ) } public func streamingInputCall( _ requests: RequestStream, callOptions: CallOptions? = nil ) async throws -> Grpc_Testing_StreamingInputCallResponse where RequestStream: AsyncSequence & Sendable, RequestStream.Element == Grpc_Testing_StreamingInputCallRequest { return try await self.performAsyncClientStreamingCall( path: Grpc_Testing_TestServiceClientMetadata.Methods.streamingInputCall.path, requests: requests, callOptions: callOptions ?? self.defaultCallOptions, interceptors: self.interceptors?.makeStreamingInputCallInterceptors() ?? [] ) } public func fullDuplexCall( _ requests: RequestStream, callOptions: CallOptions? = nil ) -> GRPCAsyncResponseStream where RequestStream: Sequence, RequestStream.Element == Grpc_Testing_StreamingOutputCallRequest { return self.performAsyncBidirectionalStreamingCall( path: Grpc_Testing_TestServiceClientMetadata.Methods.fullDuplexCall.path, requests: requests, callOptions: callOptions ?? self.defaultCallOptions, interceptors: self.interceptors?.makeFullDuplexCallInterceptors() ?? [] ) } public func fullDuplexCall( _ requests: RequestStream, callOptions: CallOptions? = nil ) -> GRPCAsyncResponseStream where RequestStream: AsyncSequence & Sendable, RequestStream.Element == Grpc_Testing_StreamingOutputCallRequest { return self.performAsyncBidirectionalStreamingCall( path: Grpc_Testing_TestServiceClientMetadata.Methods.fullDuplexCall.path, requests: requests, callOptions: callOptions ?? self.defaultCallOptions, interceptors: self.interceptors?.makeFullDuplexCallInterceptors() ?? [] ) } public func halfDuplexCall( _ requests: RequestStream, callOptions: CallOptions? = nil ) -> GRPCAsyncResponseStream where RequestStream: Sequence, RequestStream.Element == Grpc_Testing_StreamingOutputCallRequest { return self.performAsyncBidirectionalStreamingCall( path: Grpc_Testing_TestServiceClientMetadata.Methods.halfDuplexCall.path, requests: requests, callOptions: callOptions ?? self.defaultCallOptions, interceptors: self.interceptors?.makeHalfDuplexCallInterceptors() ?? [] ) } public func halfDuplexCall( _ requests: RequestStream, callOptions: CallOptions? = nil ) -> GRPCAsyncResponseStream where RequestStream: AsyncSequence & Sendable, RequestStream.Element == Grpc_Testing_StreamingOutputCallRequest { return self.performAsyncBidirectionalStreamingCall( path: Grpc_Testing_TestServiceClientMetadata.Methods.halfDuplexCall.path, requests: requests, callOptions: callOptions ?? self.defaultCallOptions, interceptors: self.interceptors?.makeHalfDuplexCallInterceptors() ?? [] ) } public func unimplementedCall( _ request: Grpc_Testing_Empty, callOptions: CallOptions? = nil ) async throws -> Grpc_Testing_Empty { return try await self.performAsyncUnaryCall( path: Grpc_Testing_TestServiceClientMetadata.Methods.unimplementedCall.path, request: request, callOptions: callOptions ?? self.defaultCallOptions, interceptors: self.interceptors?.makeUnimplementedCallInterceptors() ?? [] ) } } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public struct Grpc_Testing_TestServiceAsyncClient: Grpc_Testing_TestServiceAsyncClientProtocol { public var channel: GRPCChannel public var defaultCallOptions: CallOptions public var interceptors: Grpc_Testing_TestServiceClientInterceptorFactoryProtocol? public init( channel: GRPCChannel, defaultCallOptions: CallOptions = CallOptions(), interceptors: Grpc_Testing_TestServiceClientInterceptorFactoryProtocol? = nil ) { self.channel = channel self.defaultCallOptions = defaultCallOptions self.interceptors = interceptors } } public protocol Grpc_Testing_TestServiceClientInterceptorFactoryProtocol: Sendable { /// - Returns: Interceptors to use when invoking 'emptyCall'. func makeEmptyCallInterceptors() -> [ClientInterceptor] /// - Returns: Interceptors to use when invoking 'unaryCall'. func makeUnaryCallInterceptors() -> [ClientInterceptor] /// - Returns: Interceptors to use when invoking 'cacheableUnaryCall'. func makeCacheableUnaryCallInterceptors() -> [ClientInterceptor] /// - Returns: Interceptors to use when invoking 'streamingOutputCall'. func makeStreamingOutputCallInterceptors() -> [ClientInterceptor] /// - Returns: Interceptors to use when invoking 'streamingInputCall'. func makeStreamingInputCallInterceptors() -> [ClientInterceptor] /// - Returns: Interceptors to use when invoking 'fullDuplexCall'. func makeFullDuplexCallInterceptors() -> [ClientInterceptor] /// - Returns: Interceptors to use when invoking 'halfDuplexCall'. func makeHalfDuplexCallInterceptors() -> [ClientInterceptor] /// - Returns: Interceptors to use when invoking 'unimplementedCall'. func makeUnimplementedCallInterceptors() -> [ClientInterceptor] } public enum Grpc_Testing_TestServiceClientMetadata { public static let serviceDescriptor = GRPCServiceDescriptor( name: "TestService", fullName: "grpc.testing.TestService", methods: [ Grpc_Testing_TestServiceClientMetadata.Methods.emptyCall, Grpc_Testing_TestServiceClientMetadata.Methods.unaryCall, Grpc_Testing_TestServiceClientMetadata.Methods.cacheableUnaryCall, Grpc_Testing_TestServiceClientMetadata.Methods.streamingOutputCall, Grpc_Testing_TestServiceClientMetadata.Methods.streamingInputCall, Grpc_Testing_TestServiceClientMetadata.Methods.fullDuplexCall, Grpc_Testing_TestServiceClientMetadata.Methods.halfDuplexCall, Grpc_Testing_TestServiceClientMetadata.Methods.unimplementedCall, ] ) public enum Methods { public static let emptyCall = GRPCMethodDescriptor( name: "EmptyCall", path: "/grpc.testing.TestService/EmptyCall", type: GRPCCallType.unary ) public static let unaryCall = GRPCMethodDescriptor( name: "UnaryCall", path: "/grpc.testing.TestService/UnaryCall", type: GRPCCallType.unary ) public static let cacheableUnaryCall = GRPCMethodDescriptor( name: "CacheableUnaryCall", path: "/grpc.testing.TestService/CacheableUnaryCall", type: GRPCCallType.unary ) public static let streamingOutputCall = GRPCMethodDescriptor( name: "StreamingOutputCall", path: "/grpc.testing.TestService/StreamingOutputCall", type: GRPCCallType.serverStreaming ) public static let streamingInputCall = GRPCMethodDescriptor( name: "StreamingInputCall", path: "/grpc.testing.TestService/StreamingInputCall", type: GRPCCallType.clientStreaming ) public static let fullDuplexCall = GRPCMethodDescriptor( name: "FullDuplexCall", path: "/grpc.testing.TestService/FullDuplexCall", type: GRPCCallType.bidirectionalStreaming ) public static let halfDuplexCall = GRPCMethodDescriptor( name: "HalfDuplexCall", path: "/grpc.testing.TestService/HalfDuplexCall", type: GRPCCallType.bidirectionalStreaming ) public static let unimplementedCall = GRPCMethodDescriptor( name: "UnimplementedCall", path: "/grpc.testing.TestService/UnimplementedCall", type: GRPCCallType.unary ) } } /// A simple service NOT implemented at servers so clients can test for /// that case. /// /// Usage: instantiate `Grpc_Testing_UnimplementedServiceClient`, then call methods of this protocol to make API calls. public protocol Grpc_Testing_UnimplementedServiceClientProtocol: GRPCClient { var serviceName: String { get } var interceptors: Grpc_Testing_UnimplementedServiceClientInterceptorFactoryProtocol? { get } func unimplementedCall( _ request: Grpc_Testing_Empty, callOptions: CallOptions? ) -> UnaryCall } extension Grpc_Testing_UnimplementedServiceClientProtocol { public var serviceName: String { return "grpc.testing.UnimplementedService" } /// A call that no server should implement /// /// - Parameters: /// - request: Request to send to UnimplementedCall. /// - callOptions: Call options. /// - Returns: A `UnaryCall` with futures for the metadata, status and response. public func unimplementedCall( _ request: Grpc_Testing_Empty, callOptions: CallOptions? = nil ) -> UnaryCall { return self.makeUnaryCall( path: Grpc_Testing_UnimplementedServiceClientMetadata.Methods.unimplementedCall.path, request: request, callOptions: callOptions ?? self.defaultCallOptions, interceptors: self.interceptors?.makeUnimplementedCallInterceptors() ?? [] ) } } @available(*, deprecated) extension Grpc_Testing_UnimplementedServiceClient: @unchecked Sendable {} @available(*, deprecated, renamed: "Grpc_Testing_UnimplementedServiceNIOClient") public final class Grpc_Testing_UnimplementedServiceClient: Grpc_Testing_UnimplementedServiceClientProtocol { private let lock = Lock() private var _defaultCallOptions: CallOptions private var _interceptors: Grpc_Testing_UnimplementedServiceClientInterceptorFactoryProtocol? public let channel: GRPCChannel public var defaultCallOptions: CallOptions { get { self.lock.withLock { return self._defaultCallOptions } } set { self.lock.withLockVoid { self._defaultCallOptions = newValue } } } public var interceptors: Grpc_Testing_UnimplementedServiceClientInterceptorFactoryProtocol? { get { self.lock.withLock { return self._interceptors } } set { self.lock.withLockVoid { self._interceptors = newValue } } } /// Creates a client for the grpc.testing.UnimplementedService service. /// /// - Parameters: /// - channel: `GRPCChannel` to the service host. /// - defaultCallOptions: Options to use for each service call if the user doesn't provide them. /// - interceptors: A factory providing interceptors for each RPC. public init( channel: GRPCChannel, defaultCallOptions: CallOptions = CallOptions(), interceptors: Grpc_Testing_UnimplementedServiceClientInterceptorFactoryProtocol? = nil ) { self.channel = channel self._defaultCallOptions = defaultCallOptions self._interceptors = interceptors } } public struct Grpc_Testing_UnimplementedServiceNIOClient: Grpc_Testing_UnimplementedServiceClientProtocol { public var channel: GRPCChannel public var defaultCallOptions: CallOptions public var interceptors: Grpc_Testing_UnimplementedServiceClientInterceptorFactoryProtocol? /// Creates a client for the grpc.testing.UnimplementedService service. /// /// - Parameters: /// - channel: `GRPCChannel` to the service host. /// - defaultCallOptions: Options to use for each service call if the user doesn't provide them. /// - interceptors: A factory providing interceptors for each RPC. public init( channel: GRPCChannel, defaultCallOptions: CallOptions = CallOptions(), interceptors: Grpc_Testing_UnimplementedServiceClientInterceptorFactoryProtocol? = nil ) { self.channel = channel self.defaultCallOptions = defaultCallOptions self.interceptors = interceptors } } /// A simple service NOT implemented at servers so clients can test for /// that case. @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public protocol Grpc_Testing_UnimplementedServiceAsyncClientProtocol: GRPCClient { static var serviceDescriptor: GRPCServiceDescriptor { get } var interceptors: Grpc_Testing_UnimplementedServiceClientInterceptorFactoryProtocol? { get } func makeUnimplementedCallCall( _ request: Grpc_Testing_Empty, callOptions: CallOptions? ) -> GRPCAsyncUnaryCall } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) extension Grpc_Testing_UnimplementedServiceAsyncClientProtocol { public static var serviceDescriptor: GRPCServiceDescriptor { return Grpc_Testing_UnimplementedServiceClientMetadata.serviceDescriptor } public var interceptors: Grpc_Testing_UnimplementedServiceClientInterceptorFactoryProtocol? { return nil } public func makeUnimplementedCallCall( _ request: Grpc_Testing_Empty, callOptions: CallOptions? = nil ) -> GRPCAsyncUnaryCall { return self.makeAsyncUnaryCall( path: Grpc_Testing_UnimplementedServiceClientMetadata.Methods.unimplementedCall.path, request: request, callOptions: callOptions ?? self.defaultCallOptions, interceptors: self.interceptors?.makeUnimplementedCallInterceptors() ?? [] ) } } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) extension Grpc_Testing_UnimplementedServiceAsyncClientProtocol { public func unimplementedCall( _ request: Grpc_Testing_Empty, callOptions: CallOptions? = nil ) async throws -> Grpc_Testing_Empty { return try await self.performAsyncUnaryCall( path: Grpc_Testing_UnimplementedServiceClientMetadata.Methods.unimplementedCall.path, request: request, callOptions: callOptions ?? self.defaultCallOptions, interceptors: self.interceptors?.makeUnimplementedCallInterceptors() ?? [] ) } } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public struct Grpc_Testing_UnimplementedServiceAsyncClient: Grpc_Testing_UnimplementedServiceAsyncClientProtocol { public var channel: GRPCChannel public var defaultCallOptions: CallOptions public var interceptors: Grpc_Testing_UnimplementedServiceClientInterceptorFactoryProtocol? public init( channel: GRPCChannel, defaultCallOptions: CallOptions = CallOptions(), interceptors: Grpc_Testing_UnimplementedServiceClientInterceptorFactoryProtocol? = nil ) { self.channel = channel self.defaultCallOptions = defaultCallOptions self.interceptors = interceptors } } public protocol Grpc_Testing_UnimplementedServiceClientInterceptorFactoryProtocol: Sendable { /// - Returns: Interceptors to use when invoking 'unimplementedCall'. func makeUnimplementedCallInterceptors() -> [ClientInterceptor] } public enum Grpc_Testing_UnimplementedServiceClientMetadata { public static let serviceDescriptor = GRPCServiceDescriptor( name: "UnimplementedService", fullName: "grpc.testing.UnimplementedService", methods: [ Grpc_Testing_UnimplementedServiceClientMetadata.Methods.unimplementedCall, ] ) public enum Methods { public static let unimplementedCall = GRPCMethodDescriptor( name: "UnimplementedCall", path: "/grpc.testing.UnimplementedService/UnimplementedCall", type: GRPCCallType.unary ) } } /// A service used to control reconnect server. /// /// Usage: instantiate `Grpc_Testing_ReconnectServiceClient`, then call methods of this protocol to make API calls. public protocol Grpc_Testing_ReconnectServiceClientProtocol: GRPCClient { var serviceName: String { get } var interceptors: Grpc_Testing_ReconnectServiceClientInterceptorFactoryProtocol? { get } func start( _ request: Grpc_Testing_ReconnectParams, callOptions: CallOptions? ) -> UnaryCall func stop( _ request: Grpc_Testing_Empty, callOptions: CallOptions? ) -> UnaryCall } extension Grpc_Testing_ReconnectServiceClientProtocol { public var serviceName: String { return "grpc.testing.ReconnectService" } /// Unary call to Start /// /// - Parameters: /// - request: Request to send to Start. /// - callOptions: Call options. /// - Returns: A `UnaryCall` with futures for the metadata, status and response. public func start( _ request: Grpc_Testing_ReconnectParams, callOptions: CallOptions? = nil ) -> UnaryCall { return self.makeUnaryCall( path: Grpc_Testing_ReconnectServiceClientMetadata.Methods.start.path, request: request, callOptions: callOptions ?? self.defaultCallOptions, interceptors: self.interceptors?.makeStartInterceptors() ?? [] ) } /// Unary call to Stop /// /// - Parameters: /// - request: Request to send to Stop. /// - callOptions: Call options. /// - Returns: A `UnaryCall` with futures for the metadata, status and response. public func stop( _ request: Grpc_Testing_Empty, callOptions: CallOptions? = nil ) -> UnaryCall { return self.makeUnaryCall( path: Grpc_Testing_ReconnectServiceClientMetadata.Methods.stop.path, request: request, callOptions: callOptions ?? self.defaultCallOptions, interceptors: self.interceptors?.makeStopInterceptors() ?? [] ) } } @available(*, deprecated) extension Grpc_Testing_ReconnectServiceClient: @unchecked Sendable {} @available(*, deprecated, renamed: "Grpc_Testing_ReconnectServiceNIOClient") public final class Grpc_Testing_ReconnectServiceClient: Grpc_Testing_ReconnectServiceClientProtocol { private let lock = Lock() private var _defaultCallOptions: CallOptions private var _interceptors: Grpc_Testing_ReconnectServiceClientInterceptorFactoryProtocol? public let channel: GRPCChannel public var defaultCallOptions: CallOptions { get { self.lock.withLock { return self._defaultCallOptions } } set { self.lock.withLockVoid { self._defaultCallOptions = newValue } } } public var interceptors: Grpc_Testing_ReconnectServiceClientInterceptorFactoryProtocol? { get { self.lock.withLock { return self._interceptors } } set { self.lock.withLockVoid { self._interceptors = newValue } } } /// Creates a client for the grpc.testing.ReconnectService service. /// /// - Parameters: /// - channel: `GRPCChannel` to the service host. /// - defaultCallOptions: Options to use for each service call if the user doesn't provide them. /// - interceptors: A factory providing interceptors for each RPC. public init( channel: GRPCChannel, defaultCallOptions: CallOptions = CallOptions(), interceptors: Grpc_Testing_ReconnectServiceClientInterceptorFactoryProtocol? = nil ) { self.channel = channel self._defaultCallOptions = defaultCallOptions self._interceptors = interceptors } } public struct Grpc_Testing_ReconnectServiceNIOClient: Grpc_Testing_ReconnectServiceClientProtocol { public var channel: GRPCChannel public var defaultCallOptions: CallOptions public var interceptors: Grpc_Testing_ReconnectServiceClientInterceptorFactoryProtocol? /// Creates a client for the grpc.testing.ReconnectService service. /// /// - Parameters: /// - channel: `GRPCChannel` to the service host. /// - defaultCallOptions: Options to use for each service call if the user doesn't provide them. /// - interceptors: A factory providing interceptors for each RPC. public init( channel: GRPCChannel, defaultCallOptions: CallOptions = CallOptions(), interceptors: Grpc_Testing_ReconnectServiceClientInterceptorFactoryProtocol? = nil ) { self.channel = channel self.defaultCallOptions = defaultCallOptions self.interceptors = interceptors } } /// A service used to control reconnect server. @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public protocol Grpc_Testing_ReconnectServiceAsyncClientProtocol: GRPCClient { static var serviceDescriptor: GRPCServiceDescriptor { get } var interceptors: Grpc_Testing_ReconnectServiceClientInterceptorFactoryProtocol? { get } func makeStartCall( _ request: Grpc_Testing_ReconnectParams, callOptions: CallOptions? ) -> GRPCAsyncUnaryCall func makeStopCall( _ request: Grpc_Testing_Empty, callOptions: CallOptions? ) -> GRPCAsyncUnaryCall } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) extension Grpc_Testing_ReconnectServiceAsyncClientProtocol { public static var serviceDescriptor: GRPCServiceDescriptor { return Grpc_Testing_ReconnectServiceClientMetadata.serviceDescriptor } public var interceptors: Grpc_Testing_ReconnectServiceClientInterceptorFactoryProtocol? { return nil } public func makeStartCall( _ request: Grpc_Testing_ReconnectParams, callOptions: CallOptions? = nil ) -> GRPCAsyncUnaryCall { return self.makeAsyncUnaryCall( path: Grpc_Testing_ReconnectServiceClientMetadata.Methods.start.path, request: request, callOptions: callOptions ?? self.defaultCallOptions, interceptors: self.interceptors?.makeStartInterceptors() ?? [] ) } public func makeStopCall( _ request: Grpc_Testing_Empty, callOptions: CallOptions? = nil ) -> GRPCAsyncUnaryCall { return self.makeAsyncUnaryCall( path: Grpc_Testing_ReconnectServiceClientMetadata.Methods.stop.path, request: request, callOptions: callOptions ?? self.defaultCallOptions, interceptors: self.interceptors?.makeStopInterceptors() ?? [] ) } } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) extension Grpc_Testing_ReconnectServiceAsyncClientProtocol { public func start( _ request: Grpc_Testing_ReconnectParams, callOptions: CallOptions? = nil ) async throws -> Grpc_Testing_Empty { return try await self.performAsyncUnaryCall( path: Grpc_Testing_ReconnectServiceClientMetadata.Methods.start.path, request: request, callOptions: callOptions ?? self.defaultCallOptions, interceptors: self.interceptors?.makeStartInterceptors() ?? [] ) } public func stop( _ request: Grpc_Testing_Empty, callOptions: CallOptions? = nil ) async throws -> Grpc_Testing_ReconnectInfo { return try await self.performAsyncUnaryCall( path: Grpc_Testing_ReconnectServiceClientMetadata.Methods.stop.path, request: request, callOptions: callOptions ?? self.defaultCallOptions, interceptors: self.interceptors?.makeStopInterceptors() ?? [] ) } } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public struct Grpc_Testing_ReconnectServiceAsyncClient: Grpc_Testing_ReconnectServiceAsyncClientProtocol { public var channel: GRPCChannel public var defaultCallOptions: CallOptions public var interceptors: Grpc_Testing_ReconnectServiceClientInterceptorFactoryProtocol? public init( channel: GRPCChannel, defaultCallOptions: CallOptions = CallOptions(), interceptors: Grpc_Testing_ReconnectServiceClientInterceptorFactoryProtocol? = nil ) { self.channel = channel self.defaultCallOptions = defaultCallOptions self.interceptors = interceptors } } public protocol Grpc_Testing_ReconnectServiceClientInterceptorFactoryProtocol: Sendable { /// - Returns: Interceptors to use when invoking 'start'. func makeStartInterceptors() -> [ClientInterceptor] /// - Returns: Interceptors to use when invoking 'stop'. func makeStopInterceptors() -> [ClientInterceptor] } public enum Grpc_Testing_ReconnectServiceClientMetadata { public static let serviceDescriptor = GRPCServiceDescriptor( name: "ReconnectService", fullName: "grpc.testing.ReconnectService", methods: [ Grpc_Testing_ReconnectServiceClientMetadata.Methods.start, Grpc_Testing_ReconnectServiceClientMetadata.Methods.stop, ] ) public enum Methods { public static let start = GRPCMethodDescriptor( name: "Start", path: "/grpc.testing.ReconnectService/Start", type: GRPCCallType.unary ) public static let stop = GRPCMethodDescriptor( name: "Stop", path: "/grpc.testing.ReconnectService/Stop", type: GRPCCallType.unary ) } } /// A simple service to test the various types of RPCs and experiment with /// performance with various types of payload. /// /// To build a server, implement a class that conforms to this protocol. public protocol Grpc_Testing_TestServiceProvider: CallHandlerProvider { var interceptors: Grpc_Testing_TestServiceServerInterceptorFactoryProtocol? { get } /// One empty request followed by one empty response. func emptyCall(request: Grpc_Testing_Empty, context: StatusOnlyCallContext) -> EventLoopFuture /// One request followed by one response. func unaryCall(request: Grpc_Testing_SimpleRequest, context: StatusOnlyCallContext) -> EventLoopFuture /// 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: Grpc_Testing_SimpleRequest, context: StatusOnlyCallContext) -> EventLoopFuture /// One request followed by a sequence of responses (streamed download). /// The server returns the payload with client desired type and sizes. func streamingOutputCall(request: Grpc_Testing_StreamingOutputCallRequest, context: StreamingResponseCallContext) -> EventLoopFuture /// A sequence of requests followed by one response (streamed upload). /// The server returns the aggregated size of client payload as the result. func streamingInputCall(context: UnaryResponseCallContext) -> EventLoopFuture<(StreamEvent) -> Void> /// 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(context: StreamingResponseCallContext) -> EventLoopFuture<(StreamEvent) -> Void> /// 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(context: StreamingResponseCallContext) -> EventLoopFuture<(StreamEvent) -> Void> } extension Grpc_Testing_TestServiceProvider { public var serviceName: Substring { return Grpc_Testing_TestServiceServerMetadata.serviceDescriptor.fullName[...] } /// Determines, calls and returns the appropriate request handler, depending on the request's method. /// Returns nil for methods not handled by this service. public func handle( method name: Substring, context: CallHandlerContext ) -> GRPCServerHandlerProtocol? { switch name { case "EmptyCall": return UnaryServerHandler( context: context, requestDeserializer: ProtobufDeserializer(), responseSerializer: ProtobufSerializer(), interceptors: self.interceptors?.makeEmptyCallInterceptors() ?? [], userFunction: self.emptyCall(request:context:) ) case "UnaryCall": return UnaryServerHandler( context: context, requestDeserializer: ProtobufDeserializer(), responseSerializer: ProtobufSerializer(), interceptors: self.interceptors?.makeUnaryCallInterceptors() ?? [], userFunction: self.unaryCall(request:context:) ) case "CacheableUnaryCall": return UnaryServerHandler( context: context, requestDeserializer: ProtobufDeserializer(), responseSerializer: ProtobufSerializer(), interceptors: self.interceptors?.makeCacheableUnaryCallInterceptors() ?? [], userFunction: self.cacheableUnaryCall(request:context:) ) case "StreamingOutputCall": return ServerStreamingServerHandler( context: context, requestDeserializer: ProtobufDeserializer(), responseSerializer: ProtobufSerializer(), interceptors: self.interceptors?.makeStreamingOutputCallInterceptors() ?? [], userFunction: self.streamingOutputCall(request:context:) ) case "StreamingInputCall": return ClientStreamingServerHandler( context: context, requestDeserializer: ProtobufDeserializer(), responseSerializer: ProtobufSerializer(), interceptors: self.interceptors?.makeStreamingInputCallInterceptors() ?? [], observerFactory: self.streamingInputCall(context:) ) case "FullDuplexCall": return BidirectionalStreamingServerHandler( context: context, requestDeserializer: ProtobufDeserializer(), responseSerializer: ProtobufSerializer(), interceptors: self.interceptors?.makeFullDuplexCallInterceptors() ?? [], observerFactory: self.fullDuplexCall(context:) ) case "HalfDuplexCall": return BidirectionalStreamingServerHandler( context: context, requestDeserializer: ProtobufDeserializer(), responseSerializer: ProtobufSerializer(), interceptors: self.interceptors?.makeHalfDuplexCallInterceptors() ?? [], observerFactory: self.halfDuplexCall(context:) ) default: return nil } } } /// A simple service to test the various types of RPCs and experiment with /// performance with various types of payload. /// /// To implement a server, implement an object which conforms to this protocol. @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public protocol Grpc_Testing_TestServiceAsyncProvider: CallHandlerProvider, Sendable { static var serviceDescriptor: GRPCServiceDescriptor { get } var interceptors: Grpc_Testing_TestServiceServerInterceptorFactoryProtocol? { get } /// One empty request followed by one empty response. func emptyCall( request: Grpc_Testing_Empty, context: GRPCAsyncServerCallContext ) async throws -> Grpc_Testing_Empty /// One request followed by one response. func unaryCall( request: Grpc_Testing_SimpleRequest, context: GRPCAsyncServerCallContext ) async throws -> Grpc_Testing_SimpleResponse /// 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: Grpc_Testing_SimpleRequest, context: GRPCAsyncServerCallContext ) async throws -> Grpc_Testing_SimpleResponse /// One request followed by a sequence of responses (streamed download). /// The server returns the payload with client desired type and sizes. func streamingOutputCall( request: Grpc_Testing_StreamingOutputCallRequest, responseStream: GRPCAsyncResponseStreamWriter, context: GRPCAsyncServerCallContext ) async throws /// A sequence of requests followed by one response (streamed upload). /// The server returns the aggregated size of client payload as the result. func streamingInputCall( requestStream: GRPCAsyncRequestStream, context: GRPCAsyncServerCallContext ) async throws -> Grpc_Testing_StreamingInputCallResponse /// 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( requestStream: GRPCAsyncRequestStream, responseStream: GRPCAsyncResponseStreamWriter, context: GRPCAsyncServerCallContext ) async throws /// 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( requestStream: GRPCAsyncRequestStream, responseStream: GRPCAsyncResponseStreamWriter, context: GRPCAsyncServerCallContext ) async throws } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) extension Grpc_Testing_TestServiceAsyncProvider { public static var serviceDescriptor: GRPCServiceDescriptor { return Grpc_Testing_TestServiceServerMetadata.serviceDescriptor } public var serviceName: Substring { return Grpc_Testing_TestServiceServerMetadata.serviceDescriptor.fullName[...] } public var interceptors: Grpc_Testing_TestServiceServerInterceptorFactoryProtocol? { return nil } public func handle( method name: Substring, context: CallHandlerContext ) -> GRPCServerHandlerProtocol? { switch name { case "EmptyCall": return GRPCAsyncServerHandler( context: context, requestDeserializer: ProtobufDeserializer(), responseSerializer: ProtobufSerializer(), interceptors: self.interceptors?.makeEmptyCallInterceptors() ?? [], wrapping: { try await self.emptyCall(request: $0, context: $1) } ) case "UnaryCall": return GRPCAsyncServerHandler( context: context, requestDeserializer: ProtobufDeserializer(), responseSerializer: ProtobufSerializer(), interceptors: self.interceptors?.makeUnaryCallInterceptors() ?? [], wrapping: { try await self.unaryCall(request: $0, context: $1) } ) case "CacheableUnaryCall": return GRPCAsyncServerHandler( context: context, requestDeserializer: ProtobufDeserializer(), responseSerializer: ProtobufSerializer(), interceptors: self.interceptors?.makeCacheableUnaryCallInterceptors() ?? [], wrapping: { try await self.cacheableUnaryCall(request: $0, context: $1) } ) case "StreamingOutputCall": return GRPCAsyncServerHandler( context: context, requestDeserializer: ProtobufDeserializer(), responseSerializer: ProtobufSerializer(), interceptors: self.interceptors?.makeStreamingOutputCallInterceptors() ?? [], wrapping: { try await self.streamingOutputCall(request: $0, responseStream: $1, context: $2) } ) case "StreamingInputCall": return GRPCAsyncServerHandler( context: context, requestDeserializer: ProtobufDeserializer(), responseSerializer: ProtobufSerializer(), interceptors: self.interceptors?.makeStreamingInputCallInterceptors() ?? [], wrapping: { try await self.streamingInputCall(requestStream: $0, context: $1) } ) case "FullDuplexCall": return GRPCAsyncServerHandler( context: context, requestDeserializer: ProtobufDeserializer(), responseSerializer: ProtobufSerializer(), interceptors: self.interceptors?.makeFullDuplexCallInterceptors() ?? [], wrapping: { try await self.fullDuplexCall(requestStream: $0, responseStream: $1, context: $2) } ) case "HalfDuplexCall": return GRPCAsyncServerHandler( context: context, requestDeserializer: ProtobufDeserializer(), responseSerializer: ProtobufSerializer(), interceptors: self.interceptors?.makeHalfDuplexCallInterceptors() ?? [], wrapping: { try await self.halfDuplexCall(requestStream: $0, responseStream: $1, context: $2) } ) default: return nil } } } public protocol Grpc_Testing_TestServiceServerInterceptorFactoryProtocol: Sendable { /// - Returns: Interceptors to use when handling 'emptyCall'. /// Defaults to calling `self.makeInterceptors()`. func makeEmptyCallInterceptors() -> [ServerInterceptor] /// - Returns: Interceptors to use when handling 'unaryCall'. /// Defaults to calling `self.makeInterceptors()`. func makeUnaryCallInterceptors() -> [ServerInterceptor] /// - Returns: Interceptors to use when handling 'cacheableUnaryCall'. /// Defaults to calling `self.makeInterceptors()`. func makeCacheableUnaryCallInterceptors() -> [ServerInterceptor] /// - Returns: Interceptors to use when handling 'streamingOutputCall'. /// Defaults to calling `self.makeInterceptors()`. func makeStreamingOutputCallInterceptors() -> [ServerInterceptor] /// - Returns: Interceptors to use when handling 'streamingInputCall'. /// Defaults to calling `self.makeInterceptors()`. func makeStreamingInputCallInterceptors() -> [ServerInterceptor] /// - Returns: Interceptors to use when handling 'fullDuplexCall'. /// Defaults to calling `self.makeInterceptors()`. func makeFullDuplexCallInterceptors() -> [ServerInterceptor] /// - Returns: Interceptors to use when handling 'halfDuplexCall'. /// Defaults to calling `self.makeInterceptors()`. func makeHalfDuplexCallInterceptors() -> [ServerInterceptor] /// - Returns: Interceptors to use when handling 'unimplementedCall'. /// Defaults to calling `self.makeInterceptors()`. func makeUnimplementedCallInterceptors() -> [ServerInterceptor] } public enum Grpc_Testing_TestServiceServerMetadata { public static let serviceDescriptor = GRPCServiceDescriptor( name: "TestService", fullName: "grpc.testing.TestService", methods: [ Grpc_Testing_TestServiceServerMetadata.Methods.emptyCall, Grpc_Testing_TestServiceServerMetadata.Methods.unaryCall, Grpc_Testing_TestServiceServerMetadata.Methods.cacheableUnaryCall, Grpc_Testing_TestServiceServerMetadata.Methods.streamingOutputCall, Grpc_Testing_TestServiceServerMetadata.Methods.streamingInputCall, Grpc_Testing_TestServiceServerMetadata.Methods.fullDuplexCall, Grpc_Testing_TestServiceServerMetadata.Methods.halfDuplexCall, Grpc_Testing_TestServiceServerMetadata.Methods.unimplementedCall, ] ) public enum Methods { public static let emptyCall = GRPCMethodDescriptor( name: "EmptyCall", path: "/grpc.testing.TestService/EmptyCall", type: GRPCCallType.unary ) public static let unaryCall = GRPCMethodDescriptor( name: "UnaryCall", path: "/grpc.testing.TestService/UnaryCall", type: GRPCCallType.unary ) public static let cacheableUnaryCall = GRPCMethodDescriptor( name: "CacheableUnaryCall", path: "/grpc.testing.TestService/CacheableUnaryCall", type: GRPCCallType.unary ) public static let streamingOutputCall = GRPCMethodDescriptor( name: "StreamingOutputCall", path: "/grpc.testing.TestService/StreamingOutputCall", type: GRPCCallType.serverStreaming ) public static let streamingInputCall = GRPCMethodDescriptor( name: "StreamingInputCall", path: "/grpc.testing.TestService/StreamingInputCall", type: GRPCCallType.clientStreaming ) public static let fullDuplexCall = GRPCMethodDescriptor( name: "FullDuplexCall", path: "/grpc.testing.TestService/FullDuplexCall", type: GRPCCallType.bidirectionalStreaming ) public static let halfDuplexCall = GRPCMethodDescriptor( name: "HalfDuplexCall", path: "/grpc.testing.TestService/HalfDuplexCall", type: GRPCCallType.bidirectionalStreaming ) public static let unimplementedCall = GRPCMethodDescriptor( name: "UnimplementedCall", path: "/grpc.testing.TestService/UnimplementedCall", type: GRPCCallType.unary ) } } /// A simple service NOT implemented at servers so clients can test for /// that case. /// /// To build a server, implement a class that conforms to this protocol. public protocol Grpc_Testing_UnimplementedServiceProvider: CallHandlerProvider { var interceptors: Grpc_Testing_UnimplementedServiceServerInterceptorFactoryProtocol? { get } /// A call that no server should implement func unimplementedCall(request: Grpc_Testing_Empty, context: StatusOnlyCallContext) -> EventLoopFuture } extension Grpc_Testing_UnimplementedServiceProvider { public var serviceName: Substring { return Grpc_Testing_UnimplementedServiceServerMetadata.serviceDescriptor.fullName[...] } /// Determines, calls and returns the appropriate request handler, depending on the request's method. /// Returns nil for methods not handled by this service. public func handle( method name: Substring, context: CallHandlerContext ) -> GRPCServerHandlerProtocol? { switch name { case "UnimplementedCall": return UnaryServerHandler( context: context, requestDeserializer: ProtobufDeserializer(), responseSerializer: ProtobufSerializer(), interceptors: self.interceptors?.makeUnimplementedCallInterceptors() ?? [], userFunction: self.unimplementedCall(request:context:) ) default: return nil } } } /// A simple service NOT implemented at servers so clients can test for /// that case. /// /// To implement a server, implement an object which conforms to this protocol. @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public protocol Grpc_Testing_UnimplementedServiceAsyncProvider: CallHandlerProvider, Sendable { static var serviceDescriptor: GRPCServiceDescriptor { get } var interceptors: Grpc_Testing_UnimplementedServiceServerInterceptorFactoryProtocol? { get } /// A call that no server should implement func unimplementedCall( request: Grpc_Testing_Empty, context: GRPCAsyncServerCallContext ) async throws -> Grpc_Testing_Empty } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) extension Grpc_Testing_UnimplementedServiceAsyncProvider { public static var serviceDescriptor: GRPCServiceDescriptor { return Grpc_Testing_UnimplementedServiceServerMetadata.serviceDescriptor } public var serviceName: Substring { return Grpc_Testing_UnimplementedServiceServerMetadata.serviceDescriptor.fullName[...] } public var interceptors: Grpc_Testing_UnimplementedServiceServerInterceptorFactoryProtocol? { return nil } public func handle( method name: Substring, context: CallHandlerContext ) -> GRPCServerHandlerProtocol? { switch name { case "UnimplementedCall": return GRPCAsyncServerHandler( context: context, requestDeserializer: ProtobufDeserializer(), responseSerializer: ProtobufSerializer(), interceptors: self.interceptors?.makeUnimplementedCallInterceptors() ?? [], wrapping: { try await self.unimplementedCall(request: $0, context: $1) } ) default: return nil } } } public protocol Grpc_Testing_UnimplementedServiceServerInterceptorFactoryProtocol: Sendable { /// - Returns: Interceptors to use when handling 'unimplementedCall'. /// Defaults to calling `self.makeInterceptors()`. func makeUnimplementedCallInterceptors() -> [ServerInterceptor] } public enum Grpc_Testing_UnimplementedServiceServerMetadata { public static let serviceDescriptor = GRPCServiceDescriptor( name: "UnimplementedService", fullName: "grpc.testing.UnimplementedService", methods: [ Grpc_Testing_UnimplementedServiceServerMetadata.Methods.unimplementedCall, ] ) public enum Methods { public static let unimplementedCall = GRPCMethodDescriptor( name: "UnimplementedCall", path: "/grpc.testing.UnimplementedService/UnimplementedCall", type: GRPCCallType.unary ) } } /// A service used to control reconnect server. /// /// To build a server, implement a class that conforms to this protocol. public protocol Grpc_Testing_ReconnectServiceProvider: CallHandlerProvider { var interceptors: Grpc_Testing_ReconnectServiceServerInterceptorFactoryProtocol? { get } func start(request: Grpc_Testing_ReconnectParams, context: StatusOnlyCallContext) -> EventLoopFuture func stop(request: Grpc_Testing_Empty, context: StatusOnlyCallContext) -> EventLoopFuture } extension Grpc_Testing_ReconnectServiceProvider { public var serviceName: Substring { return Grpc_Testing_ReconnectServiceServerMetadata.serviceDescriptor.fullName[...] } /// Determines, calls and returns the appropriate request handler, depending on the request's method. /// Returns nil for methods not handled by this service. public func handle( method name: Substring, context: CallHandlerContext ) -> GRPCServerHandlerProtocol? { switch name { case "Start": return UnaryServerHandler( context: context, requestDeserializer: ProtobufDeserializer(), responseSerializer: ProtobufSerializer(), interceptors: self.interceptors?.makeStartInterceptors() ?? [], userFunction: self.start(request:context:) ) case "Stop": return UnaryServerHandler( context: context, requestDeserializer: ProtobufDeserializer(), responseSerializer: ProtobufSerializer(), interceptors: self.interceptors?.makeStopInterceptors() ?? [], userFunction: self.stop(request:context:) ) default: return nil } } } /// A service used to control reconnect server. /// /// To implement a server, implement an object which conforms to this protocol. @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public protocol Grpc_Testing_ReconnectServiceAsyncProvider: CallHandlerProvider, Sendable { static var serviceDescriptor: GRPCServiceDescriptor { get } var interceptors: Grpc_Testing_ReconnectServiceServerInterceptorFactoryProtocol? { get } func start( request: Grpc_Testing_ReconnectParams, context: GRPCAsyncServerCallContext ) async throws -> Grpc_Testing_Empty func stop( request: Grpc_Testing_Empty, context: GRPCAsyncServerCallContext ) async throws -> Grpc_Testing_ReconnectInfo } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) extension Grpc_Testing_ReconnectServiceAsyncProvider { public static var serviceDescriptor: GRPCServiceDescriptor { return Grpc_Testing_ReconnectServiceServerMetadata.serviceDescriptor } public var serviceName: Substring { return Grpc_Testing_ReconnectServiceServerMetadata.serviceDescriptor.fullName[...] } public var interceptors: Grpc_Testing_ReconnectServiceServerInterceptorFactoryProtocol? { return nil } public func handle( method name: Substring, context: CallHandlerContext ) -> GRPCServerHandlerProtocol? { switch name { case "Start": return GRPCAsyncServerHandler( context: context, requestDeserializer: ProtobufDeserializer(), responseSerializer: ProtobufSerializer(), interceptors: self.interceptors?.makeStartInterceptors() ?? [], wrapping: { try await self.start(request: $0, context: $1) } ) case "Stop": return GRPCAsyncServerHandler( context: context, requestDeserializer: ProtobufDeserializer(), responseSerializer: ProtobufSerializer(), interceptors: self.interceptors?.makeStopInterceptors() ?? [], wrapping: { try await self.stop(request: $0, context: $1) } ) default: return nil } } } public protocol Grpc_Testing_ReconnectServiceServerInterceptorFactoryProtocol: Sendable { /// - Returns: Interceptors to use when handling 'start'. /// Defaults to calling `self.makeInterceptors()`. func makeStartInterceptors() -> [ServerInterceptor] /// - Returns: Interceptors to use when handling 'stop'. /// Defaults to calling `self.makeInterceptors()`. func makeStopInterceptors() -> [ServerInterceptor] } public enum Grpc_Testing_ReconnectServiceServerMetadata { public static let serviceDescriptor = GRPCServiceDescriptor( name: "ReconnectService", fullName: "grpc.testing.ReconnectService", methods: [ Grpc_Testing_ReconnectServiceServerMetadata.Methods.start, Grpc_Testing_ReconnectServiceServerMetadata.Methods.stop, ] ) public enum Methods { public static let start = GRPCMethodDescriptor( name: "Start", path: "/grpc.testing.ReconnectService/Start", type: GRPCCallType.unary ) public static let stop = GRPCMethodDescriptor( name: "Stop", path: "/grpc.testing.ReconnectService/Stop", type: GRPCCallType.unary ) } }