| // Generated by the protocol buffer compiler. DO NOT EDIT! |
| // source: math.proto |
| #region Designer generated code |
| |
| using System; |
| using System.Threading; |
| using System.Threading.Tasks; |
| using Grpc.Core; |
| |
| namespace math { |
| public static class Math |
| { |
| static readonly string __ServiceName = "math.Math"; |
| |
| static readonly Marshaller<DivArgs> __Marshaller_DivArgs = Marshallers.Create((arg) => arg.ToByteArray(), DivArgs.ParseFrom); |
| static readonly Marshaller<DivReply> __Marshaller_DivReply = Marshallers.Create((arg) => arg.ToByteArray(), DivReply.ParseFrom); |
| static readonly Marshaller<FibArgs> __Marshaller_FibArgs = Marshallers.Create((arg) => arg.ToByteArray(), FibArgs.ParseFrom); |
| static readonly Marshaller<Num> __Marshaller_Num = Marshallers.Create((arg) => arg.ToByteArray(), Num.ParseFrom); |
| |
| static readonly Method<DivArgs, DivReply> __Method_Div = new Method<DivArgs, DivReply>( |
| MethodType.Unary, |
| "Div", |
| __Marshaller_DivArgs, |
| __Marshaller_DivReply); |
| |
| static readonly Method<DivArgs, DivReply> __Method_DivMany = new Method<DivArgs, DivReply>( |
| MethodType.DuplexStreaming, |
| "DivMany", |
| __Marshaller_DivArgs, |
| __Marshaller_DivReply); |
| |
| static readonly Method<FibArgs, Num> __Method_Fib = new Method<FibArgs, Num>( |
| MethodType.ServerStreaming, |
| "Fib", |
| __Marshaller_FibArgs, |
| __Marshaller_Num); |
| |
| static readonly Method<Num, Num> __Method_Sum = new Method<Num, Num>( |
| MethodType.ClientStreaming, |
| "Sum", |
| __Marshaller_Num, |
| __Marshaller_Num); |
| |
| // client-side stub interface |
| public interface IMathClient |
| { |
| DivReply Div(DivArgs request, CancellationToken token = default(CancellationToken)); |
| Task<DivReply> DivAsync(DivArgs request, CancellationToken token = default(CancellationToken)); |
| AsyncDuplexStreamingCall<DivArgs, DivReply> DivMany(CancellationToken token = default(CancellationToken)); |
| AsyncServerStreamingCall<Num> Fib(FibArgs request, CancellationToken token = default(CancellationToken)); |
| AsyncClientStreamingCall<Num, Num> Sum(CancellationToken token = default(CancellationToken)); |
| } |
| |
| // server-side interface |
| public interface IMath |
| { |
| Task<DivReply> Div(ServerCallContext context, DivArgs request); |
| Task DivMany(ServerCallContext context, IAsyncStreamReader<DivArgs> requestStream, IServerStreamWriter<DivReply> responseStream); |
| Task Fib(ServerCallContext context, FibArgs request, IServerStreamWriter<Num> responseStream); |
| Task<Num> Sum(ServerCallContext context, IAsyncStreamReader<Num> requestStream); |
| } |
| |
| // client stub |
| public class MathClient : AbstractStub<MathClient, StubConfiguration>, IMathClient |
| { |
| public MathClient(Channel channel) : this(channel, StubConfiguration.Default) |
| { |
| } |
| public MathClient(Channel channel, StubConfiguration config) : base(channel, config) |
| { |
| } |
| public DivReply Div(DivArgs request, CancellationToken token = default(CancellationToken)) |
| { |
| var call = CreateCall(__ServiceName, __Method_Div); |
| return Calls.BlockingUnaryCall(call, request, token); |
| } |
| public Task<DivReply> DivAsync(DivArgs request, CancellationToken token = default(CancellationToken)) |
| { |
| var call = CreateCall(__ServiceName, __Method_Div); |
| return Calls.AsyncUnaryCall(call, request, token); |
| } |
| public AsyncDuplexStreamingCall<DivArgs, DivReply> DivMany(CancellationToken token = default(CancellationToken)) |
| { |
| var call = CreateCall(__ServiceName, __Method_DivMany); |
| return Calls.AsyncDuplexStreamingCall(call, token); |
| } |
| public AsyncServerStreamingCall<Num> Fib(FibArgs request, CancellationToken token = default(CancellationToken)) |
| { |
| var call = CreateCall(__ServiceName, __Method_Fib); |
| return Calls.AsyncServerStreamingCall(call, request, token); |
| } |
| public AsyncClientStreamingCall<Num, Num> Sum(CancellationToken token = default(CancellationToken)) |
| { |
| var call = CreateCall(__ServiceName, __Method_Sum); |
| return Calls.AsyncClientStreamingCall(call, token); |
| } |
| } |
| |
| // creates service definition that can be registered with a server |
| public static ServerServiceDefinition BindService(IMath serviceImpl) |
| { |
| return ServerServiceDefinition.CreateBuilder(__ServiceName) |
| .AddMethod(__Method_Div, serviceImpl.Div) |
| .AddMethod(__Method_DivMany, serviceImpl.DivMany) |
| .AddMethod(__Method_Fib, serviceImpl.Fib) |
| .AddMethod(__Method_Sum, serviceImpl.Sum).Build(); |
| } |
| |
| // creates a new client stub |
| public static IMathClient NewStub(Channel channel) |
| { |
| return new MathClient(channel); |
| } |
| |
| // creates a new client stub |
| public static IMathClient NewStub(Channel channel, StubConfiguration config) |
| { |
| return new MathClient(channel, config); |
| } |
| } |
| } |
| #endregion |