test.grpc.swift 71 KB

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