-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgRPC_store_inventory_pb2_grpc.py
280 lines (259 loc) · 12 KB
/
gRPC_store_inventory_pb2_grpc.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
import gRPC_store_inventory_pb2 as gRPC__store__inventory__pb2
class ProductInventoryStub(object):
"""All functions specific to the gRPC server
"""
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.determineSuccessfulConnection = channel.unary_unary(
'/ecommerce.ProductInventory/determineSuccessfulConnection',
request_serializer=gRPC__store__inventory__pb2.Empty.SerializeToString,
response_deserializer=gRPC__store__inventory__pb2.Empty.FromString,
)
self.addProduct = channel.unary_unary(
'/ecommerce.ProductInventory/addProduct',
request_serializer=gRPC__store__inventory__pb2.Product.SerializeToString,
response_deserializer=gRPC__store__inventory__pb2.ProductID.FromString,
)
self.addOrder = channel.unary_unary(
'/ecommerce.ProductInventory/addOrder',
request_serializer=gRPC__store__inventory__pb2.Order.SerializeToString,
response_deserializer=gRPC__store__inventory__pb2.OrderID.FromString,
)
self.getProduct = channel.unary_unary(
'/ecommerce.ProductInventory/getProduct',
request_serializer=gRPC__store__inventory__pb2.ProductID.SerializeToString,
response_deserializer=gRPC__store__inventory__pb2.Product.FromString,
)
self.getOrder = channel.unary_unary(
'/ecommerce.ProductInventory/getOrder',
request_serializer=gRPC__store__inventory__pb2.OrderID.SerializeToString,
response_deserializer=gRPC__store__inventory__pb2.Order.FromString,
)
self.updateProduct = channel.unary_unary(
'/ecommerce.ProductInventory/updateProduct',
request_serializer=gRPC__store__inventory__pb2.UpdateProductInfo.SerializeToString,
response_deserializer=gRPC__store__inventory__pb2.Product.FromString,
)
self.updateOrder = channel.unary_unary(
'/ecommerce.ProductInventory/updateOrder',
request_serializer=gRPC__store__inventory__pb2.UpdateOrderInfo.SerializeToString,
response_deserializer=gRPC__store__inventory__pb2.Order.FromString,
)
self.addProductsToOrder = channel.unary_unary(
'/ecommerce.ProductInventory/addProductsToOrder',
request_serializer=gRPC__store__inventory__pb2.AddToOrder.SerializeToString,
response_deserializer=gRPC__store__inventory__pb2.Order.FromString,
)
self.removeProductsFromOrder = channel.unary_unary(
'/ecommerce.ProductInventory/removeProductsFromOrder',
request_serializer=gRPC__store__inventory__pb2.RemoveFromOrder.SerializeToString,
response_deserializer=gRPC__store__inventory__pb2.Order.FromString,
)
self.listProducts = channel.unary_stream(
'/ecommerce.ProductInventory/listProducts',
request_serializer=gRPC__store__inventory__pb2.ListProductsInfo.SerializeToString,
response_deserializer=gRPC__store__inventory__pb2.Product.FromString,
)
self.listOrders = channel.unary_stream(
'/ecommerce.ProductInventory/listOrders',
request_serializer=gRPC__store__inventory__pb2.OrderStatus.SerializeToString,
response_deserializer=gRPC__store__inventory__pb2.Order.FromString,
)
self.clearDatabase = channel.unary_unary(
'/ecommerce.ProductInventory/clearDatabase',
request_serializer=gRPC__store__inventory__pb2.Empty.SerializeToString,
response_deserializer=gRPC__store__inventory__pb2.Empty.FromString,
)
class ProductInventoryServicer(object):
"""All functions specific to the gRPC server
"""
def determineSuccessfulConnection(self, request, context):
"""
Determines a successful Connection between client and server
Parameter: Empty
Returns: Empty
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def addProduct(self, request, context):
"""
Add a product to the database. A product must not have the same name as another product
Parameter: Product
Returns: ProductID
Return value may be null product id, in which case the user specified Product name was invalid
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def addOrder(self, request, context):
"""
Add an order to the database
Parameter: Order
Returns: OrderID
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def getProduct(self, request, context):
"""
Get a product from the database by specifying either the product's id value or the product's name
Parameter: ProductID
Returns: Product
Return value may be the null product, in which case the user specified product id value or name was invalid
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def getOrder(self, request, context):
"""
Get an order from the database by specifying the order's id value
Parameter: OrderID
Returns: Order
Return value may be null order, in which case the user specified id value was invalid
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def updateProduct(self, request, context):
"""
Update a product currently in the database, denoting it by either its id value or its name
Parameter: UpdateProductInfo
Returns: Product
Return value may be null product in which case the user specified id value or name was invalid
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def updateOrder(self, request, context):
"""
Update an order currently in the database, denoting it by its id value
Parameter: UpdateOrderInfo
Returns: Order
Return value may be null order, in which case the user specified id value was invalid
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def addProductsToOrder(self, request, context):
"""
Add products currently in the database to an order or add to the quantity of a product already in an order
This will update the products stock automatically
Parameter: AddToOrder
Returns: Order
Return value may be null order, in which case the user specified id value was invalid
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def removeProductsFromOrder(self, request, context):
"""
Remove products from a order or remove quantities of products already in an order.
This will update the products stock automatically
Parameter: RemoveFromOrder
Returns: Order
Return value may be null order, in which case user specified id value was invalid
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def listProducts(self, request, context):
"""
List all products currently in the database.
The list of products can be narrowed down by specifying if product are in stock and/or the manufacturer
Parameter: ListProductsInfo
Returns: Stream of Product
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def listOrders(self, request, context):
"""
List all orders currently in the database.
The list of orders can be narrowed down by shipped status and/or paid status of the orders
Parameter: OrderStatus
Returns: Stream of Order
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def clearDatabase(self, request, context):
"""
Wipes the database file
Parameter: Empty
Returns: Empty
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def add_ProductInventoryServicer_to_server(servicer, server):
rpc_method_handlers = {
'determineSuccessfulConnection': grpc.unary_unary_rpc_method_handler(
servicer.determineSuccessfulConnection,
request_deserializer=gRPC__store__inventory__pb2.Empty.FromString,
response_serializer=gRPC__store__inventory__pb2.Empty.SerializeToString,
),
'addProduct': grpc.unary_unary_rpc_method_handler(
servicer.addProduct,
request_deserializer=gRPC__store__inventory__pb2.Product.FromString,
response_serializer=gRPC__store__inventory__pb2.ProductID.SerializeToString,
),
'addOrder': grpc.unary_unary_rpc_method_handler(
servicer.addOrder,
request_deserializer=gRPC__store__inventory__pb2.Order.FromString,
response_serializer=gRPC__store__inventory__pb2.OrderID.SerializeToString,
),
'getProduct': grpc.unary_unary_rpc_method_handler(
servicer.getProduct,
request_deserializer=gRPC__store__inventory__pb2.ProductID.FromString,
response_serializer=gRPC__store__inventory__pb2.Product.SerializeToString,
),
'getOrder': grpc.unary_unary_rpc_method_handler(
servicer.getOrder,
request_deserializer=gRPC__store__inventory__pb2.OrderID.FromString,
response_serializer=gRPC__store__inventory__pb2.Order.SerializeToString,
),
'updateProduct': grpc.unary_unary_rpc_method_handler(
servicer.updateProduct,
request_deserializer=gRPC__store__inventory__pb2.UpdateProductInfo.FromString,
response_serializer=gRPC__store__inventory__pb2.Product.SerializeToString,
),
'updateOrder': grpc.unary_unary_rpc_method_handler(
servicer.updateOrder,
request_deserializer=gRPC__store__inventory__pb2.UpdateOrderInfo.FromString,
response_serializer=gRPC__store__inventory__pb2.Order.SerializeToString,
),
'addProductsToOrder': grpc.unary_unary_rpc_method_handler(
servicer.addProductsToOrder,
request_deserializer=gRPC__store__inventory__pb2.AddToOrder.FromString,
response_serializer=gRPC__store__inventory__pb2.Order.SerializeToString,
),
'removeProductsFromOrder': grpc.unary_unary_rpc_method_handler(
servicer.removeProductsFromOrder,
request_deserializer=gRPC__store__inventory__pb2.RemoveFromOrder.FromString,
response_serializer=gRPC__store__inventory__pb2.Order.SerializeToString,
),
'listProducts': grpc.unary_stream_rpc_method_handler(
servicer.listProducts,
request_deserializer=gRPC__store__inventory__pb2.ListProductsInfo.FromString,
response_serializer=gRPC__store__inventory__pb2.Product.SerializeToString,
),
'listOrders': grpc.unary_stream_rpc_method_handler(
servicer.listOrders,
request_deserializer=gRPC__store__inventory__pb2.OrderStatus.FromString,
response_serializer=gRPC__store__inventory__pb2.Order.SerializeToString,
),
'clearDatabase': grpc.unary_unary_rpc_method_handler(
servicer.clearDatabase,
request_deserializer=gRPC__store__inventory__pb2.Empty.FromString,
response_serializer=gRPC__store__inventory__pb2.Empty.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'ecommerce.ProductInventory', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))