test.grpc.swift 70 KB

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