-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.proto
68 lines (54 loc) · 1.27 KB
/
schema.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
syntax = "proto3";
option go_package = "github.com/MicrexIT/schema";
package schema;
import "google/api/annotations.proto";
message ProductWatched {
string product = 1;
string visitor = 2;
}
message Product {
string name = 1;
int64 watched = 2;
int64 bought = 3;
}
message CustomerBought {
string product = 1;
string customer = 2;
}
message CustomerBoughtMany {
repeated CustomerBought customerBoughtMany = 1;
}
message Customer {
string name = 1;
int64 products = 2;
}
message Status {
uint32 status = 1;
}
message Empty {}
service Publisher {
rpc PublishProduct(ProductWatched) returns (Status) {
option (google.api.http) = {
post: "/v1/product/{product}/watched/{visitor}"
body: "*"
};
}
rpc PublishCustomer(CustomerBoughtMany) returns (Status) {
option (google.api.http) = {
post: "/v1/customer/bought"
body: "*"
};
}
}
service Inspector {
rpc InspectProduct(Empty) returns (stream Product) {
option (google.api.http) = {
get: "/v1/product/inspect"
};
}
rpc InspectCustomer(Empty) returns (stream Customer) {
option (google.api.http) = {
get: "/v1/customer/inspect"
};
}
}