// 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: route_guide.proto // // For information on using the generated types, please see the documentation: // https://github.com/grpc/grpc-swift import GRPCCore import GRPCProtobuf internal enum Routeguide_RouteGuide { internal static let descriptor = GRPCCore.ServiceDescriptor.routeguide_RouteGuide internal enum Method { internal enum GetFeature { internal typealias Input = Routeguide_Point internal typealias Output = Routeguide_Feature internal static let descriptor = GRPCCore.MethodDescriptor( service: Routeguide_RouteGuide.descriptor.fullyQualifiedService, method: "GetFeature" ) } internal enum ListFeatures { internal typealias Input = Routeguide_Rectangle internal typealias Output = Routeguide_Feature internal static let descriptor = GRPCCore.MethodDescriptor( service: Routeguide_RouteGuide.descriptor.fullyQualifiedService, method: "ListFeatures" ) } internal enum RecordRoute { internal typealias Input = Routeguide_Point internal typealias Output = Routeguide_RouteSummary internal static let descriptor = GRPCCore.MethodDescriptor( service: Routeguide_RouteGuide.descriptor.fullyQualifiedService, method: "RecordRoute" ) } internal enum RouteChat { internal typealias Input = Routeguide_RouteNote internal typealias Output = Routeguide_RouteNote internal static let descriptor = GRPCCore.MethodDescriptor( service: Routeguide_RouteGuide.descriptor.fullyQualifiedService, method: "RouteChat" ) } internal static let descriptors: [GRPCCore.MethodDescriptor] = [ GetFeature.descriptor, ListFeatures.descriptor, RecordRoute.descriptor, RouteChat.descriptor ] } @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) internal typealias StreamingServiceProtocol = Routeguide_RouteGuide_StreamingServiceProtocol @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) internal typealias ServiceProtocol = Routeguide_RouteGuide_ServiceProtocol @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) internal typealias ClientProtocol = Routeguide_RouteGuide_ClientProtocol @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) internal typealias Client = Routeguide_RouteGuide_Client } extension GRPCCore.ServiceDescriptor { internal static let routeguide_RouteGuide = Self( package: "routeguide", service: "RouteGuide" ) } /// Interface exported by the server. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) internal protocol Routeguide_RouteGuide_StreamingServiceProtocol: GRPCCore.RegistrableRPCService { /// A simple RPC. /// /// Obtains the feature at a given position. /// /// A feature with an empty name is returned if there's no feature at the given /// position. func getFeature( request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext ) async throws -> GRPCCore.StreamingServerResponse /// A server-to-client streaming RPC. /// /// Obtains the Features available within the given Rectangle. Results are /// streamed rather than returned at once (e.g. in a response message with a /// repeated field), as the rectangle may cover a large area and contain a /// huge number of features. func listFeatures( request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext ) async throws -> GRPCCore.StreamingServerResponse /// A client-to-server streaming RPC. /// /// Accepts a stream of Points on a route being traversed, returning a /// RouteSummary when traversal is completed. func recordRoute( request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext ) async throws -> GRPCCore.StreamingServerResponse /// A Bidirectional streaming RPC. /// /// Accepts a stream of RouteNotes sent while a route is being traversed, /// while receiving other RouteNotes (e.g. from other users). func routeChat( request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext ) async throws -> GRPCCore.StreamingServerResponse } /// Conformance to `GRPCCore.RegistrableRPCService`. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) extension Routeguide_RouteGuide.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: Routeguide_RouteGuide.Method.GetFeature.descriptor, deserializer: GRPCProtobuf.ProtobufDeserializer(), serializer: GRPCProtobuf.ProtobufSerializer(), handler: { request, context in try await self.getFeature( request: request, context: context ) } ) router.registerHandler( forMethod: Routeguide_RouteGuide.Method.ListFeatures.descriptor, deserializer: GRPCProtobuf.ProtobufDeserializer(), serializer: GRPCProtobuf.ProtobufSerializer(), handler: { request, context in try await self.listFeatures( request: request, context: context ) } ) router.registerHandler( forMethod: Routeguide_RouteGuide.Method.RecordRoute.descriptor, deserializer: GRPCProtobuf.ProtobufDeserializer(), serializer: GRPCProtobuf.ProtobufSerializer(), handler: { request, context in try await self.recordRoute( request: request, context: context ) } ) router.registerHandler( forMethod: Routeguide_RouteGuide.Method.RouteChat.descriptor, deserializer: GRPCProtobuf.ProtobufDeserializer(), serializer: GRPCProtobuf.ProtobufSerializer(), handler: { request, context in try await self.routeChat( request: request, context: context ) } ) } } /// Interface exported by the server. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) internal protocol Routeguide_RouteGuide_ServiceProtocol: Routeguide_RouteGuide.StreamingServiceProtocol { /// A simple RPC. /// /// Obtains the feature at a given position. /// /// A feature with an empty name is returned if there's no feature at the given /// position. func getFeature( request: GRPCCore.ServerRequest, context: GRPCCore.ServerContext ) async throws -> GRPCCore.ServerResponse /// A server-to-client streaming RPC. /// /// Obtains the Features available within the given Rectangle. Results are /// streamed rather than returned at once (e.g. in a response message with a /// repeated field), as the rectangle may cover a large area and contain a /// huge number of features. func listFeatures( request: GRPCCore.ServerRequest, context: GRPCCore.ServerContext ) async throws -> GRPCCore.StreamingServerResponse /// A client-to-server streaming RPC. /// /// Accepts a stream of Points on a route being traversed, returning a /// RouteSummary when traversal is completed. func recordRoute( request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext ) async throws -> GRPCCore.ServerResponse /// A Bidirectional streaming RPC. /// /// Accepts a stream of RouteNotes sent while a route is being traversed, /// while receiving other RouteNotes (e.g. from other users). func routeChat( request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext ) async throws -> GRPCCore.StreamingServerResponse } /// Partial conformance to `Routeguide_RouteGuide_StreamingServiceProtocol`. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) extension Routeguide_RouteGuide.ServiceProtocol { internal func getFeature( request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext ) async throws -> GRPCCore.StreamingServerResponse { let response = try await self.getFeature( request: GRPCCore.ServerRequest(stream: request), context: context ) return GRPCCore.StreamingServerResponse(single: response) } internal func listFeatures( request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext ) async throws -> GRPCCore.StreamingServerResponse { let response = try await self.listFeatures( request: GRPCCore.ServerRequest(stream: request), context: context ) return response } internal func recordRoute( request: GRPCCore.StreamingServerRequest, context: GRPCCore.ServerContext ) async throws -> GRPCCore.StreamingServerResponse { let response = try await self.recordRoute( request: request, context: context ) return GRPCCore.StreamingServerResponse(single: response) } } /// Interface exported by the server. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) internal protocol Routeguide_RouteGuide_ClientProtocol: Sendable { /// A simple RPC. /// /// Obtains the feature at a given position. /// /// A feature with an empty name is returned if there's no feature at the given /// position. func getFeature( request: GRPCCore.ClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions, _ body: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> R ) async throws -> R where R: Sendable /// A server-to-client streaming RPC. /// /// Obtains the Features available within the given Rectangle. Results are /// streamed rather than returned at once (e.g. in a response message with a /// repeated field), as the rectangle may cover a large area and contain a /// huge number of features. func listFeatures( request: GRPCCore.ClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions, _ body: @Sendable @escaping (GRPCCore.StreamingClientResponse) async throws -> R ) async throws -> R where R: Sendable /// A client-to-server streaming RPC. /// /// Accepts a stream of Points on a route being traversed, returning a /// RouteSummary when traversal is completed. func recordRoute( request: GRPCCore.StreamingClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions, _ body: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> R ) async throws -> R where R: Sendable /// A Bidirectional streaming RPC. /// /// Accepts a stream of RouteNotes sent while a route is being traversed, /// while receiving other RouteNotes (e.g. from other users). func routeChat( request: GRPCCore.StreamingClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions, _ body: @Sendable @escaping (GRPCCore.StreamingClientResponse) 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 Routeguide_RouteGuide.ClientProtocol { internal func getFeature( request: GRPCCore.ClientRequest, options: GRPCCore.CallOptions = .defaults, _ body: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> R = { try $0.message } ) async throws -> R where R: Sendable { try await self.getFeature( request: request, serializer: GRPCProtobuf.ProtobufSerializer(), deserializer: GRPCProtobuf.ProtobufDeserializer(), options: options, body ) } internal func listFeatures( request: GRPCCore.ClientRequest, options: GRPCCore.CallOptions = .defaults, _ body: @Sendable @escaping (GRPCCore.StreamingClientResponse) async throws -> R ) async throws -> R where R: Sendable { try await self.listFeatures( request: request, serializer: GRPCProtobuf.ProtobufSerializer(), deserializer: GRPCProtobuf.ProtobufDeserializer(), options: options, body ) } internal func recordRoute( request: GRPCCore.StreamingClientRequest, options: GRPCCore.CallOptions = .defaults, _ body: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> R = { try $0.message } ) async throws -> R where R: Sendable { try await self.recordRoute( request: request, serializer: GRPCProtobuf.ProtobufSerializer(), deserializer: GRPCProtobuf.ProtobufDeserializer(), options: options, body ) } internal func routeChat( request: GRPCCore.StreamingClientRequest, options: GRPCCore.CallOptions = .defaults, _ body: @Sendable @escaping (GRPCCore.StreamingClientResponse) async throws -> R ) async throws -> R where R: Sendable { try await self.routeChat( 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 Routeguide_RouteGuide.ClientProtocol { /// A simple RPC. /// /// Obtains the feature at a given position. /// /// A feature with an empty name is returned if there's no feature at the given /// position. internal func getFeature( _ message: Routeguide_Point, metadata: GRPCCore.Metadata = [:], options: GRPCCore.CallOptions = .defaults, onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> Result = { try $0.message } ) async throws -> Result where Result: Sendable { let request = GRPCCore.ClientRequest( message: message, metadata: metadata ) return try await self.getFeature( request: request, options: options, handleResponse ) } /// A server-to-client streaming RPC. /// /// Obtains the Features available within the given Rectangle. Results are /// streamed rather than returned at once (e.g. in a response message with a /// repeated field), as the rectangle may cover a large area and contain a /// huge number of features. internal func listFeatures( _ message: Routeguide_Rectangle, metadata: GRPCCore.Metadata = [:], options: GRPCCore.CallOptions = .defaults, onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse) async throws -> Result ) async throws -> Result where Result: Sendable { let request = GRPCCore.ClientRequest( message: message, metadata: metadata ) return try await self.listFeatures( request: request, options: options, handleResponse ) } /// A client-to-server streaming RPC. /// /// Accepts a stream of Points on a route being traversed, returning a /// RouteSummary when traversal is completed. internal func recordRoute( metadata: GRPCCore.Metadata = [:], options: GRPCCore.CallOptions = .defaults, requestProducer: @Sendable @escaping (GRPCCore.RPCWriter) async throws -> Void, onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> Result = { try $0.message } ) async throws -> Result where Result: Sendable { let request = GRPCCore.StreamingClientRequest( metadata: metadata, producer: requestProducer ) return try await self.recordRoute( request: request, options: options, handleResponse ) } /// A Bidirectional streaming RPC. /// /// Accepts a stream of RouteNotes sent while a route is being traversed, /// while receiving other RouteNotes (e.g. from other users). internal func routeChat( metadata: GRPCCore.Metadata = [:], options: GRPCCore.CallOptions = .defaults, requestProducer: @Sendable @escaping (GRPCCore.RPCWriter) async throws -> Void, onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse) async throws -> Result ) async throws -> Result where Result: Sendable { let request = GRPCCore.StreamingClientRequest( metadata: metadata, producer: requestProducer ) return try await self.routeChat( request: request, options: options, handleResponse ) } } /// Interface exported by the server. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) internal struct Routeguide_RouteGuide_Client: Routeguide_RouteGuide.ClientProtocol { private let client: GRPCCore.GRPCClient internal init(wrapping client: GRPCCore.GRPCClient) { self.client = client } /// A simple RPC. /// /// Obtains the feature at a given position. /// /// A feature with an empty name is returned if there's no feature at the given /// position. internal func getFeature( request: GRPCCore.ClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions = .defaults, _ body: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> R = { try $0.message } ) async throws -> R where R: Sendable { try await self.client.unary( request: request, descriptor: Routeguide_RouteGuide.Method.GetFeature.descriptor, serializer: serializer, deserializer: deserializer, options: options, handler: body ) } /// A server-to-client streaming RPC. /// /// Obtains the Features available within the given Rectangle. Results are /// streamed rather than returned at once (e.g. in a response message with a /// repeated field), as the rectangle may cover a large area and contain a /// huge number of features. internal func listFeatures( request: GRPCCore.ClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions = .defaults, _ body: @Sendable @escaping (GRPCCore.StreamingClientResponse) async throws -> R ) async throws -> R where R: Sendable { try await self.client.serverStreaming( request: request, descriptor: Routeguide_RouteGuide.Method.ListFeatures.descriptor, serializer: serializer, deserializer: deserializer, options: options, handler: body ) } /// A client-to-server streaming RPC. /// /// Accepts a stream of Points on a route being traversed, returning a /// RouteSummary when traversal is completed. internal func recordRoute( request: GRPCCore.StreamingClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions = .defaults, _ body: @Sendable @escaping (GRPCCore.ClientResponse) async throws -> R = { try $0.message } ) async throws -> R where R: Sendable { try await self.client.clientStreaming( request: request, descriptor: Routeguide_RouteGuide.Method.RecordRoute.descriptor, serializer: serializer, deserializer: deserializer, options: options, handler: body ) } /// A Bidirectional streaming RPC. /// /// Accepts a stream of RouteNotes sent while a route is being traversed, /// while receiving other RouteNotes (e.g. from other users). internal func routeChat( request: GRPCCore.StreamingClientRequest, serializer: some GRPCCore.MessageSerializer, deserializer: some GRPCCore.MessageDeserializer, options: GRPCCore.CallOptions = .defaults, _ body: @Sendable @escaping (GRPCCore.StreamingClientResponse) async throws -> R ) async throws -> R where R: Sendable { try await self.client.bidirectionalStreaming( request: request, descriptor: Routeguide_RouteGuide.Method.RouteChat.descriptor, serializer: serializer, deserializer: deserializer, options: options, handler: body ) } }