-
Notifications
You must be signed in to change notification settings - Fork 0
/
treehole.proto
235 lines (203 loc) · 5.88 KB
/
treehole.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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
syntax = "proto3";
package model;
import "auth.proto";
import "user.proto";
import "category.proto";
import "tag.proto";
import "thread.proto";
import "post.proto";
import "rate.proto";
import "identity.proto";
import "setting.proto";
import "report.proto";
import "notification.proto";
import "subscribe.proto";
import "user_device.proto";
import "site_config.proto";
import "punishment.proto";
service TreeHole {
rpc Ping (EmptyRequest) returns (EmptyRequest) {}
rpc GetOAuthConfig (OAuthConfigRequest) returns (OAuthConfigResponse) {}
rpc GetSiteConfig (EmptyRequest) returns (SiteConfig) {}
rpc OAuthLogin (OAuthLoginRequest) returns (OAuthLoginResponse) {}
rpc RegisterDevice (UserDevice) returns (EmptyRequest) {}
rpc GetProfile (EmptyRequest) returns (User) {}
rpc SetActiveIdentity (IDRequest) returns (User) {}
rpc GetAllCategories (EmptyRequest) returns (CategoriesResponse) {}
rpc GetAllTags (TagsRequest) returns (TagsResponse) {}
rpc GetHottestThreads (ThreadsQueryRequest) returns (ThreadsResponse) {}
rpc GetLatestThreads (ThreadsQueryRequest) returns (ThreadsResponse) {}
rpc GetUserThreads (ThreadsQueryRequest) returns (ThreadsResponse) {}
rpc GetUserPosts (PostsQueryRequest) returns (PostsResponse) {}
rpc GetUserFavThreads (ThreadsQueryRequest) returns (ThreadsResponse) {}
rpc GetUserParticipateThreads (ThreadsQueryRequest) returns (ThreadsResponse) {}
rpc GetThreadUserIdentities (Thread) returns (IdentitiesResponse) {}
rpc GetThread (PostsQueryRequest) returns (Thread) {}
rpc GetThreadPosts (PostsQueryRequest) returns (PostsResponse) {}
rpc GetThreadPostsEx (PostsQueryRequestEx) returns (PostsResponse) {}
rpc GetPost (Post) returns (Post) {}
rpc RateThread (RateRequest) returns (Thread) {}
rpc FavThread (FavRequest) returns (Thread) {}
rpc RatePost (RateRequest) returns (Post) {}
rpc AppreciateThread (AppreciateRequest) returns (Thread) {}
rpc AppreciatePost (AppreciateRequest) returns (Post) {}
rpc PutPost (Post) returns (Post) {}
rpc DeletePost (Post) returns (EmptyRequest) {}
rpc PutThread (Thread) returns (Thread) {}
rpc DeleteThread (Thread) returns (EmptyRequest) {}
rpc CreateIdentity (EmptyRequest) returns (User) {}
rpc DisableIdentity (Identity) returns (User) {}
rpc GetCreateIdentityQuota (EmptyRequest) returns (QuotaResponse) {}
rpc UpdateSetting (Setting) returns (Setting) {}
rpc PutReport (Report) returns (Report) {}
rpc SearchThreads (SearchRequest) returns (ThreadsResponse) {}
rpc GetUnreadNotificationCount (EmptyRequest) returns (CountReply) {}
rpc PutNotificationRead (Notification) returns (EmptyRequest) {}
rpc PutAllNotificationRead (EmptyRequest) returns (EmptyRequest) {}
rpc GetAllNotifications (NotificationQueryRequest) returns (NotificationResponse) {}
rpc PutSubscribe (Subscribe) returns (Subscribe) {}
rpc GetSubscribe (Subscribe) returns (Subscribe) {}
rpc GetBrowsableTags (EmptyRequest) returns (TagsResponse) {}
rpc CheckIn (EmptyRequest) returns (FishResponse) {}
rpc GetUploadUrl (UploadRequest) returns (UploadResponse) {}
rpc GetUserStats (EmptyRequest) returns (UserStatsResponse) {}
rpc GetDownloadUrl (UploadResponse) returns (UploadResponse) {}
rpc GetPunishments (EmptyRequest) returns (PunishmentsResponse) {}
}
enum Sort {
SortAsc = 0;
SortDesc = 1;
SortPopular = 2;
}
message OAuthConfigRequest {
OAuthLoginChannel channel = 1;
LoginSource source = 2;
}
message OAuthConfigResponse {
string authorize_url = 1;
string client_id = 2;
repeated string scopes = 3;
}
message OAuthLoginRequest {
string code = 1;
OAuthLoginChannel channel = 2;
LoginSource source = 3;
WebSource web_source = 4;
}
message OAuthLoginResponse {
string token = 1;
}
message EmptyRequest {}
message CategoriesResponse {
repeated Category categories = 1;
}
message TagsRequest {
bool all = 1;
}
message TagsResponse {
repeated Tag tags = 1;
}
message ThreadsQueryRequest {
int64 last = 1 [jstype = JS_STRING];
uint32 size = 2;
Sort sort = 3;
uint64 category_id = 4;
repeated uint64 tag_ids = 5;
}
message PostsQueryRequest {
uint64 thread_id = 1;
uint64 last = 2;
uint64 top = 3;
uint32 size = 4;
Sort sort = 5;
bool only_author = 6;
bool should_statistic = 7;
}
enum LoadDirection {
LoadDirectionDown = 0;
LoadDirectionUp = 1;
}
message PostsQueryRequestEx {
uint64 thread_id = 1;
uint64 last = 2;
uint64 top = 3;
uint32 size = 4;
Sort sort = 5;
bool only_author = 6;
LoadDirection direction = 7;
}
message ThreadsResponse {
repeated Thread threads = 1;
}
message PostsResponse {
repeated Post posts = 1;
uint64 total = 2;
}
message RateRequest {
uint64 id = 1;
RateType type = 2;
}
message AppreciateRequest {
uint64 id = 1;
int32 amount = 2;
}
message FavRequest {
uint64 id = 1;
bool is_fav = 2;
}
message IDRequest {
uint64 id = 1;
}
message QuotaResponse {
uint64 monthly_remain = 1;
uint64 remain = 2;
}
message SearchRequest {
string keyword = 1;
uint32 page_size = 2;
uint32 offset = 3;
}
message CountReply {
uint64 count = 1;
}
message NotificationQueryRequest {
int64 last = 1 [jstype = JS_STRING];
uint64 page_size = 2;
bool only_unread = 3;
NotificationType type = 4;
}
message NotificationResponse {
repeated Notification notifications = 1;
}
message IdentitiesResponse {
repeated Identity identities = 1;
}
message FishResponse {
double fish_count = 1;
}
message UploadRequest {
string file_name = 1;
uint64 size = 2;
string md5 = 3;
string content_type = 4;
uint64 width = 5;
uint64 height = 6;
}
message UploadResponse {
string uuid = 1;
string url = 2;
string name = 3;
uint64 width = 4;
uint64 height = 5;
}
message UserStatsResponse {
int64 thread_count = 1;
int64 post_count = 2;
int64 got_like_count = 3;
int64 got_hate_count = 4;
int64 sent_like_count = 5;
int64 sent_hate_count = 6;
}
message PunishmentsResponse {
repeated Punishment punishments = 1;
}