xref: /aosp_15_r20/external/grpc-grpc/test/csharp/codegen/simple/expected/HelloworldGrpc.cs (revision cc02d7e222339f7a4f6ba5f422e6413f4bd931f2)
1 // <auto-generated>
2 //     Generated by the protocol buffer compiler.  DO NOT EDIT!
3 //     source: helloworld.proto
4 // </auto-generated>
5 // Original file comments:
6 // Copyright 2023 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, 8981, 0612
21 #region Designer generated code
22 
23 using grpc = global::Grpc.Core;
24 
25 namespace Test.Csharp.Codegen.Simple.Proto.Helloworld {
26   /// <summary>
27   /// The greeting service definition.
28   /// </summary>
29   public static partial class Greeter
30   {
31     static readonly string __ServiceName = "test.csharp.codegen.simple.proto.helloworld.Greeter";
32 
33     [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
__Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context)34     static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context)
35     {
36       #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
37       if (message is global::Google.Protobuf.IBufferMessage)
38       {
39         context.SetPayloadLength(message.CalculateSize());
40         global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter());
41         context.Complete();
42         return;
43       }
44       #endif
45       context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message));
46     }
47 
48     [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
49     static class __Helper_MessageCache<T>
50     {
51       public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T));
52     }
53 
54     [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
55     static T __Helper_DeserializeMessage<T>(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser<T> parser) where T : global::Google.Protobuf.IMessage<T>
56     {
57       #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
58       if (__Helper_MessageCache<T>.IsBufferMessage)
59       {
60         return parser.ParseFrom(context.PayloadAsReadOnlySequence());
61       }
62       #endif
63       return parser.ParseFrom(context.PayloadAsNewBuffer());
64     }
65 
66     [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
67     static readonly grpc::Marshaller<global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloRequest> __Marshaller_test_csharp_codegen_simple_proto_helloworld_HelloRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloRequest.Parser));
68     [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
69     static readonly grpc::Marshaller<global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloReply> __Marshaller_test_csharp_codegen_simple_proto_helloworld_HelloReply = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloReply.Parser));
70 
71     [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
72     static readonly grpc::Method<global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloRequest, global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloReply> __Method_SayHello = new grpc::Method<global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloRequest, global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloReply>(
73         grpc::MethodType.Unary,
74         __ServiceName,
75         "SayHello",
76         __Marshaller_test_csharp_codegen_simple_proto_helloworld_HelloRequest,
77         __Marshaller_test_csharp_codegen_simple_proto_helloworld_HelloReply);
78 
79     [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
80     static readonly grpc::Method<global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloRequest, global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloReply> __Method_SayHelloStreamReply = new grpc::Method<global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloRequest, global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloReply>(
81         grpc::MethodType.ServerStreaming,
82         __ServiceName,
83         "SayHelloStreamReply",
84         __Marshaller_test_csharp_codegen_simple_proto_helloworld_HelloRequest,
85         __Marshaller_test_csharp_codegen_simple_proto_helloworld_HelloReply);
86 
87     /// <summary>Service descriptor</summary>
88     public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
89     {
90       get { return global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloworldReflection.Descriptor.Services[0]; }
91     }
92 
93     /// <summary>Base class for server-side implementations of Greeter</summary>
94     [grpc::BindServiceMethod(typeof(Greeter), "BindService")]
95     public abstract partial class GreeterBase
96     {
97       /// <summary>
98       /// Sends a greeting
99       /// </summary>
100       /// <param name="request">The request received from the client.</param>
101       /// <param name="context">The context of the server-side call handler being invoked.</param>
102       /// <returns>The response to send back to the client (wrapped by a task).</returns>
103       [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
SayHello(global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloRequest request, grpc::ServerCallContext context)104       public virtual global::System.Threading.Tasks.Task<global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloReply> SayHello(global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloRequest request, grpc::ServerCallContext context)
105       {
106         throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
107       }
108 
109       [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
SayHelloStreamReply(global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloRequest request, grpc::IServerStreamWriter<global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloReply> responseStream, grpc::ServerCallContext context)110       public virtual global::System.Threading.Tasks.Task SayHelloStreamReply(global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloRequest request, grpc::IServerStreamWriter<global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloReply> responseStream, grpc::ServerCallContext context)
111       {
112         throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
113       }
114 
115     }
116 
117     /// <summary>Client for Greeter</summary>
118     public partial class GreeterClient : grpc::ClientBase<GreeterClient>
119     {
120       /// <summary>Creates a new client for Greeter</summary>
121       /// <param name="channel">The channel to use to make remote calls.</param>
122       [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
GreeterClient(grpc::ChannelBase channel)123       public GreeterClient(grpc::ChannelBase channel) : base(channel)
124       {
125       }
126       /// <summary>Creates a new client for Greeter that uses a custom <c>CallInvoker</c>.</summary>
127       /// <param name="callInvoker">The callInvoker to use to make remote calls.</param>
128       [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
GreeterClient(grpc::CallInvoker callInvoker)129       public GreeterClient(grpc::CallInvoker callInvoker) : base(callInvoker)
130       {
131       }
132       /// <summary>Protected parameterless constructor to allow creation of test doubles.</summary>
133       [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
GreeterClient()134       protected GreeterClient() : base()
135       {
136       }
137       /// <summary>Protected constructor to allow creation of configured clients.</summary>
138       /// <param name="configuration">The client configuration.</param>
139       [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
GreeterClient(ClientBaseConfiguration configuration)140       protected GreeterClient(ClientBaseConfiguration configuration) : base(configuration)
141       {
142       }
143 
144       /// <summary>
145       /// Sends a greeting
146       /// </summary>
147       /// <param name="request">The request to send to the server.</param>
148       /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
149       /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
150       /// <param name="cancellationToken">An optional token for canceling the call.</param>
151       /// <returns>The response received from the server.</returns>
152       [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
SayHello(global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))153       public virtual global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloReply SayHello(global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
154       {
155         return SayHello(request, new grpc::CallOptions(headers, deadline, cancellationToken));
156       }
157       /// <summary>
158       /// Sends a greeting
159       /// </summary>
160       /// <param name="request">The request to send to the server.</param>
161       /// <param name="options">The options for the call.</param>
162       /// <returns>The response received from the server.</returns>
163       [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
SayHello(global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloRequest request, grpc::CallOptions options)164       public virtual global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloReply SayHello(global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloRequest request, grpc::CallOptions options)
165       {
166         return CallInvoker.BlockingUnaryCall(__Method_SayHello, null, options, request);
167       }
168       /// <summary>
169       /// Sends a greeting
170       /// </summary>
171       /// <param name="request">The request to send to the server.</param>
172       /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
173       /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
174       /// <param name="cancellationToken">An optional token for canceling the call.</param>
175       /// <returns>The call object.</returns>
176       [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
SayHelloAsync(global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))177       public virtual grpc::AsyncUnaryCall<global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloReply> SayHelloAsync(global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
178       {
179         return SayHelloAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
180       }
181       /// <summary>
182       /// Sends a greeting
183       /// </summary>
184       /// <param name="request">The request to send to the server.</param>
185       /// <param name="options">The options for the call.</param>
186       /// <returns>The call object.</returns>
187       [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
SayHelloAsync(global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloRequest request, grpc::CallOptions options)188       public virtual grpc::AsyncUnaryCall<global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloReply> SayHelloAsync(global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloRequest request, grpc::CallOptions options)
189       {
190         return CallInvoker.AsyncUnaryCall(__Method_SayHello, null, options, request);
191       }
192       [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
SayHelloStreamReply(global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))193       public virtual grpc::AsyncServerStreamingCall<global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloReply> SayHelloStreamReply(global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
194       {
195         return SayHelloStreamReply(request, new grpc::CallOptions(headers, deadline, cancellationToken));
196       }
197       [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
SayHelloStreamReply(global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloRequest request, grpc::CallOptions options)198       public virtual grpc::AsyncServerStreamingCall<global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloReply> SayHelloStreamReply(global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloRequest request, grpc::CallOptions options)
199       {
200         return CallInvoker.AsyncServerStreamingCall(__Method_SayHelloStreamReply, null, options, request);
201       }
202       /// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary>
203       [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
NewInstance(ClientBaseConfiguration configuration)204       protected override GreeterClient NewInstance(ClientBaseConfiguration configuration)
205       {
206         return new GreeterClient(configuration);
207       }
208     }
209 
210     /// <summary>Creates service definition that can be registered with a server</summary>
211     /// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
212     [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
BindService(GreeterBase serviceImpl)213     public static grpc::ServerServiceDefinition BindService(GreeterBase serviceImpl)
214     {
215       return grpc::ServerServiceDefinition.CreateBuilder()
216           .AddMethod(__Method_SayHello, serviceImpl.SayHello)
217           .AddMethod(__Method_SayHelloStreamReply, serviceImpl.SayHelloStreamReply).Build();
218     }
219 
220     /// <summary>Register service method with a service binder with or without implementation. Useful when customizing the service binding logic.
221     /// Note: this method is part of an experimental API that can change or be removed without any prior notice.</summary>
222     /// <param name="serviceBinder">Service methods will be bound by calling <c>AddMethod</c> on this object.</param>
223     /// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
224     [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
BindService(grpc::ServiceBinderBase serviceBinder, GreeterBase serviceImpl)225     public static void BindService(grpc::ServiceBinderBase serviceBinder, GreeterBase serviceImpl)
226     {
227       serviceBinder.AddMethod(__Method_SayHello, serviceImpl == null ? null : new grpc::UnaryServerMethod<global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloRequest, global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloReply>(serviceImpl.SayHello));
228       serviceBinder.AddMethod(__Method_SayHelloStreamReply, serviceImpl == null ? null : new grpc::ServerStreamingServerMethod<global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloRequest, global::Test.Csharp.Codegen.Simple.Proto.Helloworld.HelloReply>(serviceImpl.SayHelloStreamReply));
229     }
230 
231   }
232 }
233 #endregion
234