test.grpc.swift 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918
  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. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_TestService.Method.EmptyCall.Output>) async throws -> R
  422. ) async throws -> R where R: Sendable
  423. /// One request followed by one response.
  424. func unaryCall<R>(
  425. request: ClientRequest.Single<Grpc_Testing_TestService.Method.UnaryCall.Input>,
  426. serializer: some MessageSerializer<Grpc_Testing_TestService.Method.UnaryCall.Input>,
  427. deserializer: some MessageDeserializer<Grpc_Testing_TestService.Method.UnaryCall.Output>,
  428. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_TestService.Method.UnaryCall.Output>) async throws -> R
  429. ) async throws -> R where R: Sendable
  430. /// One request followed by one response. Response has cache control
  431. /// headers set such that a caching HTTP proxy (such as GFE) can
  432. /// satisfy subsequent requests.
  433. func cacheableUnaryCall<R>(
  434. request: ClientRequest.Single<Grpc_Testing_TestService.Method.CacheableUnaryCall.Input>,
  435. serializer: some MessageSerializer<Grpc_Testing_TestService.Method.CacheableUnaryCall.Input>,
  436. deserializer: some MessageDeserializer<Grpc_Testing_TestService.Method.CacheableUnaryCall.Output>,
  437. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_TestService.Method.CacheableUnaryCall.Output>) async throws -> R
  438. ) async throws -> R where R: Sendable
  439. /// One request followed by a sequence of responses (streamed download).
  440. /// The server returns the payload with client desired type and sizes.
  441. func streamingOutputCall<R>(
  442. request: ClientRequest.Single<Grpc_Testing_TestService.Method.StreamingOutputCall.Input>,
  443. serializer: some MessageSerializer<Grpc_Testing_TestService.Method.StreamingOutputCall.Input>,
  444. deserializer: some MessageDeserializer<Grpc_Testing_TestService.Method.StreamingOutputCall.Output>,
  445. _ body: @Sendable @escaping (ClientResponse.Stream<Grpc_Testing_TestService.Method.StreamingOutputCall.Output>) async throws -> R
  446. ) async throws -> R where R: Sendable
  447. /// A sequence of requests followed by one response (streamed upload).
  448. /// The server returns the aggregated size of client payload as the result.
  449. func streamingInputCall<R>(
  450. request: ClientRequest.Stream<Grpc_Testing_TestService.Method.StreamingInputCall.Input>,
  451. serializer: some MessageSerializer<Grpc_Testing_TestService.Method.StreamingInputCall.Input>,
  452. deserializer: some MessageDeserializer<Grpc_Testing_TestService.Method.StreamingInputCall.Output>,
  453. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_TestService.Method.StreamingInputCall.Output>) async throws -> R
  454. ) async throws -> R where R: Sendable
  455. /// A sequence of requests with each request served by the server immediately.
  456. /// As one request could lead to multiple responses, this interface
  457. /// demonstrates the idea of full duplexing.
  458. func fullDuplexCall<R>(
  459. request: ClientRequest.Stream<Grpc_Testing_TestService.Method.FullDuplexCall.Input>,
  460. serializer: some MessageSerializer<Grpc_Testing_TestService.Method.FullDuplexCall.Input>,
  461. deserializer: some MessageDeserializer<Grpc_Testing_TestService.Method.FullDuplexCall.Output>,
  462. _ body: @Sendable @escaping (ClientResponse.Stream<Grpc_Testing_TestService.Method.FullDuplexCall.Output>) async throws -> R
  463. ) async throws -> R where R: Sendable
  464. /// A sequence of requests followed by a sequence of responses.
  465. /// The server buffers all the client requests and then serves them in order. A
  466. /// stream of responses are returned to the client when the server starts with
  467. /// first request.
  468. func halfDuplexCall<R>(
  469. request: ClientRequest.Stream<Grpc_Testing_TestService.Method.HalfDuplexCall.Input>,
  470. serializer: some MessageSerializer<Grpc_Testing_TestService.Method.HalfDuplexCall.Input>,
  471. deserializer: some MessageDeserializer<Grpc_Testing_TestService.Method.HalfDuplexCall.Output>,
  472. _ body: @Sendable @escaping (ClientResponse.Stream<Grpc_Testing_TestService.Method.HalfDuplexCall.Output>) async throws -> R
  473. ) async throws -> R where R: Sendable
  474. /// The test server will not implement this method. It will be used
  475. /// to test the behavior when clients call unimplemented methods.
  476. func unimplementedCall<R>(
  477. request: ClientRequest.Single<Grpc_Testing_TestService.Method.UnimplementedCall.Input>,
  478. serializer: some MessageSerializer<Grpc_Testing_TestService.Method.UnimplementedCall.Input>,
  479. deserializer: some MessageDeserializer<Grpc_Testing_TestService.Method.UnimplementedCall.Output>,
  480. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_TestService.Method.UnimplementedCall.Output>) async throws -> R
  481. ) async throws -> R where R: Sendable
  482. }
  483. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  484. extension Grpc_Testing_TestService.ClientProtocol {
  485. public func emptyCall<R>(
  486. request: ClientRequest.Single<Grpc_Testing_TestService.Method.EmptyCall.Input>,
  487. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_TestService.Method.EmptyCall.Output>) async throws -> R
  488. ) async throws -> R where R: Sendable {
  489. try await self.emptyCall(
  490. request: request,
  491. serializer: ProtobufSerializer<Grpc_Testing_TestService.Method.EmptyCall.Input>(),
  492. deserializer: ProtobufDeserializer<Grpc_Testing_TestService.Method.EmptyCall.Output>(),
  493. body
  494. )
  495. }
  496. public func unaryCall<R>(
  497. request: ClientRequest.Single<Grpc_Testing_TestService.Method.UnaryCall.Input>,
  498. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_TestService.Method.UnaryCall.Output>) async throws -> R
  499. ) async throws -> R where R: Sendable {
  500. try await self.unaryCall(
  501. request: request,
  502. serializer: ProtobufSerializer<Grpc_Testing_TestService.Method.UnaryCall.Input>(),
  503. deserializer: ProtobufDeserializer<Grpc_Testing_TestService.Method.UnaryCall.Output>(),
  504. body
  505. )
  506. }
  507. public func cacheableUnaryCall<R>(
  508. request: ClientRequest.Single<Grpc_Testing_TestService.Method.CacheableUnaryCall.Input>,
  509. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_TestService.Method.CacheableUnaryCall.Output>) async throws -> R
  510. ) async throws -> R where R: Sendable {
  511. try await self.cacheableUnaryCall(
  512. request: request,
  513. serializer: ProtobufSerializer<Grpc_Testing_TestService.Method.CacheableUnaryCall.Input>(),
  514. deserializer: ProtobufDeserializer<Grpc_Testing_TestService.Method.CacheableUnaryCall.Output>(),
  515. body
  516. )
  517. }
  518. public func streamingOutputCall<R>(
  519. request: ClientRequest.Single<Grpc_Testing_TestService.Method.StreamingOutputCall.Input>,
  520. _ body: @Sendable @escaping (ClientResponse.Stream<Grpc_Testing_TestService.Method.StreamingOutputCall.Output>) async throws -> R
  521. ) async throws -> R where R: Sendable {
  522. try await self.streamingOutputCall(
  523. request: request,
  524. serializer: ProtobufSerializer<Grpc_Testing_TestService.Method.StreamingOutputCall.Input>(),
  525. deserializer: ProtobufDeserializer<Grpc_Testing_TestService.Method.StreamingOutputCall.Output>(),
  526. body
  527. )
  528. }
  529. public func streamingInputCall<R>(
  530. request: ClientRequest.Stream<Grpc_Testing_TestService.Method.StreamingInputCall.Input>,
  531. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_TestService.Method.StreamingInputCall.Output>) async throws -> R
  532. ) async throws -> R where R: Sendable {
  533. try await self.streamingInputCall(
  534. request: request,
  535. serializer: ProtobufSerializer<Grpc_Testing_TestService.Method.StreamingInputCall.Input>(),
  536. deserializer: ProtobufDeserializer<Grpc_Testing_TestService.Method.StreamingInputCall.Output>(),
  537. body
  538. )
  539. }
  540. public func fullDuplexCall<R>(
  541. request: ClientRequest.Stream<Grpc_Testing_TestService.Method.FullDuplexCall.Input>,
  542. _ body: @Sendable @escaping (ClientResponse.Stream<Grpc_Testing_TestService.Method.FullDuplexCall.Output>) async throws -> R
  543. ) async throws -> R where R: Sendable {
  544. try await self.fullDuplexCall(
  545. request: request,
  546. serializer: ProtobufSerializer<Grpc_Testing_TestService.Method.FullDuplexCall.Input>(),
  547. deserializer: ProtobufDeserializer<Grpc_Testing_TestService.Method.FullDuplexCall.Output>(),
  548. body
  549. )
  550. }
  551. public func halfDuplexCall<R>(
  552. request: ClientRequest.Stream<Grpc_Testing_TestService.Method.HalfDuplexCall.Input>,
  553. _ body: @Sendable @escaping (ClientResponse.Stream<Grpc_Testing_TestService.Method.HalfDuplexCall.Output>) async throws -> R
  554. ) async throws -> R where R: Sendable {
  555. try await self.halfDuplexCall(
  556. request: request,
  557. serializer: ProtobufSerializer<Grpc_Testing_TestService.Method.HalfDuplexCall.Input>(),
  558. deserializer: ProtobufDeserializer<Grpc_Testing_TestService.Method.HalfDuplexCall.Output>(),
  559. body
  560. )
  561. }
  562. public func unimplementedCall<R>(
  563. request: ClientRequest.Single<Grpc_Testing_TestService.Method.UnimplementedCall.Input>,
  564. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_TestService.Method.UnimplementedCall.Output>) async throws -> R
  565. ) async throws -> R where R: Sendable {
  566. try await self.unimplementedCall(
  567. request: request,
  568. serializer: ProtobufSerializer<Grpc_Testing_TestService.Method.UnimplementedCall.Input>(),
  569. deserializer: ProtobufDeserializer<Grpc_Testing_TestService.Method.UnimplementedCall.Output>(),
  570. body
  571. )
  572. }
  573. }
  574. /// A simple service to test the various types of RPCs and experiment with
  575. /// performance with various types of payload.
  576. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  577. public struct Grpc_Testing_TestServiceClient: Grpc_Testing_TestService.ClientProtocol {
  578. private let client: GRPCCore.GRPCClient
  579. public init(client: GRPCCore.GRPCClient) {
  580. self.client = client
  581. }
  582. /// One empty request followed by one empty response.
  583. public func emptyCall<R>(
  584. request: ClientRequest.Single<Grpc_Testing_TestService.Method.EmptyCall.Input>,
  585. serializer: some MessageSerializer<Grpc_Testing_TestService.Method.EmptyCall.Input>,
  586. deserializer: some MessageDeserializer<Grpc_Testing_TestService.Method.EmptyCall.Output>,
  587. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_TestService.Method.EmptyCall.Output>) async throws -> R
  588. ) async throws -> R where R: Sendable {
  589. try await self.client.unary(
  590. request: request,
  591. descriptor: Grpc_Testing_TestService.Method.EmptyCall.descriptor,
  592. serializer: serializer,
  593. deserializer: deserializer,
  594. handler: body
  595. )
  596. }
  597. /// One request followed by one response.
  598. public func unaryCall<R>(
  599. request: ClientRequest.Single<Grpc_Testing_TestService.Method.UnaryCall.Input>,
  600. serializer: some MessageSerializer<Grpc_Testing_TestService.Method.UnaryCall.Input>,
  601. deserializer: some MessageDeserializer<Grpc_Testing_TestService.Method.UnaryCall.Output>,
  602. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_TestService.Method.UnaryCall.Output>) async throws -> R
  603. ) async throws -> R where R: Sendable {
  604. try await self.client.unary(
  605. request: request,
  606. descriptor: Grpc_Testing_TestService.Method.UnaryCall.descriptor,
  607. serializer: serializer,
  608. deserializer: deserializer,
  609. handler: body
  610. )
  611. }
  612. /// One request followed by one response. Response has cache control
  613. /// headers set such that a caching HTTP proxy (such as GFE) can
  614. /// satisfy subsequent requests.
  615. public func cacheableUnaryCall<R>(
  616. request: ClientRequest.Single<Grpc_Testing_TestService.Method.CacheableUnaryCall.Input>,
  617. serializer: some MessageSerializer<Grpc_Testing_TestService.Method.CacheableUnaryCall.Input>,
  618. deserializer: some MessageDeserializer<Grpc_Testing_TestService.Method.CacheableUnaryCall.Output>,
  619. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_TestService.Method.CacheableUnaryCall.Output>) async throws -> R
  620. ) async throws -> R where R: Sendable {
  621. try await self.client.unary(
  622. request: request,
  623. descriptor: Grpc_Testing_TestService.Method.CacheableUnaryCall.descriptor,
  624. serializer: serializer,
  625. deserializer: deserializer,
  626. handler: body
  627. )
  628. }
  629. /// One request followed by a sequence of responses (streamed download).
  630. /// The server returns the payload with client desired type and sizes.
  631. public func streamingOutputCall<R>(
  632. request: ClientRequest.Single<Grpc_Testing_TestService.Method.StreamingOutputCall.Input>,
  633. serializer: some MessageSerializer<Grpc_Testing_TestService.Method.StreamingOutputCall.Input>,
  634. deserializer: some MessageDeserializer<Grpc_Testing_TestService.Method.StreamingOutputCall.Output>,
  635. _ body: @Sendable @escaping (ClientResponse.Stream<Grpc_Testing_TestService.Method.StreamingOutputCall.Output>) async throws -> R
  636. ) async throws -> R where R: Sendable {
  637. try await self.client.serverStreaming(
  638. request: request,
  639. descriptor: Grpc_Testing_TestService.Method.StreamingOutputCall.descriptor,
  640. serializer: serializer,
  641. deserializer: deserializer,
  642. handler: body
  643. )
  644. }
  645. /// A sequence of requests followed by one response (streamed upload).
  646. /// The server returns the aggregated size of client payload as the result.
  647. public func streamingInputCall<R>(
  648. request: ClientRequest.Stream<Grpc_Testing_TestService.Method.StreamingInputCall.Input>,
  649. serializer: some MessageSerializer<Grpc_Testing_TestService.Method.StreamingInputCall.Input>,
  650. deserializer: some MessageDeserializer<Grpc_Testing_TestService.Method.StreamingInputCall.Output>,
  651. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_TestService.Method.StreamingInputCall.Output>) async throws -> R
  652. ) async throws -> R where R: Sendable {
  653. try await self.client.clientStreaming(
  654. request: request,
  655. descriptor: Grpc_Testing_TestService.Method.StreamingInputCall.descriptor,
  656. serializer: serializer,
  657. deserializer: deserializer,
  658. handler: body
  659. )
  660. }
  661. /// A sequence of requests with each request served by the server immediately.
  662. /// As one request could lead to multiple responses, this interface
  663. /// demonstrates the idea of full duplexing.
  664. public func fullDuplexCall<R>(
  665. request: ClientRequest.Stream<Grpc_Testing_TestService.Method.FullDuplexCall.Input>,
  666. serializer: some MessageSerializer<Grpc_Testing_TestService.Method.FullDuplexCall.Input>,
  667. deserializer: some MessageDeserializer<Grpc_Testing_TestService.Method.FullDuplexCall.Output>,
  668. _ body: @Sendable @escaping (ClientResponse.Stream<Grpc_Testing_TestService.Method.FullDuplexCall.Output>) async throws -> R
  669. ) async throws -> R where R: Sendable {
  670. try await self.client.bidirectionalStreaming(
  671. request: request,
  672. descriptor: Grpc_Testing_TestService.Method.FullDuplexCall.descriptor,
  673. serializer: serializer,
  674. deserializer: deserializer,
  675. handler: body
  676. )
  677. }
  678. /// A sequence of requests followed by a sequence of responses.
  679. /// The server buffers all the client requests and then serves them in order. A
  680. /// stream of responses are returned to the client when the server starts with
  681. /// first request.
  682. public func halfDuplexCall<R>(
  683. request: ClientRequest.Stream<Grpc_Testing_TestService.Method.HalfDuplexCall.Input>,
  684. serializer: some MessageSerializer<Grpc_Testing_TestService.Method.HalfDuplexCall.Input>,
  685. deserializer: some MessageDeserializer<Grpc_Testing_TestService.Method.HalfDuplexCall.Output>,
  686. _ body: @Sendable @escaping (ClientResponse.Stream<Grpc_Testing_TestService.Method.HalfDuplexCall.Output>) async throws -> R
  687. ) async throws -> R where R: Sendable {
  688. try await self.client.bidirectionalStreaming(
  689. request: request,
  690. descriptor: Grpc_Testing_TestService.Method.HalfDuplexCall.descriptor,
  691. serializer: serializer,
  692. deserializer: deserializer,
  693. handler: body
  694. )
  695. }
  696. /// The test server will not implement this method. It will be used
  697. /// to test the behavior when clients call unimplemented methods.
  698. public func unimplementedCall<R>(
  699. request: ClientRequest.Single<Grpc_Testing_TestService.Method.UnimplementedCall.Input>,
  700. serializer: some MessageSerializer<Grpc_Testing_TestService.Method.UnimplementedCall.Input>,
  701. deserializer: some MessageDeserializer<Grpc_Testing_TestService.Method.UnimplementedCall.Output>,
  702. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_TestService.Method.UnimplementedCall.Output>) async throws -> R
  703. ) async throws -> R where R: Sendable {
  704. try await self.client.unary(
  705. request: request,
  706. descriptor: Grpc_Testing_TestService.Method.UnimplementedCall.descriptor,
  707. serializer: serializer,
  708. deserializer: deserializer,
  709. handler: body
  710. )
  711. }
  712. }
  713. /// A simple service NOT implemented at servers so clients can test for
  714. /// that case.
  715. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  716. public protocol Grpc_Testing_UnimplementedServiceClientProtocol: Sendable {
  717. /// A call that no server should implement
  718. func unimplementedCall<R>(
  719. request: ClientRequest.Single<Grpc_Testing_UnimplementedService.Method.UnimplementedCall.Input>,
  720. serializer: some MessageSerializer<Grpc_Testing_UnimplementedService.Method.UnimplementedCall.Input>,
  721. deserializer: some MessageDeserializer<Grpc_Testing_UnimplementedService.Method.UnimplementedCall.Output>,
  722. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_UnimplementedService.Method.UnimplementedCall.Output>) async throws -> R
  723. ) async throws -> R where R: Sendable
  724. }
  725. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  726. extension Grpc_Testing_UnimplementedService.ClientProtocol {
  727. public func unimplementedCall<R>(
  728. request: ClientRequest.Single<Grpc_Testing_UnimplementedService.Method.UnimplementedCall.Input>,
  729. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_UnimplementedService.Method.UnimplementedCall.Output>) async throws -> R
  730. ) async throws -> R where R: Sendable {
  731. try await self.unimplementedCall(
  732. request: request,
  733. serializer: ProtobufSerializer<Grpc_Testing_UnimplementedService.Method.UnimplementedCall.Input>(),
  734. deserializer: ProtobufDeserializer<Grpc_Testing_UnimplementedService.Method.UnimplementedCall.Output>(),
  735. body
  736. )
  737. }
  738. }
  739. /// A simple service NOT implemented at servers so clients can test for
  740. /// that case.
  741. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  742. public struct Grpc_Testing_UnimplementedServiceClient: Grpc_Testing_UnimplementedService.ClientProtocol {
  743. private let client: GRPCCore.GRPCClient
  744. public init(client: GRPCCore.GRPCClient) {
  745. self.client = client
  746. }
  747. /// A call that no server should implement
  748. public func unimplementedCall<R>(
  749. request: ClientRequest.Single<Grpc_Testing_UnimplementedService.Method.UnimplementedCall.Input>,
  750. serializer: some MessageSerializer<Grpc_Testing_UnimplementedService.Method.UnimplementedCall.Input>,
  751. deserializer: some MessageDeserializer<Grpc_Testing_UnimplementedService.Method.UnimplementedCall.Output>,
  752. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_UnimplementedService.Method.UnimplementedCall.Output>) async throws -> R
  753. ) async throws -> R where R: Sendable {
  754. try await self.client.unary(
  755. request: request,
  756. descriptor: Grpc_Testing_UnimplementedService.Method.UnimplementedCall.descriptor,
  757. serializer: serializer,
  758. deserializer: deserializer,
  759. handler: body
  760. )
  761. }
  762. }
  763. /// A service used to control reconnect server.
  764. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  765. public protocol Grpc_Testing_ReconnectServiceClientProtocol: Sendable {
  766. func start<R>(
  767. request: ClientRequest.Single<Grpc_Testing_ReconnectService.Method.Start.Input>,
  768. serializer: some MessageSerializer<Grpc_Testing_ReconnectService.Method.Start.Input>,
  769. deserializer: some MessageDeserializer<Grpc_Testing_ReconnectService.Method.Start.Output>,
  770. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_ReconnectService.Method.Start.Output>) async throws -> R
  771. ) async throws -> R where R: Sendable
  772. func stop<R>(
  773. request: ClientRequest.Single<Grpc_Testing_ReconnectService.Method.Stop.Input>,
  774. serializer: some MessageSerializer<Grpc_Testing_ReconnectService.Method.Stop.Input>,
  775. deserializer: some MessageDeserializer<Grpc_Testing_ReconnectService.Method.Stop.Output>,
  776. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_ReconnectService.Method.Stop.Output>) async throws -> R
  777. ) async throws -> R where R: Sendable
  778. }
  779. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  780. extension Grpc_Testing_ReconnectService.ClientProtocol {
  781. public func start<R>(
  782. request: ClientRequest.Single<Grpc_Testing_ReconnectService.Method.Start.Input>,
  783. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_ReconnectService.Method.Start.Output>) async throws -> R
  784. ) async throws -> R where R: Sendable {
  785. try await self.start(
  786. request: request,
  787. serializer: ProtobufSerializer<Grpc_Testing_ReconnectService.Method.Start.Input>(),
  788. deserializer: ProtobufDeserializer<Grpc_Testing_ReconnectService.Method.Start.Output>(),
  789. body
  790. )
  791. }
  792. public func stop<R>(
  793. request: ClientRequest.Single<Grpc_Testing_ReconnectService.Method.Stop.Input>,
  794. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_ReconnectService.Method.Stop.Output>) async throws -> R
  795. ) async throws -> R where R: Sendable {
  796. try await self.stop(
  797. request: request,
  798. serializer: ProtobufSerializer<Grpc_Testing_ReconnectService.Method.Stop.Input>(),
  799. deserializer: ProtobufDeserializer<Grpc_Testing_ReconnectService.Method.Stop.Output>(),
  800. body
  801. )
  802. }
  803. }
  804. /// A service used to control reconnect server.
  805. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  806. public struct Grpc_Testing_ReconnectServiceClient: Grpc_Testing_ReconnectService.ClientProtocol {
  807. private let client: GRPCCore.GRPCClient
  808. public init(client: GRPCCore.GRPCClient) {
  809. self.client = client
  810. }
  811. public 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. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_ReconnectService.Method.Start.Output>) async throws -> R
  816. ) async throws -> R where R: Sendable {
  817. try await self.client.unary(
  818. request: request,
  819. descriptor: Grpc_Testing_ReconnectService.Method.Start.descriptor,
  820. serializer: serializer,
  821. deserializer: deserializer,
  822. handler: body
  823. )
  824. }
  825. public func stop<R>(
  826. request: ClientRequest.Single<Grpc_Testing_ReconnectService.Method.Stop.Input>,
  827. serializer: some MessageSerializer<Grpc_Testing_ReconnectService.Method.Stop.Input>,
  828. deserializer: some MessageDeserializer<Grpc_Testing_ReconnectService.Method.Stop.Output>,
  829. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_ReconnectService.Method.Stop.Output>) async throws -> R
  830. ) async throws -> R where R: Sendable {
  831. try await self.client.unary(
  832. request: request,
  833. descriptor: Grpc_Testing_ReconnectService.Method.Stop.descriptor,
  834. serializer: serializer,
  835. deserializer: deserializer,
  836. handler: body
  837. )
  838. }
  839. }