test.grpc.swift 55 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409
  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. /// A simple service to test the various types of RPCs and experiment with
  26. /// performance with various types of payload.
  27. ///
  28. /// Usage: instantiate `Grpc_Testing_TestServiceClient`, then call methods of this protocol to make API calls.
  29. public protocol Grpc_Testing_TestServiceClientProtocol: GRPCClient {
  30. var serviceName: String { get }
  31. var interceptors: Grpc_Testing_TestServiceClientInterceptorFactoryProtocol? { get }
  32. func emptyCall(
  33. _ request: Grpc_Testing_Empty,
  34. callOptions: CallOptions?
  35. ) -> UnaryCall<Grpc_Testing_Empty, Grpc_Testing_Empty>
  36. func unaryCall(
  37. _ request: Grpc_Testing_SimpleRequest,
  38. callOptions: CallOptions?
  39. ) -> UnaryCall<Grpc_Testing_SimpleRequest, Grpc_Testing_SimpleResponse>
  40. func cacheableUnaryCall(
  41. _ request: Grpc_Testing_SimpleRequest,
  42. callOptions: CallOptions?
  43. ) -> UnaryCall<Grpc_Testing_SimpleRequest, Grpc_Testing_SimpleResponse>
  44. func streamingOutputCall(
  45. _ request: Grpc_Testing_StreamingOutputCallRequest,
  46. callOptions: CallOptions?,
  47. handler: @escaping (Grpc_Testing_StreamingOutputCallResponse) -> Void
  48. ) -> ServerStreamingCall<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse>
  49. func streamingInputCall(
  50. callOptions: CallOptions?
  51. ) -> ClientStreamingCall<Grpc_Testing_StreamingInputCallRequest, Grpc_Testing_StreamingInputCallResponse>
  52. func fullDuplexCall(
  53. callOptions: CallOptions?,
  54. handler: @escaping (Grpc_Testing_StreamingOutputCallResponse) -> Void
  55. ) -> BidirectionalStreamingCall<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse>
  56. func halfDuplexCall(
  57. callOptions: CallOptions?,
  58. handler: @escaping (Grpc_Testing_StreamingOutputCallResponse) -> Void
  59. ) -> BidirectionalStreamingCall<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse>
  60. func unimplementedCall(
  61. _ request: Grpc_Testing_Empty,
  62. callOptions: CallOptions?
  63. ) -> UnaryCall<Grpc_Testing_Empty, Grpc_Testing_Empty>
  64. }
  65. extension Grpc_Testing_TestServiceClientProtocol {
  66. public var serviceName: String {
  67. return "grpc.testing.TestService"
  68. }
  69. /// One empty request followed by one empty response.
  70. ///
  71. /// - Parameters:
  72. /// - request: Request to send to EmptyCall.
  73. /// - callOptions: Call options.
  74. /// - Returns: A `UnaryCall` with futures for the metadata, status and response.
  75. public func emptyCall(
  76. _ request: Grpc_Testing_Empty,
  77. callOptions: CallOptions? = nil
  78. ) -> UnaryCall<Grpc_Testing_Empty, Grpc_Testing_Empty> {
  79. return self.makeUnaryCall(
  80. path: "/grpc.testing.TestService/EmptyCall",
  81. request: request,
  82. callOptions: callOptions ?? self.defaultCallOptions,
  83. interceptors: self.interceptors?.makeEmptyCallInterceptors() ?? []
  84. )
  85. }
  86. /// One request followed by one response.
  87. ///
  88. /// - Parameters:
  89. /// - request: Request to send to UnaryCall.
  90. /// - callOptions: Call options.
  91. /// - Returns: A `UnaryCall` with futures for the metadata, status and response.
  92. public func unaryCall(
  93. _ request: Grpc_Testing_SimpleRequest,
  94. callOptions: CallOptions? = nil
  95. ) -> UnaryCall<Grpc_Testing_SimpleRequest, Grpc_Testing_SimpleResponse> {
  96. return self.makeUnaryCall(
  97. path: "/grpc.testing.TestService/UnaryCall",
  98. request: request,
  99. callOptions: callOptions ?? self.defaultCallOptions,
  100. interceptors: self.interceptors?.makeUnaryCallInterceptors() ?? []
  101. )
  102. }
  103. /// One request followed by one response. Response has cache control
  104. /// headers set such that a caching HTTP proxy (such as GFE) can
  105. /// satisfy subsequent requests.
  106. ///
  107. /// - Parameters:
  108. /// - request: Request to send to CacheableUnaryCall.
  109. /// - callOptions: Call options.
  110. /// - Returns: A `UnaryCall` with futures for the metadata, status and response.
  111. public func cacheableUnaryCall(
  112. _ request: Grpc_Testing_SimpleRequest,
  113. callOptions: CallOptions? = nil
  114. ) -> UnaryCall<Grpc_Testing_SimpleRequest, Grpc_Testing_SimpleResponse> {
  115. return self.makeUnaryCall(
  116. path: "/grpc.testing.TestService/CacheableUnaryCall",
  117. request: request,
  118. callOptions: callOptions ?? self.defaultCallOptions,
  119. interceptors: self.interceptors?.makeCacheableUnaryCallInterceptors() ?? []
  120. )
  121. }
  122. /// One request followed by a sequence of responses (streamed download).
  123. /// The server returns the payload with client desired type and sizes.
  124. ///
  125. /// - Parameters:
  126. /// - request: Request to send to StreamingOutputCall.
  127. /// - callOptions: Call options.
  128. /// - handler: A closure called when each response is received from the server.
  129. /// - Returns: A `ServerStreamingCall` with futures for the metadata and status.
  130. public func streamingOutputCall(
  131. _ request: Grpc_Testing_StreamingOutputCallRequest,
  132. callOptions: CallOptions? = nil,
  133. handler: @escaping (Grpc_Testing_StreamingOutputCallResponse) -> Void
  134. ) -> ServerStreamingCall<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse> {
  135. return self.makeServerStreamingCall(
  136. path: "/grpc.testing.TestService/StreamingOutputCall",
  137. request: request,
  138. callOptions: callOptions ?? self.defaultCallOptions,
  139. interceptors: self.interceptors?.makeStreamingOutputCallInterceptors() ?? [],
  140. handler: handler
  141. )
  142. }
  143. /// A sequence of requests followed by one response (streamed upload).
  144. /// The server returns the aggregated size of client payload as the result.
  145. ///
  146. /// Callers should use the `send` method on the returned object to send messages
  147. /// to the server. The caller should send an `.end` after the final message has been sent.
  148. ///
  149. /// - Parameters:
  150. /// - callOptions: Call options.
  151. /// - Returns: A `ClientStreamingCall` with futures for the metadata, status and response.
  152. public func streamingInputCall(
  153. callOptions: CallOptions? = nil
  154. ) -> ClientStreamingCall<Grpc_Testing_StreamingInputCallRequest, Grpc_Testing_StreamingInputCallResponse> {
  155. return self.makeClientStreamingCall(
  156. path: "/grpc.testing.TestService/StreamingInputCall",
  157. callOptions: callOptions ?? self.defaultCallOptions,
  158. interceptors: self.interceptors?.makeStreamingInputCallInterceptors() ?? []
  159. )
  160. }
  161. /// A sequence of requests with each request served by the server immediately.
  162. /// As one request could lead to multiple responses, this interface
  163. /// demonstrates the idea of full duplexing.
  164. ///
  165. /// Callers should use the `send` method on the returned object to send messages
  166. /// to the server. The caller should send an `.end` after the final message has been sent.
  167. ///
  168. /// - Parameters:
  169. /// - callOptions: Call options.
  170. /// - handler: A closure called when each response is received from the server.
  171. /// - Returns: A `ClientStreamingCall` with futures for the metadata and status.
  172. public func fullDuplexCall(
  173. callOptions: CallOptions? = nil,
  174. handler: @escaping (Grpc_Testing_StreamingOutputCallResponse) -> Void
  175. ) -> BidirectionalStreamingCall<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse> {
  176. return self.makeBidirectionalStreamingCall(
  177. path: "/grpc.testing.TestService/FullDuplexCall",
  178. callOptions: callOptions ?? self.defaultCallOptions,
  179. interceptors: self.interceptors?.makeFullDuplexCallInterceptors() ?? [],
  180. handler: handler
  181. )
  182. }
  183. /// A sequence of requests followed by a sequence of responses.
  184. /// The server buffers all the client requests and then serves them in order. A
  185. /// stream of responses are returned to the client when the server starts with
  186. /// first request.
  187. ///
  188. /// Callers should use the `send` method on the returned object to send messages
  189. /// to the server. The caller should send an `.end` after the final message has been sent.
  190. ///
  191. /// - Parameters:
  192. /// - callOptions: Call options.
  193. /// - handler: A closure called when each response is received from the server.
  194. /// - Returns: A `ClientStreamingCall` with futures for the metadata and status.
  195. public func halfDuplexCall(
  196. callOptions: CallOptions? = nil,
  197. handler: @escaping (Grpc_Testing_StreamingOutputCallResponse) -> Void
  198. ) -> BidirectionalStreamingCall<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse> {
  199. return self.makeBidirectionalStreamingCall(
  200. path: "/grpc.testing.TestService/HalfDuplexCall",
  201. callOptions: callOptions ?? self.defaultCallOptions,
  202. interceptors: self.interceptors?.makeHalfDuplexCallInterceptors() ?? [],
  203. handler: handler
  204. )
  205. }
  206. /// The test server will not implement this method. It will be used
  207. /// to test the behavior when clients call unimplemented methods.
  208. ///
  209. /// - Parameters:
  210. /// - request: Request to send to UnimplementedCall.
  211. /// - callOptions: Call options.
  212. /// - Returns: A `UnaryCall` with futures for the metadata, status and response.
  213. public func unimplementedCall(
  214. _ request: Grpc_Testing_Empty,
  215. callOptions: CallOptions? = nil
  216. ) -> UnaryCall<Grpc_Testing_Empty, Grpc_Testing_Empty> {
  217. return self.makeUnaryCall(
  218. path: "/grpc.testing.TestService/UnimplementedCall",
  219. request: request,
  220. callOptions: callOptions ?? self.defaultCallOptions,
  221. interceptors: self.interceptors?.makeUnimplementedCallInterceptors() ?? []
  222. )
  223. }
  224. }
  225. public protocol Grpc_Testing_TestServiceClientInterceptorFactoryProtocol {
  226. /// - Returns: Interceptors to use when invoking 'emptyCall'.
  227. func makeEmptyCallInterceptors() -> [ClientInterceptor<Grpc_Testing_Empty, Grpc_Testing_Empty>]
  228. /// - Returns: Interceptors to use when invoking 'unaryCall'.
  229. func makeUnaryCallInterceptors() -> [ClientInterceptor<Grpc_Testing_SimpleRequest, Grpc_Testing_SimpleResponse>]
  230. /// - Returns: Interceptors to use when invoking 'cacheableUnaryCall'.
  231. func makeCacheableUnaryCallInterceptors() -> [ClientInterceptor<Grpc_Testing_SimpleRequest, Grpc_Testing_SimpleResponse>]
  232. /// - Returns: Interceptors to use when invoking 'streamingOutputCall'.
  233. func makeStreamingOutputCallInterceptors() -> [ClientInterceptor<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse>]
  234. /// - Returns: Interceptors to use when invoking 'streamingInputCall'.
  235. func makeStreamingInputCallInterceptors() -> [ClientInterceptor<Grpc_Testing_StreamingInputCallRequest, Grpc_Testing_StreamingInputCallResponse>]
  236. /// - Returns: Interceptors to use when invoking 'fullDuplexCall'.
  237. func makeFullDuplexCallInterceptors() -> [ClientInterceptor<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse>]
  238. /// - Returns: Interceptors to use when invoking 'halfDuplexCall'.
  239. func makeHalfDuplexCallInterceptors() -> [ClientInterceptor<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse>]
  240. /// - Returns: Interceptors to use when invoking 'unimplementedCall'.
  241. func makeUnimplementedCallInterceptors() -> [ClientInterceptor<Grpc_Testing_Empty, Grpc_Testing_Empty>]
  242. }
  243. public final class Grpc_Testing_TestServiceClient: Grpc_Testing_TestServiceClientProtocol {
  244. public let channel: GRPCChannel
  245. public var defaultCallOptions: CallOptions
  246. public var interceptors: Grpc_Testing_TestServiceClientInterceptorFactoryProtocol?
  247. /// Creates a client for the grpc.testing.TestService service.
  248. ///
  249. /// - Parameters:
  250. /// - channel: `GRPCChannel` to the service host.
  251. /// - defaultCallOptions: Options to use for each service call if the user doesn't provide them.
  252. /// - interceptors: A factory providing interceptors for each RPC.
  253. public init(
  254. channel: GRPCChannel,
  255. defaultCallOptions: CallOptions = CallOptions(),
  256. interceptors: Grpc_Testing_TestServiceClientInterceptorFactoryProtocol? = nil
  257. ) {
  258. self.channel = channel
  259. self.defaultCallOptions = defaultCallOptions
  260. self.interceptors = interceptors
  261. }
  262. }
  263. #if compiler(>=5.5)
  264. /// A simple service to test the various types of RPCs and experiment with
  265. /// performance with various types of payload.
  266. @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)
  267. public protocol Grpc_Testing_TestServiceAsyncClientProtocol: GRPCClient {
  268. var serviceName: String { get }
  269. var interceptors: Grpc_Testing_TestServiceClientInterceptorFactoryProtocol? { get }
  270. func makeEmptyCallCall(
  271. _ request: Grpc_Testing_Empty,
  272. callOptions: CallOptions?
  273. ) -> GRPCAsyncUnaryCall<Grpc_Testing_Empty, Grpc_Testing_Empty>
  274. func makeUnaryCallCall(
  275. _ request: Grpc_Testing_SimpleRequest,
  276. callOptions: CallOptions?
  277. ) -> GRPCAsyncUnaryCall<Grpc_Testing_SimpleRequest, Grpc_Testing_SimpleResponse>
  278. func makeCacheableUnaryCallCall(
  279. _ request: Grpc_Testing_SimpleRequest,
  280. callOptions: CallOptions?
  281. ) -> GRPCAsyncUnaryCall<Grpc_Testing_SimpleRequest, Grpc_Testing_SimpleResponse>
  282. func makeStreamingOutputCallCall(
  283. _ request: Grpc_Testing_StreamingOutputCallRequest,
  284. callOptions: CallOptions?
  285. ) -> GRPCAsyncServerStreamingCall<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse>
  286. func makeStreamingInputCallCall(
  287. callOptions: CallOptions?
  288. ) -> GRPCAsyncClientStreamingCall<Grpc_Testing_StreamingInputCallRequest, Grpc_Testing_StreamingInputCallResponse>
  289. func makeFullDuplexCallCall(
  290. callOptions: CallOptions?
  291. ) -> GRPCAsyncBidirectionalStreamingCall<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse>
  292. func makeHalfDuplexCallCall(
  293. callOptions: CallOptions?
  294. ) -> GRPCAsyncBidirectionalStreamingCall<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse>
  295. func makeUnimplementedCallCall(
  296. _ request: Grpc_Testing_Empty,
  297. callOptions: CallOptions?
  298. ) -> GRPCAsyncUnaryCall<Grpc_Testing_Empty, Grpc_Testing_Empty>
  299. }
  300. @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)
  301. extension Grpc_Testing_TestServiceAsyncClientProtocol {
  302. public var serviceName: String {
  303. return "grpc.testing.TestService"
  304. }
  305. public var interceptors: Grpc_Testing_TestServiceClientInterceptorFactoryProtocol? {
  306. return nil
  307. }
  308. public func makeEmptyCallCall(
  309. _ request: Grpc_Testing_Empty,
  310. callOptions: CallOptions? = nil
  311. ) -> GRPCAsyncUnaryCall<Grpc_Testing_Empty, Grpc_Testing_Empty> {
  312. return self.makeAsyncUnaryCall(
  313. path: "/grpc.testing.TestService/EmptyCall",
  314. request: request,
  315. callOptions: callOptions ?? self.defaultCallOptions
  316. )
  317. }
  318. public func makeUnaryCallCall(
  319. _ request: Grpc_Testing_SimpleRequest,
  320. callOptions: CallOptions? = nil
  321. ) -> GRPCAsyncUnaryCall<Grpc_Testing_SimpleRequest, Grpc_Testing_SimpleResponse> {
  322. return self.makeAsyncUnaryCall(
  323. path: "/grpc.testing.TestService/UnaryCall",
  324. request: request,
  325. callOptions: callOptions ?? self.defaultCallOptions
  326. )
  327. }
  328. public func makeCacheableUnaryCallCall(
  329. _ request: Grpc_Testing_SimpleRequest,
  330. callOptions: CallOptions? = nil
  331. ) -> GRPCAsyncUnaryCall<Grpc_Testing_SimpleRequest, Grpc_Testing_SimpleResponse> {
  332. return self.makeAsyncUnaryCall(
  333. path: "/grpc.testing.TestService/CacheableUnaryCall",
  334. request: request,
  335. callOptions: callOptions ?? self.defaultCallOptions
  336. )
  337. }
  338. public func makeStreamingOutputCallCall(
  339. _ request: Grpc_Testing_StreamingOutputCallRequest,
  340. callOptions: CallOptions? = nil
  341. ) -> GRPCAsyncServerStreamingCall<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse> {
  342. return self.makeAsyncServerStreamingCall(
  343. path: "/grpc.testing.TestService/StreamingOutputCall",
  344. request: request,
  345. callOptions: callOptions ?? self.defaultCallOptions
  346. )
  347. }
  348. public func makeStreamingInputCallCall(
  349. callOptions: CallOptions? = nil
  350. ) -> GRPCAsyncClientStreamingCall<Grpc_Testing_StreamingInputCallRequest, Grpc_Testing_StreamingInputCallResponse> {
  351. return self.makeAsyncClientStreamingCall(
  352. path: "/grpc.testing.TestService/StreamingInputCall",
  353. callOptions: callOptions ?? self.defaultCallOptions
  354. )
  355. }
  356. public func makeFullDuplexCallCall(
  357. callOptions: CallOptions? = nil
  358. ) -> GRPCAsyncBidirectionalStreamingCall<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse> {
  359. return self.makeAsyncBidirectionalStreamingCall(
  360. path: "/grpc.testing.TestService/FullDuplexCall",
  361. callOptions: callOptions ?? self.defaultCallOptions
  362. )
  363. }
  364. public func makeHalfDuplexCallCall(
  365. callOptions: CallOptions? = nil
  366. ) -> GRPCAsyncBidirectionalStreamingCall<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse> {
  367. return self.makeAsyncBidirectionalStreamingCall(
  368. path: "/grpc.testing.TestService/HalfDuplexCall",
  369. callOptions: callOptions ?? self.defaultCallOptions
  370. )
  371. }
  372. public func makeUnimplementedCallCall(
  373. _ request: Grpc_Testing_Empty,
  374. callOptions: CallOptions? = nil
  375. ) -> GRPCAsyncUnaryCall<Grpc_Testing_Empty, Grpc_Testing_Empty> {
  376. return self.makeAsyncUnaryCall(
  377. path: "/grpc.testing.TestService/UnimplementedCall",
  378. request: request,
  379. callOptions: callOptions ?? self.defaultCallOptions
  380. )
  381. }
  382. }
  383. @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)
  384. extension Grpc_Testing_TestServiceAsyncClientProtocol {
  385. public func emptyCall(
  386. _ request: Grpc_Testing_Empty,
  387. callOptions: CallOptions? = nil
  388. ) async throws -> Grpc_Testing_Empty {
  389. return try await self.performAsyncUnaryCall(
  390. path: "/grpc.testing.TestService/EmptyCall",
  391. request: request,
  392. callOptions: callOptions ?? self.defaultCallOptions
  393. )
  394. }
  395. public func unaryCall(
  396. _ request: Grpc_Testing_SimpleRequest,
  397. callOptions: CallOptions? = nil
  398. ) async throws -> Grpc_Testing_SimpleResponse {
  399. return try await self.performAsyncUnaryCall(
  400. path: "/grpc.testing.TestService/UnaryCall",
  401. request: request,
  402. callOptions: callOptions ?? self.defaultCallOptions
  403. )
  404. }
  405. public func cacheableUnaryCall(
  406. _ request: Grpc_Testing_SimpleRequest,
  407. callOptions: CallOptions? = nil
  408. ) async throws -> Grpc_Testing_SimpleResponse {
  409. return try await self.performAsyncUnaryCall(
  410. path: "/grpc.testing.TestService/CacheableUnaryCall",
  411. request: request,
  412. callOptions: callOptions ?? self.defaultCallOptions
  413. )
  414. }
  415. public func streamingOutputCall(
  416. _ request: Grpc_Testing_StreamingOutputCallRequest,
  417. callOptions: CallOptions? = nil
  418. ) -> GRPCAsyncResponseStream<Grpc_Testing_StreamingOutputCallResponse> {
  419. return self.performAsyncServerStreamingCall(
  420. path: "/grpc.testing.TestService/StreamingOutputCall",
  421. request: request,
  422. callOptions: callOptions ?? self.defaultCallOptions
  423. )
  424. }
  425. public func streamingInputCall<RequestStream>(
  426. _ requests: RequestStream,
  427. callOptions: CallOptions? = nil
  428. ) async throws -> Grpc_Testing_StreamingInputCallResponse where RequestStream: Sequence, RequestStream.Element == Grpc_Testing_StreamingInputCallRequest {
  429. return try await self.performAsyncClientStreamingCall(
  430. path: "/grpc.testing.TestService/StreamingInputCall",
  431. requests: requests,
  432. callOptions: callOptions ?? self.defaultCallOptions
  433. )
  434. }
  435. public func streamingInputCall<RequestStream>(
  436. _ requests: RequestStream,
  437. callOptions: CallOptions? = nil
  438. ) async throws -> Grpc_Testing_StreamingInputCallResponse where RequestStream: AsyncSequence, RequestStream.Element == Grpc_Testing_StreamingInputCallRequest {
  439. return try await self.performAsyncClientStreamingCall(
  440. path: "/grpc.testing.TestService/StreamingInputCall",
  441. requests: requests,
  442. callOptions: callOptions ?? self.defaultCallOptions
  443. )
  444. }
  445. public func fullDuplexCall<RequestStream>(
  446. _ requests: RequestStream,
  447. callOptions: CallOptions? = nil
  448. ) -> GRPCAsyncResponseStream<Grpc_Testing_StreamingOutputCallResponse> where RequestStream: Sequence, RequestStream.Element == Grpc_Testing_StreamingOutputCallRequest {
  449. return self.performAsyncBidirectionalStreamingCall(
  450. path: "/grpc.testing.TestService/FullDuplexCall",
  451. requests: requests,
  452. callOptions: callOptions ?? self.defaultCallOptions
  453. )
  454. }
  455. public func fullDuplexCall<RequestStream>(
  456. _ requests: RequestStream,
  457. callOptions: CallOptions? = nil
  458. ) -> GRPCAsyncResponseStream<Grpc_Testing_StreamingOutputCallResponse> where RequestStream: AsyncSequence, RequestStream.Element == Grpc_Testing_StreamingOutputCallRequest {
  459. return self.performAsyncBidirectionalStreamingCall(
  460. path: "/grpc.testing.TestService/FullDuplexCall",
  461. requests: requests,
  462. callOptions: callOptions ?? self.defaultCallOptions
  463. )
  464. }
  465. public func halfDuplexCall<RequestStream>(
  466. _ requests: RequestStream,
  467. callOptions: CallOptions? = nil
  468. ) -> GRPCAsyncResponseStream<Grpc_Testing_StreamingOutputCallResponse> where RequestStream: Sequence, RequestStream.Element == Grpc_Testing_StreamingOutputCallRequest {
  469. return self.performAsyncBidirectionalStreamingCall(
  470. path: "/grpc.testing.TestService/HalfDuplexCall",
  471. requests: requests,
  472. callOptions: callOptions ?? self.defaultCallOptions
  473. )
  474. }
  475. public func halfDuplexCall<RequestStream>(
  476. _ requests: RequestStream,
  477. callOptions: CallOptions? = nil
  478. ) -> GRPCAsyncResponseStream<Grpc_Testing_StreamingOutputCallResponse> where RequestStream: AsyncSequence, RequestStream.Element == Grpc_Testing_StreamingOutputCallRequest {
  479. return self.performAsyncBidirectionalStreamingCall(
  480. path: "/grpc.testing.TestService/HalfDuplexCall",
  481. requests: requests,
  482. callOptions: callOptions ?? self.defaultCallOptions
  483. )
  484. }
  485. public func unimplementedCall(
  486. _ request: Grpc_Testing_Empty,
  487. callOptions: CallOptions? = nil
  488. ) async throws -> Grpc_Testing_Empty {
  489. return try await self.performAsyncUnaryCall(
  490. path: "/grpc.testing.TestService/UnimplementedCall",
  491. request: request,
  492. callOptions: callOptions ?? self.defaultCallOptions
  493. )
  494. }
  495. }
  496. @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)
  497. public struct Grpc_Testing_TestServiceAsyncClient: Grpc_Testing_TestServiceAsyncClientProtocol {
  498. public var channel: GRPCChannel
  499. public var defaultCallOptions: CallOptions
  500. public var interceptors: Grpc_Testing_TestServiceClientInterceptorFactoryProtocol?
  501. public init(
  502. channel: GRPCChannel,
  503. defaultCallOptions: CallOptions = CallOptions(),
  504. interceptors: Grpc_Testing_TestServiceClientInterceptorFactoryProtocol? = nil
  505. ) {
  506. self.channel = channel
  507. self.defaultCallOptions = defaultCallOptions
  508. self.interceptors = interceptors
  509. }
  510. }
  511. #endif // compiler(>=5.5)
  512. /// A simple service NOT implemented at servers so clients can test for
  513. /// that case.
  514. ///
  515. /// Usage: instantiate `Grpc_Testing_UnimplementedServiceClient`, then call methods of this protocol to make API calls.
  516. public protocol Grpc_Testing_UnimplementedServiceClientProtocol: GRPCClient {
  517. var serviceName: String { get }
  518. var interceptors: Grpc_Testing_UnimplementedServiceClientInterceptorFactoryProtocol? { get }
  519. func unimplementedCall(
  520. _ request: Grpc_Testing_Empty,
  521. callOptions: CallOptions?
  522. ) -> UnaryCall<Grpc_Testing_Empty, Grpc_Testing_Empty>
  523. }
  524. extension Grpc_Testing_UnimplementedServiceClientProtocol {
  525. public var serviceName: String {
  526. return "grpc.testing.UnimplementedService"
  527. }
  528. /// A call that no server should implement
  529. ///
  530. /// - Parameters:
  531. /// - request: Request to send to UnimplementedCall.
  532. /// - callOptions: Call options.
  533. /// - Returns: A `UnaryCall` with futures for the metadata, status and response.
  534. public func unimplementedCall(
  535. _ request: Grpc_Testing_Empty,
  536. callOptions: CallOptions? = nil
  537. ) -> UnaryCall<Grpc_Testing_Empty, Grpc_Testing_Empty> {
  538. return self.makeUnaryCall(
  539. path: "/grpc.testing.UnimplementedService/UnimplementedCall",
  540. request: request,
  541. callOptions: callOptions ?? self.defaultCallOptions,
  542. interceptors: self.interceptors?.makeUnimplementedCallInterceptors() ?? []
  543. )
  544. }
  545. }
  546. public protocol Grpc_Testing_UnimplementedServiceClientInterceptorFactoryProtocol {
  547. /// - Returns: Interceptors to use when invoking 'unimplementedCall'.
  548. func makeUnimplementedCallInterceptors() -> [ClientInterceptor<Grpc_Testing_Empty, Grpc_Testing_Empty>]
  549. }
  550. public final class Grpc_Testing_UnimplementedServiceClient: Grpc_Testing_UnimplementedServiceClientProtocol {
  551. public let channel: GRPCChannel
  552. public var defaultCallOptions: CallOptions
  553. public var interceptors: Grpc_Testing_UnimplementedServiceClientInterceptorFactoryProtocol?
  554. /// Creates a client for the grpc.testing.UnimplementedService service.
  555. ///
  556. /// - Parameters:
  557. /// - channel: `GRPCChannel` to the service host.
  558. /// - defaultCallOptions: Options to use for each service call if the user doesn't provide them.
  559. /// - interceptors: A factory providing interceptors for each RPC.
  560. public init(
  561. channel: GRPCChannel,
  562. defaultCallOptions: CallOptions = CallOptions(),
  563. interceptors: Grpc_Testing_UnimplementedServiceClientInterceptorFactoryProtocol? = nil
  564. ) {
  565. self.channel = channel
  566. self.defaultCallOptions = defaultCallOptions
  567. self.interceptors = interceptors
  568. }
  569. }
  570. #if compiler(>=5.5)
  571. /// A simple service NOT implemented at servers so clients can test for
  572. /// that case.
  573. @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)
  574. public protocol Grpc_Testing_UnimplementedServiceAsyncClientProtocol: GRPCClient {
  575. var serviceName: String { get }
  576. var interceptors: Grpc_Testing_UnimplementedServiceClientInterceptorFactoryProtocol? { get }
  577. func makeUnimplementedCallCall(
  578. _ request: Grpc_Testing_Empty,
  579. callOptions: CallOptions?
  580. ) -> GRPCAsyncUnaryCall<Grpc_Testing_Empty, Grpc_Testing_Empty>
  581. }
  582. @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)
  583. extension Grpc_Testing_UnimplementedServiceAsyncClientProtocol {
  584. public var serviceName: String {
  585. return "grpc.testing.UnimplementedService"
  586. }
  587. public var interceptors: Grpc_Testing_UnimplementedServiceClientInterceptorFactoryProtocol? {
  588. return nil
  589. }
  590. public func makeUnimplementedCallCall(
  591. _ request: Grpc_Testing_Empty,
  592. callOptions: CallOptions? = nil
  593. ) -> GRPCAsyncUnaryCall<Grpc_Testing_Empty, Grpc_Testing_Empty> {
  594. return self.makeAsyncUnaryCall(
  595. path: "/grpc.testing.UnimplementedService/UnimplementedCall",
  596. request: request,
  597. callOptions: callOptions ?? self.defaultCallOptions
  598. )
  599. }
  600. }
  601. @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)
  602. extension Grpc_Testing_UnimplementedServiceAsyncClientProtocol {
  603. public func unimplementedCall(
  604. _ request: Grpc_Testing_Empty,
  605. callOptions: CallOptions? = nil
  606. ) async throws -> Grpc_Testing_Empty {
  607. return try await self.performAsyncUnaryCall(
  608. path: "/grpc.testing.UnimplementedService/UnimplementedCall",
  609. request: request,
  610. callOptions: callOptions ?? self.defaultCallOptions
  611. )
  612. }
  613. }
  614. @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)
  615. public struct Grpc_Testing_UnimplementedServiceAsyncClient: Grpc_Testing_UnimplementedServiceAsyncClientProtocol {
  616. public var channel: GRPCChannel
  617. public var defaultCallOptions: CallOptions
  618. public var interceptors: Grpc_Testing_UnimplementedServiceClientInterceptorFactoryProtocol?
  619. public init(
  620. channel: GRPCChannel,
  621. defaultCallOptions: CallOptions = CallOptions(),
  622. interceptors: Grpc_Testing_UnimplementedServiceClientInterceptorFactoryProtocol? = nil
  623. ) {
  624. self.channel = channel
  625. self.defaultCallOptions = defaultCallOptions
  626. self.interceptors = interceptors
  627. }
  628. }
  629. #endif // compiler(>=5.5)
  630. /// A service used to control reconnect server.
  631. ///
  632. /// Usage: instantiate `Grpc_Testing_ReconnectServiceClient`, then call methods of this protocol to make API calls.
  633. public protocol Grpc_Testing_ReconnectServiceClientProtocol: GRPCClient {
  634. var serviceName: String { get }
  635. var interceptors: Grpc_Testing_ReconnectServiceClientInterceptorFactoryProtocol? { get }
  636. func start(
  637. _ request: Grpc_Testing_ReconnectParams,
  638. callOptions: CallOptions?
  639. ) -> UnaryCall<Grpc_Testing_ReconnectParams, Grpc_Testing_Empty>
  640. func stop(
  641. _ request: Grpc_Testing_Empty,
  642. callOptions: CallOptions?
  643. ) -> UnaryCall<Grpc_Testing_Empty, Grpc_Testing_ReconnectInfo>
  644. }
  645. extension Grpc_Testing_ReconnectServiceClientProtocol {
  646. public var serviceName: String {
  647. return "grpc.testing.ReconnectService"
  648. }
  649. /// Unary call to Start
  650. ///
  651. /// - Parameters:
  652. /// - request: Request to send to Start.
  653. /// - callOptions: Call options.
  654. /// - Returns: A `UnaryCall` with futures for the metadata, status and response.
  655. public func start(
  656. _ request: Grpc_Testing_ReconnectParams,
  657. callOptions: CallOptions? = nil
  658. ) -> UnaryCall<Grpc_Testing_ReconnectParams, Grpc_Testing_Empty> {
  659. return self.makeUnaryCall(
  660. path: "/grpc.testing.ReconnectService/Start",
  661. request: request,
  662. callOptions: callOptions ?? self.defaultCallOptions,
  663. interceptors: self.interceptors?.makeStartInterceptors() ?? []
  664. )
  665. }
  666. /// Unary call to Stop
  667. ///
  668. /// - Parameters:
  669. /// - request: Request to send to Stop.
  670. /// - callOptions: Call options.
  671. /// - Returns: A `UnaryCall` with futures for the metadata, status and response.
  672. public func stop(
  673. _ request: Grpc_Testing_Empty,
  674. callOptions: CallOptions? = nil
  675. ) -> UnaryCall<Grpc_Testing_Empty, Grpc_Testing_ReconnectInfo> {
  676. return self.makeUnaryCall(
  677. path: "/grpc.testing.ReconnectService/Stop",
  678. request: request,
  679. callOptions: callOptions ?? self.defaultCallOptions,
  680. interceptors: self.interceptors?.makeStopInterceptors() ?? []
  681. )
  682. }
  683. }
  684. public protocol Grpc_Testing_ReconnectServiceClientInterceptorFactoryProtocol {
  685. /// - Returns: Interceptors to use when invoking 'start'.
  686. func makeStartInterceptors() -> [ClientInterceptor<Grpc_Testing_ReconnectParams, Grpc_Testing_Empty>]
  687. /// - Returns: Interceptors to use when invoking 'stop'.
  688. func makeStopInterceptors() -> [ClientInterceptor<Grpc_Testing_Empty, Grpc_Testing_ReconnectInfo>]
  689. }
  690. public final class Grpc_Testing_ReconnectServiceClient: Grpc_Testing_ReconnectServiceClientProtocol {
  691. public let channel: GRPCChannel
  692. public var defaultCallOptions: CallOptions
  693. public var interceptors: Grpc_Testing_ReconnectServiceClientInterceptorFactoryProtocol?
  694. /// Creates a client for the grpc.testing.ReconnectService service.
  695. ///
  696. /// - Parameters:
  697. /// - channel: `GRPCChannel` to the service host.
  698. /// - defaultCallOptions: Options to use for each service call if the user doesn't provide them.
  699. /// - interceptors: A factory providing interceptors for each RPC.
  700. public init(
  701. channel: GRPCChannel,
  702. defaultCallOptions: CallOptions = CallOptions(),
  703. interceptors: Grpc_Testing_ReconnectServiceClientInterceptorFactoryProtocol? = nil
  704. ) {
  705. self.channel = channel
  706. self.defaultCallOptions = defaultCallOptions
  707. self.interceptors = interceptors
  708. }
  709. }
  710. #if compiler(>=5.5)
  711. /// A service used to control reconnect server.
  712. @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)
  713. public protocol Grpc_Testing_ReconnectServiceAsyncClientProtocol: GRPCClient {
  714. var serviceName: String { get }
  715. var interceptors: Grpc_Testing_ReconnectServiceClientInterceptorFactoryProtocol? { get }
  716. func makeStartCall(
  717. _ request: Grpc_Testing_ReconnectParams,
  718. callOptions: CallOptions?
  719. ) -> GRPCAsyncUnaryCall<Grpc_Testing_ReconnectParams, Grpc_Testing_Empty>
  720. func makeStopCall(
  721. _ request: Grpc_Testing_Empty,
  722. callOptions: CallOptions?
  723. ) -> GRPCAsyncUnaryCall<Grpc_Testing_Empty, Grpc_Testing_ReconnectInfo>
  724. }
  725. @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)
  726. extension Grpc_Testing_ReconnectServiceAsyncClientProtocol {
  727. public var serviceName: String {
  728. return "grpc.testing.ReconnectService"
  729. }
  730. public var interceptors: Grpc_Testing_ReconnectServiceClientInterceptorFactoryProtocol? {
  731. return nil
  732. }
  733. public func makeStartCall(
  734. _ request: Grpc_Testing_ReconnectParams,
  735. callOptions: CallOptions? = nil
  736. ) -> GRPCAsyncUnaryCall<Grpc_Testing_ReconnectParams, Grpc_Testing_Empty> {
  737. return self.makeAsyncUnaryCall(
  738. path: "/grpc.testing.ReconnectService/Start",
  739. request: request,
  740. callOptions: callOptions ?? self.defaultCallOptions
  741. )
  742. }
  743. public func makeStopCall(
  744. _ request: Grpc_Testing_Empty,
  745. callOptions: CallOptions? = nil
  746. ) -> GRPCAsyncUnaryCall<Grpc_Testing_Empty, Grpc_Testing_ReconnectInfo> {
  747. return self.makeAsyncUnaryCall(
  748. path: "/grpc.testing.ReconnectService/Stop",
  749. request: request,
  750. callOptions: callOptions ?? self.defaultCallOptions
  751. )
  752. }
  753. }
  754. @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)
  755. extension Grpc_Testing_ReconnectServiceAsyncClientProtocol {
  756. public func start(
  757. _ request: Grpc_Testing_ReconnectParams,
  758. callOptions: CallOptions? = nil
  759. ) async throws -> Grpc_Testing_Empty {
  760. return try await self.performAsyncUnaryCall(
  761. path: "/grpc.testing.ReconnectService/Start",
  762. request: request,
  763. callOptions: callOptions ?? self.defaultCallOptions
  764. )
  765. }
  766. public func stop(
  767. _ request: Grpc_Testing_Empty,
  768. callOptions: CallOptions? = nil
  769. ) async throws -> Grpc_Testing_ReconnectInfo {
  770. return try await self.performAsyncUnaryCall(
  771. path: "/grpc.testing.ReconnectService/Stop",
  772. request: request,
  773. callOptions: callOptions ?? self.defaultCallOptions
  774. )
  775. }
  776. }
  777. @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)
  778. public struct Grpc_Testing_ReconnectServiceAsyncClient: Grpc_Testing_ReconnectServiceAsyncClientProtocol {
  779. public var channel: GRPCChannel
  780. public var defaultCallOptions: CallOptions
  781. public var interceptors: Grpc_Testing_ReconnectServiceClientInterceptorFactoryProtocol?
  782. public init(
  783. channel: GRPCChannel,
  784. defaultCallOptions: CallOptions = CallOptions(),
  785. interceptors: Grpc_Testing_ReconnectServiceClientInterceptorFactoryProtocol? = nil
  786. ) {
  787. self.channel = channel
  788. self.defaultCallOptions = defaultCallOptions
  789. self.interceptors = interceptors
  790. }
  791. }
  792. #endif // compiler(>=5.5)
  793. /// A simple service to test the various types of RPCs and experiment with
  794. /// performance with various types of payload.
  795. ///
  796. /// To build a server, implement a class that conforms to this protocol.
  797. public protocol Grpc_Testing_TestServiceProvider: CallHandlerProvider {
  798. var interceptors: Grpc_Testing_TestServiceServerInterceptorFactoryProtocol? { get }
  799. /// One empty request followed by one empty response.
  800. func emptyCall(request: Grpc_Testing_Empty, context: StatusOnlyCallContext) -> EventLoopFuture<Grpc_Testing_Empty>
  801. /// One request followed by one response.
  802. func unaryCall(request: Grpc_Testing_SimpleRequest, context: StatusOnlyCallContext) -> EventLoopFuture<Grpc_Testing_SimpleResponse>
  803. /// One request followed by one response. Response has cache control
  804. /// headers set such that a caching HTTP proxy (such as GFE) can
  805. /// satisfy subsequent requests.
  806. func cacheableUnaryCall(request: Grpc_Testing_SimpleRequest, context: StatusOnlyCallContext) -> EventLoopFuture<Grpc_Testing_SimpleResponse>
  807. /// One request followed by a sequence of responses (streamed download).
  808. /// The server returns the payload with client desired type and sizes.
  809. func streamingOutputCall(request: Grpc_Testing_StreamingOutputCallRequest, context: StreamingResponseCallContext<Grpc_Testing_StreamingOutputCallResponse>) -> EventLoopFuture<GRPCStatus>
  810. /// A sequence of requests followed by one response (streamed upload).
  811. /// The server returns the aggregated size of client payload as the result.
  812. func streamingInputCall(context: UnaryResponseCallContext<Grpc_Testing_StreamingInputCallResponse>) -> EventLoopFuture<(StreamEvent<Grpc_Testing_StreamingInputCallRequest>) -> Void>
  813. /// A sequence of requests with each request served by the server immediately.
  814. /// As one request could lead to multiple responses, this interface
  815. /// demonstrates the idea of full duplexing.
  816. func fullDuplexCall(context: StreamingResponseCallContext<Grpc_Testing_StreamingOutputCallResponse>) -> EventLoopFuture<(StreamEvent<Grpc_Testing_StreamingOutputCallRequest>) -> Void>
  817. /// A sequence of requests followed by a sequence of responses.
  818. /// The server buffers all the client requests and then serves them in order. A
  819. /// stream of responses are returned to the client when the server starts with
  820. /// first request.
  821. func halfDuplexCall(context: StreamingResponseCallContext<Grpc_Testing_StreamingOutputCallResponse>) -> EventLoopFuture<(StreamEvent<Grpc_Testing_StreamingOutputCallRequest>) -> Void>
  822. }
  823. extension Grpc_Testing_TestServiceProvider {
  824. public var serviceName: Substring { return "grpc.testing.TestService" }
  825. /// Determines, calls and returns the appropriate request handler, depending on the request's method.
  826. /// Returns nil for methods not handled by this service.
  827. public func handle(
  828. method name: Substring,
  829. context: CallHandlerContext
  830. ) -> GRPCServerHandlerProtocol? {
  831. switch name {
  832. case "EmptyCall":
  833. return UnaryServerHandler(
  834. context: context,
  835. requestDeserializer: ProtobufDeserializer<Grpc_Testing_Empty>(),
  836. responseSerializer: ProtobufSerializer<Grpc_Testing_Empty>(),
  837. interceptors: self.interceptors?.makeEmptyCallInterceptors() ?? [],
  838. userFunction: self.emptyCall(request:context:)
  839. )
  840. case "UnaryCall":
  841. return UnaryServerHandler(
  842. context: context,
  843. requestDeserializer: ProtobufDeserializer<Grpc_Testing_SimpleRequest>(),
  844. responseSerializer: ProtobufSerializer<Grpc_Testing_SimpleResponse>(),
  845. interceptors: self.interceptors?.makeUnaryCallInterceptors() ?? [],
  846. userFunction: self.unaryCall(request:context:)
  847. )
  848. case "CacheableUnaryCall":
  849. return UnaryServerHandler(
  850. context: context,
  851. requestDeserializer: ProtobufDeserializer<Grpc_Testing_SimpleRequest>(),
  852. responseSerializer: ProtobufSerializer<Grpc_Testing_SimpleResponse>(),
  853. interceptors: self.interceptors?.makeCacheableUnaryCallInterceptors() ?? [],
  854. userFunction: self.cacheableUnaryCall(request:context:)
  855. )
  856. case "StreamingOutputCall":
  857. return ServerStreamingServerHandler(
  858. context: context,
  859. requestDeserializer: ProtobufDeserializer<Grpc_Testing_StreamingOutputCallRequest>(),
  860. responseSerializer: ProtobufSerializer<Grpc_Testing_StreamingOutputCallResponse>(),
  861. interceptors: self.interceptors?.makeStreamingOutputCallInterceptors() ?? [],
  862. userFunction: self.streamingOutputCall(request:context:)
  863. )
  864. case "StreamingInputCall":
  865. return ClientStreamingServerHandler(
  866. context: context,
  867. requestDeserializer: ProtobufDeserializer<Grpc_Testing_StreamingInputCallRequest>(),
  868. responseSerializer: ProtobufSerializer<Grpc_Testing_StreamingInputCallResponse>(),
  869. interceptors: self.interceptors?.makeStreamingInputCallInterceptors() ?? [],
  870. observerFactory: self.streamingInputCall(context:)
  871. )
  872. case "FullDuplexCall":
  873. return BidirectionalStreamingServerHandler(
  874. context: context,
  875. requestDeserializer: ProtobufDeserializer<Grpc_Testing_StreamingOutputCallRequest>(),
  876. responseSerializer: ProtobufSerializer<Grpc_Testing_StreamingOutputCallResponse>(),
  877. interceptors: self.interceptors?.makeFullDuplexCallInterceptors() ?? [],
  878. observerFactory: self.fullDuplexCall(context:)
  879. )
  880. case "HalfDuplexCall":
  881. return BidirectionalStreamingServerHandler(
  882. context: context,
  883. requestDeserializer: ProtobufDeserializer<Grpc_Testing_StreamingOutputCallRequest>(),
  884. responseSerializer: ProtobufSerializer<Grpc_Testing_StreamingOutputCallResponse>(),
  885. interceptors: self.interceptors?.makeHalfDuplexCallInterceptors() ?? [],
  886. observerFactory: self.halfDuplexCall(context:)
  887. )
  888. default:
  889. return nil
  890. }
  891. }
  892. }
  893. public protocol Grpc_Testing_TestServiceServerInterceptorFactoryProtocol {
  894. /// - Returns: Interceptors to use when handling 'emptyCall'.
  895. /// Defaults to calling `self.makeInterceptors()`.
  896. func makeEmptyCallInterceptors() -> [ServerInterceptor<Grpc_Testing_Empty, Grpc_Testing_Empty>]
  897. /// - Returns: Interceptors to use when handling 'unaryCall'.
  898. /// Defaults to calling `self.makeInterceptors()`.
  899. func makeUnaryCallInterceptors() -> [ServerInterceptor<Grpc_Testing_SimpleRequest, Grpc_Testing_SimpleResponse>]
  900. /// - Returns: Interceptors to use when handling 'cacheableUnaryCall'.
  901. /// Defaults to calling `self.makeInterceptors()`.
  902. func makeCacheableUnaryCallInterceptors() -> [ServerInterceptor<Grpc_Testing_SimpleRequest, Grpc_Testing_SimpleResponse>]
  903. /// - Returns: Interceptors to use when handling 'streamingOutputCall'.
  904. /// Defaults to calling `self.makeInterceptors()`.
  905. func makeStreamingOutputCallInterceptors() -> [ServerInterceptor<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse>]
  906. /// - Returns: Interceptors to use when handling 'streamingInputCall'.
  907. /// Defaults to calling `self.makeInterceptors()`.
  908. func makeStreamingInputCallInterceptors() -> [ServerInterceptor<Grpc_Testing_StreamingInputCallRequest, Grpc_Testing_StreamingInputCallResponse>]
  909. /// - Returns: Interceptors to use when handling 'fullDuplexCall'.
  910. /// Defaults to calling `self.makeInterceptors()`.
  911. func makeFullDuplexCallInterceptors() -> [ServerInterceptor<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse>]
  912. /// - Returns: Interceptors to use when handling 'halfDuplexCall'.
  913. /// Defaults to calling `self.makeInterceptors()`.
  914. func makeHalfDuplexCallInterceptors() -> [ServerInterceptor<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse>]
  915. /// - Returns: Interceptors to use when handling 'unimplementedCall'.
  916. /// Defaults to calling `self.makeInterceptors()`.
  917. func makeUnimplementedCallInterceptors() -> [ServerInterceptor<Grpc_Testing_Empty, Grpc_Testing_Empty>]
  918. }
  919. #if compiler(>=5.5)
  920. /// A simple service to test the various types of RPCs and experiment with
  921. /// performance with various types of payload.
  922. ///
  923. /// To implement a server, implement an object which conforms to this protocol.
  924. @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)
  925. public protocol Grpc_Testing_TestServiceAsyncProvider: CallHandlerProvider {
  926. var interceptors: Grpc_Testing_TestServiceServerInterceptorFactoryProtocol? { get }
  927. /// One empty request followed by one empty response.
  928. @Sendable func emptyCall(
  929. request: Grpc_Testing_Empty,
  930. context: GRPCAsyncServerCallContext
  931. ) async throws -> Grpc_Testing_Empty
  932. /// One request followed by one response.
  933. @Sendable func unaryCall(
  934. request: Grpc_Testing_SimpleRequest,
  935. context: GRPCAsyncServerCallContext
  936. ) async throws -> Grpc_Testing_SimpleResponse
  937. /// One request followed by one response. Response has cache control
  938. /// headers set such that a caching HTTP proxy (such as GFE) can
  939. /// satisfy subsequent requests.
  940. @Sendable func cacheableUnaryCall(
  941. request: Grpc_Testing_SimpleRequest,
  942. context: GRPCAsyncServerCallContext
  943. ) async throws -> Grpc_Testing_SimpleResponse
  944. /// One request followed by a sequence of responses (streamed download).
  945. /// The server returns the payload with client desired type and sizes.
  946. @Sendable func streamingOutputCall(
  947. request: Grpc_Testing_StreamingOutputCallRequest,
  948. responseStream: GRPCAsyncResponseStreamWriter<Grpc_Testing_StreamingOutputCallResponse>,
  949. context: GRPCAsyncServerCallContext
  950. ) async throws
  951. /// A sequence of requests followed by one response (streamed upload).
  952. /// The server returns the aggregated size of client payload as the result.
  953. @Sendable func streamingInputCall(
  954. requests: GRPCAsyncRequestStream<Grpc_Testing_StreamingInputCallRequest>,
  955. context: GRPCAsyncServerCallContext
  956. ) async throws -> Grpc_Testing_StreamingInputCallResponse
  957. /// A sequence of requests with each request served by the server immediately.
  958. /// As one request could lead to multiple responses, this interface
  959. /// demonstrates the idea of full duplexing.
  960. @Sendable func fullDuplexCall(
  961. requests: GRPCAsyncRequestStream<Grpc_Testing_StreamingOutputCallRequest>,
  962. responseStream: GRPCAsyncResponseStreamWriter<Grpc_Testing_StreamingOutputCallResponse>,
  963. context: GRPCAsyncServerCallContext
  964. ) async throws
  965. /// A sequence of requests followed by a sequence of responses.
  966. /// The server buffers all the client requests and then serves them in order. A
  967. /// stream of responses are returned to the client when the server starts with
  968. /// first request.
  969. @Sendable func halfDuplexCall(
  970. requests: GRPCAsyncRequestStream<Grpc_Testing_StreamingOutputCallRequest>,
  971. responseStream: GRPCAsyncResponseStreamWriter<Grpc_Testing_StreamingOutputCallResponse>,
  972. context: GRPCAsyncServerCallContext
  973. ) async throws
  974. }
  975. @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)
  976. extension Grpc_Testing_TestServiceAsyncProvider {
  977. public var serviceName: Substring {
  978. return "grpc.testing.TestService"
  979. }
  980. public var interceptors: Grpc_Testing_TestServiceServerInterceptorFactoryProtocol? {
  981. return nil
  982. }
  983. public func handle(
  984. method name: Substring,
  985. context: CallHandlerContext
  986. ) -> GRPCServerHandlerProtocol? {
  987. switch name {
  988. case "EmptyCall":
  989. return GRPCAsyncServerHandler(
  990. context: context,
  991. requestDeserializer: ProtobufDeserializer<Grpc_Testing_Empty>(),
  992. responseSerializer: ProtobufSerializer<Grpc_Testing_Empty>(),
  993. interceptors: self.interceptors?.makeEmptyCallInterceptors() ?? [],
  994. wrapping: self.emptyCall(request:context:)
  995. )
  996. case "UnaryCall":
  997. return GRPCAsyncServerHandler(
  998. context: context,
  999. requestDeserializer: ProtobufDeserializer<Grpc_Testing_SimpleRequest>(),
  1000. responseSerializer: ProtobufSerializer<Grpc_Testing_SimpleResponse>(),
  1001. interceptors: self.interceptors?.makeUnaryCallInterceptors() ?? [],
  1002. wrapping: self.unaryCall(request:context:)
  1003. )
  1004. case "CacheableUnaryCall":
  1005. return GRPCAsyncServerHandler(
  1006. context: context,
  1007. requestDeserializer: ProtobufDeserializer<Grpc_Testing_SimpleRequest>(),
  1008. responseSerializer: ProtobufSerializer<Grpc_Testing_SimpleResponse>(),
  1009. interceptors: self.interceptors?.makeCacheableUnaryCallInterceptors() ?? [],
  1010. wrapping: self.cacheableUnaryCall(request:context:)
  1011. )
  1012. case "StreamingOutputCall":
  1013. return GRPCAsyncServerHandler(
  1014. context: context,
  1015. requestDeserializer: ProtobufDeserializer<Grpc_Testing_StreamingOutputCallRequest>(),
  1016. responseSerializer: ProtobufSerializer<Grpc_Testing_StreamingOutputCallResponse>(),
  1017. interceptors: self.interceptors?.makeStreamingOutputCallInterceptors() ?? [],
  1018. wrapping: self.streamingOutputCall(request:responseStream:context:)
  1019. )
  1020. case "StreamingInputCall":
  1021. return GRPCAsyncServerHandler(
  1022. context: context,
  1023. requestDeserializer: ProtobufDeserializer<Grpc_Testing_StreamingInputCallRequest>(),
  1024. responseSerializer: ProtobufSerializer<Grpc_Testing_StreamingInputCallResponse>(),
  1025. interceptors: self.interceptors?.makeStreamingInputCallInterceptors() ?? [],
  1026. wrapping: self.streamingInputCall(requests:context:)
  1027. )
  1028. case "FullDuplexCall":
  1029. return GRPCAsyncServerHandler(
  1030. context: context,
  1031. requestDeserializer: ProtobufDeserializer<Grpc_Testing_StreamingOutputCallRequest>(),
  1032. responseSerializer: ProtobufSerializer<Grpc_Testing_StreamingOutputCallResponse>(),
  1033. interceptors: self.interceptors?.makeFullDuplexCallInterceptors() ?? [],
  1034. wrapping: self.fullDuplexCall(requests:responseStream:context:)
  1035. )
  1036. case "HalfDuplexCall":
  1037. return GRPCAsyncServerHandler(
  1038. context: context,
  1039. requestDeserializer: ProtobufDeserializer<Grpc_Testing_StreamingOutputCallRequest>(),
  1040. responseSerializer: ProtobufSerializer<Grpc_Testing_StreamingOutputCallResponse>(),
  1041. interceptors: self.interceptors?.makeHalfDuplexCallInterceptors() ?? [],
  1042. wrapping: self.halfDuplexCall(requests:responseStream:context:)
  1043. )
  1044. default:
  1045. return nil
  1046. }
  1047. }
  1048. }
  1049. #endif // compiler(>=5.5)
  1050. /// A simple service NOT implemented at servers so clients can test for
  1051. /// that case.
  1052. ///
  1053. /// To build a server, implement a class that conforms to this protocol.
  1054. public protocol Grpc_Testing_UnimplementedServiceProvider: CallHandlerProvider {
  1055. var interceptors: Grpc_Testing_UnimplementedServiceServerInterceptorFactoryProtocol? { get }
  1056. /// A call that no server should implement
  1057. func unimplementedCall(request: Grpc_Testing_Empty, context: StatusOnlyCallContext) -> EventLoopFuture<Grpc_Testing_Empty>
  1058. }
  1059. extension Grpc_Testing_UnimplementedServiceProvider {
  1060. public var serviceName: Substring { return "grpc.testing.UnimplementedService" }
  1061. /// Determines, calls and returns the appropriate request handler, depending on the request's method.
  1062. /// Returns nil for methods not handled by this service.
  1063. public func handle(
  1064. method name: Substring,
  1065. context: CallHandlerContext
  1066. ) -> GRPCServerHandlerProtocol? {
  1067. switch name {
  1068. case "UnimplementedCall":
  1069. return UnaryServerHandler(
  1070. context: context,
  1071. requestDeserializer: ProtobufDeserializer<Grpc_Testing_Empty>(),
  1072. responseSerializer: ProtobufSerializer<Grpc_Testing_Empty>(),
  1073. interceptors: self.interceptors?.makeUnimplementedCallInterceptors() ?? [],
  1074. userFunction: self.unimplementedCall(request:context:)
  1075. )
  1076. default:
  1077. return nil
  1078. }
  1079. }
  1080. }
  1081. public protocol Grpc_Testing_UnimplementedServiceServerInterceptorFactoryProtocol {
  1082. /// - Returns: Interceptors to use when handling 'unimplementedCall'.
  1083. /// Defaults to calling `self.makeInterceptors()`.
  1084. func makeUnimplementedCallInterceptors() -> [ServerInterceptor<Grpc_Testing_Empty, Grpc_Testing_Empty>]
  1085. }
  1086. #if compiler(>=5.5)
  1087. /// A simple service NOT implemented at servers so clients can test for
  1088. /// that case.
  1089. ///
  1090. /// To implement a server, implement an object which conforms to this protocol.
  1091. @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)
  1092. public protocol Grpc_Testing_UnimplementedServiceAsyncProvider: CallHandlerProvider {
  1093. var interceptors: Grpc_Testing_UnimplementedServiceServerInterceptorFactoryProtocol? { get }
  1094. /// A call that no server should implement
  1095. @Sendable func unimplementedCall(
  1096. request: Grpc_Testing_Empty,
  1097. context: GRPCAsyncServerCallContext
  1098. ) async throws -> Grpc_Testing_Empty
  1099. }
  1100. @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)
  1101. extension Grpc_Testing_UnimplementedServiceAsyncProvider {
  1102. public var serviceName: Substring {
  1103. return "grpc.testing.UnimplementedService"
  1104. }
  1105. public var interceptors: Grpc_Testing_UnimplementedServiceServerInterceptorFactoryProtocol? {
  1106. return nil
  1107. }
  1108. public func handle(
  1109. method name: Substring,
  1110. context: CallHandlerContext
  1111. ) -> GRPCServerHandlerProtocol? {
  1112. switch name {
  1113. case "UnimplementedCall":
  1114. return GRPCAsyncServerHandler(
  1115. context: context,
  1116. requestDeserializer: ProtobufDeserializer<Grpc_Testing_Empty>(),
  1117. responseSerializer: ProtobufSerializer<Grpc_Testing_Empty>(),
  1118. interceptors: self.interceptors?.makeUnimplementedCallInterceptors() ?? [],
  1119. wrapping: self.unimplementedCall(request:context:)
  1120. )
  1121. default:
  1122. return nil
  1123. }
  1124. }
  1125. }
  1126. #endif // compiler(>=5.5)
  1127. /// A service used to control reconnect server.
  1128. ///
  1129. /// To build a server, implement a class that conforms to this protocol.
  1130. public protocol Grpc_Testing_ReconnectServiceProvider: CallHandlerProvider {
  1131. var interceptors: Grpc_Testing_ReconnectServiceServerInterceptorFactoryProtocol? { get }
  1132. func start(request: Grpc_Testing_ReconnectParams, context: StatusOnlyCallContext) -> EventLoopFuture<Grpc_Testing_Empty>
  1133. func stop(request: Grpc_Testing_Empty, context: StatusOnlyCallContext) -> EventLoopFuture<Grpc_Testing_ReconnectInfo>
  1134. }
  1135. extension Grpc_Testing_ReconnectServiceProvider {
  1136. public var serviceName: Substring { return "grpc.testing.ReconnectService" }
  1137. /// Determines, calls and returns the appropriate request handler, depending on the request's method.
  1138. /// Returns nil for methods not handled by this service.
  1139. public func handle(
  1140. method name: Substring,
  1141. context: CallHandlerContext
  1142. ) -> GRPCServerHandlerProtocol? {
  1143. switch name {
  1144. case "Start":
  1145. return UnaryServerHandler(
  1146. context: context,
  1147. requestDeserializer: ProtobufDeserializer<Grpc_Testing_ReconnectParams>(),
  1148. responseSerializer: ProtobufSerializer<Grpc_Testing_Empty>(),
  1149. interceptors: self.interceptors?.makeStartInterceptors() ?? [],
  1150. userFunction: self.start(request:context:)
  1151. )
  1152. case "Stop":
  1153. return UnaryServerHandler(
  1154. context: context,
  1155. requestDeserializer: ProtobufDeserializer<Grpc_Testing_Empty>(),
  1156. responseSerializer: ProtobufSerializer<Grpc_Testing_ReconnectInfo>(),
  1157. interceptors: self.interceptors?.makeStopInterceptors() ?? [],
  1158. userFunction: self.stop(request:context:)
  1159. )
  1160. default:
  1161. return nil
  1162. }
  1163. }
  1164. }
  1165. public protocol Grpc_Testing_ReconnectServiceServerInterceptorFactoryProtocol {
  1166. /// - Returns: Interceptors to use when handling 'start'.
  1167. /// Defaults to calling `self.makeInterceptors()`.
  1168. func makeStartInterceptors() -> [ServerInterceptor<Grpc_Testing_ReconnectParams, Grpc_Testing_Empty>]
  1169. /// - Returns: Interceptors to use when handling 'stop'.
  1170. /// Defaults to calling `self.makeInterceptors()`.
  1171. func makeStopInterceptors() -> [ServerInterceptor<Grpc_Testing_Empty, Grpc_Testing_ReconnectInfo>]
  1172. }
  1173. #if compiler(>=5.5)
  1174. /// A service used to control reconnect server.
  1175. ///
  1176. /// To implement a server, implement an object which conforms to this protocol.
  1177. @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)
  1178. public protocol Grpc_Testing_ReconnectServiceAsyncProvider: CallHandlerProvider {
  1179. var interceptors: Grpc_Testing_ReconnectServiceServerInterceptorFactoryProtocol? { get }
  1180. @Sendable func start(
  1181. request: Grpc_Testing_ReconnectParams,
  1182. context: GRPCAsyncServerCallContext
  1183. ) async throws -> Grpc_Testing_Empty
  1184. @Sendable func stop(
  1185. request: Grpc_Testing_Empty,
  1186. context: GRPCAsyncServerCallContext
  1187. ) async throws -> Grpc_Testing_ReconnectInfo
  1188. }
  1189. @available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)
  1190. extension Grpc_Testing_ReconnectServiceAsyncProvider {
  1191. public var serviceName: Substring {
  1192. return "grpc.testing.ReconnectService"
  1193. }
  1194. public var interceptors: Grpc_Testing_ReconnectServiceServerInterceptorFactoryProtocol? {
  1195. return nil
  1196. }
  1197. public func handle(
  1198. method name: Substring,
  1199. context: CallHandlerContext
  1200. ) -> GRPCServerHandlerProtocol? {
  1201. switch name {
  1202. case "Start":
  1203. return GRPCAsyncServerHandler(
  1204. context: context,
  1205. requestDeserializer: ProtobufDeserializer<Grpc_Testing_ReconnectParams>(),
  1206. responseSerializer: ProtobufSerializer<Grpc_Testing_Empty>(),
  1207. interceptors: self.interceptors?.makeStartInterceptors() ?? [],
  1208. wrapping: self.start(request:context:)
  1209. )
  1210. case "Stop":
  1211. return GRPCAsyncServerHandler(
  1212. context: context,
  1213. requestDeserializer: ProtobufDeserializer<Grpc_Testing_Empty>(),
  1214. responseSerializer: ProtobufSerializer<Grpc_Testing_ReconnectInfo>(),
  1215. interceptors: self.interceptors?.makeStopInterceptors() ?? [],
  1216. wrapping: self.stop(request:context:)
  1217. )
  1218. default:
  1219. return nil
  1220. }
  1221. }
  1222. }
  1223. #endif // compiler(>=5.5)