test.grpc.swift 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675
  1. //
  2. // DO NOT EDIT.
  3. //
  4. // Generated by the protocol buffer compiler.
  5. // Source: src/proto/grpc/testing/test.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 Grpc_Testing_TestServiceClient, then call methods of this protocol to make API calls.
  26. public protocol Grpc_Testing_TestServiceClientProtocol: GRPCClient {
  27. var interceptors: Grpc_Testing_TestServiceClientInterceptorFactoryProtocol? { get }
  28. func emptyCall(
  29. _ request: Grpc_Testing_Empty,
  30. callOptions: CallOptions?
  31. ) -> UnaryCall<Grpc_Testing_Empty, Grpc_Testing_Empty>
  32. func unaryCall(
  33. _ request: Grpc_Testing_SimpleRequest,
  34. callOptions: CallOptions?
  35. ) -> UnaryCall<Grpc_Testing_SimpleRequest, Grpc_Testing_SimpleResponse>
  36. func cacheableUnaryCall(
  37. _ request: Grpc_Testing_SimpleRequest,
  38. callOptions: CallOptions?
  39. ) -> UnaryCall<Grpc_Testing_SimpleRequest, Grpc_Testing_SimpleResponse>
  40. func streamingOutputCall(
  41. _ request: Grpc_Testing_StreamingOutputCallRequest,
  42. callOptions: CallOptions?,
  43. handler: @escaping (Grpc_Testing_StreamingOutputCallResponse) -> Void
  44. ) -> ServerStreamingCall<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse>
  45. func streamingInputCall(
  46. callOptions: CallOptions?
  47. ) -> ClientStreamingCall<Grpc_Testing_StreamingInputCallRequest, Grpc_Testing_StreamingInputCallResponse>
  48. func fullDuplexCall(
  49. callOptions: CallOptions?,
  50. handler: @escaping (Grpc_Testing_StreamingOutputCallResponse) -> Void
  51. ) -> BidirectionalStreamingCall<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse>
  52. func halfDuplexCall(
  53. callOptions: CallOptions?,
  54. handler: @escaping (Grpc_Testing_StreamingOutputCallResponse) -> Void
  55. ) -> BidirectionalStreamingCall<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse>
  56. func unimplementedCall(
  57. _ request: Grpc_Testing_Empty,
  58. callOptions: CallOptions?
  59. ) -> UnaryCall<Grpc_Testing_Empty, Grpc_Testing_Empty>
  60. }
  61. extension Grpc_Testing_TestServiceClientProtocol {
  62. /// One empty request followed by one empty response.
  63. ///
  64. /// - Parameters:
  65. /// - request: Request to send to EmptyCall.
  66. /// - callOptions: Call options.
  67. /// - Returns: A `UnaryCall` with futures for the metadata, status and response.
  68. public func emptyCall(
  69. _ request: Grpc_Testing_Empty,
  70. callOptions: CallOptions? = nil
  71. ) -> UnaryCall<Grpc_Testing_Empty, Grpc_Testing_Empty> {
  72. return self.makeUnaryCall(
  73. path: "/grpc.testing.TestService/EmptyCall",
  74. request: request,
  75. callOptions: callOptions ?? self.defaultCallOptions,
  76. interceptors: self.interceptors?.makeEmptyCallInterceptors() ?? []
  77. )
  78. }
  79. /// One request followed by one response.
  80. ///
  81. /// - Parameters:
  82. /// - request: Request to send to UnaryCall.
  83. /// - callOptions: Call options.
  84. /// - Returns: A `UnaryCall` with futures for the metadata, status and response.
  85. public func unaryCall(
  86. _ request: Grpc_Testing_SimpleRequest,
  87. callOptions: CallOptions? = nil
  88. ) -> UnaryCall<Grpc_Testing_SimpleRequest, Grpc_Testing_SimpleResponse> {
  89. return self.makeUnaryCall(
  90. path: "/grpc.testing.TestService/UnaryCall",
  91. request: request,
  92. callOptions: callOptions ?? self.defaultCallOptions,
  93. interceptors: self.interceptors?.makeUnaryCallInterceptors() ?? []
  94. )
  95. }
  96. /// One request followed by one response. Response has cache control
  97. /// headers set such that a caching HTTP proxy (such as GFE) can
  98. /// satisfy subsequent requests.
  99. ///
  100. /// - Parameters:
  101. /// - request: Request to send to CacheableUnaryCall.
  102. /// - callOptions: Call options.
  103. /// - Returns: A `UnaryCall` with futures for the metadata, status and response.
  104. public func cacheableUnaryCall(
  105. _ request: Grpc_Testing_SimpleRequest,
  106. callOptions: CallOptions? = nil
  107. ) -> UnaryCall<Grpc_Testing_SimpleRequest, Grpc_Testing_SimpleResponse> {
  108. return self.makeUnaryCall(
  109. path: "/grpc.testing.TestService/CacheableUnaryCall",
  110. request: request,
  111. callOptions: callOptions ?? self.defaultCallOptions,
  112. interceptors: self.interceptors?.makeCacheableUnaryCallInterceptors() ?? []
  113. )
  114. }
  115. /// One request followed by a sequence of responses (streamed download).
  116. /// The server returns the payload with client desired type and sizes.
  117. ///
  118. /// - Parameters:
  119. /// - request: Request to send to StreamingOutputCall.
  120. /// - callOptions: Call options.
  121. /// - handler: A closure called when each response is received from the server.
  122. /// - Returns: A `ServerStreamingCall` with futures for the metadata and status.
  123. public func streamingOutputCall(
  124. _ request: Grpc_Testing_StreamingOutputCallRequest,
  125. callOptions: CallOptions? = nil,
  126. handler: @escaping (Grpc_Testing_StreamingOutputCallResponse) -> Void
  127. ) -> ServerStreamingCall<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse> {
  128. return self.makeServerStreamingCall(
  129. path: "/grpc.testing.TestService/StreamingOutputCall",
  130. request: request,
  131. callOptions: callOptions ?? self.defaultCallOptions,
  132. interceptors: self.interceptors?.makeStreamingOutputCallInterceptors() ?? [],
  133. handler: handler
  134. )
  135. }
  136. /// A sequence of requests followed by one response (streamed upload).
  137. /// The server returns the aggregated size of client payload as the result.
  138. ///
  139. /// Callers should use the `send` method on the returned object to send messages
  140. /// to the server. The caller should send an `.end` after the final message has been sent.
  141. ///
  142. /// - Parameters:
  143. /// - callOptions: Call options.
  144. /// - Returns: A `ClientStreamingCall` with futures for the metadata, status and response.
  145. public func streamingInputCall(
  146. callOptions: CallOptions? = nil
  147. ) -> ClientStreamingCall<Grpc_Testing_StreamingInputCallRequest, Grpc_Testing_StreamingInputCallResponse> {
  148. return self.makeClientStreamingCall(
  149. path: "/grpc.testing.TestService/StreamingInputCall",
  150. callOptions: callOptions ?? self.defaultCallOptions,
  151. interceptors: self.interceptors?.makeStreamingInputCallInterceptors() ?? []
  152. )
  153. }
  154. /// A sequence of requests with each request served by the server immediately.
  155. /// As one request could lead to multiple responses, this interface
  156. /// demonstrates the idea of full duplexing.
  157. ///
  158. /// Callers should use the `send` method on the returned object to send messages
  159. /// to the server. The caller should send an `.end` after the final message has been sent.
  160. ///
  161. /// - Parameters:
  162. /// - callOptions: Call options.
  163. /// - handler: A closure called when each response is received from the server.
  164. /// - Returns: A `ClientStreamingCall` with futures for the metadata and status.
  165. public func fullDuplexCall(
  166. callOptions: CallOptions? = nil,
  167. handler: @escaping (Grpc_Testing_StreamingOutputCallResponse) -> Void
  168. ) -> BidirectionalStreamingCall<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse> {
  169. return self.makeBidirectionalStreamingCall(
  170. path: "/grpc.testing.TestService/FullDuplexCall",
  171. callOptions: callOptions ?? self.defaultCallOptions,
  172. interceptors: self.interceptors?.makeFullDuplexCallInterceptors() ?? [],
  173. handler: handler
  174. )
  175. }
  176. /// A sequence of requests followed by a sequence of responses.
  177. /// The server buffers all the client requests and then serves them in order. A
  178. /// stream of responses are returned to the client when the server starts with
  179. /// first request.
  180. ///
  181. /// Callers should use the `send` method on the returned object to send messages
  182. /// to the server. The caller should send an `.end` after the final message has been sent.
  183. ///
  184. /// - Parameters:
  185. /// - callOptions: Call options.
  186. /// - handler: A closure called when each response is received from the server.
  187. /// - Returns: A `ClientStreamingCall` with futures for the metadata and status.
  188. public func halfDuplexCall(
  189. callOptions: CallOptions? = nil,
  190. handler: @escaping (Grpc_Testing_StreamingOutputCallResponse) -> Void
  191. ) -> BidirectionalStreamingCall<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse> {
  192. return self.makeBidirectionalStreamingCall(
  193. path: "/grpc.testing.TestService/HalfDuplexCall",
  194. callOptions: callOptions ?? self.defaultCallOptions,
  195. interceptors: self.interceptors?.makeHalfDuplexCallInterceptors() ?? [],
  196. handler: handler
  197. )
  198. }
  199. /// The test server will not implement this method. It will be used
  200. /// to test the behavior when clients call unimplemented methods.
  201. ///
  202. /// - Parameters:
  203. /// - request: Request to send to UnimplementedCall.
  204. /// - callOptions: Call options.
  205. /// - Returns: A `UnaryCall` with futures for the metadata, status and response.
  206. public func unimplementedCall(
  207. _ request: Grpc_Testing_Empty,
  208. callOptions: CallOptions? = nil
  209. ) -> UnaryCall<Grpc_Testing_Empty, Grpc_Testing_Empty> {
  210. return self.makeUnaryCall(
  211. path: "/grpc.testing.TestService/UnimplementedCall",
  212. request: request,
  213. callOptions: callOptions ?? self.defaultCallOptions,
  214. interceptors: self.interceptors?.makeUnimplementedCallInterceptors() ?? []
  215. )
  216. }
  217. }
  218. public protocol Grpc_Testing_TestServiceClientInterceptorFactoryProtocol {
  219. /// - Returns: Interceptors to use when invoking 'emptyCall'.
  220. func makeEmptyCallInterceptors() -> [ClientInterceptor<Grpc_Testing_Empty, Grpc_Testing_Empty>]
  221. /// - Returns: Interceptors to use when invoking 'unaryCall'.
  222. func makeUnaryCallInterceptors() -> [ClientInterceptor<Grpc_Testing_SimpleRequest, Grpc_Testing_SimpleResponse>]
  223. /// - Returns: Interceptors to use when invoking 'cacheableUnaryCall'.
  224. func makeCacheableUnaryCallInterceptors() -> [ClientInterceptor<Grpc_Testing_SimpleRequest, Grpc_Testing_SimpleResponse>]
  225. /// - Returns: Interceptors to use when invoking 'streamingOutputCall'.
  226. func makeStreamingOutputCallInterceptors() -> [ClientInterceptor<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse>]
  227. /// - Returns: Interceptors to use when invoking 'streamingInputCall'.
  228. func makeStreamingInputCallInterceptors() -> [ClientInterceptor<Grpc_Testing_StreamingInputCallRequest, Grpc_Testing_StreamingInputCallResponse>]
  229. /// - Returns: Interceptors to use when invoking 'fullDuplexCall'.
  230. func makeFullDuplexCallInterceptors() -> [ClientInterceptor<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse>]
  231. /// - Returns: Interceptors to use when invoking 'halfDuplexCall'.
  232. func makeHalfDuplexCallInterceptors() -> [ClientInterceptor<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse>]
  233. /// - Returns: Interceptors to use when invoking 'unimplementedCall'.
  234. func makeUnimplementedCallInterceptors() -> [ClientInterceptor<Grpc_Testing_Empty, Grpc_Testing_Empty>]
  235. }
  236. public final class Grpc_Testing_TestServiceClient: Grpc_Testing_TestServiceClientProtocol {
  237. public let channel: GRPCChannel
  238. public var defaultCallOptions: CallOptions
  239. public var interceptors: Grpc_Testing_TestServiceClientInterceptorFactoryProtocol?
  240. /// Creates a client for the grpc.testing.TestService service.
  241. ///
  242. /// - Parameters:
  243. /// - channel: `GRPCChannel` to the service host.
  244. /// - defaultCallOptions: Options to use for each service call if the user doesn't provide them.
  245. /// - interceptors: A factory providing interceptors for each RPC.
  246. public init(
  247. channel: GRPCChannel,
  248. defaultCallOptions: CallOptions = CallOptions(),
  249. interceptors: Grpc_Testing_TestServiceClientInterceptorFactoryProtocol? = nil
  250. ) {
  251. self.channel = channel
  252. self.defaultCallOptions = defaultCallOptions
  253. self.interceptors = interceptors
  254. }
  255. }
  256. /// Usage: instantiate Grpc_Testing_UnimplementedServiceClient, then call methods of this protocol to make API calls.
  257. public protocol Grpc_Testing_UnimplementedServiceClientProtocol: GRPCClient {
  258. var interceptors: Grpc_Testing_UnimplementedServiceClientInterceptorFactoryProtocol? { get }
  259. func unimplementedCall(
  260. _ request: Grpc_Testing_Empty,
  261. callOptions: CallOptions?
  262. ) -> UnaryCall<Grpc_Testing_Empty, Grpc_Testing_Empty>
  263. }
  264. extension Grpc_Testing_UnimplementedServiceClientProtocol {
  265. /// A call that no server should implement
  266. ///
  267. /// - Parameters:
  268. /// - request: Request to send to UnimplementedCall.
  269. /// - callOptions: Call options.
  270. /// - Returns: A `UnaryCall` with futures for the metadata, status and response.
  271. public func unimplementedCall(
  272. _ request: Grpc_Testing_Empty,
  273. callOptions: CallOptions? = nil
  274. ) -> UnaryCall<Grpc_Testing_Empty, Grpc_Testing_Empty> {
  275. return self.makeUnaryCall(
  276. path: "/grpc.testing.UnimplementedService/UnimplementedCall",
  277. request: request,
  278. callOptions: callOptions ?? self.defaultCallOptions,
  279. interceptors: self.interceptors?.makeUnimplementedCallInterceptors() ?? []
  280. )
  281. }
  282. }
  283. public protocol Grpc_Testing_UnimplementedServiceClientInterceptorFactoryProtocol {
  284. /// - Returns: Interceptors to use when invoking 'unimplementedCall'.
  285. func makeUnimplementedCallInterceptors() -> [ClientInterceptor<Grpc_Testing_Empty, Grpc_Testing_Empty>]
  286. }
  287. public final class Grpc_Testing_UnimplementedServiceClient: Grpc_Testing_UnimplementedServiceClientProtocol {
  288. public let channel: GRPCChannel
  289. public var defaultCallOptions: CallOptions
  290. public var interceptors: Grpc_Testing_UnimplementedServiceClientInterceptorFactoryProtocol?
  291. /// Creates a client for the grpc.testing.UnimplementedService service.
  292. ///
  293. /// - Parameters:
  294. /// - channel: `GRPCChannel` to the service host.
  295. /// - defaultCallOptions: Options to use for each service call if the user doesn't provide them.
  296. /// - interceptors: A factory providing interceptors for each RPC.
  297. public init(
  298. channel: GRPCChannel,
  299. defaultCallOptions: CallOptions = CallOptions(),
  300. interceptors: Grpc_Testing_UnimplementedServiceClientInterceptorFactoryProtocol? = nil
  301. ) {
  302. self.channel = channel
  303. self.defaultCallOptions = defaultCallOptions
  304. self.interceptors = interceptors
  305. }
  306. }
  307. /// Usage: instantiate Grpc_Testing_ReconnectServiceClient, then call methods of this protocol to make API calls.
  308. public protocol Grpc_Testing_ReconnectServiceClientProtocol: GRPCClient {
  309. var interceptors: Grpc_Testing_ReconnectServiceClientInterceptorFactoryProtocol? { get }
  310. func start(
  311. _ request: Grpc_Testing_ReconnectParams,
  312. callOptions: CallOptions?
  313. ) -> UnaryCall<Grpc_Testing_ReconnectParams, Grpc_Testing_Empty>
  314. func stop(
  315. _ request: Grpc_Testing_Empty,
  316. callOptions: CallOptions?
  317. ) -> UnaryCall<Grpc_Testing_Empty, Grpc_Testing_ReconnectInfo>
  318. }
  319. extension Grpc_Testing_ReconnectServiceClientProtocol {
  320. /// Unary call to Start
  321. ///
  322. /// - Parameters:
  323. /// - request: Request to send to Start.
  324. /// - callOptions: Call options.
  325. /// - Returns: A `UnaryCall` with futures for the metadata, status and response.
  326. public func start(
  327. _ request: Grpc_Testing_ReconnectParams,
  328. callOptions: CallOptions? = nil
  329. ) -> UnaryCall<Grpc_Testing_ReconnectParams, Grpc_Testing_Empty> {
  330. return self.makeUnaryCall(
  331. path: "/grpc.testing.ReconnectService/Start",
  332. request: request,
  333. callOptions: callOptions ?? self.defaultCallOptions,
  334. interceptors: self.interceptors?.makeStartInterceptors() ?? []
  335. )
  336. }
  337. /// Unary call to Stop
  338. ///
  339. /// - Parameters:
  340. /// - request: Request to send to Stop.
  341. /// - callOptions: Call options.
  342. /// - Returns: A `UnaryCall` with futures for the metadata, status and response.
  343. public func stop(
  344. _ request: Grpc_Testing_Empty,
  345. callOptions: CallOptions? = nil
  346. ) -> UnaryCall<Grpc_Testing_Empty, Grpc_Testing_ReconnectInfo> {
  347. return self.makeUnaryCall(
  348. path: "/grpc.testing.ReconnectService/Stop",
  349. request: request,
  350. callOptions: callOptions ?? self.defaultCallOptions,
  351. interceptors: self.interceptors?.makeStopInterceptors() ?? []
  352. )
  353. }
  354. }
  355. public protocol Grpc_Testing_ReconnectServiceClientInterceptorFactoryProtocol {
  356. /// - Returns: Interceptors to use when invoking 'start'.
  357. func makeStartInterceptors() -> [ClientInterceptor<Grpc_Testing_ReconnectParams, Grpc_Testing_Empty>]
  358. /// - Returns: Interceptors to use when invoking 'stop'.
  359. func makeStopInterceptors() -> [ClientInterceptor<Grpc_Testing_Empty, Grpc_Testing_ReconnectInfo>]
  360. }
  361. public final class Grpc_Testing_ReconnectServiceClient: Grpc_Testing_ReconnectServiceClientProtocol {
  362. public let channel: GRPCChannel
  363. public var defaultCallOptions: CallOptions
  364. public var interceptors: Grpc_Testing_ReconnectServiceClientInterceptorFactoryProtocol?
  365. /// Creates a client for the grpc.testing.ReconnectService service.
  366. ///
  367. /// - Parameters:
  368. /// - channel: `GRPCChannel` to the service host.
  369. /// - defaultCallOptions: Options to use for each service call if the user doesn't provide them.
  370. /// - interceptors: A factory providing interceptors for each RPC.
  371. public init(
  372. channel: GRPCChannel,
  373. defaultCallOptions: CallOptions = CallOptions(),
  374. interceptors: Grpc_Testing_ReconnectServiceClientInterceptorFactoryProtocol? = nil
  375. ) {
  376. self.channel = channel
  377. self.defaultCallOptions = defaultCallOptions
  378. self.interceptors = interceptors
  379. }
  380. }
  381. /// To build a server, implement a class that conforms to this protocol.
  382. public protocol Grpc_Testing_TestServiceProvider: CallHandlerProvider {
  383. var interceptors: Grpc_Testing_TestServiceServerInterceptorFactoryProtocol? { get }
  384. /// One empty request followed by one empty response.
  385. func emptyCall(request: Grpc_Testing_Empty, context: StatusOnlyCallContext) -> EventLoopFuture<Grpc_Testing_Empty>
  386. /// One request followed by one response.
  387. func unaryCall(request: Grpc_Testing_SimpleRequest, context: StatusOnlyCallContext) -> EventLoopFuture<Grpc_Testing_SimpleResponse>
  388. /// One request followed by one response. Response has cache control
  389. /// headers set such that a caching HTTP proxy (such as GFE) can
  390. /// satisfy subsequent requests.
  391. func cacheableUnaryCall(request: Grpc_Testing_SimpleRequest, context: StatusOnlyCallContext) -> EventLoopFuture<Grpc_Testing_SimpleResponse>
  392. /// One request followed by a sequence of responses (streamed download).
  393. /// The server returns the payload with client desired type and sizes.
  394. func streamingOutputCall(request: Grpc_Testing_StreamingOutputCallRequest, context: StreamingResponseCallContext<Grpc_Testing_StreamingOutputCallResponse>) -> EventLoopFuture<GRPCStatus>
  395. /// A sequence of requests followed by one response (streamed upload).
  396. /// The server returns the aggregated size of client payload as the result.
  397. func streamingInputCall(context: UnaryResponseCallContext<Grpc_Testing_StreamingInputCallResponse>) -> EventLoopFuture<(StreamEvent<Grpc_Testing_StreamingInputCallRequest>) -> Void>
  398. /// A sequence of requests with each request served by the server immediately.
  399. /// As one request could lead to multiple responses, this interface
  400. /// demonstrates the idea of full duplexing.
  401. func fullDuplexCall(context: StreamingResponseCallContext<Grpc_Testing_StreamingOutputCallResponse>) -> EventLoopFuture<(StreamEvent<Grpc_Testing_StreamingOutputCallRequest>) -> Void>
  402. /// A sequence of requests followed by a sequence of responses.
  403. /// The server buffers all the client requests and then serves them in order. A
  404. /// stream of responses are returned to the client when the server starts with
  405. /// first request.
  406. func halfDuplexCall(context: StreamingResponseCallContext<Grpc_Testing_StreamingOutputCallResponse>) -> EventLoopFuture<(StreamEvent<Grpc_Testing_StreamingOutputCallRequest>) -> Void>
  407. }
  408. extension Grpc_Testing_TestServiceProvider {
  409. public var serviceName: Substring { return "grpc.testing.TestService" }
  410. /// Determines, calls and returns the appropriate request handler, depending on the request's method.
  411. /// Returns nil for methods not handled by this service.
  412. public func handleMethod(
  413. _ methodName: Substring,
  414. callHandlerContext: CallHandlerContext
  415. ) -> GRPCCallHandler? {
  416. switch methodName {
  417. case "EmptyCall":
  418. return CallHandlerFactory.makeUnary(
  419. callHandlerContext: callHandlerContext,
  420. interceptors: self.interceptors?.makeEmptyCallInterceptors() ?? []
  421. ) { context in
  422. return { request in
  423. self.emptyCall(request: request, context: context)
  424. }
  425. }
  426. case "UnaryCall":
  427. return CallHandlerFactory.makeUnary(
  428. callHandlerContext: callHandlerContext,
  429. interceptors: self.interceptors?.makeUnaryCallInterceptors() ?? []
  430. ) { context in
  431. return { request in
  432. self.unaryCall(request: request, context: context)
  433. }
  434. }
  435. case "CacheableUnaryCall":
  436. return CallHandlerFactory.makeUnary(
  437. callHandlerContext: callHandlerContext,
  438. interceptors: self.interceptors?.makeCacheableUnaryCallInterceptors() ?? []
  439. ) { context in
  440. return { request in
  441. self.cacheableUnaryCall(request: request, context: context)
  442. }
  443. }
  444. case "StreamingOutputCall":
  445. return CallHandlerFactory.makeServerStreaming(
  446. callHandlerContext: callHandlerContext,
  447. interceptors: self.interceptors?.makeStreamingOutputCallInterceptors() ?? []
  448. ) { context in
  449. return { request in
  450. self.streamingOutputCall(request: request, context: context)
  451. }
  452. }
  453. case "StreamingInputCall":
  454. return CallHandlerFactory.makeClientStreaming(
  455. callHandlerContext: callHandlerContext,
  456. interceptors: self.interceptors?.makeStreamingInputCallInterceptors() ?? []
  457. ) { context in
  458. self.streamingInputCall(context: context)
  459. }
  460. case "FullDuplexCall":
  461. return CallHandlerFactory.makeBidirectionalStreaming(
  462. callHandlerContext: callHandlerContext,
  463. interceptors: self.interceptors?.makeFullDuplexCallInterceptors() ?? []
  464. ) { context in
  465. self.fullDuplexCall(context: context)
  466. }
  467. case "HalfDuplexCall":
  468. return CallHandlerFactory.makeBidirectionalStreaming(
  469. callHandlerContext: callHandlerContext,
  470. interceptors: self.interceptors?.makeHalfDuplexCallInterceptors() ?? []
  471. ) { context in
  472. self.halfDuplexCall(context: context)
  473. }
  474. default:
  475. return nil
  476. }
  477. }
  478. }
  479. public protocol Grpc_Testing_TestServiceServerInterceptorFactoryProtocol {
  480. /// - Returns: Interceptors to use when handling 'emptyCall'.
  481. /// Defaults to calling `self.makeInterceptors()`.
  482. func makeEmptyCallInterceptors() -> [ServerInterceptor<Grpc_Testing_Empty, Grpc_Testing_Empty>]
  483. /// - Returns: Interceptors to use when handling 'unaryCall'.
  484. /// Defaults to calling `self.makeInterceptors()`.
  485. func makeUnaryCallInterceptors() -> [ServerInterceptor<Grpc_Testing_SimpleRequest, Grpc_Testing_SimpleResponse>]
  486. /// - Returns: Interceptors to use when handling 'cacheableUnaryCall'.
  487. /// Defaults to calling `self.makeInterceptors()`.
  488. func makeCacheableUnaryCallInterceptors() -> [ServerInterceptor<Grpc_Testing_SimpleRequest, Grpc_Testing_SimpleResponse>]
  489. /// - Returns: Interceptors to use when handling 'streamingOutputCall'.
  490. /// Defaults to calling `self.makeInterceptors()`.
  491. func makeStreamingOutputCallInterceptors() -> [ServerInterceptor<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse>]
  492. /// - Returns: Interceptors to use when handling 'streamingInputCall'.
  493. /// Defaults to calling `self.makeInterceptors()`.
  494. func makeStreamingInputCallInterceptors() -> [ServerInterceptor<Grpc_Testing_StreamingInputCallRequest, Grpc_Testing_StreamingInputCallResponse>]
  495. /// - Returns: Interceptors to use when handling 'fullDuplexCall'.
  496. /// Defaults to calling `self.makeInterceptors()`.
  497. func makeFullDuplexCallInterceptors() -> [ServerInterceptor<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse>]
  498. /// - Returns: Interceptors to use when handling 'halfDuplexCall'.
  499. /// Defaults to calling `self.makeInterceptors()`.
  500. func makeHalfDuplexCallInterceptors() -> [ServerInterceptor<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse>]
  501. /// - Returns: Interceptors to use when handling 'unimplementedCall'.
  502. /// Defaults to calling `self.makeInterceptors()`.
  503. func makeUnimplementedCallInterceptors() -> [ServerInterceptor<Grpc_Testing_Empty, Grpc_Testing_Empty>]
  504. }
  505. /// To build a server, implement a class that conforms to this protocol.
  506. public protocol Grpc_Testing_UnimplementedServiceProvider: CallHandlerProvider {
  507. var interceptors: Grpc_Testing_UnimplementedServiceServerInterceptorFactoryProtocol? { get }
  508. /// A call that no server should implement
  509. func unimplementedCall(request: Grpc_Testing_Empty, context: StatusOnlyCallContext) -> EventLoopFuture<Grpc_Testing_Empty>
  510. }
  511. extension Grpc_Testing_UnimplementedServiceProvider {
  512. public var serviceName: Substring { return "grpc.testing.UnimplementedService" }
  513. /// Determines, calls and returns the appropriate request handler, depending on the request's method.
  514. /// Returns nil for methods not handled by this service.
  515. public func handleMethod(
  516. _ methodName: Substring,
  517. callHandlerContext: CallHandlerContext
  518. ) -> GRPCCallHandler? {
  519. switch methodName {
  520. case "UnimplementedCall":
  521. return CallHandlerFactory.makeUnary(
  522. callHandlerContext: callHandlerContext,
  523. interceptors: self.interceptors?.makeUnimplementedCallInterceptors() ?? []
  524. ) { context in
  525. return { request in
  526. self.unimplementedCall(request: request, context: context)
  527. }
  528. }
  529. default:
  530. return nil
  531. }
  532. }
  533. }
  534. public protocol Grpc_Testing_UnimplementedServiceServerInterceptorFactoryProtocol {
  535. /// - Returns: Interceptors to use when handling 'unimplementedCall'.
  536. /// Defaults to calling `self.makeInterceptors()`.
  537. func makeUnimplementedCallInterceptors() -> [ServerInterceptor<Grpc_Testing_Empty, Grpc_Testing_Empty>]
  538. }
  539. /// To build a server, implement a class that conforms to this protocol.
  540. public protocol Grpc_Testing_ReconnectServiceProvider: CallHandlerProvider {
  541. var interceptors: Grpc_Testing_ReconnectServiceServerInterceptorFactoryProtocol? { get }
  542. func start(request: Grpc_Testing_ReconnectParams, context: StatusOnlyCallContext) -> EventLoopFuture<Grpc_Testing_Empty>
  543. func stop(request: Grpc_Testing_Empty, context: StatusOnlyCallContext) -> EventLoopFuture<Grpc_Testing_ReconnectInfo>
  544. }
  545. extension Grpc_Testing_ReconnectServiceProvider {
  546. public var serviceName: Substring { return "grpc.testing.ReconnectService" }
  547. /// Determines, calls and returns the appropriate request handler, depending on the request's method.
  548. /// Returns nil for methods not handled by this service.
  549. public func handleMethod(
  550. _ methodName: Substring,
  551. callHandlerContext: CallHandlerContext
  552. ) -> GRPCCallHandler? {
  553. switch methodName {
  554. case "Start":
  555. return CallHandlerFactory.makeUnary(
  556. callHandlerContext: callHandlerContext,
  557. interceptors: self.interceptors?.makeStartInterceptors() ?? []
  558. ) { context in
  559. return { request in
  560. self.start(request: request, context: context)
  561. }
  562. }
  563. case "Stop":
  564. return CallHandlerFactory.makeUnary(
  565. callHandlerContext: callHandlerContext,
  566. interceptors: self.interceptors?.makeStopInterceptors() ?? []
  567. ) { context in
  568. return { request in
  569. self.stop(request: request, context: context)
  570. }
  571. }
  572. default:
  573. return nil
  574. }
  575. }
  576. }
  577. public protocol Grpc_Testing_ReconnectServiceServerInterceptorFactoryProtocol {
  578. /// - Returns: Interceptors to use when handling 'start'.
  579. /// Defaults to calling `self.makeInterceptors()`.
  580. func makeStartInterceptors() -> [ServerInterceptor<Grpc_Testing_ReconnectParams, Grpc_Testing_Empty>]
  581. /// - Returns: Interceptors to use when handling 'stop'.
  582. /// Defaults to calling `self.makeInterceptors()`.
  583. func makeStopInterceptors() -> [ServerInterceptor<Grpc_Testing_Empty, Grpc_Testing_ReconnectInfo>]
  584. }