2 // Generated by the protocol buffer compiler. DO NOT EDIT!
3 // source: math/math.proto
5 // Original file comments:
6 // Copyright 2015 gRPC authors.
8 // Licensed under the Apache License, Version 2.0 (the "License");
9 // you may not use this file except in compliance with the License.
10 // You may obtain a copy of the License at
12 // http://www.apache.org/licenses/LICENSE-2.0
14 // Unless required by applicable law or agreed to in writing, software
15 // distributed under the License is distributed on an "AS IS" BASIS,
16 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 // See the License for the specific language governing permissions and
18 // limitations under the License.
20 #pragma warning disable 0414, 1591
21 #region Designer generated code
23 using grpc = global::Grpc.Core;
26 public static partial class Math
28 static readonly string __ServiceName = "math.Math";
30 static readonly grpc::Marshaller<global::Math.DivArgs> __Marshaller_math_DivArgs = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Math.DivArgs.Parser.ParseFrom);
31 static readonly grpc::Marshaller<global::Math.DivReply> __Marshaller_math_DivReply = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Math.DivReply.Parser.ParseFrom);
32 static readonly grpc::Marshaller<global::Math.FibArgs> __Marshaller_math_FibArgs = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Math.FibArgs.Parser.ParseFrom);
33 static readonly grpc::Marshaller<global::Math.Num> __Marshaller_math_Num = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Math.Num.Parser.ParseFrom);
35 static readonly grpc::Method<global::Math.DivArgs, global::Math.DivReply> __Method_Div = new grpc::Method<global::Math.DivArgs, global::Math.DivReply>(
36 grpc::MethodType.Unary,
39 __Marshaller_math_DivArgs,
40 __Marshaller_math_DivReply);
42 static readonly grpc::Method<global::Math.DivArgs, global::Math.DivReply> __Method_DivMany = new grpc::Method<global::Math.DivArgs, global::Math.DivReply>(
43 grpc::MethodType.DuplexStreaming,
46 __Marshaller_math_DivArgs,
47 __Marshaller_math_DivReply);
49 static readonly grpc::Method<global::Math.FibArgs, global::Math.Num> __Method_Fib = new grpc::Method<global::Math.FibArgs, global::Math.Num>(
50 grpc::MethodType.ServerStreaming,
53 __Marshaller_math_FibArgs,
54 __Marshaller_math_Num);
56 static readonly grpc::Method<global::Math.Num, global::Math.Num> __Method_Sum = new grpc::Method<global::Math.Num, global::Math.Num>(
57 grpc::MethodType.ClientStreaming,
60 __Marshaller_math_Num,
61 __Marshaller_math_Num);
63 /// <summary>Service descriptor</summary>
64 public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
66 get { return global::Math.MathReflection.Descriptor.Services[0]; }
69 /// <summary>Base class for server-side implementations of Math</summary>
70 public abstract partial class MathBase
73 /// Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient
76 /// <param name="request">The request received from the client.</param>
77 /// <param name="context">The context of the server-side call handler being invoked.</param>
78 /// <returns>The response to send back to the client (wrapped by a task).</returns>
79 public virtual global::System.Threading.Tasks.Task<global::Math.DivReply> Div(global::Math.DivArgs request, grpc::ServerCallContext context)
81 throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
85 /// DivMany accepts an arbitrary number of division args from the client stream
86 /// and sends back the results in the reply stream. The stream continues until
87 /// the client closes its end; the server does the same after sending all the
88 /// replies. The stream ends immediately if either end aborts.
90 /// <param name="requestStream">Used for reading requests from the client.</param>
91 /// <param name="responseStream">Used for sending responses back to the client.</param>
92 /// <param name="context">The context of the server-side call handler being invoked.</param>
93 /// <returns>A task indicating completion of the handler.</returns>
94 public virtual global::System.Threading.Tasks.Task DivMany(grpc::IAsyncStreamReader<global::Math.DivArgs> requestStream, grpc::IServerStreamWriter<global::Math.DivReply> responseStream, grpc::ServerCallContext context)
96 throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
100 /// Fib generates numbers in the Fibonacci sequence. If FibArgs.limit > 0, Fib
101 /// generates up to limit numbers; otherwise it continues until the call is
102 /// canceled. Unlike Fib above, Fib has no final FibReply.
104 /// <param name="request">The request received from the client.</param>
105 /// <param name="responseStream">Used for sending responses back to the client.</param>
106 /// <param name="context">The context of the server-side call handler being invoked.</param>
107 /// <returns>A task indicating completion of the handler.</returns>
108 public virtual global::System.Threading.Tasks.Task Fib(global::Math.FibArgs request, grpc::IServerStreamWriter<global::Math.Num> responseStream, grpc::ServerCallContext context)
110 throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
114 /// Sum sums a stream of numbers, returning the final result once the stream
117 /// <param name="requestStream">Used for reading requests from the client.</param>
118 /// <param name="context">The context of the server-side call handler being invoked.</param>
119 /// <returns>The response to send back to the client (wrapped by a task).</returns>
120 public virtual global::System.Threading.Tasks.Task<global::Math.Num> Sum(grpc::IAsyncStreamReader<global::Math.Num> requestStream, grpc::ServerCallContext context)
122 throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
127 /// <summary>Client for Math</summary>
128 public partial class MathClient : grpc::ClientBase<MathClient>
130 /// <summary>Creates a new client for Math</summary>
131 /// <param name="channel">The channel to use to make remote calls.</param>
132 public MathClient(grpc::Channel channel) : base(channel)
135 /// <summary>Creates a new client for Math that uses a custom <c>CallInvoker</c>.</summary>
136 /// <param name="callInvoker">The callInvoker to use to make remote calls.</param>
137 public MathClient(grpc::CallInvoker callInvoker) : base(callInvoker)
140 /// <summary>Protected parameterless constructor to allow creation of test doubles.</summary>
141 protected MathClient() : base()
144 /// <summary>Protected constructor to allow creation of configured clients.</summary>
145 /// <param name="configuration">The client configuration.</param>
146 protected MathClient(ClientBaseConfiguration configuration) : base(configuration)
151 /// Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient
154 /// <param name="request">The request to send to the server.</param>
155 /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
156 /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
157 /// <param name="cancellationToken">An optional token for canceling the call.</param>
158 /// <returns>The response received from the server.</returns>
159 public virtual global::Math.DivReply Div(global::Math.DivArgs request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
161 return Div(request, new grpc::CallOptions(headers, deadline, cancellationToken));
164 /// Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient
167 /// <param name="request">The request to send to the server.</param>
168 /// <param name="options">The options for the call.</param>
169 /// <returns>The response received from the server.</returns>
170 public virtual global::Math.DivReply Div(global::Math.DivArgs request, grpc::CallOptions options)
172 return CallInvoker.BlockingUnaryCall(__Method_Div, null, options, request);
175 /// Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient
178 /// <param name="request">The request to send to the server.</param>
179 /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
180 /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
181 /// <param name="cancellationToken">An optional token for canceling the call.</param>
182 /// <returns>The call object.</returns>
183 public virtual grpc::AsyncUnaryCall<global::Math.DivReply> DivAsync(global::Math.DivArgs request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
185 return DivAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
188 /// Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient
191 /// <param name="request">The request to send to the server.</param>
192 /// <param name="options">The options for the call.</param>
193 /// <returns>The call object.</returns>
194 public virtual grpc::AsyncUnaryCall<global::Math.DivReply> DivAsync(global::Math.DivArgs request, grpc::CallOptions options)
196 return CallInvoker.AsyncUnaryCall(__Method_Div, null, options, request);
199 /// DivMany accepts an arbitrary number of division args from the client stream
200 /// and sends back the results in the reply stream. The stream continues until
201 /// the client closes its end; the server does the same after sending all the
202 /// replies. The stream ends immediately if either end aborts.
204 /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
205 /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
206 /// <param name="cancellationToken">An optional token for canceling the call.</param>
207 /// <returns>The call object.</returns>
208 public virtual grpc::AsyncDuplexStreamingCall<global::Math.DivArgs, global::Math.DivReply> DivMany(grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
210 return DivMany(new grpc::CallOptions(headers, deadline, cancellationToken));
213 /// DivMany accepts an arbitrary number of division args from the client stream
214 /// and sends back the results in the reply stream. The stream continues until
215 /// the client closes its end; the server does the same after sending all the
216 /// replies. The stream ends immediately if either end aborts.
218 /// <param name="options">The options for the call.</param>
219 /// <returns>The call object.</returns>
220 public virtual grpc::AsyncDuplexStreamingCall<global::Math.DivArgs, global::Math.DivReply> DivMany(grpc::CallOptions options)
222 return CallInvoker.AsyncDuplexStreamingCall(__Method_DivMany, null, options);
225 /// Fib generates numbers in the Fibonacci sequence. If FibArgs.limit > 0, Fib
226 /// generates up to limit numbers; otherwise it continues until the call is
227 /// canceled. Unlike Fib above, Fib has no final FibReply.
229 /// <param name="request">The request to send to the server.</param>
230 /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
231 /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
232 /// <param name="cancellationToken">An optional token for canceling the call.</param>
233 /// <returns>The call object.</returns>
234 public virtual grpc::AsyncServerStreamingCall<global::Math.Num> Fib(global::Math.FibArgs request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
236 return Fib(request, new grpc::CallOptions(headers, deadline, cancellationToken));
239 /// Fib generates numbers in the Fibonacci sequence. If FibArgs.limit > 0, Fib
240 /// generates up to limit numbers; otherwise it continues until the call is
241 /// canceled. Unlike Fib above, Fib has no final FibReply.
243 /// <param name="request">The request to send to the server.</param>
244 /// <param name="options">The options for the call.</param>
245 /// <returns>The call object.</returns>
246 public virtual grpc::AsyncServerStreamingCall<global::Math.Num> Fib(global::Math.FibArgs request, grpc::CallOptions options)
248 return CallInvoker.AsyncServerStreamingCall(__Method_Fib, null, options, request);
251 /// Sum sums a stream of numbers, returning the final result once the stream
254 /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
255 /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
256 /// <param name="cancellationToken">An optional token for canceling the call.</param>
257 /// <returns>The call object.</returns>
258 public virtual grpc::AsyncClientStreamingCall<global::Math.Num, global::Math.Num> Sum(grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
260 return Sum(new grpc::CallOptions(headers, deadline, cancellationToken));
263 /// Sum sums a stream of numbers, returning the final result once the stream
266 /// <param name="options">The options for the call.</param>
267 /// <returns>The call object.</returns>
268 public virtual grpc::AsyncClientStreamingCall<global::Math.Num, global::Math.Num> Sum(grpc::CallOptions options)
270 return CallInvoker.AsyncClientStreamingCall(__Method_Sum, null, options);
272 /// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary>
273 protected override MathClient NewInstance(ClientBaseConfiguration configuration)
275 return new MathClient(configuration);
279 /// <summary>Creates service definition that can be registered with a server</summary>
280 /// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
281 public static grpc::ServerServiceDefinition BindService(MathBase serviceImpl)
283 return grpc::ServerServiceDefinition.CreateBuilder()
284 .AddMethod(__Method_Div, serviceImpl.Div)
285 .AddMethod(__Method_DivMany, serviceImpl.DivMany)
286 .AddMethod(__Method_Fib, serviceImpl.Fib)
287 .AddMethod(__Method_Sum, serviceImpl.Sum).Build();
290 /// <summary>Register service method with a service binder with or without implementation. Useful when customizing the service binding logic.
291 /// Note: this method is part of an experimental API that can change or be removed without any prior notice.</summary>
292 /// <param name="serviceBinder">Service methods will be bound by calling <c>AddMethod</c> on this object.</param>
293 /// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
294 public static void BindService(grpc::ServiceBinderBase serviceBinder, MathBase serviceImpl)
296 serviceBinder.AddMethod(__Method_Div, serviceImpl == null ? null : new grpc::UnaryServerMethod<global::Math.DivArgs, global::Math.DivReply>(serviceImpl.Div));
297 serviceBinder.AddMethod(__Method_DivMany, serviceImpl == null ? null : new grpc::DuplexStreamingServerMethod<global::Math.DivArgs, global::Math.DivReply>(serviceImpl.DivMany));
298 serviceBinder.AddMethod(__Method_Fib, serviceImpl == null ? null : new grpc::ServerStreamingServerMethod<global::Math.FibArgs, global::Math.Num>(serviceImpl.Fib));
299 serviceBinder.AddMethod(__Method_Sum, serviceImpl == null ? null : new grpc::ClientStreamingServerMethod<global::Math.Num, global::Math.Num>(serviceImpl.Sum));