|
|
@@ -28,24 +28,24 @@ import SwiftProtobuf
|
|
|
|
|
|
|
|
|
/// Usage: instantiate Echo_EchoServiceClient, then call methods of this protocol to make API calls.
|
|
|
-internal protocol Echo_EchoService {
|
|
|
+public protocol Echo_EchoService {
|
|
|
func get(_ request: Echo_EchoRequest, callOptions: CallOptions?) -> UnaryCall<Echo_EchoRequest, Echo_EchoResponse>
|
|
|
func expand(_ request: Echo_EchoRequest, callOptions: CallOptions?, handler: @escaping (Echo_EchoResponse) -> Void) -> ServerStreamingCall<Echo_EchoRequest, Echo_EchoResponse>
|
|
|
func collect(callOptions: CallOptions?) -> ClientStreamingCall<Echo_EchoRequest, Echo_EchoResponse>
|
|
|
func update(callOptions: CallOptions?, handler: @escaping (Echo_EchoResponse) -> Void) -> BidirectionalStreamingCall<Echo_EchoRequest, Echo_EchoResponse>
|
|
|
}
|
|
|
|
|
|
-internal final class Echo_EchoServiceClient: GRPCServiceClient, Echo_EchoService {
|
|
|
- internal let connection: ClientConnection
|
|
|
- internal var serviceName: String { return "echo.Echo" }
|
|
|
- internal var defaultCallOptions: CallOptions
|
|
|
+public final class Echo_EchoServiceClient: GRPCServiceClient, Echo_EchoService {
|
|
|
+ public let connection: ClientConnection
|
|
|
+ public var serviceName: String { return "echo.Echo" }
|
|
|
+ public var defaultCallOptions: CallOptions
|
|
|
|
|
|
/// Creates a client for the echo.Echo service.
|
|
|
///
|
|
|
/// - Parameters:
|
|
|
/// - connection: `ClientConnection` to the service host.
|
|
|
/// - defaultCallOptions: Options to use for each service call if the user doesn't provide them.
|
|
|
- internal init(connection: ClientConnection, defaultCallOptions: CallOptions = CallOptions()) {
|
|
|
+ public init(connection: ClientConnection, defaultCallOptions: CallOptions = CallOptions()) {
|
|
|
self.connection = connection
|
|
|
self.defaultCallOptions = defaultCallOptions
|
|
|
}
|
|
|
@@ -56,7 +56,7 @@ internal final class Echo_EchoServiceClient: GRPCServiceClient, Echo_EchoService
|
|
|
/// - request: Request to send to Get.
|
|
|
/// - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
|
|
|
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
|
|
|
- internal func get(_ request: Echo_EchoRequest, callOptions: CallOptions? = nil) -> UnaryCall<Echo_EchoRequest, Echo_EchoResponse> {
|
|
|
+ public func get(_ request: Echo_EchoRequest, callOptions: CallOptions? = nil) -> UnaryCall<Echo_EchoRequest, Echo_EchoResponse> {
|
|
|
return self.makeUnaryCall(path: self.path(forMethod: "Get"),
|
|
|
request: request,
|
|
|
callOptions: callOptions ?? self.defaultCallOptions)
|
|
|
@@ -69,7 +69,7 @@ internal final class Echo_EchoServiceClient: GRPCServiceClient, Echo_EchoService
|
|
|
/// - 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.
|
|
|
- internal func expand(_ request: Echo_EchoRequest, callOptions: CallOptions? = nil, handler: @escaping (Echo_EchoResponse) -> Void) -> ServerStreamingCall<Echo_EchoRequest, Echo_EchoResponse> {
|
|
|
+ public func expand(_ request: Echo_EchoRequest, callOptions: CallOptions? = nil, handler: @escaping (Echo_EchoResponse) -> Void) -> ServerStreamingCall<Echo_EchoRequest, Echo_EchoResponse> {
|
|
|
return self.makeServerStreamingCall(path: self.path(forMethod: "Expand"),
|
|
|
request: request,
|
|
|
callOptions: callOptions ?? self.defaultCallOptions,
|
|
|
@@ -84,7 +84,7 @@ internal final class Echo_EchoServiceClient: GRPCServiceClient, Echo_EchoService
|
|
|
/// - Parameters:
|
|
|
/// - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
|
|
|
/// - Returns: A `ClientStreamingCall` with futures for the metadata, status and response.
|
|
|
- internal func collect(callOptions: CallOptions? = nil) -> ClientStreamingCall<Echo_EchoRequest, Echo_EchoResponse> {
|
|
|
+ public func collect(callOptions: CallOptions? = nil) -> ClientStreamingCall<Echo_EchoRequest, Echo_EchoResponse> {
|
|
|
return self.makeClientStreamingCall(path: self.path(forMethod: "Collect"),
|
|
|
callOptions: callOptions ?? self.defaultCallOptions)
|
|
|
}
|
|
|
@@ -98,7 +98,7 @@ internal final class Echo_EchoServiceClient: GRPCServiceClient, Echo_EchoService
|
|
|
/// - 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.
|
|
|
- internal func update(callOptions: CallOptions? = nil, handler: @escaping (Echo_EchoResponse) -> Void) -> BidirectionalStreamingCall<Echo_EchoRequest, Echo_EchoResponse> {
|
|
|
+ public func update(callOptions: CallOptions? = nil, handler: @escaping (Echo_EchoResponse) -> Void) -> BidirectionalStreamingCall<Echo_EchoRequest, Echo_EchoResponse> {
|
|
|
return self.makeBidirectionalStreamingCall(path: self.path(forMethod: "Update"),
|
|
|
callOptions: callOptions ?? self.defaultCallOptions,
|
|
|
handler: handler)
|
|
|
@@ -107,7 +107,7 @@ internal final class Echo_EchoServiceClient: GRPCServiceClient, Echo_EchoService
|
|
|
}
|
|
|
|
|
|
/// To build a server, implement a class that conforms to this protocol.
|
|
|
-internal protocol Echo_EchoProvider: CallHandlerProvider {
|
|
|
+public protocol Echo_EchoProvider: CallHandlerProvider {
|
|
|
func get(request: Echo_EchoRequest, context: StatusOnlyCallContext) -> EventLoopFuture<Echo_EchoResponse>
|
|
|
func expand(request: Echo_EchoRequest, context: StreamingResponseCallContext<Echo_EchoResponse>) -> EventLoopFuture<GRPCStatus>
|
|
|
func collect(context: UnaryResponseCallContext<Echo_EchoResponse>) -> EventLoopFuture<(StreamEvent<Echo_EchoRequest>) -> Void>
|
|
|
@@ -115,11 +115,11 @@ internal protocol Echo_EchoProvider: CallHandlerProvider {
|
|
|
}
|
|
|
|
|
|
extension Echo_EchoProvider {
|
|
|
- internal var serviceName: String { return "echo.Echo" }
|
|
|
+ public var serviceName: String { return "echo.Echo" }
|
|
|
|
|
|
/// 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 handleMethod(_ methodName: String, callHandlerContext: CallHandlerContext) -> GRPCCallHandler? {
|
|
|
+ public func handleMethod(_ methodName: String, callHandlerContext: CallHandlerContext) -> GRPCCallHandler? {
|
|
|
switch methodName {
|
|
|
case "Get":
|
|
|
return UnaryCallHandler(callHandlerContext: callHandlerContext) { context in
|