-
Notifications
You must be signed in to change notification settings - Fork 0
/
service.proto
118 lines (93 loc) · 1.92 KB
/
service.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
syntax = "proto3";
package awakari.subscriptions.proxy;
option go_package = "./api/grpc/subscriptions";
import "google/protobuf/timestamp.proto";
service Service {
rpc Create(CreateRequest) returns (CreateResponse);
rpc Read(ReadRequest) returns (ReadResponse);
rpc Update(UpdateRequest) returns (UpdateResponse);
rpc Delete(DeleteRequest) returns (DeleteResponse);
rpc SearchOwn(SearchOwnRequest) returns (SearchOwnResponse);
}
// Create
message CreateRequest {
string description = 1;
bool enabled = 2;
Condition cond = 3;
google.protobuf.Timestamp expires = 4;
}
// Condition represents the Subscription routing Condition data that is immutable once Subscription is created.
message Condition {
bool not = 1;
oneof cond {
GroupCondition gc = 2;
TextCondition tc = 3;
NumberCondition nc = 4;
}
}
message GroupCondition {
GroupLogic logic = 1;
repeated Condition group = 2;
}
enum GroupLogic {
And = 0;
Or = 1;
Xor = 2;
}
message TextCondition {
string id = 1; // leave it unset when create
string key = 2;
string term = 3;
bool exact = 4;
}
message NumberCondition {
string id = 1; // skip when create
string key = 2;
Operation op = 3;
double val = 4;
}
enum Operation {
Undefined = 0;
Gt = 1;
Gte = 2;
Eq = 3;
Lte = 4;
Lt = 5;
}
message CreateResponse {
string id = 1;
}
// Read
message ReadRequest {
string id = 1;
}
message ReadResponse {
string description = 1;
bool enabled = 2;
Condition cond = 3;
google.protobuf.Timestamp expires = 4;
}
// Update
message UpdateRequest {
string id = 1;
string description = 2;
bool enabled = 3;
google.protobuf.Timestamp expires = 4;
Condition cond = 5;
}
message UpdateResponse {
}
// Delete
message DeleteRequest {
string id = 1;
}
message DeleteResponse {
}
// SearchOwn
message SearchOwnRequest {
string cursor = 1;
uint32 limit = 2;
}
message SearchOwnResponse {
repeated string ids = 1;
}