regenerate greeter protos

pull/10599/head
Jan Tattermusch 8 years ago
parent 769df6fa45
commit 622d7d6d2d
  1. 33
      examples/csharp/helloworld/Greeter/Helloworld.cs
  2. 61
      examples/csharp/helloworld/Greeter/HelloworldGrpc.cs

@ -10,7 +10,6 @@ using scg = global::System.Collections.Generic;
namespace Helloworld { namespace Helloworld {
/// <summary>Holder for reflection information generated from helloworld.proto</summary> /// <summary>Holder for reflection information generated from helloworld.proto</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static partial class HelloworldReflection { public static partial class HelloworldReflection {
#region Descriptor #region Descriptor
@ -43,29 +42,34 @@ namespace Helloworld {
/// <summary> /// <summary>
/// The request message containing the user's name. /// The request message containing the user's name.
/// </summary> /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class HelloRequest : pb::IMessage<HelloRequest> { public sealed partial class HelloRequest : pb::IMessage<HelloRequest> {
private static readonly pb::MessageParser<HelloRequest> _parser = new pb::MessageParser<HelloRequest>(() => new HelloRequest()); private static readonly pb::MessageParser<HelloRequest> _parser = new pb::MessageParser<HelloRequest>(() => new HelloRequest());
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<HelloRequest> Parser { get { return _parser; } } public static pb::MessageParser<HelloRequest> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor { public static pbr::MessageDescriptor Descriptor {
get { return global::Helloworld.HelloworldReflection.Descriptor.MessageTypes[0]; } get { return global::Helloworld.HelloworldReflection.Descriptor.MessageTypes[0]; }
} }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
pbr::MessageDescriptor pb::IMessage.Descriptor { pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; } get { return Descriptor; }
} }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public HelloRequest() { public HelloRequest() {
OnConstruction(); OnConstruction();
} }
partial void OnConstruction(); partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public HelloRequest(HelloRequest other) : this() { public HelloRequest(HelloRequest other) : this() {
name_ = other.name_; name_ = other.name_;
} }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public HelloRequest Clone() { public HelloRequest Clone() {
return new HelloRequest(this); return new HelloRequest(this);
} }
@ -73,6 +77,7 @@ namespace Helloworld {
/// <summary>Field number for the "name" field.</summary> /// <summary>Field number for the "name" field.</summary>
public const int NameFieldNumber = 1; public const int NameFieldNumber = 1;
private string name_ = ""; private string name_ = "";
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public string Name { public string Name {
get { return name_; } get { return name_; }
set { set {
@ -80,10 +85,12 @@ namespace Helloworld {
} }
} }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) { public override bool Equals(object other) {
return Equals(other as HelloRequest); return Equals(other as HelloRequest);
} }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool Equals(HelloRequest other) { public bool Equals(HelloRequest other) {
if (ReferenceEquals(other, null)) { if (ReferenceEquals(other, null)) {
return false; return false;
@ -95,16 +102,19 @@ namespace Helloworld {
return true; return true;
} }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() { public override int GetHashCode() {
int hash = 1; int hash = 1;
if (Name.Length != 0) hash ^= Name.GetHashCode(); if (Name.Length != 0) hash ^= Name.GetHashCode();
return hash; return hash;
} }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override string ToString() { public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this); return pb::JsonFormatter.ToDiagnosticString(this);
} }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) { public void WriteTo(pb::CodedOutputStream output) {
if (Name.Length != 0) { if (Name.Length != 0) {
output.WriteRawTag(10); output.WriteRawTag(10);
@ -112,6 +122,7 @@ namespace Helloworld {
} }
} }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() { public int CalculateSize() {
int size = 0; int size = 0;
if (Name.Length != 0) { if (Name.Length != 0) {
@ -120,6 +131,7 @@ namespace Helloworld {
return size; return size;
} }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(HelloRequest other) { public void MergeFrom(HelloRequest other) {
if (other == null) { if (other == null) {
return; return;
@ -129,6 +141,7 @@ namespace Helloworld {
} }
} }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) { public void MergeFrom(pb::CodedInputStream input) {
uint tag; uint tag;
while ((tag = input.ReadTag()) != 0) { while ((tag = input.ReadTag()) != 0) {
@ -149,29 +162,34 @@ namespace Helloworld {
/// <summary> /// <summary>
/// The response message containing the greetings /// The response message containing the greetings
/// </summary> /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class HelloReply : pb::IMessage<HelloReply> { public sealed partial class HelloReply : pb::IMessage<HelloReply> {
private static readonly pb::MessageParser<HelloReply> _parser = new pb::MessageParser<HelloReply>(() => new HelloReply()); private static readonly pb::MessageParser<HelloReply> _parser = new pb::MessageParser<HelloReply>(() => new HelloReply());
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<HelloReply> Parser { get { return _parser; } } public static pb::MessageParser<HelloReply> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor { public static pbr::MessageDescriptor Descriptor {
get { return global::Helloworld.HelloworldReflection.Descriptor.MessageTypes[1]; } get { return global::Helloworld.HelloworldReflection.Descriptor.MessageTypes[1]; }
} }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
pbr::MessageDescriptor pb::IMessage.Descriptor { pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; } get { return Descriptor; }
} }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public HelloReply() { public HelloReply() {
OnConstruction(); OnConstruction();
} }
partial void OnConstruction(); partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public HelloReply(HelloReply other) : this() { public HelloReply(HelloReply other) : this() {
message_ = other.message_; message_ = other.message_;
} }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public HelloReply Clone() { public HelloReply Clone() {
return new HelloReply(this); return new HelloReply(this);
} }
@ -179,6 +197,7 @@ namespace Helloworld {
/// <summary>Field number for the "message" field.</summary> /// <summary>Field number for the "message" field.</summary>
public const int MessageFieldNumber = 1; public const int MessageFieldNumber = 1;
private string message_ = ""; private string message_ = "";
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public string Message { public string Message {
get { return message_; } get { return message_; }
set { set {
@ -186,10 +205,12 @@ namespace Helloworld {
} }
} }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) { public override bool Equals(object other) {
return Equals(other as HelloReply); return Equals(other as HelloReply);
} }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool Equals(HelloReply other) { public bool Equals(HelloReply other) {
if (ReferenceEquals(other, null)) { if (ReferenceEquals(other, null)) {
return false; return false;
@ -201,16 +222,19 @@ namespace Helloworld {
return true; return true;
} }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() { public override int GetHashCode() {
int hash = 1; int hash = 1;
if (Message.Length != 0) hash ^= Message.GetHashCode(); if (Message.Length != 0) hash ^= Message.GetHashCode();
return hash; return hash;
} }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override string ToString() { public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this); return pb::JsonFormatter.ToDiagnosticString(this);
} }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) { public void WriteTo(pb::CodedOutputStream output) {
if (Message.Length != 0) { if (Message.Length != 0) {
output.WriteRawTag(10); output.WriteRawTag(10);
@ -218,6 +242,7 @@ namespace Helloworld {
} }
} }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() { public int CalculateSize() {
int size = 0; int size = 0;
if (Message.Length != 0) { if (Message.Length != 0) {
@ -226,6 +251,7 @@ namespace Helloworld {
return size; return size;
} }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(HelloReply other) { public void MergeFrom(HelloReply other) {
if (other == null) { if (other == null) {
return; return;
@ -235,6 +261,7 @@ namespace Helloworld {
} }
} }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) { public void MergeFrom(pb::CodedInputStream input) {
uint tag; uint tag;
while ((tag = input.ReadTag()) != 0) { while ((tag = input.ReadTag()) != 0) {

@ -35,21 +35,21 @@
using System; using System;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Grpc.Core; using grpc = global::Grpc.Core;
namespace Helloworld { namespace Helloworld {
/// <summary> /// <summary>
/// The greeting service definition. /// The greeting service definition.
/// </summary> /// </summary>
public static class Greeter public static partial class Greeter
{ {
static readonly string __ServiceName = "helloworld.Greeter"; static readonly string __ServiceName = "helloworld.Greeter";
static readonly Marshaller<global::Helloworld.HelloRequest> __Marshaller_HelloRequest = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Helloworld.HelloRequest.Parser.ParseFrom); static readonly grpc::Marshaller<global::Helloworld.HelloRequest> __Marshaller_HelloRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Helloworld.HelloRequest.Parser.ParseFrom);
static readonly Marshaller<global::Helloworld.HelloReply> __Marshaller_HelloReply = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Helloworld.HelloReply.Parser.ParseFrom); static readonly grpc::Marshaller<global::Helloworld.HelloReply> __Marshaller_HelloReply = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Helloworld.HelloReply.Parser.ParseFrom);
static readonly Method<global::Helloworld.HelloRequest, global::Helloworld.HelloReply> __Method_SayHello = new Method<global::Helloworld.HelloRequest, global::Helloworld.HelloReply>( static readonly grpc::Method<global::Helloworld.HelloRequest, global::Helloworld.HelloReply> __Method_SayHello = new grpc::Method<global::Helloworld.HelloRequest, global::Helloworld.HelloReply>(
MethodType.Unary, grpc::MethodType.Unary,
__ServiceName, __ServiceName,
"SayHello", "SayHello",
__Marshaller_HelloRequest, __Marshaller_HelloRequest,
@ -62,29 +62,32 @@ namespace Helloworld {
} }
/// <summary>Base class for server-side implementations of Greeter</summary> /// <summary>Base class for server-side implementations of Greeter</summary>
public abstract class GreeterBase public abstract partial class GreeterBase
{ {
/// <summary> /// <summary>
/// Sends a greeting /// Sends a greeting
/// </summary> /// </summary>
public virtual global::System.Threading.Tasks.Task<global::Helloworld.HelloReply> SayHello(global::Helloworld.HelloRequest request, ServerCallContext context) /// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Helloworld.HelloReply> SayHello(global::Helloworld.HelloRequest request, grpc::ServerCallContext context)
{ {
throw new RpcException(new Status(StatusCode.Unimplemented, "")); throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
} }
} }
/// <summary>Client for Greeter</summary> /// <summary>Client for Greeter</summary>
public class GreeterClient : ClientBase<GreeterClient> public partial class GreeterClient : grpc::ClientBase<GreeterClient>
{ {
/// <summary>Creates a new client for Greeter</summary> /// <summary>Creates a new client for Greeter</summary>
/// <param name="channel">The channel to use to make remote calls.</param> /// <param name="channel">The channel to use to make remote calls.</param>
public GreeterClient(Channel channel) : base(channel) public GreeterClient(grpc::Channel channel) : base(channel)
{ {
} }
/// <summary>Creates a new client for Greeter that uses a custom <c>CallInvoker</c>.</summary> /// <summary>Creates a new client for Greeter that uses a custom <c>CallInvoker</c>.</summary>
/// <param name="callInvoker">The callInvoker to use to make remote calls.</param> /// <param name="callInvoker">The callInvoker to use to make remote calls.</param>
public GreeterClient(CallInvoker callInvoker) : base(callInvoker) public GreeterClient(grpc::CallInvoker callInvoker) : base(callInvoker)
{ {
} }
/// <summary>Protected parameterless constructor to allow creation of test doubles.</summary> /// <summary>Protected parameterless constructor to allow creation of test doubles.</summary>
@ -100,31 +103,48 @@ namespace Helloworld {
/// <summary> /// <summary>
/// Sends a greeting /// Sends a greeting
/// </summary> /// </summary>
public virtual global::Helloworld.HelloReply SayHello(global::Helloworld.HelloRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) /// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Helloworld.HelloReply SayHello(global::Helloworld.HelloRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{ {
return SayHello(request, new CallOptions(headers, deadline, cancellationToken)); return SayHello(request, new grpc::CallOptions(headers, deadline, cancellationToken));
} }
/// <summary> /// <summary>
/// Sends a greeting /// Sends a greeting
/// </summary> /// </summary>
public virtual global::Helloworld.HelloReply SayHello(global::Helloworld.HelloRequest request, CallOptions options) /// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Helloworld.HelloReply SayHello(global::Helloworld.HelloRequest request, grpc::CallOptions options)
{ {
return CallInvoker.BlockingUnaryCall(__Method_SayHello, null, options, request); return CallInvoker.BlockingUnaryCall(__Method_SayHello, null, options, request);
} }
/// <summary> /// <summary>
/// Sends a greeting /// Sends a greeting
/// </summary> /// </summary>
public virtual AsyncUnaryCall<global::Helloworld.HelloReply> SayHelloAsync(global::Helloworld.HelloRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) /// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Helloworld.HelloReply> SayHelloAsync(global::Helloworld.HelloRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{ {
return SayHelloAsync(request, new CallOptions(headers, deadline, cancellationToken)); return SayHelloAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
} }
/// <summary> /// <summary>
/// Sends a greeting /// Sends a greeting
/// </summary> /// </summary>
public virtual AsyncUnaryCall<global::Helloworld.HelloReply> SayHelloAsync(global::Helloworld.HelloRequest request, CallOptions options) /// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Helloworld.HelloReply> SayHelloAsync(global::Helloworld.HelloRequest request, grpc::CallOptions options)
{ {
return CallInvoker.AsyncUnaryCall(__Method_SayHello, null, options, request); return CallInvoker.AsyncUnaryCall(__Method_SayHello, null, options, request);
} }
/// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary>
protected override GreeterClient NewInstance(ClientBaseConfiguration configuration) protected override GreeterClient NewInstance(ClientBaseConfiguration configuration)
{ {
return new GreeterClient(configuration); return new GreeterClient(configuration);
@ -132,9 +152,10 @@ namespace Helloworld {
} }
/// <summary>Creates service definition that can be registered with a server</summary> /// <summary>Creates service definition that can be registered with a server</summary>
public static ServerServiceDefinition BindService(GreeterBase serviceImpl) /// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
public static grpc::ServerServiceDefinition BindService(GreeterBase serviceImpl)
{ {
return ServerServiceDefinition.CreateBuilder() return grpc::ServerServiceDefinition.CreateBuilder()
.AddMethod(__Method_SayHello, serviceImpl.SayHello).Build(); .AddMethod(__Method_SayHello, serviceImpl.SayHello).Build();
} }

Loading…
Cancel
Save