// // DO NOT EDIT. // swift-format-ignore-file // // Generated by the protocol buffer compiler. // Source: service.proto // import GRPC import NIO import SwiftProtobuf /// Usage: instantiate `Codegentest_FooClient`, then call methods of this protocol to make API calls. internal protocol Codegentest_FooClientProtocol: GRPCClient { var serviceName: String { get } var interceptors: Codegentest_FooClientInterceptorFactoryProtocol? { get } func get( _ request: Codegentest_FooMessage, callOptions: CallOptions? ) -> UnaryCall } extension Codegentest_FooClientProtocol { internal var serviceName: String { return "codegentest.Foo" } /// Unary call to Get /// /// - Parameters: /// - request: Request to send to Get. /// - callOptions: Call options. /// - Returns: A `UnaryCall` with futures for the metadata, status and response. internal func get( _ request: Codegentest_FooMessage, callOptions: CallOptions? = nil ) -> UnaryCall { return self.makeUnaryCall( path: "/codegentest.Foo/Get", request: request, callOptions: callOptions ?? self.defaultCallOptions, interceptors: self.interceptors?.makeGetInterceptors() ?? [] ) } } internal protocol Codegentest_FooClientInterceptorFactoryProtocol { /// - Returns: Interceptors to use when invoking 'get'. func makeGetInterceptors() -> [ClientInterceptor] } internal final class Codegentest_FooClient: Codegentest_FooClientProtocol { internal let channel: GRPCChannel internal var defaultCallOptions: CallOptions internal var interceptors: Codegentest_FooClientInterceptorFactoryProtocol? /// Creates a client for the codegentest.Foo 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. internal init( channel: GRPCChannel, defaultCallOptions: CallOptions = CallOptions(), interceptors: Codegentest_FooClientInterceptorFactoryProtocol? = nil ) { self.channel = channel self.defaultCallOptions = defaultCallOptions self.interceptors = interceptors } } /// To build a server, implement a class that conforms to this protocol. internal protocol Codegentest_FooProvider: CallHandlerProvider { var interceptors: Codegentest_FooServerInterceptorFactoryProtocol? { get } func get(request: Codegentest_FooMessage, context: StatusOnlyCallContext) -> EventLoopFuture } extension Codegentest_FooProvider { internal var serviceName: Substring { return "codegentest.Foo" } /// Determines, calls and returns the appropriate request handler, depending on the request's method. /// Returns nil for methods not handled by this service. internal func handle( method name: Substring, context: CallHandlerContext ) -> GRPCServerHandlerProtocol? { switch name { case "Get": return UnaryServerHandler( context: context, requestDeserializer: ProtobufDeserializer(), responseSerializer: ProtobufSerializer(), interceptors: self.interceptors?.makeGetInterceptors() ?? [], userFunction: self.get(request:context:) ) default: return nil } } } internal protocol Codegentest_FooServerInterceptorFactoryProtocol { /// - Returns: Interceptors to use when handling 'get'. /// Defaults to calling `self.makeInterceptors()`. func makeGetInterceptors() -> [ServerInterceptor] }