test.grpc.swift 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260
  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. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
  630. extension Grpc_Testing_TestService.ClientProtocol {
  631. /// One empty request followed by one empty response.
  632. public func emptyCall<Result>(
  633. _ message: Grpc_Testing_Empty,
  634. metadata: GRPCCore.Metadata = [:],
  635. options: GRPCCore.CallOptions = .defaults,
  636. onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse.Single<Grpc_Testing_Empty>) async throws -> Result = {
  637. try $0.message
  638. }
  639. ) async throws -> Result where Result: Sendable {
  640. let request = GRPCCore.ClientRequest.Single<Grpc_Testing_Empty>(
  641. message: message,
  642. metadata: metadata
  643. )
  644. return try await self.emptyCall(
  645. request: request,
  646. options: options,
  647. handleResponse
  648. )
  649. }
  650. /// One request followed by one response.
  651. public func unaryCall<Result>(
  652. _ message: Grpc_Testing_SimpleRequest,
  653. metadata: GRPCCore.Metadata = [:],
  654. options: GRPCCore.CallOptions = .defaults,
  655. onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse.Single<Grpc_Testing_SimpleResponse>) async throws -> Result = {
  656. try $0.message
  657. }
  658. ) async throws -> Result where Result: Sendable {
  659. let request = GRPCCore.ClientRequest.Single<Grpc_Testing_SimpleRequest>(
  660. message: message,
  661. metadata: metadata
  662. )
  663. return try await self.unaryCall(
  664. request: request,
  665. options: options,
  666. handleResponse
  667. )
  668. }
  669. /// One request followed by one response. Response has cache control
  670. /// headers set such that a caching HTTP proxy (such as GFE) can
  671. /// satisfy subsequent requests.
  672. public func cacheableUnaryCall<Result>(
  673. _ message: Grpc_Testing_SimpleRequest,
  674. metadata: GRPCCore.Metadata = [:],
  675. options: GRPCCore.CallOptions = .defaults,
  676. onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse.Single<Grpc_Testing_SimpleResponse>) async throws -> Result = {
  677. try $0.message
  678. }
  679. ) async throws -> Result where Result: Sendable {
  680. let request = GRPCCore.ClientRequest.Single<Grpc_Testing_SimpleRequest>(
  681. message: message,
  682. metadata: metadata
  683. )
  684. return try await self.cacheableUnaryCall(
  685. request: request,
  686. options: options,
  687. handleResponse
  688. )
  689. }
  690. /// One request followed by a sequence of responses (streamed download).
  691. /// The server returns the payload with client desired type and sizes.
  692. public func streamingOutputCall<Result>(
  693. _ message: Grpc_Testing_StreamingOutputCallRequest,
  694. metadata: GRPCCore.Metadata = [:],
  695. options: GRPCCore.CallOptions = .defaults,
  696. onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse.Stream<Grpc_Testing_StreamingOutputCallResponse>) async throws -> Result
  697. ) async throws -> Result where Result: Sendable {
  698. let request = GRPCCore.ClientRequest.Single<Grpc_Testing_StreamingOutputCallRequest>(
  699. message: message,
  700. metadata: metadata
  701. )
  702. return try await self.streamingOutputCall(
  703. request: request,
  704. options: options,
  705. handleResponse
  706. )
  707. }
  708. /// A sequence of requests followed by one response (streamed upload).
  709. /// The server returns the aggregated size of client payload as the result.
  710. public func streamingInputCall<Result>(
  711. metadata: GRPCCore.Metadata = [:],
  712. options: GRPCCore.CallOptions = .defaults,
  713. requestProducer: @Sendable @escaping (GRPCCore.RPCWriter<Grpc_Testing_StreamingInputCallRequest>) async throws -> Void,
  714. onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse.Single<Grpc_Testing_StreamingInputCallResponse>) async throws -> Result = {
  715. try $0.message
  716. }
  717. ) async throws -> Result where Result: Sendable {
  718. let request = GRPCCore.ClientRequest.Stream<Grpc_Testing_StreamingInputCallRequest>(
  719. metadata: metadata,
  720. producer: requestProducer
  721. )
  722. return try await self.streamingInputCall(
  723. request: request,
  724. options: options,
  725. handleResponse
  726. )
  727. }
  728. /// A sequence of requests with each request served by the server immediately.
  729. /// As one request could lead to multiple responses, this interface
  730. /// demonstrates the idea of full duplexing.
  731. public func fullDuplexCall<Result>(
  732. metadata: GRPCCore.Metadata = [:],
  733. options: GRPCCore.CallOptions = .defaults,
  734. requestProducer: @Sendable @escaping (GRPCCore.RPCWriter<Grpc_Testing_StreamingOutputCallRequest>) async throws -> Void,
  735. onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse.Stream<Grpc_Testing_StreamingOutputCallResponse>) async throws -> Result
  736. ) async throws -> Result where Result: Sendable {
  737. let request = GRPCCore.ClientRequest.Stream<Grpc_Testing_StreamingOutputCallRequest>(
  738. metadata: metadata,
  739. producer: requestProducer
  740. )
  741. return try await self.fullDuplexCall(
  742. request: request,
  743. options: options,
  744. handleResponse
  745. )
  746. }
  747. /// A sequence of requests followed by a sequence of responses.
  748. /// The server buffers all the client requests and then serves them in order. A
  749. /// stream of responses are returned to the client when the server starts with
  750. /// first request.
  751. public func halfDuplexCall<Result>(
  752. metadata: GRPCCore.Metadata = [:],
  753. options: GRPCCore.CallOptions = .defaults,
  754. requestProducer: @Sendable @escaping (GRPCCore.RPCWriter<Grpc_Testing_StreamingOutputCallRequest>) async throws -> Void,
  755. onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse.Stream<Grpc_Testing_StreamingOutputCallResponse>) async throws -> Result
  756. ) async throws -> Result where Result: Sendable {
  757. let request = GRPCCore.ClientRequest.Stream<Grpc_Testing_StreamingOutputCallRequest>(
  758. metadata: metadata,
  759. producer: requestProducer
  760. )
  761. return try await self.halfDuplexCall(
  762. request: request,
  763. options: options,
  764. handleResponse
  765. )
  766. }
  767. /// The test server will not implement this method. It will be used
  768. /// to test the behavior when clients call unimplemented methods.
  769. public func unimplementedCall<Result>(
  770. _ message: Grpc_Testing_Empty,
  771. metadata: GRPCCore.Metadata = [:],
  772. options: GRPCCore.CallOptions = .defaults,
  773. onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse.Single<Grpc_Testing_Empty>) async throws -> Result = {
  774. try $0.message
  775. }
  776. ) async throws -> Result where Result: Sendable {
  777. let request = GRPCCore.ClientRequest.Single<Grpc_Testing_Empty>(
  778. message: message,
  779. metadata: metadata
  780. )
  781. return try await self.unimplementedCall(
  782. request: request,
  783. options: options,
  784. handleResponse
  785. )
  786. }
  787. }
  788. /// A simple service to test the various types of RPCs and experiment with
  789. /// performance with various types of payload.
  790. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
  791. public struct Grpc_Testing_TestServiceClient: Grpc_Testing_TestService.ClientProtocol {
  792. private let client: GRPCCore.GRPCClient
  793. public init(wrapping client: GRPCCore.GRPCClient) {
  794. self.client = client
  795. }
  796. /// One empty request followed by one empty response.
  797. public func emptyCall<R>(
  798. request: ClientRequest.Single<Grpc_Testing_Empty>,
  799. serializer: some MessageSerializer<Grpc_Testing_Empty>,
  800. deserializer: some MessageDeserializer<Grpc_Testing_Empty>,
  801. options: CallOptions = .defaults,
  802. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_Empty>) async throws -> R = {
  803. try $0.message
  804. }
  805. ) async throws -> R where R: Sendable {
  806. try await self.client.unary(
  807. request: request,
  808. descriptor: Grpc_Testing_TestService.Method.EmptyCall.descriptor,
  809. serializer: serializer,
  810. deserializer: deserializer,
  811. options: options,
  812. handler: body
  813. )
  814. }
  815. /// One request followed by one response.
  816. public func unaryCall<R>(
  817. request: ClientRequest.Single<Grpc_Testing_SimpleRequest>,
  818. serializer: some MessageSerializer<Grpc_Testing_SimpleRequest>,
  819. deserializer: some MessageDeserializer<Grpc_Testing_SimpleResponse>,
  820. options: CallOptions = .defaults,
  821. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_SimpleResponse>) async throws -> R = {
  822. try $0.message
  823. }
  824. ) async throws -> R where R: Sendable {
  825. try await self.client.unary(
  826. request: request,
  827. descriptor: Grpc_Testing_TestService.Method.UnaryCall.descriptor,
  828. serializer: serializer,
  829. deserializer: deserializer,
  830. options: options,
  831. handler: body
  832. )
  833. }
  834. /// One request followed by one response. Response has cache control
  835. /// headers set such that a caching HTTP proxy (such as GFE) can
  836. /// satisfy subsequent requests.
  837. public func cacheableUnaryCall<R>(
  838. request: ClientRequest.Single<Grpc_Testing_SimpleRequest>,
  839. serializer: some MessageSerializer<Grpc_Testing_SimpleRequest>,
  840. deserializer: some MessageDeserializer<Grpc_Testing_SimpleResponse>,
  841. options: CallOptions = .defaults,
  842. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_SimpleResponse>) async throws -> R = {
  843. try $0.message
  844. }
  845. ) async throws -> R where R: Sendable {
  846. try await self.client.unary(
  847. request: request,
  848. descriptor: Grpc_Testing_TestService.Method.CacheableUnaryCall.descriptor,
  849. serializer: serializer,
  850. deserializer: deserializer,
  851. options: options,
  852. handler: body
  853. )
  854. }
  855. /// One request followed by a sequence of responses (streamed download).
  856. /// The server returns the payload with client desired type and sizes.
  857. public func streamingOutputCall<R>(
  858. request: ClientRequest.Single<Grpc_Testing_StreamingOutputCallRequest>,
  859. serializer: some MessageSerializer<Grpc_Testing_StreamingOutputCallRequest>,
  860. deserializer: some MessageDeserializer<Grpc_Testing_StreamingOutputCallResponse>,
  861. options: CallOptions = .defaults,
  862. _ body: @Sendable @escaping (ClientResponse.Stream<Grpc_Testing_StreamingOutputCallResponse>) async throws -> R
  863. ) async throws -> R where R: Sendable {
  864. try await self.client.serverStreaming(
  865. request: request,
  866. descriptor: Grpc_Testing_TestService.Method.StreamingOutputCall.descriptor,
  867. serializer: serializer,
  868. deserializer: deserializer,
  869. options: options,
  870. handler: body
  871. )
  872. }
  873. /// A sequence of requests followed by one response (streamed upload).
  874. /// The server returns the aggregated size of client payload as the result.
  875. public func streamingInputCall<R>(
  876. request: ClientRequest.Stream<Grpc_Testing_StreamingInputCallRequest>,
  877. serializer: some MessageSerializer<Grpc_Testing_StreamingInputCallRequest>,
  878. deserializer: some MessageDeserializer<Grpc_Testing_StreamingInputCallResponse>,
  879. options: CallOptions = .defaults,
  880. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_StreamingInputCallResponse>) async throws -> R = {
  881. try $0.message
  882. }
  883. ) async throws -> R where R: Sendable {
  884. try await self.client.clientStreaming(
  885. request: request,
  886. descriptor: Grpc_Testing_TestService.Method.StreamingInputCall.descriptor,
  887. serializer: serializer,
  888. deserializer: deserializer,
  889. options: options,
  890. handler: body
  891. )
  892. }
  893. /// A sequence of requests with each request served by the server immediately.
  894. /// As one request could lead to multiple responses, this interface
  895. /// demonstrates the idea of full duplexing.
  896. public func fullDuplexCall<R>(
  897. request: ClientRequest.Stream<Grpc_Testing_StreamingOutputCallRequest>,
  898. serializer: some MessageSerializer<Grpc_Testing_StreamingOutputCallRequest>,
  899. deserializer: some MessageDeserializer<Grpc_Testing_StreamingOutputCallResponse>,
  900. options: CallOptions = .defaults,
  901. _ body: @Sendable @escaping (ClientResponse.Stream<Grpc_Testing_StreamingOutputCallResponse>) async throws -> R
  902. ) async throws -> R where R: Sendable {
  903. try await self.client.bidirectionalStreaming(
  904. request: request,
  905. descriptor: Grpc_Testing_TestService.Method.FullDuplexCall.descriptor,
  906. serializer: serializer,
  907. deserializer: deserializer,
  908. options: options,
  909. handler: body
  910. )
  911. }
  912. /// A sequence of requests followed by a sequence of responses.
  913. /// The server buffers all the client requests and then serves them in order. A
  914. /// stream of responses are returned to the client when the server starts with
  915. /// first request.
  916. public func halfDuplexCall<R>(
  917. request: ClientRequest.Stream<Grpc_Testing_StreamingOutputCallRequest>,
  918. serializer: some MessageSerializer<Grpc_Testing_StreamingOutputCallRequest>,
  919. deserializer: some MessageDeserializer<Grpc_Testing_StreamingOutputCallResponse>,
  920. options: CallOptions = .defaults,
  921. _ body: @Sendable @escaping (ClientResponse.Stream<Grpc_Testing_StreamingOutputCallResponse>) async throws -> R
  922. ) async throws -> R where R: Sendable {
  923. try await self.client.bidirectionalStreaming(
  924. request: request,
  925. descriptor: Grpc_Testing_TestService.Method.HalfDuplexCall.descriptor,
  926. serializer: serializer,
  927. deserializer: deserializer,
  928. options: options,
  929. handler: body
  930. )
  931. }
  932. /// The test server will not implement this method. It will be used
  933. /// to test the behavior when clients call unimplemented methods.
  934. public func unimplementedCall<R>(
  935. request: ClientRequest.Single<Grpc_Testing_Empty>,
  936. serializer: some MessageSerializer<Grpc_Testing_Empty>,
  937. deserializer: some MessageDeserializer<Grpc_Testing_Empty>,
  938. options: CallOptions = .defaults,
  939. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_Empty>) async throws -> R = {
  940. try $0.message
  941. }
  942. ) async throws -> R where R: Sendable {
  943. try await self.client.unary(
  944. request: request,
  945. descriptor: Grpc_Testing_TestService.Method.UnimplementedCall.descriptor,
  946. serializer: serializer,
  947. deserializer: deserializer,
  948. options: options,
  949. handler: body
  950. )
  951. }
  952. }
  953. /// A simple service NOT implemented at servers so clients can test for
  954. /// that case.
  955. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
  956. public protocol Grpc_Testing_UnimplementedServiceClientProtocol: Sendable {
  957. /// A call that no server should implement
  958. func unimplementedCall<R>(
  959. request: ClientRequest.Single<Grpc_Testing_Empty>,
  960. serializer: some MessageSerializer<Grpc_Testing_Empty>,
  961. deserializer: some MessageDeserializer<Grpc_Testing_Empty>,
  962. options: CallOptions,
  963. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_Empty>) async throws -> R
  964. ) async throws -> R where R: Sendable
  965. }
  966. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
  967. extension Grpc_Testing_UnimplementedService.ClientProtocol {
  968. public func unimplementedCall<R>(
  969. request: ClientRequest.Single<Grpc_Testing_Empty>,
  970. options: CallOptions = .defaults,
  971. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_Empty>) async throws -> R = {
  972. try $0.message
  973. }
  974. ) async throws -> R where R: Sendable {
  975. try await self.unimplementedCall(
  976. request: request,
  977. serializer: ProtobufSerializer<Grpc_Testing_Empty>(),
  978. deserializer: ProtobufDeserializer<Grpc_Testing_Empty>(),
  979. options: options,
  980. body
  981. )
  982. }
  983. }
  984. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
  985. extension Grpc_Testing_UnimplementedService.ClientProtocol {
  986. /// A call that no server should implement
  987. public func unimplementedCall<Result>(
  988. _ message: Grpc_Testing_Empty,
  989. metadata: GRPCCore.Metadata = [:],
  990. options: GRPCCore.CallOptions = .defaults,
  991. onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse.Single<Grpc_Testing_Empty>) async throws -> Result = {
  992. try $0.message
  993. }
  994. ) async throws -> Result where Result: Sendable {
  995. let request = GRPCCore.ClientRequest.Single<Grpc_Testing_Empty>(
  996. message: message,
  997. metadata: metadata
  998. )
  999. return try await self.unimplementedCall(
  1000. request: request,
  1001. options: options,
  1002. handleResponse
  1003. )
  1004. }
  1005. }
  1006. /// A simple service NOT implemented at servers so clients can test for
  1007. /// that case.
  1008. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
  1009. public struct Grpc_Testing_UnimplementedServiceClient: Grpc_Testing_UnimplementedService.ClientProtocol {
  1010. private let client: GRPCCore.GRPCClient
  1011. public init(wrapping client: GRPCCore.GRPCClient) {
  1012. self.client = client
  1013. }
  1014. /// A call that no server should implement
  1015. public func unimplementedCall<R>(
  1016. request: ClientRequest.Single<Grpc_Testing_Empty>,
  1017. serializer: some MessageSerializer<Grpc_Testing_Empty>,
  1018. deserializer: some MessageDeserializer<Grpc_Testing_Empty>,
  1019. options: CallOptions = .defaults,
  1020. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_Empty>) async throws -> R = {
  1021. try $0.message
  1022. }
  1023. ) async throws -> R where R: Sendable {
  1024. try await self.client.unary(
  1025. request: request,
  1026. descriptor: Grpc_Testing_UnimplementedService.Method.UnimplementedCall.descriptor,
  1027. serializer: serializer,
  1028. deserializer: deserializer,
  1029. options: options,
  1030. handler: body
  1031. )
  1032. }
  1033. }
  1034. /// A service used to control reconnect server.
  1035. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
  1036. public protocol Grpc_Testing_ReconnectServiceClientProtocol: Sendable {
  1037. func start<R>(
  1038. request: ClientRequest.Single<Grpc_Testing_ReconnectParams>,
  1039. serializer: some MessageSerializer<Grpc_Testing_ReconnectParams>,
  1040. deserializer: some MessageDeserializer<Grpc_Testing_Empty>,
  1041. options: CallOptions,
  1042. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_Empty>) async throws -> R
  1043. ) async throws -> R where R: Sendable
  1044. func stop<R>(
  1045. request: ClientRequest.Single<Grpc_Testing_Empty>,
  1046. serializer: some MessageSerializer<Grpc_Testing_Empty>,
  1047. deserializer: some MessageDeserializer<Grpc_Testing_ReconnectInfo>,
  1048. options: CallOptions,
  1049. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_ReconnectInfo>) async throws -> R
  1050. ) async throws -> R where R: Sendable
  1051. }
  1052. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
  1053. extension Grpc_Testing_ReconnectService.ClientProtocol {
  1054. public func start<R>(
  1055. request: ClientRequest.Single<Grpc_Testing_ReconnectParams>,
  1056. options: CallOptions = .defaults,
  1057. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_Empty>) async throws -> R = {
  1058. try $0.message
  1059. }
  1060. ) async throws -> R where R: Sendable {
  1061. try await self.start(
  1062. request: request,
  1063. serializer: ProtobufSerializer<Grpc_Testing_ReconnectParams>(),
  1064. deserializer: ProtobufDeserializer<Grpc_Testing_Empty>(),
  1065. options: options,
  1066. body
  1067. )
  1068. }
  1069. public func stop<R>(
  1070. request: ClientRequest.Single<Grpc_Testing_Empty>,
  1071. options: CallOptions = .defaults,
  1072. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_ReconnectInfo>) async throws -> R = {
  1073. try $0.message
  1074. }
  1075. ) async throws -> R where R: Sendable {
  1076. try await self.stop(
  1077. request: request,
  1078. serializer: ProtobufSerializer<Grpc_Testing_Empty>(),
  1079. deserializer: ProtobufDeserializer<Grpc_Testing_ReconnectInfo>(),
  1080. options: options,
  1081. body
  1082. )
  1083. }
  1084. }
  1085. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
  1086. extension Grpc_Testing_ReconnectService.ClientProtocol {
  1087. public func start<Result>(
  1088. _ message: Grpc_Testing_ReconnectParams,
  1089. metadata: GRPCCore.Metadata = [:],
  1090. options: GRPCCore.CallOptions = .defaults,
  1091. onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse.Single<Grpc_Testing_Empty>) async throws -> Result = {
  1092. try $0.message
  1093. }
  1094. ) async throws -> Result where Result: Sendable {
  1095. let request = GRPCCore.ClientRequest.Single<Grpc_Testing_ReconnectParams>(
  1096. message: message,
  1097. metadata: metadata
  1098. )
  1099. return try await self.start(
  1100. request: request,
  1101. options: options,
  1102. handleResponse
  1103. )
  1104. }
  1105. public func stop<Result>(
  1106. _ message: Grpc_Testing_Empty,
  1107. metadata: GRPCCore.Metadata = [:],
  1108. options: GRPCCore.CallOptions = .defaults,
  1109. onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse.Single<Grpc_Testing_ReconnectInfo>) async throws -> Result = {
  1110. try $0.message
  1111. }
  1112. ) async throws -> Result where Result: Sendable {
  1113. let request = GRPCCore.ClientRequest.Single<Grpc_Testing_Empty>(
  1114. message: message,
  1115. metadata: metadata
  1116. )
  1117. return try await self.stop(
  1118. request: request,
  1119. options: options,
  1120. handleResponse
  1121. )
  1122. }
  1123. }
  1124. /// A service used to control reconnect server.
  1125. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
  1126. public struct Grpc_Testing_ReconnectServiceClient: Grpc_Testing_ReconnectService.ClientProtocol {
  1127. private let client: GRPCCore.GRPCClient
  1128. public init(wrapping client: GRPCCore.GRPCClient) {
  1129. self.client = client
  1130. }
  1131. public func start<R>(
  1132. request: ClientRequest.Single<Grpc_Testing_ReconnectParams>,
  1133. serializer: some MessageSerializer<Grpc_Testing_ReconnectParams>,
  1134. deserializer: some MessageDeserializer<Grpc_Testing_Empty>,
  1135. options: CallOptions = .defaults,
  1136. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_Empty>) async throws -> R = {
  1137. try $0.message
  1138. }
  1139. ) async throws -> R where R: Sendable {
  1140. try await self.client.unary(
  1141. request: request,
  1142. descriptor: Grpc_Testing_ReconnectService.Method.Start.descriptor,
  1143. serializer: serializer,
  1144. deserializer: deserializer,
  1145. options: options,
  1146. handler: body
  1147. )
  1148. }
  1149. public func stop<R>(
  1150. request: ClientRequest.Single<Grpc_Testing_Empty>,
  1151. serializer: some MessageSerializer<Grpc_Testing_Empty>,
  1152. deserializer: some MessageDeserializer<Grpc_Testing_ReconnectInfo>,
  1153. options: CallOptions = .defaults,
  1154. _ body: @Sendable @escaping (ClientResponse.Single<Grpc_Testing_ReconnectInfo>) async throws -> R = {
  1155. try $0.message
  1156. }
  1157. ) async throws -> R where R: Sendable {
  1158. try await self.client.unary(
  1159. request: request,
  1160. descriptor: Grpc_Testing_ReconnectService.Method.Stop.descriptor,
  1161. serializer: serializer,
  1162. deserializer: deserializer,
  1163. options: options,
  1164. handler: body
  1165. )
  1166. }
  1167. }