-
Notifications
You must be signed in to change notification settings - Fork 0
/
service.proto
163 lines (126 loc) · 2.54 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
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
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);
rpc Search(SearchRequest) returns (SearchResponse);
}
// Create
message CreateRequest {
string description = 1;
bool enabled = 2;
Condition cond = 3;
google.protobuf.Timestamp expires = 4;
bool public = 5;
}
// 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;
google.protobuf.Timestamp created = 5;
google.protobuf.Timestamp updated = 6;
bool public = 7;
int64 followers = 8;
}
// Update
message UpdateRequest {
string id = 1;
string description = 2;
bool enabled = 3;
google.protobuf.Timestamp expires = 4;
Condition cond = 5;
bool public = 6;
}
message UpdateResponse {
}
// Delete
message DeleteRequest {
string id = 1;
}
message DeleteResponse {
}
// SearchOwn
message SearchOwnRequest {
string cursor = 1;
uint32 limit = 2;
Order order = 3;
string pattern = 4;
}
enum Order {
ASC = 0;
DESC = 1;
}
message SearchOwnResponse {
repeated string ids = 1;
}
// Search (including public interests)
// Search
message SearchRequest {
Cursor cursor = 1;
uint32 limit = 2;
Order order = 3;
string Pattern = 4;
Sort sort = 5;
}
message Cursor {
string id = 1;
int64 followers = 2;
}
enum Sort {
ID = 0;
FOLLOWERS = 1;
}
message SearchResponse {
repeated string ids = 1;
}