| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703 |
- //
- // 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 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<Grpc_Testing_Empty, Grpc_Testing_Empty>
- func unaryCall(
- _ request: Grpc_Testing_SimpleRequest,
- callOptions: CallOptions?
- ) -> UnaryCall<Grpc_Testing_SimpleRequest, Grpc_Testing_SimpleResponse>
- func cacheableUnaryCall(
- _ request: Grpc_Testing_SimpleRequest,
- callOptions: CallOptions?
- ) -> UnaryCall<Grpc_Testing_SimpleRequest, Grpc_Testing_SimpleResponse>
- func streamingOutputCall(
- _ request: Grpc_Testing_StreamingOutputCallRequest,
- callOptions: CallOptions?,
- handler: @escaping (Grpc_Testing_StreamingOutputCallResponse) -> Void
- ) -> ServerStreamingCall<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse>
- func streamingInputCall(
- callOptions: CallOptions?
- ) -> ClientStreamingCall<Grpc_Testing_StreamingInputCallRequest, Grpc_Testing_StreamingInputCallResponse>
- func fullDuplexCall(
- callOptions: CallOptions?,
- handler: @escaping (Grpc_Testing_StreamingOutputCallResponse) -> Void
- ) -> BidirectionalStreamingCall<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse>
- func halfDuplexCall(
- callOptions: CallOptions?,
- handler: @escaping (Grpc_Testing_StreamingOutputCallResponse) -> Void
- ) -> BidirectionalStreamingCall<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse>
- func unimplementedCall(
- _ request: Grpc_Testing_Empty,
- callOptions: CallOptions?
- ) -> UnaryCall<Grpc_Testing_Empty, Grpc_Testing_Empty>
- }
- 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<Grpc_Testing_Empty, Grpc_Testing_Empty> {
- return self.makeUnaryCall(
- path: "/grpc.testing.TestService/EmptyCall",
- 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<Grpc_Testing_SimpleRequest, Grpc_Testing_SimpleResponse> {
- return self.makeUnaryCall(
- path: "/grpc.testing.TestService/UnaryCall",
- 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<Grpc_Testing_SimpleRequest, Grpc_Testing_SimpleResponse> {
- return self.makeUnaryCall(
- path: "/grpc.testing.TestService/CacheableUnaryCall",
- 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<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse> {
- return self.makeServerStreamingCall(
- path: "/grpc.testing.TestService/StreamingOutputCall",
- 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<Grpc_Testing_StreamingInputCallRequest, Grpc_Testing_StreamingInputCallResponse> {
- return self.makeClientStreamingCall(
- path: "/grpc.testing.TestService/StreamingInputCall",
- 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<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse> {
- return self.makeBidirectionalStreamingCall(
- path: "/grpc.testing.TestService/FullDuplexCall",
- 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<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse> {
- return self.makeBidirectionalStreamingCall(
- path: "/grpc.testing.TestService/HalfDuplexCall",
- 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<Grpc_Testing_Empty, Grpc_Testing_Empty> {
- return self.makeUnaryCall(
- path: "/grpc.testing.TestService/UnimplementedCall",
- request: request,
- callOptions: callOptions ?? self.defaultCallOptions,
- interceptors: self.interceptors?.makeUnimplementedCallInterceptors() ?? []
- )
- }
- }
- public protocol Grpc_Testing_TestServiceClientInterceptorFactoryProtocol {
- /// - Returns: Interceptors to use when invoking 'emptyCall'.
- func makeEmptyCallInterceptors() -> [ClientInterceptor<Grpc_Testing_Empty, Grpc_Testing_Empty>]
- /// - Returns: Interceptors to use when invoking 'unaryCall'.
- func makeUnaryCallInterceptors() -> [ClientInterceptor<Grpc_Testing_SimpleRequest, Grpc_Testing_SimpleResponse>]
- /// - Returns: Interceptors to use when invoking 'cacheableUnaryCall'.
- func makeCacheableUnaryCallInterceptors() -> [ClientInterceptor<Grpc_Testing_SimpleRequest, Grpc_Testing_SimpleResponse>]
- /// - Returns: Interceptors to use when invoking 'streamingOutputCall'.
- func makeStreamingOutputCallInterceptors() -> [ClientInterceptor<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse>]
- /// - Returns: Interceptors to use when invoking 'streamingInputCall'.
- func makeStreamingInputCallInterceptors() -> [ClientInterceptor<Grpc_Testing_StreamingInputCallRequest, Grpc_Testing_StreamingInputCallResponse>]
- /// - Returns: Interceptors to use when invoking 'fullDuplexCall'.
- func makeFullDuplexCallInterceptors() -> [ClientInterceptor<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse>]
- /// - Returns: Interceptors to use when invoking 'halfDuplexCall'.
- func makeHalfDuplexCallInterceptors() -> [ClientInterceptor<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse>]
- /// - Returns: Interceptors to use when invoking 'unimplementedCall'.
- func makeUnimplementedCallInterceptors() -> [ClientInterceptor<Grpc_Testing_Empty, Grpc_Testing_Empty>]
- }
- public final class Grpc_Testing_TestServiceClient: Grpc_Testing_TestServiceClientProtocol {
- public let 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 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<Grpc_Testing_Empty, Grpc_Testing_Empty>
- }
- 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<Grpc_Testing_Empty, Grpc_Testing_Empty> {
- return self.makeUnaryCall(
- path: "/grpc.testing.UnimplementedService/UnimplementedCall",
- request: request,
- callOptions: callOptions ?? self.defaultCallOptions,
- interceptors: self.interceptors?.makeUnimplementedCallInterceptors() ?? []
- )
- }
- }
- public protocol Grpc_Testing_UnimplementedServiceClientInterceptorFactoryProtocol {
- /// - Returns: Interceptors to use when invoking 'unimplementedCall'.
- func makeUnimplementedCallInterceptors() -> [ClientInterceptor<Grpc_Testing_Empty, Grpc_Testing_Empty>]
- }
- public final class Grpc_Testing_UnimplementedServiceClient: Grpc_Testing_UnimplementedServiceClientProtocol {
- public let 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 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<Grpc_Testing_ReconnectParams, Grpc_Testing_Empty>
- func stop(
- _ request: Grpc_Testing_Empty,
- callOptions: CallOptions?
- ) -> UnaryCall<Grpc_Testing_Empty, Grpc_Testing_ReconnectInfo>
- }
- 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<Grpc_Testing_ReconnectParams, Grpc_Testing_Empty> {
- return self.makeUnaryCall(
- path: "/grpc.testing.ReconnectService/Start",
- 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<Grpc_Testing_Empty, Grpc_Testing_ReconnectInfo> {
- return self.makeUnaryCall(
- path: "/grpc.testing.ReconnectService/Stop",
- request: request,
- callOptions: callOptions ?? self.defaultCallOptions,
- interceptors: self.interceptors?.makeStopInterceptors() ?? []
- )
- }
- }
- public protocol Grpc_Testing_ReconnectServiceClientInterceptorFactoryProtocol {
- /// - Returns: Interceptors to use when invoking 'start'.
- func makeStartInterceptors() -> [ClientInterceptor<Grpc_Testing_ReconnectParams, Grpc_Testing_Empty>]
- /// - Returns: Interceptors to use when invoking 'stop'.
- func makeStopInterceptors() -> [ClientInterceptor<Grpc_Testing_Empty, Grpc_Testing_ReconnectInfo>]
- }
- public final class Grpc_Testing_ReconnectServiceClient: Grpc_Testing_ReconnectServiceClientProtocol {
- public let 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 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<Grpc_Testing_Empty>
- /// One request followed by one response.
- func unaryCall(request: Grpc_Testing_SimpleRequest, context: StatusOnlyCallContext) -> EventLoopFuture<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: StatusOnlyCallContext) -> EventLoopFuture<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, context: StreamingResponseCallContext<Grpc_Testing_StreamingOutputCallResponse>) -> EventLoopFuture<GRPCStatus>
- /// 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<Grpc_Testing_StreamingInputCallResponse>) -> EventLoopFuture<(StreamEvent<Grpc_Testing_StreamingInputCallRequest>) -> 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<Grpc_Testing_StreamingOutputCallResponse>) -> EventLoopFuture<(StreamEvent<Grpc_Testing_StreamingOutputCallRequest>) -> 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<Grpc_Testing_StreamingOutputCallResponse>) -> EventLoopFuture<(StreamEvent<Grpc_Testing_StreamingOutputCallRequest>) -> Void>
- }
- extension Grpc_Testing_TestServiceProvider {
- public var serviceName: Substring { return "grpc.testing.TestService" }
- /// 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 handleMethod(
- _ methodName: Substring,
- callHandlerContext: CallHandlerContext
- ) -> GRPCCallHandler? {
- switch methodName {
- case "EmptyCall":
- return CallHandlerFactory.makeUnary(
- callHandlerContext: callHandlerContext,
- interceptors: self.interceptors?.makeEmptyCallInterceptors() ?? []
- ) { context in
- return { request in
- self.emptyCall(request: request, context: context)
- }
- }
- case "UnaryCall":
- return CallHandlerFactory.makeUnary(
- callHandlerContext: callHandlerContext,
- interceptors: self.interceptors?.makeUnaryCallInterceptors() ?? []
- ) { context in
- return { request in
- self.unaryCall(request: request, context: context)
- }
- }
- case "CacheableUnaryCall":
- return CallHandlerFactory.makeUnary(
- callHandlerContext: callHandlerContext,
- interceptors: self.interceptors?.makeCacheableUnaryCallInterceptors() ?? []
- ) { context in
- return { request in
- self.cacheableUnaryCall(request: request, context: context)
- }
- }
- case "StreamingOutputCall":
- return CallHandlerFactory.makeServerStreaming(
- callHandlerContext: callHandlerContext,
- interceptors: self.interceptors?.makeStreamingOutputCallInterceptors() ?? []
- ) { context in
- return { request in
- self.streamingOutputCall(request: request, context: context)
- }
- }
- case "StreamingInputCall":
- return CallHandlerFactory.makeClientStreaming(
- callHandlerContext: callHandlerContext,
- interceptors: self.interceptors?.makeStreamingInputCallInterceptors() ?? []
- ) { context in
- self.streamingInputCall(context: context)
- }
- case "FullDuplexCall":
- return CallHandlerFactory.makeBidirectionalStreaming(
- callHandlerContext: callHandlerContext,
- interceptors: self.interceptors?.makeFullDuplexCallInterceptors() ?? []
- ) { context in
- self.fullDuplexCall(context: context)
- }
- case "HalfDuplexCall":
- return CallHandlerFactory.makeBidirectionalStreaming(
- callHandlerContext: callHandlerContext,
- interceptors: self.interceptors?.makeHalfDuplexCallInterceptors() ?? []
- ) { context in
- self.halfDuplexCall(context: context)
- }
- default:
- return nil
- }
- }
- }
- public protocol Grpc_Testing_TestServiceServerInterceptorFactoryProtocol {
- /// - Returns: Interceptors to use when handling 'emptyCall'.
- /// Defaults to calling `self.makeInterceptors()`.
- func makeEmptyCallInterceptors() -> [ServerInterceptor<Grpc_Testing_Empty, Grpc_Testing_Empty>]
- /// - Returns: Interceptors to use when handling 'unaryCall'.
- /// Defaults to calling `self.makeInterceptors()`.
- func makeUnaryCallInterceptors() -> [ServerInterceptor<Grpc_Testing_SimpleRequest, Grpc_Testing_SimpleResponse>]
- /// - Returns: Interceptors to use when handling 'cacheableUnaryCall'.
- /// Defaults to calling `self.makeInterceptors()`.
- func makeCacheableUnaryCallInterceptors() -> [ServerInterceptor<Grpc_Testing_SimpleRequest, Grpc_Testing_SimpleResponse>]
- /// - Returns: Interceptors to use when handling 'streamingOutputCall'.
- /// Defaults to calling `self.makeInterceptors()`.
- func makeStreamingOutputCallInterceptors() -> [ServerInterceptor<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse>]
- /// - Returns: Interceptors to use when handling 'streamingInputCall'.
- /// Defaults to calling `self.makeInterceptors()`.
- func makeStreamingInputCallInterceptors() -> [ServerInterceptor<Grpc_Testing_StreamingInputCallRequest, Grpc_Testing_StreamingInputCallResponse>]
- /// - Returns: Interceptors to use when handling 'fullDuplexCall'.
- /// Defaults to calling `self.makeInterceptors()`.
- func makeFullDuplexCallInterceptors() -> [ServerInterceptor<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse>]
- /// - Returns: Interceptors to use when handling 'halfDuplexCall'.
- /// Defaults to calling `self.makeInterceptors()`.
- func makeHalfDuplexCallInterceptors() -> [ServerInterceptor<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse>]
- /// - Returns: Interceptors to use when handling 'unimplementedCall'.
- /// Defaults to calling `self.makeInterceptors()`.
- func makeUnimplementedCallInterceptors() -> [ServerInterceptor<Grpc_Testing_Empty, Grpc_Testing_Empty>]
- }
- /// 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<Grpc_Testing_Empty>
- }
- extension Grpc_Testing_UnimplementedServiceProvider {
- public var serviceName: Substring { return "grpc.testing.UnimplementedService" }
- /// 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 handleMethod(
- _ methodName: Substring,
- callHandlerContext: CallHandlerContext
- ) -> GRPCCallHandler? {
- switch methodName {
- case "UnimplementedCall":
- return CallHandlerFactory.makeUnary(
- callHandlerContext: callHandlerContext,
- interceptors: self.interceptors?.makeUnimplementedCallInterceptors() ?? []
- ) { context in
- return { request in
- self.unimplementedCall(request: request, context: context)
- }
- }
- default:
- return nil
- }
- }
- }
- public protocol Grpc_Testing_UnimplementedServiceServerInterceptorFactoryProtocol {
- /// - Returns: Interceptors to use when handling 'unimplementedCall'.
- /// Defaults to calling `self.makeInterceptors()`.
- func makeUnimplementedCallInterceptors() -> [ServerInterceptor<Grpc_Testing_Empty, Grpc_Testing_Empty>]
- }
- /// 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<Grpc_Testing_Empty>
- func stop(request: Grpc_Testing_Empty, context: StatusOnlyCallContext) -> EventLoopFuture<Grpc_Testing_ReconnectInfo>
- }
- extension Grpc_Testing_ReconnectServiceProvider {
- public var serviceName: Substring { return "grpc.testing.ReconnectService" }
- /// 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 handleMethod(
- _ methodName: Substring,
- callHandlerContext: CallHandlerContext
- ) -> GRPCCallHandler? {
- switch methodName {
- case "Start":
- return CallHandlerFactory.makeUnary(
- callHandlerContext: callHandlerContext,
- interceptors: self.interceptors?.makeStartInterceptors() ?? []
- ) { context in
- return { request in
- self.start(request: request, context: context)
- }
- }
- case "Stop":
- return CallHandlerFactory.makeUnary(
- callHandlerContext: callHandlerContext,
- interceptors: self.interceptors?.makeStopInterceptors() ?? []
- ) { context in
- return { request in
- self.stop(request: request, context: context)
- }
- }
- default:
- return nil
- }
- }
- }
- public protocol Grpc_Testing_ReconnectServiceServerInterceptorFactoryProtocol {
- /// - Returns: Interceptors to use when handling 'start'.
- /// Defaults to calling `self.makeInterceptors()`.
- func makeStartInterceptors() -> [ServerInterceptor<Grpc_Testing_ReconnectParams, Grpc_Testing_Empty>]
- /// - Returns: Interceptors to use when handling 'stop'.
- /// Defaults to calling `self.makeInterceptors()`.
- func makeStopInterceptors() -> [ServerInterceptor<Grpc_Testing_Empty, Grpc_Testing_ReconnectInfo>]
- }
|