ba6824dd8e2ec4025432f347f926e688add3a38d
[platform/upstream/grpc.git] / src / csharp / Grpc.Examples / MathGrpc.cs
1 // <auto-generated>
2 //     Generated by the protocol buffer compiler.  DO NOT EDIT!
3 //     source: math/math.proto
4 // </auto-generated>
5 // Original file comments:
6 // Copyright 2015 gRPC authors.
7 //
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
11 //
12 //     http://www.apache.org/licenses/LICENSE-2.0
13 //
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.
19 //
20 #pragma warning disable 0414, 1591
21 #region Designer generated code
22
23 using grpc = global::Grpc.Core;
24
25 namespace Math {
26   public static partial class Math
27   {
28     static readonly string __ServiceName = "math.Math";
29
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);
34
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,
37         __ServiceName,
38         "Div",
39         __Marshaller_math_DivArgs,
40         __Marshaller_math_DivReply);
41
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,
44         __ServiceName,
45         "DivMany",
46         __Marshaller_math_DivArgs,
47         __Marshaller_math_DivReply);
48
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,
51         __ServiceName,
52         "Fib",
53         __Marshaller_math_FibArgs,
54         __Marshaller_math_Num);
55
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,
58         __ServiceName,
59         "Sum",
60         __Marshaller_math_Num,
61         __Marshaller_math_Num);
62
63     /// <summary>Service descriptor</summary>
64     public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
65     {
66       get { return global::Math.MathReflection.Descriptor.Services[0]; }
67     }
68
69     /// <summary>Base class for server-side implementations of Math</summary>
70     public abstract partial class MathBase
71     {
72       /// <summary>
73       /// Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient
74       /// and remainder.
75       /// </summary>
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)
80       {
81         throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
82       }
83
84       /// <summary>
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.
89       /// </summary>
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)
95       {
96         throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
97       }
98
99       /// <summary>
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.
103       /// </summary>
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)
109       {
110         throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
111       }
112
113       /// <summary>
114       /// Sum sums a stream of numbers, returning the final result once the stream
115       /// is closed.
116       /// </summary>
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)
121       {
122         throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
123       }
124
125     }
126
127     /// <summary>Client for Math</summary>
128     public partial class MathClient : grpc::ClientBase<MathClient>
129     {
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)
133       {
134       }
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)
138       {
139       }
140       /// <summary>Protected parameterless constructor to allow creation of test doubles.</summary>
141       protected MathClient() : base()
142       {
143       }
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)
147       {
148       }
149
150       /// <summary>
151       /// Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient
152       /// and remainder.
153       /// </summary>
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))
160       {
161         return Div(request, new grpc::CallOptions(headers, deadline, cancellationToken));
162       }
163       /// <summary>
164       /// Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient
165       /// and remainder.
166       /// </summary>
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)
171       {
172         return CallInvoker.BlockingUnaryCall(__Method_Div, null, options, request);
173       }
174       /// <summary>
175       /// Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient
176       /// and remainder.
177       /// </summary>
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))
184       {
185         return DivAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
186       }
187       /// <summary>
188       /// Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient
189       /// and remainder.
190       /// </summary>
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)
195       {
196         return CallInvoker.AsyncUnaryCall(__Method_Div, null, options, request);
197       }
198       /// <summary>
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.
203       /// </summary>
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))
209       {
210         return DivMany(new grpc::CallOptions(headers, deadline, cancellationToken));
211       }
212       /// <summary>
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.
217       /// </summary>
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)
221       {
222         return CallInvoker.AsyncDuplexStreamingCall(__Method_DivMany, null, options);
223       }
224       /// <summary>
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.
228       /// </summary>
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))
235       {
236         return Fib(request, new grpc::CallOptions(headers, deadline, cancellationToken));
237       }
238       /// <summary>
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.
242       /// </summary>
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)
247       {
248         return CallInvoker.AsyncServerStreamingCall(__Method_Fib, null, options, request);
249       }
250       /// <summary>
251       /// Sum sums a stream of numbers, returning the final result once the stream
252       /// is closed.
253       /// </summary>
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))
259       {
260         return Sum(new grpc::CallOptions(headers, deadline, cancellationToken));
261       }
262       /// <summary>
263       /// Sum sums a stream of numbers, returning the final result once the stream
264       /// is closed.
265       /// </summary>
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)
269       {
270         return CallInvoker.AsyncClientStreamingCall(__Method_Sum, null, options);
271       }
272       /// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary>
273       protected override MathClient NewInstance(ClientBaseConfiguration configuration)
274       {
275         return new MathClient(configuration);
276       }
277     }
278
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)
282     {
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();
288     }
289
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)
295     {
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));
300     }
301
302   }
303 }
304 #endregion