| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 |
- /// 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<Helloworld_HelloRequest>,
- context: GRPCCore.ServerContext
- ) async throws -> GRPCCore.ServerResponse.Stream<Helloworld_HelloReply>
- }
- /// 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<Helloworld_HelloRequest>(),
- serializer: GRPCProtobuf.ProtobufSerializer<Helloworld_HelloReply>(),
- 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<Helloworld_HelloRequest>,
- context: GRPCCore.ServerContext
- ) async throws -> GRPCCore.ServerResponse.Single<Helloworld_HelloReply>
- }
- /// 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<Helloworld_HelloRequest>,
- context: GRPCCore.ServerContext
- ) async throws -> GRPCCore.ServerResponse.Stream<Helloworld_HelloReply> {
- 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<R>(
- request: GRPCCore.ClientRequest.Single<Helloworld_HelloRequest>,
- serializer: some GRPCCore.MessageSerializer<Helloworld_HelloRequest>,
- deserializer: some GRPCCore.MessageDeserializer<Helloworld_HelloReply>,
- options: GRPCCore.CallOptions,
- _ body: @Sendable @escaping (GRPCCore.ClientResponse.Single<Helloworld_HelloReply>) 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<R>(
- request: GRPCCore.ClientRequest.Single<Helloworld_HelloRequest>,
- options: GRPCCore.CallOptions = .defaults,
- _ body: @Sendable @escaping (GRPCCore.ClientResponse.Single<Helloworld_HelloReply>) async throws -> R = {
- try $0.message
- }
- ) async throws -> R where R: Sendable {
- try await self.sayHello(
- request: request,
- serializer: GRPCProtobuf.ProtobufSerializer<Helloworld_HelloRequest>(),
- deserializer: GRPCProtobuf.ProtobufDeserializer<Helloworld_HelloReply>(),
- 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<Result>(
- _ message: Helloworld_HelloRequest,
- metadata: GRPCCore.Metadata = [:],
- options: GRPCCore.CallOptions = .defaults,
- onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse.Single<Helloworld_HelloReply>) async throws -> Result = {
- try $0.message
- }
- ) async throws -> Result where Result: Sendable {
- let request = GRPCCore.ClientRequest.Single<Helloworld_HelloRequest>(
- 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<R>(
- request: GRPCCore.ClientRequest.Single<Helloworld_HelloRequest>,
- serializer: some GRPCCore.MessageSerializer<Helloworld_HelloRequest>,
- deserializer: some GRPCCore.MessageDeserializer<Helloworld_HelloReply>,
- options: GRPCCore.CallOptions = .defaults,
- _ body: @Sendable @escaping (GRPCCore.ClientResponse.Single<Helloworld_HelloReply>) 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
- )
- }
- }
|