reflection.grpc.swift 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. //
  2. // DO NOT EDIT.
  3. // swift-format-ignore-file
  4. //
  5. // Generated by the protocol buffer compiler.
  6. // Source: reflection.proto
  7. //
  8. import GRPC
  9. import NIO
  10. import NIOConcurrencyHelpers
  11. import SwiftProtobuf
  12. /// Usage: instantiate `Reflection_ServerReflectionClient`, then call methods of this protocol to make API calls.
  13. internal protocol Reflection_ServerReflectionClientProtocol: GRPCClient {
  14. var serviceName: String { get }
  15. var interceptors: Reflection_ServerReflectionClientInterceptorFactoryProtocol? { get }
  16. func serverReflectionInfo(
  17. callOptions: CallOptions?,
  18. handler: @escaping (Reflection_ServerReflectionResponse) -> Void
  19. ) -> BidirectionalStreamingCall<Reflection_ServerReflectionRequest, Reflection_ServerReflectionResponse>
  20. }
  21. extension Reflection_ServerReflectionClientProtocol {
  22. internal var serviceName: String {
  23. return "reflection.ServerReflection"
  24. }
  25. /// The reflection service is structured as a bidirectional stream, ensuring
  26. /// all related requests go to a single server.
  27. ///
  28. /// Callers should use the `send` method on the returned object to send messages
  29. /// to the server. The caller should send an `.end` after the final message has been sent.
  30. ///
  31. /// - Parameters:
  32. /// - callOptions: Call options.
  33. /// - handler: A closure called when each response is received from the server.
  34. /// - Returns: A `ClientStreamingCall` with futures for the metadata and status.
  35. internal func serverReflectionInfo(
  36. callOptions: CallOptions? = nil,
  37. handler: @escaping (Reflection_ServerReflectionResponse) -> Void
  38. ) -> BidirectionalStreamingCall<Reflection_ServerReflectionRequest, Reflection_ServerReflectionResponse> {
  39. return self.makeBidirectionalStreamingCall(
  40. path: Reflection_ServerReflectionClientMetadata.Methods.serverReflectionInfo.path,
  41. callOptions: callOptions ?? self.defaultCallOptions,
  42. interceptors: self.interceptors?.makeServerReflectionInfoInterceptors() ?? [],
  43. handler: handler
  44. )
  45. }
  46. }
  47. @available(*, deprecated)
  48. extension Reflection_ServerReflectionClient: @unchecked Sendable {}
  49. @available(*, deprecated, renamed: "Reflection_ServerReflectionNIOClient")
  50. internal final class Reflection_ServerReflectionClient: Reflection_ServerReflectionClientProtocol {
  51. private let lock = Lock()
  52. private var _defaultCallOptions: CallOptions
  53. private var _interceptors: Reflection_ServerReflectionClientInterceptorFactoryProtocol?
  54. internal let channel: GRPCChannel
  55. internal var defaultCallOptions: CallOptions {
  56. get { self.lock.withLock { return self._defaultCallOptions } }
  57. set { self.lock.withLockVoid { self._defaultCallOptions = newValue } }
  58. }
  59. internal var interceptors: Reflection_ServerReflectionClientInterceptorFactoryProtocol? {
  60. get { self.lock.withLock { return self._interceptors } }
  61. set { self.lock.withLockVoid { self._interceptors = newValue } }
  62. }
  63. /// Creates a client for the reflection.ServerReflection service.
  64. ///
  65. /// - Parameters:
  66. /// - channel: `GRPCChannel` to the service host.
  67. /// - defaultCallOptions: Options to use for each service call if the user doesn't provide them.
  68. /// - interceptors: A factory providing interceptors for each RPC.
  69. internal init(
  70. channel: GRPCChannel,
  71. defaultCallOptions: CallOptions = CallOptions(),
  72. interceptors: Reflection_ServerReflectionClientInterceptorFactoryProtocol? = nil
  73. ) {
  74. self.channel = channel
  75. self._defaultCallOptions = defaultCallOptions
  76. self._interceptors = interceptors
  77. }
  78. }
  79. internal struct Reflection_ServerReflectionNIOClient: Reflection_ServerReflectionClientProtocol {
  80. internal var channel: GRPCChannel
  81. internal var defaultCallOptions: CallOptions
  82. internal var interceptors: Reflection_ServerReflectionClientInterceptorFactoryProtocol?
  83. /// Creates a client for the reflection.ServerReflection service.
  84. ///
  85. /// - Parameters:
  86. /// - channel: `GRPCChannel` to the service host.
  87. /// - defaultCallOptions: Options to use for each service call if the user doesn't provide them.
  88. /// - interceptors: A factory providing interceptors for each RPC.
  89. internal init(
  90. channel: GRPCChannel,
  91. defaultCallOptions: CallOptions = CallOptions(),
  92. interceptors: Reflection_ServerReflectionClientInterceptorFactoryProtocol? = nil
  93. ) {
  94. self.channel = channel
  95. self.defaultCallOptions = defaultCallOptions
  96. self.interceptors = interceptors
  97. }
  98. }
  99. @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
  100. internal protocol Reflection_ServerReflectionAsyncClientProtocol: GRPCClient {
  101. static var serviceDescriptor: GRPCServiceDescriptor { get }
  102. var interceptors: Reflection_ServerReflectionClientInterceptorFactoryProtocol? { get }
  103. func makeServerReflectionInfoCall(
  104. callOptions: CallOptions?
  105. ) -> GRPCAsyncBidirectionalStreamingCall<Reflection_ServerReflectionRequest, Reflection_ServerReflectionResponse>
  106. }
  107. @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
  108. extension Reflection_ServerReflectionAsyncClientProtocol {
  109. internal static var serviceDescriptor: GRPCServiceDescriptor {
  110. return Reflection_ServerReflectionClientMetadata.serviceDescriptor
  111. }
  112. internal var interceptors: Reflection_ServerReflectionClientInterceptorFactoryProtocol? {
  113. return nil
  114. }
  115. internal func makeServerReflectionInfoCall(
  116. callOptions: CallOptions? = nil
  117. ) -> GRPCAsyncBidirectionalStreamingCall<Reflection_ServerReflectionRequest, Reflection_ServerReflectionResponse> {
  118. return self.makeAsyncBidirectionalStreamingCall(
  119. path: Reflection_ServerReflectionClientMetadata.Methods.serverReflectionInfo.path,
  120. callOptions: callOptions ?? self.defaultCallOptions,
  121. interceptors: self.interceptors?.makeServerReflectionInfoInterceptors() ?? []
  122. )
  123. }
  124. }
  125. @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
  126. extension Reflection_ServerReflectionAsyncClientProtocol {
  127. internal func serverReflectionInfo<RequestStream>(
  128. _ requests: RequestStream,
  129. callOptions: CallOptions? = nil
  130. ) -> GRPCAsyncResponseStream<Reflection_ServerReflectionResponse> where RequestStream: Sequence, RequestStream.Element == Reflection_ServerReflectionRequest {
  131. return self.performAsyncBidirectionalStreamingCall(
  132. path: Reflection_ServerReflectionClientMetadata.Methods.serverReflectionInfo.path,
  133. requests: requests,
  134. callOptions: callOptions ?? self.defaultCallOptions,
  135. interceptors: self.interceptors?.makeServerReflectionInfoInterceptors() ?? []
  136. )
  137. }
  138. internal func serverReflectionInfo<RequestStream>(
  139. _ requests: RequestStream,
  140. callOptions: CallOptions? = nil
  141. ) -> GRPCAsyncResponseStream<Reflection_ServerReflectionResponse> where RequestStream: AsyncSequence & Sendable, RequestStream.Element == Reflection_ServerReflectionRequest {
  142. return self.performAsyncBidirectionalStreamingCall(
  143. path: Reflection_ServerReflectionClientMetadata.Methods.serverReflectionInfo.path,
  144. requests: requests,
  145. callOptions: callOptions ?? self.defaultCallOptions,
  146. interceptors: self.interceptors?.makeServerReflectionInfoInterceptors() ?? []
  147. )
  148. }
  149. }
  150. @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
  151. internal struct Reflection_ServerReflectionAsyncClient: Reflection_ServerReflectionAsyncClientProtocol {
  152. internal var channel: GRPCChannel
  153. internal var defaultCallOptions: CallOptions
  154. internal var interceptors: Reflection_ServerReflectionClientInterceptorFactoryProtocol?
  155. internal init(
  156. channel: GRPCChannel,
  157. defaultCallOptions: CallOptions = CallOptions(),
  158. interceptors: Reflection_ServerReflectionClientInterceptorFactoryProtocol? = nil
  159. ) {
  160. self.channel = channel
  161. self.defaultCallOptions = defaultCallOptions
  162. self.interceptors = interceptors
  163. }
  164. }
  165. internal protocol Reflection_ServerReflectionClientInterceptorFactoryProtocol: Sendable {
  166. /// - Returns: Interceptors to use when invoking 'serverReflectionInfo'.
  167. func makeServerReflectionInfoInterceptors() -> [ClientInterceptor<Reflection_ServerReflectionRequest, Reflection_ServerReflectionResponse>]
  168. }
  169. internal enum Reflection_ServerReflectionClientMetadata {
  170. internal static let serviceDescriptor = GRPCServiceDescriptor(
  171. name: "ServerReflection",
  172. fullName: "reflection.ServerReflection",
  173. methods: [
  174. Reflection_ServerReflectionClientMetadata.Methods.serverReflectionInfo,
  175. ]
  176. )
  177. internal enum Methods {
  178. internal static let serverReflectionInfo = GRPCMethodDescriptor(
  179. name: "ServerReflectionInfo",
  180. path: "/reflection.ServerReflection/ServerReflectionInfo",
  181. type: GRPCCallType.bidirectionalStreaming
  182. )
  183. }
  184. }