/
api.proto
136 lines (113 loc) · 3.24 KB
/
api.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
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
syntax = "proto3";
package api;
option go_package = "github.com/henvic/pgxtutorial/internal/api";
// Inventory gRPC API service.
service Inventory {
rpc SearchProducts (SearchProductsRequest) returns (SearchProductsResponse) {}
rpc CreateProduct (CreateProductRequest) returns (CreateProductResponse) {}
rpc UpdateProduct (UpdateProductRequest) returns (UpdateProductResponse) {}
rpc DeleteProduct (DeleteProductRequest) returns (DeleteProductResponse) {}
rpc GetProduct (GetProductRequest) returns (GetProductResponse) {}
rpc CreateProductReview (CreateProductReviewRequest) returns (CreateProductReviewResponse) {}
rpc UpdateProductReview (UpdateProductReviewRequest) returns (UpdateProductReviewResponse) {}
rpc DeleteProductReview (DeleteProductReviewRequest) returns (DeleteProductReviewResponse) {}
rpc GetProductReview (GetProductReviewRequest) returns (GetProductReviewResponse) {}
}
// SearchProductsRequest message.
message SearchProductsRequest {
string query_string = 1;
optional int64 min_price = 2;
optional int64 max_price = 3;
optional int32 page = 4;
}
// SearchProductsResponse message.
message SearchProductsResponse {
int32 total = 1;
repeated Product items = 2;
}
// Product message.
message Product {
string id = 1;
int64 price = 2;
string name = 3;
string description = 4;
}
// CreateProductRequest message.
message CreateProductRequest {
string id = 1;
string name = 2;
string description = 3;
int64 price = 4;
}
// CreateProductResponse message.
message CreateProductResponse {}
// UpdateProductRequest message.
message UpdateProductRequest {
string id = 1;
optional string name = 2;
optional string description = 3;
optional int64 price = 4;
}
// UpdateProductResponse message.
message UpdateProductResponse {}
// DeleteProductRequest message.
message DeleteProductRequest {
string id = 1;
}
// DeleteProductResponse message.
message DeleteProductResponse {}
// GetProductRequest message.
message GetProductRequest {
string id = 1;
}
// GetProductResponse message.
message GetProductResponse {
string id = 1;
int64 price = 2;
string name = 3;
string description = 4;
string created_at = 5;
string modified_at = 6;
}
// CreateProductReviewRequest message.
message CreateProductReviewRequest {
string product_id = 2;
string reviewer_id = 3;
int32 score = 4;
string title = 5;
string description = 6;
}
// CreateProductReviewResponse message.
message CreateProductReviewResponse {
string id = 1;
}
// UpdateProductReviewRequest message.
message UpdateProductReviewRequest {
string id = 1;
optional int32 score = 4;
optional string title = 5;
optional string description = 6;
}
// UpdateProductReviewResponse message.
message UpdateProductReviewResponse {}
// DeleteProductReviewRequest message.
message DeleteProductReviewRequest {
string id = 1;
}
// DeleteProductReviewResponse message.
message DeleteProductReviewResponse {}
// GetProductReviewRequest message.
message GetProductReviewRequest {
string id = 1;
}
// GetProductReviewResponse message.
message GetProductReviewResponse {
string id = 1;
string product_id = 2;
string reviewer_id = 3;
int32 score = 4;
string title = 5;
string description = 6;
string created_at = 7;
string modified_at = 8;
}