| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126 |
- // 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
- // MARK: - routeguide.RouteGuide
- /// Namespace containing generated types for the "routeguide.RouteGuide" service.
- internal enum Routeguide_RouteGuide {
- /// Service descriptor for the "routeguide.RouteGuide" service.
- internal static let descriptor = GRPCCore.ServiceDescriptor(fullyQualifiedService: "routeguide.RouteGuide")
- /// Namespace for method metadata.
- internal enum Method {
- /// Namespace for "GetFeature" metadata.
- internal enum GetFeature {
- /// Request type for "GetFeature".
- internal typealias Input = Routeguide_Point
- /// Response type for "GetFeature".
- internal typealias Output = Routeguide_Feature
- /// Descriptor for "GetFeature".
- internal static let descriptor = GRPCCore.MethodDescriptor(
- service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "routeguide.RouteGuide"),
- method: "GetFeature"
- )
- }
- /// Namespace for "ListFeatures" metadata.
- internal enum ListFeatures {
- /// Request type for "ListFeatures".
- internal typealias Input = Routeguide_Rectangle
- /// Response type for "ListFeatures".
- internal typealias Output = Routeguide_Feature
- /// Descriptor for "ListFeatures".
- internal static let descriptor = GRPCCore.MethodDescriptor(
- service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "routeguide.RouteGuide"),
- method: "ListFeatures"
- )
- }
- /// Namespace for "RecordRoute" metadata.
- internal enum RecordRoute {
- /// Request type for "RecordRoute".
- internal typealias Input = Routeguide_Point
- /// Response type for "RecordRoute".
- internal typealias Output = Routeguide_RouteSummary
- /// Descriptor for "RecordRoute".
- internal static let descriptor = GRPCCore.MethodDescriptor(
- service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "routeguide.RouteGuide"),
- method: "RecordRoute"
- )
- }
- /// Namespace for "RouteChat" metadata.
- internal enum RouteChat {
- /// Request type for "RouteChat".
- internal typealias Input = Routeguide_RouteNote
- /// Response type for "RouteChat".
- internal typealias Output = Routeguide_RouteNote
- /// Descriptor for "RouteChat".
- internal static let descriptor = GRPCCore.MethodDescriptor(
- service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "routeguide.RouteGuide"),
- method: "RouteChat"
- )
- }
- /// Descriptors for all methods in the "routeguide.RouteGuide" service.
- internal static let descriptors: [GRPCCore.MethodDescriptor] = [
- GetFeature.descriptor,
- ListFeatures.descriptor,
- RecordRoute.descriptor,
- RouteChat.descriptor
- ]
- }
- }
- extension GRPCCore.ServiceDescriptor {
- /// Service descriptor for the "routeguide.RouteGuide" service.
- internal static let routeguide_RouteGuide = GRPCCore.ServiceDescriptor(fullyQualifiedService: "routeguide.RouteGuide")
- }
- // MARK: routeguide.RouteGuide (server)
- extension Routeguide_RouteGuide {
- /// Streaming variant of the service protocol for the "routeguide.RouteGuide" service.
- ///
- /// This protocol is the lowest-level of the service protocols generated for this service
- /// giving you the most flexibility over the implementation of your service. This comes at
- /// the cost of more verbose and less strict APIs. Each RPC requires you to implement it in
- /// terms of a request stream and response stream. Where only a single request or response
- /// message is expected, you are responsible for enforcing this invariant is maintained.
- ///
- /// Where possible, prefer using the stricter, less-verbose ``ServiceProtocol``
- /// or ``SimpleServiceProtocol`` instead.
- ///
- /// > Source IDL Documentation:
- /// >
- /// > Interface exported by the server.
- internal protocol StreamingServiceProtocol: GRPCCore.RegistrableRPCService {
- /// Handle the "GetFeature" method.
- ///
- /// > Source IDL Documentation:
- /// >
- /// > 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.
- ///
- /// - Parameters:
- /// - request: A streaming request of `Routeguide_Point` messages.
- /// - context: Context providing information about the RPC.
- /// - Throws: Any error which occurred during the processing of the request. Thrown errors
- /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
- /// to an internal error.
- /// - Returns: A streaming response of `Routeguide_Feature` messages.
- func getFeature(
- request: GRPCCore.StreamingServerRequest<Routeguide_Point>,
- context: GRPCCore.ServerContext
- ) async throws -> GRPCCore.StreamingServerResponse<Routeguide_Feature>
- /// Handle the "ListFeatures" method.
- ///
- /// > Source IDL Documentation:
- /// >
- /// > 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.
- ///
- /// - Parameters:
- /// - request: A streaming request of `Routeguide_Rectangle` messages.
- /// - context: Context providing information about the RPC.
- /// - Throws: Any error which occurred during the processing of the request. Thrown errors
- /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
- /// to an internal error.
- /// - Returns: A streaming response of `Routeguide_Feature` messages.
- func listFeatures(
- request: GRPCCore.StreamingServerRequest<Routeguide_Rectangle>,
- context: GRPCCore.ServerContext
- ) async throws -> GRPCCore.StreamingServerResponse<Routeguide_Feature>
- /// Handle the "RecordRoute" method.
- ///
- /// > Source IDL Documentation:
- /// >
- /// > A client-to-server streaming RPC.
- /// >
- /// > Accepts a stream of Points on a route being traversed, returning a
- /// > RouteSummary when traversal is completed.
- ///
- /// - Parameters:
- /// - request: A streaming request of `Routeguide_Point` messages.
- /// - context: Context providing information about the RPC.
- /// - Throws: Any error which occurred during the processing of the request. Thrown errors
- /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
- /// to an internal error.
- /// - Returns: A streaming response of `Routeguide_RouteSummary` messages.
- func recordRoute(
- request: GRPCCore.StreamingServerRequest<Routeguide_Point>,
- context: GRPCCore.ServerContext
- ) async throws -> GRPCCore.StreamingServerResponse<Routeguide_RouteSummary>
- /// Handle the "RouteChat" method.
- ///
- /// > Source IDL Documentation:
- /// >
- /// > 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).
- ///
- /// - Parameters:
- /// - request: A streaming request of `Routeguide_RouteNote` messages.
- /// - context: Context providing information about the RPC.
- /// - Throws: Any error which occurred during the processing of the request. Thrown errors
- /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
- /// to an internal error.
- /// - Returns: A streaming response of `Routeguide_RouteNote` messages.
- func routeChat(
- request: GRPCCore.StreamingServerRequest<Routeguide_RouteNote>,
- context: GRPCCore.ServerContext
- ) async throws -> GRPCCore.StreamingServerResponse<Routeguide_RouteNote>
- }
- /// Service protocol for the "routeguide.RouteGuide" service.
- ///
- /// This protocol is higher level than ``StreamingServiceProtocol`` but lower level than
- /// the ``SimpleServiceProtocol``, it provides access to request and response metadata and
- /// trailing response metadata. If you don't need these then consider using
- /// the ``SimpleServiceProtocol``. If you need fine grained control over your RPCs then
- /// use ``StreamingServiceProtocol``.
- ///
- /// > Source IDL Documentation:
- /// >
- /// > Interface exported by the server.
- internal protocol ServiceProtocol: Routeguide_RouteGuide.StreamingServiceProtocol {
- /// Handle the "GetFeature" method.
- ///
- /// > Source IDL Documentation:
- /// >
- /// > 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.
- ///
- /// - Parameters:
- /// - request: A request containing a single `Routeguide_Point` message.
- /// - context: Context providing information about the RPC.
- /// - Throws: Any error which occurred during the processing of the request. Thrown errors
- /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
- /// to an internal error.
- /// - Returns: A response containing a single `Routeguide_Feature` message.
- func getFeature(
- request: GRPCCore.ServerRequest<Routeguide_Point>,
- context: GRPCCore.ServerContext
- ) async throws -> GRPCCore.ServerResponse<Routeguide_Feature>
- /// Handle the "ListFeatures" method.
- ///
- /// > Source IDL Documentation:
- /// >
- /// > 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.
- ///
- /// - Parameters:
- /// - request: A request containing a single `Routeguide_Rectangle` message.
- /// - context: Context providing information about the RPC.
- /// - Throws: Any error which occurred during the processing of the request. Thrown errors
- /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
- /// to an internal error.
- /// - Returns: A streaming response of `Routeguide_Feature` messages.
- func listFeatures(
- request: GRPCCore.ServerRequest<Routeguide_Rectangle>,
- context: GRPCCore.ServerContext
- ) async throws -> GRPCCore.StreamingServerResponse<Routeguide_Feature>
- /// Handle the "RecordRoute" method.
- ///
- /// > Source IDL Documentation:
- /// >
- /// > A client-to-server streaming RPC.
- /// >
- /// > Accepts a stream of Points on a route being traversed, returning a
- /// > RouteSummary when traversal is completed.
- ///
- /// - Parameters:
- /// - request: A streaming request of `Routeguide_Point` messages.
- /// - context: Context providing information about the RPC.
- /// - Throws: Any error which occurred during the processing of the request. Thrown errors
- /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
- /// to an internal error.
- /// - Returns: A response containing a single `Routeguide_RouteSummary` message.
- func recordRoute(
- request: GRPCCore.StreamingServerRequest<Routeguide_Point>,
- context: GRPCCore.ServerContext
- ) async throws -> GRPCCore.ServerResponse<Routeguide_RouteSummary>
- /// Handle the "RouteChat" method.
- ///
- /// > Source IDL Documentation:
- /// >
- /// > 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).
- ///
- /// - Parameters:
- /// - request: A streaming request of `Routeguide_RouteNote` messages.
- /// - context: Context providing information about the RPC.
- /// - Throws: Any error which occurred during the processing of the request. Thrown errors
- /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
- /// to an internal error.
- /// - Returns: A streaming response of `Routeguide_RouteNote` messages.
- func routeChat(
- request: GRPCCore.StreamingServerRequest<Routeguide_RouteNote>,
- context: GRPCCore.ServerContext
- ) async throws -> GRPCCore.StreamingServerResponse<Routeguide_RouteNote>
- }
- /// Simple service protocol for the "routeguide.RouteGuide" service.
- ///
- /// This is the highest level protocol for the service. The API is the easiest to use but
- /// doesn't provide access to request or response metadata. If you need access to these
- /// then use ``ServiceProtocol`` instead.
- ///
- /// > Source IDL Documentation:
- /// >
- /// > Interface exported by the server.
- internal protocol SimpleServiceProtocol: Routeguide_RouteGuide.ServiceProtocol {
- /// Handle the "GetFeature" method.
- ///
- /// > Source IDL Documentation:
- /// >
- /// > 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.
- ///
- /// - Parameters:
- /// - request: A `Routeguide_Point` message.
- /// - context: Context providing information about the RPC.
- /// - Throws: Any error which occurred during the processing of the request. Thrown errors
- /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
- /// to an internal error.
- /// - Returns: A `Routeguide_Feature` to respond with.
- func getFeature(
- request: Routeguide_Point,
- context: GRPCCore.ServerContext
- ) async throws -> Routeguide_Feature
- /// Handle the "ListFeatures" method.
- ///
- /// > Source IDL Documentation:
- /// >
- /// > 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.
- ///
- /// - Parameters:
- /// - request: A `Routeguide_Rectangle` message.
- /// - response: A response stream of `Routeguide_Feature` messages.
- /// - context: Context providing information about the RPC.
- /// - Throws: Any error which occurred during the processing of the request. Thrown errors
- /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
- /// to an internal error.
- func listFeatures(
- request: Routeguide_Rectangle,
- response: GRPCCore.RPCWriter<Routeguide_Feature>,
- context: GRPCCore.ServerContext
- ) async throws
- /// Handle the "RecordRoute" method.
- ///
- /// > Source IDL Documentation:
- /// >
- /// > A client-to-server streaming RPC.
- /// >
- /// > Accepts a stream of Points on a route being traversed, returning a
- /// > RouteSummary when traversal is completed.
- ///
- /// - Parameters:
- /// - request: A stream of `Routeguide_Point` messages.
- /// - context: Context providing information about the RPC.
- /// - Throws: Any error which occurred during the processing of the request. Thrown errors
- /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
- /// to an internal error.
- /// - Returns: A `Routeguide_RouteSummary` to respond with.
- func recordRoute(
- request: GRPCCore.RPCAsyncSequence<Routeguide_Point, any Swift.Error>,
- context: GRPCCore.ServerContext
- ) async throws -> Routeguide_RouteSummary
- /// Handle the "RouteChat" method.
- ///
- /// > Source IDL Documentation:
- /// >
- /// > 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).
- ///
- /// - Parameters:
- /// - request: A stream of `Routeguide_RouteNote` messages.
- /// - response: A response stream of `Routeguide_RouteNote` messages.
- /// - context: Context providing information about the RPC.
- /// - Throws: Any error which occurred during the processing of the request. Thrown errors
- /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
- /// to an internal error.
- func routeChat(
- request: GRPCCore.RPCAsyncSequence<Routeguide_RouteNote, any Swift.Error>,
- response: GRPCCore.RPCWriter<Routeguide_RouteNote>,
- context: GRPCCore.ServerContext
- ) async throws
- }
- }
- // Default implementation of 'registerMethods(with:)'.
- extension Routeguide_RouteGuide.StreamingServiceProtocol {
- internal func registerMethods<Transport>(with router: inout GRPCCore.RPCRouter<Transport>) where Transport: GRPCCore.ServerTransport {
- router.registerHandler(
- forMethod: Routeguide_RouteGuide.Method.GetFeature.descriptor,
- deserializer: GRPCProtobuf.ProtobufDeserializer<Routeguide_Point>(),
- serializer: GRPCProtobuf.ProtobufSerializer<Routeguide_Feature>(),
- handler: { request, context in
- try await self.getFeature(
- request: request,
- context: context
- )
- }
- )
- router.registerHandler(
- forMethod: Routeguide_RouteGuide.Method.ListFeatures.descriptor,
- deserializer: GRPCProtobuf.ProtobufDeserializer<Routeguide_Rectangle>(),
- serializer: GRPCProtobuf.ProtobufSerializer<Routeguide_Feature>(),
- handler: { request, context in
- try await self.listFeatures(
- request: request,
- context: context
- )
- }
- )
- router.registerHandler(
- forMethod: Routeguide_RouteGuide.Method.RecordRoute.descriptor,
- deserializer: GRPCProtobuf.ProtobufDeserializer<Routeguide_Point>(),
- serializer: GRPCProtobuf.ProtobufSerializer<Routeguide_RouteSummary>(),
- handler: { request, context in
- try await self.recordRoute(
- request: request,
- context: context
- )
- }
- )
- router.registerHandler(
- forMethod: Routeguide_RouteGuide.Method.RouteChat.descriptor,
- deserializer: GRPCProtobuf.ProtobufDeserializer<Routeguide_RouteNote>(),
- serializer: GRPCProtobuf.ProtobufSerializer<Routeguide_RouteNote>(),
- handler: { request, context in
- try await self.routeChat(
- request: request,
- context: context
- )
- }
- )
- }
- }
- // Default implementation of streaming methods from 'StreamingServiceProtocol'.
- extension Routeguide_RouteGuide.ServiceProtocol {
- internal func getFeature(
- request: GRPCCore.StreamingServerRequest<Routeguide_Point>,
- context: GRPCCore.ServerContext
- ) async throws -> GRPCCore.StreamingServerResponse<Routeguide_Feature> {
- let response = try await self.getFeature(
- request: GRPCCore.ServerRequest(stream: request),
- context: context
- )
- return GRPCCore.StreamingServerResponse(single: response)
- }
- internal func listFeatures(
- request: GRPCCore.StreamingServerRequest<Routeguide_Rectangle>,
- context: GRPCCore.ServerContext
- ) async throws -> GRPCCore.StreamingServerResponse<Routeguide_Feature> {
- let response = try await self.listFeatures(
- request: GRPCCore.ServerRequest(stream: request),
- context: context
- )
- return response
- }
- internal func recordRoute(
- request: GRPCCore.StreamingServerRequest<Routeguide_Point>,
- context: GRPCCore.ServerContext
- ) async throws -> GRPCCore.StreamingServerResponse<Routeguide_RouteSummary> {
- let response = try await self.recordRoute(
- request: request,
- context: context
- )
- return GRPCCore.StreamingServerResponse(single: response)
- }
- }
- // Default implementation of methods from 'ServiceProtocol'.
- extension Routeguide_RouteGuide.SimpleServiceProtocol {
- internal func getFeature(
- request: GRPCCore.ServerRequest<Routeguide_Point>,
- context: GRPCCore.ServerContext
- ) async throws -> GRPCCore.ServerResponse<Routeguide_Feature> {
- return GRPCCore.ServerResponse<Routeguide_Feature>(
- message: try await self.getFeature(
- request: request.message,
- context: context
- ),
- metadata: [:]
- )
- }
- internal func listFeatures(
- request: GRPCCore.ServerRequest<Routeguide_Rectangle>,
- context: GRPCCore.ServerContext
- ) async throws -> GRPCCore.StreamingServerResponse<Routeguide_Feature> {
- return GRPCCore.StreamingServerResponse<Routeguide_Feature>(
- metadata: [:],
- producer: { writer in
- try await self.listFeatures(
- request: request.message,
- response: writer,
- context: context
- )
- return [:]
- }
- )
- }
- internal func recordRoute(
- request: GRPCCore.StreamingServerRequest<Routeguide_Point>,
- context: GRPCCore.ServerContext
- ) async throws -> GRPCCore.ServerResponse<Routeguide_RouteSummary> {
- return GRPCCore.ServerResponse<Routeguide_RouteSummary>(
- message: try await self.recordRoute(
- request: request.messages,
- context: context
- ),
- metadata: [:]
- )
- }
- internal func routeChat(
- request: GRPCCore.StreamingServerRequest<Routeguide_RouteNote>,
- context: GRPCCore.ServerContext
- ) async throws -> GRPCCore.StreamingServerResponse<Routeguide_RouteNote> {
- return GRPCCore.StreamingServerResponse<Routeguide_RouteNote>(
- metadata: [:],
- producer: { writer in
- try await self.routeChat(
- request: request.messages,
- response: writer,
- context: context
- )
- return [:]
- }
- )
- }
- }
- // MARK: routeguide.RouteGuide (client)
- extension Routeguide_RouteGuide {
- /// Generated client protocol for the "routeguide.RouteGuide" service.
- ///
- /// You don't need to implement this protocol directly, use the generated
- /// implementation, ``Client``.
- ///
- /// > Source IDL Documentation:
- /// >
- /// > Interface exported by the server.
- internal protocol ClientProtocol: Sendable {
- /// Call the "GetFeature" method.
- ///
- /// > Source IDL Documentation:
- /// >
- /// > 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.
- ///
- /// - Parameters:
- /// - request: A request containing a single `Routeguide_Point` message.
- /// - serializer: A serializer for `Routeguide_Point` messages.
- /// - deserializer: A deserializer for `Routeguide_Feature` messages.
- /// - options: Options to apply to this RPC.
- /// - handleResponse: A closure which handles the response, the result of which is
- /// returned to the caller. Returning from the closure will cancel the RPC if it
- /// hasn't already finished.
- /// - Returns: The result of `handleResponse`.
- func getFeature<Result>(
- request: GRPCCore.ClientRequest<Routeguide_Point>,
- serializer: some GRPCCore.MessageSerializer<Routeguide_Point>,
- deserializer: some GRPCCore.MessageDeserializer<Routeguide_Feature>,
- options: GRPCCore.CallOptions,
- onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Routeguide_Feature>) async throws -> Result
- ) async throws -> Result where Result: Sendable
- /// Call the "ListFeatures" method.
- ///
- /// > Source IDL Documentation:
- /// >
- /// > 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.
- ///
- /// - Parameters:
- /// - request: A request containing a single `Routeguide_Rectangle` message.
- /// - serializer: A serializer for `Routeguide_Rectangle` messages.
- /// - deserializer: A deserializer for `Routeguide_Feature` messages.
- /// - options: Options to apply to this RPC.
- /// - handleResponse: A closure which handles the response, the result of which is
- /// returned to the caller. Returning from the closure will cancel the RPC if it
- /// hasn't already finished.
- /// - Returns: The result of `handleResponse`.
- func listFeatures<Result>(
- request: GRPCCore.ClientRequest<Routeguide_Rectangle>,
- serializer: some GRPCCore.MessageSerializer<Routeguide_Rectangle>,
- deserializer: some GRPCCore.MessageDeserializer<Routeguide_Feature>,
- options: GRPCCore.CallOptions,
- onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse<Routeguide_Feature>) async throws -> Result
- ) async throws -> Result where Result: Sendable
- /// Call the "RecordRoute" method.
- ///
- /// > Source IDL Documentation:
- /// >
- /// > A client-to-server streaming RPC.
- /// >
- /// > Accepts a stream of Points on a route being traversed, returning a
- /// > RouteSummary when traversal is completed.
- ///
- /// - Parameters:
- /// - request: A streaming request producing `Routeguide_Point` messages.
- /// - serializer: A serializer for `Routeguide_Point` messages.
- /// - deserializer: A deserializer for `Routeguide_RouteSummary` messages.
- /// - options: Options to apply to this RPC.
- /// - handleResponse: A closure which handles the response, the result of which is
- /// returned to the caller. Returning from the closure will cancel the RPC if it
- /// hasn't already finished.
- /// - Returns: The result of `handleResponse`.
- func recordRoute<Result>(
- request: GRPCCore.StreamingClientRequest<Routeguide_Point>,
- serializer: some GRPCCore.MessageSerializer<Routeguide_Point>,
- deserializer: some GRPCCore.MessageDeserializer<Routeguide_RouteSummary>,
- options: GRPCCore.CallOptions,
- onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Routeguide_RouteSummary>) async throws -> Result
- ) async throws -> Result where Result: Sendable
- /// Call the "RouteChat" method.
- ///
- /// > Source IDL Documentation:
- /// >
- /// > 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).
- ///
- /// - Parameters:
- /// - request: A streaming request producing `Routeguide_RouteNote` messages.
- /// - serializer: A serializer for `Routeguide_RouteNote` messages.
- /// - deserializer: A deserializer for `Routeguide_RouteNote` messages.
- /// - options: Options to apply to this RPC.
- /// - handleResponse: A closure which handles the response, the result of which is
- /// returned to the caller. Returning from the closure will cancel the RPC if it
- /// hasn't already finished.
- /// - Returns: The result of `handleResponse`.
- func routeChat<Result>(
- request: GRPCCore.StreamingClientRequest<Routeguide_RouteNote>,
- serializer: some GRPCCore.MessageSerializer<Routeguide_RouteNote>,
- deserializer: some GRPCCore.MessageDeserializer<Routeguide_RouteNote>,
- options: GRPCCore.CallOptions,
- onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse<Routeguide_RouteNote>) async throws -> Result
- ) async throws -> Result where Result: Sendable
- }
- /// Generated client for the "routeguide.RouteGuide" service.
- ///
- /// The ``Client`` provides an implementation of ``ClientProtocol`` which wraps
- /// a `GRPCCore.GRPCCClient`. The underlying `GRPCClient` provides the long-lived
- /// means of communication with the remote peer.
- ///
- /// > Source IDL Documentation:
- /// >
- /// > Interface exported by the server.
- internal struct Client<Transport>: ClientProtocol where Transport: GRPCCore.ClientTransport {
- private let client: GRPCCore.GRPCClient<Transport>
- /// Creates a new client wrapping the provided `GRPCCore.GRPCClient`.
- ///
- /// - Parameters:
- /// - client: A `GRPCCore.GRPCClient` providing a communication channel to the service.
- internal init(wrapping client: GRPCCore.GRPCClient<Transport>) {
- self.client = client
- }
- /// Call the "GetFeature" method.
- ///
- /// > Source IDL Documentation:
- /// >
- /// > 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.
- ///
- /// - Parameters:
- /// - request: A request containing a single `Routeguide_Point` message.
- /// - serializer: A serializer for `Routeguide_Point` messages.
- /// - deserializer: A deserializer for `Routeguide_Feature` messages.
- /// - options: Options to apply to this RPC.
- /// - handleResponse: A closure which handles the response, the result of which is
- /// returned to the caller. Returning from the closure will cancel the RPC if it
- /// hasn't already finished.
- /// - Returns: The result of `handleResponse`.
- internal func getFeature<Result>(
- request: GRPCCore.ClientRequest<Routeguide_Point>,
- serializer: some GRPCCore.MessageSerializer<Routeguide_Point>,
- deserializer: some GRPCCore.MessageDeserializer<Routeguide_Feature>,
- options: GRPCCore.CallOptions = .defaults,
- onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Routeguide_Feature>) async throws -> Result = { response in
- try response.message
- }
- ) async throws -> Result where Result: Sendable {
- try await self.client.unary(
- request: request,
- descriptor: Routeguide_RouteGuide.Method.GetFeature.descriptor,
- serializer: serializer,
- deserializer: deserializer,
- options: options,
- onResponse: handleResponse
- )
- }
- /// Call the "ListFeatures" method.
- ///
- /// > Source IDL Documentation:
- /// >
- /// > 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.
- ///
- /// - Parameters:
- /// - request: A request containing a single `Routeguide_Rectangle` message.
- /// - serializer: A serializer for `Routeguide_Rectangle` messages.
- /// - deserializer: A deserializer for `Routeguide_Feature` messages.
- /// - options: Options to apply to this RPC.
- /// - handleResponse: A closure which handles the response, the result of which is
- /// returned to the caller. Returning from the closure will cancel the RPC if it
- /// hasn't already finished.
- /// - Returns: The result of `handleResponse`.
- internal func listFeatures<Result>(
- request: GRPCCore.ClientRequest<Routeguide_Rectangle>,
- serializer: some GRPCCore.MessageSerializer<Routeguide_Rectangle>,
- deserializer: some GRPCCore.MessageDeserializer<Routeguide_Feature>,
- options: GRPCCore.CallOptions = .defaults,
- onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse<Routeguide_Feature>) async throws -> Result
- ) async throws -> Result where Result: Sendable {
- try await self.client.serverStreaming(
- request: request,
- descriptor: Routeguide_RouteGuide.Method.ListFeatures.descriptor,
- serializer: serializer,
- deserializer: deserializer,
- options: options,
- onResponse: handleResponse
- )
- }
- /// Call the "RecordRoute" method.
- ///
- /// > Source IDL Documentation:
- /// >
- /// > A client-to-server streaming RPC.
- /// >
- /// > Accepts a stream of Points on a route being traversed, returning a
- /// > RouteSummary when traversal is completed.
- ///
- /// - Parameters:
- /// - request: A streaming request producing `Routeguide_Point` messages.
- /// - serializer: A serializer for `Routeguide_Point` messages.
- /// - deserializer: A deserializer for `Routeguide_RouteSummary` messages.
- /// - options: Options to apply to this RPC.
- /// - handleResponse: A closure which handles the response, the result of which is
- /// returned to the caller. Returning from the closure will cancel the RPC if it
- /// hasn't already finished.
- /// - Returns: The result of `handleResponse`.
- internal func recordRoute<Result>(
- request: GRPCCore.StreamingClientRequest<Routeguide_Point>,
- serializer: some GRPCCore.MessageSerializer<Routeguide_Point>,
- deserializer: some GRPCCore.MessageDeserializer<Routeguide_RouteSummary>,
- options: GRPCCore.CallOptions = .defaults,
- onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Routeguide_RouteSummary>) async throws -> Result = { response in
- try response.message
- }
- ) async throws -> Result where Result: Sendable {
- try await self.client.clientStreaming(
- request: request,
- descriptor: Routeguide_RouteGuide.Method.RecordRoute.descriptor,
- serializer: serializer,
- deserializer: deserializer,
- options: options,
- onResponse: handleResponse
- )
- }
- /// Call the "RouteChat" method.
- ///
- /// > Source IDL Documentation:
- /// >
- /// > 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).
- ///
- /// - Parameters:
- /// - request: A streaming request producing `Routeguide_RouteNote` messages.
- /// - serializer: A serializer for `Routeguide_RouteNote` messages.
- /// - deserializer: A deserializer for `Routeguide_RouteNote` messages.
- /// - options: Options to apply to this RPC.
- /// - handleResponse: A closure which handles the response, the result of which is
- /// returned to the caller. Returning from the closure will cancel the RPC if it
- /// hasn't already finished.
- /// - Returns: The result of `handleResponse`.
- internal func routeChat<Result>(
- request: GRPCCore.StreamingClientRequest<Routeguide_RouteNote>,
- serializer: some GRPCCore.MessageSerializer<Routeguide_RouteNote>,
- deserializer: some GRPCCore.MessageDeserializer<Routeguide_RouteNote>,
- options: GRPCCore.CallOptions = .defaults,
- onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse<Routeguide_RouteNote>) async throws -> Result
- ) async throws -> Result where Result: Sendable {
- try await self.client.bidirectionalStreaming(
- request: request,
- descriptor: Routeguide_RouteGuide.Method.RouteChat.descriptor,
- serializer: serializer,
- deserializer: deserializer,
- options: options,
- onResponse: handleResponse
- )
- }
- }
- }
- // Helpers providing default arguments to 'ClientProtocol' methods.
- extension Routeguide_RouteGuide.ClientProtocol {
- /// Call the "GetFeature" method.
- ///
- /// > Source IDL Documentation:
- /// >
- /// > 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.
- ///
- /// - Parameters:
- /// - request: A request containing a single `Routeguide_Point` message.
- /// - options: Options to apply to this RPC.
- /// - handleResponse: A closure which handles the response, the result of which is
- /// returned to the caller. Returning from the closure will cancel the RPC if it
- /// hasn't already finished.
- /// - Returns: The result of `handleResponse`.
- internal func getFeature<Result>(
- request: GRPCCore.ClientRequest<Routeguide_Point>,
- options: GRPCCore.CallOptions = .defaults,
- onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Routeguide_Feature>) async throws -> Result = { response in
- try response.message
- }
- ) async throws -> Result where Result: Sendable {
- try await self.getFeature(
- request: request,
- serializer: GRPCProtobuf.ProtobufSerializer<Routeguide_Point>(),
- deserializer: GRPCProtobuf.ProtobufDeserializer<Routeguide_Feature>(),
- options: options,
- onResponse: handleResponse
- )
- }
- /// Call the "ListFeatures" method.
- ///
- /// > Source IDL Documentation:
- /// >
- /// > 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.
- ///
- /// - Parameters:
- /// - request: A request containing a single `Routeguide_Rectangle` message.
- /// - options: Options to apply to this RPC.
- /// - handleResponse: A closure which handles the response, the result of which is
- /// returned to the caller. Returning from the closure will cancel the RPC if it
- /// hasn't already finished.
- /// - Returns: The result of `handleResponse`.
- internal func listFeatures<Result>(
- request: GRPCCore.ClientRequest<Routeguide_Rectangle>,
- options: GRPCCore.CallOptions = .defaults,
- onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse<Routeguide_Feature>) async throws -> Result
- ) async throws -> Result where Result: Sendable {
- try await self.listFeatures(
- request: request,
- serializer: GRPCProtobuf.ProtobufSerializer<Routeguide_Rectangle>(),
- deserializer: GRPCProtobuf.ProtobufDeserializer<Routeguide_Feature>(),
- options: options,
- onResponse: handleResponse
- )
- }
- /// Call the "RecordRoute" method.
- ///
- /// > Source IDL Documentation:
- /// >
- /// > A client-to-server streaming RPC.
- /// >
- /// > Accepts a stream of Points on a route being traversed, returning a
- /// > RouteSummary when traversal is completed.
- ///
- /// - Parameters:
- /// - request: A streaming request producing `Routeguide_Point` messages.
- /// - options: Options to apply to this RPC.
- /// - handleResponse: A closure which handles the response, the result of which is
- /// returned to the caller. Returning from the closure will cancel the RPC if it
- /// hasn't already finished.
- /// - Returns: The result of `handleResponse`.
- internal func recordRoute<Result>(
- request: GRPCCore.StreamingClientRequest<Routeguide_Point>,
- options: GRPCCore.CallOptions = .defaults,
- onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Routeguide_RouteSummary>) async throws -> Result = { response in
- try response.message
- }
- ) async throws -> Result where Result: Sendable {
- try await self.recordRoute(
- request: request,
- serializer: GRPCProtobuf.ProtobufSerializer<Routeguide_Point>(),
- deserializer: GRPCProtobuf.ProtobufDeserializer<Routeguide_RouteSummary>(),
- options: options,
- onResponse: handleResponse
- )
- }
- /// Call the "RouteChat" method.
- ///
- /// > Source IDL Documentation:
- /// >
- /// > 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).
- ///
- /// - Parameters:
- /// - request: A streaming request producing `Routeguide_RouteNote` messages.
- /// - options: Options to apply to this RPC.
- /// - handleResponse: A closure which handles the response, the result of which is
- /// returned to the caller. Returning from the closure will cancel the RPC if it
- /// hasn't already finished.
- /// - Returns: The result of `handleResponse`.
- internal func routeChat<Result>(
- request: GRPCCore.StreamingClientRequest<Routeguide_RouteNote>,
- options: GRPCCore.CallOptions = .defaults,
- onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse<Routeguide_RouteNote>) async throws -> Result
- ) async throws -> Result where Result: Sendable {
- try await self.routeChat(
- request: request,
- serializer: GRPCProtobuf.ProtobufSerializer<Routeguide_RouteNote>(),
- deserializer: GRPCProtobuf.ProtobufDeserializer<Routeguide_RouteNote>(),
- options: options,
- onResponse: handleResponse
- )
- }
- }
- // Helpers providing sugared APIs for 'ClientProtocol' methods.
- extension Routeguide_RouteGuide.ClientProtocol {
- /// Call the "GetFeature" method.
- ///
- /// > Source IDL Documentation:
- /// >
- /// > 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.
- ///
- /// - Parameters:
- /// - message: request message to send.
- /// - metadata: Additional metadata to send, defaults to empty.
- /// - options: Options to apply to this RPC, defaults to `.defaults`.
- /// - handleResponse: A closure which handles the response, the result of which is
- /// returned to the caller. Returning from the closure will cancel the RPC if it
- /// hasn't already finished.
- /// - Returns: The result of `handleResponse`.
- internal func getFeature<Result>(
- _ message: Routeguide_Point,
- metadata: GRPCCore.Metadata = [:],
- options: GRPCCore.CallOptions = .defaults,
- onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Routeguide_Feature>) async throws -> Result = { response in
- try response.message
- }
- ) async throws -> Result where Result: Sendable {
- let request = GRPCCore.ClientRequest<Routeguide_Point>(
- message: message,
- metadata: metadata
- )
- return try await self.getFeature(
- request: request,
- options: options,
- onResponse: handleResponse
- )
- }
- /// Call the "ListFeatures" method.
- ///
- /// > Source IDL Documentation:
- /// >
- /// > 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.
- ///
- /// - Parameters:
- /// - message: request message to send.
- /// - metadata: Additional metadata to send, defaults to empty.
- /// - options: Options to apply to this RPC, defaults to `.defaults`.
- /// - handleResponse: A closure which handles the response, the result of which is
- /// returned to the caller. Returning from the closure will cancel the RPC if it
- /// hasn't already finished.
- /// - Returns: The result of `handleResponse`.
- internal func listFeatures<Result>(
- _ message: Routeguide_Rectangle,
- metadata: GRPCCore.Metadata = [:],
- options: GRPCCore.CallOptions = .defaults,
- onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse<Routeguide_Feature>) async throws -> Result
- ) async throws -> Result where Result: Sendable {
- let request = GRPCCore.ClientRequest<Routeguide_Rectangle>(
- message: message,
- metadata: metadata
- )
- return try await self.listFeatures(
- request: request,
- options: options,
- onResponse: handleResponse
- )
- }
- /// Call the "RecordRoute" method.
- ///
- /// > Source IDL Documentation:
- /// >
- /// > A client-to-server streaming RPC.
- /// >
- /// > Accepts a stream of Points on a route being traversed, returning a
- /// > RouteSummary when traversal is completed.
- ///
- /// - Parameters:
- /// - metadata: Additional metadata to send, defaults to empty.
- /// - options: Options to apply to this RPC, defaults to `.defaults`.
- /// - producer: A closure producing request messages to send to the server. The request
- /// stream is closed when the closure returns.
- /// - handleResponse: A closure which handles the response, the result of which is
- /// returned to the caller. Returning from the closure will cancel the RPC if it
- /// hasn't already finished.
- /// - Returns: The result of `handleResponse`.
- internal func recordRoute<Result>(
- metadata: GRPCCore.Metadata = [:],
- options: GRPCCore.CallOptions = .defaults,
- requestProducer producer: @Sendable @escaping (GRPCCore.RPCWriter<Routeguide_Point>) async throws -> Void,
- onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Routeguide_RouteSummary>) async throws -> Result = { response in
- try response.message
- }
- ) async throws -> Result where Result: Sendable {
- let request = GRPCCore.StreamingClientRequest<Routeguide_Point>(
- metadata: metadata,
- producer: producer
- )
- return try await self.recordRoute(
- request: request,
- options: options,
- onResponse: handleResponse
- )
- }
- /// Call the "RouteChat" method.
- ///
- /// > Source IDL Documentation:
- /// >
- /// > 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).
- ///
- /// - Parameters:
- /// - metadata: Additional metadata to send, defaults to empty.
- /// - options: Options to apply to this RPC, defaults to `.defaults`.
- /// - producer: A closure producing request messages to send to the server. The request
- /// stream is closed when the closure returns.
- /// - handleResponse: A closure which handles the response, the result of which is
- /// returned to the caller. Returning from the closure will cancel the RPC if it
- /// hasn't already finished.
- /// - Returns: The result of `handleResponse`.
- internal func routeChat<Result>(
- metadata: GRPCCore.Metadata = [:],
- options: GRPCCore.CallOptions = .defaults,
- requestProducer producer: @Sendable @escaping (GRPCCore.RPCWriter<Routeguide_RouteNote>) async throws -> Void,
- onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse<Routeguide_RouteNote>) async throws -> Result
- ) async throws -> Result where Result: Sendable {
- let request = GRPCCore.StreamingClientRequest<Routeguide_RouteNote>(
- metadata: metadata,
- producer: producer
- )
- return try await self.routeChat(
- request: request,
- options: options,
- onResponse: handleResponse
- )
- }
- }
|