-
Notifications
You must be signed in to change notification settings - Fork 2
/
geekapk_v1b_api.geekspec
274 lines (182 loc) · 7.94 KB
/
geekapk_v1b_api.geekspec
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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# All APIs for GeekApk v1.0b except apiHint
# author duangsuse
# version 1.0b
# spec JsonRpc
# GeekSpec DSL definition: https://github.com/duangsuse/GeekApk/blob/add-controller-template/geekspec_dsl_parser.pegjs
#@ Auth user scheme(Token, Cookie): uid=gaUser tok=gaHash
#@ Auth serverAdmin scheme(Token, Cookie): uid=gaUser tok=gaHash admin_tok=gaModTok
## Server Info API section
serverVersion() -> plain
= /serverVersion
serverDescription() -> plain
= /serverDescription
serverBoot() -> datetime
= /serverBoot
serverDetail() -> object:string
= /serverDetail
## Server ADMIN api section
## All ADMIN apis except deleteApp, transferAppCategory, removeComment, flagUser should have serverAdmin permission
POST@createUser(username:String) -> object:GeekUser
= /admin/makeUser
PUT@resetSharedHash(uid-path:UserId, shash:String?) -> plain
= /admin/resetMetaHash/{uid}
DELETE@deleteUser(uid-path:UserId) -> object:GeekUser
= /admin/dropUser/{uid}
#### Requires superuser session
PUT@flagUser(uid-path:UserId, flag:Int) -> object:GeekUser
= /admin/flagUser/{uid}
POST@createCategory(name:String) -> object:Category
= /admin/makeCategory
PUT@renameCategory(id-path:CategoryId, name:String) -> object:Category
= /admin/nameCategory/{id}
DELETE@deleteCategory(id-path:CategoryId) -> object:Category
= /admin/dropCategory/{id}
#### Requires superuser session
DELETE@deleteApp(aid-path:AppId) -> object:App
= /admin/dropApp/{aid}
#### Requires superuser session
PUT@transferAppCategory(aid-path:AppId, cid:CategoryId) -> [$aid:number, $old:number, $new:number]
= /admin/moveApp/{aid}
PUT@transferAppOwner(aid-path:AppId, uid:UserId) -> [$aid:number, $old:number, $new:number]
= /admin/transferApp/{aid}
DELETE@deleteAppUpdate(aid-path:AppId, rev-path:Int) -> object:AppUpdate
= /admin/dropAppUpdate/{aid}/{rev}
#### Requires superuser session
DELETE@removeComment(cid-path:CommentId) -> [$cid:number, $deletedSubComments:number]
= /admin/dropComment/{cid}
## GeekApk Categories section
categoryList() -> array:Category
= /category/all
categoryName(id-path:CategoryId) -> plain
= /category/{id}
## GeekApk Users section
readUser(id-path:UserId) -> object:GeekUser
= /user/{id}
### Requires user permission
PUT@updateUser(id-path:UserId, prop:String{username, nickname, avatar, bio, metaApp}, value-body:String)
-> [$user:number, $prop:string, $old:string, $new:string]
= /user/{id}
PUT@resetHash(id-path:UserId, shash:String, hash:String)
-> [$id:number, $newShash:string, $newHash:string]
= /user/{id}/hash
checkHash(id-path:UserId, hash:String)
-> [$valid:boolean, $message:string]
= /user/{id}/checkHash
listUser(sort:String?{created, followers}, sliceFrom:UserSize?, sliceTo:UserSize?) -> array:GeekUser
= /user/all
listMetaUser(sort:String?{created, followers}, sliceFrom:UserSize?, sliceTo:UserSize?) -> array:GeekUser
= /user/allHasMetaApp
searchUser(type:String?{username, nickname, bio}, kw-path:String, sort:String?{created, followers}) -> array:GeekUser
= /user/search/{kw}
PUT@updateOnlineTime(id-path:UserId)
= /user/{id}/online
## GeekApk Timeline section
readUserTimeline(uid-path:UserId, type:Int?, sliceFrom:TimelineSize?, sliceTo:TimelineSize?) -> array:Timeline
= /timeline/{uid}
readAllTimeline(type:Int?, sliceFrom:TimelineSize?, sliceTo:TimelineSize?) -> array:Timeline
= /timeline/all
bulkReadUserTimeline(uids-path:String, type:Int?, sliceFrom:TimelineSize?, sliceTo:TimelineSize?) -> array:Timeline
= /timeline/bulk/{uids}
getUserTimelineCount(uid-path:UserId) -> number
= /timeline/check/{uid}
getBulkUserTimelineCount(uids-path:String) -> number
= /timeline/check/{uids}
## GeekApk notifications section
### All interface access requires user(owner) permission
readMineNotifications() -> array:Notification
= /notification/active
readAllMineNotifications(sliceFrom:NotificationSize?, sliceTo:NotificationSize?) -> array:Notification
= /notification/all
markNotifications(start:NotificationSize, end:NotificationSize?, stat:String{active, inactive}) -> number
= /notification/mark
getNotificationCount() -> number
= /notification/count
## GeekApk Apps section
### All non-GET interface access requires (readwrite) user(owner) permission
readApp(aid-path:AppId) -> object:App
= /app/{aid}
PUT@updateApp(aid-path:AppId, attr:String{package, icon, name, screenshots, readme}, val-body:String)
-> [$attr:String, $oldVal:String]
= /app/{aid}
POST@createApp(package:String, category:CategoryId) -> object:App
= /app
findAppWithPackageName(package-path:String) -> object:App
= /app/package/{package}
listApp(inCategory:CategoryId?, sort:String?{updated, comments, stars, created}, sliceFrom:AppSize?, sliceTo:AppSize?)
-> array:App = /app/all
DELETE@dropApp(aid-path:AppId) -> object:App
= /app/{aid}
searchApp(inCategory:CategoryId?, content-path:String, type:String{name, package, icon, readme}, sort:String?{updated, comments, stars, created})
= /app/search/{content}
### GeekApk app collaborators
POST@addCollab(uid:UserId, aid-path:AppId)
= /app/{aid}/collab
DELETE@removeCollab(uid:UserId, aid-path:AppId)
= /app/{aid}/collab
collaborators(aid-path:AppId) -> array:number
= /app/collaborators/{aid}
collaborated(uid-path:UserId) -> array:number
= /app/collaborated/{uid}
## GeekApk Application updates
### All non-GET interface access requires (readwrite) user(owner) permission
readReversions(aid-path:AppId) -> array:AppUpdate
= /appUpdate/{aid}
checkLastReversions(aids-path:String) -> array:number
= /appUpdate/check/{aids}
readReversion(aid-path:AppId, rev-path:Int) -> object:AppUpdate
= /appUpdate/{aid}/{rev}
POST@createReversion(aid-path:AppId, rev-path:Int) -> [$aid:number, $rev:number]
= /appUpdate/{aid}/{rev}
PUT@updateReversion(aid-path:AppId, rev-path:Int, attr:String{version, install, updates, minsdk}, val-body:String) -> [$attr:string, $oldVal:string]
= /appUpdate/{aid}/{rev}
DELETE@dropReversion(aid-path:AppId, rev-path:Int) -> object:AppUpdate
= /appUpdate/{aid}/{rev}
## GeekApk comments
### All non-GET interface access requires (readwrite) user(owner) permission
searchComment(inApp:AppId?, user:UserId?, repliesTo:CommentId?, content-path:String) -> array:Comment
= /comment/search/{content}
listCommentInApp(aid-path:AppId, sliceFrom:CommentSize?, sliceTo:CommentSize?) -> array:Comment
= /comment/{aid}
listSubComment(cid-path:CommentId) -> array:Comment
= /comment/subOf/{cid}
listAllComment(inApp:AppId?, user:UserId?, sliceFrom:CommentSize?, sliceTo:CommentSize?) -> array:Comment
= /comment/all
POST@createComment(aid-path:AppId, content:String) -> object:Comment
= /comment/{aid}
PUT@editComment(cid-path:CommentId) -> [$oldContent:string, $newContent:string]
= /comment/edit/{cid}
DELETE@deleteComment(cid-path:CommentId) -> object:Comment
= /comment/delete/{cid}
## GeekApk App Star and Follow
### All non-GET interface access requires (non-banned) user(possibly owner) permission
### Star (User -* App)
POST@follow(uid-path:UserId) -> [$oldCount:number, $newCount:number]
= /follow/{uid}
DELETE@unfollow(uid-path:UserId) -> [$oldCount:number, $newCount:number]
= /follow/{uid}
followers(uid-path:UserId) -> array:GeekUser
= /follow/followers/{uid}
following(uid-path:UserId) -> array:GeekUser
= /follow/{uid}
### Follow (User -> User)
POST@star(aid-path:AppId) -> [$oldCount:number, $newCount:number]
= /star/{aid}
DELETE@unstar(aid-path:AppId) -> [$oldCount:number, $newCount:number]
= /star/{aid}
stargazers(aid-path:AppId) -> array:App
= /star/{aid}
stars(uid-path:UserId) -> array:App
= /star/user/{uid}
## PATCH APIs
PATCH@patchUser(uid-path:UserId, obj-body:GeekUser) -> object:GeekUser
= /user/{uid}
PATCH@patchApp(aid-path:AppId, obj-body:App) -> object:App
= /app/{aid}
PATCH@patchReversion(aid-path:AppId, rev-path:Int, obj-body:AppUpdate) -> object:AppUpdate
= /appUpdate/{aid}/{rev}
## QCL API
POST@qclExecute(stmt:String) -> object:string
= /qclExec
## GeekHits (Rate limit) API
getMyLimit() -> object:LimitMap
= /limit