test.grpc.swift 49 KB

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