-
Notifications
You must be signed in to change notification settings - Fork 0
/
product.proto
70 lines (54 loc) · 1.17 KB
/
product.proto
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
syntax = "proto3";
package product;
option go_package = "/product";
service ProductCatalogService {
rpc ListProducts(ListProductsReq) returns (ListProductsResp) {}
rpc GetProduct(GetProductReq) returns (GetProductResp) {}
rpc SearchProducts(SearchProductsReq) returns (SearchProductsResp) {}
rpc CreateProduct(CreateReq) returns (CreateResp) {}
rpc DeleteProduct(DeleteReq) returns (DeleteResp) {}
}
message CreateReq {
string name = 2;
string description = 3;
string picture = 4;
float price = 5;
repeated string categories = 6;
}
message CreateResp {
uint32 id = 1;
}
message DeleteReq {
uint32 id = 1;
}
message DeleteResp {
bool is = 1;
}
message ListProductsReq{
int32 page = 1;
int64 pageSize = 2;
string categoryName = 3;
}
message Product {
uint32 id = 1;
string name = 2;
string description = 3;
string picture = 4;
float price = 5;
repeated string categories = 6;
}
message ListProductsResp {
repeated Product products = 1;
}
message GetProductReq {
uint32 id = 1;
}
message GetProductResp {
Product product = 1;
}
message SearchProductsReq {
string query = 1;
}
message SearchProductsResp {
repeated Product results = 1;
}