lemmy-js-client 0.13.4-rc.1 → 0.15.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/http.d.ts +22 -6
- package/dist/http.js +115 -75
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/interfaces/api/comment.d.ts +1 -1
- package/dist/interfaces/api/community.d.ts +1 -1
- package/dist/interfaces/api/index.d.ts +6 -6
- package/dist/interfaces/api/index.js +1 -1
- package/dist/interfaces/api/person.d.ts +21 -2
- package/dist/interfaces/api/post.d.ts +2 -2
- package/dist/interfaces/api/site.d.ts +36 -2
- package/dist/interfaces/index.d.ts +5 -5
- package/dist/interfaces/index.js +1 -1
- package/dist/interfaces/others.d.ts +37 -33
- package/dist/interfaces/others.js +38 -34
- package/dist/interfaces/source.d.ts +16 -2
- package/dist/interfaces/views.d.ts +8 -2
- package/dist/websocket.d.ts +22 -6
- package/dist/websocket.js +24 -0
- package/package.json +20 -9
package/dist/http.js
CHANGED
@@ -67,7 +67,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
67
67
|
*/
|
68
68
|
function LemmyHttp(baseUrl, headers) {
|
69
69
|
this.headers = {};
|
70
|
-
this.apiUrl = baseUrl
|
70
|
+
this.apiUrl = "".concat(baseUrl, "/api/").concat(others_1.VERSION);
|
71
71
|
if (headers) {
|
72
72
|
this.headers = headers;
|
73
73
|
}
|
@@ -78,7 +78,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
78
78
|
LemmyHttp.prototype.getSite = function (form) {
|
79
79
|
return __awaiter(this, void 0, void 0, function () {
|
80
80
|
return __generator(this, function (_a) {
|
81
|
-
return [2 /*return*/, this.wrapper(HttpType.Get,
|
81
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/site", form)];
|
82
82
|
});
|
83
83
|
});
|
84
84
|
};
|
@@ -88,7 +88,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
88
88
|
LemmyHttp.prototype.createSite = function (form) {
|
89
89
|
return __awaiter(this, void 0, void 0, function () {
|
90
90
|
return __generator(this, function (_a) {
|
91
|
-
return [2 /*return*/, this.wrapper(HttpType.Post,
|
91
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/site", form)];
|
92
92
|
});
|
93
93
|
});
|
94
94
|
};
|
@@ -98,7 +98,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
98
98
|
LemmyHttp.prototype.editSite = function (form) {
|
99
99
|
return __awaiter(this, void 0, void 0, function () {
|
100
100
|
return __generator(this, function (_a) {
|
101
|
-
return [2 /*return*/, this.wrapper(HttpType.Put,
|
101
|
+
return [2 /*return*/, this.wrapper(HttpType.Put, "/site", form)];
|
102
102
|
});
|
103
103
|
});
|
104
104
|
};
|
@@ -108,7 +108,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
108
108
|
LemmyHttp.prototype.transferSite = function (form) {
|
109
109
|
return __awaiter(this, void 0, void 0, function () {
|
110
110
|
return __generator(this, function (_a) {
|
111
|
-
return [2 /*return*/, this.wrapper(HttpType.Post,
|
111
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/site/transfer", form)];
|
112
112
|
});
|
113
113
|
});
|
114
114
|
};
|
@@ -118,7 +118,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
118
118
|
LemmyHttp.prototype.getSiteConfig = function (form) {
|
119
119
|
return __awaiter(this, void 0, void 0, function () {
|
120
120
|
return __generator(this, function (_a) {
|
121
|
-
return [2 /*return*/, this.wrapper(HttpType.Get,
|
121
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/site/config", form)];
|
122
122
|
});
|
123
123
|
});
|
124
124
|
};
|
@@ -128,7 +128,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
128
128
|
LemmyHttp.prototype.saveSiteConfig = function (form) {
|
129
129
|
return __awaiter(this, void 0, void 0, function () {
|
130
130
|
return __generator(this, function (_a) {
|
131
|
-
return [2 /*return*/, this.wrapper(HttpType.Put,
|
131
|
+
return [2 /*return*/, this.wrapper(HttpType.Put, "/site/config", form)];
|
132
132
|
});
|
133
133
|
});
|
134
134
|
};
|
@@ -138,7 +138,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
138
138
|
LemmyHttp.prototype.getModlog = function (form) {
|
139
139
|
return __awaiter(this, void 0, void 0, function () {
|
140
140
|
return __generator(this, function (_a) {
|
141
|
-
return [2 /*return*/, this.wrapper(HttpType.Get,
|
141
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/modlog", form)];
|
142
142
|
});
|
143
143
|
});
|
144
144
|
};
|
@@ -148,7 +148,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
148
148
|
LemmyHttp.prototype.search = function (form) {
|
149
149
|
return __awaiter(this, void 0, void 0, function () {
|
150
150
|
return __generator(this, function (_a) {
|
151
|
-
return [2 /*return*/, this.wrapper(HttpType.Get,
|
151
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/search", form)];
|
152
152
|
});
|
153
153
|
});
|
154
154
|
};
|
@@ -158,7 +158,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
158
158
|
LemmyHttp.prototype.resolveObject = function (form) {
|
159
159
|
return __awaiter(this, void 0, void 0, function () {
|
160
160
|
return __generator(this, function (_a) {
|
161
|
-
return [2 /*return*/, this.wrapper(HttpType.Get,
|
161
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/resolve_object", form)];
|
162
162
|
});
|
163
163
|
});
|
164
164
|
};
|
@@ -168,7 +168,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
168
168
|
LemmyHttp.prototype.createCommunity = function (form) {
|
169
169
|
return __awaiter(this, void 0, void 0, function () {
|
170
170
|
return __generator(this, function (_a) {
|
171
|
-
return [2 /*return*/, this.wrapper(HttpType.Post,
|
171
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/community", form)];
|
172
172
|
});
|
173
173
|
});
|
174
174
|
};
|
@@ -178,7 +178,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
178
178
|
LemmyHttp.prototype.getCommunity = function (form) {
|
179
179
|
return __awaiter(this, void 0, void 0, function () {
|
180
180
|
return __generator(this, function (_a) {
|
181
|
-
return [2 /*return*/, this.wrapper(HttpType.Get,
|
181
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/community", form)];
|
182
182
|
});
|
183
183
|
});
|
184
184
|
};
|
@@ -188,7 +188,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
188
188
|
LemmyHttp.prototype.editCommunity = function (form) {
|
189
189
|
return __awaiter(this, void 0, void 0, function () {
|
190
190
|
return __generator(this, function (_a) {
|
191
|
-
return [2 /*return*/, this.wrapper(HttpType.Put,
|
191
|
+
return [2 /*return*/, this.wrapper(HttpType.Put, "/community", form)];
|
192
192
|
});
|
193
193
|
});
|
194
194
|
};
|
@@ -198,7 +198,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
198
198
|
LemmyHttp.prototype.listCommunities = function (form) {
|
199
199
|
return __awaiter(this, void 0, void 0, function () {
|
200
200
|
return __generator(this, function (_a) {
|
201
|
-
return [2 /*return*/, this.wrapper(HttpType.Get,
|
201
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/community/list", form)];
|
202
202
|
});
|
203
203
|
});
|
204
204
|
};
|
@@ -208,7 +208,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
208
208
|
LemmyHttp.prototype.followCommunity = function (form) {
|
209
209
|
return __awaiter(this, void 0, void 0, function () {
|
210
210
|
return __generator(this, function (_a) {
|
211
|
-
return [2 /*return*/, this.wrapper(HttpType.Post,
|
211
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/community/follow", form)];
|
212
212
|
});
|
213
213
|
});
|
214
214
|
};
|
@@ -218,7 +218,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
218
218
|
LemmyHttp.prototype.blockCommunity = function (form) {
|
219
219
|
return __awaiter(this, void 0, void 0, function () {
|
220
220
|
return __generator(this, function (_a) {
|
221
|
-
return [2 /*return*/, this.wrapper(HttpType.Post,
|
221
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/community/block", form)];
|
222
222
|
});
|
223
223
|
});
|
224
224
|
};
|
@@ -228,7 +228,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
228
228
|
LemmyHttp.prototype.deleteCommunity = function (form) {
|
229
229
|
return __awaiter(this, void 0, void 0, function () {
|
230
230
|
return __generator(this, function (_a) {
|
231
|
-
return [2 /*return*/, this.wrapper(HttpType.Post,
|
231
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/community/delete", form)];
|
232
232
|
});
|
233
233
|
});
|
234
234
|
};
|
@@ -238,7 +238,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
238
238
|
LemmyHttp.prototype.removeCommunity = function (form) {
|
239
239
|
return __awaiter(this, void 0, void 0, function () {
|
240
240
|
return __generator(this, function (_a) {
|
241
|
-
return [2 /*return*/, this.wrapper(HttpType.Post,
|
241
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/community/remove", form)];
|
242
242
|
});
|
243
243
|
});
|
244
244
|
};
|
@@ -248,7 +248,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
248
248
|
LemmyHttp.prototype.transferCommunity = function (form) {
|
249
249
|
return __awaiter(this, void 0, void 0, function () {
|
250
250
|
return __generator(this, function (_a) {
|
251
|
-
return [2 /*return*/, this.wrapper(HttpType.Post,
|
251
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/community/transfer", form)];
|
252
252
|
});
|
253
253
|
});
|
254
254
|
};
|
@@ -258,7 +258,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
258
258
|
LemmyHttp.prototype.banFromCommunity = function (form) {
|
259
259
|
return __awaiter(this, void 0, void 0, function () {
|
260
260
|
return __generator(this, function (_a) {
|
261
|
-
return [2 /*return*/, this.wrapper(HttpType.Post,
|
261
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/community/ban_user", form)];
|
262
262
|
});
|
263
263
|
});
|
264
264
|
};
|
@@ -268,7 +268,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
268
268
|
LemmyHttp.prototype.addModToCommunity = function (form) {
|
269
269
|
return __awaiter(this, void 0, void 0, function () {
|
270
270
|
return __generator(this, function (_a) {
|
271
|
-
return [2 /*return*/, this.wrapper(HttpType.Post,
|
271
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/community/mod", form)];
|
272
272
|
});
|
273
273
|
});
|
274
274
|
};
|
@@ -278,7 +278,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
278
278
|
LemmyHttp.prototype.createPost = function (form) {
|
279
279
|
return __awaiter(this, void 0, void 0, function () {
|
280
280
|
return __generator(this, function (_a) {
|
281
|
-
return [2 /*return*/, this.wrapper(HttpType.Post,
|
281
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/post", form)];
|
282
282
|
});
|
283
283
|
});
|
284
284
|
};
|
@@ -288,7 +288,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
288
288
|
LemmyHttp.prototype.getPost = function (form) {
|
289
289
|
return __awaiter(this, void 0, void 0, function () {
|
290
290
|
return __generator(this, function (_a) {
|
291
|
-
return [2 /*return*/, this.wrapper(HttpType.Get,
|
291
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/post", form)];
|
292
292
|
});
|
293
293
|
});
|
294
294
|
};
|
@@ -298,7 +298,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
298
298
|
LemmyHttp.prototype.editPost = function (form) {
|
299
299
|
return __awaiter(this, void 0, void 0, function () {
|
300
300
|
return __generator(this, function (_a) {
|
301
|
-
return [2 /*return*/, this.wrapper(HttpType.Put,
|
301
|
+
return [2 /*return*/, this.wrapper(HttpType.Put, "/post", form)];
|
302
302
|
});
|
303
303
|
});
|
304
304
|
};
|
@@ -308,7 +308,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
308
308
|
LemmyHttp.prototype.deletePost = function (form) {
|
309
309
|
return __awaiter(this, void 0, void 0, function () {
|
310
310
|
return __generator(this, function (_a) {
|
311
|
-
return [2 /*return*/, this.wrapper(HttpType.Post,
|
311
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/post/delete", form)];
|
312
312
|
});
|
313
313
|
});
|
314
314
|
};
|
@@ -318,7 +318,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
318
318
|
LemmyHttp.prototype.removePost = function (form) {
|
319
319
|
return __awaiter(this, void 0, void 0, function () {
|
320
320
|
return __generator(this, function (_a) {
|
321
|
-
return [2 /*return*/, this.wrapper(HttpType.Post,
|
321
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/post/remove", form)];
|
322
322
|
});
|
323
323
|
});
|
324
324
|
};
|
@@ -328,7 +328,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
328
328
|
LemmyHttp.prototype.lockPost = function (form) {
|
329
329
|
return __awaiter(this, void 0, void 0, function () {
|
330
330
|
return __generator(this, function (_a) {
|
331
|
-
return [2 /*return*/, this.wrapper(HttpType.Post,
|
331
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/post/lock", form)];
|
332
332
|
});
|
333
333
|
});
|
334
334
|
};
|
@@ -338,7 +338,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
338
338
|
LemmyHttp.prototype.stickyPost = function (form) {
|
339
339
|
return __awaiter(this, void 0, void 0, function () {
|
340
340
|
return __generator(this, function (_a) {
|
341
|
-
return [2 /*return*/, this.wrapper(HttpType.Post,
|
341
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/post/sticky", form)];
|
342
342
|
});
|
343
343
|
});
|
344
344
|
};
|
@@ -348,7 +348,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
348
348
|
LemmyHttp.prototype.getPosts = function (form) {
|
349
349
|
return __awaiter(this, void 0, void 0, function () {
|
350
350
|
return __generator(this, function (_a) {
|
351
|
-
return [2 /*return*/, this.wrapper(HttpType.Get,
|
351
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/post/list", form)];
|
352
352
|
});
|
353
353
|
});
|
354
354
|
};
|
@@ -358,7 +358,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
358
358
|
LemmyHttp.prototype.likePost = function (form) {
|
359
359
|
return __awaiter(this, void 0, void 0, function () {
|
360
360
|
return __generator(this, function (_a) {
|
361
|
-
return [2 /*return*/, this.wrapper(HttpType.Post,
|
361
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/post/like", form)];
|
362
362
|
});
|
363
363
|
});
|
364
364
|
};
|
@@ -368,7 +368,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
368
368
|
LemmyHttp.prototype.savePost = function (form) {
|
369
369
|
return __awaiter(this, void 0, void 0, function () {
|
370
370
|
return __generator(this, function (_a) {
|
371
|
-
return [2 /*return*/, this.wrapper(HttpType.Put,
|
371
|
+
return [2 /*return*/, this.wrapper(HttpType.Put, "/post/save", form)];
|
372
372
|
});
|
373
373
|
});
|
374
374
|
};
|
@@ -378,7 +378,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
378
378
|
LemmyHttp.prototype.createPostReport = function (form) {
|
379
379
|
return __awaiter(this, void 0, void 0, function () {
|
380
380
|
return __generator(this, function (_a) {
|
381
|
-
return [2 /*return*/, this.wrapper(HttpType.Post,
|
381
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/post/report", form)];
|
382
382
|
});
|
383
383
|
});
|
384
384
|
};
|
@@ -388,7 +388,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
388
388
|
LemmyHttp.prototype.resolvePostReport = function (form) {
|
389
389
|
return __awaiter(this, void 0, void 0, function () {
|
390
390
|
return __generator(this, function (_a) {
|
391
|
-
return [2 /*return*/, this.wrapper(HttpType.Put,
|
391
|
+
return [2 /*return*/, this.wrapper(HttpType.Put, "/post/report/resolve", form)];
|
392
392
|
});
|
393
393
|
});
|
394
394
|
};
|
@@ -398,7 +398,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
398
398
|
LemmyHttp.prototype.listPostReports = function (form) {
|
399
399
|
return __awaiter(this, void 0, void 0, function () {
|
400
400
|
return __generator(this, function (_a) {
|
401
|
-
return [2 /*return*/, this.wrapper(HttpType.Get,
|
401
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/post/report/list", form)];
|
402
402
|
});
|
403
403
|
});
|
404
404
|
};
|
@@ -408,7 +408,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
408
408
|
LemmyHttp.prototype.getSiteMetadata = function (form) {
|
409
409
|
return __awaiter(this, void 0, void 0, function () {
|
410
410
|
return __generator(this, function (_a) {
|
411
|
-
return [2 /*return*/, this.wrapper(HttpType.Get,
|
411
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/post/site_metadata", form)];
|
412
412
|
});
|
413
413
|
});
|
414
414
|
};
|
@@ -418,7 +418,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
418
418
|
LemmyHttp.prototype.createComment = function (form) {
|
419
419
|
return __awaiter(this, void 0, void 0, function () {
|
420
420
|
return __generator(this, function (_a) {
|
421
|
-
return [2 /*return*/, this.wrapper(HttpType.Post,
|
421
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/comment", form)];
|
422
422
|
});
|
423
423
|
});
|
424
424
|
};
|
@@ -428,7 +428,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
428
428
|
LemmyHttp.prototype.editComment = function (form) {
|
429
429
|
return __awaiter(this, void 0, void 0, function () {
|
430
430
|
return __generator(this, function (_a) {
|
431
|
-
return [2 /*return*/, this.wrapper(HttpType.Put,
|
431
|
+
return [2 /*return*/, this.wrapper(HttpType.Put, "/comment", form)];
|
432
432
|
});
|
433
433
|
});
|
434
434
|
};
|
@@ -438,7 +438,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
438
438
|
LemmyHttp.prototype.deleteComment = function (form) {
|
439
439
|
return __awaiter(this, void 0, void 0, function () {
|
440
440
|
return __generator(this, function (_a) {
|
441
|
-
return [2 /*return*/, this.wrapper(HttpType.Post,
|
441
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/comment/delete", form)];
|
442
442
|
});
|
443
443
|
});
|
444
444
|
};
|
@@ -448,7 +448,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
448
448
|
LemmyHttp.prototype.removeComment = function (form) {
|
449
449
|
return __awaiter(this, void 0, void 0, function () {
|
450
450
|
return __generator(this, function (_a) {
|
451
|
-
return [2 /*return*/, this.wrapper(HttpType.Post,
|
451
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/comment/remove", form)];
|
452
452
|
});
|
453
453
|
});
|
454
454
|
};
|
@@ -458,7 +458,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
458
458
|
LemmyHttp.prototype.markCommentAsRead = function (form) {
|
459
459
|
return __awaiter(this, void 0, void 0, function () {
|
460
460
|
return __generator(this, function (_a) {
|
461
|
-
return [2 /*return*/, this.wrapper(HttpType.Post,
|
461
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/comment/mark_as_read", form)];
|
462
462
|
});
|
463
463
|
});
|
464
464
|
};
|
@@ -468,7 +468,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
468
468
|
LemmyHttp.prototype.likeComment = function (form) {
|
469
469
|
return __awaiter(this, void 0, void 0, function () {
|
470
470
|
return __generator(this, function (_a) {
|
471
|
-
return [2 /*return*/, this.wrapper(HttpType.Post,
|
471
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/comment/like", form)];
|
472
472
|
});
|
473
473
|
});
|
474
474
|
};
|
@@ -478,7 +478,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
478
478
|
LemmyHttp.prototype.saveComment = function (form) {
|
479
479
|
return __awaiter(this, void 0, void 0, function () {
|
480
480
|
return __generator(this, function (_a) {
|
481
|
-
return [2 /*return*/, this.wrapper(HttpType.Put,
|
481
|
+
return [2 /*return*/, this.wrapper(HttpType.Put, "/comment/save", form)];
|
482
482
|
});
|
483
483
|
});
|
484
484
|
};
|
@@ -488,7 +488,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
488
488
|
LemmyHttp.prototype.getComments = function (form) {
|
489
489
|
return __awaiter(this, void 0, void 0, function () {
|
490
490
|
return __generator(this, function (_a) {
|
491
|
-
return [2 /*return*/, this.wrapper(HttpType.Get,
|
491
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/comment/list", form)];
|
492
492
|
});
|
493
493
|
});
|
494
494
|
};
|
@@ -498,7 +498,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
498
498
|
LemmyHttp.prototype.createCommentReport = function (form) {
|
499
499
|
return __awaiter(this, void 0, void 0, function () {
|
500
500
|
return __generator(this, function (_a) {
|
501
|
-
return [2 /*return*/, this.wrapper(HttpType.Post,
|
501
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/comment/report", form)];
|
502
502
|
});
|
503
503
|
});
|
504
504
|
};
|
@@ -508,7 +508,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
508
508
|
LemmyHttp.prototype.resolveCommentReport = function (form) {
|
509
509
|
return __awaiter(this, void 0, void 0, function () {
|
510
510
|
return __generator(this, function (_a) {
|
511
|
-
return [2 /*return*/, this.wrapper(HttpType.Put,
|
511
|
+
return [2 /*return*/, this.wrapper(HttpType.Put, "/comment/report/resolve", form)];
|
512
512
|
});
|
513
513
|
});
|
514
514
|
};
|
@@ -518,7 +518,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
518
518
|
LemmyHttp.prototype.listCommentReports = function (form) {
|
519
519
|
return __awaiter(this, void 0, void 0, function () {
|
520
520
|
return __generator(this, function (_a) {
|
521
|
-
return [2 /*return*/, this.wrapper(HttpType.Get,
|
521
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/comment/report/list", form)];
|
522
522
|
});
|
523
523
|
});
|
524
524
|
};
|
@@ -528,7 +528,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
528
528
|
LemmyHttp.prototype.getPrivateMessages = function (form) {
|
529
529
|
return __awaiter(this, void 0, void 0, function () {
|
530
530
|
return __generator(this, function (_a) {
|
531
|
-
return [2 /*return*/, this.wrapper(HttpType.Get,
|
531
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/private_message/list", form)];
|
532
532
|
});
|
533
533
|
});
|
534
534
|
};
|
@@ -538,7 +538,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
538
538
|
LemmyHttp.prototype.createPrivateMessage = function (form) {
|
539
539
|
return __awaiter(this, void 0, void 0, function () {
|
540
540
|
return __generator(this, function (_a) {
|
541
|
-
return [2 /*return*/, this.wrapper(HttpType.Post,
|
541
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/private_message", form)];
|
542
542
|
});
|
543
543
|
});
|
544
544
|
};
|
@@ -548,7 +548,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
548
548
|
LemmyHttp.prototype.editPrivateMessage = function (form) {
|
549
549
|
return __awaiter(this, void 0, void 0, function () {
|
550
550
|
return __generator(this, function (_a) {
|
551
|
-
return [2 /*return*/, this.wrapper(HttpType.Put,
|
551
|
+
return [2 /*return*/, this.wrapper(HttpType.Put, "/private_message", form)];
|
552
552
|
});
|
553
553
|
});
|
554
554
|
};
|
@@ -558,7 +558,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
558
558
|
LemmyHttp.prototype.deletePrivateMessage = function (form) {
|
559
559
|
return __awaiter(this, void 0, void 0, function () {
|
560
560
|
return __generator(this, function (_a) {
|
561
|
-
return [2 /*return*/, this.wrapper(HttpType.Post,
|
561
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/private_message/delete", form)];
|
562
562
|
});
|
563
563
|
});
|
564
564
|
};
|
@@ -568,7 +568,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
568
568
|
LemmyHttp.prototype.markPrivateMessageAsRead = function (form) {
|
569
569
|
return __awaiter(this, void 0, void 0, function () {
|
570
570
|
return __generator(this, function (_a) {
|
571
|
-
return [2 /*return*/, this.wrapper(HttpType.Post,
|
571
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/private_message/mark_as_read", form)];
|
572
572
|
});
|
573
573
|
});
|
574
574
|
};
|
@@ -578,7 +578,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
578
578
|
LemmyHttp.prototype.register = function (form) {
|
579
579
|
return __awaiter(this, void 0, void 0, function () {
|
580
580
|
return __generator(this, function (_a) {
|
581
|
-
return [2 /*return*/, this.wrapper(HttpType.Post,
|
581
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/user/register", form)];
|
582
582
|
});
|
583
583
|
});
|
584
584
|
};
|
@@ -588,7 +588,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
588
588
|
LemmyHttp.prototype.login = function (form) {
|
589
589
|
return __awaiter(this, void 0, void 0, function () {
|
590
590
|
return __generator(this, function (_a) {
|
591
|
-
return [2 /*return*/, this.wrapper(HttpType.Post,
|
591
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/user/login", form)];
|
592
592
|
});
|
593
593
|
});
|
594
594
|
};
|
@@ -598,7 +598,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
598
598
|
LemmyHttp.prototype.getPersonDetails = function (form) {
|
599
599
|
return __awaiter(this, void 0, void 0, function () {
|
600
600
|
return __generator(this, function (_a) {
|
601
|
-
return [2 /*return*/, this.wrapper(HttpType.Get,
|
601
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/user", form)];
|
602
602
|
});
|
603
603
|
});
|
604
604
|
};
|
@@ -608,7 +608,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
608
608
|
LemmyHttp.prototype.getPersonMentions = function (form) {
|
609
609
|
return __awaiter(this, void 0, void 0, function () {
|
610
610
|
return __generator(this, function (_a) {
|
611
|
-
return [2 /*return*/, this.wrapper(HttpType.Get,
|
611
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/user/mention", form)];
|
612
612
|
});
|
613
613
|
});
|
614
614
|
};
|
@@ -618,7 +618,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
618
618
|
LemmyHttp.prototype.markPersonMentionAsRead = function (form) {
|
619
619
|
return __awaiter(this, void 0, void 0, function () {
|
620
620
|
return __generator(this, function (_a) {
|
621
|
-
return [2 /*return*/, this.wrapper(HttpType.Post,
|
621
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/user/mention/mark_as_read", form)];
|
622
622
|
});
|
623
623
|
});
|
624
624
|
};
|
@@ -628,7 +628,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
628
628
|
LemmyHttp.prototype.getReplies = function (form) {
|
629
629
|
return __awaiter(this, void 0, void 0, function () {
|
630
630
|
return __generator(this, function (_a) {
|
631
|
-
return [2 /*return*/, this.wrapper(HttpType.Get,
|
631
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/user/replies", form)];
|
632
632
|
});
|
633
633
|
});
|
634
634
|
};
|
@@ -638,7 +638,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
638
638
|
LemmyHttp.prototype.banPerson = function (form) {
|
639
639
|
return __awaiter(this, void 0, void 0, function () {
|
640
640
|
return __generator(this, function (_a) {
|
641
|
-
return [2 /*return*/, this.wrapper(HttpType.Post,
|
641
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/user/ban", form)];
|
642
642
|
});
|
643
643
|
});
|
644
644
|
};
|
@@ -648,7 +648,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
648
648
|
LemmyHttp.prototype.blockPerson = function (form) {
|
649
649
|
return __awaiter(this, void 0, void 0, function () {
|
650
650
|
return __generator(this, function (_a) {
|
651
|
-
return [2 /*return*/, this.wrapper(HttpType.Post,
|
651
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/user/block", form)];
|
652
652
|
});
|
653
653
|
});
|
654
654
|
};
|
@@ -658,7 +658,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
658
658
|
LemmyHttp.prototype.getCaptcha = function () {
|
659
659
|
return __awaiter(this, void 0, void 0, function () {
|
660
660
|
return __generator(this, function (_a) {
|
661
|
-
return [2 /*return*/, this.wrapper(HttpType.Get,
|
661
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/user/get_captcha", {})];
|
662
662
|
});
|
663
663
|
});
|
664
664
|
};
|
@@ -668,7 +668,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
668
668
|
LemmyHttp.prototype.deleteAccount = function (form) {
|
669
669
|
return __awaiter(this, void 0, void 0, function () {
|
670
670
|
return __generator(this, function (_a) {
|
671
|
-
return [2 /*return*/, this.wrapper(HttpType.Post,
|
671
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/user/delete_account", form)];
|
672
672
|
});
|
673
673
|
});
|
674
674
|
};
|
@@ -678,7 +678,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
678
678
|
LemmyHttp.prototype.passwordReset = function (form) {
|
679
679
|
return __awaiter(this, void 0, void 0, function () {
|
680
680
|
return __generator(this, function (_a) {
|
681
|
-
return [2 /*return*/, this.wrapper(HttpType.Post,
|
681
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/user/password_reset", form)];
|
682
682
|
});
|
683
683
|
});
|
684
684
|
};
|
@@ -688,7 +688,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
688
688
|
LemmyHttp.prototype.passwordChange = function (form) {
|
689
689
|
return __awaiter(this, void 0, void 0, function () {
|
690
690
|
return __generator(this, function (_a) {
|
691
|
-
return [2 /*return*/, this.wrapper(HttpType.Post,
|
691
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/user/password_change", form)];
|
692
692
|
});
|
693
693
|
});
|
694
694
|
};
|
@@ -698,7 +698,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
698
698
|
LemmyHttp.prototype.markAllAsRead = function (form) {
|
699
699
|
return __awaiter(this, void 0, void 0, function () {
|
700
700
|
return __generator(this, function (_a) {
|
701
|
-
return [2 /*return*/, this.wrapper(HttpType.Post,
|
701
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/user/mark_all_as_read", form)];
|
702
702
|
});
|
703
703
|
});
|
704
704
|
};
|
@@ -708,7 +708,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
708
708
|
LemmyHttp.prototype.saveUserSettings = function (form) {
|
709
709
|
return __awaiter(this, void 0, void 0, function () {
|
710
710
|
return __generator(this, function (_a) {
|
711
|
-
return [2 /*return*/, this.wrapper(HttpType.Put,
|
711
|
+
return [2 /*return*/, this.wrapper(HttpType.Put, "/user/save_user_settings", form)];
|
712
712
|
});
|
713
713
|
});
|
714
714
|
};
|
@@ -718,7 +718,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
718
718
|
LemmyHttp.prototype.changePassword = function (form) {
|
719
719
|
return __awaiter(this, void 0, void 0, function () {
|
720
720
|
return __generator(this, function (_a) {
|
721
|
-
return [2 /*return*/, this.wrapper(HttpType.Put,
|
721
|
+
return [2 /*return*/, this.wrapper(HttpType.Put, "/user/change_password", form)];
|
722
722
|
});
|
723
723
|
});
|
724
724
|
};
|
@@ -728,7 +728,7 @@ var LemmyHttp = /** @class */ (function () {
|
|
728
728
|
LemmyHttp.prototype.getReportCount = function (form) {
|
729
729
|
return __awaiter(this, void 0, void 0, function () {
|
730
730
|
return __generator(this, function (_a) {
|
731
|
-
return [2 /*return*/, this.wrapper(HttpType.Get,
|
731
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/user/report_count", form)];
|
732
732
|
});
|
733
733
|
});
|
734
734
|
};
|
@@ -738,7 +738,17 @@ var LemmyHttp = /** @class */ (function () {
|
|
738
738
|
LemmyHttp.prototype.getUnreadCount = function (form) {
|
739
739
|
return __awaiter(this, void 0, void 0, function () {
|
740
740
|
return __generator(this, function (_a) {
|
741
|
-
return [2 /*return*/, this.wrapper(HttpType.Get,
|
741
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/user/unread_count", form)];
|
742
|
+
});
|
743
|
+
});
|
744
|
+
};
|
745
|
+
/**
|
746
|
+
* Verify your email
|
747
|
+
*/
|
748
|
+
LemmyHttp.prototype.verifyEmail = function (form) {
|
749
|
+
return __awaiter(this, void 0, void 0, function () {
|
750
|
+
return __generator(this, function (_a) {
|
751
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/user/verify_email", form)];
|
742
752
|
});
|
743
753
|
});
|
744
754
|
};
|
@@ -748,28 +758,58 @@ var LemmyHttp = /** @class */ (function () {
|
|
748
758
|
LemmyHttp.prototype.addAdmin = function (form) {
|
749
759
|
return __awaiter(this, void 0, void 0, function () {
|
750
760
|
return __generator(this, function (_a) {
|
751
|
-
return [2 /*return*/, this.wrapper(HttpType.Post,
|
761
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/admin/add", form)];
|
762
|
+
});
|
763
|
+
});
|
764
|
+
};
|
765
|
+
/**
|
766
|
+
* Get the unread registration applications count.
|
767
|
+
*/
|
768
|
+
LemmyHttp.prototype.getUnreadRegistrationApplicationCount = function (form) {
|
769
|
+
return __awaiter(this, void 0, void 0, function () {
|
770
|
+
return __generator(this, function (_a) {
|
771
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/admin/registration_application/count", form)];
|
772
|
+
});
|
773
|
+
});
|
774
|
+
};
|
775
|
+
/**
|
776
|
+
* List the unread registration applications.
|
777
|
+
*/
|
778
|
+
LemmyHttp.prototype.listRegistrationApplications = function (form) {
|
779
|
+
return __awaiter(this, void 0, void 0, function () {
|
780
|
+
return __generator(this, function (_a) {
|
781
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/admin/registration_application/list", form)];
|
782
|
+
});
|
783
|
+
});
|
784
|
+
};
|
785
|
+
/**
|
786
|
+
* Approve a registration application
|
787
|
+
*/
|
788
|
+
LemmyHttp.prototype.approveRegistrationApplication = function (form) {
|
789
|
+
return __awaiter(this, void 0, void 0, function () {
|
790
|
+
return __generator(this, function (_a) {
|
791
|
+
return [2 /*return*/, this.wrapper(HttpType.Put, "/admin/registration_application/approve", form)];
|
752
792
|
});
|
753
793
|
});
|
754
794
|
};
|
755
795
|
LemmyHttp.prototype.buildFullUrl = function (endpoint) {
|
756
|
-
return ""
|
796
|
+
return "".concat(this.apiUrl).concat(endpoint);
|
757
797
|
};
|
758
798
|
LemmyHttp.prototype.wrapper = function (type_, endpoint, form) {
|
759
799
|
return __awaiter(this, void 0, void 0, function () {
|
760
800
|
var getUrl;
|
761
801
|
return __generator(this, function (_a) {
|
762
802
|
if (type_ == HttpType.Get) {
|
763
|
-
getUrl = this.buildFullUrl(endpoint)
|
803
|
+
getUrl = "".concat(this.buildFullUrl(endpoint), "?").concat(encodeGetParams(form));
|
764
804
|
return [2 /*return*/, (0, node_fetch_1.default)(getUrl, {
|
765
|
-
method:
|
805
|
+
method: "GET",
|
766
806
|
headers: this.headers,
|
767
807
|
}).then(function (d) { return d.json(); })];
|
768
808
|
}
|
769
809
|
else {
|
770
810
|
return [2 /*return*/, (0, node_fetch_1.default)(this.buildFullUrl(endpoint), {
|
771
811
|
method: type_,
|
772
|
-
headers: __assign({
|
812
|
+
headers: __assign({ "Content-Type": "application/json" }, this.headers),
|
773
813
|
body: JSON.stringify(form),
|
774
814
|
}).then(function (d) { return d.json(); })];
|
775
815
|
}
|
@@ -782,6 +822,6 @@ var LemmyHttp = /** @class */ (function () {
|
|
782
822
|
exports.LemmyHttp = LemmyHttp;
|
783
823
|
function encodeGetParams(p) {
|
784
824
|
return Object.entries(p)
|
785
|
-
.map(function (kv) { return kv.map(encodeURIComponent).join(
|
786
|
-
.join(
|
825
|
+
.map(function (kv) { return kv.map(encodeURIComponent).join("="); })
|
826
|
+
.join("&");
|
787
827
|
}
|