test.grpc.swift 71 KB

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