lemmy-js-client 0.11.4-rc.9 → 0.12.3-rc.2
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +14 -22
- package/dist/http.d.ts +219 -6
- package/dist/http.js +269 -2
- package/dist/interfaces/aggregates.d.ts +42 -0
- package/dist/interfaces/api/comment.d.ts +24 -9
- package/dist/interfaces/api/community.d.ts +14 -0
- package/dist/interfaces/api/person.d.ts +48 -9
- package/dist/interfaces/api/post.d.ts +30 -15
- package/dist/interfaces/api/site.d.ts +37 -2
- package/dist/interfaces/others.d.ts +99 -22
- package/dist/interfaces/others.js +67 -22
- package/dist/interfaces/source.d.ts +8 -0
- package/dist/interfaces/views.d.ts +7 -1
- package/dist/websocket.d.ts +236 -5
- package/dist/websocket.js +250 -1
- package/package.json +4 -1
package/dist/websocket.js
CHANGED
@@ -3,192 +3,441 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LemmyWebsocket = void 0;
|
4
4
|
var others_1 = require("./interfaces/others");
|
5
5
|
/**
|
6
|
-
* Helps build lemmy websocket message requests, that you can use in your Websocket sends
|
6
|
+
* Helps build lemmy websocket message requests, that you can use in your Websocket sends.
|
7
|
+
*
|
8
|
+
* You'll receive back a [[WebSocketResponse]].
|
9
|
+
*
|
10
|
+
* The return types for these are given in [[LemmyHttp]]
|
7
11
|
*/
|
8
12
|
var LemmyWebsocket = /** @class */ (function () {
|
9
13
|
function LemmyWebsocket() {
|
10
14
|
}
|
15
|
+
/**
|
16
|
+
* Log into lemmy.
|
17
|
+
*/
|
11
18
|
LemmyWebsocket.prototype.login = function (form) {
|
12
19
|
return wrapper(others_1.UserOperation.Login, form);
|
13
20
|
};
|
21
|
+
/**
|
22
|
+
* A websocket join for your user.
|
23
|
+
*
|
24
|
+
* Allows your user to receive private messages and notifications.
|
25
|
+
*/
|
14
26
|
LemmyWebsocket.prototype.userJoin = function (form) {
|
15
27
|
return wrapper(others_1.UserOperation.UserJoin, form);
|
16
28
|
};
|
29
|
+
/**
|
30
|
+
* A websocket join for the current post room.
|
31
|
+
*
|
32
|
+
* Allows your user to receive new comments and updates for that post.
|
33
|
+
*/
|
17
34
|
LemmyWebsocket.prototype.postJoin = function (form) {
|
18
35
|
return wrapper(others_1.UserOperation.PostJoin, form);
|
19
36
|
};
|
37
|
+
/**
|
38
|
+
* A websocket join for a given community.
|
39
|
+
*
|
40
|
+
* Allows your user to receive community updates.
|
41
|
+
*
|
42
|
+
* Note: community_id: 0, is your front page.
|
43
|
+
*/
|
20
44
|
LemmyWebsocket.prototype.communityJoin = function (form) {
|
21
45
|
return wrapper(others_1.UserOperation.CommunityJoin, form);
|
22
46
|
};
|
47
|
+
/**
|
48
|
+
* Register a new user.
|
49
|
+
*/
|
23
50
|
LemmyWebsocket.prototype.register = function (register) {
|
24
51
|
return wrapper(others_1.UserOperation.Register, register);
|
25
52
|
};
|
53
|
+
/**
|
54
|
+
* Fetch a Captcha.
|
55
|
+
*/
|
26
56
|
LemmyWebsocket.prototype.getCaptcha = function () {
|
27
57
|
return wrapper(others_1.UserOperation.GetCaptcha, {});
|
28
58
|
};
|
59
|
+
/**
|
60
|
+
* Create a new community.
|
61
|
+
*/
|
29
62
|
LemmyWebsocket.prototype.createCommunity = function (form) {
|
30
63
|
return wrapper(others_1.UserOperation.CreateCommunity, form);
|
31
64
|
};
|
65
|
+
/**
|
66
|
+
* Edit a community.
|
67
|
+
*/
|
32
68
|
LemmyWebsocket.prototype.editCommunity = function (form) {
|
33
69
|
return wrapper(others_1.UserOperation.EditCommunity, form);
|
34
70
|
};
|
71
|
+
/**
|
72
|
+
* Delete a community.
|
73
|
+
*/
|
35
74
|
LemmyWebsocket.prototype.deleteCommunity = function (form) {
|
36
75
|
return wrapper(others_1.UserOperation.DeleteCommunity, form);
|
37
76
|
};
|
77
|
+
/**
|
78
|
+
* A moderator remove for a community.
|
79
|
+
*/
|
38
80
|
LemmyWebsocket.prototype.removeCommunity = function (form) {
|
39
81
|
return wrapper(others_1.UserOperation.RemoveCommunity, form);
|
40
82
|
};
|
83
|
+
/**
|
84
|
+
* Follow / subscribe to a community.
|
85
|
+
*/
|
41
86
|
LemmyWebsocket.prototype.followCommunity = function (form) {
|
42
87
|
return wrapper(others_1.UserOperation.FollowCommunity, form);
|
43
88
|
};
|
89
|
+
/**
|
90
|
+
* List communities, with various filters.
|
91
|
+
*/
|
44
92
|
LemmyWebsocket.prototype.listCommunities = function (form) {
|
45
93
|
return wrapper(others_1.UserOperation.ListCommunities, form);
|
46
94
|
};
|
95
|
+
/**
|
96
|
+
* Create a post.
|
97
|
+
*/
|
47
98
|
LemmyWebsocket.prototype.createPost = function (form) {
|
48
99
|
return wrapper(others_1.UserOperation.CreatePost, form);
|
49
100
|
};
|
101
|
+
/**
|
102
|
+
* Get / fetch a post.
|
103
|
+
*/
|
50
104
|
LemmyWebsocket.prototype.getPost = function (form) {
|
51
105
|
return wrapper(others_1.UserOperation.GetPost, form);
|
52
106
|
};
|
107
|
+
/**
|
108
|
+
* Get / fetch a community.
|
109
|
+
*/
|
53
110
|
LemmyWebsocket.prototype.getCommunity = function (form) {
|
54
111
|
return wrapper(others_1.UserOperation.GetCommunity, form);
|
55
112
|
};
|
113
|
+
/**
|
114
|
+
* Create a comment.
|
115
|
+
*/
|
56
116
|
LemmyWebsocket.prototype.createComment = function (form) {
|
57
117
|
return wrapper(others_1.UserOperation.CreateComment, form);
|
58
118
|
};
|
119
|
+
/**
|
120
|
+
* Edit a comment.
|
121
|
+
*/
|
59
122
|
LemmyWebsocket.prototype.editComment = function (form) {
|
60
123
|
return wrapper(others_1.UserOperation.EditComment, form);
|
61
124
|
};
|
125
|
+
/**
|
126
|
+
* Delete a comment.
|
127
|
+
*/
|
62
128
|
LemmyWebsocket.prototype.deleteComment = function (form) {
|
63
129
|
return wrapper(others_1.UserOperation.DeleteComment, form);
|
64
130
|
};
|
131
|
+
/**
|
132
|
+
* A moderator remove for a comment.
|
133
|
+
*/
|
65
134
|
LemmyWebsocket.prototype.removeComment = function (form) {
|
66
135
|
return wrapper(others_1.UserOperation.RemoveComment, form);
|
67
136
|
};
|
137
|
+
/**
|
138
|
+
* Mark a comment as read.
|
139
|
+
*/
|
68
140
|
LemmyWebsocket.prototype.markCommentAsRead = function (form) {
|
69
141
|
return wrapper(others_1.UserOperation.MarkCommentAsRead, form);
|
70
142
|
};
|
143
|
+
/**
|
144
|
+
* Like / vote on a comment.
|
145
|
+
*/
|
71
146
|
LemmyWebsocket.prototype.likeComment = function (form) {
|
72
147
|
return wrapper(others_1.UserOperation.CreateCommentLike, form);
|
73
148
|
};
|
149
|
+
/**
|
150
|
+
* Save a comment.
|
151
|
+
*/
|
74
152
|
LemmyWebsocket.prototype.saveComment = function (form) {
|
75
153
|
return wrapper(others_1.UserOperation.SaveComment, form);
|
76
154
|
};
|
155
|
+
/**
|
156
|
+
* Report a comment.
|
157
|
+
*/
|
158
|
+
LemmyWebsocket.prototype.createCommentReport = function (form) {
|
159
|
+
return wrapper(others_1.UserOperation.CreateCommentReport, form);
|
160
|
+
};
|
161
|
+
/**
|
162
|
+
* Resolve a comment report. Only a mod can do this.
|
163
|
+
*/
|
164
|
+
LemmyWebsocket.prototype.resolveCommentReport = function (form) {
|
165
|
+
return wrapper(others_1.UserOperation.ResolveCommentReport, form);
|
166
|
+
};
|
167
|
+
/**
|
168
|
+
* List comment reports.
|
169
|
+
*/
|
170
|
+
LemmyWebsocket.prototype.listCommentReports = function (form) {
|
171
|
+
return wrapper(others_1.UserOperation.ListCommentReports, form);
|
172
|
+
};
|
173
|
+
/**
|
174
|
+
* Get / fetch posts, with various filters.
|
175
|
+
*/
|
77
176
|
LemmyWebsocket.prototype.getPosts = function (form) {
|
78
177
|
return wrapper(others_1.UserOperation.GetPosts, form);
|
79
178
|
};
|
179
|
+
/**
|
180
|
+
* Get / fetch comments.
|
181
|
+
*/
|
80
182
|
LemmyWebsocket.prototype.getComments = function (form) {
|
81
183
|
return wrapper(others_1.UserOperation.GetComments, form);
|
82
184
|
};
|
185
|
+
/**
|
186
|
+
* Like / vote on a post.
|
187
|
+
*/
|
83
188
|
LemmyWebsocket.prototype.likePost = function (form) {
|
84
189
|
return wrapper(others_1.UserOperation.CreatePostLike, form);
|
85
190
|
};
|
191
|
+
/**
|
192
|
+
* Edit a post.
|
193
|
+
*/
|
86
194
|
LemmyWebsocket.prototype.editPost = function (form) {
|
87
195
|
return wrapper(others_1.UserOperation.EditPost, form);
|
88
196
|
};
|
197
|
+
/**
|
198
|
+
* Delete a post.
|
199
|
+
*/
|
89
200
|
LemmyWebsocket.prototype.deletePost = function (form) {
|
90
201
|
return wrapper(others_1.UserOperation.DeletePost, form);
|
91
202
|
};
|
203
|
+
/**
|
204
|
+
* A moderator remove for a post.
|
205
|
+
*/
|
92
206
|
LemmyWebsocket.prototype.removePost = function (form) {
|
93
207
|
return wrapper(others_1.UserOperation.RemovePost, form);
|
94
208
|
};
|
209
|
+
/**
|
210
|
+
* A moderator can lock a post ( IE disable new comments ).
|
211
|
+
*/
|
95
212
|
LemmyWebsocket.prototype.lockPost = function (form) {
|
96
213
|
return wrapper(others_1.UserOperation.LockPost, form);
|
97
214
|
};
|
215
|
+
/**
|
216
|
+
* A moderator can sticky a post ( IE stick it to the top of a community ).
|
217
|
+
*/
|
98
218
|
LemmyWebsocket.prototype.stickyPost = function (form) {
|
99
219
|
return wrapper(others_1.UserOperation.StickyPost, form);
|
100
220
|
};
|
221
|
+
/**
|
222
|
+
* Save a post.
|
223
|
+
*/
|
101
224
|
LemmyWebsocket.prototype.savePost = function (form) {
|
102
225
|
return wrapper(others_1.UserOperation.SavePost, form);
|
103
226
|
};
|
227
|
+
/**
|
228
|
+
* Report a post.
|
229
|
+
*/
|
230
|
+
LemmyWebsocket.prototype.createPostReport = function (form) {
|
231
|
+
return wrapper(others_1.UserOperation.CreatePostReport, form);
|
232
|
+
};
|
233
|
+
/**
|
234
|
+
* Resolve a post report. Only a mod can do this.
|
235
|
+
*/
|
236
|
+
LemmyWebsocket.prototype.resolvePostReport = function (form) {
|
237
|
+
return wrapper(others_1.UserOperation.ResolvePostReport, form);
|
238
|
+
};
|
239
|
+
/**
|
240
|
+
* List post reports.
|
241
|
+
*/
|
242
|
+
LemmyWebsocket.prototype.listPostReports = function (form) {
|
243
|
+
return wrapper(others_1.UserOperation.ListPostReports, form);
|
244
|
+
};
|
245
|
+
/**
|
246
|
+
* Fetch metadata for any given site.
|
247
|
+
*/
|
248
|
+
LemmyWebsocket.prototype.getSiteMetadata = function (form) {
|
249
|
+
return wrapper(others_1.UserOperation.GetSiteMetadata, form);
|
250
|
+
};
|
251
|
+
/**
|
252
|
+
* Ban a user from a community.
|
253
|
+
*/
|
104
254
|
LemmyWebsocket.prototype.banFromCommunity = function (form) {
|
105
255
|
return wrapper(others_1.UserOperation.BanFromCommunity, form);
|
106
256
|
};
|
257
|
+
/**
|
258
|
+
* Add a moderator to your community.
|
259
|
+
*/
|
107
260
|
LemmyWebsocket.prototype.addModToCommunity = function (form) {
|
108
261
|
return wrapper(others_1.UserOperation.AddModToCommunity, form);
|
109
262
|
};
|
263
|
+
/**
|
264
|
+
* Transfer your community to an existing moderator.
|
265
|
+
*/
|
110
266
|
LemmyWebsocket.prototype.transferCommunity = function (form) {
|
111
267
|
return wrapper(others_1.UserOperation.TransferCommunity, form);
|
112
268
|
};
|
269
|
+
/**
|
270
|
+
* Transfer your site to another user.
|
271
|
+
*/
|
113
272
|
LemmyWebsocket.prototype.transferSite = function (form) {
|
114
273
|
return wrapper(others_1.UserOperation.TransferSite, form);
|
115
274
|
};
|
275
|
+
/**
|
276
|
+
* Ban a person from your site.
|
277
|
+
*/
|
116
278
|
LemmyWebsocket.prototype.banPerson = function (form) {
|
117
279
|
return wrapper(others_1.UserOperation.BanPerson, form);
|
118
280
|
};
|
281
|
+
/**
|
282
|
+
* Add an admin to your site.
|
283
|
+
*/
|
119
284
|
LemmyWebsocket.prototype.addAdmin = function (form) {
|
120
285
|
return wrapper(others_1.UserOperation.AddAdmin, form);
|
121
286
|
};
|
287
|
+
/**
|
288
|
+
* Get the details for a person.
|
289
|
+
*/
|
122
290
|
LemmyWebsocket.prototype.getPersonDetails = function (form) {
|
123
291
|
return wrapper(others_1.UserOperation.GetPersonDetails, form);
|
124
292
|
};
|
293
|
+
/**
|
294
|
+
* Get comment replies.
|
295
|
+
*/
|
125
296
|
LemmyWebsocket.prototype.getReplies = function (form) {
|
126
297
|
return wrapper(others_1.UserOperation.GetReplies, form);
|
127
298
|
};
|
299
|
+
/**
|
300
|
+
* Get mentions for your user.
|
301
|
+
*/
|
128
302
|
LemmyWebsocket.prototype.getPersonMentions = function (form) {
|
129
303
|
return wrapper(others_1.UserOperation.GetPersonMentions, form);
|
130
304
|
};
|
305
|
+
/**
|
306
|
+
* Mark a person mention as read.
|
307
|
+
*/
|
131
308
|
LemmyWebsocket.prototype.markPersonMentionAsRead = function (form) {
|
132
309
|
return wrapper(others_1.UserOperation.MarkPersonMentionAsRead, form);
|
133
310
|
};
|
311
|
+
/**
|
312
|
+
* Get the modlog.
|
313
|
+
*/
|
134
314
|
LemmyWebsocket.prototype.getModlog = function (form) {
|
135
315
|
return wrapper(others_1.UserOperation.GetModlog, form);
|
136
316
|
};
|
317
|
+
/**
|
318
|
+
* Create your site.
|
319
|
+
*/
|
137
320
|
LemmyWebsocket.prototype.createSite = function (form) {
|
138
321
|
return wrapper(others_1.UserOperation.CreateSite, form);
|
139
322
|
};
|
323
|
+
/**
|
324
|
+
* Edit your site.
|
325
|
+
*/
|
140
326
|
LemmyWebsocket.prototype.editSite = function (form) {
|
141
327
|
return wrapper(others_1.UserOperation.EditSite, form);
|
142
328
|
};
|
329
|
+
/**
|
330
|
+
* Gets the site, and your user data.
|
331
|
+
*/
|
143
332
|
LemmyWebsocket.prototype.getSite = function (form) {
|
144
333
|
if (form === void 0) { form = {}; }
|
145
334
|
return wrapper(others_1.UserOperation.GetSite, form);
|
146
335
|
};
|
336
|
+
/**
|
337
|
+
* Get your site configuration.
|
338
|
+
*/
|
147
339
|
LemmyWebsocket.prototype.getSiteConfig = function (form) {
|
148
340
|
return wrapper(others_1.UserOperation.GetSiteConfig, form);
|
149
341
|
};
|
342
|
+
/**
|
343
|
+
* Search lemmy.
|
344
|
+
*/
|
150
345
|
LemmyWebsocket.prototype.search = function (form) {
|
151
346
|
return wrapper(others_1.UserOperation.Search, form);
|
152
347
|
};
|
348
|
+
/**
|
349
|
+
* Fetch a non-local / federated object.
|
350
|
+
*/
|
351
|
+
LemmyWebsocket.prototype.resolveObject = function (form) {
|
352
|
+
return wrapper(others_1.UserOperation.ResolveObject, form);
|
353
|
+
};
|
354
|
+
/**
|
355
|
+
* Mark all replies as read.
|
356
|
+
*/
|
153
357
|
LemmyWebsocket.prototype.markAllAsRead = function (form) {
|
154
358
|
return wrapper(others_1.UserOperation.MarkAllAsRead, form);
|
155
359
|
};
|
360
|
+
/**
|
361
|
+
* Save your user settings.
|
362
|
+
*/
|
156
363
|
LemmyWebsocket.prototype.saveUserSettings = function (form) {
|
157
364
|
return wrapper(others_1.UserOperation.SaveUserSettings, form);
|
158
365
|
};
|
366
|
+
/**
|
367
|
+
* Change your user password.
|
368
|
+
*/
|
159
369
|
LemmyWebsocket.prototype.changePassword = function (form) {
|
160
370
|
return wrapper(others_1.UserOperation.ChangePassword, form);
|
161
371
|
};
|
372
|
+
/**
|
373
|
+
* Get counts for your reports
|
374
|
+
*/
|
375
|
+
LemmyWebsocket.prototype.getReportCount = function (form) {
|
376
|
+
return wrapper(others_1.UserOperation.GetReportCount, form);
|
377
|
+
};
|
378
|
+
/**
|
379
|
+
* Delete your account.
|
380
|
+
*/
|
162
381
|
LemmyWebsocket.prototype.deleteAccount = function (form) {
|
163
382
|
return wrapper(others_1.UserOperation.DeleteAccount, form);
|
164
383
|
};
|
384
|
+
/**
|
385
|
+
* Reset your password.
|
386
|
+
*/
|
165
387
|
LemmyWebsocket.prototype.passwordReset = function (form) {
|
166
388
|
return wrapper(others_1.UserOperation.PasswordReset, form);
|
167
389
|
};
|
390
|
+
/**
|
391
|
+
* Change your password from an email / token based reset.
|
392
|
+
*/
|
168
393
|
LemmyWebsocket.prototype.passwordChange = function (form) {
|
169
394
|
return wrapper(others_1.UserOperation.PasswordChange, form);
|
170
395
|
};
|
396
|
+
/**
|
397
|
+
* Create a private message.
|
398
|
+
*/
|
171
399
|
LemmyWebsocket.prototype.createPrivateMessage = function (form) {
|
172
400
|
return wrapper(others_1.UserOperation.CreatePrivateMessage, form);
|
173
401
|
};
|
402
|
+
/**
|
403
|
+
* Edit a private message.
|
404
|
+
*/
|
174
405
|
LemmyWebsocket.prototype.editPrivateMessage = function (form) {
|
175
406
|
return wrapper(others_1.UserOperation.EditPrivateMessage, form);
|
176
407
|
};
|
408
|
+
/**
|
409
|
+
* Delete a private message.
|
410
|
+
*/
|
177
411
|
LemmyWebsocket.prototype.deletePrivateMessage = function (form) {
|
178
412
|
return wrapper(others_1.UserOperation.DeletePrivateMessage, form);
|
179
413
|
};
|
414
|
+
/**
|
415
|
+
* Mark a private message as read.
|
416
|
+
*/
|
180
417
|
LemmyWebsocket.prototype.markPrivateMessageAsRead = function (form) {
|
181
418
|
return wrapper(others_1.UserOperation.MarkPrivateMessageAsRead, form);
|
182
419
|
};
|
420
|
+
/**
|
421
|
+
* Get / fetch private messages.
|
422
|
+
*/
|
183
423
|
LemmyWebsocket.prototype.getPrivateMessages = function (form) {
|
184
424
|
return wrapper(others_1.UserOperation.GetPrivateMessages, form);
|
185
425
|
};
|
426
|
+
/**
|
427
|
+
* Save your site config.
|
428
|
+
*/
|
186
429
|
LemmyWebsocket.prototype.saveSiteConfig = function (form) {
|
187
430
|
return wrapper(others_1.UserOperation.SaveSiteConfig, form);
|
188
431
|
};
|
432
|
+
/**
|
433
|
+
* Block a person.
|
434
|
+
*/
|
189
435
|
LemmyWebsocket.prototype.blockPerson = function (form) {
|
190
436
|
return wrapper(others_1.UserOperation.BlockPerson, form);
|
191
437
|
};
|
438
|
+
/**
|
439
|
+
* Block a community.
|
440
|
+
*/
|
192
441
|
LemmyWebsocket.prototype.blockCommunity = function (form) {
|
193
442
|
return wrapper(others_1.UserOperation.BlockCommunity, form);
|
194
443
|
};
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "lemmy-js-client",
|
3
3
|
"description": "A javascript / typescript client for Lemmy",
|
4
|
-
"version": "0.
|
4
|
+
"version": "0.12.3-rc.2",
|
5
5
|
"author": "Dessalines <tyhou13@gmx.com>",
|
6
6
|
"license": "AGPL-3.0",
|
7
7
|
"main": "./dist/index.js",
|
@@ -10,6 +10,7 @@
|
|
10
10
|
],
|
11
11
|
"scripts": {
|
12
12
|
"build": "tsc",
|
13
|
+
"docs": "typedoc src/index.ts --sourcefile-url-prefix 'https://github.com/LemmyNet/lemmy-js-client/tree/main/src/'",
|
13
14
|
"lint": "tsc --noEmit && eslint --report-unused-disable-directives --ext .js,.ts,.tsx src",
|
14
15
|
"prepare": "yarn run build"
|
15
16
|
},
|
@@ -23,6 +24,8 @@
|
|
23
24
|
"node-fetch": "^2.6.1",
|
24
25
|
"prettier": "^2.3.2",
|
25
26
|
"sortpack": "^2.2.0",
|
27
|
+
"typedoc": "^0.21.6",
|
28
|
+
"typedoc-plugin-sourcefile-url": "^1.0.6",
|
26
29
|
"typescript": "^4.3.5"
|
27
30
|
},
|
28
31
|
"types": "./dist/index.d.ts",
|