/// Copyright 2015 gRPC authors. /// /// 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: helloworld.proto // // For information on using the generated types, please see the documentation: // https://github.com/grpc/grpc-swift import GRPCCore import GRPCProtobuf internal enum Helloworld_Greeter { internal static let descriptor = GRPCCore.ServiceDescriptor.helloworld_Greeter internal enum Method { internal enum SayHello { internal typealias Input = Helloworld_HelloRequest internal typealias Output = Helloworld_HelloReply internal static let descriptor = GRPCCore.MethodDescriptor( service: Helloworld_Greeter.descriptor.fullyQualifiedService, method: "SayHello" ) } internal static let descriptors: [GRPCCore.MethodDescriptor] = [ SayHello.descriptor ] } @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) internal typealias StreamingServiceProtocol = Helloworld_GreeterStreamingServiceProtocol @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) internal typealias ServiceProtocol = Helloworld_GreeterServiceProtocol @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) internal typealias ClientProtocol = Helloworld_GreeterClientProtocol @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) internal typealias Client = Helloworld_GreeterClient } extension GRPCCore.ServiceDescriptor { internal static let helloworld_Greeter = Self( package: "helloworld", service: "Greeter" ) } /// The greeting service definition. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) internal protocol Helloworld_GreeterStreamingServiceProtocol: GRPCCore.RegistrableRPCService { /// Sends a greeting func sayHello( request: GRPCCore.ServerRequest.Stream, context: GRPCCore.ServerContext ) async throws -> GRPCCore.ServerResponse.Stream } /// Conformance to `GRPCCore.RegistrableRPCService`. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) extension Helloworld_Greeter.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: Helloworld_Greeter.Method.SayHello.descriptor, deserializer: GRPCProtobuf.ProtobufDeserializer(), serializer: GRPCProtobuf.ProtobufSerializer(), handler: { request, context in try await self.sayHello( request: request, context: context ) } ) } } /// The greeting service definition. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) internal protocol Helloworld_GreeterServiceProtocol: Helloworld_Greeter.StreamingServiceProtocol { /// Sends a greeting func sayHello( request: GRPCCore.ServerRequest.Single, context: GRPCCore.ServerContext ) async throws -> GRPCCore.ServerResponse.Single } /// Partial conformance to `Helloworld_GreeterStreamingServiceProtocol`. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) extension Helloworld_Greeter.ServiceProtocol { internal func sayHello( request: GRPCCore.ServerRequest.Stream, context: GRPCCore.ServerContext ) async throws -> GRPCCore.ServerResponse.Stream { let response = try await self.sayHello( request: GRPCCore.ServerRequest.Single(stream: request), context: context ) return GRPCCore.ServerResponse.Stream(single: response) } } /// The greeting service definition. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) internal protocol Helloworld_GreeterClientProtocol: Sendable { /// Sends a greeting func sayHello( request: GRPCCore.ClientRequest.Single, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions, _ body: @Sendable @escaping (GRPCCore.ClientResponse.Single) 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 Helloworld_Greeter.ClientProtocol { internal func sayHello( request: GRPCCore.ClientRequest.Single, options: GRPCCore.CallOptions = .defaults, _ body: @Sendable @escaping (GRPCCore.ClientResponse.Single) async throws -> R = { try $0.message } ) async throws -> R where R: Sendable { try await self.sayHello( request: request, serializer: GRPCProtobuf.ProtobufSerializer(), deserializer: GRPCProtobuf.ProtobufDeserializer(), options: options, body ) } } @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) extension Helloworld_Greeter.ClientProtocol { /// Sends a greeting internal func sayHello( _ message: Helloworld_HelloRequest, metadata: GRPCCore.Metadata = [:], options: GRPCCore.CallOptions = .defaults, onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse.Single) async throws -> Result = { try $0.message } ) async throws -> Result where Result: Sendable { let request = GRPCCore.ClientRequest.Single( message: message, metadata: metadata ) return try await self.sayHello( request: request, options: options, handleResponse ) } } /// The greeting service definition. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) internal struct Helloworld_GreeterClient: Helloworld_Greeter.ClientProtocol { private let client: GRPCCore.GRPCClient internal init(wrapping client: GRPCCore.GRPCClient) { self.client = client } /// Sends a greeting internal func sayHello( request: GRPCCore.ClientRequest.Single, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions = .defaults, _ body: @Sendable @escaping (GRPCCore.ClientResponse.Single) async throws -> R = { try $0.message } ) async throws -> R where R: Sendable { try await self.client.unary( request: request, descriptor: Helloworld_Greeter.Method.SayHello.descriptor, serializer: serializer, deserializer: deserializer, options: options, handler: body ) } }