| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436 |
- //
- // Copyright 2024, gRPC Authors All rights reserved.
- //
- // Licensed under the Apache License, Version 2.0 (the "License");
- // you may not use this file except in compliance with the License.
- // You may obtain a copy of the License at
- //
- // http://www.apache.org/licenses/LICENSE-2.0
- //
- // Unless required by applicable law or agreed to in writing, software
- // distributed under the License is distributed on an "AS IS" BASIS,
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- // See the License for the specific language governing permissions and
- // limitations under the License.
- // DO NOT EDIT.
- // swift-format-ignore-file
- //
- // Generated by the gRPC Swift generator plugin for the protocol buffer compiler.
- // Source: control.proto
- //
- // For information on using the generated types, please see the documentation:
- // https://github.com/grpc/grpc-swift
- import GRPCCore
- import GRPCProtobuf
- internal enum Control {
- internal static let descriptor = ServiceDescriptor.Control
- internal enum Method {
- internal enum Unary {
- internal typealias Input = ControlInput
- internal typealias Output = ControlOutput
- internal static let descriptor = MethodDescriptor(
- service: Control.descriptor.fullyQualifiedService,
- method: "Unary"
- )
- }
- internal enum ServerStream {
- internal typealias Input = ControlInput
- internal typealias Output = ControlOutput
- internal static let descriptor = MethodDescriptor(
- service: Control.descriptor.fullyQualifiedService,
- method: "ServerStream"
- )
- }
- internal enum ClientStream {
- internal typealias Input = ControlInput
- internal typealias Output = ControlOutput
- internal static let descriptor = MethodDescriptor(
- service: Control.descriptor.fullyQualifiedService,
- method: "ClientStream"
- )
- }
- internal enum BidiStream {
- internal typealias Input = ControlInput
- internal typealias Output = ControlOutput
- internal static let descriptor = MethodDescriptor(
- service: Control.descriptor.fullyQualifiedService,
- method: "BidiStream"
- )
- }
- internal static let descriptors: [MethodDescriptor] = [
- Unary.descriptor,
- ServerStream.descriptor,
- ClientStream.descriptor,
- BidiStream.descriptor
- ]
- }
- @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
- internal typealias StreamingServiceProtocol = ControlStreamingServiceProtocol
- @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
- internal typealias ServiceProtocol = ControlServiceProtocol
- @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
- internal typealias ClientProtocol = ControlClientProtocol
- @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
- internal typealias Client = ControlClient
- }
- extension ServiceDescriptor {
- internal static let Control = Self(
- package: "",
- service: "Control"
- )
- }
- /// A controllable service for testing.
- ///
- /// The control service has one RPC of each kind, the input to each RPC controls
- /// the output.
- @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
- internal protocol ControlStreamingServiceProtocol: GRPCCore.RegistrableRPCService {
- func unary(request: ServerRequest.Stream<ControlInput>) async throws -> ServerResponse.Stream<ControlOutput>
-
- func serverStream(request: ServerRequest.Stream<ControlInput>) async throws -> ServerResponse.Stream<ControlOutput>
-
- func clientStream(request: ServerRequest.Stream<ControlInput>) async throws -> ServerResponse.Stream<ControlOutput>
-
- func bidiStream(request: ServerRequest.Stream<ControlInput>) async throws -> ServerResponse.Stream<ControlOutput>
- }
- /// Conformance to `GRPCCore.RegistrableRPCService`.
- @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
- extension Control.StreamingServiceProtocol {
- @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
- internal func registerMethods(with router: inout GRPCCore.RPCRouter) {
- router.registerHandler(
- forMethod: Control.Method.Unary.descriptor,
- deserializer: ProtobufDeserializer<ControlInput>(),
- serializer: ProtobufSerializer<ControlOutput>(),
- handler: { request in
- try await self.unary(request: request)
- }
- )
- router.registerHandler(
- forMethod: Control.Method.ServerStream.descriptor,
- deserializer: ProtobufDeserializer<ControlInput>(),
- serializer: ProtobufSerializer<ControlOutput>(),
- handler: { request in
- try await self.serverStream(request: request)
- }
- )
- router.registerHandler(
- forMethod: Control.Method.ClientStream.descriptor,
- deserializer: ProtobufDeserializer<ControlInput>(),
- serializer: ProtobufSerializer<ControlOutput>(),
- handler: { request in
- try await self.clientStream(request: request)
- }
- )
- router.registerHandler(
- forMethod: Control.Method.BidiStream.descriptor,
- deserializer: ProtobufDeserializer<ControlInput>(),
- serializer: ProtobufSerializer<ControlOutput>(),
- handler: { request in
- try await self.bidiStream(request: request)
- }
- )
- }
- }
- /// A controllable service for testing.
- ///
- /// The control service has one RPC of each kind, the input to each RPC controls
- /// the output.
- @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
- internal protocol ControlServiceProtocol: Control.StreamingServiceProtocol {
- func unary(request: ServerRequest.Single<ControlInput>) async throws -> ServerResponse.Single<ControlOutput>
-
- func serverStream(request: ServerRequest.Single<ControlInput>) async throws -> ServerResponse.Stream<ControlOutput>
-
- func clientStream(request: ServerRequest.Stream<ControlInput>) async throws -> ServerResponse.Single<ControlOutput>
-
- func bidiStream(request: ServerRequest.Stream<ControlInput>) async throws -> ServerResponse.Stream<ControlOutput>
- }
- /// Partial conformance to `ControlStreamingServiceProtocol`.
- @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
- extension Control.ServiceProtocol {
- internal func unary(request: ServerRequest.Stream<ControlInput>) async throws -> ServerResponse.Stream<ControlOutput> {
- let response = try await self.unary(request: ServerRequest.Single(stream: request))
- return ServerResponse.Stream(single: response)
- }
-
- internal func serverStream(request: ServerRequest.Stream<ControlInput>) async throws -> ServerResponse.Stream<ControlOutput> {
- let response = try await self.serverStream(request: ServerRequest.Single(stream: request))
- return response
- }
-
- internal func clientStream(request: ServerRequest.Stream<ControlInput>) async throws -> ServerResponse.Stream<ControlOutput> {
- let response = try await self.clientStream(request: request)
- return ServerResponse.Stream(single: response)
- }
- }
- /// A controllable service for testing.
- ///
- /// The control service has one RPC of each kind, the input to each RPC controls
- /// the output.
- @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
- internal protocol ControlClientProtocol: Sendable {
- func unary<R>(
- request: ClientRequest.Single<ControlInput>,
- serializer: some MessageSerializer<ControlInput>,
- deserializer: some MessageDeserializer<ControlOutput>,
- options: CallOptions,
- _ body: @Sendable @escaping (ClientResponse.Single<ControlOutput>) async throws -> R
- ) async throws -> R where R: Sendable
-
- func serverStream<R>(
- request: ClientRequest.Single<ControlInput>,
- serializer: some MessageSerializer<ControlInput>,
- deserializer: some MessageDeserializer<ControlOutput>,
- options: CallOptions,
- _ body: @Sendable @escaping (ClientResponse.Stream<ControlOutput>) async throws -> R
- ) async throws -> R where R: Sendable
-
- func clientStream<R>(
- request: ClientRequest.Stream<ControlInput>,
- serializer: some MessageSerializer<ControlInput>,
- deserializer: some MessageDeserializer<ControlOutput>,
- options: CallOptions,
- _ body: @Sendable @escaping (ClientResponse.Single<ControlOutput>) async throws -> R
- ) async throws -> R where R: Sendable
-
- func bidiStream<R>(
- request: ClientRequest.Stream<ControlInput>,
- serializer: some MessageSerializer<ControlInput>,
- deserializer: some MessageDeserializer<ControlOutput>,
- options: CallOptions,
- _ body: @Sendable @escaping (ClientResponse.Stream<ControlOutput>) async throws -> R
- ) async throws -> R where R: Sendable
- }
- @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
- extension Control.ClientProtocol {
- internal func unary<R>(
- request: ClientRequest.Single<ControlInput>,
- options: CallOptions = .defaults,
- _ body: @Sendable @escaping (ClientResponse.Single<ControlOutput>) async throws -> R = {
- try $0.message
- }
- ) async throws -> R where R: Sendable {
- try await self.unary(
- request: request,
- serializer: ProtobufSerializer<ControlInput>(),
- deserializer: ProtobufDeserializer<ControlOutput>(),
- options: options,
- body
- )
- }
-
- internal func serverStream<R>(
- request: ClientRequest.Single<ControlInput>,
- options: CallOptions = .defaults,
- _ body: @Sendable @escaping (ClientResponse.Stream<ControlOutput>) async throws -> R
- ) async throws -> R where R: Sendable {
- try await self.serverStream(
- request: request,
- serializer: ProtobufSerializer<ControlInput>(),
- deserializer: ProtobufDeserializer<ControlOutput>(),
- options: options,
- body
- )
- }
-
- internal func clientStream<R>(
- request: ClientRequest.Stream<ControlInput>,
- options: CallOptions = .defaults,
- _ body: @Sendable @escaping (ClientResponse.Single<ControlOutput>) async throws -> R = {
- try $0.message
- }
- ) async throws -> R where R: Sendable {
- try await self.clientStream(
- request: request,
- serializer: ProtobufSerializer<ControlInput>(),
- deserializer: ProtobufDeserializer<ControlOutput>(),
- options: options,
- body
- )
- }
-
- internal func bidiStream<R>(
- request: ClientRequest.Stream<ControlInput>,
- options: CallOptions = .defaults,
- _ body: @Sendable @escaping (ClientResponse.Stream<ControlOutput>) async throws -> R
- ) async throws -> R where R: Sendable {
- try await self.bidiStream(
- request: request,
- serializer: ProtobufSerializer<ControlInput>(),
- deserializer: ProtobufDeserializer<ControlOutput>(),
- options: options,
- body
- )
- }
- }
- @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
- extension Control.ClientProtocol {
- internal func unary<Result>(
- _ message: ControlInput,
- metadata: GRPCCore.Metadata = [:],
- options: GRPCCore.CallOptions = .defaults,
- onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse.Single<ControlOutput>) async throws -> Result = {
- try $0.message
- }
- ) async throws -> Result where Result: Sendable {
- let request = GRPCCore.ClientRequest.Single<ControlInput>(
- message: message,
- metadata: metadata
- )
- return try await self.unary(
- request: request,
- options: options,
- handleResponse
- )
- }
-
- internal func serverStream<Result>(
- _ message: ControlInput,
- metadata: GRPCCore.Metadata = [:],
- options: GRPCCore.CallOptions = .defaults,
- onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse.Stream<ControlOutput>) async throws -> Result
- ) async throws -> Result where Result: Sendable {
- let request = GRPCCore.ClientRequest.Single<ControlInput>(
- message: message,
- metadata: metadata
- )
- return try await self.serverStream(
- request: request,
- options: options,
- handleResponse
- )
- }
-
- internal func clientStream<Result>(
- metadata: GRPCCore.Metadata = [:],
- options: GRPCCore.CallOptions = .defaults,
- requestProducer: @Sendable @escaping (GRPCCore.RPCWriter<ControlInput>) async throws -> Void,
- onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse.Single<ControlOutput>) async throws -> Result = {
- try $0.message
- }
- ) async throws -> Result where Result: Sendable {
- let request = GRPCCore.ClientRequest.Stream<ControlInput>(
- metadata: metadata,
- producer: requestProducer
- )
- return try await self.clientStream(
- request: request,
- options: options,
- handleResponse
- )
- }
-
- internal func bidiStream<Result>(
- metadata: GRPCCore.Metadata = [:],
- options: GRPCCore.CallOptions = .defaults,
- requestProducer: @Sendable @escaping (GRPCCore.RPCWriter<ControlInput>) async throws -> Void,
- onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse.Stream<ControlOutput>) async throws -> Result
- ) async throws -> Result where Result: Sendable {
- let request = GRPCCore.ClientRequest.Stream<ControlInput>(
- metadata: metadata,
- producer: requestProducer
- )
- return try await self.bidiStream(
- request: request,
- options: options,
- handleResponse
- )
- }
- }
- /// A controllable service for testing.
- ///
- /// The control service has one RPC of each kind, the input to each RPC controls
- /// the output.
- @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
- internal struct ControlClient: Control.ClientProtocol {
- private let client: GRPCCore.GRPCClient
-
- internal init(wrapping client: GRPCCore.GRPCClient) {
- self.client = client
- }
-
- internal func unary<R>(
- request: ClientRequest.Single<ControlInput>,
- serializer: some MessageSerializer<ControlInput>,
- deserializer: some MessageDeserializer<ControlOutput>,
- options: CallOptions = .defaults,
- _ body: @Sendable @escaping (ClientResponse.Single<ControlOutput>) async throws -> R = {
- try $0.message
- }
- ) async throws -> R where R: Sendable {
- try await self.client.unary(
- request: request,
- descriptor: Control.Method.Unary.descriptor,
- serializer: serializer,
- deserializer: deserializer,
- options: options,
- handler: body
- )
- }
-
- internal func serverStream<R>(
- request: ClientRequest.Single<ControlInput>,
- serializer: some MessageSerializer<ControlInput>,
- deserializer: some MessageDeserializer<ControlOutput>,
- options: CallOptions = .defaults,
- _ body: @Sendable @escaping (ClientResponse.Stream<ControlOutput>) async throws -> R
- ) async throws -> R where R: Sendable {
- try await self.client.serverStreaming(
- request: request,
- descriptor: Control.Method.ServerStream.descriptor,
- serializer: serializer,
- deserializer: deserializer,
- options: options,
- handler: body
- )
- }
-
- internal func clientStream<R>(
- request: ClientRequest.Stream<ControlInput>,
- serializer: some MessageSerializer<ControlInput>,
- deserializer: some MessageDeserializer<ControlOutput>,
- options: CallOptions = .defaults,
- _ body: @Sendable @escaping (ClientResponse.Single<ControlOutput>) async throws -> R = {
- try $0.message
- }
- ) async throws -> R where R: Sendable {
- try await self.client.clientStreaming(
- request: request,
- descriptor: Control.Method.ClientStream.descriptor,
- serializer: serializer,
- deserializer: deserializer,
- options: options,
- handler: body
- )
- }
-
- internal func bidiStream<R>(
- request: ClientRequest.Stream<ControlInput>,
- serializer: some MessageSerializer<ControlInput>,
- deserializer: some MessageDeserializer<ControlOutput>,
- options: CallOptions = .defaults,
- _ body: @Sendable @escaping (ClientResponse.Stream<ControlOutput>) async throws -> R
- ) async throws -> R where R: Sendable {
- try await self.client.bidirectionalStreaming(
- request: request,
- descriptor: Control.Method.BidiStream.descriptor,
- serializer: serializer,
- deserializer: deserializer,
- options: options,
- handler: body
- )
- }
- }
|