From 1f60819dee79831588a4320a739100e134e9f206 Mon Sep 17 00:00:00 2001 From: Simon Zeltser Date: Fri, 21 Sep 2018 19:09:52 +0000 Subject: [PATCH] Introducing super basic health check for cart service (#44) * Introducing super basic health check for cart service - Generated C# proto implementation for grpc health check - Moved all C# protos to a dedicated folder - Implemented basic health checking to ping CartStore (which is Redis in default implementation) - Base plumbing for health checks * Introducing super basic health check for cart service - Generated C# proto implementation for grpc health check - Moved all C# protos to a dedicated folder - Implemented basic health checking to ping CartStore (which is Redis in default implementation) - Base plumbing for health checks * Changing Ping health probe to call Redis Cache Ping method --- src/cartservice/HealthImpl.cs | 22 + src/cartservice/Program.cs | 9 +- src/cartservice/cartservice.csproj | 3 +- src/cartservice/cartstore/LocalCartStore.cs | 5 + src/cartservice/cartstore/RedisCartStore.cs | 15 + src/cartservice/generate_protos.bat | 2 +- src/cartservice/{ => grpc_generated}/Demo.cs | 1457 +++++++---------- .../{ => grpc_generated}/DemoGrpc.cs | 150 +- src/cartservice/interfaces/ICartStore.cs | 2 + 9 files changed, 770 insertions(+), 895 deletions(-) create mode 100644 src/cartservice/HealthImpl.cs rename src/cartservice/{ => grpc_generated}/Demo.cs (87%) rename src/cartservice/{ => grpc_generated}/DemoGrpc.cs (89%) diff --git a/src/cartservice/HealthImpl.cs b/src/cartservice/HealthImpl.cs new file mode 100644 index 0000000..5ac6551 --- /dev/null +++ b/src/cartservice/HealthImpl.cs @@ -0,0 +1,22 @@ +using System; +using cartservice.interfaces; +using Grpc.Health.V1; +using StackExchange.Redis; +using static Grpc.Health.V1.Health; + +namespace cartservice { + internal class HealthImpl : HealthBase { + private ICartStore dependency { get; } + public HealthImpl (ICartStore dependency) { + this.dependency = dependency; + } + + public HealthCheckResponse Check (HealthCheckRequest request) { + Console.WriteLine ("Checking CartService Health"); + + return new HealthCheckResponse { + Status = dependency.Ping() ? HealthCheckResponse.Types.ServingStatus.Serving : HealthCheckResponse.Types.ServingStatus.NotServing + }; + } + } +} \ No newline at end of file diff --git a/src/cartservice/Program.cs b/src/cartservice/Program.cs index 70e3907..d1f80bb 100644 --- a/src/cartservice/Program.cs +++ b/src/cartservice/Program.cs @@ -56,7 +56,14 @@ namespace cartservice Console.WriteLine($"Trying to start a grpc server at {host}:{port}"); Server server = new Server { - Services = { Hipstershop.CartService.BindService(new CartServiceImpl(cartStore)) }, + Services = + { + // Cart Service Endpoint + Hipstershop.CartService.BindService(new CartServiceImpl(cartStore)), + + // Health Endpoint + Grpc.Health.V1.Health.BindService(new HealthImpl(cartStore)) + }, Ports = { new ServerPort(host, port, ServerCredentials.Insecure) } }; diff --git a/src/cartservice/cartservice.csproj b/src/cartservice/cartservice.csproj index c6945d2..2df2e2c 100644 --- a/src/cartservice/cartservice.csproj +++ b/src/cartservice/cartservice.csproj @@ -7,9 +7,10 @@ - + + diff --git a/src/cartservice/cartstore/LocalCartStore.cs b/src/cartservice/cartstore/LocalCartStore.cs index adbf177..c1228d5 100644 --- a/src/cartservice/cartstore/LocalCartStore.cs +++ b/src/cartservice/cartstore/LocalCartStore.cs @@ -82,5 +82,10 @@ namespace cartservice.cartstore return Task.FromResult(cart); } + + public bool Ping() + { + return true; + } } } \ No newline at end of file diff --git a/src/cartservice/cartstore/RedisCartStore.cs b/src/cartservice/cartstore/RedisCartStore.cs index aca60fb..bc7b7e8 100644 --- a/src/cartservice/cartstore/RedisCartStore.cs +++ b/src/cartservice/cartstore/RedisCartStore.cs @@ -197,5 +197,20 @@ namespace cartservice.cartstore throw new RpcException(new Status(StatusCode.FailedPrecondition, $"Can't access cart storage. {ex}")); } } + + public bool Ping() + { + try + { + var redis = ConnectionMultiplexer.Connect(redisConnectionOptions); + var cache = redis.GetDatabase(); + var res = cache.Ping(); + return res != TimeSpan.Zero; + } + catch (Exception) + { + return false; + } + } } } diff --git a/src/cartservice/generate_protos.bat b/src/cartservice/generate_protos.bat index 96b3428..9f22097 100644 --- a/src/cartservice/generate_protos.bat +++ b/src/cartservice/generate_protos.bat @@ -22,6 +22,6 @@ cd /d %~dp0 set NUGET_PATH=%UserProfile%\.nuget\packages set TOOLS_PATH=%NUGET_PATH%\Grpc.Tools\1.12.0\tools\windows_x64 -%TOOLS_PATH%\protoc.exe -I%~dp0/../../pb;%NUGET_PATH%\google.protobuf.tools\3.5.1\tools\ --csharp_out %~dp0 %~dp0\..\..\pb\demo.proto --grpc_out %~dp0 --plugin=protoc-gen-grpc=%TOOLS_PATH%\grpc_csharp_plugin.exe +%TOOLS_PATH%\protoc.exe -I%~dp0/../../pb;%NUGET_PATH%\google.protobuf.tools\3.5.1\tools\ --csharp_out %~dp0\grpc_generated %~dp0\..\..\pb\demo.proto --grpc_out %~dp0\grpc_generated --plugin=protoc-gen-grpc=%TOOLS_PATH%\grpc_csharp_plugin.exe endlocal diff --git a/src/cartservice/Demo.cs b/src/cartservice/grpc_generated/Demo.cs similarity index 87% rename from src/cartservice/Demo.cs rename to src/cartservice/grpc_generated/Demo.cs index c6d9925..f196131 100644 --- a/src/cartservice/Demo.cs +++ b/src/cartservice/grpc_generated/Demo.cs @@ -1,17 +1,3 @@ -// Copyright 2018 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - // // Generated by the protocol buffer compiler. DO NOT EDIT! // source: demo.proto @@ -47,84 +33,79 @@ namespace Hipstershop { "aG9wLkNhcnRJdGVtIgcKBUVtcHR5IkIKGkxpc3RSZWNvbW1lbmRhdGlvbnNS", "ZXF1ZXN0Eg8KB3VzZXJfaWQYASABKAkSEwoLcHJvZHVjdF9pZHMYAiADKAki", "MgobTGlzdFJlY29tbWVuZGF0aW9uc1Jlc3BvbnNlEhMKC3Byb2R1Y3RfaWRz", - "GAEgAygJInYKB1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AYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { @@ -145,22 +126,21 @@ namespace Hipstershop { new pbr::GeneratedClrTypeInfo(typeof(global::Hipstershop.GetQuoteResponse), global::Hipstershop.GetQuoteResponse.Parser, new[]{ "CostUsd" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Hipstershop.ShipOrderRequest), global::Hipstershop.ShipOrderRequest.Parser, new[]{ "Address", "Items" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Hipstershop.ShipOrderResponse), global::Hipstershop.ShipOrderResponse.Parser, new[]{ "TrackingId" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Hipstershop.Address), global::Hipstershop.Address.Parser, new[]{ "StreetAddress1", "StreetAddress2", "City", "Country", "ZipCode" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Hipstershop.MoneyAmount), global::Hipstershop.MoneyAmount.Parser, new[]{ "Decimal", "Fractional" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Hipstershop.Money), global::Hipstershop.Money.Parser, new[]{ "CurrencyCode", "Amount" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Hipstershop.Address), global::Hipstershop.Address.Parser, new[]{ "StreetAddress", "City", "State", "Country", "ZipCode" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Hipstershop.Money), global::Hipstershop.Money.Parser, new[]{ "CurrencyCode", "Units", "Nanos" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Hipstershop.GetSupportedCurrenciesResponse), global::Hipstershop.GetSupportedCurrenciesResponse.Parser, new[]{ "CurrencyCodes" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Hipstershop.ConversionRequest), global::Hipstershop.ConversionRequest.Parser, new[]{ "From", "ToCode" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Hipstershop.ConversionResponse), global::Hipstershop.ConversionResponse.Parser, new[]{ "Result" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Hipstershop.CurrencyConversionRequest), global::Hipstershop.CurrencyConversionRequest.Parser, new[]{ "From", "ToCode" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Hipstershop.CreditCardInfo), global::Hipstershop.CreditCardInfo.Parser, new[]{ "CreditCardNumber", "CreditCardCvv", "CreditCardExpirationYear", "CreditCardExpirationMonth" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Hipstershop.ChargeRequest), global::Hipstershop.ChargeRequest.Parser, new[]{ "Amount", "CreditCard" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Hipstershop.ChargeResponse), global::Hipstershop.ChargeResponse.Parser, new[]{ "TransactionId" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Hipstershop.OrderItem), global::Hipstershop.OrderItem.Parser, new[]{ "Item", "Cost" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Hipstershop.OrderResult), global::Hipstershop.OrderResult.Parser, new[]{ "OrderId", "ShippingTrackingId", "ShippingCost", "ShippingAddress", "Items" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Hipstershop.SendOrderConfirmationRequest), global::Hipstershop.SendOrderConfirmationRequest.Parser, new[]{ "Email", "Order" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Hipstershop.CreateOrderRequest), global::Hipstershop.CreateOrderRequest.Parser, new[]{ "UserId", "UserCurrency", "Address" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Hipstershop.CreateOrderResponse), global::Hipstershop.CreateOrderResponse.Parser, new[]{ "Items", "ShippingCost" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Hipstershop.PlaceOrderRequest), global::Hipstershop.PlaceOrderRequest.Parser, new[]{ "UserId", "UserCurrency", "Address", "Email", "CreditCard" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Hipstershop.PlaceOrderResponse), global::Hipstershop.PlaceOrderResponse.Parser, new[]{ "Order" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Hipstershop.PlaceOrderResponse), global::Hipstershop.PlaceOrderResponse.Parser, new[]{ "Order" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Hipstershop.AdRequest), global::Hipstershop.AdRequest.Parser, new[]{ "ContextKeys" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Hipstershop.AdResponse), global::Hipstershop.AdResponse.Parser, new[]{ "Ads" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Hipstershop.Ad), global::Hipstershop.Ad.Parser, new[]{ "RedirectUrl", "Text" }, null, null, null) })); } #endregion @@ -1349,9 +1329,9 @@ namespace Hipstershop { /// Field number for the "price_usd" field. public const int PriceUsdFieldNumber = 5; - private global::Hipstershop.MoneyAmount priceUsd_; + private global::Hipstershop.Money priceUsd_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Hipstershop.MoneyAmount PriceUsd { + public global::Hipstershop.Money PriceUsd { get { return priceUsd_; } set { priceUsd_ = value; @@ -1468,7 +1448,7 @@ namespace Hipstershop { } if (other.priceUsd_ != null) { if (priceUsd_ == null) { - priceUsd_ = new global::Hipstershop.MoneyAmount(); + priceUsd_ = new global::Hipstershop.Money(); } PriceUsd.MergeFrom(other.PriceUsd); } @@ -1501,7 +1481,7 @@ namespace Hipstershop { } case 42: { if (priceUsd_ == null) { - priceUsd_ = new global::Hipstershop.MoneyAmount(); + priceUsd_ = new global::Hipstershop.Money(); } input.ReadMessage(priceUsd_); break; @@ -2203,9 +2183,9 @@ namespace Hipstershop { /// Field number for the "cost_usd" field. public const int CostUsdFieldNumber = 1; - private global::Hipstershop.MoneyAmount costUsd_; + private global::Hipstershop.Money costUsd_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Hipstershop.MoneyAmount CostUsd { + public global::Hipstershop.Money CostUsd { get { return costUsd_; } set { costUsd_ = value; @@ -2274,7 +2254,7 @@ namespace Hipstershop { } if (other.costUsd_ != null) { if (costUsd_ == null) { - costUsd_ = new global::Hipstershop.MoneyAmount(); + costUsd_ = new global::Hipstershop.Money(); } CostUsd.MergeFrom(other.CostUsd); } @@ -2291,7 +2271,7 @@ namespace Hipstershop { break; case 10: { if (costUsd_ == null) { - costUsd_ = new global::Hipstershop.MoneyAmount(); + costUsd_ = new global::Hipstershop.Money(); } input.ReadMessage(costUsd_); break; @@ -2611,9 +2591,9 @@ namespace Hipstershop { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Address(Address other) : this() { - streetAddress1_ = other.streetAddress1_; - streetAddress2_ = other.streetAddress2_; + streetAddress_ = other.streetAddress_; city_ = other.city_; + state_ = other.state_; country_ = other.country_; zipCode_ = other.zipCode_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); @@ -2624,30 +2604,19 @@ namespace Hipstershop { return new Address(this); } - /// Field number for the "street_address_1" field. - public const int StreetAddress1FieldNumber = 1; - private string streetAddress1_ = ""; + /// Field number for the "street_address" field. + public const int StreetAddressFieldNumber = 1; + private string streetAddress_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string StreetAddress1 { - get { return streetAddress1_; } + public string StreetAddress { + get { return streetAddress_; } set { - streetAddress1_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "street_address_2" field. - public const int StreetAddress2FieldNumber = 2; - private string streetAddress2_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string StreetAddress2 { - get { return streetAddress2_; } - set { - streetAddress2_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + streetAddress_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } /// Field number for the "city" field. - public const int CityFieldNumber = 3; + public const int CityFieldNumber = 2; private string city_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string City { @@ -2657,6 +2626,17 @@ namespace Hipstershop { } } + /// Field number for the "state" field. + public const int StateFieldNumber = 3; + private string state_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string State { + get { return state_; } + set { + state_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + /// Field number for the "country" field. public const int CountryFieldNumber = 4; private string country_ = ""; @@ -2692,9 +2672,9 @@ namespace Hipstershop { if (ReferenceEquals(other, this)) { return true; } - if (StreetAddress1 != other.StreetAddress1) return false; - if (StreetAddress2 != other.StreetAddress2) return false; + if (StreetAddress != other.StreetAddress) return false; if (City != other.City) return false; + if (State != other.State) return false; if (Country != other.Country) return false; if (ZipCode != other.ZipCode) return false; return Equals(_unknownFields, other._unknownFields); @@ -2703,9 +2683,9 @@ namespace Hipstershop { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (StreetAddress1.Length != 0) hash ^= StreetAddress1.GetHashCode(); - if (StreetAddress2.Length != 0) hash ^= StreetAddress2.GetHashCode(); + if (StreetAddress.Length != 0) hash ^= StreetAddress.GetHashCode(); if (City.Length != 0) hash ^= City.GetHashCode(); + if (State.Length != 0) hash ^= State.GetHashCode(); if (Country.Length != 0) hash ^= Country.GetHashCode(); if (ZipCode != 0) hash ^= ZipCode.GetHashCode(); if (_unknownFields != null) { @@ -2721,18 +2701,18 @@ namespace Hipstershop { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (StreetAddress1.Length != 0) { + if (StreetAddress.Length != 0) { output.WriteRawTag(10); - output.WriteString(StreetAddress1); - } - if (StreetAddress2.Length != 0) { - output.WriteRawTag(18); - output.WriteString(StreetAddress2); + output.WriteString(StreetAddress); } if (City.Length != 0) { - output.WriteRawTag(26); + output.WriteRawTag(18); output.WriteString(City); } + if (State.Length != 0) { + output.WriteRawTag(26); + output.WriteString(State); + } if (Country.Length != 0) { output.WriteRawTag(34); output.WriteString(Country); @@ -2749,15 +2729,15 @@ namespace Hipstershop { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (StreetAddress1.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(StreetAddress1); - } - if (StreetAddress2.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(StreetAddress2); + if (StreetAddress.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(StreetAddress); } if (City.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(City); } + if (State.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(State); + } if (Country.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(Country); } @@ -2775,15 +2755,15 @@ namespace Hipstershop { if (other == null) { return; } - if (other.StreetAddress1.Length != 0) { - StreetAddress1 = other.StreetAddress1; - } - if (other.StreetAddress2.Length != 0) { - StreetAddress2 = other.StreetAddress2; + if (other.StreetAddress.Length != 0) { + StreetAddress = other.StreetAddress; } if (other.City.Length != 0) { City = other.City; } + if (other.State.Length != 0) { + State = other.State; + } if (other.Country.Length != 0) { Country = other.Country; } @@ -2802,15 +2782,15 @@ namespace Hipstershop { _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { - StreetAddress1 = input.ReadString(); + StreetAddress = input.ReadString(); break; } case 18: { - StreetAddress2 = input.ReadString(); + City = input.ReadString(); break; } case 26: { - City = input.ReadString(); + State = input.ReadString(); break; } case 34: { @@ -2828,166 +2808,8 @@ namespace Hipstershop { } /// - /// Describes a money amount without currency. For example, decimal=2 and - /// fractional=500 (or fractional=5) makes up 2.5 units. + /// Represents an amount of money with its currency type. /// - public sealed partial class MoneyAmount : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MoneyAmount()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Hipstershop.DemoReflection.Descriptor.MessageTypes[18]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MoneyAmount() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MoneyAmount(MoneyAmount other) : this() { - decimal_ = other.decimal_; - fractional_ = other.fractional_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MoneyAmount Clone() { - return new MoneyAmount(this); - } - - /// Field number for the "decimal" field. - public const int DecimalFieldNumber = 1; - private uint decimal_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public uint Decimal { - get { return decimal_; } - set { - decimal_ = value; - } - } - - /// Field number for the "fractional" field. - public const int FractionalFieldNumber = 2; - private uint fractional_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public uint Fractional { - get { return fractional_; } - set { - fractional_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as MoneyAmount); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(MoneyAmount other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Decimal != other.Decimal) return false; - if (Fractional != other.Fractional) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Decimal != 0) hash ^= Decimal.GetHashCode(); - if (Fractional != 0) hash ^= Fractional.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Decimal != 0) { - output.WriteRawTag(8); - output.WriteUInt32(Decimal); - } - if (Fractional != 0) { - output.WriteRawTag(16); - output.WriteUInt32(Fractional); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Decimal != 0) { - size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Decimal); - } - if (Fractional != 0) { - size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Fractional); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(MoneyAmount other) { - if (other == null) { - return; - } - if (other.Decimal != 0) { - Decimal = other.Decimal; - } - if (other.Fractional != 0) { - Fractional = other.Fractional; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Decimal = input.ReadUInt32(); - break; - } - case 16: { - Fractional = input.ReadUInt32(); - break; - } - } - } - } - - } - public sealed partial class Money : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Money()); private pb::UnknownFieldSet _unknownFields; @@ -2996,7 +2818,7 @@ namespace Hipstershop { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Hipstershop.DemoReflection.Descriptor.MessageTypes[19]; } + get { return global::Hipstershop.DemoReflection.Descriptor.MessageTypes[18]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3014,7 +2836,8 @@ namespace Hipstershop { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Money(Money other) : this() { currencyCode_ = other.currencyCode_; - Amount = other.amount_ != null ? other.Amount.Clone() : null; + units_ = other.units_; + nanos_ = other.nanos_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -3037,14 +2860,37 @@ namespace Hipstershop { } } - /// Field number for the "amount" field. - public const int AmountFieldNumber = 2; - private global::Hipstershop.MoneyAmount amount_; + /// Field number for the "units" field. + public const int UnitsFieldNumber = 2; + private long units_; + /// + /// The whole units of the amount. + /// For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar. + /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Hipstershop.MoneyAmount Amount { - get { return amount_; } + public long Units { + get { return units_; } set { - amount_ = value; + units_ = value; + } + } + + /// Field number for the "nanos" field. + public const int NanosFieldNumber = 3; + private int nanos_; + /// + /// Number of nano (10^-9) units of the amount. + /// The value must be between -999,999,999 and +999,999,999 inclusive. + /// If `units` is positive, `nanos` must be positive or zero. + /// If `units` is zero, `nanos` can be positive, zero, or negative. + /// If `units` is negative, `nanos` must be negative or zero. + /// For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Nanos { + get { return nanos_; } + set { + nanos_ = value; } } @@ -3062,7 +2908,8 @@ namespace Hipstershop { return true; } if (CurrencyCode != other.CurrencyCode) return false; - if (!object.Equals(Amount, other.Amount)) return false; + if (Units != other.Units) return false; + if (Nanos != other.Nanos) return false; return Equals(_unknownFields, other._unknownFields); } @@ -3070,7 +2917,8 @@ namespace Hipstershop { public override int GetHashCode() { int hash = 1; if (CurrencyCode.Length != 0) hash ^= CurrencyCode.GetHashCode(); - if (amount_ != null) hash ^= Amount.GetHashCode(); + if (Units != 0L) hash ^= Units.GetHashCode(); + if (Nanos != 0) hash ^= Nanos.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -3088,9 +2936,13 @@ namespace Hipstershop { output.WriteRawTag(10); output.WriteString(CurrencyCode); } - if (amount_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Amount); + if (Units != 0L) { + output.WriteRawTag(16); + output.WriteInt64(Units); + } + if (Nanos != 0) { + output.WriteRawTag(24); + output.WriteInt32(Nanos); } if (_unknownFields != null) { _unknownFields.WriteTo(output); @@ -3103,8 +2955,11 @@ namespace Hipstershop { if (CurrencyCode.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(CurrencyCode); } - if (amount_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Amount); + if (Units != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(Units); + } + if (Nanos != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Nanos); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); @@ -3120,11 +2975,11 @@ namespace Hipstershop { if (other.CurrencyCode.Length != 0) { CurrencyCode = other.CurrencyCode; } - if (other.amount_ != null) { - if (amount_ == null) { - amount_ = new global::Hipstershop.MoneyAmount(); - } - Amount.MergeFrom(other.Amount); + if (other.Units != 0L) { + Units = other.Units; + } + if (other.Nanos != 0) { + Nanos = other.Nanos; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -3141,11 +2996,12 @@ namespace Hipstershop { CurrencyCode = input.ReadString(); break; } - case 18: { - if (amount_ == null) { - amount_ = new global::Hipstershop.MoneyAmount(); - } - input.ReadMessage(amount_); + case 16: { + Units = input.ReadInt64(); + break; + } + case 24: { + Nanos = input.ReadInt32(); break; } } @@ -3162,7 +3018,7 @@ namespace Hipstershop { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Hipstershop.DemoReflection.Descriptor.MessageTypes[20]; } + get { return global::Hipstershop.DemoReflection.Descriptor.MessageTypes[19]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3278,15 +3134,15 @@ namespace Hipstershop { } - public sealed partial class ConversionRequest : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ConversionRequest()); + public sealed partial class CurrencyConversionRequest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CurrencyConversionRequest()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } + public static pb::MessageParser Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Hipstershop.DemoReflection.Descriptor.MessageTypes[21]; } + get { return global::Hipstershop.DemoReflection.Descriptor.MessageTypes[20]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3295,22 +3151,22 @@ namespace Hipstershop { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ConversionRequest() { + public CurrencyConversionRequest() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ConversionRequest(ConversionRequest other) : this() { + public CurrencyConversionRequest(CurrencyConversionRequest other) : this() { From = other.from_ != null ? other.From.Clone() : null; toCode_ = other.toCode_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ConversionRequest Clone() { - return new ConversionRequest(this); + public CurrencyConversionRequest Clone() { + return new CurrencyConversionRequest(this); } /// Field number for the "from" field. @@ -3340,11 +3196,11 @@ namespace Hipstershop { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { - return Equals(other as ConversionRequest); + return Equals(other as CurrencyConversionRequest); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ConversionRequest other) { + public bool Equals(CurrencyConversionRequest other) { if (ReferenceEquals(other, null)) { return false; } @@ -3403,7 +3259,7 @@ namespace Hipstershop { } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ConversionRequest other) { + public void MergeFrom(CurrencyConversionRequest other) { if (other == null) { return; } @@ -3444,141 +3300,6 @@ namespace Hipstershop { } - public sealed partial class ConversionResponse : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ConversionResponse()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Hipstershop.DemoReflection.Descriptor.MessageTypes[22]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ConversionResponse() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ConversionResponse(ConversionResponse other) : this() { - Result = other.result_ != null ? other.Result.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ConversionResponse Clone() { - return new ConversionResponse(this); - } - - /// Field number for the "result" field. - public const int ResultFieldNumber = 1; - private global::Hipstershop.Money result_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Hipstershop.Money Result { - get { return result_; } - set { - result_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ConversionResponse); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ConversionResponse other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(Result, other.Result)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (result_ != null) hash ^= Result.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (result_ != null) { - output.WriteRawTag(10); - output.WriteMessage(Result); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (result_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Result); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ConversionResponse other) { - if (other == null) { - return; - } - if (other.result_ != null) { - if (result_ == null) { - result_ = new global::Hipstershop.Money(); - } - Result.MergeFrom(other.Result); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (result_ == null) { - result_ = new global::Hipstershop.Money(); - } - input.ReadMessage(result_); - break; - } - } - } - } - - } - public sealed partial class CreditCardInfo : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CreditCardInfo()); private pb::UnknownFieldSet _unknownFields; @@ -3587,7 +3308,7 @@ namespace Hipstershop { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Hipstershop.DemoReflection.Descriptor.MessageTypes[23]; } + get { return global::Hipstershop.DemoReflection.Descriptor.MessageTypes[21]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3800,7 +3521,7 @@ namespace Hipstershop { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Hipstershop.DemoReflection.Descriptor.MessageTypes[24]; } + get { return global::Hipstershop.DemoReflection.Descriptor.MessageTypes[22]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3969,7 +3690,7 @@ namespace Hipstershop { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Hipstershop.DemoReflection.Descriptor.MessageTypes[25]; } + get { return global::Hipstershop.DemoReflection.Descriptor.MessageTypes[23]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4098,7 +3819,7 @@ namespace Hipstershop { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Hipstershop.DemoReflection.Descriptor.MessageTypes[26]; } + get { return global::Hipstershop.DemoReflection.Descriptor.MessageTypes[24]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4267,7 +3988,7 @@ namespace Hipstershop { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Hipstershop.DemoReflection.Descriptor.MessageTypes[27]; } + get { return global::Hipstershop.DemoReflection.Descriptor.MessageTypes[25]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4512,7 +4233,7 @@ namespace Hipstershop { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Hipstershop.DemoReflection.Descriptor.MessageTypes[28]; } + get { return global::Hipstershop.DemoReflection.Descriptor.MessageTypes[26]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4667,352 +4388,6 @@ namespace Hipstershop { } - public sealed partial class CreateOrderRequest : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CreateOrderRequest()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Hipstershop.DemoReflection.Descriptor.MessageTypes[29]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CreateOrderRequest() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CreateOrderRequest(CreateOrderRequest other) : this() { - userId_ = other.userId_; - userCurrency_ = other.userCurrency_; - Address = other.address_ != null ? other.Address.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CreateOrderRequest Clone() { - return new CreateOrderRequest(this); - } - - /// Field number for the "user_id" field. - public const int UserIdFieldNumber = 1; - private string userId_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string UserId { - get { return userId_; } - set { - userId_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "user_currency" field. - public const int UserCurrencyFieldNumber = 2; - private string userCurrency_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string UserCurrency { - get { return userCurrency_; } - set { - userCurrency_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "address" field. - public const int AddressFieldNumber = 3; - private global::Hipstershop.Address address_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Hipstershop.Address Address { - get { return address_; } - set { - address_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as CreateOrderRequest); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(CreateOrderRequest other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (UserId != other.UserId) return false; - if (UserCurrency != other.UserCurrency) return false; - if (!object.Equals(Address, other.Address)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (UserId.Length != 0) hash ^= UserId.GetHashCode(); - if (UserCurrency.Length != 0) hash ^= UserCurrency.GetHashCode(); - if (address_ != null) hash ^= Address.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (UserId.Length != 0) { - output.WriteRawTag(10); - output.WriteString(UserId); - } - if (UserCurrency.Length != 0) { - output.WriteRawTag(18); - output.WriteString(UserCurrency); - } - if (address_ != null) { - output.WriteRawTag(26); - output.WriteMessage(Address); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (UserId.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(UserId); - } - if (UserCurrency.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(UserCurrency); - } - if (address_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Address); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(CreateOrderRequest other) { - if (other == null) { - return; - } - if (other.UserId.Length != 0) { - UserId = other.UserId; - } - if (other.UserCurrency.Length != 0) { - UserCurrency = other.UserCurrency; - } - if (other.address_ != null) { - if (address_ == null) { - address_ = new global::Hipstershop.Address(); - } - Address.MergeFrom(other.Address); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - UserId = input.ReadString(); - break; - } - case 18: { - UserCurrency = input.ReadString(); - break; - } - case 26: { - if (address_ == null) { - address_ = new global::Hipstershop.Address(); - } - input.ReadMessage(address_); - break; - } - } - } - } - - } - - public sealed partial class CreateOrderResponse : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CreateOrderResponse()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Hipstershop.DemoReflection.Descriptor.MessageTypes[30]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CreateOrderResponse() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CreateOrderResponse(CreateOrderResponse other) : this() { - items_ = other.items_.Clone(); - ShippingCost = other.shippingCost_ != null ? other.ShippingCost.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CreateOrderResponse Clone() { - return new CreateOrderResponse(this); - } - - /// Field number for the "items" field. - public const int ItemsFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_items_codec - = pb::FieldCodec.ForMessage(10, global::Hipstershop.OrderItem.Parser); - private readonly pbc::RepeatedField items_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Items { - get { return items_; } - } - - /// Field number for the "shipping_cost" field. - public const int ShippingCostFieldNumber = 2; - private global::Hipstershop.Money shippingCost_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Hipstershop.Money ShippingCost { - get { return shippingCost_; } - set { - shippingCost_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as CreateOrderResponse); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(CreateOrderResponse other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!items_.Equals(other.items_)) return false; - if (!object.Equals(ShippingCost, other.ShippingCost)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= items_.GetHashCode(); - if (shippingCost_ != null) hash ^= ShippingCost.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - items_.WriteTo(output, _repeated_items_codec); - if (shippingCost_ != null) { - output.WriteRawTag(18); - output.WriteMessage(ShippingCost); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += items_.CalculateSize(_repeated_items_codec); - if (shippingCost_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(ShippingCost); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(CreateOrderResponse other) { - if (other == null) { - return; - } - items_.Add(other.items_); - if (other.shippingCost_ != null) { - if (shippingCost_ == null) { - shippingCost_ = new global::Hipstershop.Money(); - } - ShippingCost.MergeFrom(other.ShippingCost); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - items_.AddEntriesFrom(input, _repeated_items_codec); - break; - } - case 18: { - if (shippingCost_ == null) { - shippingCost_ = new global::Hipstershop.Money(); - } - input.ReadMessage(shippingCost_); - break; - } - } - } - } - - } - public sealed partial class PlaceOrderRequest : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PlaceOrderRequest()); private pb::UnknownFieldSet _unknownFields; @@ -5021,7 +4396,7 @@ namespace Hipstershop { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Hipstershop.DemoReflection.Descriptor.MessageTypes[31]; } + get { return global::Hipstershop.DemoReflection.Descriptor.MessageTypes[27]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5274,7 +4649,7 @@ namespace Hipstershop { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Hipstershop.DemoReflection.Descriptor.MessageTypes[32]; } + get { return global::Hipstershop.DemoReflection.Descriptor.MessageTypes[28]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5401,6 +4776,414 @@ namespace Hipstershop { } + public sealed partial class AdRequest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AdRequest()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Hipstershop.DemoReflection.Descriptor.MessageTypes[29]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AdRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AdRequest(AdRequest other) : this() { + contextKeys_ = other.contextKeys_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AdRequest Clone() { + return new AdRequest(this); + } + + /// Field number for the "context_keys" field. + public const int ContextKeysFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_contextKeys_codec + = pb::FieldCodec.ForString(10); + private readonly pbc::RepeatedField contextKeys_ = new pbc::RepeatedField(); + /// + /// List of important key words from the current page describing the context. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField ContextKeys { + get { return contextKeys_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as AdRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(AdRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!contextKeys_.Equals(other.contextKeys_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + hash ^= contextKeys_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + contextKeys_.WriteTo(output, _repeated_contextKeys_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + size += contextKeys_.CalculateSize(_repeated_contextKeys_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(AdRequest other) { + if (other == null) { + return; + } + contextKeys_.Add(other.contextKeys_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + contextKeys_.AddEntriesFrom(input, _repeated_contextKeys_codec); + break; + } + } + } + } + + } + + public sealed partial class AdResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AdResponse()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Hipstershop.DemoReflection.Descriptor.MessageTypes[30]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AdResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AdResponse(AdResponse other) : this() { + ads_ = other.ads_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AdResponse Clone() { + return new AdResponse(this); + } + + /// Field number for the "ads" field. + public const int AdsFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_ads_codec + = pb::FieldCodec.ForMessage(10, global::Hipstershop.Ad.Parser); + private readonly pbc::RepeatedField ads_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Ads { + get { return ads_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as AdResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(AdResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!ads_.Equals(other.ads_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + hash ^= ads_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + ads_.WriteTo(output, _repeated_ads_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + size += ads_.CalculateSize(_repeated_ads_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(AdResponse other) { + if (other == null) { + return; + } + ads_.Add(other.ads_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + ads_.AddEntriesFrom(input, _repeated_ads_codec); + break; + } + } + } + } + + } + + public sealed partial class Ad : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Ad()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Hipstershop.DemoReflection.Descriptor.MessageTypes[31]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Ad() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Ad(Ad other) : this() { + redirectUrl_ = other.redirectUrl_; + text_ = other.text_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Ad Clone() { + return new Ad(this); + } + + /// Field number for the "redirect_url" field. + public const int RedirectUrlFieldNumber = 1; + private string redirectUrl_ = ""; + /// + /// url to redirect to when an ad is clicked. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string RedirectUrl { + get { return redirectUrl_; } + set { + redirectUrl_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "text" field. + public const int TextFieldNumber = 2; + private string text_ = ""; + /// + /// short advertisement text to display. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Text { + get { return text_; } + set { + text_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as Ad); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(Ad other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (RedirectUrl != other.RedirectUrl) return false; + if (Text != other.Text) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (RedirectUrl.Length != 0) hash ^= RedirectUrl.GetHashCode(); + if (Text.Length != 0) hash ^= Text.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (RedirectUrl.Length != 0) { + output.WriteRawTag(10); + output.WriteString(RedirectUrl); + } + if (Text.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Text); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (RedirectUrl.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(RedirectUrl); + } + if (Text.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Text); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(Ad other) { + if (other == null) { + return; + } + if (other.RedirectUrl.Length != 0) { + RedirectUrl = other.RedirectUrl; + } + if (other.Text.Length != 0) { + Text = other.Text; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + RedirectUrl = input.ReadString(); + break; + } + case 18: { + Text = input.ReadString(); + break; + } + } + } + } + + } + #endregion } diff --git a/src/cartservice/DemoGrpc.cs b/src/cartservice/grpc_generated/DemoGrpc.cs similarity index 89% rename from src/cartservice/DemoGrpc.cs rename to src/cartservice/grpc_generated/DemoGrpc.cs index 30fa0e5..fa263ae 100644 --- a/src/cartservice/DemoGrpc.cs +++ b/src/cartservice/grpc_generated/DemoGrpc.cs @@ -1,17 +1,3 @@ -// Copyright 2018 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - // // Generated by the protocol buffer compiler. DO NOT EDIT! // source: demo.proto @@ -522,8 +508,8 @@ namespace Hipstershop { static readonly grpc::Marshaller __Marshaller_Empty = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.Empty.Parser.ParseFrom); static readonly grpc::Marshaller __Marshaller_GetSupportedCurrenciesResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.GetSupportedCurrenciesResponse.Parser.ParseFrom); - static readonly grpc::Marshaller __Marshaller_ConversionRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.ConversionRequest.Parser.ParseFrom); - static readonly grpc::Marshaller __Marshaller_ConversionResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.ConversionResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_CurrencyConversionRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.CurrencyConversionRequest.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_Money = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.Money.Parser.ParseFrom); static readonly grpc::Method __Method_GetSupportedCurrencies = new grpc::Method( grpc::MethodType.Unary, @@ -532,12 +518,12 @@ namespace Hipstershop { __Marshaller_Empty, __Marshaller_GetSupportedCurrenciesResponse); - static readonly grpc::Method __Method_Convert = new grpc::Method( + static readonly grpc::Method __Method_Convert = new grpc::Method( grpc::MethodType.Unary, __ServiceName, "Convert", - __Marshaller_ConversionRequest, - __Marshaller_ConversionResponse); + __Marshaller_CurrencyConversionRequest, + __Marshaller_Money); /// Service descriptor public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor @@ -553,7 +539,7 @@ namespace Hipstershop { throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); } - public virtual global::System.Threading.Tasks.Task Convert(global::Hipstershop.ConversionRequest request, grpc::ServerCallContext context) + public virtual global::System.Threading.Tasks.Task Convert(global::Hipstershop.CurrencyConversionRequest request, grpc::ServerCallContext context) { throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); } @@ -599,19 +585,19 @@ namespace Hipstershop { { return CallInvoker.AsyncUnaryCall(__Method_GetSupportedCurrencies, null, options, request); } - public virtual global::Hipstershop.ConversionResponse Convert(global::Hipstershop.ConversionRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + public virtual global::Hipstershop.Money Convert(global::Hipstershop.CurrencyConversionRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) { return Convert(request, new grpc::CallOptions(headers, deadline, cancellationToken)); } - public virtual global::Hipstershop.ConversionResponse Convert(global::Hipstershop.ConversionRequest request, grpc::CallOptions options) + public virtual global::Hipstershop.Money Convert(global::Hipstershop.CurrencyConversionRequest request, grpc::CallOptions options) { return CallInvoker.BlockingUnaryCall(__Method_Convert, null, options, request); } - public virtual grpc::AsyncUnaryCall ConvertAsync(global::Hipstershop.ConversionRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + public virtual grpc::AsyncUnaryCall ConvertAsync(global::Hipstershop.CurrencyConversionRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) { return ConvertAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); } - public virtual grpc::AsyncUnaryCall ConvertAsync(global::Hipstershop.ConversionRequest request, grpc::CallOptions options) + public virtual grpc::AsyncUnaryCall ConvertAsync(global::Hipstershop.CurrencyConversionRequest request, grpc::CallOptions options) { return CallInvoker.AsyncUnaryCall(__Method_Convert, null, options, request); } @@ -806,18 +792,9 @@ namespace Hipstershop { { static readonly string __ServiceName = "hipstershop.CheckoutService"; - static readonly grpc::Marshaller __Marshaller_CreateOrderRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.CreateOrderRequest.Parser.ParseFrom); - static readonly grpc::Marshaller __Marshaller_CreateOrderResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.CreateOrderResponse.Parser.ParseFrom); static readonly grpc::Marshaller __Marshaller_PlaceOrderRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.PlaceOrderRequest.Parser.ParseFrom); static readonly grpc::Marshaller __Marshaller_PlaceOrderResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.PlaceOrderResponse.Parser.ParseFrom); - static readonly grpc::Method __Method_CreateOrder = new grpc::Method( - grpc::MethodType.Unary, - __ServiceName, - "CreateOrder", - __Marshaller_CreateOrderRequest, - __Marshaller_CreateOrderResponse); - static readonly grpc::Method __Method_PlaceOrder = new grpc::Method( grpc::MethodType.Unary, __ServiceName, @@ -834,11 +811,6 @@ namespace Hipstershop { /// Base class for server-side implementations of CheckoutService public abstract partial class CheckoutServiceBase { - public virtual global::System.Threading.Tasks.Task CreateOrder(global::Hipstershop.CreateOrderRequest request, grpc::ServerCallContext context) - { - throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); - } - public virtual global::System.Threading.Tasks.Task PlaceOrder(global::Hipstershop.PlaceOrderRequest request, grpc::ServerCallContext context) { throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); @@ -869,22 +841,6 @@ namespace Hipstershop { { } - public virtual global::Hipstershop.CreateOrderResponse CreateOrder(global::Hipstershop.CreateOrderRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return CreateOrder(request, new grpc::CallOptions(headers, deadline, cancellationToken)); - } - public virtual global::Hipstershop.CreateOrderResponse CreateOrder(global::Hipstershop.CreateOrderRequest request, grpc::CallOptions options) - { - return CallInvoker.BlockingUnaryCall(__Method_CreateOrder, null, options, request); - } - public virtual grpc::AsyncUnaryCall CreateOrderAsync(global::Hipstershop.CreateOrderRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - return CreateOrderAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); - } - public virtual grpc::AsyncUnaryCall CreateOrderAsync(global::Hipstershop.CreateOrderRequest request, grpc::CallOptions options) - { - return CallInvoker.AsyncUnaryCall(__Method_CreateOrder, null, options, request); - } public virtual global::Hipstershop.PlaceOrderResponse PlaceOrder(global::Hipstershop.PlaceOrderRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) { return PlaceOrder(request, new grpc::CallOptions(headers, deadline, cancellationToken)); @@ -913,10 +869,94 @@ namespace Hipstershop { public static grpc::ServerServiceDefinition BindService(CheckoutServiceBase serviceImpl) { return grpc::ServerServiceDefinition.CreateBuilder() - .AddMethod(__Method_CreateOrder, serviceImpl.CreateOrder) .AddMethod(__Method_PlaceOrder, serviceImpl.PlaceOrder).Build(); } } + public static partial class AdService + { + static readonly string __ServiceName = "hipstershop.AdService"; + + static readonly grpc::Marshaller __Marshaller_AdRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.AdRequest.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_AdResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Hipstershop.AdResponse.Parser.ParseFrom); + + static readonly grpc::Method __Method_GetAds = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetAds", + __Marshaller_AdRequest, + __Marshaller_AdResponse); + + /// Service descriptor + public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor + { + get { return global::Hipstershop.DemoReflection.Descriptor.Services[8]; } + } + + /// Base class for server-side implementations of AdService + public abstract partial class AdServiceBase + { + public virtual global::System.Threading.Tasks.Task GetAds(global::Hipstershop.AdRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + } + + /// Client for AdService + public partial class AdServiceClient : grpc::ClientBase + { + /// Creates a new client for AdService + /// The channel to use to make remote calls. + public AdServiceClient(grpc::Channel channel) : base(channel) + { + } + /// Creates a new client for AdService that uses a custom CallInvoker. + /// The callInvoker to use to make remote calls. + public AdServiceClient(grpc::CallInvoker callInvoker) : base(callInvoker) + { + } + /// Protected parameterless constructor to allow creation of test doubles. + protected AdServiceClient() : base() + { + } + /// Protected constructor to allow creation of configured clients. + /// The client configuration. + protected AdServiceClient(ClientBaseConfiguration configuration) : base(configuration) + { + } + + public virtual global::Hipstershop.AdResponse GetAds(global::Hipstershop.AdRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetAds(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::Hipstershop.AdResponse GetAds(global::Hipstershop.AdRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetAds, null, options, request); + } + public virtual grpc::AsyncUnaryCall GetAdsAsync(global::Hipstershop.AdRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + return GetAdsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall GetAdsAsync(global::Hipstershop.AdRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetAds, null, options, request); + } + /// Creates a new instance of client from given ClientBaseConfiguration. + protected override AdServiceClient NewInstance(ClientBaseConfiguration configuration) + { + return new AdServiceClient(configuration); + } + } + + /// Creates service definition that can be registered with a server + /// An object implementing the server-side handling logic. + public static grpc::ServerServiceDefinition BindService(AdServiceBase serviceImpl) + { + return grpc::ServerServiceDefinition.CreateBuilder() + .AddMethod(__Method_GetAds, serviceImpl.GetAds).Build(); + } + + } } #endregion diff --git a/src/cartservice/interfaces/ICartStore.cs b/src/cartservice/interfaces/ICartStore.cs index 51afaa1..8c5e225 100644 --- a/src/cartservice/interfaces/ICartStore.cs +++ b/src/cartservice/interfaces/ICartStore.cs @@ -24,5 +24,7 @@ namespace cartservice.interfaces Task EmptyCartAsync(string userId); Task GetCartAsync(string userId); + + bool Ping(); } } \ No newline at end of file