From ab8bf7e55cedc6176fec9825fc3e15f94019b485 Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Thu, 21 Jun 2018 11:06:53 -0700 Subject: [PATCH 1/9] ignore/delete *.pyc Signed-off-by: Ahmet Alp Balkan --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 239beea..8fe4c79 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .DS_Store +*.pyc *.swp *~ From 8860d8bfddf9adda8f7c81e1ef8195bfb1634e9d Mon Sep 17 00:00:00 2001 From: Simon Zeltser Date: Thu, 21 Jun 2018 11:09:12 -0700 Subject: [PATCH 2/9] added redis integration and command line arguments handling to cart service. Didn't test in the cloud yet --- .gitignore | 3 + .vscode/launch.json | 28 +++++++ .vscode/tasks.json | 15 ++++ src/cartservice/cartstore/LocalCartStore.cs | 41 ++++++++++ src/cartservice/cartstore/RedisCartStore.cs | 74 +++++++++++++++++++ src/cartservice/interfaces/ICartStore.cs | 12 +++ .../run_redis_emulator_windows.bat | 11 +++ 7 files changed, 184 insertions(+) create mode 100644 .gitignore create mode 100644 .vscode/launch.json create mode 100644 .vscode/tasks.json create mode 100644 src/cartservice/cartstore/LocalCartStore.cs create mode 100644 src/cartservice/cartstore/RedisCartStore.cs create mode 100644 src/cartservice/interfaces/ICartStore.cs create mode 100644 src/cartservice/run_redis_emulator_windows.bat diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cf3cbd3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +src/cartservice/bin/* +src/cartservice/obj/* +.vs/*.* \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..6cba3ec --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,28 @@ +{ + // Use IntelliSense to find out which attributes exist for C# debugging + // Use hover for the description of the existing attributes + // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md + "version": "0.2.0", + "configurations": [ + { + "name": ".NET Core Launch (console)", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + // If you have changed target frameworks, make sure to update the program path. + "program": "${workspaceFolder}/src/cartservice/bin/Debug/netcoreapp2.0/cartservice.dll", + "args": [], + "cwd": "${workspaceFolder}/src/cartservice", + // For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window + "console": "internalConsole", + "stopAtEntry": false, + "internalConsoleOptions": "openOnSessionStart" + }, + { + "name": ".NET Core Attach", + "type": "coreclr", + "request": "attach", + "processId": "${command:pickProcess}" + } + ,] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..ac157b4 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,15 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/src/cartservice/cartservice.csproj" + ], + "problemMatcher": "$msCompile" + } + ] +} \ No newline at end of file diff --git a/src/cartservice/cartstore/LocalCartStore.cs b/src/cartservice/cartstore/LocalCartStore.cs new file mode 100644 index 0000000..66c8d40 --- /dev/null +++ b/src/cartservice/cartstore/LocalCartStore.cs @@ -0,0 +1,41 @@ +using System.Collections.Concurrent; +using cartservice.interfaces; + +namespace cartservice.cartstore +{ + internal class LocalCartStore + { + // Maps between user and their cart + private ConcurrentDictionary userCartItems = new ConcurrentDictionary(); + + public void AddItem(string userId, string productId, int quantity) + { + Cart cart; + if (!userCartItems.TryGetValue(userId, out cart)) + { + cart = new Cart(userId); + } + else + { + cart = userCartItems[userId]; + } + cart.AddItem(productId, quantity); + } + + public void EmptyCart(string userId) + { + Cart cart; + if (userCartItems.TryGetValue(userId, out cart)) + { + cart.EmptyCart(); + } + } + + public Cart GetCart(string userId) + { + Cart cart = null; + userCartItems.TryGetValue(userId, out cart); + return cart; + } + } +} \ No newline at end of file diff --git a/src/cartservice/cartstore/RedisCartStore.cs b/src/cartservice/cartstore/RedisCartStore.cs new file mode 100644 index 0000000..8745a19 --- /dev/null +++ b/src/cartservice/cartstore/RedisCartStore.cs @@ -0,0 +1,74 @@ +using System; +using System.IO; +using System.Threading.Tasks; +using cartservice.interfaces; +using Google.Protobuf; +using Hipstershop; +using StackExchange.Redis; + +namespace cartservice.cartstore +{ + public class RedisCartStore : ICartStore + { + private const string CART_FIELD_NAME = "cart"; + + private readonly ConnectionMultiplexer redis; + + private readonly byte[] emptyCartBytes; + + public RedisCartStore(string redisAddress) + { + // Serialize empty cart into byte array. + var cart = new Hipstershop.Cart(); + emptyCartBytes = cart.ToByteArray(); + + string connectionString = $"{redisAddress},ssl=false,allowAdmin=true"; + Console.WriteLine("Connecting to Redis: " + connectionString); + redis = ConnectionMultiplexer.Connect(connectionString); + } + + public async Task AddItemAsync(string userId, string productId, int quantity) + { + var db = redis.GetDatabase(); + + // Access the cart from the cache + var value = await db.HashGetAsync(userId, CART_FIELD_NAME); + + Hipstershop.Cart cart; + if (value.IsNull) + { + cart = new Hipstershop.Cart(); + } + else + { + cart = Hipstershop.Cart.Parser.ParseFrom(value); + } + + cart.Items.Add(new Hipstershop.CartItem { ProductId = productId, Quantity = quantity }); + } + + public async Task EmptyCartAsync(string userId) + { + var db = redis.GetDatabase(); + + // Update the cache with empty cart for given user + await db.HashSetAsync(userId, new[] { new HashEntry(CART_FIELD_NAME, emptyCartBytes) }); + } + + public async Task GetCartAsync(string userId) + { + var db = redis.GetDatabase(); + + // Access the cart from the cache + var value = await db.HashGetAsync(userId, CART_FIELD_NAME); + + Hipstershop.Cart cart = null; + if (!value.IsNull) + { + cart = Hipstershop.Cart.Parser.ParseFrom(value); + } + + return cart; + } + } +} \ No newline at end of file diff --git a/src/cartservice/interfaces/ICartStore.cs b/src/cartservice/interfaces/ICartStore.cs new file mode 100644 index 0000000..f4fa1e5 --- /dev/null +++ b/src/cartservice/interfaces/ICartStore.cs @@ -0,0 +1,12 @@ +using System.Threading.Tasks; + +namespace cartservice.interfaces +{ + internal interface ICartStore + { + Task AddItemAsync(string userId, string productId, int quantity); + Task EmptyCartAsync(string userId); + + Task GetCartAsync(string userId); + } +} \ No newline at end of file diff --git a/src/cartservice/run_redis_emulator_windows.bat b/src/cartservice/run_redis_emulator_windows.bat new file mode 100644 index 0000000..8b1d9c0 --- /dev/null +++ b/src/cartservice/run_redis_emulator_windows.bat @@ -0,0 +1,11 @@ +@echo off +rem install redis on windows using choco +rem choco install redis-64 + +rem run redis +redis-server --daemonize yes + +rem testing locally +rem redis-cli +rem SET foo bar +rem GET foo \ No newline at end of file From 0ce195bb80156b2652bc28df3d971da166bd0635 Mon Sep 17 00:00:00 2001 From: Simon Zeltser Date: Thu, 21 Jun 2018 11:10:13 -0700 Subject: [PATCH 3/9] command line arguments handling --- src/cartservice/CartServiceImpl.cs | 59 ++++++------------------------ src/cartservice/Program.cs | 44 +++++++++++++++++++--- src/cartservice/cartservice.csproj | 3 ++ 3 files changed, 53 insertions(+), 53 deletions(-) diff --git a/src/cartservice/CartServiceImpl.cs b/src/cartservice/CartServiceImpl.cs index e1cbb49..c6c4887 100644 --- a/src/cartservice/CartServiceImpl.cs +++ b/src/cartservice/CartServiceImpl.cs @@ -2,6 +2,7 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using cartservice.interfaces; using Grpc.Core; using Hipstershop; using static Hipstershop.CartService; @@ -11,65 +12,29 @@ namespace cartservice // Cart wrapper to deal with grpc communication internal class CartServiceImpl : CartServiceBase { - private CartStore cartStore; + private ICartStore cartStore; + private readonly static Empty Empty = new Empty(); - public CartServiceImpl(CartStore cartStore) + public CartServiceImpl(ICartStore cartStore) { this.cartStore = cartStore; } - public override Task AddItem(AddItemRequest request, Grpc.Core.ServerCallContext context) + public async override Task AddItem(AddItemRequest request, Grpc.Core.ServerCallContext context) { - cartStore.AddItem(request.UserId, request.Item.ProductId, request.Item.Quantity); - return Task.FromResult(new Empty()); + await cartStore.AddItemAsync(request.UserId, request.Item.ProductId, request.Item.Quantity); + return Empty; } - public override Task EmptyCart(EmptyCartRequest request, ServerCallContext context) + public async override Task EmptyCart(EmptyCartRequest request, ServerCallContext context) { - cartStore.EmptyCart(request.UserId); - return Task.FromResult(new Empty()); + await cartStore.EmptyCartAsync(request.UserId); + return Empty; } - public override Task GetCart(GetCartRequest request, ServerCallContext context) + public async override Task GetCart(GetCartRequest request, ServerCallContext context) { - var cart = cartStore.GetCart(request.UserId); - return Task.FromResult(cart.ToHipsterCart()); - } - } - - internal class CartStore - { - // Maps between user and their cart - private ConcurrentDictionary userCartItems = new ConcurrentDictionary(); - - public void AddItem(string userId, string productId, int quantity) - { - Cart cart; - if (!userCartItems.TryGetValue(userId, out cart)) - { - cart = new Cart(userId); - } - else - { - cart = userCartItems[userId]; - } - cart.AddItem(productId, quantity); - } - - public void EmptyCart(string userId) - { - Cart cart; - if (userCartItems.TryGetValue(userId, out cart)) - { - cart.EmptyCart(); - } - } - - public Cart GetCart(string userId) - { - Cart cart = null; - userCartItems.TryGetValue(userId, out cart); - return cart; + return await cartStore.GetCartAsync(request.UserId); } } diff --git a/src/cartservice/Program.cs b/src/cartservice/Program.cs index 8d4e396..1902144 100644 --- a/src/cartservice/Program.cs +++ b/src/cartservice/Program.cs @@ -1,29 +1,41 @@ using System; +using System.IO; +using cartservice.cartstore; using CommandLine; using Grpc.Core; +using Microsoft.Extensions.Configuration; namespace cartservice { class Program { + const string CART_SERVICE_ADDRESS = "CART_SERVICE_ADDR"; + const string REDIS_ADDRESS = "REDIS_ADDR"; + [Verb("start", HelpText = "Starts the server listening on provided port")] class ServerOptions { + [Option('h', "hostname", HelpText = "The ip on which the server is running. If not provided, CART_SERVICE_ADDR environment variable value will be used. If not defined, localhost is used")] + public string Host { get; set; } [Option('p', "port", HelpText = "The port on for running the server", Required = true)] public int Port { get; set; } + + [Option('r', "redis", HelpText = "The ip of redis cache")] + public string Redis { get; set; } + } - static object StartServer(string host, int port) + static object StartServer(string host, int port, string redisAddress) { - var store = new CartStore(); + var store = new RedisCartStore(redisAddress); Server server = new Server { Services = { Hipstershop.CartService.BindService(new CartServiceImpl(store)) }, Ports = { new ServerPort(host, port, ServerCredentials.Insecure) } }; - Console.WriteLine("Cart server is listening on port " + port); + Console.WriteLine($"Cart server is listening at {host}:{port}"); Console.WriteLine("Press any key to stop the server..."); server.Start(); @@ -33,6 +45,7 @@ namespace cartservice return null; } + static void Main(string[] args) { if (args.Length == 0) @@ -45,15 +58,34 @@ namespace cartservice { case "start": Parser.Default.ParseArguments(args).MapResult( - (ServerOptions options) => StartServer("localhost", options.Port), + (ServerOptions options) => + { + string host = options.Host; + if (string.IsNullOrEmpty(host)) + { + Console.WriteLine($"Reading host address from {CART_SERVICE_ADDRESS} environment variable..."); + host = Environment.GetEnvironmentVariable(CART_SERVICE_ADDRESS); + if (string.IsNullOrEmpty(host)) + { + Console.WriteLine("Setting the host to 127.0.0.1"); + host = "127.0.0.1"; + } + } + + string redis = options.Redis; + if (string.IsNullOrEmpty(redis)) + { + Console.WriteLine("Reading redis cache address from environment variable"); + redis = Environment.GetEnvironmentVariable(REDIS_ADDRESS); + } + return StartServer(host, options.Port, redis); + }, errs => 1); break; default: Console.WriteLine("Invalid command"); break; } - - Console.WriteLine("Hello World!"); } } } diff --git a/src/cartservice/cartservice.csproj b/src/cartservice/cartservice.csproj index fddba5c..6298870 100644 --- a/src/cartservice/cartservice.csproj +++ b/src/cartservice/cartservice.csproj @@ -11,6 +11,9 @@ + + + From af9db7b021a73c2cf1335b70306946bd8fec501c Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Thu, 21 Jun 2018 11:12:17 -0700 Subject: [PATCH 4/9] recommendationsvc: compile_proto.sh -> genproto.sh Signed-off-by: Ahmet Alp Balkan --- src/recommendationservice/{compile_proto.sh => genproto.sh} | 3 +++ 1 file changed, 3 insertions(+) rename src/recommendationservice/{compile_proto.sh => genproto.sh} (90%) diff --git a/src/recommendationservice/compile_proto.sh b/src/recommendationservice/genproto.sh similarity index 90% rename from src/recommendationservice/compile_proto.sh rename to src/recommendationservice/genproto.sh index e3e0761..d1195d2 100755 --- a/src/recommendationservice/compile_proto.sh +++ b/src/recommendationservice/genproto.sh @@ -1,3 +1,6 @@ +#!/bin/bash +set -e + # script to compile python protos # # requires gRPC tools: From d7d9165da6dceb9544c44708e81ceb7a76041e55 Mon Sep 17 00:00:00 2001 From: Simon Zeltser Date: Thu, 21 Jun 2018 11:19:48 -0700 Subject: [PATCH 5/9] added gitignore file for .net proj --- src/cartservice/.gitignore | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 src/cartservice/.gitignore diff --git a/src/cartservice/.gitignore b/src/cartservice/.gitignore new file mode 100644 index 0000000..f983350 --- /dev/null +++ b/src/cartservice/.gitignore @@ -0,0 +1,3 @@ +/bin/* +/obj/* +.vs/*.* From b91d97f673b23022c92a36c998d51e40dccc0f62 Mon Sep 17 00:00:00 2001 From: Simon Zeltser Date: Thu, 21 Jun 2018 11:22:23 -0700 Subject: [PATCH 6/9] remove .gitignore changes for cart service - they should be in cart service folder --- .gitignore | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 .gitignore diff --git a/.gitignore b/.gitignore deleted file mode 100644 index cf3cbd3..0000000 --- a/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -src/cartservice/bin/* -src/cartservice/obj/* -.vs/*.* \ No newline at end of file From 164e52fa448e4eebd05c110ec5f56b2834164b86 Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Thu, 21 Jun 2018 11:44:47 -0700 Subject: [PATCH 7/9] checkoutservice: add code stubs, TODO implement Signed-off-by: Ahmet Alp Balkan --- .gitignore | 2 + src/checkoutservice/genproto.sh | 6 + src/checkoutservice/genproto/demo.pb.go | 2393 +++++++++++++++++++++++ src/checkoutservice/main.go | 70 + 4 files changed, 2471 insertions(+) create mode 100755 src/checkoutservice/genproto.sh create mode 100644 src/checkoutservice/genproto/demo.pb.go create mode 100644 src/checkoutservice/main.go diff --git a/.gitignore b/.gitignore index 8fe4c79..577ce36 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +bin/ +pkg/ .DS_Store *.pyc *.swp diff --git a/src/checkoutservice/genproto.sh b/src/checkoutservice/genproto.sh new file mode 100755 index 0000000..1855f6b --- /dev/null +++ b/src/checkoutservice/genproto.sh @@ -0,0 +1,6 @@ +#!/bin/bash -e + +PATH=$PATH:$GOPATH/bin +protodir=../../pb + +protoc --go_out=plugins=grpc:genproto -I $protodir $protodir/demo.proto diff --git a/src/checkoutservice/genproto/demo.pb.go b/src/checkoutservice/genproto/demo.pb.go new file mode 100644 index 0000000..d547682 --- /dev/null +++ b/src/checkoutservice/genproto/demo.pb.go @@ -0,0 +1,2393 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: demo.proto + +package hipstershop + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type CartItem struct { + ProductId string `protobuf:"bytes,1,opt,name=product_id,json=productId" json:"product_id,omitempty"` + Quantity int32 `protobuf:"varint,2,opt,name=quantity" json:"quantity,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CartItem) Reset() { *m = CartItem{} } +func (m *CartItem) String() string { return proto.CompactTextString(m) } +func (*CartItem) ProtoMessage() {} +func (*CartItem) Descriptor() ([]byte, []int) { + return fileDescriptor_demo_40506d781b7ed975, []int{0} +} +func (m *CartItem) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CartItem.Unmarshal(m, b) +} +func (m *CartItem) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CartItem.Marshal(b, m, deterministic) +} +func (dst *CartItem) XXX_Merge(src proto.Message) { + xxx_messageInfo_CartItem.Merge(dst, src) +} +func (m *CartItem) XXX_Size() int { + return xxx_messageInfo_CartItem.Size(m) +} +func (m *CartItem) XXX_DiscardUnknown() { + xxx_messageInfo_CartItem.DiscardUnknown(m) +} + +var xxx_messageInfo_CartItem proto.InternalMessageInfo + +func (m *CartItem) GetProductId() string { + if m != nil { + return m.ProductId + } + return "" +} + +func (m *CartItem) GetQuantity() int32 { + if m != nil { + return m.Quantity + } + return 0 +} + +type AddItemRequest struct { + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId" json:"user_id,omitempty"` + Item *CartItem `protobuf:"bytes,2,opt,name=item" json:"item,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AddItemRequest) Reset() { *m = AddItemRequest{} } +func (m *AddItemRequest) String() string { return proto.CompactTextString(m) } +func (*AddItemRequest) ProtoMessage() {} +func (*AddItemRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_demo_40506d781b7ed975, []int{1} +} +func (m *AddItemRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AddItemRequest.Unmarshal(m, b) +} +func (m *AddItemRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AddItemRequest.Marshal(b, m, deterministic) +} +func (dst *AddItemRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AddItemRequest.Merge(dst, src) +} +func (m *AddItemRequest) XXX_Size() int { + return xxx_messageInfo_AddItemRequest.Size(m) +} +func (m *AddItemRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AddItemRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_AddItemRequest proto.InternalMessageInfo + +func (m *AddItemRequest) GetUserId() string { + if m != nil { + return m.UserId + } + return "" +} + +func (m *AddItemRequest) GetItem() *CartItem { + if m != nil { + return m.Item + } + return nil +} + +type EmptyCartRequest struct { + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId" json:"user_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EmptyCartRequest) Reset() { *m = EmptyCartRequest{} } +func (m *EmptyCartRequest) String() string { return proto.CompactTextString(m) } +func (*EmptyCartRequest) ProtoMessage() {} +func (*EmptyCartRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_demo_40506d781b7ed975, []int{2} +} +func (m *EmptyCartRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_EmptyCartRequest.Unmarshal(m, b) +} +func (m *EmptyCartRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_EmptyCartRequest.Marshal(b, m, deterministic) +} +func (dst *EmptyCartRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_EmptyCartRequest.Merge(dst, src) +} +func (m *EmptyCartRequest) XXX_Size() int { + return xxx_messageInfo_EmptyCartRequest.Size(m) +} +func (m *EmptyCartRequest) XXX_DiscardUnknown() { + xxx_messageInfo_EmptyCartRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_EmptyCartRequest proto.InternalMessageInfo + +func (m *EmptyCartRequest) GetUserId() string { + if m != nil { + return m.UserId + } + return "" +} + +type GetCartRequest struct { + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId" json:"user_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetCartRequest) Reset() { *m = GetCartRequest{} } +func (m *GetCartRequest) String() string { return proto.CompactTextString(m) } +func (*GetCartRequest) ProtoMessage() {} +func (*GetCartRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_demo_40506d781b7ed975, []int{3} +} +func (m *GetCartRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetCartRequest.Unmarshal(m, b) +} +func (m *GetCartRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetCartRequest.Marshal(b, m, deterministic) +} +func (dst *GetCartRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetCartRequest.Merge(dst, src) +} +func (m *GetCartRequest) XXX_Size() int { + return xxx_messageInfo_GetCartRequest.Size(m) +} +func (m *GetCartRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetCartRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetCartRequest proto.InternalMessageInfo + +func (m *GetCartRequest) GetUserId() string { + if m != nil { + return m.UserId + } + return "" +} + +type Cart struct { + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId" json:"user_id,omitempty"` + Items []*CartItem `protobuf:"bytes,2,rep,name=items" json:"items,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Cart) Reset() { *m = Cart{} } +func (m *Cart) String() string { return proto.CompactTextString(m) } +func (*Cart) ProtoMessage() {} +func (*Cart) Descriptor() ([]byte, []int) { + return fileDescriptor_demo_40506d781b7ed975, []int{4} +} +func (m *Cart) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Cart.Unmarshal(m, b) +} +func (m *Cart) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Cart.Marshal(b, m, deterministic) +} +func (dst *Cart) XXX_Merge(src proto.Message) { + xxx_messageInfo_Cart.Merge(dst, src) +} +func (m *Cart) XXX_Size() int { + return xxx_messageInfo_Cart.Size(m) +} +func (m *Cart) XXX_DiscardUnknown() { + xxx_messageInfo_Cart.DiscardUnknown(m) +} + +var xxx_messageInfo_Cart proto.InternalMessageInfo + +func (m *Cart) GetUserId() string { + if m != nil { + return m.UserId + } + return "" +} + +func (m *Cart) GetItems() []*CartItem { + if m != nil { + return m.Items + } + return nil +} + +type Empty struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Empty) Reset() { *m = Empty{} } +func (m *Empty) String() string { return proto.CompactTextString(m) } +func (*Empty) ProtoMessage() {} +func (*Empty) Descriptor() ([]byte, []int) { + return fileDescriptor_demo_40506d781b7ed975, []int{5} +} +func (m *Empty) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Empty.Unmarshal(m, b) +} +func (m *Empty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Empty.Marshal(b, m, deterministic) +} +func (dst *Empty) XXX_Merge(src proto.Message) { + xxx_messageInfo_Empty.Merge(dst, src) +} +func (m *Empty) XXX_Size() int { + return xxx_messageInfo_Empty.Size(m) +} +func (m *Empty) XXX_DiscardUnknown() { + xxx_messageInfo_Empty.DiscardUnknown(m) +} + +var xxx_messageInfo_Empty proto.InternalMessageInfo + +type ListRecommendationsRequest struct { + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId" json:"user_id,omitempty"` + ProductIds []string `protobuf:"bytes,2,rep,name=product_ids,json=productIds" json:"product_ids,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ListRecommendationsRequest) Reset() { *m = ListRecommendationsRequest{} } +func (m *ListRecommendationsRequest) String() string { return proto.CompactTextString(m) } +func (*ListRecommendationsRequest) ProtoMessage() {} +func (*ListRecommendationsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_demo_40506d781b7ed975, []int{6} +} +func (m *ListRecommendationsRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ListRecommendationsRequest.Unmarshal(m, b) +} +func (m *ListRecommendationsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ListRecommendationsRequest.Marshal(b, m, deterministic) +} +func (dst *ListRecommendationsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListRecommendationsRequest.Merge(dst, src) +} +func (m *ListRecommendationsRequest) XXX_Size() int { + return xxx_messageInfo_ListRecommendationsRequest.Size(m) +} +func (m *ListRecommendationsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ListRecommendationsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ListRecommendationsRequest proto.InternalMessageInfo + +func (m *ListRecommendationsRequest) GetUserId() string { + if m != nil { + return m.UserId + } + return "" +} + +func (m *ListRecommendationsRequest) GetProductIds() []string { + if m != nil { + return m.ProductIds + } + return nil +} + +type ListRecommendationsResponse struct { + ProductIds []string `protobuf:"bytes,1,rep,name=product_ids,json=productIds" json:"product_ids,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ListRecommendationsResponse) Reset() { *m = ListRecommendationsResponse{} } +func (m *ListRecommendationsResponse) String() string { return proto.CompactTextString(m) } +func (*ListRecommendationsResponse) ProtoMessage() {} +func (*ListRecommendationsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_demo_40506d781b7ed975, []int{7} +} +func (m *ListRecommendationsResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ListRecommendationsResponse.Unmarshal(m, b) +} +func (m *ListRecommendationsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ListRecommendationsResponse.Marshal(b, m, deterministic) +} +func (dst *ListRecommendationsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListRecommendationsResponse.Merge(dst, src) +} +func (m *ListRecommendationsResponse) XXX_Size() int { + return xxx_messageInfo_ListRecommendationsResponse.Size(m) +} +func (m *ListRecommendationsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ListRecommendationsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ListRecommendationsResponse proto.InternalMessageInfo + +func (m *ListRecommendationsResponse) GetProductIds() []string { + if m != nil { + return m.ProductIds + } + return nil +} + +type Product struct { + Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` + Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"` + Picture string `protobuf:"bytes,4,opt,name=picture" json:"picture,omitempty"` + PriceUsd *MoneyAmount `protobuf:"bytes,5,opt,name=price_usd,json=priceUsd" json:"price_usd,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Product) Reset() { *m = Product{} } +func (m *Product) String() string { return proto.CompactTextString(m) } +func (*Product) ProtoMessage() {} +func (*Product) Descriptor() ([]byte, []int) { + return fileDescriptor_demo_40506d781b7ed975, []int{8} +} +func (m *Product) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Product.Unmarshal(m, b) +} +func (m *Product) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Product.Marshal(b, m, deterministic) +} +func (dst *Product) XXX_Merge(src proto.Message) { + xxx_messageInfo_Product.Merge(dst, src) +} +func (m *Product) XXX_Size() int { + return xxx_messageInfo_Product.Size(m) +} +func (m *Product) XXX_DiscardUnknown() { + xxx_messageInfo_Product.DiscardUnknown(m) +} + +var xxx_messageInfo_Product proto.InternalMessageInfo + +func (m *Product) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *Product) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Product) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *Product) GetPicture() string { + if m != nil { + return m.Picture + } + return "" +} + +func (m *Product) GetPriceUsd() *MoneyAmount { + if m != nil { + return m.PriceUsd + } + return nil +} + +type ListProductsResponse struct { + Products []*Product `protobuf:"bytes,1,rep,name=products" json:"products,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ListProductsResponse) Reset() { *m = ListProductsResponse{} } +func (m *ListProductsResponse) String() string { return proto.CompactTextString(m) } +func (*ListProductsResponse) ProtoMessage() {} +func (*ListProductsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_demo_40506d781b7ed975, []int{9} +} +func (m *ListProductsResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ListProductsResponse.Unmarshal(m, b) +} +func (m *ListProductsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ListProductsResponse.Marshal(b, m, deterministic) +} +func (dst *ListProductsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListProductsResponse.Merge(dst, src) +} +func (m *ListProductsResponse) XXX_Size() int { + return xxx_messageInfo_ListProductsResponse.Size(m) +} +func (m *ListProductsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ListProductsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ListProductsResponse proto.InternalMessageInfo + +func (m *ListProductsResponse) GetProducts() []*Product { + if m != nil { + return m.Products + } + return nil +} + +type GetProductRequest struct { + Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetProductRequest) Reset() { *m = GetProductRequest{} } +func (m *GetProductRequest) String() string { return proto.CompactTextString(m) } +func (*GetProductRequest) ProtoMessage() {} +func (*GetProductRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_demo_40506d781b7ed975, []int{10} +} +func (m *GetProductRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetProductRequest.Unmarshal(m, b) +} +func (m *GetProductRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetProductRequest.Marshal(b, m, deterministic) +} +func (dst *GetProductRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetProductRequest.Merge(dst, src) +} +func (m *GetProductRequest) XXX_Size() int { + return xxx_messageInfo_GetProductRequest.Size(m) +} +func (m *GetProductRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetProductRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetProductRequest proto.InternalMessageInfo + +func (m *GetProductRequest) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +type SearchProductsRequest struct { + Query string `protobuf:"bytes,1,opt,name=query" json:"query,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SearchProductsRequest) Reset() { *m = SearchProductsRequest{} } +func (m *SearchProductsRequest) String() string { return proto.CompactTextString(m) } +func (*SearchProductsRequest) ProtoMessage() {} +func (*SearchProductsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_demo_40506d781b7ed975, []int{11} +} +func (m *SearchProductsRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SearchProductsRequest.Unmarshal(m, b) +} +func (m *SearchProductsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SearchProductsRequest.Marshal(b, m, deterministic) +} +func (dst *SearchProductsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SearchProductsRequest.Merge(dst, src) +} +func (m *SearchProductsRequest) XXX_Size() int { + return xxx_messageInfo_SearchProductsRequest.Size(m) +} +func (m *SearchProductsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SearchProductsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_SearchProductsRequest proto.InternalMessageInfo + +func (m *SearchProductsRequest) GetQuery() string { + if m != nil { + return m.Query + } + return "" +} + +type SearchProductsResponse struct { + Results []*Product `protobuf:"bytes,1,rep,name=results" json:"results,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SearchProductsResponse) Reset() { *m = SearchProductsResponse{} } +func (m *SearchProductsResponse) String() string { return proto.CompactTextString(m) } +func (*SearchProductsResponse) ProtoMessage() {} +func (*SearchProductsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_demo_40506d781b7ed975, []int{12} +} +func (m *SearchProductsResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SearchProductsResponse.Unmarshal(m, b) +} +func (m *SearchProductsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SearchProductsResponse.Marshal(b, m, deterministic) +} +func (dst *SearchProductsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_SearchProductsResponse.Merge(dst, src) +} +func (m *SearchProductsResponse) XXX_Size() int { + return xxx_messageInfo_SearchProductsResponse.Size(m) +} +func (m *SearchProductsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_SearchProductsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_SearchProductsResponse proto.InternalMessageInfo + +func (m *SearchProductsResponse) GetResults() []*Product { + if m != nil { + return m.Results + } + return nil +} + +type GetQuoteRequest struct { + Address *Address `protobuf:"bytes,1,opt,name=address" json:"address,omitempty"` + Items []*CartItem `protobuf:"bytes,2,rep,name=items" json:"items,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetQuoteRequest) Reset() { *m = GetQuoteRequest{} } +func (m *GetQuoteRequest) String() string { return proto.CompactTextString(m) } +func (*GetQuoteRequest) ProtoMessage() {} +func (*GetQuoteRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_demo_40506d781b7ed975, []int{13} +} +func (m *GetQuoteRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetQuoteRequest.Unmarshal(m, b) +} +func (m *GetQuoteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetQuoteRequest.Marshal(b, m, deterministic) +} +func (dst *GetQuoteRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetQuoteRequest.Merge(dst, src) +} +func (m *GetQuoteRequest) XXX_Size() int { + return xxx_messageInfo_GetQuoteRequest.Size(m) +} +func (m *GetQuoteRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetQuoteRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetQuoteRequest proto.InternalMessageInfo + +func (m *GetQuoteRequest) GetAddress() *Address { + if m != nil { + return m.Address + } + return nil +} + +func (m *GetQuoteRequest) GetItems() []*CartItem { + if m != nil { + return m.Items + } + return nil +} + +type GetQuoteResponse struct { + CostUsd *MoneyAmount `protobuf:"bytes,1,opt,name=cost_usd,json=costUsd" json:"cost_usd,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetQuoteResponse) Reset() { *m = GetQuoteResponse{} } +func (m *GetQuoteResponse) String() string { return proto.CompactTextString(m) } +func (*GetQuoteResponse) ProtoMessage() {} +func (*GetQuoteResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_demo_40506d781b7ed975, []int{14} +} +func (m *GetQuoteResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetQuoteResponse.Unmarshal(m, b) +} +func (m *GetQuoteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetQuoteResponse.Marshal(b, m, deterministic) +} +func (dst *GetQuoteResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetQuoteResponse.Merge(dst, src) +} +func (m *GetQuoteResponse) XXX_Size() int { + return xxx_messageInfo_GetQuoteResponse.Size(m) +} +func (m *GetQuoteResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetQuoteResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetQuoteResponse proto.InternalMessageInfo + +func (m *GetQuoteResponse) GetCostUsd() *MoneyAmount { + if m != nil { + return m.CostUsd + } + return nil +} + +type ShipOrderRequest struct { + Address *Address `protobuf:"bytes,1,opt,name=address" json:"address,omitempty"` + Items []*CartItem `protobuf:"bytes,2,rep,name=items" json:"items,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ShipOrderRequest) Reset() { *m = ShipOrderRequest{} } +func (m *ShipOrderRequest) String() string { return proto.CompactTextString(m) } +func (*ShipOrderRequest) ProtoMessage() {} +func (*ShipOrderRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_demo_40506d781b7ed975, []int{15} +} +func (m *ShipOrderRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ShipOrderRequest.Unmarshal(m, b) +} +func (m *ShipOrderRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ShipOrderRequest.Marshal(b, m, deterministic) +} +func (dst *ShipOrderRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ShipOrderRequest.Merge(dst, src) +} +func (m *ShipOrderRequest) XXX_Size() int { + return xxx_messageInfo_ShipOrderRequest.Size(m) +} +func (m *ShipOrderRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ShipOrderRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ShipOrderRequest proto.InternalMessageInfo + +func (m *ShipOrderRequest) GetAddress() *Address { + if m != nil { + return m.Address + } + return nil +} + +func (m *ShipOrderRequest) GetItems() []*CartItem { + if m != nil { + return m.Items + } + return nil +} + +type ShipOrderResponse struct { + TrackingId string `protobuf:"bytes,1,opt,name=tracking_id,json=trackingId" json:"tracking_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ShipOrderResponse) Reset() { *m = ShipOrderResponse{} } +func (m *ShipOrderResponse) String() string { return proto.CompactTextString(m) } +func (*ShipOrderResponse) ProtoMessage() {} +func (*ShipOrderResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_demo_40506d781b7ed975, []int{16} +} +func (m *ShipOrderResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ShipOrderResponse.Unmarshal(m, b) +} +func (m *ShipOrderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ShipOrderResponse.Marshal(b, m, deterministic) +} +func (dst *ShipOrderResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ShipOrderResponse.Merge(dst, src) +} +func (m *ShipOrderResponse) XXX_Size() int { + return xxx_messageInfo_ShipOrderResponse.Size(m) +} +func (m *ShipOrderResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ShipOrderResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ShipOrderResponse proto.InternalMessageInfo + +func (m *ShipOrderResponse) GetTrackingId() string { + if m != nil { + return m.TrackingId + } + return "" +} + +type Address struct { + StreetAddress_1 string `protobuf:"bytes,1,opt,name=street_address_1,json=streetAddress1" json:"street_address_1,omitempty"` + StreetAddress_2 string `protobuf:"bytes,2,opt,name=street_address_2,json=streetAddress2" json:"street_address_2,omitempty"` + City string `protobuf:"bytes,3,opt,name=city" json:"city,omitempty"` + Country string `protobuf:"bytes,4,opt,name=country" json:"country,omitempty"` + ZipCode int32 `protobuf:"varint,5,opt,name=zip_code,json=zipCode" json:"zip_code,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Address) Reset() { *m = Address{} } +func (m *Address) String() string { return proto.CompactTextString(m) } +func (*Address) ProtoMessage() {} +func (*Address) Descriptor() ([]byte, []int) { + return fileDescriptor_demo_40506d781b7ed975, []int{17} +} +func (m *Address) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Address.Unmarshal(m, b) +} +func (m *Address) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Address.Marshal(b, m, deterministic) +} +func (dst *Address) XXX_Merge(src proto.Message) { + xxx_messageInfo_Address.Merge(dst, src) +} +func (m *Address) XXX_Size() int { + return xxx_messageInfo_Address.Size(m) +} +func (m *Address) XXX_DiscardUnknown() { + xxx_messageInfo_Address.DiscardUnknown(m) +} + +var xxx_messageInfo_Address proto.InternalMessageInfo + +func (m *Address) GetStreetAddress_1() string { + if m != nil { + return m.StreetAddress_1 + } + return "" +} + +func (m *Address) GetStreetAddress_2() string { + if m != nil { + return m.StreetAddress_2 + } + return "" +} + +func (m *Address) GetCity() string { + if m != nil { + return m.City + } + return "" +} + +func (m *Address) GetCountry() string { + if m != nil { + return m.Country + } + return "" +} + +func (m *Address) GetZipCode() int32 { + if m != nil { + return m.ZipCode + } + return 0 +} + +// Describes a money amount without currency. For example, decimal=2 and +// fractional=500 (or fractional=5) makes up 2.5 units. +type MoneyAmount struct { + Decimal uint32 `protobuf:"varint,1,opt,name=decimal" json:"decimal,omitempty"` + Fractional uint32 `protobuf:"varint,2,opt,name=fractional" json:"fractional,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MoneyAmount) Reset() { *m = MoneyAmount{} } +func (m *MoneyAmount) String() string { return proto.CompactTextString(m) } +func (*MoneyAmount) ProtoMessage() {} +func (*MoneyAmount) Descriptor() ([]byte, []int) { + return fileDescriptor_demo_40506d781b7ed975, []int{18} +} +func (m *MoneyAmount) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MoneyAmount.Unmarshal(m, b) +} +func (m *MoneyAmount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MoneyAmount.Marshal(b, m, deterministic) +} +func (dst *MoneyAmount) XXX_Merge(src proto.Message) { + xxx_messageInfo_MoneyAmount.Merge(dst, src) +} +func (m *MoneyAmount) XXX_Size() int { + return xxx_messageInfo_MoneyAmount.Size(m) +} +func (m *MoneyAmount) XXX_DiscardUnknown() { + xxx_messageInfo_MoneyAmount.DiscardUnknown(m) +} + +var xxx_messageInfo_MoneyAmount proto.InternalMessageInfo + +func (m *MoneyAmount) GetDecimal() uint32 { + if m != nil { + return m.Decimal + } + return 0 +} + +func (m *MoneyAmount) GetFractional() uint32 { + if m != nil { + return m.Fractional + } + return 0 +} + +type Money struct { + // The 3-letter currency code defined in ISO 4217. + CurrencyCode string `protobuf:"bytes,1,opt,name=currency_code,json=currencyCode" json:"currency_code,omitempty"` + Amount *MoneyAmount `protobuf:"bytes,2,opt,name=amount" json:"amount,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Money) Reset() { *m = Money{} } +func (m *Money) String() string { return proto.CompactTextString(m) } +func (*Money) ProtoMessage() {} +func (*Money) Descriptor() ([]byte, []int) { + return fileDescriptor_demo_40506d781b7ed975, []int{19} +} +func (m *Money) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Money.Unmarshal(m, b) +} +func (m *Money) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Money.Marshal(b, m, deterministic) +} +func (dst *Money) XXX_Merge(src proto.Message) { + xxx_messageInfo_Money.Merge(dst, src) +} +func (m *Money) XXX_Size() int { + return xxx_messageInfo_Money.Size(m) +} +func (m *Money) XXX_DiscardUnknown() { + xxx_messageInfo_Money.DiscardUnknown(m) +} + +var xxx_messageInfo_Money proto.InternalMessageInfo + +func (m *Money) GetCurrencyCode() string { + if m != nil { + return m.CurrencyCode + } + return "" +} + +func (m *Money) GetAmount() *MoneyAmount { + if m != nil { + return m.Amount + } + return nil +} + +type GetSupportedCurrenciesResponse struct { + // The 3-letter currency code defined in ISO 4217. + CurrencyCodes []string `protobuf:"bytes,1,rep,name=currency_codes,json=currencyCodes" json:"currency_codes,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetSupportedCurrenciesResponse) Reset() { *m = GetSupportedCurrenciesResponse{} } +func (m *GetSupportedCurrenciesResponse) String() string { return proto.CompactTextString(m) } +func (*GetSupportedCurrenciesResponse) ProtoMessage() {} +func (*GetSupportedCurrenciesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_demo_40506d781b7ed975, []int{20} +} +func (m *GetSupportedCurrenciesResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetSupportedCurrenciesResponse.Unmarshal(m, b) +} +func (m *GetSupportedCurrenciesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetSupportedCurrenciesResponse.Marshal(b, m, deterministic) +} +func (dst *GetSupportedCurrenciesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetSupportedCurrenciesResponse.Merge(dst, src) +} +func (m *GetSupportedCurrenciesResponse) XXX_Size() int { + return xxx_messageInfo_GetSupportedCurrenciesResponse.Size(m) +} +func (m *GetSupportedCurrenciesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetSupportedCurrenciesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetSupportedCurrenciesResponse proto.InternalMessageInfo + +func (m *GetSupportedCurrenciesResponse) GetCurrencyCodes() []string { + if m != nil { + return m.CurrencyCodes + } + return nil +} + +type CurrencyConversionRequest struct { + From *Money `protobuf:"bytes,1,opt,name=from" json:"from,omitempty"` + // The 3-letter currency code defined in ISO 4217. + ToCode string `protobuf:"bytes,2,opt,name=to_code,json=toCode" json:"to_code,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CurrencyConversionRequest) Reset() { *m = CurrencyConversionRequest{} } +func (m *CurrencyConversionRequest) String() string { return proto.CompactTextString(m) } +func (*CurrencyConversionRequest) ProtoMessage() {} +func (*CurrencyConversionRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_demo_40506d781b7ed975, []int{21} +} +func (m *CurrencyConversionRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CurrencyConversionRequest.Unmarshal(m, b) +} +func (m *CurrencyConversionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CurrencyConversionRequest.Marshal(b, m, deterministic) +} +func (dst *CurrencyConversionRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_CurrencyConversionRequest.Merge(dst, src) +} +func (m *CurrencyConversionRequest) XXX_Size() int { + return xxx_messageInfo_CurrencyConversionRequest.Size(m) +} +func (m *CurrencyConversionRequest) XXX_DiscardUnknown() { + xxx_messageInfo_CurrencyConversionRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_CurrencyConversionRequest proto.InternalMessageInfo + +func (m *CurrencyConversionRequest) GetFrom() *Money { + if m != nil { + return m.From + } + return nil +} + +func (m *CurrencyConversionRequest) GetToCode() string { + if m != nil { + return m.ToCode + } + return "" +} + +type CreditCardInfo struct { + CreditCardNumber string `protobuf:"bytes,1,opt,name=credit_card_number,json=creditCardNumber" json:"credit_card_number,omitempty"` + CreditCardCvv int32 `protobuf:"varint,2,opt,name=credit_card_cvv,json=creditCardCvv" json:"credit_card_cvv,omitempty"` + CreditCardExpirationYear int32 `protobuf:"varint,3,opt,name=credit_card_expiration_year,json=creditCardExpirationYear" json:"credit_card_expiration_year,omitempty"` + CreditCardExpirationMonth int32 `protobuf:"varint,4,opt,name=credit_card_expiration_month,json=creditCardExpirationMonth" json:"credit_card_expiration_month,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CreditCardInfo) Reset() { *m = CreditCardInfo{} } +func (m *CreditCardInfo) String() string { return proto.CompactTextString(m) } +func (*CreditCardInfo) ProtoMessage() {} +func (*CreditCardInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_demo_40506d781b7ed975, []int{22} +} +func (m *CreditCardInfo) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CreditCardInfo.Unmarshal(m, b) +} +func (m *CreditCardInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CreditCardInfo.Marshal(b, m, deterministic) +} +func (dst *CreditCardInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreditCardInfo.Merge(dst, src) +} +func (m *CreditCardInfo) XXX_Size() int { + return xxx_messageInfo_CreditCardInfo.Size(m) +} +func (m *CreditCardInfo) XXX_DiscardUnknown() { + xxx_messageInfo_CreditCardInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_CreditCardInfo proto.InternalMessageInfo + +func (m *CreditCardInfo) GetCreditCardNumber() string { + if m != nil { + return m.CreditCardNumber + } + return "" +} + +func (m *CreditCardInfo) GetCreditCardCvv() int32 { + if m != nil { + return m.CreditCardCvv + } + return 0 +} + +func (m *CreditCardInfo) GetCreditCardExpirationYear() int32 { + if m != nil { + return m.CreditCardExpirationYear + } + return 0 +} + +func (m *CreditCardInfo) GetCreditCardExpirationMonth() int32 { + if m != nil { + return m.CreditCardExpirationMonth + } + return 0 +} + +type ChargeRequest struct { + Amount *Money `protobuf:"bytes,1,opt,name=amount" json:"amount,omitempty"` + CreditCard *CreditCardInfo `protobuf:"bytes,2,opt,name=credit_card,json=creditCard" json:"credit_card,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ChargeRequest) Reset() { *m = ChargeRequest{} } +func (m *ChargeRequest) String() string { return proto.CompactTextString(m) } +func (*ChargeRequest) ProtoMessage() {} +func (*ChargeRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_demo_40506d781b7ed975, []int{23} +} +func (m *ChargeRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ChargeRequest.Unmarshal(m, b) +} +func (m *ChargeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ChargeRequest.Marshal(b, m, deterministic) +} +func (dst *ChargeRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ChargeRequest.Merge(dst, src) +} +func (m *ChargeRequest) XXX_Size() int { + return xxx_messageInfo_ChargeRequest.Size(m) +} +func (m *ChargeRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ChargeRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ChargeRequest proto.InternalMessageInfo + +func (m *ChargeRequest) GetAmount() *Money { + if m != nil { + return m.Amount + } + return nil +} + +func (m *ChargeRequest) GetCreditCard() *CreditCardInfo { + if m != nil { + return m.CreditCard + } + return nil +} + +type ChargeResponse struct { + TransactionId string `protobuf:"bytes,1,opt,name=transaction_id,json=transactionId" json:"transaction_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ChargeResponse) Reset() { *m = ChargeResponse{} } +func (m *ChargeResponse) String() string { return proto.CompactTextString(m) } +func (*ChargeResponse) ProtoMessage() {} +func (*ChargeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_demo_40506d781b7ed975, []int{24} +} +func (m *ChargeResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ChargeResponse.Unmarshal(m, b) +} +func (m *ChargeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ChargeResponse.Marshal(b, m, deterministic) +} +func (dst *ChargeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ChargeResponse.Merge(dst, src) +} +func (m *ChargeResponse) XXX_Size() int { + return xxx_messageInfo_ChargeResponse.Size(m) +} +func (m *ChargeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ChargeResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ChargeResponse proto.InternalMessageInfo + +func (m *ChargeResponse) GetTransactionId() string { + if m != nil { + return m.TransactionId + } + return "" +} + +type OrderItem struct { + Item *CartItem `protobuf:"bytes,1,opt,name=item" json:"item,omitempty"` + Cost *Money `protobuf:"bytes,2,opt,name=cost" json:"cost,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *OrderItem) Reset() { *m = OrderItem{} } +func (m *OrderItem) String() string { return proto.CompactTextString(m) } +func (*OrderItem) ProtoMessage() {} +func (*OrderItem) Descriptor() ([]byte, []int) { + return fileDescriptor_demo_40506d781b7ed975, []int{25} +} +func (m *OrderItem) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_OrderItem.Unmarshal(m, b) +} +func (m *OrderItem) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_OrderItem.Marshal(b, m, deterministic) +} +func (dst *OrderItem) XXX_Merge(src proto.Message) { + xxx_messageInfo_OrderItem.Merge(dst, src) +} +func (m *OrderItem) XXX_Size() int { + return xxx_messageInfo_OrderItem.Size(m) +} +func (m *OrderItem) XXX_DiscardUnknown() { + xxx_messageInfo_OrderItem.DiscardUnknown(m) +} + +var xxx_messageInfo_OrderItem proto.InternalMessageInfo + +func (m *OrderItem) GetItem() *CartItem { + if m != nil { + return m.Item + } + return nil +} + +func (m *OrderItem) GetCost() *Money { + if m != nil { + return m.Cost + } + return nil +} + +type OrderResult struct { + OrderId string `protobuf:"bytes,1,opt,name=order_id,json=orderId" json:"order_id,omitempty"` + ShippingTrackingId string `protobuf:"bytes,2,opt,name=shipping_tracking_id,json=shippingTrackingId" json:"shipping_tracking_id,omitempty"` + ShippingCost *Money `protobuf:"bytes,3,opt,name=shipping_cost,json=shippingCost" json:"shipping_cost,omitempty"` + ShippingAddress *Address `protobuf:"bytes,4,opt,name=shipping_address,json=shippingAddress" json:"shipping_address,omitempty"` + Items []*OrderItem `protobuf:"bytes,5,rep,name=items" json:"items,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *OrderResult) Reset() { *m = OrderResult{} } +func (m *OrderResult) String() string { return proto.CompactTextString(m) } +func (*OrderResult) ProtoMessage() {} +func (*OrderResult) Descriptor() ([]byte, []int) { + return fileDescriptor_demo_40506d781b7ed975, []int{26} +} +func (m *OrderResult) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_OrderResult.Unmarshal(m, b) +} +func (m *OrderResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_OrderResult.Marshal(b, m, deterministic) +} +func (dst *OrderResult) XXX_Merge(src proto.Message) { + xxx_messageInfo_OrderResult.Merge(dst, src) +} +func (m *OrderResult) XXX_Size() int { + return xxx_messageInfo_OrderResult.Size(m) +} +func (m *OrderResult) XXX_DiscardUnknown() { + xxx_messageInfo_OrderResult.DiscardUnknown(m) +} + +var xxx_messageInfo_OrderResult proto.InternalMessageInfo + +func (m *OrderResult) GetOrderId() string { + if m != nil { + return m.OrderId + } + return "" +} + +func (m *OrderResult) GetShippingTrackingId() string { + if m != nil { + return m.ShippingTrackingId + } + return "" +} + +func (m *OrderResult) GetShippingCost() *Money { + if m != nil { + return m.ShippingCost + } + return nil +} + +func (m *OrderResult) GetShippingAddress() *Address { + if m != nil { + return m.ShippingAddress + } + return nil +} + +func (m *OrderResult) GetItems() []*OrderItem { + if m != nil { + return m.Items + } + return nil +} + +type SendOrderConfirmationRequest struct { + Email string `protobuf:"bytes,1,opt,name=email" json:"email,omitempty"` + Order *OrderResult `protobuf:"bytes,2,opt,name=order" json:"order,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SendOrderConfirmationRequest) Reset() { *m = SendOrderConfirmationRequest{} } +func (m *SendOrderConfirmationRequest) String() string { return proto.CompactTextString(m) } +func (*SendOrderConfirmationRequest) ProtoMessage() {} +func (*SendOrderConfirmationRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_demo_40506d781b7ed975, []int{27} +} +func (m *SendOrderConfirmationRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SendOrderConfirmationRequest.Unmarshal(m, b) +} +func (m *SendOrderConfirmationRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SendOrderConfirmationRequest.Marshal(b, m, deterministic) +} +func (dst *SendOrderConfirmationRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SendOrderConfirmationRequest.Merge(dst, src) +} +func (m *SendOrderConfirmationRequest) XXX_Size() int { + return xxx_messageInfo_SendOrderConfirmationRequest.Size(m) +} +func (m *SendOrderConfirmationRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SendOrderConfirmationRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_SendOrderConfirmationRequest proto.InternalMessageInfo + +func (m *SendOrderConfirmationRequest) GetEmail() string { + if m != nil { + return m.Email + } + return "" +} + +func (m *SendOrderConfirmationRequest) GetOrder() *OrderResult { + if m != nil { + return m.Order + } + return nil +} + +type CreateOrderRequest struct { + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId" json:"user_id,omitempty"` + UserCurrency string `protobuf:"bytes,2,opt,name=user_currency,json=userCurrency" json:"user_currency,omitempty"` + Address *Address `protobuf:"bytes,3,opt,name=address" json:"address,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CreateOrderRequest) Reset() { *m = CreateOrderRequest{} } +func (m *CreateOrderRequest) String() string { return proto.CompactTextString(m) } +func (*CreateOrderRequest) ProtoMessage() {} +func (*CreateOrderRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_demo_40506d781b7ed975, []int{28} +} +func (m *CreateOrderRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CreateOrderRequest.Unmarshal(m, b) +} +func (m *CreateOrderRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CreateOrderRequest.Marshal(b, m, deterministic) +} +func (dst *CreateOrderRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateOrderRequest.Merge(dst, src) +} +func (m *CreateOrderRequest) XXX_Size() int { + return xxx_messageInfo_CreateOrderRequest.Size(m) +} +func (m *CreateOrderRequest) XXX_DiscardUnknown() { + xxx_messageInfo_CreateOrderRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateOrderRequest proto.InternalMessageInfo + +func (m *CreateOrderRequest) GetUserId() string { + if m != nil { + return m.UserId + } + return "" +} + +func (m *CreateOrderRequest) GetUserCurrency() string { + if m != nil { + return m.UserCurrency + } + return "" +} + +func (m *CreateOrderRequest) GetAddress() *Address { + if m != nil { + return m.Address + } + return nil +} + +type CreateOrderResponse struct { + Items []*OrderItem `protobuf:"bytes,1,rep,name=items" json:"items,omitempty"` + ShippingCost *Money `protobuf:"bytes,2,opt,name=shipping_cost,json=shippingCost" json:"shipping_cost,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CreateOrderResponse) Reset() { *m = CreateOrderResponse{} } +func (m *CreateOrderResponse) String() string { return proto.CompactTextString(m) } +func (*CreateOrderResponse) ProtoMessage() {} +func (*CreateOrderResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_demo_40506d781b7ed975, []int{29} +} +func (m *CreateOrderResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CreateOrderResponse.Unmarshal(m, b) +} +func (m *CreateOrderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CreateOrderResponse.Marshal(b, m, deterministic) +} +func (dst *CreateOrderResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateOrderResponse.Merge(dst, src) +} +func (m *CreateOrderResponse) XXX_Size() int { + return xxx_messageInfo_CreateOrderResponse.Size(m) +} +func (m *CreateOrderResponse) XXX_DiscardUnknown() { + xxx_messageInfo_CreateOrderResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateOrderResponse proto.InternalMessageInfo + +func (m *CreateOrderResponse) GetItems() []*OrderItem { + if m != nil { + return m.Items + } + return nil +} + +func (m *CreateOrderResponse) GetShippingCost() *Money { + if m != nil { + return m.ShippingCost + } + return nil +} + +type PlaceOrderRequest struct { + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId" json:"user_id,omitempty"` + UserCurrency string `protobuf:"bytes,2,opt,name=user_currency,json=userCurrency" json:"user_currency,omitempty"` + Address *Address `protobuf:"bytes,3,opt,name=address" json:"address,omitempty"` + Email string `protobuf:"bytes,5,opt,name=email" json:"email,omitempty"` + CreditCard *CreditCardInfo `protobuf:"bytes,6,opt,name=credit_card,json=creditCard" json:"credit_card,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PlaceOrderRequest) Reset() { *m = PlaceOrderRequest{} } +func (m *PlaceOrderRequest) String() string { return proto.CompactTextString(m) } +func (*PlaceOrderRequest) ProtoMessage() {} +func (*PlaceOrderRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_demo_40506d781b7ed975, []int{30} +} +func (m *PlaceOrderRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PlaceOrderRequest.Unmarshal(m, b) +} +func (m *PlaceOrderRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PlaceOrderRequest.Marshal(b, m, deterministic) +} +func (dst *PlaceOrderRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_PlaceOrderRequest.Merge(dst, src) +} +func (m *PlaceOrderRequest) XXX_Size() int { + return xxx_messageInfo_PlaceOrderRequest.Size(m) +} +func (m *PlaceOrderRequest) XXX_DiscardUnknown() { + xxx_messageInfo_PlaceOrderRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_PlaceOrderRequest proto.InternalMessageInfo + +func (m *PlaceOrderRequest) GetUserId() string { + if m != nil { + return m.UserId + } + return "" +} + +func (m *PlaceOrderRequest) GetUserCurrency() string { + if m != nil { + return m.UserCurrency + } + return "" +} + +func (m *PlaceOrderRequest) GetAddress() *Address { + if m != nil { + return m.Address + } + return nil +} + +func (m *PlaceOrderRequest) GetEmail() string { + if m != nil { + return m.Email + } + return "" +} + +func (m *PlaceOrderRequest) GetCreditCard() *CreditCardInfo { + if m != nil { + return m.CreditCard + } + return nil +} + +type PlaceOrderResponse struct { + Order *OrderResult `protobuf:"bytes,1,opt,name=order" json:"order,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PlaceOrderResponse) Reset() { *m = PlaceOrderResponse{} } +func (m *PlaceOrderResponse) String() string { return proto.CompactTextString(m) } +func (*PlaceOrderResponse) ProtoMessage() {} +func (*PlaceOrderResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_demo_40506d781b7ed975, []int{31} +} +func (m *PlaceOrderResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PlaceOrderResponse.Unmarshal(m, b) +} +func (m *PlaceOrderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PlaceOrderResponse.Marshal(b, m, deterministic) +} +func (dst *PlaceOrderResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_PlaceOrderResponse.Merge(dst, src) +} +func (m *PlaceOrderResponse) XXX_Size() int { + return xxx_messageInfo_PlaceOrderResponse.Size(m) +} +func (m *PlaceOrderResponse) XXX_DiscardUnknown() { + xxx_messageInfo_PlaceOrderResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_PlaceOrderResponse proto.InternalMessageInfo + +func (m *PlaceOrderResponse) GetOrder() *OrderResult { + if m != nil { + return m.Order + } + return nil +} + +func init() { + proto.RegisterType((*CartItem)(nil), "hipstershop.CartItem") + proto.RegisterType((*AddItemRequest)(nil), "hipstershop.AddItemRequest") + proto.RegisterType((*EmptyCartRequest)(nil), "hipstershop.EmptyCartRequest") + proto.RegisterType((*GetCartRequest)(nil), "hipstershop.GetCartRequest") + proto.RegisterType((*Cart)(nil), "hipstershop.Cart") + proto.RegisterType((*Empty)(nil), "hipstershop.Empty") + proto.RegisterType((*ListRecommendationsRequest)(nil), "hipstershop.ListRecommendationsRequest") + proto.RegisterType((*ListRecommendationsResponse)(nil), "hipstershop.ListRecommendationsResponse") + proto.RegisterType((*Product)(nil), "hipstershop.Product") + proto.RegisterType((*ListProductsResponse)(nil), "hipstershop.ListProductsResponse") + proto.RegisterType((*GetProductRequest)(nil), "hipstershop.GetProductRequest") + proto.RegisterType((*SearchProductsRequest)(nil), "hipstershop.SearchProductsRequest") + proto.RegisterType((*SearchProductsResponse)(nil), "hipstershop.SearchProductsResponse") + proto.RegisterType((*GetQuoteRequest)(nil), "hipstershop.GetQuoteRequest") + proto.RegisterType((*GetQuoteResponse)(nil), "hipstershop.GetQuoteResponse") + proto.RegisterType((*ShipOrderRequest)(nil), "hipstershop.ShipOrderRequest") + proto.RegisterType((*ShipOrderResponse)(nil), "hipstershop.ShipOrderResponse") + proto.RegisterType((*Address)(nil), "hipstershop.Address") + proto.RegisterType((*MoneyAmount)(nil), "hipstershop.MoneyAmount") + proto.RegisterType((*Money)(nil), "hipstershop.Money") + proto.RegisterType((*GetSupportedCurrenciesResponse)(nil), "hipstershop.GetSupportedCurrenciesResponse") + proto.RegisterType((*CurrencyConversionRequest)(nil), "hipstershop.CurrencyConversionRequest") + proto.RegisterType((*CreditCardInfo)(nil), "hipstershop.CreditCardInfo") + proto.RegisterType((*ChargeRequest)(nil), "hipstershop.ChargeRequest") + proto.RegisterType((*ChargeResponse)(nil), "hipstershop.ChargeResponse") + proto.RegisterType((*OrderItem)(nil), "hipstershop.OrderItem") + proto.RegisterType((*OrderResult)(nil), "hipstershop.OrderResult") + proto.RegisterType((*SendOrderConfirmationRequest)(nil), "hipstershop.SendOrderConfirmationRequest") + proto.RegisterType((*CreateOrderRequest)(nil), "hipstershop.CreateOrderRequest") + proto.RegisterType((*CreateOrderResponse)(nil), "hipstershop.CreateOrderResponse") + proto.RegisterType((*PlaceOrderRequest)(nil), "hipstershop.PlaceOrderRequest") + proto.RegisterType((*PlaceOrderResponse)(nil), "hipstershop.PlaceOrderResponse") +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// CartServiceClient is the client API for CartService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type CartServiceClient interface { + AddItem(ctx context.Context, in *AddItemRequest, opts ...grpc.CallOption) (*Empty, error) + GetCart(ctx context.Context, in *GetCartRequest, opts ...grpc.CallOption) (*Cart, error) + EmptyCart(ctx context.Context, in *EmptyCartRequest, opts ...grpc.CallOption) (*Empty, error) +} + +type cartServiceClient struct { + cc *grpc.ClientConn +} + +func NewCartServiceClient(cc *grpc.ClientConn) CartServiceClient { + return &cartServiceClient{cc} +} + +func (c *cartServiceClient) AddItem(ctx context.Context, in *AddItemRequest, opts ...grpc.CallOption) (*Empty, error) { + out := new(Empty) + err := c.cc.Invoke(ctx, "/hipstershop.CartService/AddItem", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *cartServiceClient) GetCart(ctx context.Context, in *GetCartRequest, opts ...grpc.CallOption) (*Cart, error) { + out := new(Cart) + err := c.cc.Invoke(ctx, "/hipstershop.CartService/GetCart", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *cartServiceClient) EmptyCart(ctx context.Context, in *EmptyCartRequest, opts ...grpc.CallOption) (*Empty, error) { + out := new(Empty) + err := c.cc.Invoke(ctx, "/hipstershop.CartService/EmptyCart", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// CartServiceServer is the server API for CartService service. +type CartServiceServer interface { + AddItem(context.Context, *AddItemRequest) (*Empty, error) + GetCart(context.Context, *GetCartRequest) (*Cart, error) + EmptyCart(context.Context, *EmptyCartRequest) (*Empty, error) +} + +func RegisterCartServiceServer(s *grpc.Server, srv CartServiceServer) { + s.RegisterService(&_CartService_serviceDesc, srv) +} + +func _CartService_AddItem_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AddItemRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CartServiceServer).AddItem(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/hipstershop.CartService/AddItem", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CartServiceServer).AddItem(ctx, req.(*AddItemRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CartService_GetCart_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetCartRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CartServiceServer).GetCart(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/hipstershop.CartService/GetCart", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CartServiceServer).GetCart(ctx, req.(*GetCartRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CartService_EmptyCart_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(EmptyCartRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CartServiceServer).EmptyCart(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/hipstershop.CartService/EmptyCart", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CartServiceServer).EmptyCart(ctx, req.(*EmptyCartRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _CartService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "hipstershop.CartService", + HandlerType: (*CartServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "AddItem", + Handler: _CartService_AddItem_Handler, + }, + { + MethodName: "GetCart", + Handler: _CartService_GetCart_Handler, + }, + { + MethodName: "EmptyCart", + Handler: _CartService_EmptyCart_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "demo.proto", +} + +// RecommendationServiceClient is the client API for RecommendationService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type RecommendationServiceClient interface { + ListRecommendations(ctx context.Context, in *ListRecommendationsRequest, opts ...grpc.CallOption) (*ListRecommendationsResponse, error) +} + +type recommendationServiceClient struct { + cc *grpc.ClientConn +} + +func NewRecommendationServiceClient(cc *grpc.ClientConn) RecommendationServiceClient { + return &recommendationServiceClient{cc} +} + +func (c *recommendationServiceClient) ListRecommendations(ctx context.Context, in *ListRecommendationsRequest, opts ...grpc.CallOption) (*ListRecommendationsResponse, error) { + out := new(ListRecommendationsResponse) + err := c.cc.Invoke(ctx, "/hipstershop.RecommendationService/ListRecommendations", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// RecommendationServiceServer is the server API for RecommendationService service. +type RecommendationServiceServer interface { + ListRecommendations(context.Context, *ListRecommendationsRequest) (*ListRecommendationsResponse, error) +} + +func RegisterRecommendationServiceServer(s *grpc.Server, srv RecommendationServiceServer) { + s.RegisterService(&_RecommendationService_serviceDesc, srv) +} + +func _RecommendationService_ListRecommendations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListRecommendationsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RecommendationServiceServer).ListRecommendations(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/hipstershop.RecommendationService/ListRecommendations", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RecommendationServiceServer).ListRecommendations(ctx, req.(*ListRecommendationsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _RecommendationService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "hipstershop.RecommendationService", + HandlerType: (*RecommendationServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ListRecommendations", + Handler: _RecommendationService_ListRecommendations_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "demo.proto", +} + +// ProductCatalogServiceClient is the client API for ProductCatalogService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type ProductCatalogServiceClient interface { + ListProducts(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*ListProductsResponse, error) + GetProduct(ctx context.Context, in *GetProductRequest, opts ...grpc.CallOption) (*Product, error) + SearchProducts(ctx context.Context, in *SearchProductsRequest, opts ...grpc.CallOption) (*SearchProductsResponse, error) +} + +type productCatalogServiceClient struct { + cc *grpc.ClientConn +} + +func NewProductCatalogServiceClient(cc *grpc.ClientConn) ProductCatalogServiceClient { + return &productCatalogServiceClient{cc} +} + +func (c *productCatalogServiceClient) ListProducts(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*ListProductsResponse, error) { + out := new(ListProductsResponse) + err := c.cc.Invoke(ctx, "/hipstershop.ProductCatalogService/ListProducts", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *productCatalogServiceClient) GetProduct(ctx context.Context, in *GetProductRequest, opts ...grpc.CallOption) (*Product, error) { + out := new(Product) + err := c.cc.Invoke(ctx, "/hipstershop.ProductCatalogService/GetProduct", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *productCatalogServiceClient) SearchProducts(ctx context.Context, in *SearchProductsRequest, opts ...grpc.CallOption) (*SearchProductsResponse, error) { + out := new(SearchProductsResponse) + err := c.cc.Invoke(ctx, "/hipstershop.ProductCatalogService/SearchProducts", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ProductCatalogServiceServer is the server API for ProductCatalogService service. +type ProductCatalogServiceServer interface { + ListProducts(context.Context, *Empty) (*ListProductsResponse, error) + GetProduct(context.Context, *GetProductRequest) (*Product, error) + SearchProducts(context.Context, *SearchProductsRequest) (*SearchProductsResponse, error) +} + +func RegisterProductCatalogServiceServer(s *grpc.Server, srv ProductCatalogServiceServer) { + s.RegisterService(&_ProductCatalogService_serviceDesc, srv) +} + +func _ProductCatalogService_ListProducts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProductCatalogServiceServer).ListProducts(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/hipstershop.ProductCatalogService/ListProducts", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProductCatalogServiceServer).ListProducts(ctx, req.(*Empty)) + } + return interceptor(ctx, in, info, handler) +} + +func _ProductCatalogService_GetProduct_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetProductRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProductCatalogServiceServer).GetProduct(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/hipstershop.ProductCatalogService/GetProduct", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProductCatalogServiceServer).GetProduct(ctx, req.(*GetProductRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ProductCatalogService_SearchProducts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SearchProductsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProductCatalogServiceServer).SearchProducts(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/hipstershop.ProductCatalogService/SearchProducts", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProductCatalogServiceServer).SearchProducts(ctx, req.(*SearchProductsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _ProductCatalogService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "hipstershop.ProductCatalogService", + HandlerType: (*ProductCatalogServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ListProducts", + Handler: _ProductCatalogService_ListProducts_Handler, + }, + { + MethodName: "GetProduct", + Handler: _ProductCatalogService_GetProduct_Handler, + }, + { + MethodName: "SearchProducts", + Handler: _ProductCatalogService_SearchProducts_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "demo.proto", +} + +// ShippingServiceClient is the client API for ShippingService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type ShippingServiceClient interface { + GetQuote(ctx context.Context, in *GetQuoteRequest, opts ...grpc.CallOption) (*GetQuoteResponse, error) + ShipOrder(ctx context.Context, in *ShipOrderRequest, opts ...grpc.CallOption) (*ShipOrderResponse, error) +} + +type shippingServiceClient struct { + cc *grpc.ClientConn +} + +func NewShippingServiceClient(cc *grpc.ClientConn) ShippingServiceClient { + return &shippingServiceClient{cc} +} + +func (c *shippingServiceClient) GetQuote(ctx context.Context, in *GetQuoteRequest, opts ...grpc.CallOption) (*GetQuoteResponse, error) { + out := new(GetQuoteResponse) + err := c.cc.Invoke(ctx, "/hipstershop.ShippingService/GetQuote", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *shippingServiceClient) ShipOrder(ctx context.Context, in *ShipOrderRequest, opts ...grpc.CallOption) (*ShipOrderResponse, error) { + out := new(ShipOrderResponse) + err := c.cc.Invoke(ctx, "/hipstershop.ShippingService/ShipOrder", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ShippingServiceServer is the server API for ShippingService service. +type ShippingServiceServer interface { + GetQuote(context.Context, *GetQuoteRequest) (*GetQuoteResponse, error) + ShipOrder(context.Context, *ShipOrderRequest) (*ShipOrderResponse, error) +} + +func RegisterShippingServiceServer(s *grpc.Server, srv ShippingServiceServer) { + s.RegisterService(&_ShippingService_serviceDesc, srv) +} + +func _ShippingService_GetQuote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetQuoteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ShippingServiceServer).GetQuote(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/hipstershop.ShippingService/GetQuote", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ShippingServiceServer).GetQuote(ctx, req.(*GetQuoteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ShippingService_ShipOrder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ShipOrderRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ShippingServiceServer).ShipOrder(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/hipstershop.ShippingService/ShipOrder", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ShippingServiceServer).ShipOrder(ctx, req.(*ShipOrderRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _ShippingService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "hipstershop.ShippingService", + HandlerType: (*ShippingServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetQuote", + Handler: _ShippingService_GetQuote_Handler, + }, + { + MethodName: "ShipOrder", + Handler: _ShippingService_ShipOrder_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "demo.proto", +} + +// CurrencyServiceClient is the client API for CurrencyService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type CurrencyServiceClient interface { + GetSupportedCurrencies(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*GetSupportedCurrenciesResponse, error) + Convert(ctx context.Context, in *CurrencyConversionRequest, opts ...grpc.CallOption) (*Money, error) +} + +type currencyServiceClient struct { + cc *grpc.ClientConn +} + +func NewCurrencyServiceClient(cc *grpc.ClientConn) CurrencyServiceClient { + return ¤cyServiceClient{cc} +} + +func (c *currencyServiceClient) GetSupportedCurrencies(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*GetSupportedCurrenciesResponse, error) { + out := new(GetSupportedCurrenciesResponse) + err := c.cc.Invoke(ctx, "/hipstershop.CurrencyService/GetSupportedCurrencies", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *currencyServiceClient) Convert(ctx context.Context, in *CurrencyConversionRequest, opts ...grpc.CallOption) (*Money, error) { + out := new(Money) + err := c.cc.Invoke(ctx, "/hipstershop.CurrencyService/Convert", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// CurrencyServiceServer is the server API for CurrencyService service. +type CurrencyServiceServer interface { + GetSupportedCurrencies(context.Context, *Empty) (*GetSupportedCurrenciesResponse, error) + Convert(context.Context, *CurrencyConversionRequest) (*Money, error) +} + +func RegisterCurrencyServiceServer(s *grpc.Server, srv CurrencyServiceServer) { + s.RegisterService(&_CurrencyService_serviceDesc, srv) +} + +func _CurrencyService_GetSupportedCurrencies_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CurrencyServiceServer).GetSupportedCurrencies(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/hipstershop.CurrencyService/GetSupportedCurrencies", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CurrencyServiceServer).GetSupportedCurrencies(ctx, req.(*Empty)) + } + return interceptor(ctx, in, info, handler) +} + +func _CurrencyService_Convert_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CurrencyConversionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CurrencyServiceServer).Convert(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/hipstershop.CurrencyService/Convert", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CurrencyServiceServer).Convert(ctx, req.(*CurrencyConversionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _CurrencyService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "hipstershop.CurrencyService", + HandlerType: (*CurrencyServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetSupportedCurrencies", + Handler: _CurrencyService_GetSupportedCurrencies_Handler, + }, + { + MethodName: "Convert", + Handler: _CurrencyService_Convert_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "demo.proto", +} + +// PaymentServiceClient is the client API for PaymentService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type PaymentServiceClient interface { + Charge(ctx context.Context, in *ChargeRequest, opts ...grpc.CallOption) (*ChargeResponse, error) +} + +type paymentServiceClient struct { + cc *grpc.ClientConn +} + +func NewPaymentServiceClient(cc *grpc.ClientConn) PaymentServiceClient { + return &paymentServiceClient{cc} +} + +func (c *paymentServiceClient) Charge(ctx context.Context, in *ChargeRequest, opts ...grpc.CallOption) (*ChargeResponse, error) { + out := new(ChargeResponse) + err := c.cc.Invoke(ctx, "/hipstershop.PaymentService/Charge", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// PaymentServiceServer is the server API for PaymentService service. +type PaymentServiceServer interface { + Charge(context.Context, *ChargeRequest) (*ChargeResponse, error) +} + +func RegisterPaymentServiceServer(s *grpc.Server, srv PaymentServiceServer) { + s.RegisterService(&_PaymentService_serviceDesc, srv) +} + +func _PaymentService_Charge_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ChargeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PaymentServiceServer).Charge(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/hipstershop.PaymentService/Charge", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PaymentServiceServer).Charge(ctx, req.(*ChargeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _PaymentService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "hipstershop.PaymentService", + HandlerType: (*PaymentServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Charge", + Handler: _PaymentService_Charge_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "demo.proto", +} + +// EmailServiceClient is the client API for EmailService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type EmailServiceClient interface { + SendOrderConfirmation(ctx context.Context, in *SendOrderConfirmationRequest, opts ...grpc.CallOption) (*Empty, error) +} + +type emailServiceClient struct { + cc *grpc.ClientConn +} + +func NewEmailServiceClient(cc *grpc.ClientConn) EmailServiceClient { + return &emailServiceClient{cc} +} + +func (c *emailServiceClient) SendOrderConfirmation(ctx context.Context, in *SendOrderConfirmationRequest, opts ...grpc.CallOption) (*Empty, error) { + out := new(Empty) + err := c.cc.Invoke(ctx, "/hipstershop.EmailService/SendOrderConfirmation", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// EmailServiceServer is the server API for EmailService service. +type EmailServiceServer interface { + SendOrderConfirmation(context.Context, *SendOrderConfirmationRequest) (*Empty, error) +} + +func RegisterEmailServiceServer(s *grpc.Server, srv EmailServiceServer) { + s.RegisterService(&_EmailService_serviceDesc, srv) +} + +func _EmailService_SendOrderConfirmation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SendOrderConfirmationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(EmailServiceServer).SendOrderConfirmation(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/hipstershop.EmailService/SendOrderConfirmation", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(EmailServiceServer).SendOrderConfirmation(ctx, req.(*SendOrderConfirmationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _EmailService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "hipstershop.EmailService", + HandlerType: (*EmailServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "SendOrderConfirmation", + Handler: _EmailService_SendOrderConfirmation_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "demo.proto", +} + +// CheckoutServiceClient is the client API for CheckoutService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type CheckoutServiceClient interface { + CreateOrder(ctx context.Context, in *CreateOrderRequest, opts ...grpc.CallOption) (*CreateOrderResponse, error) + PlaceOrder(ctx context.Context, in *PlaceOrderRequest, opts ...grpc.CallOption) (*PlaceOrderResponse, error) +} + +type checkoutServiceClient struct { + cc *grpc.ClientConn +} + +func NewCheckoutServiceClient(cc *grpc.ClientConn) CheckoutServiceClient { + return &checkoutServiceClient{cc} +} + +func (c *checkoutServiceClient) CreateOrder(ctx context.Context, in *CreateOrderRequest, opts ...grpc.CallOption) (*CreateOrderResponse, error) { + out := new(CreateOrderResponse) + err := c.cc.Invoke(ctx, "/hipstershop.CheckoutService/CreateOrder", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *checkoutServiceClient) PlaceOrder(ctx context.Context, in *PlaceOrderRequest, opts ...grpc.CallOption) (*PlaceOrderResponse, error) { + out := new(PlaceOrderResponse) + err := c.cc.Invoke(ctx, "/hipstershop.CheckoutService/PlaceOrder", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// CheckoutServiceServer is the server API for CheckoutService service. +type CheckoutServiceServer interface { + CreateOrder(context.Context, *CreateOrderRequest) (*CreateOrderResponse, error) + PlaceOrder(context.Context, *PlaceOrderRequest) (*PlaceOrderResponse, error) +} + +func RegisterCheckoutServiceServer(s *grpc.Server, srv CheckoutServiceServer) { + s.RegisterService(&_CheckoutService_serviceDesc, srv) +} + +func _CheckoutService_CreateOrder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateOrderRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CheckoutServiceServer).CreateOrder(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/hipstershop.CheckoutService/CreateOrder", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CheckoutServiceServer).CreateOrder(ctx, req.(*CreateOrderRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CheckoutService_PlaceOrder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PlaceOrderRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CheckoutServiceServer).PlaceOrder(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/hipstershop.CheckoutService/PlaceOrder", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CheckoutServiceServer).PlaceOrder(ctx, req.(*PlaceOrderRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _CheckoutService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "hipstershop.CheckoutService", + HandlerType: (*CheckoutServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateOrder", + Handler: _CheckoutService_CreateOrder_Handler, + }, + { + MethodName: "PlaceOrder", + Handler: _CheckoutService_PlaceOrder_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "demo.proto", +} + +func init() { proto.RegisterFile("demo.proto", fileDescriptor_demo_40506d781b7ed975) } + +var fileDescriptor_demo_40506d781b7ed975 = []byte{ + // 1466 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xdd, 0x72, 0xd3, 0xc6, + 0x17, 0x8f, 0x9c, 0x38, 0xb6, 0x8f, 0x63, 0x27, 0x59, 0x12, 0xfe, 0x46, 0x81, 0x90, 0xff, 0x66, + 0x4a, 0x43, 0xa1, 0x19, 0x30, 0xed, 0x70, 0x51, 0x5a, 0xca, 0x98, 0x8c, 0xf1, 0x0c, 0x14, 0xaa, + 0x40, 0xa7, 0x1d, 0x3a, 0x78, 0x84, 0xb4, 0xc1, 0x2a, 0xd6, 0x07, 0xab, 0x55, 0xa6, 0x66, 0x7a, + 0x45, 0x5f, 0xa4, 0x57, 0xbd, 0xe8, 0x03, 0xb4, 0xef, 0xd0, 0xfb, 0xbe, 0x42, 0x9f, 0xa3, 0xb3, + 0xab, 0x5d, 0x7d, 0x59, 0x4a, 0xc2, 0x4d, 0x7b, 0xe7, 0xdd, 0xfd, 0xed, 0x39, 0xbf, 0x3d, 0xdf, + 0x32, 0x80, 0x4d, 0x5c, 0x7f, 0x3f, 0xa0, 0x3e, 0xf3, 0x51, 0x7b, 0xe2, 0x04, 0x21, 0x23, 0x34, + 0x9c, 0xf8, 0x01, 0x3e, 0x80, 0xe6, 0xc0, 0xa4, 0x6c, 0xc4, 0x88, 0x8b, 0x2e, 0x01, 0x04, 0xd4, + 0xb7, 0x23, 0x8b, 0x8d, 0x1d, 0xbb, 0xa7, 0xed, 0x68, 0x7b, 0x2d, 0xa3, 0x25, 0x77, 0x46, 0x36, + 0xd2, 0xa1, 0xf9, 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x33, 0x7d, 0xa7, 0x1a, 0x90, 0x58, 0xfc, 0x31, 0x40, 0x5a, 0x2e, 0x0b, 0x29, 0x33, 0xd7, 0x1e, + 0xf4, 0xcb, 0x95, 0xe7, 0x4a, 0xe0, 0xcb, 0x65, 0xf1, 0xf7, 0xcc, 0xad, 0x7f, 0x02, 0x00, 0x00, + 0xff, 0xff, 0xdd, 0xe8, 0xfb, 0x77, 0xac, 0x11, 0x00, 0x00, +} diff --git a/src/checkoutservice/main.go b/src/checkoutservice/main.go new file mode 100644 index 0000000..7225898 --- /dev/null +++ b/src/checkoutservice/main.go @@ -0,0 +1,70 @@ +package main + +import ( + "context" + "fmt" + "log" + "net" + "os" + + pb "./genproto" + "google.golang.org/grpc" +) + +const ( + listenPort = "5000" +) + +type checkoutService struct { + productCatalogSvcAddr string + cartSvcAddr string + currencySvcAddr string + shippingSvcAddr string + emailSvcAddr string + paymentSvcAddr string +} + +func main() { + port := listenPort + if os.Getenv("PORT") != "" { + port = os.Getenv("PORT") + } + + svc := new(checkoutService) + mustMapEnv(&svc.productCatalogSvcAddr, "PRODUCT_CATALOG_SERVICE_ADDR") + mustMapEnv(&svc.cartSvcAddr, "CART_SERVICE_ADDR") + mustMapEnv(&svc.currencySvcAddr, "CURRENCY_SERVICE_ADDR") + mustMapEnv(&svc.shippingSvcAddr, "SHIPPING_SERVICE_ADDR") + mustMapEnv(&svc.emailSvcAddr, "EMAIL_SERVICE_ADDR") + mustMapEnv(&svc.paymentSvcAddr, "PAYMENT_SERVICE_ADDR") + + log.Printf("starting to listen on tcp/%s", port) + lis, err := net.Listen("tcp", fmt.Sprintf(":%s", port)) + if err != nil { + log.Fatal(err) + } + srv := grpc.NewServer() + pb.RegisterCheckoutServiceServer(srv, svc) + log.Println("starting to listen on tcp: %q", lis.Addr().String()) + log.Fatal(srv.Serve(lis)) +} + +func mustMapEnv(target *string, envKey string) { + v := os.Getenv(envKey) + if v == "" { + panic(fmt.Sprintf("environment variable %q not set", envKey)) + } + *target = v +} + +func (cs *checkoutService) CreateOrder(ctx context.Context, req *pb.CreateOrderRequest) (*pb.CreateOrderResponse, error) { + log.Printf("[CreateOrder] user_id=%q user_currency=%q", req.UserId, req.UserCurrency) + resp := new(pb.CreateOrderResponse) + return resp, nil +} + +func (cs *checkoutService) PlaceOrder(ctx context.Context, req *pb.PlaceOrderRequest) (*pb.PlaceOrderResponse, error) { + log.Printf("[PlaceOrder] user_id=%q user_currency=%q", req.UserId, req.UserCurrency) + resp := new(pb.PlaceOrderResponse) + return resp, nil +} From f06818db0cf8937096be5c13e637b0c30a0f3929 Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Thu, 21 Jun 2018 12:15:53 -0700 Subject: [PATCH 8/9] checkoutservice: partial implementation Signed-off-by: Ahmet Alp Balkan --- src/checkoutservice/Dockerfile | 13 ++++++++++++ src/checkoutservice/main.go | 37 +++++++++++++++++++++++++++------- 2 files changed, 43 insertions(+), 7 deletions(-) create mode 100644 src/checkoutservice/Dockerfile diff --git a/src/checkoutservice/Dockerfile b/src/checkoutservice/Dockerfile new file mode 100644 index 0000000..62907c3 --- /dev/null +++ b/src/checkoutservice/Dockerfile @@ -0,0 +1,13 @@ +FROM golang:1.10-alpine as builder +RUN apk add --no-cache ca-certificates git +WORKDIR /src/microservices-demo/catalogservice +COPY . . +RUN go get -d ./... +RUN go build -v -o /catalogservice . + +FROM alpine as release +RUN apk add --no-cache \ + ca-certificates +COPY --from=builder /catalogservice /catalogservice +EXPOSE 5000 +ENTRYPOINT /catalogservice diff --git a/src/checkoutservice/main.go b/src/checkoutservice/main.go index 7225898..49b744f 100644 --- a/src/checkoutservice/main.go +++ b/src/checkoutservice/main.go @@ -7,6 +7,9 @@ import ( "net" "os" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + pb "./genproto" "google.golang.org/grpc" ) @@ -31,21 +34,22 @@ func main() { } svc := new(checkoutService) - mustMapEnv(&svc.productCatalogSvcAddr, "PRODUCT_CATALOG_SERVICE_ADDR") - mustMapEnv(&svc.cartSvcAddr, "CART_SERVICE_ADDR") - mustMapEnv(&svc.currencySvcAddr, "CURRENCY_SERVICE_ADDR") mustMapEnv(&svc.shippingSvcAddr, "SHIPPING_SERVICE_ADDR") - mustMapEnv(&svc.emailSvcAddr, "EMAIL_SERVICE_ADDR") - mustMapEnv(&svc.paymentSvcAddr, "PAYMENT_SERVICE_ADDR") + // mustMapEnv(&svc.productCatalogSvcAddr, "PRODUCT_CATALOG_SERVICE_ADDR") + // mustMapEnv(&svc.cartSvcAddr, "CART_SERVICE_ADDR") + // mustMapEnv(&svc.currencySvcAddr, "CURRENCY_SERVICE_ADDR") + // mustMapEnv(&svc.emailSvcAddr, "EMAIL_SERVICE_ADDR") + // mustMapEnv(&svc.paymentSvcAddr, "PAYMENT_SERVICE_ADDR") + + log.Printf("service config: %+v", svc) - log.Printf("starting to listen on tcp/%s", port) lis, err := net.Listen("tcp", fmt.Sprintf(":%s", port)) if err != nil { log.Fatal(err) } srv := grpc.NewServer() pb.RegisterCheckoutServiceServer(srv, svc) - log.Println("starting to listen on tcp: %q", lis.Addr().String()) + log.Printf("starting to listen on tcp: %q", lis.Addr().String()) log.Fatal(srv.Serve(lis)) } @@ -60,6 +64,25 @@ func mustMapEnv(target *string, envKey string) { func (cs *checkoutService) CreateOrder(ctx context.Context, req *pb.CreateOrderRequest) (*pb.CreateOrderResponse, error) { log.Printf("[CreateOrder] user_id=%q user_currency=%q", req.UserId, req.UserCurrency) resp := new(pb.CreateOrderResponse) + conn, err := grpc.Dial(cs.shippingSvcAddr, grpc.WithInsecure()) + if err != nil { + return nil, status.Errorf(codes.Unavailable, "could not connect shippping service: %+v", err) + } + defer conn.Close() + + shippingQuote, err := pb.NewShippingServiceClient(conn). + GetQuote(ctx, &pb.GetQuoteRequest{ + Address: req.Address, + Items: nil}) // TODO(ahmetb): query CartService for items + if err != nil { + return nil, status.Errorf(codes.Unavailable, "failed to get shipping quote: %+v", err) + } + resp.ShippingCost = &pb.Money{ + Amount: shippingQuote.GetCostUsd(), + CurrencyCode: "USD", // TOD(ahmetb) convert to req.UserCurrency + } + // TODO(ahmetb) calculate resp.OrderItem with req.UserCurrency + return resp, nil } From 4ade7ddb29e2665ec0eef13235581987d007dbc1 Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Thu, 21 Jun 2018 12:40:07 -0700 Subject: [PATCH 9/9] remove -v from go-build dockerfiles Signed-off-by: Ahmet Alp Balkan --- src/checkoutservice/Dockerfile | 2 +- src/productcatalogservice/Dockerfile | 2 +- src/shippingservice/Dockerfile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/checkoutservice/Dockerfile b/src/checkoutservice/Dockerfile index 62907c3..8b5ae93 100644 --- a/src/checkoutservice/Dockerfile +++ b/src/checkoutservice/Dockerfile @@ -3,7 +3,7 @@ RUN apk add --no-cache ca-certificates git WORKDIR /src/microservices-demo/catalogservice COPY . . RUN go get -d ./... -RUN go build -v -o /catalogservice . +RUN go build -o /catalogservice . FROM alpine as release RUN apk add --no-cache \ diff --git a/src/productcatalogservice/Dockerfile b/src/productcatalogservice/Dockerfile index 245dfe3..12878d9 100644 --- a/src/productcatalogservice/Dockerfile +++ b/src/productcatalogservice/Dockerfile @@ -5,7 +5,7 @@ RUN apk add --no-cache \ WORKDIR /src/microservices-demo/productcatalogservice COPY . . RUN go get -d ./... -RUN go build -v -o /productcatalogservice . +RUN go build -o /productcatalogservice . FROM alpine as release RUN apk add --no-cache \ diff --git a/src/shippingservice/Dockerfile b/src/shippingservice/Dockerfile index 5f89b24..2066a07 100644 --- a/src/shippingservice/Dockerfile +++ b/src/shippingservice/Dockerfile @@ -5,7 +5,7 @@ RUN apk add --no-cache \ WORKDIR /src/microservices-demo/shippingservice COPY . . RUN go get -d ./... -RUN go build -v -o /shippingservice . +RUN go build -o /shippingservice . FROM alpine as release COPY --from=builder /shippingservice /shippingservice