| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- //
- // DO NOT EDIT.
- //
- // Generated by the protocol buffer compiler.
- // Source: 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 GRPC
- import NIO
- import NIOHTTP1
- import SwiftProtobuf
- internal final class Codegentest_FooTestClient: Codegentest_FooClientProtocol {
- private let fakeChannel: FakeChannel
- internal var defaultCallOptions: CallOptions
- internal var channel: GRPCChannel {
- return self.fakeChannel
- }
- internal init(
- fakeChannel: FakeChannel = FakeChannel(),
- defaultCallOptions callOptions: CallOptions = CallOptions()
- ) {
- self.fakeChannel = fakeChannel
- self.defaultCallOptions = callOptions
- }
- /// Make a unary response for the Bar RPC. This must be called
- /// before calling 'bar'. See also 'FakeUnaryResponse'.
- ///
- /// - Parameter requestHandler: a handler for request parts sent by the RPC.
- internal func makeBarResponseStream(
- _ requestHandler: @escaping (FakeRequestPart<Codegentest_BarRequest>) -> () = { _ in }
- ) -> FakeUnaryResponse<Codegentest_BarRequest, Codegentest_BarResponse> {
- return self.fakeChannel.makeFakeUnaryResponse(path: "/codegentest.Foo/Bar", requestHandler: requestHandler)
- }
- internal func enqueueBarResponse(
- _ response: Codegentest_BarResponse,
- _ requestHandler: @escaping (FakeRequestPart<Codegentest_BarRequest>) -> () = { _ in }
- ) {
- let stream = self.makeBarResponseStream(requestHandler)
- // This is the only operation on the stream; try! is fine.
- try! stream.sendMessage(response)
- }
- /// Returns true if there are response streams enqueued for 'Bar'
- internal var hasBarResponsesRemaining: Bool {
- return self.fakeChannel.hasFakeResponseEnqueued(forPath: "/codegentest.Foo/Bar")
- }
- }
|