echo.grpc.swift 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  1. //
  2. // DO NOT EDIT.
  3. //
  4. // Generated by the protocol buffer compiler.
  5. // Source: echo.proto
  6. //
  7. //
  8. // Copyright 2018, gRPC Authors All rights reserved.
  9. //
  10. // Licensed under the Apache License, Version 2.0 (the "License");
  11. // you may not use this file except in compliance with the License.
  12. // You may obtain a copy of the License at
  13. //
  14. // http://www.apache.org/licenses/LICENSE-2.0
  15. //
  16. // Unless required by applicable law or agreed to in writing, software
  17. // distributed under the License is distributed on an "AS IS" BASIS,
  18. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  19. // See the License for the specific language governing permissions and
  20. // limitations under the License.
  21. //
  22. import GRPC
  23. import NIO
  24. import SwiftProtobuf
  25. /// Usage: instantiate `Echo_EchoClient`, then call methods of this protocol to make API calls.
  26. public protocol Echo_EchoClientProtocol: GRPCClient {
  27. var serviceName: String { get }
  28. var interceptors: Echo_EchoClientInterceptorFactoryProtocol? { get }
  29. func get(
  30. _ request: Echo_EchoRequest,
  31. callOptions: CallOptions?
  32. ) -> UnaryCall<Echo_EchoRequest, Echo_EchoResponse>
  33. func expand(
  34. _ request: Echo_EchoRequest,
  35. callOptions: CallOptions?,
  36. handler: @escaping (Echo_EchoResponse) -> Void
  37. ) -> ServerStreamingCall<Echo_EchoRequest, Echo_EchoResponse>
  38. func collect(
  39. callOptions: CallOptions?
  40. ) -> ClientStreamingCall<Echo_EchoRequest, Echo_EchoResponse>
  41. func update(
  42. callOptions: CallOptions?,
  43. handler: @escaping (Echo_EchoResponse) -> Void
  44. ) -> BidirectionalStreamingCall<Echo_EchoRequest, Echo_EchoResponse>
  45. }
  46. extension Echo_EchoClientProtocol {
  47. public var serviceName: String {
  48. return "echo.Echo"
  49. }
  50. /// Immediately returns an echo of a request.
  51. ///
  52. /// - Parameters:
  53. /// - request: Request to send to Get.
  54. /// - callOptions: Call options.
  55. /// - Returns: A `UnaryCall` with futures for the metadata, status and response.
  56. public func get(
  57. _ request: Echo_EchoRequest,
  58. callOptions: CallOptions? = nil
  59. ) -> UnaryCall<Echo_EchoRequest, Echo_EchoResponse> {
  60. return self.makeUnaryCall(
  61. path: "/echo.Echo/Get",
  62. request: request,
  63. callOptions: callOptions ?? self.defaultCallOptions,
  64. interceptors: self.interceptors?.makeGetInterceptors() ?? []
  65. )
  66. }
  67. /// Splits a request into words and returns each word in a stream of messages.
  68. ///
  69. /// - Parameters:
  70. /// - request: Request to send to Expand.
  71. /// - callOptions: Call options.
  72. /// - handler: A closure called when each response is received from the server.
  73. /// - Returns: A `ServerStreamingCall` with futures for the metadata and status.
  74. public func expand(
  75. _ request: Echo_EchoRequest,
  76. callOptions: CallOptions? = nil,
  77. handler: @escaping (Echo_EchoResponse) -> Void
  78. ) -> ServerStreamingCall<Echo_EchoRequest, Echo_EchoResponse> {
  79. return self.makeServerStreamingCall(
  80. path: "/echo.Echo/Expand",
  81. request: request,
  82. callOptions: callOptions ?? self.defaultCallOptions,
  83. interceptors: self.interceptors?.makeExpandInterceptors() ?? [],
  84. handler: handler
  85. )
  86. }
  87. /// Collects a stream of messages and returns them concatenated when the caller closes.
  88. ///
  89. /// Callers should use the `send` method on the returned object to send messages
  90. /// to the server. The caller should send an `.end` after the final message has been sent.
  91. ///
  92. /// - Parameters:
  93. /// - callOptions: Call options.
  94. /// - Returns: A `ClientStreamingCall` with futures for the metadata, status and response.
  95. public func collect(
  96. callOptions: CallOptions? = nil
  97. ) -> ClientStreamingCall<Echo_EchoRequest, Echo_EchoResponse> {
  98. return self.makeClientStreamingCall(
  99. path: "/echo.Echo/Collect",
  100. callOptions: callOptions ?? self.defaultCallOptions,
  101. interceptors: self.interceptors?.makeCollectInterceptors() ?? []
  102. )
  103. }
  104. /// Streams back messages as they are received in an input stream.
  105. ///
  106. /// Callers should use the `send` method on the returned object to send messages
  107. /// to the server. The caller should send an `.end` after the final message has been sent.
  108. ///
  109. /// - Parameters:
  110. /// - callOptions: Call options.
  111. /// - handler: A closure called when each response is received from the server.
  112. /// - Returns: A `ClientStreamingCall` with futures for the metadata and status.
  113. public func update(
  114. callOptions: CallOptions? = nil,
  115. handler: @escaping (Echo_EchoResponse) -> Void
  116. ) -> BidirectionalStreamingCall<Echo_EchoRequest, Echo_EchoResponse> {
  117. return self.makeBidirectionalStreamingCall(
  118. path: "/echo.Echo/Update",
  119. callOptions: callOptions ?? self.defaultCallOptions,
  120. interceptors: self.interceptors?.makeUpdateInterceptors() ?? [],
  121. handler: handler
  122. )
  123. }
  124. }
  125. public protocol Echo_EchoClientInterceptorFactoryProtocol {
  126. /// - Returns: Interceptors to use when invoking 'get'.
  127. func makeGetInterceptors() -> [ClientInterceptor<Echo_EchoRequest, Echo_EchoResponse>]
  128. /// - Returns: Interceptors to use when invoking 'expand'.
  129. func makeExpandInterceptors() -> [ClientInterceptor<Echo_EchoRequest, Echo_EchoResponse>]
  130. /// - Returns: Interceptors to use when invoking 'collect'.
  131. func makeCollectInterceptors() -> [ClientInterceptor<Echo_EchoRequest, Echo_EchoResponse>]
  132. /// - Returns: Interceptors to use when invoking 'update'.
  133. func makeUpdateInterceptors() -> [ClientInterceptor<Echo_EchoRequest, Echo_EchoResponse>]
  134. }
  135. public final class Echo_EchoClient: Echo_EchoClientProtocol {
  136. public let channel: GRPCChannel
  137. public var defaultCallOptions: CallOptions
  138. public var interceptors: Echo_EchoClientInterceptorFactoryProtocol?
  139. /// Creates a client for the echo.Echo service.
  140. ///
  141. /// - Parameters:
  142. /// - channel: `GRPCChannel` to the service host.
  143. /// - defaultCallOptions: Options to use for each service call if the user doesn't provide them.
  144. /// - interceptors: A factory providing interceptors for each RPC.
  145. public init(
  146. channel: GRPCChannel,
  147. defaultCallOptions: CallOptions = CallOptions(),
  148. interceptors: Echo_EchoClientInterceptorFactoryProtocol? = nil
  149. ) {
  150. self.channel = channel
  151. self.defaultCallOptions = defaultCallOptions
  152. self.interceptors = interceptors
  153. }
  154. }
  155. #if compiler(>=5.5)
  156. @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)
  157. public protocol Echo_EchoAsyncClientProtocol: GRPCClient {
  158. var serviceName: String { get }
  159. var interceptors: Echo_EchoClientInterceptorFactoryProtocol? { get }
  160. func makeGetCall(
  161. _ request: Echo_EchoRequest,
  162. callOptions: CallOptions?
  163. ) -> GRPCAsyncUnaryCall<Echo_EchoRequest, Echo_EchoResponse>
  164. func makeExpandCall(
  165. _ request: Echo_EchoRequest,
  166. callOptions: CallOptions?
  167. ) -> GRPCAsyncServerStreamingCall<Echo_EchoRequest, Echo_EchoResponse>
  168. func makeCollectCall(
  169. callOptions: CallOptions?
  170. ) -> GRPCAsyncClientStreamingCall<Echo_EchoRequest, Echo_EchoResponse>
  171. func makeUpdateCall(
  172. callOptions: CallOptions?
  173. ) -> GRPCAsyncBidirectionalStreamingCall<Echo_EchoRequest, Echo_EchoResponse>
  174. }
  175. @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)
  176. extension Echo_EchoAsyncClientProtocol {
  177. public var serviceName: String {
  178. return "echo.Echo"
  179. }
  180. public var interceptors: Echo_EchoClientInterceptorFactoryProtocol? {
  181. return nil
  182. }
  183. public func makeGetCall(
  184. _ request: Echo_EchoRequest,
  185. callOptions: CallOptions? = nil
  186. ) -> GRPCAsyncUnaryCall<Echo_EchoRequest, Echo_EchoResponse> {
  187. return self.makeAsyncUnaryCall(
  188. path: "/echo.Echo/Get",
  189. request: request,
  190. callOptions: callOptions ?? self.defaultCallOptions
  191. )
  192. }
  193. public func makeExpandCall(
  194. _ request: Echo_EchoRequest,
  195. callOptions: CallOptions? = nil
  196. ) -> GRPCAsyncServerStreamingCall<Echo_EchoRequest, Echo_EchoResponse> {
  197. return self.makeAsyncServerStreamingCall(
  198. path: "/echo.Echo/Expand",
  199. request: request,
  200. callOptions: callOptions ?? self.defaultCallOptions
  201. )
  202. }
  203. public func makeCollectCall(
  204. callOptions: CallOptions? = nil
  205. ) -> GRPCAsyncClientStreamingCall<Echo_EchoRequest, Echo_EchoResponse> {
  206. return self.makeAsyncClientStreamingCall(
  207. path: "/echo.Echo/Collect",
  208. callOptions: callOptions ?? self.defaultCallOptions
  209. )
  210. }
  211. public func makeUpdateCall(
  212. callOptions: CallOptions? = nil
  213. ) -> GRPCAsyncBidirectionalStreamingCall<Echo_EchoRequest, Echo_EchoResponse> {
  214. return self.makeAsyncBidirectionalStreamingCall(
  215. path: "/echo.Echo/Update",
  216. callOptions: callOptions ?? self.defaultCallOptions
  217. )
  218. }
  219. }
  220. @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)
  221. public struct Echo_EchoAsyncClient: Echo_EchoAsyncClientProtocol {
  222. public var channel: GRPCChannel
  223. public var defaultCallOptions: CallOptions
  224. public var interceptors: Echo_EchoClientInterceptorFactoryProtocol?
  225. public init(
  226. channel: GRPCChannel,
  227. defaultCallOptions: CallOptions = CallOptions(),
  228. interceptors: Echo_EchoClientInterceptorFactoryProtocol? = nil
  229. ) {
  230. self.channel = channel
  231. self.defaultCallOptions = defaultCallOptions
  232. self.interceptors = interceptors
  233. }
  234. }
  235. #endif // compiler(>=5.5)
  236. public final class Echo_EchoTestClient: Echo_EchoClientProtocol {
  237. private let fakeChannel: FakeChannel
  238. public var defaultCallOptions: CallOptions
  239. public var interceptors: Echo_EchoClientInterceptorFactoryProtocol?
  240. public var channel: GRPCChannel {
  241. return self.fakeChannel
  242. }
  243. public init(
  244. fakeChannel: FakeChannel = FakeChannel(),
  245. defaultCallOptions callOptions: CallOptions = CallOptions(),
  246. interceptors: Echo_EchoClientInterceptorFactoryProtocol? = nil
  247. ) {
  248. self.fakeChannel = fakeChannel
  249. self.defaultCallOptions = callOptions
  250. self.interceptors = interceptors
  251. }
  252. /// Make a unary response for the Get RPC. This must be called
  253. /// before calling 'get'. See also 'FakeUnaryResponse'.
  254. ///
  255. /// - Parameter requestHandler: a handler for request parts sent by the RPC.
  256. public func makeGetResponseStream(
  257. _ requestHandler: @escaping (FakeRequestPart<Echo_EchoRequest>) -> () = { _ in }
  258. ) -> FakeUnaryResponse<Echo_EchoRequest, Echo_EchoResponse> {
  259. return self.fakeChannel.makeFakeUnaryResponse(path: "/echo.Echo/Get", requestHandler: requestHandler)
  260. }
  261. public func enqueueGetResponse(
  262. _ response: Echo_EchoResponse,
  263. _ requestHandler: @escaping (FakeRequestPart<Echo_EchoRequest>) -> () = { _ in }
  264. ) {
  265. let stream = self.makeGetResponseStream(requestHandler)
  266. // This is the only operation on the stream; try! is fine.
  267. try! stream.sendMessage(response)
  268. }
  269. /// Returns true if there are response streams enqueued for 'Get'
  270. public var hasGetResponsesRemaining: Bool {
  271. return self.fakeChannel.hasFakeResponseEnqueued(forPath: "/echo.Echo/Get")
  272. }
  273. /// Make a streaming response for the Expand RPC. This must be called
  274. /// before calling 'expand'. See also 'FakeStreamingResponse'.
  275. ///
  276. /// - Parameter requestHandler: a handler for request parts sent by the RPC.
  277. public func makeExpandResponseStream(
  278. _ requestHandler: @escaping (FakeRequestPart<Echo_EchoRequest>) -> () = { _ in }
  279. ) -> FakeStreamingResponse<Echo_EchoRequest, Echo_EchoResponse> {
  280. return self.fakeChannel.makeFakeStreamingResponse(path: "/echo.Echo/Expand", requestHandler: requestHandler)
  281. }
  282. public func enqueueExpandResponses(
  283. _ responses: [Echo_EchoResponse],
  284. _ requestHandler: @escaping (FakeRequestPart<Echo_EchoRequest>) -> () = { _ in }
  285. ) {
  286. let stream = self.makeExpandResponseStream(requestHandler)
  287. // These are the only operation on the stream; try! is fine.
  288. responses.forEach { try! stream.sendMessage($0) }
  289. try! stream.sendEnd()
  290. }
  291. /// Returns true if there are response streams enqueued for 'Expand'
  292. public var hasExpandResponsesRemaining: Bool {
  293. return self.fakeChannel.hasFakeResponseEnqueued(forPath: "/echo.Echo/Expand")
  294. }
  295. /// Make a unary response for the Collect RPC. This must be called
  296. /// before calling 'collect'. See also 'FakeUnaryResponse'.
  297. ///
  298. /// - Parameter requestHandler: a handler for request parts sent by the RPC.
  299. public func makeCollectResponseStream(
  300. _ requestHandler: @escaping (FakeRequestPart<Echo_EchoRequest>) -> () = { _ in }
  301. ) -> FakeUnaryResponse<Echo_EchoRequest, Echo_EchoResponse> {
  302. return self.fakeChannel.makeFakeUnaryResponse(path: "/echo.Echo/Collect", requestHandler: requestHandler)
  303. }
  304. public func enqueueCollectResponse(
  305. _ response: Echo_EchoResponse,
  306. _ requestHandler: @escaping (FakeRequestPart<Echo_EchoRequest>) -> () = { _ in }
  307. ) {
  308. let stream = self.makeCollectResponseStream(requestHandler)
  309. // This is the only operation on the stream; try! is fine.
  310. try! stream.sendMessage(response)
  311. }
  312. /// Returns true if there are response streams enqueued for 'Collect'
  313. public var hasCollectResponsesRemaining: Bool {
  314. return self.fakeChannel.hasFakeResponseEnqueued(forPath: "/echo.Echo/Collect")
  315. }
  316. /// Make a streaming response for the Update RPC. This must be called
  317. /// before calling 'update'. See also 'FakeStreamingResponse'.
  318. ///
  319. /// - Parameter requestHandler: a handler for request parts sent by the RPC.
  320. public func makeUpdateResponseStream(
  321. _ requestHandler: @escaping (FakeRequestPart<Echo_EchoRequest>) -> () = { _ in }
  322. ) -> FakeStreamingResponse<Echo_EchoRequest, Echo_EchoResponse> {
  323. return self.fakeChannel.makeFakeStreamingResponse(path: "/echo.Echo/Update", requestHandler: requestHandler)
  324. }
  325. public func enqueueUpdateResponses(
  326. _ responses: [Echo_EchoResponse],
  327. _ requestHandler: @escaping (FakeRequestPart<Echo_EchoRequest>) -> () = { _ in }
  328. ) {
  329. let stream = self.makeUpdateResponseStream(requestHandler)
  330. // These are the only operation on the stream; try! is fine.
  331. responses.forEach { try! stream.sendMessage($0) }
  332. try! stream.sendEnd()
  333. }
  334. /// Returns true if there are response streams enqueued for 'Update'
  335. public var hasUpdateResponsesRemaining: Bool {
  336. return self.fakeChannel.hasFakeResponseEnqueued(forPath: "/echo.Echo/Update")
  337. }
  338. }
  339. /// To build a server, implement a class that conforms to this protocol.
  340. public protocol Echo_EchoProvider: CallHandlerProvider {
  341. var interceptors: Echo_EchoServerInterceptorFactoryProtocol? { get }
  342. /// Immediately returns an echo of a request.
  343. func get(request: Echo_EchoRequest, context: StatusOnlyCallContext) -> EventLoopFuture<Echo_EchoResponse>
  344. /// Splits a request into words and returns each word in a stream of messages.
  345. func expand(request: Echo_EchoRequest, context: StreamingResponseCallContext<Echo_EchoResponse>) -> EventLoopFuture<GRPCStatus>
  346. /// Collects a stream of messages and returns them concatenated when the caller closes.
  347. func collect(context: UnaryResponseCallContext<Echo_EchoResponse>) -> EventLoopFuture<(StreamEvent<Echo_EchoRequest>) -> Void>
  348. /// Streams back messages as they are received in an input stream.
  349. func update(context: StreamingResponseCallContext<Echo_EchoResponse>) -> EventLoopFuture<(StreamEvent<Echo_EchoRequest>) -> Void>
  350. }
  351. extension Echo_EchoProvider {
  352. public var serviceName: Substring { return "echo.Echo" }
  353. /// Determines, calls and returns the appropriate request handler, depending on the request's method.
  354. /// Returns nil for methods not handled by this service.
  355. public func handle(
  356. method name: Substring,
  357. context: CallHandlerContext
  358. ) -> GRPCServerHandlerProtocol? {
  359. switch name {
  360. case "Get":
  361. return UnaryServerHandler(
  362. context: context,
  363. requestDeserializer: ProtobufDeserializer<Echo_EchoRequest>(),
  364. responseSerializer: ProtobufSerializer<Echo_EchoResponse>(),
  365. interceptors: self.interceptors?.makeGetInterceptors() ?? [],
  366. userFunction: self.get(request:context:)
  367. )
  368. case "Expand":
  369. return ServerStreamingServerHandler(
  370. context: context,
  371. requestDeserializer: ProtobufDeserializer<Echo_EchoRequest>(),
  372. responseSerializer: ProtobufSerializer<Echo_EchoResponse>(),
  373. interceptors: self.interceptors?.makeExpandInterceptors() ?? [],
  374. userFunction: self.expand(request:context:)
  375. )
  376. case "Collect":
  377. return ClientStreamingServerHandler(
  378. context: context,
  379. requestDeserializer: ProtobufDeserializer<Echo_EchoRequest>(),
  380. responseSerializer: ProtobufSerializer<Echo_EchoResponse>(),
  381. interceptors: self.interceptors?.makeCollectInterceptors() ?? [],
  382. observerFactory: self.collect(context:)
  383. )
  384. case "Update":
  385. return BidirectionalStreamingServerHandler(
  386. context: context,
  387. requestDeserializer: ProtobufDeserializer<Echo_EchoRequest>(),
  388. responseSerializer: ProtobufSerializer<Echo_EchoResponse>(),
  389. interceptors: self.interceptors?.makeUpdateInterceptors() ?? [],
  390. observerFactory: self.update(context:)
  391. )
  392. default:
  393. return nil
  394. }
  395. }
  396. }
  397. public protocol Echo_EchoServerInterceptorFactoryProtocol {
  398. /// - Returns: Interceptors to use when handling 'get'.
  399. /// Defaults to calling `self.makeInterceptors()`.
  400. func makeGetInterceptors() -> [ServerInterceptor<Echo_EchoRequest, Echo_EchoResponse>]
  401. /// - Returns: Interceptors to use when handling 'expand'.
  402. /// Defaults to calling `self.makeInterceptors()`.
  403. func makeExpandInterceptors() -> [ServerInterceptor<Echo_EchoRequest, Echo_EchoResponse>]
  404. /// - Returns: Interceptors to use when handling 'collect'.
  405. /// Defaults to calling `self.makeInterceptors()`.
  406. func makeCollectInterceptors() -> [ServerInterceptor<Echo_EchoRequest, Echo_EchoResponse>]
  407. /// - Returns: Interceptors to use when handling 'update'.
  408. /// Defaults to calling `self.makeInterceptors()`.
  409. func makeUpdateInterceptors() -> [ServerInterceptor<Echo_EchoRequest, Echo_EchoResponse>]
  410. }
  411. #if compiler(>=5.5)
  412. /// To implement a server, implement an object which conforms to this protocol.
  413. @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)
  414. public protocol Echo_EchoAsyncProvider: CallHandlerProvider {
  415. var interceptors: Echo_EchoServerInterceptorFactoryProtocol? { get }
  416. /// Immediately returns an echo of a request.
  417. @Sendable func get(
  418. request: Echo_EchoRequest,
  419. context: GRPCAsyncServerCallContext
  420. ) async throws -> Echo_EchoResponse
  421. /// Splits a request into words and returns each word in a stream of messages.
  422. @Sendable func expand(
  423. request: Echo_EchoRequest,
  424. responseStream: GRPCAsyncResponseStreamWriter<Echo_EchoResponse>,
  425. context: GRPCAsyncServerCallContext
  426. ) async throws
  427. /// Collects a stream of messages and returns them concatenated when the caller closes.
  428. @Sendable func collect(
  429. requests: GRPCAsyncRequestStream<Echo_EchoRequest>,
  430. context: GRPCAsyncServerCallContext
  431. ) async throws -> Echo_EchoResponse
  432. /// Streams back messages as they are received in an input stream.
  433. @Sendable func update(
  434. requests: GRPCAsyncRequestStream<Echo_EchoRequest>,
  435. responseStream: GRPCAsyncResponseStreamWriter<Echo_EchoResponse>,
  436. context: GRPCAsyncServerCallContext
  437. ) async throws
  438. }
  439. @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)
  440. extension Echo_EchoAsyncProvider {
  441. public var serviceName: Substring {
  442. return "echo.Echo"
  443. }
  444. public var interceptors: Echo_EchoServerInterceptorFactoryProtocol? {
  445. return nil
  446. }
  447. public func handle(
  448. method name: Substring,
  449. context: CallHandlerContext
  450. ) -> GRPCServerHandlerProtocol? {
  451. switch name {
  452. case "Get":
  453. return GRPCAsyncServerHandler(
  454. context: context,
  455. requestDeserializer: ProtobufDeserializer<Echo_EchoRequest>(),
  456. responseSerializer: ProtobufSerializer<Echo_EchoResponse>(),
  457. interceptors: self.interceptors?.makeGetInterceptors() ?? [],
  458. wrapping: self.get(request:context:)
  459. )
  460. case "Expand":
  461. return GRPCAsyncServerHandler(
  462. context: context,
  463. requestDeserializer: ProtobufDeserializer<Echo_EchoRequest>(),
  464. responseSerializer: ProtobufSerializer<Echo_EchoResponse>(),
  465. interceptors: self.interceptors?.makeExpandInterceptors() ?? [],
  466. wrapping: self.expand(request:responseStream:context:)
  467. )
  468. case "Collect":
  469. return GRPCAsyncServerHandler(
  470. context: context,
  471. requestDeserializer: ProtobufDeserializer<Echo_EchoRequest>(),
  472. responseSerializer: ProtobufSerializer<Echo_EchoResponse>(),
  473. interceptors: self.interceptors?.makeCollectInterceptors() ?? [],
  474. wrapping: self.collect(requests:context:)
  475. )
  476. case "Update":
  477. return GRPCAsyncServerHandler(
  478. context: context,
  479. requestDeserializer: ProtobufDeserializer<Echo_EchoRequest>(),
  480. responseSerializer: ProtobufSerializer<Echo_EchoResponse>(),
  481. interceptors: self.interceptors?.makeUpdateInterceptors() ?? [],
  482. wrapping: self.update(requests:responseStream:context:)
  483. )
  484. default:
  485. return nil
  486. }
  487. }
  488. }
  489. #endif // compiler(>=5.5)