| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366 |
- //
- // 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 Foundation
- import NIO
- import NIOHTTP1
- import GRPC
- import SwiftProtobuf
- /// Usage: instantiate Grpc_Testing_TestServiceServiceClient, then call methods of this protocol to make API calls.
- public protocol Grpc_Testing_TestServiceService {
- 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>
- }
- public final class Grpc_Testing_TestServiceServiceClient: GRPCServiceClient, Grpc_Testing_TestServiceService {
- public let connection: ClientConnection
- public var serviceName: String { return "grpc.testing.TestService" }
- public var defaultCallOptions: CallOptions
- /// Creates a client for the grpc.testing.TestService service.
- ///
- /// - Parameters:
- /// - connection: `ClientConnection` to the service host.
- /// - defaultCallOptions: Options to use for each service call if the user doesn't provide them.
- public init(connection: ClientConnection, defaultCallOptions: CallOptions = CallOptions()) {
- self.connection = connection
- self.defaultCallOptions = defaultCallOptions
- }
- /// Asynchronous unary call to EmptyCall.
- ///
- /// - Parameters:
- /// - request: Request to send to EmptyCall.
- /// - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
- /// - 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: self.path(forMethod: "EmptyCall"),
- request: request,
- callOptions: callOptions ?? self.defaultCallOptions)
- }
- /// Asynchronous unary call to UnaryCall.
- ///
- /// - Parameters:
- /// - request: Request to send to UnaryCall.
- /// - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
- /// - 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: self.path(forMethod: "UnaryCall"),
- request: request,
- callOptions: callOptions ?? self.defaultCallOptions)
- }
- /// Asynchronous unary call to CacheableUnaryCall.
- ///
- /// - Parameters:
- /// - request: Request to send to CacheableUnaryCall.
- /// - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
- /// - 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: self.path(forMethod: "CacheableUnaryCall"),
- request: request,
- callOptions: callOptions ?? self.defaultCallOptions)
- }
- /// Asynchronous server-streaming call to StreamingOutputCall.
- ///
- /// - Parameters:
- /// - request: Request to send to StreamingOutputCall.
- /// - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
- /// - 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: self.path(forMethod: "StreamingOutputCall"),
- request: request,
- callOptions: callOptions ?? self.defaultCallOptions,
- handler: handler)
- }
- /// Asynchronous client-streaming call to StreamingInputCall.
- ///
- /// 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; `self.defaultCallOptions` is used if `nil`.
- /// - 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: self.path(forMethod: "StreamingInputCall"),
- callOptions: callOptions ?? self.defaultCallOptions)
- }
- /// Asynchronous bidirectional-streaming call to FullDuplexCall.
- ///
- /// 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; `self.defaultCallOptions` is used if `nil`.
- /// - 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: self.path(forMethod: "FullDuplexCall"),
- callOptions: callOptions ?? self.defaultCallOptions,
- handler: handler)
- }
- /// Asynchronous bidirectional-streaming call to HalfDuplexCall.
- ///
- /// 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; `self.defaultCallOptions` is used if `nil`.
- /// - 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: self.path(forMethod: "HalfDuplexCall"),
- callOptions: callOptions ?? self.defaultCallOptions,
- handler: handler)
- }
- /// Asynchronous unary call to UnimplementedCall.
- ///
- /// - Parameters:
- /// - request: Request to send to UnimplementedCall.
- /// - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
- /// - 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: self.path(forMethod: "UnimplementedCall"),
- request: request,
- callOptions: callOptions ?? self.defaultCallOptions)
- }
- }
- /// Usage: instantiate Grpc_Testing_UnimplementedServiceServiceClient, then call methods of this protocol to make API calls.
- public protocol Grpc_Testing_UnimplementedServiceService {
- func unimplementedCall(_ request: Grpc_Testing_Empty, callOptions: CallOptions?) -> UnaryCall<Grpc_Testing_Empty, Grpc_Testing_Empty>
- }
- public final class Grpc_Testing_UnimplementedServiceServiceClient: GRPCServiceClient, Grpc_Testing_UnimplementedServiceService {
- public let connection: ClientConnection
- public var serviceName: String { return "grpc.testing.UnimplementedService" }
- public var defaultCallOptions: CallOptions
- /// Creates a client for the grpc.testing.UnimplementedService service.
- ///
- /// - Parameters:
- /// - connection: `ClientConnection` to the service host.
- /// - defaultCallOptions: Options to use for each service call if the user doesn't provide them.
- public init(connection: ClientConnection, defaultCallOptions: CallOptions = CallOptions()) {
- self.connection = connection
- self.defaultCallOptions = defaultCallOptions
- }
- /// Asynchronous unary call to UnimplementedCall.
- ///
- /// - Parameters:
- /// - request: Request to send to UnimplementedCall.
- /// - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
- /// - 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: self.path(forMethod: "UnimplementedCall"),
- request: request,
- callOptions: callOptions ?? self.defaultCallOptions)
- }
- }
- /// Usage: instantiate Grpc_Testing_ReconnectServiceServiceClient, then call methods of this protocol to make API calls.
- public protocol Grpc_Testing_ReconnectServiceService {
- 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>
- }
- public final class Grpc_Testing_ReconnectServiceServiceClient: GRPCServiceClient, Grpc_Testing_ReconnectServiceService {
- public let connection: ClientConnection
- public var serviceName: String { return "grpc.testing.ReconnectService" }
- public var defaultCallOptions: CallOptions
- /// Creates a client for the grpc.testing.ReconnectService service.
- ///
- /// - Parameters:
- /// - connection: `ClientConnection` to the service host.
- /// - defaultCallOptions: Options to use for each service call if the user doesn't provide them.
- public init(connection: ClientConnection, defaultCallOptions: CallOptions = CallOptions()) {
- self.connection = connection
- self.defaultCallOptions = defaultCallOptions
- }
- /// Asynchronous unary call to Start.
- ///
- /// - Parameters:
- /// - request: Request to send to Start.
- /// - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
- /// - 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: self.path(forMethod: "Start"),
- request: request,
- callOptions: callOptions ?? self.defaultCallOptions)
- }
- /// Asynchronous unary call to Stop.
- ///
- /// - Parameters:
- /// - request: Request to send to Stop.
- /// - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
- /// - 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: self.path(forMethod: "Stop"),
- request: request,
- callOptions: callOptions ?? self.defaultCallOptions)
- }
- }
- /// To build a server, implement a class that conforms to this protocol.
- public protocol Grpc_Testing_TestServiceProvider: CallHandlerProvider {
- func emptyCall(request: Grpc_Testing_Empty, context: StatusOnlyCallContext) -> EventLoopFuture<Grpc_Testing_Empty>
- func unaryCall(request: Grpc_Testing_SimpleRequest, context: StatusOnlyCallContext) -> EventLoopFuture<Grpc_Testing_SimpleResponse>
- func cacheableUnaryCall(request: Grpc_Testing_SimpleRequest, context: StatusOnlyCallContext) -> EventLoopFuture<Grpc_Testing_SimpleResponse>
- func streamingOutputCall(request: Grpc_Testing_StreamingOutputCallRequest, context: StreamingResponseCallContext<Grpc_Testing_StreamingOutputCallResponse>) -> EventLoopFuture<GRPCStatus>
- func streamingInputCall(context: UnaryResponseCallContext<Grpc_Testing_StreamingInputCallResponse>) -> EventLoopFuture<(StreamEvent<Grpc_Testing_StreamingInputCallRequest>) -> Void>
- func fullDuplexCall(context: StreamingResponseCallContext<Grpc_Testing_StreamingOutputCallResponse>) -> EventLoopFuture<(StreamEvent<Grpc_Testing_StreamingOutputCallRequest>) -> Void>
- func halfDuplexCall(context: StreamingResponseCallContext<Grpc_Testing_StreamingOutputCallResponse>) -> EventLoopFuture<(StreamEvent<Grpc_Testing_StreamingOutputCallRequest>) -> Void>
- }
- extension Grpc_Testing_TestServiceProvider {
- public var serviceName: String { 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: String, request: HTTPRequestHead, channel: Channel, errorDelegate: ServerErrorDelegate?) -> GRPCCallHandler? {
- switch methodName {
- case "EmptyCall":
- return UnaryCallHandler(channel: channel, request: request, errorDelegate: errorDelegate) { context in
- return { request in
- self.emptyCall(request: request, context: context)
- }
- }
- case "UnaryCall":
- return UnaryCallHandler(channel: channel, request: request, errorDelegate: errorDelegate) { context in
- return { request in
- self.unaryCall(request: request, context: context)
- }
- }
- case "CacheableUnaryCall":
- return UnaryCallHandler(channel: channel, request: request, errorDelegate: errorDelegate) { context in
- return { request in
- self.cacheableUnaryCall(request: request, context: context)
- }
- }
- case "StreamingOutputCall":
- return ServerStreamingCallHandler(channel: channel, request: request, errorDelegate: errorDelegate) { context in
- return { request in
- self.streamingOutputCall(request: request, context: context)
- }
- }
- case "StreamingInputCall":
- return ClientStreamingCallHandler(channel: channel, request: request, errorDelegate: errorDelegate) { context in
- return self.streamingInputCall(context: context)
- }
- case "FullDuplexCall":
- return BidirectionalStreamingCallHandler(channel: channel, request: request, errorDelegate: errorDelegate) { context in
- return self.fullDuplexCall(context: context)
- }
- case "HalfDuplexCall":
- return BidirectionalStreamingCallHandler(channel: channel, request: request, errorDelegate: errorDelegate) { context in
- return self.halfDuplexCall(context: context)
- }
- default: return nil
- }
- }
- }
- /// To build a server, implement a class that conforms to this protocol.
- public protocol Grpc_Testing_UnimplementedServiceProvider: CallHandlerProvider {
- func unimplementedCall(request: Grpc_Testing_Empty, context: StatusOnlyCallContext) -> EventLoopFuture<Grpc_Testing_Empty>
- }
- extension Grpc_Testing_UnimplementedServiceProvider {
- public var serviceName: String { 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: String, request: HTTPRequestHead, channel: Channel, errorDelegate: ServerErrorDelegate?) -> GRPCCallHandler? {
- switch methodName {
- case "UnimplementedCall":
- return UnaryCallHandler(channel: channel, request: request, errorDelegate: errorDelegate) { context in
- return { request in
- self.unimplementedCall(request: request, context: context)
- }
- }
- default: return nil
- }
- }
- }
- /// To build a server, implement a class that conforms to this protocol.
- public protocol Grpc_Testing_ReconnectServiceProvider: CallHandlerProvider {
- 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: String { 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: String, request: HTTPRequestHead, channel: Channel, errorDelegate: ServerErrorDelegate?) -> GRPCCallHandler? {
- switch methodName {
- case "Start":
- return UnaryCallHandler(channel: channel, request: request, errorDelegate: errorDelegate) { context in
- return { request in
- self.start(request: request, context: context)
- }
- }
- case "Stop":
- return UnaryCallHandler(channel: channel, request: request, errorDelegate: errorDelegate) { context in
- return { request in
- self.stop(request: request, context: context)
- }
- }
- default: return nil
- }
- }
- }
|