test.grpc.swift 67 KB

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