test.grpc.swift 52 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973
  1. // Copyright 2015-2016 gRPC authors.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. // An integration test service that covers all the method signature permutations
  15. // of unary/streaming requests/responses.
  16. // DO NOT EDIT.
  17. // swift-format-ignore-file
  18. //
  19. // Generated by the gRPC Swift generator plugin for the protocol buffer compiler.
  20. // Source: src/proto/grpc/testing/test.proto
  21. //
  22. // For information on using the generated types, please see the documentation:
  23. // https://github.com/grpc/grpc-swift
  24. import GRPCCore
  25. import GRPCProtobuf
  26. public enum Grpc_Testing_ReconnectService {
  27. public enum Method {
  28. public enum Start {
  29. public typealias Input = Grpc_Testing_ReconnectParams
  30. public typealias Output = Grpc_Testing_Empty
  31. public static let descriptor = MethodDescriptor(
  32. service: "grpc.testing.ReconnectService",
  33. method: "Start"
  34. )
  35. }
  36. public enum Stop {
  37. public typealias Input = Grpc_Testing_Empty
  38. public typealias Output = Grpc_Testing_ReconnectInfo
  39. public static let descriptor = MethodDescriptor(
  40. service: "grpc.testing.ReconnectService",
  41. method: "Stop"
  42. )
  43. }
  44. public static let descriptors: [MethodDescriptor] = [
  45. Start.descriptor,
  46. Stop.descriptor
  47. ]
  48. }
  49. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  50. public typealias StreamingServiceProtocol = Grpc_Testing_ReconnectServiceStreamingServiceProtocol
  51. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  52. public typealias ServiceProtocol = Grpc_Testing_ReconnectServiceServiceProtocol
  53. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  54. public typealias ClientProtocol = Grpc_Testing_ReconnectServiceClientProtocol
  55. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  56. public typealias Client = Grpc_Testing_ReconnectServiceClient
  57. }
  58. public enum Grpc_Testing_TestService {
  59. public enum Method {
  60. public enum EmptyCall {
  61. public typealias Input = Grpc_Testing_Empty
  62. public typealias Output = Grpc_Testing_Empty
  63. public static let descriptor = MethodDescriptor(
  64. service: "grpc.testing.TestService",
  65. method: "EmptyCall"
  66. )
  67. }
  68. public enum UnaryCall {
  69. public typealias Input = Grpc_Testing_SimpleRequest
  70. public typealias Output = Grpc_Testing_SimpleResponse
  71. public static let descriptor = MethodDescriptor(
  72. service: "grpc.testing.TestService",
  73. method: "UnaryCall"
  74. )
  75. }
  76. public enum CacheableUnaryCall {
  77. public typealias Input = Grpc_Testing_SimpleRequest
  78. public typealias Output = Grpc_Testing_SimpleResponse
  79. public static let descriptor = MethodDescriptor(
  80. service: "grpc.testing.TestService",
  81. method: "CacheableUnaryCall"
  82. )
  83. }
  84. public enum StreamingOutputCall {
  85. public typealias Input = Grpc_Testing_StreamingOutputCallRequest
  86. public typealias Output = Grpc_Testing_StreamingOutputCallResponse
  87. public static let descriptor = MethodDescriptor(
  88. service: "grpc.testing.TestService",
  89. method: "StreamingOutputCall"
  90. )
  91. }
  92. public enum StreamingInputCall {
  93. public typealias Input = Grpc_Testing_StreamingInputCallRequest
  94. public typealias Output = Grpc_Testing_StreamingInputCallResponse
  95. public static let descriptor = MethodDescriptor(
  96. service: "grpc.testing.TestService",
  97. method: "StreamingInputCall"
  98. )
  99. }
  100. public enum FullDuplexCall {
  101. public typealias Input = Grpc_Testing_StreamingOutputCallRequest
  102. public typealias Output = Grpc_Testing_StreamingOutputCallResponse
  103. public static let descriptor = MethodDescriptor(
  104. service: "grpc.testing.TestService",
  105. method: "FullDuplexCall"
  106. )
  107. }
  108. public enum HalfDuplexCall {
  109. public typealias Input = Grpc_Testing_StreamingOutputCallRequest
  110. public typealias Output = Grpc_Testing_StreamingOutputCallResponse
  111. public static let descriptor = MethodDescriptor(
  112. service: "grpc.testing.TestService",
  113. method: "HalfDuplexCall"
  114. )
  115. }
  116. public enum UnimplementedCall {
  117. public typealias Input = Grpc_Testing_Empty
  118. public typealias Output = Grpc_Testing_Empty
  119. public static let descriptor = MethodDescriptor(
  120. service: "grpc.testing.TestService",
  121. method: "UnimplementedCall"
  122. )
  123. }
  124. public static let descriptors: [MethodDescriptor] = [
  125. EmptyCall.descriptor,
  126. UnaryCall.descriptor,
  127. CacheableUnaryCall.descriptor,
  128. StreamingOutputCall.descriptor,
  129. StreamingInputCall.descriptor,
  130. FullDuplexCall.descriptor,
  131. HalfDuplexCall.descriptor,
  132. UnimplementedCall.descriptor
  133. ]
  134. }
  135. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  136. public typealias StreamingServiceProtocol = Grpc_Testing_TestServiceStreamingServiceProtocol
  137. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  138. public typealias ServiceProtocol = Grpc_Testing_TestServiceServiceProtocol
  139. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  140. public typealias ClientProtocol = Grpc_Testing_TestServiceClientProtocol
  141. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  142. public typealias Client = Grpc_Testing_TestServiceClient
  143. }
  144. public enum Grpc_Testing_UnimplementedService {
  145. public enum Method {
  146. public enum UnimplementedCall {
  147. public typealias Input = Grpc_Testing_Empty
  148. public typealias Output = Grpc_Testing_Empty
  149. public static let descriptor = MethodDescriptor(
  150. service: "grpc.testing.UnimplementedService",
  151. method: "UnimplementedCall"
  152. )
  153. }
  154. public static let descriptors: [MethodDescriptor] = [
  155. UnimplementedCall.descriptor
  156. ]
  157. }
  158. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  159. public typealias StreamingServiceProtocol = Grpc_Testing_UnimplementedServiceStreamingServiceProtocol
  160. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  161. public typealias ServiceProtocol = Grpc_Testing_UnimplementedServiceServiceProtocol
  162. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  163. public typealias ClientProtocol = Grpc_Testing_UnimplementedServiceClientProtocol
  164. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  165. public typealias Client = Grpc_Testing_UnimplementedServiceClient
  166. }
  167. /// A simple service to test the various types of RPCs and experiment with
  168. /// performance with various types of payload.
  169. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  170. public protocol Grpc_Testing_TestServiceStreamingServiceProtocol: GRPCCore.RegistrableRPCService {
  171. /// One empty request followed by one empty response.
  172. func emptyCall(request: ServerRequest.Stream<Grpc_Testing_TestService.Method.EmptyCall.Input>) async throws -> ServerResponse.Stream<Grpc_Testing_TestService.Method.EmptyCall.Output>
  173. /// One request followed by one response.
  174. func unaryCall(request: ServerRequest.Stream<Grpc_Testing_TestService.Method.UnaryCall.Input>) async throws -> ServerResponse.Stream<Grpc_Testing_TestService.Method.UnaryCall.Output>
  175. /// One request followed by one response. Response has cache control
  176. /// headers set such that a caching HTTP proxy (such as GFE) can
  177. /// satisfy subsequent requests.
  178. func cacheableUnaryCall(request: ServerRequest.Stream<Grpc_Testing_TestService.Method.CacheableUnaryCall.Input>) async throws -> ServerResponse.Stream<Grpc_Testing_TestService.Method.CacheableUnaryCall.Output>
  179. /// One request followed by a sequence of responses (streamed download).
  180. /// The server returns the payload with client desired type and sizes.
  181. func streamingOutputCall(request: ServerRequest.Stream<Grpc_Testing_TestService.Method.StreamingOutputCall.Input>) async throws -> ServerResponse.Stream<Grpc_Testing_TestService.Method.StreamingOutputCall.Output>
  182. /// A sequence of requests followed by one response (streamed upload).
  183. /// The server returns the aggregated size of client payload as the result.
  184. func streamingInputCall(request: ServerRequest.Stream<Grpc_Testing_TestService.Method.StreamingInputCall.Input>) async throws -> ServerResponse.Stream<Grpc_Testing_TestService.Method.StreamingInputCall.Output>
  185. /// A sequence of requests with each request served by the server immediately.
  186. /// As one request could lead to multiple responses, this interface
  187. /// demonstrates the idea of full duplexing.
  188. func fullDuplexCall(request: ServerRequest.Stream<Grpc_Testing_TestService.Method.FullDuplexCall.Input>) async throws -> ServerResponse.Stream<Grpc_Testing_TestService.Method.FullDuplexCall.Output>
  189. /// A sequence of requests followed by a sequence of responses.
  190. /// The server buffers all the client requests and then serves them in order. A
  191. /// stream of responses are returned to the client when the server starts with
  192. /// first request.
  193. func halfDuplexCall(request: ServerRequest.Stream<Grpc_Testing_TestService.Method.HalfDuplexCall.Input>) async throws -> ServerResponse.Stream<Grpc_Testing_TestService.Method.HalfDuplexCall.Output>
  194. /// The test server will not implement this method. It will be used
  195. /// to test the behavior when clients call unimplemented methods.
  196. func unimplementedCall(request: ServerRequest.Stream<Grpc_Testing_TestService.Method.UnimplementedCall.Input>) async throws -> ServerResponse.Stream<Grpc_Testing_TestService.Method.UnimplementedCall.Output>
  197. }
  198. /// Conformance to `GRPCCore.RegistrableRPCService`.
  199. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  200. extension Grpc_Testing_TestService.StreamingServiceProtocol {
  201. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  202. public func registerMethods(with router: inout GRPCCore.RPCRouter) {
  203. router.registerHandler(
  204. forMethod: Grpc_Testing_TestService.Method.EmptyCall.descriptor,
  205. deserializer: ProtobufDeserializer<Grpc_Testing_TestService.Method.EmptyCall.Input>(),
  206. serializer: ProtobufSerializer<Grpc_Testing_TestService.Method.EmptyCall.Output>(),
  207. handler: { request in
  208. try await self.emptyCall(request: request)
  209. }
  210. )
  211. router.registerHandler(
  212. forMethod: Grpc_Testing_TestService.Method.UnaryCall.descriptor,
  213. deserializer: ProtobufDeserializer<Grpc_Testing_TestService.Method.UnaryCall.Input>(),
  214. serializer: ProtobufSerializer<Grpc_Testing_TestService.Method.UnaryCall.Output>(),
  215. handler: { request in
  216. try await self.unaryCall(request: request)
  217. }
  218. )
  219. router.registerHandler(
  220. forMethod: Grpc_Testing_TestService.Method.CacheableUnaryCall.descriptor,
  221. deserializer: ProtobufDeserializer<Grpc_Testing_TestService.Method.CacheableUnaryCall.Input>(),
  222. serializer: ProtobufSerializer<Grpc_Testing_TestService.Method.CacheableUnaryCall.Output>(),
  223. handler: { request in
  224. try await self.cacheableUnaryCall(request: request)
  225. }
  226. )
  227. router.registerHandler(
  228. forMethod: Grpc_Testing_TestService.Method.StreamingOutputCall.descriptor,
  229. deserializer: ProtobufDeserializer<Grpc_Testing_TestService.Method.StreamingOutputCall.Input>(),
  230. serializer: ProtobufSerializer<Grpc_Testing_TestService.Method.StreamingOutputCall.Output>(),
  231. handler: { request in
  232. try await self.streamingOutputCall(request: request)
  233. }
  234. )
  235. router.registerHandler(
  236. forMethod: Grpc_Testing_TestService.Method.StreamingInputCall.descriptor,
  237. deserializer: ProtobufDeserializer<Grpc_Testing_TestService.Method.StreamingInputCall.Input>(),
  238. serializer: ProtobufSerializer<Grpc_Testing_TestService.Method.StreamingInputCall.Output>(),
  239. handler: { request in
  240. try await self.streamingInputCall(request: request)
  241. }
  242. )
  243. router.registerHandler(
  244. forMethod: Grpc_Testing_TestService.Method.FullDuplexCall.descriptor,
  245. deserializer: ProtobufDeserializer<Grpc_Testing_TestService.Method.FullDuplexCall.Input>(),
  246. serializer: ProtobufSerializer<Grpc_Testing_TestService.Method.FullDuplexCall.Output>(),
  247. handler: { request in
  248. try await self.fullDuplexCall(request: request)
  249. }
  250. )
  251. router.registerHandler(
  252. forMethod: Grpc_Testing_TestService.Method.HalfDuplexCall.descriptor,
  253. deserializer: ProtobufDeserializer<Grpc_Testing_TestService.Method.HalfDuplexCall.Input>(),
  254. serializer: ProtobufSerializer<Grpc_Testing_TestService.Method.HalfDuplexCall.Output>(),
  255. handler: { request in
  256. try await self.halfDuplexCall(request: request)
  257. }
  258. )
  259. router.registerHandler(
  260. forMethod: Grpc_Testing_TestService.Method.UnimplementedCall.descriptor,
  261. deserializer: ProtobufDeserializer<Grpc_Testing_TestService.Method.UnimplementedCall.Input>(),
  262. serializer: ProtobufSerializer<Grpc_Testing_TestService.Method.UnimplementedCall.Output>(),
  263. handler: { request in
  264. try await self.unimplementedCall(request: request)
  265. }
  266. )
  267. }
  268. }
  269. /// A simple service to test the various types of RPCs and experiment with
  270. /// performance with various types of payload.
  271. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  272. public protocol Grpc_Testing_TestServiceServiceProtocol: Grpc_Testing_TestService.StreamingServiceProtocol {
  273. /// One empty request followed by one empty response.
  274. func emptyCall(request: ServerRequest.Single<Grpc_Testing_TestService.Method.EmptyCall.Input>) async throws -> ServerResponse.Single<Grpc_Testing_TestService.Method.EmptyCall.Output>
  275. /// One request followed by one response.
  276. func unaryCall(request: ServerRequest.Single<Grpc_Testing_TestService.Method.UnaryCall.Input>) async throws -> ServerResponse.Single<Grpc_Testing_TestService.Method.UnaryCall.Output>
  277. /// One request followed by one response. Response has cache control
  278. /// headers set such that a caching HTTP proxy (such as GFE) can
  279. /// satisfy subsequent requests.
  280. func cacheableUnaryCall(request: ServerRequest.Single<Grpc_Testing_TestService.Method.CacheableUnaryCall.Input>) async throws -> ServerResponse.Single<Grpc_Testing_TestService.Method.CacheableUnaryCall.Output>
  281. /// One request followed by a sequence of responses (streamed download).
  282. /// The server returns the payload with client desired type and sizes.
  283. func streamingOutputCall(request: ServerRequest.Single<Grpc_Testing_TestService.Method.StreamingOutputCall.Input>) async throws -> ServerResponse.Stream<Grpc_Testing_TestService.Method.StreamingOutputCall.Output>
  284. /// A sequence of requests followed by one response (streamed upload).
  285. /// The server returns the aggregated size of client payload as the result.
  286. func streamingInputCall(request: ServerRequest.Stream<Grpc_Testing_TestService.Method.StreamingInputCall.Input>) async throws -> ServerResponse.Single<Grpc_Testing_TestService.Method.StreamingInputCall.Output>
  287. /// A sequence of requests with each request served by the server immediately.
  288. /// As one request could lead to multiple responses, this interface
  289. /// demonstrates the idea of full duplexing.
  290. func fullDuplexCall(request: ServerRequest.Stream<Grpc_Testing_TestService.Method.FullDuplexCall.Input>) async throws -> ServerResponse.Stream<Grpc_Testing_TestService.Method.FullDuplexCall.Output>
  291. /// A sequence of requests followed by a sequence of responses.
  292. /// The server buffers all the client requests and then serves them in order. A
  293. /// stream of responses are returned to the client when the server starts with
  294. /// first request.
  295. func halfDuplexCall(request: ServerRequest.Stream<Grpc_Testing_TestService.Method.HalfDuplexCall.Input>) async throws -> ServerResponse.Stream<Grpc_Testing_TestService.Method.HalfDuplexCall.Output>
  296. /// The test server will not implement this method. It will be used
  297. /// to test the behavior when clients call unimplemented methods.
  298. func unimplementedCall(request: ServerRequest.Single<Grpc_Testing_TestService.Method.UnimplementedCall.Input>) async throws -> ServerResponse.Single<Grpc_Testing_TestService.Method.UnimplementedCall.Output>
  299. }
  300. /// Partial conformance to `Grpc_Testing_TestServiceStreamingServiceProtocol`.
  301. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  302. extension Grpc_Testing_TestService.ServiceProtocol {
  303. public func emptyCall(request: ServerRequest.Stream<Grpc_Testing_TestService.Method.EmptyCall.Input>) async throws -> ServerResponse.Stream<Grpc_Testing_TestService.Method.EmptyCall.Output> {
  304. let response = try await self.emptyCall(request: ServerRequest.Single(stream: request))
  305. return ServerResponse.Stream(single: response)
  306. }
  307. public func unaryCall(request: ServerRequest.Stream<Grpc_Testing_TestService.Method.UnaryCall.Input>) async throws -> ServerResponse.Stream<Grpc_Testing_TestService.Method.UnaryCall.Output> {
  308. let response = try await self.unaryCall(request: ServerRequest.Single(stream: request))
  309. return ServerResponse.Stream(single: response)
  310. }
  311. public func cacheableUnaryCall(request: ServerRequest.Stream<Grpc_Testing_TestService.Method.CacheableUnaryCall.Input>) async throws -> ServerResponse.Stream<Grpc_Testing_TestService.Method.CacheableUnaryCall.Output> {
  312. let response = try await self.cacheableUnaryCall(request: ServerRequest.Single(stream: request))
  313. return ServerResponse.Stream(single: response)
  314. }
  315. public func streamingOutputCall(request: ServerRequest.Stream<Grpc_Testing_TestService.Method.StreamingOutputCall.Input>) async throws -> ServerResponse.Stream<Grpc_Testing_TestService.Method.StreamingOutputCall.Output> {
  316. let response = try await self.streamingOutputCall(request: ServerRequest.Single(stream: request))
  317. return response
  318. }
  319. public func streamingInputCall(request: ServerRequest.Stream<Grpc_Testing_TestService.Method.StreamingInputCall.Input>) async throws -> ServerResponse.Stream<Grpc_Testing_TestService.Method.StreamingInputCall.Output> {
  320. let response = try await self.streamingInputCall(request: request)
  321. return ServerResponse.Stream(single: response)
  322. }
  323. public func unimplementedCall(request: ServerRequest.Stream<Grpc_Testing_TestService.Method.UnimplementedCall.Input>) async throws -> ServerResponse.Stream<Grpc_Testing_TestService.Method.UnimplementedCall.Output> {
  324. let response = try await self.unimplementedCall(request: ServerRequest.Single(stream: request))
  325. return ServerResponse.Stream(single: response)
  326. }
  327. }
  328. /// A simple service NOT implemented at servers so clients can test for
  329. /// that case.
  330. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  331. public protocol Grpc_Testing_UnimplementedServiceStreamingServiceProtocol: GRPCCore.RegistrableRPCService {
  332. /// A call that no server should implement
  333. func unimplementedCall(request: ServerRequest.Stream<Grpc_Testing_UnimplementedService.Method.UnimplementedCall.Input>) async throws -> ServerResponse.Stream<Grpc_Testing_UnimplementedService.Method.UnimplementedCall.Output>
  334. }
  335. /// Conformance to `GRPCCore.RegistrableRPCService`.
  336. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  337. extension Grpc_Testing_UnimplementedService.StreamingServiceProtocol {
  338. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  339. public func registerMethods(with router: inout GRPCCore.RPCRouter) {
  340. router.registerHandler(
  341. forMethod: Grpc_Testing_UnimplementedService.Method.UnimplementedCall.descriptor,
  342. deserializer: ProtobufDeserializer<Grpc_Testing_UnimplementedService.Method.UnimplementedCall.Input>(),
  343. serializer: ProtobufSerializer<Grpc_Testing_UnimplementedService.Method.UnimplementedCall.Output>(),
  344. handler: { request in
  345. try await self.unimplementedCall(request: request)
  346. }
  347. )
  348. }
  349. }
  350. /// A simple service NOT implemented at servers so clients can test for
  351. /// that case.
  352. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  353. public protocol Grpc_Testing_UnimplementedServiceServiceProtocol: Grpc_Testing_UnimplementedService.StreamingServiceProtocol {
  354. /// A call that no server should implement
  355. func unimplementedCall(request: ServerRequest.Single<Grpc_Testing_UnimplementedService.Method.UnimplementedCall.Input>) async throws -> ServerResponse.Single<Grpc_Testing_UnimplementedService.Method.UnimplementedCall.Output>
  356. }
  357. /// Partial conformance to `Grpc_Testing_UnimplementedServiceStreamingServiceProtocol`.
  358. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  359. extension Grpc_Testing_UnimplementedService.ServiceProtocol {
  360. public func unimplementedCall(request: ServerRequest.Stream<Grpc_Testing_UnimplementedService.Method.UnimplementedCall.Input>) async throws -> ServerResponse.Stream<Grpc_Testing_UnimplementedService.Method.UnimplementedCall.Output> {
  361. let response = try await self.unimplementedCall(request: ServerRequest.Single(stream: request))
  362. return ServerResponse.Stream(single: response)
  363. }
  364. }
  365. /// A service used to control reconnect server.
  366. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  367. public protocol Grpc_Testing_ReconnectServiceStreamingServiceProtocol: GRPCCore.RegistrableRPCService {
  368. func start(request: ServerRequest.Stream<Grpc_Testing_ReconnectService.Method.Start.Input>) async throws -> ServerResponse.Stream<Grpc_Testing_ReconnectService.Method.Start.Output>
  369. func stop(request: ServerRequest.Stream<Grpc_Testing_ReconnectService.Method.Stop.Input>) async throws -> ServerResponse.Stream<Grpc_Testing_ReconnectService.Method.Stop.Output>
  370. }
  371. /// Conformance to `GRPCCore.RegistrableRPCService`.
  372. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  373. extension Grpc_Testing_ReconnectService.StreamingServiceProtocol {
  374. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  375. public func registerMethods(with router: inout GRPCCore.RPCRouter) {
  376. router.registerHandler(
  377. forMethod: Grpc_Testing_ReconnectService.Method.Start.descriptor,
  378. deserializer: ProtobufDeserializer<Grpc_Testing_ReconnectService.Method.Start.Input>(),
  379. serializer: ProtobufSerializer<Grpc_Testing_ReconnectService.Method.Start.Output>(),
  380. handler: { request in
  381. try await self.start(request: request)
  382. }
  383. )
  384. router.registerHandler(
  385. forMethod: Grpc_Testing_ReconnectService.Method.Stop.descriptor,
  386. deserializer: ProtobufDeserializer<Grpc_Testing_ReconnectService.Method.Stop.Input>(),
  387. serializer: ProtobufSerializer<Grpc_Testing_ReconnectService.Method.Stop.Output>(),
  388. handler: { request in
  389. try await self.stop(request: request)
  390. }
  391. )
  392. }
  393. }
  394. /// A service used to control reconnect server.
  395. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  396. public protocol Grpc_Testing_ReconnectServiceServiceProtocol: Grpc_Testing_ReconnectService.StreamingServiceProtocol {
  397. func start(request: ServerRequest.Single<Grpc_Testing_ReconnectService.Method.Start.Input>) async throws -> ServerResponse.Single<Grpc_Testing_ReconnectService.Method.Start.Output>
  398. func stop(request: ServerRequest.Single<Grpc_Testing_ReconnectService.Method.Stop.Input>) async throws -> ServerResponse.Single<Grpc_Testing_ReconnectService.Method.Stop.Output>
  399. }
  400. /// Partial conformance to `Grpc_Testing_ReconnectServiceStreamingServiceProtocol`.
  401. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  402. extension Grpc_Testing_ReconnectService.ServiceProtocol {
  403. public func start(request: ServerRequest.Stream<Grpc_Testing_ReconnectService.Method.Start.Input>) async throws -> ServerResponse.Stream<Grpc_Testing_ReconnectService.Method.Start.Output> {
  404. let response = try await self.start(request: ServerRequest.Single(stream: request))
  405. return ServerResponse.Stream(single: response)
  406. }
  407. public func stop(request: ServerRequest.Stream<Grpc_Testing_ReconnectService.Method.Stop.Input>) async throws -> ServerResponse.Stream<Grpc_Testing_ReconnectService.Method.Stop.Output> {
  408. let response = try await self.stop(request: ServerRequest.Single(stream: request))
  409. return ServerResponse.Stream(single: response)
  410. }
  411. }
  412. /// A simple service to test the various types of RPCs and experiment with
  413. /// performance with various types of payload.
  414. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  415. public protocol Grpc_Testing_TestServiceClientProtocol: Sendable {
  416. /// One empty request followed by one empty response.
  417. func emptyCall<R>(
  418. request: ClientRequest.Single<Grpc_Testing_TestService.Method.EmptyCall.Input>,
  419. serializer: some MessageSerializer<Grpc_Testing_TestService.Method.EmptyCall.Input>,
  420. deserializer: some MessageDeserializer<Grpc_Testing_TestService.Method.EmptyCall.Output>,
  421. options: CallOptions,
  422. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_TestService.Method.EmptyCall.Output>) async throws -> R
  423. ) async throws -> R where R: Sendable
  424. /// One request followed by one response.
  425. func unaryCall<R>(
  426. request: ClientRequest.Single<Grpc_Testing_TestService.Method.UnaryCall.Input>,
  427. serializer: some MessageSerializer<Grpc_Testing_TestService.Method.UnaryCall.Input>,
  428. deserializer: some MessageDeserializer<Grpc_Testing_TestService.Method.UnaryCall.Output>,
  429. options: CallOptions,
  430. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_TestService.Method.UnaryCall.Output>) async throws -> R
  431. ) async throws -> R where R: Sendable
  432. /// One request followed by one response. Response has cache control
  433. /// headers set such that a caching HTTP proxy (such as GFE) can
  434. /// satisfy subsequent requests.
  435. func cacheableUnaryCall<R>(
  436. request: ClientRequest.Single<Grpc_Testing_TestService.Method.CacheableUnaryCall.Input>,
  437. serializer: some MessageSerializer<Grpc_Testing_TestService.Method.CacheableUnaryCall.Input>,
  438. deserializer: some MessageDeserializer<Grpc_Testing_TestService.Method.CacheableUnaryCall.Output>,
  439. options: CallOptions,
  440. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_TestService.Method.CacheableUnaryCall.Output>) async throws -> R
  441. ) async throws -> R where R: Sendable
  442. /// One request followed by a sequence of responses (streamed download).
  443. /// The server returns the payload with client desired type and sizes.
  444. func streamingOutputCall<R>(
  445. request: ClientRequest.Single<Grpc_Testing_TestService.Method.StreamingOutputCall.Input>,
  446. serializer: some MessageSerializer<Grpc_Testing_TestService.Method.StreamingOutputCall.Input>,
  447. deserializer: some MessageDeserializer<Grpc_Testing_TestService.Method.StreamingOutputCall.Output>,
  448. options: CallOptions,
  449. _ body: @Sendable @escaping (ClientResponse.Stream<Grpc_Testing_TestService.Method.StreamingOutputCall.Output>) async throws -> R
  450. ) async throws -> R where R: Sendable
  451. /// A sequence of requests followed by one response (streamed upload).
  452. /// The server returns the aggregated size of client payload as the result.
  453. func streamingInputCall<R>(
  454. request: ClientRequest.Stream<Grpc_Testing_TestService.Method.StreamingInputCall.Input>,
  455. serializer: some MessageSerializer<Grpc_Testing_TestService.Method.StreamingInputCall.Input>,
  456. deserializer: some MessageDeserializer<Grpc_Testing_TestService.Method.StreamingInputCall.Output>,
  457. options: CallOptions,
  458. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_TestService.Method.StreamingInputCall.Output>) async throws -> R
  459. ) async throws -> R where R: Sendable
  460. /// A sequence of requests with each request served by the server immediately.
  461. /// As one request could lead to multiple responses, this interface
  462. /// demonstrates the idea of full duplexing.
  463. func fullDuplexCall<R>(
  464. request: ClientRequest.Stream<Grpc_Testing_TestService.Method.FullDuplexCall.Input>,
  465. serializer: some MessageSerializer<Grpc_Testing_TestService.Method.FullDuplexCall.Input>,
  466. deserializer: some MessageDeserializer<Grpc_Testing_TestService.Method.FullDuplexCall.Output>,
  467. options: CallOptions,
  468. _ body: @Sendable @escaping (ClientResponse.Stream<Grpc_Testing_TestService.Method.FullDuplexCall.Output>) async throws -> R
  469. ) async throws -> R where R: Sendable
  470. /// A sequence of requests followed by a sequence of responses.
  471. /// The server buffers all the client requests and then serves them in order. A
  472. /// stream of responses are returned to the client when the server starts with
  473. /// first request.
  474. func halfDuplexCall<R>(
  475. request: ClientRequest.Stream<Grpc_Testing_TestService.Method.HalfDuplexCall.Input>,
  476. serializer: some MessageSerializer<Grpc_Testing_TestService.Method.HalfDuplexCall.Input>,
  477. deserializer: some MessageDeserializer<Grpc_Testing_TestService.Method.HalfDuplexCall.Output>,
  478. options: CallOptions,
  479. _ body: @Sendable @escaping (ClientResponse.Stream<Grpc_Testing_TestService.Method.HalfDuplexCall.Output>) async throws -> R
  480. ) async throws -> R where R: Sendable
  481. /// The test server will not implement this method. It will be used
  482. /// to test the behavior when clients call unimplemented methods.
  483. func unimplementedCall<R>(
  484. request: ClientRequest.Single<Grpc_Testing_TestService.Method.UnimplementedCall.Input>,
  485. serializer: some MessageSerializer<Grpc_Testing_TestService.Method.UnimplementedCall.Input>,
  486. deserializer: some MessageDeserializer<Grpc_Testing_TestService.Method.UnimplementedCall.Output>,
  487. options: CallOptions,
  488. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_TestService.Method.UnimplementedCall.Output>) async throws -> R
  489. ) async throws -> R where R: Sendable
  490. }
  491. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  492. extension Grpc_Testing_TestService.ClientProtocol {
  493. public func emptyCall<R>(
  494. request: ClientRequest.Single<Grpc_Testing_TestService.Method.EmptyCall.Input>,
  495. options: CallOptions = .defaults,
  496. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_TestService.Method.EmptyCall.Output>) async throws -> R
  497. ) async throws -> R where R: Sendable {
  498. try await self.emptyCall(
  499. request: request,
  500. serializer: ProtobufSerializer<Grpc_Testing_TestService.Method.EmptyCall.Input>(),
  501. deserializer: ProtobufDeserializer<Grpc_Testing_TestService.Method.EmptyCall.Output>(),
  502. options: options,
  503. body
  504. )
  505. }
  506. public func unaryCall<R>(
  507. request: ClientRequest.Single<Grpc_Testing_TestService.Method.UnaryCall.Input>,
  508. options: CallOptions = .defaults,
  509. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_TestService.Method.UnaryCall.Output>) async throws -> R
  510. ) async throws -> R where R: Sendable {
  511. try await self.unaryCall(
  512. request: request,
  513. serializer: ProtobufSerializer<Grpc_Testing_TestService.Method.UnaryCall.Input>(),
  514. deserializer: ProtobufDeserializer<Grpc_Testing_TestService.Method.UnaryCall.Output>(),
  515. options: options,
  516. body
  517. )
  518. }
  519. public func cacheableUnaryCall<R>(
  520. request: ClientRequest.Single<Grpc_Testing_TestService.Method.CacheableUnaryCall.Input>,
  521. options: CallOptions = .defaults,
  522. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_TestService.Method.CacheableUnaryCall.Output>) async throws -> R
  523. ) async throws -> R where R: Sendable {
  524. try await self.cacheableUnaryCall(
  525. request: request,
  526. serializer: ProtobufSerializer<Grpc_Testing_TestService.Method.CacheableUnaryCall.Input>(),
  527. deserializer: ProtobufDeserializer<Grpc_Testing_TestService.Method.CacheableUnaryCall.Output>(),
  528. options: options,
  529. body
  530. )
  531. }
  532. public func streamingOutputCall<R>(
  533. request: ClientRequest.Single<Grpc_Testing_TestService.Method.StreamingOutputCall.Input>,
  534. options: CallOptions = .defaults,
  535. _ body: @Sendable @escaping (ClientResponse.Stream<Grpc_Testing_TestService.Method.StreamingOutputCall.Output>) async throws -> R
  536. ) async throws -> R where R: Sendable {
  537. try await self.streamingOutputCall(
  538. request: request,
  539. serializer: ProtobufSerializer<Grpc_Testing_TestService.Method.StreamingOutputCall.Input>(),
  540. deserializer: ProtobufDeserializer<Grpc_Testing_TestService.Method.StreamingOutputCall.Output>(),
  541. options: options,
  542. body
  543. )
  544. }
  545. public func streamingInputCall<R>(
  546. request: ClientRequest.Stream<Grpc_Testing_TestService.Method.StreamingInputCall.Input>,
  547. options: CallOptions = .defaults,
  548. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_TestService.Method.StreamingInputCall.Output>) async throws -> R
  549. ) async throws -> R where R: Sendable {
  550. try await self.streamingInputCall(
  551. request: request,
  552. serializer: ProtobufSerializer<Grpc_Testing_TestService.Method.StreamingInputCall.Input>(),
  553. deserializer: ProtobufDeserializer<Grpc_Testing_TestService.Method.StreamingInputCall.Output>(),
  554. options: options,
  555. body
  556. )
  557. }
  558. public func fullDuplexCall<R>(
  559. request: ClientRequest.Stream<Grpc_Testing_TestService.Method.FullDuplexCall.Input>,
  560. options: CallOptions = .defaults,
  561. _ body: @Sendable @escaping (ClientResponse.Stream<Grpc_Testing_TestService.Method.FullDuplexCall.Output>) async throws -> R
  562. ) async throws -> R where R: Sendable {
  563. try await self.fullDuplexCall(
  564. request: request,
  565. serializer: ProtobufSerializer<Grpc_Testing_TestService.Method.FullDuplexCall.Input>(),
  566. deserializer: ProtobufDeserializer<Grpc_Testing_TestService.Method.FullDuplexCall.Output>(),
  567. options: options,
  568. body
  569. )
  570. }
  571. public func halfDuplexCall<R>(
  572. request: ClientRequest.Stream<Grpc_Testing_TestService.Method.HalfDuplexCall.Input>,
  573. options: CallOptions = .defaults,
  574. _ body: @Sendable @escaping (ClientResponse.Stream<Grpc_Testing_TestService.Method.HalfDuplexCall.Output>) async throws -> R
  575. ) async throws -> R where R: Sendable {
  576. try await self.halfDuplexCall(
  577. request: request,
  578. serializer: ProtobufSerializer<Grpc_Testing_TestService.Method.HalfDuplexCall.Input>(),
  579. deserializer: ProtobufDeserializer<Grpc_Testing_TestService.Method.HalfDuplexCall.Output>(),
  580. options: options,
  581. body
  582. )
  583. }
  584. public func unimplementedCall<R>(
  585. request: ClientRequest.Single<Grpc_Testing_TestService.Method.UnimplementedCall.Input>,
  586. options: CallOptions = .defaults,
  587. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_TestService.Method.UnimplementedCall.Output>) async throws -> R
  588. ) async throws -> R where R: Sendable {
  589. try await self.unimplementedCall(
  590. request: request,
  591. serializer: ProtobufSerializer<Grpc_Testing_TestService.Method.UnimplementedCall.Input>(),
  592. deserializer: ProtobufDeserializer<Grpc_Testing_TestService.Method.UnimplementedCall.Output>(),
  593. options: options,
  594. body
  595. )
  596. }
  597. }
  598. /// A simple service to test the various types of RPCs and experiment with
  599. /// performance with various types of payload.
  600. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  601. public struct Grpc_Testing_TestServiceClient: Grpc_Testing_TestService.ClientProtocol {
  602. private let client: GRPCCore.GRPCClient
  603. public init(client: GRPCCore.GRPCClient) {
  604. self.client = client
  605. }
  606. /// One empty request followed by one empty response.
  607. public func emptyCall<R>(
  608. request: ClientRequest.Single<Grpc_Testing_TestService.Method.EmptyCall.Input>,
  609. serializer: some MessageSerializer<Grpc_Testing_TestService.Method.EmptyCall.Input>,
  610. deserializer: some MessageDeserializer<Grpc_Testing_TestService.Method.EmptyCall.Output>,
  611. options: CallOptions = .defaults,
  612. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_TestService.Method.EmptyCall.Output>) async throws -> R
  613. ) async throws -> R where R: Sendable {
  614. try await self.client.unary(
  615. request: request,
  616. descriptor: Grpc_Testing_TestService.Method.EmptyCall.descriptor,
  617. serializer: serializer,
  618. deserializer: deserializer,
  619. options: options,
  620. handler: body
  621. )
  622. }
  623. /// One request followed by one response.
  624. public func unaryCall<R>(
  625. request: ClientRequest.Single<Grpc_Testing_TestService.Method.UnaryCall.Input>,
  626. serializer: some MessageSerializer<Grpc_Testing_TestService.Method.UnaryCall.Input>,
  627. deserializer: some MessageDeserializer<Grpc_Testing_TestService.Method.UnaryCall.Output>,
  628. options: CallOptions = .defaults,
  629. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_TestService.Method.UnaryCall.Output>) async throws -> R
  630. ) async throws -> R where R: Sendable {
  631. try await self.client.unary(
  632. request: request,
  633. descriptor: Grpc_Testing_TestService.Method.UnaryCall.descriptor,
  634. serializer: serializer,
  635. deserializer: deserializer,
  636. options: options,
  637. handler: body
  638. )
  639. }
  640. /// One request followed by one response. Response has cache control
  641. /// headers set such that a caching HTTP proxy (such as GFE) can
  642. /// satisfy subsequent requests.
  643. public func cacheableUnaryCall<R>(
  644. request: ClientRequest.Single<Grpc_Testing_TestService.Method.CacheableUnaryCall.Input>,
  645. serializer: some MessageSerializer<Grpc_Testing_TestService.Method.CacheableUnaryCall.Input>,
  646. deserializer: some MessageDeserializer<Grpc_Testing_TestService.Method.CacheableUnaryCall.Output>,
  647. options: CallOptions = .defaults,
  648. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_TestService.Method.CacheableUnaryCall.Output>) async throws -> R
  649. ) async throws -> R where R: Sendable {
  650. try await self.client.unary(
  651. request: request,
  652. descriptor: Grpc_Testing_TestService.Method.CacheableUnaryCall.descriptor,
  653. serializer: serializer,
  654. deserializer: deserializer,
  655. options: options,
  656. handler: body
  657. )
  658. }
  659. /// One request followed by a sequence of responses (streamed download).
  660. /// The server returns the payload with client desired type and sizes.
  661. public func streamingOutputCall<R>(
  662. request: ClientRequest.Single<Grpc_Testing_TestService.Method.StreamingOutputCall.Input>,
  663. serializer: some MessageSerializer<Grpc_Testing_TestService.Method.StreamingOutputCall.Input>,
  664. deserializer: some MessageDeserializer<Grpc_Testing_TestService.Method.StreamingOutputCall.Output>,
  665. options: CallOptions = .defaults,
  666. _ body: @Sendable @escaping (ClientResponse.Stream<Grpc_Testing_TestService.Method.StreamingOutputCall.Output>) async throws -> R
  667. ) async throws -> R where R: Sendable {
  668. try await self.client.serverStreaming(
  669. request: request,
  670. descriptor: Grpc_Testing_TestService.Method.StreamingOutputCall.descriptor,
  671. serializer: serializer,
  672. deserializer: deserializer,
  673. options: options,
  674. handler: body
  675. )
  676. }
  677. /// A sequence of requests followed by one response (streamed upload).
  678. /// The server returns the aggregated size of client payload as the result.
  679. public func streamingInputCall<R>(
  680. request: ClientRequest.Stream<Grpc_Testing_TestService.Method.StreamingInputCall.Input>,
  681. serializer: some MessageSerializer<Grpc_Testing_TestService.Method.StreamingInputCall.Input>,
  682. deserializer: some MessageDeserializer<Grpc_Testing_TestService.Method.StreamingInputCall.Output>,
  683. options: CallOptions = .defaults,
  684. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_TestService.Method.StreamingInputCall.Output>) async throws -> R
  685. ) async throws -> R where R: Sendable {
  686. try await self.client.clientStreaming(
  687. request: request,
  688. descriptor: Grpc_Testing_TestService.Method.StreamingInputCall.descriptor,
  689. serializer: serializer,
  690. deserializer: deserializer,
  691. options: options,
  692. handler: body
  693. )
  694. }
  695. /// A sequence of requests with each request served by the server immediately.
  696. /// As one request could lead to multiple responses, this interface
  697. /// demonstrates the idea of full duplexing.
  698. public func fullDuplexCall<R>(
  699. request: ClientRequest.Stream<Grpc_Testing_TestService.Method.FullDuplexCall.Input>,
  700. serializer: some MessageSerializer<Grpc_Testing_TestService.Method.FullDuplexCall.Input>,
  701. deserializer: some MessageDeserializer<Grpc_Testing_TestService.Method.FullDuplexCall.Output>,
  702. options: CallOptions = .defaults,
  703. _ body: @Sendable @escaping (ClientResponse.Stream<Grpc_Testing_TestService.Method.FullDuplexCall.Output>) async throws -> R
  704. ) async throws -> R where R: Sendable {
  705. try await self.client.bidirectionalStreaming(
  706. request: request,
  707. descriptor: Grpc_Testing_TestService.Method.FullDuplexCall.descriptor,
  708. serializer: serializer,
  709. deserializer: deserializer,
  710. options: options,
  711. handler: body
  712. )
  713. }
  714. /// A sequence of requests followed by a sequence of responses.
  715. /// The server buffers all the client requests and then serves them in order. A
  716. /// stream of responses are returned to the client when the server starts with
  717. /// first request.
  718. public func halfDuplexCall<R>(
  719. request: ClientRequest.Stream<Grpc_Testing_TestService.Method.HalfDuplexCall.Input>,
  720. serializer: some MessageSerializer<Grpc_Testing_TestService.Method.HalfDuplexCall.Input>,
  721. deserializer: some MessageDeserializer<Grpc_Testing_TestService.Method.HalfDuplexCall.Output>,
  722. options: CallOptions = .defaults,
  723. _ body: @Sendable @escaping (ClientResponse.Stream<Grpc_Testing_TestService.Method.HalfDuplexCall.Output>) async throws -> R
  724. ) async throws -> R where R: Sendable {
  725. try await self.client.bidirectionalStreaming(
  726. request: request,
  727. descriptor: Grpc_Testing_TestService.Method.HalfDuplexCall.descriptor,
  728. serializer: serializer,
  729. deserializer: deserializer,
  730. options: options,
  731. handler: body
  732. )
  733. }
  734. /// The test server will not implement this method. It will be used
  735. /// to test the behavior when clients call unimplemented methods.
  736. public func unimplementedCall<R>(
  737. request: ClientRequest.Single<Grpc_Testing_TestService.Method.UnimplementedCall.Input>,
  738. serializer: some MessageSerializer<Grpc_Testing_TestService.Method.UnimplementedCall.Input>,
  739. deserializer: some MessageDeserializer<Grpc_Testing_TestService.Method.UnimplementedCall.Output>,
  740. options: CallOptions = .defaults,
  741. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_TestService.Method.UnimplementedCall.Output>) async throws -> R
  742. ) async throws -> R where R: Sendable {
  743. try await self.client.unary(
  744. request: request,
  745. descriptor: Grpc_Testing_TestService.Method.UnimplementedCall.descriptor,
  746. serializer: serializer,
  747. deserializer: deserializer,
  748. options: options,
  749. handler: body
  750. )
  751. }
  752. }
  753. /// A simple service NOT implemented at servers so clients can test for
  754. /// that case.
  755. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  756. public protocol Grpc_Testing_UnimplementedServiceClientProtocol: Sendable {
  757. /// A call that no server should implement
  758. func unimplementedCall<R>(
  759. request: ClientRequest.Single<Grpc_Testing_UnimplementedService.Method.UnimplementedCall.Input>,
  760. serializer: some MessageSerializer<Grpc_Testing_UnimplementedService.Method.UnimplementedCall.Input>,
  761. deserializer: some MessageDeserializer<Grpc_Testing_UnimplementedService.Method.UnimplementedCall.Output>,
  762. options: CallOptions,
  763. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_UnimplementedService.Method.UnimplementedCall.Output>) async throws -> R
  764. ) async throws -> R where R: Sendable
  765. }
  766. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  767. extension Grpc_Testing_UnimplementedService.ClientProtocol {
  768. public func unimplementedCall<R>(
  769. request: ClientRequest.Single<Grpc_Testing_UnimplementedService.Method.UnimplementedCall.Input>,
  770. options: CallOptions = .defaults,
  771. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_UnimplementedService.Method.UnimplementedCall.Output>) async throws -> R
  772. ) async throws -> R where R: Sendable {
  773. try await self.unimplementedCall(
  774. request: request,
  775. serializer: ProtobufSerializer<Grpc_Testing_UnimplementedService.Method.UnimplementedCall.Input>(),
  776. deserializer: ProtobufDeserializer<Grpc_Testing_UnimplementedService.Method.UnimplementedCall.Output>(),
  777. options: options,
  778. body
  779. )
  780. }
  781. }
  782. /// A simple service NOT implemented at servers so clients can test for
  783. /// that case.
  784. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  785. public struct Grpc_Testing_UnimplementedServiceClient: Grpc_Testing_UnimplementedService.ClientProtocol {
  786. private let client: GRPCCore.GRPCClient
  787. public init(client: GRPCCore.GRPCClient) {
  788. self.client = client
  789. }
  790. /// A call that no server should implement
  791. public func unimplementedCall<R>(
  792. request: ClientRequest.Single<Grpc_Testing_UnimplementedService.Method.UnimplementedCall.Input>,
  793. serializer: some MessageSerializer<Grpc_Testing_UnimplementedService.Method.UnimplementedCall.Input>,
  794. deserializer: some MessageDeserializer<Grpc_Testing_UnimplementedService.Method.UnimplementedCall.Output>,
  795. options: CallOptions = .defaults,
  796. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_UnimplementedService.Method.UnimplementedCall.Output>) async throws -> R
  797. ) async throws -> R where R: Sendable {
  798. try await self.client.unary(
  799. request: request,
  800. descriptor: Grpc_Testing_UnimplementedService.Method.UnimplementedCall.descriptor,
  801. serializer: serializer,
  802. deserializer: deserializer,
  803. options: options,
  804. handler: body
  805. )
  806. }
  807. }
  808. /// A service used to control reconnect server.
  809. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  810. public protocol Grpc_Testing_ReconnectServiceClientProtocol: Sendable {
  811. func start<R>(
  812. request: ClientRequest.Single<Grpc_Testing_ReconnectService.Method.Start.Input>,
  813. serializer: some MessageSerializer<Grpc_Testing_ReconnectService.Method.Start.Input>,
  814. deserializer: some MessageDeserializer<Grpc_Testing_ReconnectService.Method.Start.Output>,
  815. options: CallOptions,
  816. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_ReconnectService.Method.Start.Output>) async throws -> R
  817. ) async throws -> R where R: Sendable
  818. func stop<R>(
  819. request: ClientRequest.Single<Grpc_Testing_ReconnectService.Method.Stop.Input>,
  820. serializer: some MessageSerializer<Grpc_Testing_ReconnectService.Method.Stop.Input>,
  821. deserializer: some MessageDeserializer<Grpc_Testing_ReconnectService.Method.Stop.Output>,
  822. options: CallOptions,
  823. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_ReconnectService.Method.Stop.Output>) async throws -> R
  824. ) async throws -> R where R: Sendable
  825. }
  826. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  827. extension Grpc_Testing_ReconnectService.ClientProtocol {
  828. public func start<R>(
  829. request: ClientRequest.Single<Grpc_Testing_ReconnectService.Method.Start.Input>,
  830. options: CallOptions = .defaults,
  831. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_ReconnectService.Method.Start.Output>) async throws -> R
  832. ) async throws -> R where R: Sendable {
  833. try await self.start(
  834. request: request,
  835. serializer: ProtobufSerializer<Grpc_Testing_ReconnectService.Method.Start.Input>(),
  836. deserializer: ProtobufDeserializer<Grpc_Testing_ReconnectService.Method.Start.Output>(),
  837. options: options,
  838. body
  839. )
  840. }
  841. public func stop<R>(
  842. request: ClientRequest.Single<Grpc_Testing_ReconnectService.Method.Stop.Input>,
  843. options: CallOptions = .defaults,
  844. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_ReconnectService.Method.Stop.Output>) async throws -> R
  845. ) async throws -> R where R: Sendable {
  846. try await self.stop(
  847. request: request,
  848. serializer: ProtobufSerializer<Grpc_Testing_ReconnectService.Method.Stop.Input>(),
  849. deserializer: ProtobufDeserializer<Grpc_Testing_ReconnectService.Method.Stop.Output>(),
  850. options: options,
  851. body
  852. )
  853. }
  854. }
  855. /// A service used to control reconnect server.
  856. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  857. public struct Grpc_Testing_ReconnectServiceClient: Grpc_Testing_ReconnectService.ClientProtocol {
  858. private let client: GRPCCore.GRPCClient
  859. public init(client: GRPCCore.GRPCClient) {
  860. self.client = client
  861. }
  862. public func start<R>(
  863. request: ClientRequest.Single<Grpc_Testing_ReconnectService.Method.Start.Input>,
  864. serializer: some MessageSerializer<Grpc_Testing_ReconnectService.Method.Start.Input>,
  865. deserializer: some MessageDeserializer<Grpc_Testing_ReconnectService.Method.Start.Output>,
  866. options: CallOptions = .defaults,
  867. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_ReconnectService.Method.Start.Output>) async throws -> R
  868. ) async throws -> R where R: Sendable {
  869. try await self.client.unary(
  870. request: request,
  871. descriptor: Grpc_Testing_ReconnectService.Method.Start.descriptor,
  872. serializer: serializer,
  873. deserializer: deserializer,
  874. options: options,
  875. handler: body
  876. )
  877. }
  878. public func stop<R>(
  879. request: ClientRequest.Single<Grpc_Testing_ReconnectService.Method.Stop.Input>,
  880. serializer: some MessageSerializer<Grpc_Testing_ReconnectService.Method.Stop.Input>,
  881. deserializer: some MessageDeserializer<Grpc_Testing_ReconnectService.Method.Stop.Output>,
  882. options: CallOptions = .defaults,
  883. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_ReconnectService.Method.Stop.Output>) async throws -> R
  884. ) async throws -> R where R: Sendable {
  885. try await self.client.unary(
  886. request: request,
  887. descriptor: Grpc_Testing_ReconnectService.Method.Stop.descriptor,
  888. serializer: serializer,
  889. deserializer: deserializer,
  890. options: options,
  891. handler: body
  892. )
  893. }
  894. }