test.grpc.swift 71 KB

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