HelloworldGrpc.cs 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. // Generated by the protocol buffer compiler. DO NOT EDIT!
  2. // source: helloworld.proto
  3. // Original file comments:
  4. // Copyright 2015 gRPC authors.
  5. //
  6. // Licensed under the Apache License, Version 2.0 (the "License");
  7. // you may not use this file except in compliance with the License.
  8. // You may obtain a copy of the License at
  9. //
  10. // http://www.apache.org/licenses/LICENSE-2.0
  11. //
  12. // Unless required by applicable law or agreed to in writing, software
  13. // distributed under the License is distributed on an "AS IS" BASIS,
  14. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. // See the License for the specific language governing permissions and
  16. // limitations under the License.
  17. //
  18. #pragma warning disable 1591
  19. #region Designer generated code
  20. using System;
  21. using System.Threading;
  22. using System.Threading.Tasks;
  23. using grpc = global::Grpc.Core;
  24. namespace Helloworld {
  25. /// <summary>
  26. /// The greeting service definition.
  27. /// </summary>
  28. public static partial class Greeter
  29. {
  30. static readonly string __ServiceName = "helloworld.Greeter";
  31. static readonly grpc::Marshaller<global::Helloworld.HelloRequest> __Marshaller_HelloRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Helloworld.HelloRequest.Parser.ParseFrom);
  32. static readonly grpc::Marshaller<global::Helloworld.HelloReply> __Marshaller_HelloReply = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Helloworld.HelloReply.Parser.ParseFrom);
  33. static readonly grpc::Method<global::Helloworld.HelloRequest, global::Helloworld.HelloReply> __Method_SayHello = new grpc::Method<global::Helloworld.HelloRequest, global::Helloworld.HelloReply>(
  34. grpc::MethodType.Unary,
  35. __ServiceName,
  36. "SayHello",
  37. __Marshaller_HelloRequest,
  38. __Marshaller_HelloReply);
  39. /// <summary>Service descriptor</summary>
  40. public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
  41. {
  42. get { return global::Helloworld.HelloworldReflection.Descriptor.Services[0]; }
  43. }
  44. /// <summary>Base class for server-side implementations of Greeter</summary>
  45. public abstract partial class GreeterBase
  46. {
  47. /// <summary>
  48. /// Sends a greeting
  49. /// </summary>
  50. /// <param name="request">The request received from the client.</param>
  51. /// <param name="context">The context of the server-side call handler being invoked.</param>
  52. /// <returns>The response to send back to the client (wrapped by a task).</returns>
  53. public virtual global::System.Threading.Tasks.Task<global::Helloworld.HelloReply> SayHello(global::Helloworld.HelloRequest request, grpc::ServerCallContext context)
  54. {
  55. throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
  56. }
  57. }
  58. /// <summary>Client for Greeter</summary>
  59. public partial class GreeterClient : grpc::ClientBase<GreeterClient>
  60. {
  61. /// <summary>Creates a new client for Greeter</summary>
  62. /// <param name="channel">The channel to use to make remote calls.</param>
  63. public GreeterClient(grpc::Channel channel) : base(channel)
  64. {
  65. }
  66. /// <summary>Creates a new client for Greeter that uses a custom <c>CallInvoker</c>.</summary>
  67. /// <param name="callInvoker">The callInvoker to use to make remote calls.</param>
  68. public GreeterClient(grpc::CallInvoker callInvoker) : base(callInvoker)
  69. {
  70. }
  71. /// <summary>Protected parameterless constructor to allow creation of test doubles.</summary>
  72. protected GreeterClient() : base()
  73. {
  74. }
  75. /// <summary>Protected constructor to allow creation of configured clients.</summary>
  76. /// <param name="configuration">The client configuration.</param>
  77. protected GreeterClient(ClientBaseConfiguration configuration) : base(configuration)
  78. {
  79. }
  80. /// <summary>
  81. /// Sends a greeting
  82. /// </summary>
  83. /// <param name="request">The request to send to the server.</param>
  84. /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
  85. /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
  86. /// <param name="cancellationToken">An optional token for canceling the call.</param>
  87. /// <returns>The response received from the server.</returns>
  88. public virtual global::Helloworld.HelloReply SayHello(global::Helloworld.HelloRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
  89. {
  90. return SayHello(request, new grpc::CallOptions(headers, deadline, cancellationToken));
  91. }
  92. /// <summary>
  93. /// Sends a greeting
  94. /// </summary>
  95. /// <param name="request">The request to send to the server.</param>
  96. /// <param name="options">The options for the call.</param>
  97. /// <returns>The response received from the server.</returns>
  98. public virtual global::Helloworld.HelloReply SayHello(global::Helloworld.HelloRequest request, grpc::CallOptions options)
  99. {
  100. return CallInvoker.BlockingUnaryCall(__Method_SayHello, null, options, request);
  101. }
  102. /// <summary>
  103. /// Sends a greeting
  104. /// </summary>
  105. /// <param name="request">The request to send to the server.</param>
  106. /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
  107. /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
  108. /// <param name="cancellationToken">An optional token for canceling the call.</param>
  109. /// <returns>The call object.</returns>
  110. public virtual grpc::AsyncUnaryCall<global::Helloworld.HelloReply> SayHelloAsync(global::Helloworld.HelloRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
  111. {
  112. return SayHelloAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
  113. }
  114. /// <summary>
  115. /// Sends a greeting
  116. /// </summary>
  117. /// <param name="request">The request to send to the server.</param>
  118. /// <param name="options">The options for the call.</param>
  119. /// <returns>The call object.</returns>
  120. public virtual grpc::AsyncUnaryCall<global::Helloworld.HelloReply> SayHelloAsync(global::Helloworld.HelloRequest request, grpc::CallOptions options)
  121. {
  122. return CallInvoker.AsyncUnaryCall(__Method_SayHello, null, options, request);
  123. }
  124. /// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary>
  125. protected override GreeterClient NewInstance(ClientBaseConfiguration configuration)
  126. {
  127. return new GreeterClient(configuration);
  128. }
  129. }
  130. /// <summary>Creates service definition that can be registered with a server</summary>
  131. /// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
  132. public static grpc::ServerServiceDefinition BindService(GreeterBase serviceImpl)
  133. {
  134. return grpc::ServerServiceDefinition.CreateBuilder()
  135. .AddMethod(__Method_SayHello, serviceImpl.SayHello).Build();
  136. }
  137. }
  138. }
  139. #endregion