// Generated by the protocol buffer compiler. DO NOT EDIT! // source: route_guide.proto // Original file comments: // Copyright 2015, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // #region Designer generated code using System; using System.Threading; using System.Threading.Tasks; using Grpc.Core; namespace Routeguide { /// /// Interface exported by the server. /// public static class RouteGuide { static readonly string __ServiceName = "routeguide.RouteGuide"; static readonly Marshaller __Marshaller_Point = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Routeguide.Point.Parser.ParseFrom); static readonly Marshaller __Marshaller_Feature = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Routeguide.Feature.Parser.ParseFrom); static readonly Marshaller __Marshaller_Rectangle = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Routeguide.Rectangle.Parser.ParseFrom); static readonly Marshaller __Marshaller_RouteSummary = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Routeguide.RouteSummary.Parser.ParseFrom); static readonly Marshaller __Marshaller_RouteNote = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Routeguide.RouteNote.Parser.ParseFrom); static readonly Method __Method_GetFeature = new Method( MethodType.Unary, __ServiceName, "GetFeature", __Marshaller_Point, __Marshaller_Feature); static readonly Method __Method_ListFeatures = new Method( MethodType.ServerStreaming, __ServiceName, "ListFeatures", __Marshaller_Rectangle, __Marshaller_Feature); static readonly Method __Method_RecordRoute = new Method( MethodType.ClientStreaming, __ServiceName, "RecordRoute", __Marshaller_Point, __Marshaller_RouteSummary); static readonly Method __Method_RouteChat = new Method( MethodType.DuplexStreaming, __ServiceName, "RouteChat", __Marshaller_RouteNote, __Marshaller_RouteNote); /// Service descriptor public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor { get { return global::Routeguide.RouteGuideReflection.Descriptor.Services[0]; } } /// Client for RouteGuide [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")] public interface IRouteGuideClient { /// /// 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. /// global::Routeguide.Feature GetFeature(global::Routeguide.Point request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// 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. /// global::Routeguide.Feature GetFeature(global::Routeguide.Point request, CallOptions options); /// /// 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. /// AsyncUnaryCall GetFeatureAsync(global::Routeguide.Point request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// 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. /// AsyncUnaryCall GetFeatureAsync(global::Routeguide.Point request, CallOptions options); /// /// 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. /// AsyncServerStreamingCall ListFeatures(global::Routeguide.Rectangle request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// 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. /// AsyncServerStreamingCall ListFeatures(global::Routeguide.Rectangle request, CallOptions options); /// /// A client-to-server streaming RPC. /// /// Accepts a stream of Points on a route being traversed, returning a /// RouteSummary when traversal is completed. /// AsyncClientStreamingCall RecordRoute(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// A client-to-server streaming RPC. /// /// Accepts a stream of Points on a route being traversed, returning a /// RouteSummary when traversal is completed. /// AsyncClientStreamingCall RecordRoute(CallOptions options); /// /// 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). /// AsyncDuplexStreamingCall RouteChat(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// 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). /// AsyncDuplexStreamingCall RouteChat(CallOptions options); } /// Interface of server-side implementations of RouteGuide [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")] public interface IRouteGuide { /// /// 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. /// global::System.Threading.Tasks.Task GetFeature(global::Routeguide.Point request, ServerCallContext context); /// /// 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. /// global::System.Threading.Tasks.Task ListFeatures(global::Routeguide.Rectangle request, IServerStreamWriter responseStream, ServerCallContext context); /// /// A client-to-server streaming RPC. /// /// Accepts a stream of Points on a route being traversed, returning a /// RouteSummary when traversal is completed. /// global::System.Threading.Tasks.Task RecordRoute(IAsyncStreamReader requestStream, ServerCallContext context); /// /// 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). /// global::System.Threading.Tasks.Task RouteChat(IAsyncStreamReader requestStream, IServerStreamWriter responseStream, ServerCallContext context); } /// Base class for server-side implementations of RouteGuide public abstract class RouteGuideBase { /// /// 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. /// public virtual global::System.Threading.Tasks.Task GetFeature(global::Routeguide.Point request, ServerCallContext context) { throw new RpcException(new Status(StatusCode.Unimplemented, "")); } /// /// 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. /// public virtual global::System.Threading.Tasks.Task ListFeatures(global::Routeguide.Rectangle request, IServerStreamWriter responseStream, ServerCallContext context) { throw new RpcException(new Status(StatusCode.Unimplemented, "")); } /// /// A client-to-server streaming RPC. /// /// Accepts a stream of Points on a route being traversed, returning a /// RouteSummary when traversal is completed. /// public virtual global::System.Threading.Tasks.Task RecordRoute(IAsyncStreamReader requestStream, ServerCallContext context) { throw new RpcException(new Status(StatusCode.Unimplemented, "")); } /// /// 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). /// public virtual global::System.Threading.Tasks.Task RouteChat(IAsyncStreamReader requestStream, IServerStreamWriter responseStream, ServerCallContext context) { throw new RpcException(new Status(StatusCode.Unimplemented, "")); } } /// Client for RouteGuide #pragma warning disable 0618 public class RouteGuideClient : ClientBase, IRouteGuideClient #pragma warning restore 0618 { public RouteGuideClient(Channel channel) : base(channel) { } public RouteGuideClient(CallInvoker callInvoker) : base(callInvoker) { } ///Protected parameterless constructor to allow creation of test doubles. protected RouteGuideClient() : base() { } ///Protected constructor to allow creation of configured clients. protected RouteGuideClient(ClientBaseConfiguration configuration) : base(configuration) { } /// /// 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. /// public virtual global::Routeguide.Feature GetFeature(global::Routeguide.Point request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) { return GetFeature(request, new CallOptions(headers, deadline, cancellationToken)); } /// /// 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. /// public virtual global::Routeguide.Feature GetFeature(global::Routeguide.Point request, CallOptions options) { return CallInvoker.BlockingUnaryCall(__Method_GetFeature, null, options, request); } /// /// 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. /// public virtual AsyncUnaryCall GetFeatureAsync(global::Routeguide.Point request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) { return GetFeatureAsync(request, new CallOptions(headers, deadline, cancellationToken)); } /// /// 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. /// public virtual AsyncUnaryCall GetFeatureAsync(global::Routeguide.Point request, CallOptions options) { return CallInvoker.AsyncUnaryCall(__Method_GetFeature, null, options, request); } /// /// 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. /// public virtual AsyncServerStreamingCall ListFeatures(global::Routeguide.Rectangle request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) { return ListFeatures(request, new CallOptions(headers, deadline, cancellationToken)); } /// /// 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. /// public virtual AsyncServerStreamingCall ListFeatures(global::Routeguide.Rectangle request, CallOptions options) { return CallInvoker.AsyncServerStreamingCall(__Method_ListFeatures, null, options, request); } /// /// A client-to-server streaming RPC. /// /// Accepts a stream of Points on a route being traversed, returning a /// RouteSummary when traversal is completed. /// public virtual AsyncClientStreamingCall RecordRoute(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) { return RecordRoute(new CallOptions(headers, deadline, cancellationToken)); } /// /// A client-to-server streaming RPC. /// /// Accepts a stream of Points on a route being traversed, returning a /// RouteSummary when traversal is completed. /// public virtual AsyncClientStreamingCall RecordRoute(CallOptions options) { return CallInvoker.AsyncClientStreamingCall(__Method_RecordRoute, null, options); } /// /// 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). /// public virtual AsyncDuplexStreamingCall RouteChat(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) { return RouteChat(new CallOptions(headers, deadline, cancellationToken)); } /// /// 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). /// public virtual AsyncDuplexStreamingCall RouteChat(CallOptions options) { return CallInvoker.AsyncDuplexStreamingCall(__Method_RouteChat, null, options); } protected override RouteGuideClient NewInstance(ClientBaseConfiguration configuration) { return new RouteGuideClient(configuration); } } /// Creates a new client for RouteGuide public static RouteGuideClient NewClient(Channel channel) { return new RouteGuideClient(channel); } /// Creates service definition that can be registered with a server #pragma warning disable 0618 public static ServerServiceDefinition BindService(IRouteGuide serviceImpl) #pragma warning restore 0618 { return ServerServiceDefinition.CreateBuilder(__ServiceName) .AddMethod(__Method_GetFeature, serviceImpl.GetFeature) .AddMethod(__Method_ListFeatures, serviceImpl.ListFeatures) .AddMethod(__Method_RecordRoute, serviceImpl.RecordRoute) .AddMethod(__Method_RouteChat, serviceImpl.RouteChat).Build(); } /// Creates service definition that can be registered with a server #pragma warning disable 0618 public static ServerServiceDefinition BindService(RouteGuideBase serviceImpl) #pragma warning restore 0618 { return ServerServiceDefinition.CreateBuilder(__ServiceName) .AddMethod(__Method_GetFeature, serviceImpl.GetFeature) .AddMethod(__Method_ListFeatures, serviceImpl.ListFeatures) .AddMethod(__Method_RecordRoute, serviceImpl.RecordRoute) .AddMethod(__Method_RouteChat, serviceImpl.RouteChat).Build(); } } } #endregion