normalization.grpc.swift 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  1. //
  2. // DO NOT EDIT.
  3. //
  4. // Generated by the protocol buffer compiler.
  5. // Source: normalization.proto
  6. //
  7. //
  8. // Copyright 2018, gRPC Authors All rights reserved.
  9. //
  10. // Licensed under the Apache License, Version 2.0 (the "License");
  11. // you may not use this file except in compliance with the License.
  12. // You may obtain a copy of the License at
  13. //
  14. // http://www.apache.org/licenses/LICENSE-2.0
  15. //
  16. // Unless required by applicable law or agreed to in writing, software
  17. // distributed under the License is distributed on an "AS IS" BASIS,
  18. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  19. // See the License for the specific language governing permissions and
  20. // limitations under the License.
  21. //
  22. import GRPC
  23. import NIO
  24. import SwiftProtobuf
  25. /// Usage: instantiate `Normalization_NormalizationClient`, then call methods of this protocol to make API calls.
  26. internal protocol Normalization_NormalizationClientProtocol: GRPCClient {
  27. var serviceName: String { get }
  28. var interceptors: Normalization_NormalizationClientInterceptorFactoryProtocol? { get }
  29. func Unary(
  30. _ request: SwiftProtobuf.Google_Protobuf_Empty,
  31. callOptions: CallOptions?
  32. ) -> UnaryCall<SwiftProtobuf.Google_Protobuf_Empty, Normalization_FunctionName>
  33. func unary(
  34. _ request: SwiftProtobuf.Google_Protobuf_Empty,
  35. callOptions: CallOptions?
  36. ) -> UnaryCall<SwiftProtobuf.Google_Protobuf_Empty, Normalization_FunctionName>
  37. func ServerStreaming(
  38. _ request: SwiftProtobuf.Google_Protobuf_Empty,
  39. callOptions: CallOptions?,
  40. handler: @escaping (Normalization_FunctionName) -> Void
  41. ) -> ServerStreamingCall<SwiftProtobuf.Google_Protobuf_Empty, Normalization_FunctionName>
  42. func serverStreaming(
  43. _ request: SwiftProtobuf.Google_Protobuf_Empty,
  44. callOptions: CallOptions?,
  45. handler: @escaping (Normalization_FunctionName) -> Void
  46. ) -> ServerStreamingCall<SwiftProtobuf.Google_Protobuf_Empty, Normalization_FunctionName>
  47. func ClientStreaming(
  48. callOptions: CallOptions?
  49. ) -> ClientStreamingCall<SwiftProtobuf.Google_Protobuf_Empty, Normalization_FunctionName>
  50. func clientStreaming(
  51. callOptions: CallOptions?
  52. ) -> ClientStreamingCall<SwiftProtobuf.Google_Protobuf_Empty, Normalization_FunctionName>
  53. func BidirectionalStreaming(
  54. callOptions: CallOptions?,
  55. handler: @escaping (Normalization_FunctionName) -> Void
  56. ) -> BidirectionalStreamingCall<SwiftProtobuf.Google_Protobuf_Empty, Normalization_FunctionName>
  57. func bidirectionalStreaming(
  58. callOptions: CallOptions?,
  59. handler: @escaping (Normalization_FunctionName) -> Void
  60. ) -> BidirectionalStreamingCall<SwiftProtobuf.Google_Protobuf_Empty, Normalization_FunctionName>
  61. }
  62. extension Normalization_NormalizationClientProtocol {
  63. internal var serviceName: String {
  64. return "normalization.Normalization"
  65. }
  66. /// Unary call to Unary
  67. ///
  68. /// - Parameters:
  69. /// - request: Request to send to Unary.
  70. /// - callOptions: Call options.
  71. /// - Returns: A `UnaryCall` with futures for the metadata, status and response.
  72. internal func Unary(
  73. _ request: SwiftProtobuf.Google_Protobuf_Empty,
  74. callOptions: CallOptions? = nil
  75. ) -> UnaryCall<SwiftProtobuf.Google_Protobuf_Empty, Normalization_FunctionName> {
  76. return self.makeUnaryCall(
  77. path: "/normalization.Normalization/Unary",
  78. request: request,
  79. callOptions: callOptions ?? self.defaultCallOptions,
  80. interceptors: self.interceptors?.makeUnaryInterceptors() ?? []
  81. )
  82. }
  83. /// Unary call to unary
  84. ///
  85. /// - Parameters:
  86. /// - request: Request to send to unary.
  87. /// - callOptions: Call options.
  88. /// - Returns: A `UnaryCall` with futures for the metadata, status and response.
  89. internal func unary(
  90. _ request: SwiftProtobuf.Google_Protobuf_Empty,
  91. callOptions: CallOptions? = nil
  92. ) -> UnaryCall<SwiftProtobuf.Google_Protobuf_Empty, Normalization_FunctionName> {
  93. return self.makeUnaryCall(
  94. path: "/normalization.Normalization/unary",
  95. request: request,
  96. callOptions: callOptions ?? self.defaultCallOptions,
  97. interceptors: self.interceptors?.makeunaryInterceptors() ?? []
  98. )
  99. }
  100. /// Server streaming call to ServerStreaming
  101. ///
  102. /// - Parameters:
  103. /// - request: Request to send to ServerStreaming.
  104. /// - callOptions: Call options.
  105. /// - handler: A closure called when each response is received from the server.
  106. /// - Returns: A `ServerStreamingCall` with futures for the metadata and status.
  107. internal func ServerStreaming(
  108. _ request: SwiftProtobuf.Google_Protobuf_Empty,
  109. callOptions: CallOptions? = nil,
  110. handler: @escaping (Normalization_FunctionName) -> Void
  111. ) -> ServerStreamingCall<SwiftProtobuf.Google_Protobuf_Empty, Normalization_FunctionName> {
  112. return self.makeServerStreamingCall(
  113. path: "/normalization.Normalization/ServerStreaming",
  114. request: request,
  115. callOptions: callOptions ?? self.defaultCallOptions,
  116. interceptors: self.interceptors?.makeServerStreamingInterceptors() ?? [],
  117. handler: handler
  118. )
  119. }
  120. /// Server streaming call to serverStreaming
  121. ///
  122. /// - Parameters:
  123. /// - request: Request to send to serverStreaming.
  124. /// - callOptions: Call options.
  125. /// - handler: A closure called when each response is received from the server.
  126. /// - Returns: A `ServerStreamingCall` with futures for the metadata and status.
  127. internal func serverStreaming(
  128. _ request: SwiftProtobuf.Google_Protobuf_Empty,
  129. callOptions: CallOptions? = nil,
  130. handler: @escaping (Normalization_FunctionName) -> Void
  131. ) -> ServerStreamingCall<SwiftProtobuf.Google_Protobuf_Empty, Normalization_FunctionName> {
  132. return self.makeServerStreamingCall(
  133. path: "/normalization.Normalization/serverStreaming",
  134. request: request,
  135. callOptions: callOptions ?? self.defaultCallOptions,
  136. interceptors: self.interceptors?.makeserverStreamingInterceptors() ?? [],
  137. handler: handler
  138. )
  139. }
  140. /// Client streaming call to ClientStreaming
  141. ///
  142. /// Callers should use the `send` method on the returned object to send messages
  143. /// to the server. The caller should send an `.end` after the final message has been sent.
  144. ///
  145. /// - Parameters:
  146. /// - callOptions: Call options.
  147. /// - Returns: A `ClientStreamingCall` with futures for the metadata, status and response.
  148. internal func ClientStreaming(
  149. callOptions: CallOptions? = nil
  150. ) -> ClientStreamingCall<SwiftProtobuf.Google_Protobuf_Empty, Normalization_FunctionName> {
  151. return self.makeClientStreamingCall(
  152. path: "/normalization.Normalization/ClientStreaming",
  153. callOptions: callOptions ?? self.defaultCallOptions,
  154. interceptors: self.interceptors?.makeClientStreamingInterceptors() ?? []
  155. )
  156. }
  157. /// Client streaming call to clientStreaming
  158. ///
  159. /// Callers should use the `send` method on the returned object to send messages
  160. /// to the server. The caller should send an `.end` after the final message has been sent.
  161. ///
  162. /// - Parameters:
  163. /// - callOptions: Call options.
  164. /// - Returns: A `ClientStreamingCall` with futures for the metadata, status and response.
  165. internal func clientStreaming(
  166. callOptions: CallOptions? = nil
  167. ) -> ClientStreamingCall<SwiftProtobuf.Google_Protobuf_Empty, Normalization_FunctionName> {
  168. return self.makeClientStreamingCall(
  169. path: "/normalization.Normalization/clientStreaming",
  170. callOptions: callOptions ?? self.defaultCallOptions,
  171. interceptors: self.interceptors?.makeclientStreamingInterceptors() ?? []
  172. )
  173. }
  174. /// Bidirectional streaming call to BidirectionalStreaming
  175. ///
  176. /// Callers should use the `send` method on the returned object to send messages
  177. /// to the server. The caller should send an `.end` after the final message has been sent.
  178. ///
  179. /// - Parameters:
  180. /// - callOptions: Call options.
  181. /// - handler: A closure called when each response is received from the server.
  182. /// - Returns: A `ClientStreamingCall` with futures for the metadata and status.
  183. internal func BidirectionalStreaming(
  184. callOptions: CallOptions? = nil,
  185. handler: @escaping (Normalization_FunctionName) -> Void
  186. ) -> BidirectionalStreamingCall<SwiftProtobuf.Google_Protobuf_Empty, Normalization_FunctionName> {
  187. return self.makeBidirectionalStreamingCall(
  188. path: "/normalization.Normalization/BidirectionalStreaming",
  189. callOptions: callOptions ?? self.defaultCallOptions,
  190. interceptors: self.interceptors?.makeBidirectionalStreamingInterceptors() ?? [],
  191. handler: handler
  192. )
  193. }
  194. /// Bidirectional streaming call to bidirectionalStreaming
  195. ///
  196. /// Callers should use the `send` method on the returned object to send messages
  197. /// to the server. The caller should send an `.end` after the final message has been sent.
  198. ///
  199. /// - Parameters:
  200. /// - callOptions: Call options.
  201. /// - handler: A closure called when each response is received from the server.
  202. /// - Returns: A `ClientStreamingCall` with futures for the metadata and status.
  203. internal func bidirectionalStreaming(
  204. callOptions: CallOptions? = nil,
  205. handler: @escaping (Normalization_FunctionName) -> Void
  206. ) -> BidirectionalStreamingCall<SwiftProtobuf.Google_Protobuf_Empty, Normalization_FunctionName> {
  207. return self.makeBidirectionalStreamingCall(
  208. path: "/normalization.Normalization/bidirectionalStreaming",
  209. callOptions: callOptions ?? self.defaultCallOptions,
  210. interceptors: self.interceptors?.makebidirectionalStreamingInterceptors() ?? [],
  211. handler: handler
  212. )
  213. }
  214. }
  215. internal protocol Normalization_NormalizationClientInterceptorFactoryProtocol {
  216. /// - Returns: Interceptors to use when invoking 'Unary'.
  217. func makeUnaryInterceptors() -> [ClientInterceptor<SwiftProtobuf.Google_Protobuf_Empty, Normalization_FunctionName>]
  218. /// - Returns: Interceptors to use when invoking 'unary'.
  219. func makeunaryInterceptors() -> [ClientInterceptor<SwiftProtobuf.Google_Protobuf_Empty, Normalization_FunctionName>]
  220. /// - Returns: Interceptors to use when invoking 'ServerStreaming'.
  221. func makeServerStreamingInterceptors() -> [ClientInterceptor<SwiftProtobuf.Google_Protobuf_Empty, Normalization_FunctionName>]
  222. /// - Returns: Interceptors to use when invoking 'serverStreaming'.
  223. func makeserverStreamingInterceptors() -> [ClientInterceptor<SwiftProtobuf.Google_Protobuf_Empty, Normalization_FunctionName>]
  224. /// - Returns: Interceptors to use when invoking 'ClientStreaming'.
  225. func makeClientStreamingInterceptors() -> [ClientInterceptor<SwiftProtobuf.Google_Protobuf_Empty, Normalization_FunctionName>]
  226. /// - Returns: Interceptors to use when invoking 'clientStreaming'.
  227. func makeclientStreamingInterceptors() -> [ClientInterceptor<SwiftProtobuf.Google_Protobuf_Empty, Normalization_FunctionName>]
  228. /// - Returns: Interceptors to use when invoking 'BidirectionalStreaming'.
  229. func makeBidirectionalStreamingInterceptors() -> [ClientInterceptor<SwiftProtobuf.Google_Protobuf_Empty, Normalization_FunctionName>]
  230. /// - Returns: Interceptors to use when invoking 'bidirectionalStreaming'.
  231. func makebidirectionalStreamingInterceptors() -> [ClientInterceptor<SwiftProtobuf.Google_Protobuf_Empty, Normalization_FunctionName>]
  232. }
  233. internal final class Normalization_NormalizationClient: Normalization_NormalizationClientProtocol {
  234. internal let channel: GRPCChannel
  235. internal var defaultCallOptions: CallOptions
  236. internal var interceptors: Normalization_NormalizationClientInterceptorFactoryProtocol?
  237. /// Creates a client for the normalization.Normalization service.
  238. ///
  239. /// - Parameters:
  240. /// - channel: `GRPCChannel` to the service host.
  241. /// - defaultCallOptions: Options to use for each service call if the user doesn't provide them.
  242. /// - interceptors: A factory providing interceptors for each RPC.
  243. internal init(
  244. channel: GRPCChannel,
  245. defaultCallOptions: CallOptions = CallOptions(),
  246. interceptors: Normalization_NormalizationClientInterceptorFactoryProtocol? = nil
  247. ) {
  248. self.channel = channel
  249. self.defaultCallOptions = defaultCallOptions
  250. self.interceptors = interceptors
  251. }
  252. }
  253. /// To build a server, implement a class that conforms to this protocol.
  254. internal protocol Normalization_NormalizationProvider: CallHandlerProvider {
  255. var interceptors: Normalization_NormalizationServerInterceptorFactoryProtocol? { get }
  256. func Unary(request: SwiftProtobuf.Google_Protobuf_Empty, context: StatusOnlyCallContext) -> EventLoopFuture<Normalization_FunctionName>
  257. func unary(request: SwiftProtobuf.Google_Protobuf_Empty, context: StatusOnlyCallContext) -> EventLoopFuture<Normalization_FunctionName>
  258. func ServerStreaming(request: SwiftProtobuf.Google_Protobuf_Empty, context: StreamingResponseCallContext<Normalization_FunctionName>) -> EventLoopFuture<GRPCStatus>
  259. func serverStreaming(request: SwiftProtobuf.Google_Protobuf_Empty, context: StreamingResponseCallContext<Normalization_FunctionName>) -> EventLoopFuture<GRPCStatus>
  260. func ClientStreaming(context: UnaryResponseCallContext<Normalization_FunctionName>) -> EventLoopFuture<(StreamEvent<SwiftProtobuf.Google_Protobuf_Empty>) -> Void>
  261. func clientStreaming(context: UnaryResponseCallContext<Normalization_FunctionName>) -> EventLoopFuture<(StreamEvent<SwiftProtobuf.Google_Protobuf_Empty>) -> Void>
  262. func BidirectionalStreaming(context: StreamingResponseCallContext<Normalization_FunctionName>) -> EventLoopFuture<(StreamEvent<SwiftProtobuf.Google_Protobuf_Empty>) -> Void>
  263. func bidirectionalStreaming(context: StreamingResponseCallContext<Normalization_FunctionName>) -> EventLoopFuture<(StreamEvent<SwiftProtobuf.Google_Protobuf_Empty>) -> Void>
  264. }
  265. extension Normalization_NormalizationProvider {
  266. internal var serviceName: Substring { return "normalization.Normalization" }
  267. /// Determines, calls and returns the appropriate request handler, depending on the request's method.
  268. /// Returns nil for methods not handled by this service.
  269. internal func handle(
  270. method name: Substring,
  271. context: CallHandlerContext
  272. ) -> GRPCServerHandlerProtocol? {
  273. switch name {
  274. case "Unary":
  275. return UnaryServerHandler(
  276. context: context,
  277. requestDeserializer: ProtobufDeserializer<SwiftProtobuf.Google_Protobuf_Empty>(),
  278. responseSerializer: ProtobufSerializer<Normalization_FunctionName>(),
  279. interceptors: self.interceptors?.makeUnaryInterceptors() ?? [],
  280. userFunction: self.Unary(request:context:)
  281. )
  282. case "unary":
  283. return UnaryServerHandler(
  284. context: context,
  285. requestDeserializer: ProtobufDeserializer<SwiftProtobuf.Google_Protobuf_Empty>(),
  286. responseSerializer: ProtobufSerializer<Normalization_FunctionName>(),
  287. interceptors: self.interceptors?.makeunaryInterceptors() ?? [],
  288. userFunction: self.unary(request:context:)
  289. )
  290. case "ServerStreaming":
  291. return ServerStreamingServerHandler(
  292. context: context,
  293. requestDeserializer: ProtobufDeserializer<SwiftProtobuf.Google_Protobuf_Empty>(),
  294. responseSerializer: ProtobufSerializer<Normalization_FunctionName>(),
  295. interceptors: self.interceptors?.makeServerStreamingInterceptors() ?? [],
  296. userFunction: self.ServerStreaming(request:context:)
  297. )
  298. case "serverStreaming":
  299. return ServerStreamingServerHandler(
  300. context: context,
  301. requestDeserializer: ProtobufDeserializer<SwiftProtobuf.Google_Protobuf_Empty>(),
  302. responseSerializer: ProtobufSerializer<Normalization_FunctionName>(),
  303. interceptors: self.interceptors?.makeserverStreamingInterceptors() ?? [],
  304. userFunction: self.serverStreaming(request:context:)
  305. )
  306. case "ClientStreaming":
  307. return ClientStreamingServerHandler(
  308. context: context,
  309. requestDeserializer: ProtobufDeserializer<SwiftProtobuf.Google_Protobuf_Empty>(),
  310. responseSerializer: ProtobufSerializer<Normalization_FunctionName>(),
  311. interceptors: self.interceptors?.makeClientStreamingInterceptors() ?? [],
  312. observerFactory: self.ClientStreaming(context:)
  313. )
  314. case "clientStreaming":
  315. return ClientStreamingServerHandler(
  316. context: context,
  317. requestDeserializer: ProtobufDeserializer<SwiftProtobuf.Google_Protobuf_Empty>(),
  318. responseSerializer: ProtobufSerializer<Normalization_FunctionName>(),
  319. interceptors: self.interceptors?.makeclientStreamingInterceptors() ?? [],
  320. observerFactory: self.clientStreaming(context:)
  321. )
  322. case "BidirectionalStreaming":
  323. return BidirectionalStreamingServerHandler(
  324. context: context,
  325. requestDeserializer: ProtobufDeserializer<SwiftProtobuf.Google_Protobuf_Empty>(),
  326. responseSerializer: ProtobufSerializer<Normalization_FunctionName>(),
  327. interceptors: self.interceptors?.makeBidirectionalStreamingInterceptors() ?? [],
  328. observerFactory: self.BidirectionalStreaming(context:)
  329. )
  330. case "bidirectionalStreaming":
  331. return BidirectionalStreamingServerHandler(
  332. context: context,
  333. requestDeserializer: ProtobufDeserializer<SwiftProtobuf.Google_Protobuf_Empty>(),
  334. responseSerializer: ProtobufSerializer<Normalization_FunctionName>(),
  335. interceptors: self.interceptors?.makebidirectionalStreamingInterceptors() ?? [],
  336. observerFactory: self.bidirectionalStreaming(context:)
  337. )
  338. default:
  339. return nil
  340. }
  341. }
  342. }
  343. internal protocol Normalization_NormalizationServerInterceptorFactoryProtocol {
  344. /// - Returns: Interceptors to use when handling 'Unary'.
  345. /// Defaults to calling `self.makeInterceptors()`.
  346. func makeUnaryInterceptors() -> [ServerInterceptor<SwiftProtobuf.Google_Protobuf_Empty, Normalization_FunctionName>]
  347. /// - Returns: Interceptors to use when handling 'unary'.
  348. /// Defaults to calling `self.makeInterceptors()`.
  349. func makeunaryInterceptors() -> [ServerInterceptor<SwiftProtobuf.Google_Protobuf_Empty, Normalization_FunctionName>]
  350. /// - Returns: Interceptors to use when handling 'ServerStreaming'.
  351. /// Defaults to calling `self.makeInterceptors()`.
  352. func makeServerStreamingInterceptors() -> [ServerInterceptor<SwiftProtobuf.Google_Protobuf_Empty, Normalization_FunctionName>]
  353. /// - Returns: Interceptors to use when handling 'serverStreaming'.
  354. /// Defaults to calling `self.makeInterceptors()`.
  355. func makeserverStreamingInterceptors() -> [ServerInterceptor<SwiftProtobuf.Google_Protobuf_Empty, Normalization_FunctionName>]
  356. /// - Returns: Interceptors to use when handling 'ClientStreaming'.
  357. /// Defaults to calling `self.makeInterceptors()`.
  358. func makeClientStreamingInterceptors() -> [ServerInterceptor<SwiftProtobuf.Google_Protobuf_Empty, Normalization_FunctionName>]
  359. /// - Returns: Interceptors to use when handling 'clientStreaming'.
  360. /// Defaults to calling `self.makeInterceptors()`.
  361. func makeclientStreamingInterceptors() -> [ServerInterceptor<SwiftProtobuf.Google_Protobuf_Empty, Normalization_FunctionName>]
  362. /// - Returns: Interceptors to use when handling 'BidirectionalStreaming'.
  363. /// Defaults to calling `self.makeInterceptors()`.
  364. func makeBidirectionalStreamingInterceptors() -> [ServerInterceptor<SwiftProtobuf.Google_Protobuf_Empty, Normalization_FunctionName>]
  365. /// - Returns: Interceptors to use when handling 'bidirectionalStreaming'.
  366. /// Defaults to calling `self.makeInterceptors()`.
  367. func makebidirectionalStreamingInterceptors() -> [ServerInterceptor<SwiftProtobuf.Google_Protobuf_Empty, Normalization_FunctionName>]
  368. }