lemmy-js-client 0.17.0-rc.4 → 0.17.0-rc.40
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/http.d.ts +178 -14
- package/dist/http.js +296 -98
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6 -1
- package/dist/interfaces/aggregates.d.ts +1 -0
- package/dist/interfaces/api/comment.d.ts +47 -45
- package/dist/interfaces/api/comment.js +349 -0
- package/dist/interfaces/api/community.d.ts +56 -48
- package/dist/interfaces/api/community.js +433 -0
- package/dist/interfaces/api/index.js +5 -1
- package/dist/interfaces/api/person.d.ts +132 -102
- package/dist/interfaces/api/person.js +910 -0
- package/dist/interfaces/api/post.d.ts +71 -54
- package/dist/interfaces/api/post.js +453 -0
- package/dist/interfaces/api/site.d.ts +127 -98
- package/dist/interfaces/api/site.js +985 -0
- package/dist/interfaces/index.js +5 -1
- package/dist/interfaces/others.d.ts +101 -93
- package/dist/interfaces/others.js +162 -59
- package/dist/interfaces/source.d.ts +113 -77
- package/dist/interfaces/source.js +809 -0
- package/dist/interfaces/views.d.ts +79 -40
- package/dist/interfaces/views.js +599 -0
- package/dist/utils.d.ts +9 -0
- package/dist/utils.js +18 -0
- package/dist/websocket.d.ts +33 -14
- package/dist/websocket.js +49 -19
- package/package.json +17 -14
package/dist/http.js
CHANGED
@@ -48,7 +48,13 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
48
48
|
};
|
49
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
50
50
|
exports.LemmyHttp = void 0;
|
51
|
+
var class_transformer_1 = require("class-transformer");
|
51
52
|
var node_fetch_1 = require("node-fetch");
|
53
|
+
var comment_1 = require("./interfaces/api/comment");
|
54
|
+
var community_1 = require("./interfaces/api/community");
|
55
|
+
var person_1 = require("./interfaces/api/person");
|
56
|
+
var post_1 = require("./interfaces/api/post");
|
57
|
+
var site_1 = require("./interfaces/api/site");
|
52
58
|
var others_1 = require("./interfaces/others");
|
53
59
|
var HttpType;
|
54
60
|
(function (HttpType) {
|
@@ -74,738 +80,920 @@ var LemmyHttp = /** @class */ (function () {
|
|
74
80
|
}
|
75
81
|
/**
|
76
82
|
* Gets the site, and your user data.
|
83
|
+
*
|
84
|
+
* `HTTP.GET /site`
|
77
85
|
*/
|
78
86
|
LemmyHttp.prototype.getSite = function (form) {
|
79
87
|
return __awaiter(this, void 0, void 0, function () {
|
80
88
|
return __generator(this, function (_a) {
|
81
|
-
return [2 /*return*/, this.wrapper(HttpType.Get, "/site", form)];
|
89
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/site", form, site_1.GetSiteResponse)];
|
82
90
|
});
|
83
91
|
});
|
84
92
|
};
|
85
93
|
/**
|
86
94
|
* Create your site.
|
95
|
+
*
|
96
|
+
* `HTTP.POST /site`
|
87
97
|
*/
|
88
98
|
LemmyHttp.prototype.createSite = function (form) {
|
89
99
|
return __awaiter(this, void 0, void 0, function () {
|
90
100
|
return __generator(this, function (_a) {
|
91
|
-
return [2 /*return*/, this.wrapper(HttpType.Post, "/site", form)];
|
101
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/site", form, site_1.SiteResponse)];
|
92
102
|
});
|
93
103
|
});
|
94
104
|
};
|
95
105
|
/**
|
96
106
|
* Edit your site.
|
107
|
+
*
|
108
|
+
* `HTTP.PUT /site`
|
97
109
|
*/
|
98
110
|
LemmyHttp.prototype.editSite = function (form) {
|
99
111
|
return __awaiter(this, void 0, void 0, function () {
|
100
112
|
return __generator(this, function (_a) {
|
101
|
-
return [2 /*return*/, this.wrapper(HttpType.Put, "/site", form)];
|
113
|
+
return [2 /*return*/, this.wrapper(HttpType.Put, "/site", form, site_1.SiteResponse)];
|
102
114
|
});
|
103
115
|
});
|
104
116
|
};
|
105
117
|
/**
|
106
118
|
* Leave the Site admins.
|
119
|
+
*
|
120
|
+
* `HTTP.POST /user/leave_admin`
|
107
121
|
*/
|
108
122
|
LemmyHttp.prototype.leaveAdmin = function (form) {
|
109
123
|
return __awaiter(this, void 0, void 0, function () {
|
110
124
|
return __generator(this, function (_a) {
|
111
|
-
return [2 /*return*/, this.wrapper(HttpType.Post, "/user/leave_admin", form)];
|
112
|
-
});
|
113
|
-
});
|
114
|
-
};
|
115
|
-
/**
|
116
|
-
* Get your site configuration.
|
117
|
-
*/
|
118
|
-
LemmyHttp.prototype.getSiteConfig = function (form) {
|
119
|
-
return __awaiter(this, void 0, void 0, function () {
|
120
|
-
return __generator(this, function (_a) {
|
121
|
-
return [2 /*return*/, this.wrapper(HttpType.Get, "/site/config", form)];
|
122
|
-
});
|
123
|
-
});
|
124
|
-
};
|
125
|
-
/**
|
126
|
-
* Save your site config.
|
127
|
-
*/
|
128
|
-
LemmyHttp.prototype.saveSiteConfig = function (form) {
|
129
|
-
return __awaiter(this, void 0, void 0, function () {
|
130
|
-
return __generator(this, function (_a) {
|
131
|
-
return [2 /*return*/, this.wrapper(HttpType.Put, "/site/config", form)];
|
125
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/user/leave_admin", form, site_1.GetSiteResponse)];
|
132
126
|
});
|
133
127
|
});
|
134
128
|
};
|
135
129
|
/**
|
136
130
|
* Get the modlog.
|
131
|
+
*
|
132
|
+
* `HTTP.GET /modlog`
|
137
133
|
*/
|
138
134
|
LemmyHttp.prototype.getModlog = function (form) {
|
139
135
|
return __awaiter(this, void 0, void 0, function () {
|
140
136
|
return __generator(this, function (_a) {
|
141
|
-
return [2 /*return*/, this.wrapper(HttpType.Get, "/modlog", form)];
|
137
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/modlog", form, site_1.GetModlogResponse)];
|
142
138
|
});
|
143
139
|
});
|
144
140
|
};
|
145
141
|
/**
|
146
142
|
* Search lemmy.
|
143
|
+
*
|
144
|
+
* `HTTP.GET /search`
|
147
145
|
*/
|
148
146
|
LemmyHttp.prototype.search = function (form) {
|
149
147
|
return __awaiter(this, void 0, void 0, function () {
|
150
148
|
return __generator(this, function (_a) {
|
151
|
-
return [2 /*return*/, this.wrapper(HttpType.Get, "/search", form)];
|
149
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/search", form, site_1.SearchResponse)];
|
152
150
|
});
|
153
151
|
});
|
154
152
|
};
|
155
153
|
/**
|
156
154
|
* Fetch a non-local / federated object.
|
155
|
+
*
|
156
|
+
* `HTTP.GET /resolve_object`
|
157
157
|
*/
|
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, "/resolve_object", form)];
|
161
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/resolve_object", form, site_1.ResolveObjectResponse)];
|
162
162
|
});
|
163
163
|
});
|
164
164
|
};
|
165
165
|
/**
|
166
166
|
* Create a new community.
|
167
|
+
*
|
168
|
+
* `HTTP.POST /community`
|
167
169
|
*/
|
168
170
|
LemmyHttp.prototype.createCommunity = function (form) {
|
169
171
|
return __awaiter(this, void 0, void 0, function () {
|
170
172
|
return __generator(this, function (_a) {
|
171
|
-
return [2 /*return*/, this.wrapper(HttpType.Post, "/community", form)];
|
173
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/community", form, community_1.CommunityResponse)];
|
172
174
|
});
|
173
175
|
});
|
174
176
|
};
|
175
177
|
/**
|
176
178
|
* Get / fetch a community.
|
179
|
+
*
|
180
|
+
* `HTTP.GET /community`
|
177
181
|
*/
|
178
182
|
LemmyHttp.prototype.getCommunity = function (form) {
|
179
183
|
return __awaiter(this, void 0, void 0, function () {
|
180
184
|
return __generator(this, function (_a) {
|
181
|
-
return [2 /*return*/, this.wrapper(HttpType.Get, "/community", form)];
|
185
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/community", form, community_1.GetCommunityResponse)];
|
182
186
|
});
|
183
187
|
});
|
184
188
|
};
|
185
189
|
/**
|
186
190
|
* Edit a community.
|
191
|
+
*
|
192
|
+
* `HTTP.PUT /community`
|
187
193
|
*/
|
188
194
|
LemmyHttp.prototype.editCommunity = function (form) {
|
189
195
|
return __awaiter(this, void 0, void 0, function () {
|
190
196
|
return __generator(this, function (_a) {
|
191
|
-
return [2 /*return*/, this.wrapper(HttpType.Put, "/community", form)];
|
197
|
+
return [2 /*return*/, this.wrapper(HttpType.Put, "/community", form, community_1.CommunityResponse)];
|
192
198
|
});
|
193
199
|
});
|
194
200
|
};
|
195
201
|
/**
|
196
202
|
* List communities, with various filters.
|
203
|
+
*
|
204
|
+
* `HTTP.GET /community/list`
|
197
205
|
*/
|
198
206
|
LemmyHttp.prototype.listCommunities = function (form) {
|
199
207
|
return __awaiter(this, void 0, void 0, function () {
|
200
208
|
return __generator(this, function (_a) {
|
201
|
-
return [2 /*return*/, this.wrapper(HttpType.Get, "/community/list", form)];
|
209
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/community/list", form, community_1.ListCommunitiesResponse)];
|
202
210
|
});
|
203
211
|
});
|
204
212
|
};
|
205
213
|
/**
|
206
214
|
* Follow / subscribe to a community.
|
215
|
+
*
|
216
|
+
* `HTTP.POST /community/follow`
|
207
217
|
*/
|
208
218
|
LemmyHttp.prototype.followCommunity = function (form) {
|
209
219
|
return __awaiter(this, void 0, void 0, function () {
|
210
220
|
return __generator(this, function (_a) {
|
211
|
-
return [2 /*return*/, this.wrapper(HttpType.Post, "/community/follow", form)];
|
221
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/community/follow", form, community_1.CommunityResponse)];
|
212
222
|
});
|
213
223
|
});
|
214
224
|
};
|
215
225
|
/**
|
216
226
|
* Block a community.
|
227
|
+
*
|
228
|
+
* `HTTP.POST /community/block`
|
217
229
|
*/
|
218
230
|
LemmyHttp.prototype.blockCommunity = function (form) {
|
219
231
|
return __awaiter(this, void 0, void 0, function () {
|
220
232
|
return __generator(this, function (_a) {
|
221
|
-
return [2 /*return*/, this.wrapper(HttpType.Post, "/community/block", form)];
|
233
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/community/block", form, community_1.BlockCommunityResponse)];
|
222
234
|
});
|
223
235
|
});
|
224
236
|
};
|
225
237
|
/**
|
226
238
|
* Delete a community.
|
239
|
+
*
|
240
|
+
* `HTTP.POST /community/delete`
|
227
241
|
*/
|
228
242
|
LemmyHttp.prototype.deleteCommunity = function (form) {
|
229
243
|
return __awaiter(this, void 0, void 0, function () {
|
230
244
|
return __generator(this, function (_a) {
|
231
|
-
return [2 /*return*/, this.wrapper(HttpType.Post, "/community/delete", form)];
|
245
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/community/delete", form, community_1.CommunityResponse)];
|
232
246
|
});
|
233
247
|
});
|
234
248
|
};
|
235
249
|
/**
|
236
250
|
* A moderator remove for a community.
|
251
|
+
*
|
252
|
+
* `HTTP.POST /community/remove`
|
237
253
|
*/
|
238
254
|
LemmyHttp.prototype.removeCommunity = function (form) {
|
239
255
|
return __awaiter(this, void 0, void 0, function () {
|
240
256
|
return __generator(this, function (_a) {
|
241
|
-
return [2 /*return*/, this.wrapper(HttpType.Post, "/community/remove", form)];
|
257
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/community/remove", form, community_1.CommunityResponse)];
|
242
258
|
});
|
243
259
|
});
|
244
260
|
};
|
245
261
|
/**
|
246
262
|
* Transfer your community to an existing moderator.
|
263
|
+
*
|
264
|
+
* `HTTP.POST /community/transfer`
|
247
265
|
*/
|
248
266
|
LemmyHttp.prototype.transferCommunity = function (form) {
|
249
267
|
return __awaiter(this, void 0, void 0, function () {
|
250
268
|
return __generator(this, function (_a) {
|
251
|
-
return [2 /*return*/, this.wrapper(HttpType.Post, "/community/transfer", form)];
|
269
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/community/transfer", form, community_1.GetCommunityResponse)];
|
252
270
|
});
|
253
271
|
});
|
254
272
|
};
|
255
273
|
/**
|
256
274
|
* Ban a user from a community.
|
275
|
+
*
|
276
|
+
* `HTTP.POST /community/ban_user`
|
257
277
|
*/
|
258
278
|
LemmyHttp.prototype.banFromCommunity = function (form) {
|
259
279
|
return __awaiter(this, void 0, void 0, function () {
|
260
280
|
return __generator(this, function (_a) {
|
261
|
-
return [2 /*return*/, this.wrapper(HttpType.Post, "/community/ban_user", form)];
|
281
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/community/ban_user", form, community_1.BanFromCommunityResponse)];
|
262
282
|
});
|
263
283
|
});
|
264
284
|
};
|
265
285
|
/**
|
266
286
|
* Add a moderator to your community.
|
287
|
+
*
|
288
|
+
* `HTTP.POST /community/mod`
|
267
289
|
*/
|
268
290
|
LemmyHttp.prototype.addModToCommunity = function (form) {
|
269
291
|
return __awaiter(this, void 0, void 0, function () {
|
270
292
|
return __generator(this, function (_a) {
|
271
|
-
return [2 /*return*/, this.wrapper(HttpType.Post, "/community/mod", form)];
|
293
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/community/mod", form, community_1.AddModToCommunityResponse)];
|
272
294
|
});
|
273
295
|
});
|
274
296
|
};
|
275
297
|
/**
|
276
298
|
* Create a post.
|
299
|
+
*
|
300
|
+
* `HTTP.POST /post`
|
277
301
|
*/
|
278
302
|
LemmyHttp.prototype.createPost = function (form) {
|
279
303
|
return __awaiter(this, void 0, void 0, function () {
|
280
304
|
return __generator(this, function (_a) {
|
281
|
-
return [2 /*return*/, this.wrapper(HttpType.Post, "/post", form)];
|
305
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/post", form, post_1.PostResponse)];
|
282
306
|
});
|
283
307
|
});
|
284
308
|
};
|
285
309
|
/**
|
286
310
|
* Get / fetch a post.
|
311
|
+
*
|
312
|
+
* `HTTP.GET /post`
|
287
313
|
*/
|
288
314
|
LemmyHttp.prototype.getPost = function (form) {
|
289
315
|
return __awaiter(this, void 0, void 0, function () {
|
290
316
|
return __generator(this, function (_a) {
|
291
|
-
return [2 /*return*/, this.wrapper(HttpType.Get, "/post", form)];
|
317
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/post", form, post_1.GetPostResponse)];
|
292
318
|
});
|
293
319
|
});
|
294
320
|
};
|
295
321
|
/**
|
296
322
|
* Edit a post.
|
323
|
+
*
|
324
|
+
* `HTTP.PUT /post`
|
297
325
|
*/
|
298
326
|
LemmyHttp.prototype.editPost = function (form) {
|
299
327
|
return __awaiter(this, void 0, void 0, function () {
|
300
328
|
return __generator(this, function (_a) {
|
301
|
-
return [2 /*return*/, this.wrapper(HttpType.Put, "/post", form)];
|
329
|
+
return [2 /*return*/, this.wrapper(HttpType.Put, "/post", form, post_1.PostResponse)];
|
302
330
|
});
|
303
331
|
});
|
304
332
|
};
|
305
333
|
/**
|
306
334
|
* Delete a post.
|
335
|
+
*
|
336
|
+
* `HTTP.POST /post/delete`
|
307
337
|
*/
|
308
338
|
LemmyHttp.prototype.deletePost = function (form) {
|
309
339
|
return __awaiter(this, void 0, void 0, function () {
|
310
340
|
return __generator(this, function (_a) {
|
311
|
-
return [2 /*return*/, this.wrapper(HttpType.Post, "/post/delete", form)];
|
341
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/post/delete", form, post_1.PostResponse)];
|
312
342
|
});
|
313
343
|
});
|
314
344
|
};
|
315
345
|
/**
|
316
346
|
* A moderator remove for a post.
|
347
|
+
*
|
348
|
+
* `HTTP.POST /post/remove`
|
317
349
|
*/
|
318
350
|
LemmyHttp.prototype.removePost = function (form) {
|
319
351
|
return __awaiter(this, void 0, void 0, function () {
|
320
352
|
return __generator(this, function (_a) {
|
321
|
-
return [2 /*return*/, this.wrapper(HttpType.Post, "/post/remove", form)];
|
353
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/post/remove", form, post_1.PostResponse)];
|
354
|
+
});
|
355
|
+
});
|
356
|
+
};
|
357
|
+
/**
|
358
|
+
* Mark a post as read.
|
359
|
+
*
|
360
|
+
* `HTTP.POST /post/mark_as_read`
|
361
|
+
*/
|
362
|
+
LemmyHttp.prototype.markPostAsRead = function (form) {
|
363
|
+
return __awaiter(this, void 0, void 0, function () {
|
364
|
+
return __generator(this, function (_a) {
|
365
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/post/mark_as_read", form, post_1.PostResponse)];
|
322
366
|
});
|
323
367
|
});
|
324
368
|
};
|
325
369
|
/**
|
326
370
|
* A moderator can lock a post ( IE disable new comments ).
|
371
|
+
*
|
372
|
+
* `HTTP.POST /post/lock`
|
327
373
|
*/
|
328
374
|
LemmyHttp.prototype.lockPost = function (form) {
|
329
375
|
return __awaiter(this, void 0, void 0, function () {
|
330
376
|
return __generator(this, function (_a) {
|
331
|
-
return [2 /*return*/, this.wrapper(HttpType.Post, "/post/lock", form)];
|
377
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/post/lock", form, post_1.PostResponse)];
|
332
378
|
});
|
333
379
|
});
|
334
380
|
};
|
335
381
|
/**
|
336
382
|
* A moderator can sticky a post ( IE stick it to the top of a community ).
|
383
|
+
*
|
384
|
+
* `HTTP.POST /post/sticky`
|
337
385
|
*/
|
338
386
|
LemmyHttp.prototype.stickyPost = function (form) {
|
339
387
|
return __awaiter(this, void 0, void 0, function () {
|
340
388
|
return __generator(this, function (_a) {
|
341
|
-
return [2 /*return*/, this.wrapper(HttpType.Post, "/post/sticky", form)];
|
389
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/post/sticky", form, post_1.PostResponse)];
|
342
390
|
});
|
343
391
|
});
|
344
392
|
};
|
345
393
|
/**
|
346
394
|
* Get / fetch posts, with various filters.
|
395
|
+
*
|
396
|
+
* `HTTP.GET /post/list`
|
347
397
|
*/
|
348
398
|
LemmyHttp.prototype.getPosts = function (form) {
|
349
399
|
return __awaiter(this, void 0, void 0, function () {
|
350
400
|
return __generator(this, function (_a) {
|
351
|
-
return [2 /*return*/, this.wrapper(HttpType.Get, "/post/list", form)];
|
401
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/post/list", form, post_1.GetPostsResponse)];
|
352
402
|
});
|
353
403
|
});
|
354
404
|
};
|
355
405
|
/**
|
356
406
|
* Like / vote on a post.
|
407
|
+
*
|
408
|
+
* `HTTP.POST /post/like`
|
357
409
|
*/
|
358
410
|
LemmyHttp.prototype.likePost = function (form) {
|
359
411
|
return __awaiter(this, void 0, void 0, function () {
|
360
412
|
return __generator(this, function (_a) {
|
361
|
-
return [2 /*return*/, this.wrapper(HttpType.Post, "/post/like", form)];
|
413
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/post/like", form, post_1.PostResponse)];
|
362
414
|
});
|
363
415
|
});
|
364
416
|
};
|
365
417
|
/**
|
366
418
|
* Save a post.
|
419
|
+
*
|
420
|
+
* `HTTP.PUT /post/save`
|
367
421
|
*/
|
368
422
|
LemmyHttp.prototype.savePost = function (form) {
|
369
423
|
return __awaiter(this, void 0, void 0, function () {
|
370
424
|
return __generator(this, function (_a) {
|
371
|
-
return [2 /*return*/, this.wrapper(HttpType.Put, "/post/save", form)];
|
425
|
+
return [2 /*return*/, this.wrapper(HttpType.Put, "/post/save", form, post_1.PostResponse)];
|
372
426
|
});
|
373
427
|
});
|
374
428
|
};
|
375
429
|
/**
|
376
430
|
* Report a post.
|
431
|
+
*
|
432
|
+
* `HTTP.POST /post/report`
|
377
433
|
*/
|
378
434
|
LemmyHttp.prototype.createPostReport = function (form) {
|
379
435
|
return __awaiter(this, void 0, void 0, function () {
|
380
436
|
return __generator(this, function (_a) {
|
381
|
-
return [2 /*return*/, this.wrapper(HttpType.Post, "/post/report", form)];
|
437
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/post/report", form, post_1.PostReportResponse)];
|
382
438
|
});
|
383
439
|
});
|
384
440
|
};
|
385
441
|
/**
|
386
442
|
* Resolve a post report. Only a mod can do this.
|
443
|
+
*
|
444
|
+
* `HTTP.PUT /post/report/resolve`
|
387
445
|
*/
|
388
446
|
LemmyHttp.prototype.resolvePostReport = function (form) {
|
389
447
|
return __awaiter(this, void 0, void 0, function () {
|
390
448
|
return __generator(this, function (_a) {
|
391
|
-
return [2 /*return*/, this.wrapper(HttpType.Put, "/post/report/resolve", form)];
|
449
|
+
return [2 /*return*/, this.wrapper(HttpType.Put, "/post/report/resolve", form, post_1.PostReportResponse)];
|
392
450
|
});
|
393
451
|
});
|
394
452
|
};
|
395
453
|
/**
|
396
454
|
* List post reports.
|
455
|
+
*
|
456
|
+
* `HTTP.GET /post/report/list`
|
397
457
|
*/
|
398
458
|
LemmyHttp.prototype.listPostReports = function (form) {
|
399
459
|
return __awaiter(this, void 0, void 0, function () {
|
400
460
|
return __generator(this, function (_a) {
|
401
|
-
return [2 /*return*/, this.wrapper(HttpType.Get, "/post/report/list", form)];
|
461
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/post/report/list", form, post_1.ListPostReportsResponse)];
|
402
462
|
});
|
403
463
|
});
|
404
464
|
};
|
405
465
|
/**
|
406
466
|
* Fetch metadata for any given site.
|
467
|
+
*
|
468
|
+
* `HTTP.GET /post/site_metadata`
|
407
469
|
*/
|
408
470
|
LemmyHttp.prototype.getSiteMetadata = function (form) {
|
409
471
|
return __awaiter(this, void 0, void 0, function () {
|
410
472
|
return __generator(this, function (_a) {
|
411
|
-
return [2 /*return*/, this.wrapper(HttpType.Get, "/post/site_metadata", form)];
|
473
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/post/site_metadata", form, post_1.GetSiteMetadataResponse)];
|
412
474
|
});
|
413
475
|
});
|
414
476
|
};
|
415
477
|
/**
|
416
478
|
* Create a comment.
|
479
|
+
*
|
480
|
+
* `HTTP.POST /comment`
|
417
481
|
*/
|
418
482
|
LemmyHttp.prototype.createComment = function (form) {
|
419
483
|
return __awaiter(this, void 0, void 0, function () {
|
420
484
|
return __generator(this, function (_a) {
|
421
|
-
return [2 /*return*/, this.wrapper(HttpType.Post, "/comment", form)];
|
485
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/comment", form, comment_1.CommentResponse)];
|
422
486
|
});
|
423
487
|
});
|
424
488
|
};
|
425
489
|
/**
|
426
490
|
* Edit a comment.
|
491
|
+
*
|
492
|
+
* `HTTP.PUT /comment`
|
427
493
|
*/
|
428
494
|
LemmyHttp.prototype.editComment = function (form) {
|
429
495
|
return __awaiter(this, void 0, void 0, function () {
|
430
496
|
return __generator(this, function (_a) {
|
431
|
-
return [2 /*return*/, this.wrapper(HttpType.Put, "/comment", form)];
|
497
|
+
return [2 /*return*/, this.wrapper(HttpType.Put, "/comment", form, comment_1.CommentResponse)];
|
432
498
|
});
|
433
499
|
});
|
434
500
|
};
|
435
501
|
/**
|
436
502
|
* Delete a comment.
|
503
|
+
*
|
504
|
+
* `HTTP.POST /comment/delete`
|
437
505
|
*/
|
438
506
|
LemmyHttp.prototype.deleteComment = function (form) {
|
439
507
|
return __awaiter(this, void 0, void 0, function () {
|
440
508
|
return __generator(this, function (_a) {
|
441
|
-
return [2 /*return*/, this.wrapper(HttpType.Post, "/comment/delete", form)];
|
509
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/comment/delete", form, comment_1.CommentResponse)];
|
442
510
|
});
|
443
511
|
});
|
444
512
|
};
|
445
513
|
/**
|
446
514
|
* A moderator remove for a comment.
|
515
|
+
*
|
516
|
+
* `HTTP.POST /comment/remove`
|
447
517
|
*/
|
448
518
|
LemmyHttp.prototype.removeComment = function (form) {
|
449
519
|
return __awaiter(this, void 0, void 0, function () {
|
450
520
|
return __generator(this, function (_a) {
|
451
|
-
return [2 /*return*/, this.wrapper(HttpType.Post, "/comment/remove", form)];
|
521
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/comment/remove", form, comment_1.CommentResponse)];
|
452
522
|
});
|
453
523
|
});
|
454
524
|
};
|
455
525
|
/**
|
456
526
|
* Mark a comment as read.
|
527
|
+
*
|
528
|
+
* `HTTP.POST /comment/mark_as_read`
|
457
529
|
*/
|
458
|
-
LemmyHttp.prototype.
|
530
|
+
LemmyHttp.prototype.markCommentReplyAsRead = function (form) {
|
459
531
|
return __awaiter(this, void 0, void 0, function () {
|
460
532
|
return __generator(this, function (_a) {
|
461
|
-
return [2 /*return*/, this.wrapper(HttpType.Post, "/comment/mark_as_read", form)];
|
533
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/comment/mark_as_read", form, comment_1.CommentResponse)];
|
462
534
|
});
|
463
535
|
});
|
464
536
|
};
|
465
537
|
/**
|
466
538
|
* Like / vote on a comment.
|
539
|
+
*
|
540
|
+
* `HTTP.POST /comment/like`
|
467
541
|
*/
|
468
542
|
LemmyHttp.prototype.likeComment = function (form) {
|
469
543
|
return __awaiter(this, void 0, void 0, function () {
|
470
544
|
return __generator(this, function (_a) {
|
471
|
-
return [2 /*return*/, this.wrapper(HttpType.Post, "/comment/like", form)];
|
545
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/comment/like", form, comment_1.CommentResponse)];
|
472
546
|
});
|
473
547
|
});
|
474
548
|
};
|
475
549
|
/**
|
476
550
|
* Save a comment.
|
551
|
+
*
|
552
|
+
* `HTTP.PUT /comment/save`
|
477
553
|
*/
|
478
554
|
LemmyHttp.prototype.saveComment = function (form) {
|
479
555
|
return __awaiter(this, void 0, void 0, function () {
|
480
556
|
return __generator(this, function (_a) {
|
481
|
-
return [2 /*return*/, this.wrapper(HttpType.Put, "/comment/save", form)];
|
557
|
+
return [2 /*return*/, this.wrapper(HttpType.Put, "/comment/save", form, comment_1.CommentResponse)];
|
482
558
|
});
|
483
559
|
});
|
484
560
|
};
|
485
561
|
/**
|
486
562
|
* Get / fetch comments.
|
563
|
+
*
|
564
|
+
* `HTTP.GET /comment/list`
|
487
565
|
*/
|
488
566
|
LemmyHttp.prototype.getComments = function (form) {
|
489
567
|
return __awaiter(this, void 0, void 0, function () {
|
490
568
|
return __generator(this, function (_a) {
|
491
|
-
return [2 /*return*/, this.wrapper(HttpType.Get, "/comment/list", form)];
|
569
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/comment/list", form, comment_1.GetCommentsResponse)];
|
492
570
|
});
|
493
571
|
});
|
494
572
|
};
|
495
573
|
/**
|
496
574
|
* Report a comment.
|
575
|
+
*
|
576
|
+
* `HTTP.POST /comment/report`
|
497
577
|
*/
|
498
578
|
LemmyHttp.prototype.createCommentReport = function (form) {
|
499
579
|
return __awaiter(this, void 0, void 0, function () {
|
500
580
|
return __generator(this, function (_a) {
|
501
|
-
return [2 /*return*/, this.wrapper(HttpType.Post, "/comment/report", form)];
|
581
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/comment/report", form, comment_1.CommentReportResponse)];
|
502
582
|
});
|
503
583
|
});
|
504
584
|
};
|
505
585
|
/**
|
506
586
|
* Resolve a comment report. Only a mod can do this.
|
587
|
+
*
|
588
|
+
* `HTTP.PUT /comment/report/resolve`
|
507
589
|
*/
|
508
590
|
LemmyHttp.prototype.resolveCommentReport = function (form) {
|
509
591
|
return __awaiter(this, void 0, void 0, function () {
|
510
592
|
return __generator(this, function (_a) {
|
511
|
-
return [2 /*return*/, this.wrapper(HttpType.Put, "/comment/report/resolve", form)];
|
593
|
+
return [2 /*return*/, this.wrapper(HttpType.Put, "/comment/report/resolve", form, comment_1.CommentReportResponse)];
|
512
594
|
});
|
513
595
|
});
|
514
596
|
};
|
515
597
|
/**
|
516
598
|
* List comment reports.
|
599
|
+
*
|
600
|
+
* `HTTP.GET /comment/report/list`
|
517
601
|
*/
|
518
602
|
LemmyHttp.prototype.listCommentReports = function (form) {
|
519
603
|
return __awaiter(this, void 0, void 0, function () {
|
520
604
|
return __generator(this, function (_a) {
|
521
|
-
return [2 /*return*/, this.wrapper(HttpType.Get, "/comment/report/list", form)];
|
605
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/comment/report/list", form, comment_1.ListCommentReportsResponse)];
|
522
606
|
});
|
523
607
|
});
|
524
608
|
};
|
525
609
|
/**
|
526
610
|
* Get / fetch private messages.
|
611
|
+
*
|
612
|
+
* `HTTP.GET /private_message/list`
|
527
613
|
*/
|
528
614
|
LemmyHttp.prototype.getPrivateMessages = function (form) {
|
529
615
|
return __awaiter(this, void 0, void 0, function () {
|
530
616
|
return __generator(this, function (_a) {
|
531
|
-
return [2 /*return*/, this.wrapper(HttpType.Get, "/private_message/list", form)];
|
617
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/private_message/list", form, person_1.PrivateMessagesResponse)];
|
532
618
|
});
|
533
619
|
});
|
534
620
|
};
|
535
621
|
/**
|
536
622
|
* Create a private message.
|
623
|
+
*
|
624
|
+
* `HTTP.POST /private_message`
|
537
625
|
*/
|
538
626
|
LemmyHttp.prototype.createPrivateMessage = function (form) {
|
539
627
|
return __awaiter(this, void 0, void 0, function () {
|
540
628
|
return __generator(this, function (_a) {
|
541
|
-
return [2 /*return*/, this.wrapper(HttpType.Post, "/private_message", form)];
|
629
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/private_message", form, person_1.PrivateMessageResponse)];
|
542
630
|
});
|
543
631
|
});
|
544
632
|
};
|
545
633
|
/**
|
546
634
|
* Edit a private message.
|
635
|
+
*
|
636
|
+
* `HTTP.PUT /private_message`
|
547
637
|
*/
|
548
638
|
LemmyHttp.prototype.editPrivateMessage = function (form) {
|
549
639
|
return __awaiter(this, void 0, void 0, function () {
|
550
640
|
return __generator(this, function (_a) {
|
551
|
-
return [2 /*return*/, this.wrapper(HttpType.Put, "/private_message", form)];
|
641
|
+
return [2 /*return*/, this.wrapper(HttpType.Put, "/private_message", form, person_1.PrivateMessageResponse)];
|
552
642
|
});
|
553
643
|
});
|
554
644
|
};
|
555
645
|
/**
|
556
646
|
* Delete a private message.
|
647
|
+
*
|
648
|
+
* `HTTP.POST /private_message/delete`
|
557
649
|
*/
|
558
650
|
LemmyHttp.prototype.deletePrivateMessage = function (form) {
|
559
651
|
return __awaiter(this, void 0, void 0, function () {
|
560
652
|
return __generator(this, function (_a) {
|
561
|
-
return [2 /*return*/, this.wrapper(HttpType.Post, "/private_message/delete", form)];
|
653
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/private_message/delete", form, person_1.PrivateMessageResponse)];
|
562
654
|
});
|
563
655
|
});
|
564
656
|
};
|
565
657
|
/**
|
566
658
|
* Mark a private message as read.
|
659
|
+
*
|
660
|
+
* `HTTP.POST /private_message/mark_as_read`
|
567
661
|
*/
|
568
662
|
LemmyHttp.prototype.markPrivateMessageAsRead = function (form) {
|
569
663
|
return __awaiter(this, void 0, void 0, function () {
|
570
664
|
return __generator(this, function (_a) {
|
571
|
-
return [2 /*return*/, this.wrapper(HttpType.Post, "/private_message/mark_as_read", form)];
|
665
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/private_message/mark_as_read", form, person_1.PrivateMessageResponse)];
|
572
666
|
});
|
573
667
|
});
|
574
668
|
};
|
575
669
|
/**
|
576
670
|
* Register a new user.
|
671
|
+
*
|
672
|
+
* `HTTP.POST /user/register`
|
577
673
|
*/
|
578
674
|
LemmyHttp.prototype.register = function (form) {
|
579
675
|
return __awaiter(this, void 0, void 0, function () {
|
580
676
|
return __generator(this, function (_a) {
|
581
|
-
return [2 /*return*/, this.wrapper(HttpType.Post, "/user/register", form)];
|
677
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/user/register", form, person_1.LoginResponse)];
|
582
678
|
});
|
583
679
|
});
|
584
680
|
};
|
585
681
|
/**
|
586
682
|
* Log into lemmy.
|
683
|
+
*
|
684
|
+
* `HTTP.POST /user/login`
|
587
685
|
*/
|
588
686
|
LemmyHttp.prototype.login = function (form) {
|
589
687
|
return __awaiter(this, void 0, void 0, function () {
|
590
688
|
return __generator(this, function (_a) {
|
591
|
-
return [2 /*return*/, this.wrapper(HttpType.Post, "/user/login", form)];
|
689
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/user/login", form, person_1.LoginResponse)];
|
592
690
|
});
|
593
691
|
});
|
594
692
|
};
|
595
693
|
/**
|
596
694
|
* Get the details for a person.
|
695
|
+
*
|
696
|
+
* `HTTP.GET /user`
|
597
697
|
*/
|
598
698
|
LemmyHttp.prototype.getPersonDetails = function (form) {
|
599
699
|
return __awaiter(this, void 0, void 0, function () {
|
600
700
|
return __generator(this, function (_a) {
|
601
|
-
return [2 /*return*/, this.wrapper(HttpType.Get, "/user", form)];
|
701
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/user", form, person_1.GetPersonDetailsResponse)];
|
602
702
|
});
|
603
703
|
});
|
604
704
|
};
|
605
705
|
/**
|
606
706
|
* Get mentions for your user.
|
707
|
+
*
|
708
|
+
* `HTTP.GET /user/mention`
|
607
709
|
*/
|
608
710
|
LemmyHttp.prototype.getPersonMentions = function (form) {
|
609
711
|
return __awaiter(this, void 0, void 0, function () {
|
610
712
|
return __generator(this, function (_a) {
|
611
|
-
return [2 /*return*/, this.wrapper(HttpType.Get, "/user/mention", form)];
|
713
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/user/mention", form, person_1.GetPersonMentionsResponse)];
|
612
714
|
});
|
613
715
|
});
|
614
716
|
};
|
615
717
|
/**
|
616
718
|
* Mark a person mention as read.
|
719
|
+
*
|
720
|
+
* `HTTP.POST /user/mention/mark_as_read`
|
617
721
|
*/
|
618
722
|
LemmyHttp.prototype.markPersonMentionAsRead = function (form) {
|
619
723
|
return __awaiter(this, void 0, void 0, function () {
|
620
724
|
return __generator(this, function (_a) {
|
621
|
-
return [2 /*return*/, this.wrapper(HttpType.Post, "/user/mention/mark_as_read", form)];
|
725
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/user/mention/mark_as_read", form, person_1.PersonMentionResponse)];
|
622
726
|
});
|
623
727
|
});
|
624
728
|
};
|
625
729
|
/**
|
626
730
|
* Get comment replies.
|
731
|
+
*
|
732
|
+
* `HTTP.GET /user/replies`
|
627
733
|
*/
|
628
734
|
LemmyHttp.prototype.getReplies = function (form) {
|
629
735
|
return __awaiter(this, void 0, void 0, function () {
|
630
736
|
return __generator(this, function (_a) {
|
631
|
-
return [2 /*return*/, this.wrapper(HttpType.Get, "/user/replies", form)];
|
737
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/user/replies", form, person_1.GetRepliesResponse)];
|
632
738
|
});
|
633
739
|
});
|
634
740
|
};
|
635
741
|
/**
|
636
742
|
* Ban a person from your site.
|
743
|
+
*
|
744
|
+
* `HTTP.POST /user/ban`
|
637
745
|
*/
|
638
746
|
LemmyHttp.prototype.banPerson = function (form) {
|
639
747
|
return __awaiter(this, void 0, void 0, function () {
|
640
748
|
return __generator(this, function (_a) {
|
641
|
-
return [2 /*return*/, this.wrapper(HttpType.Post, "/user/ban", form)];
|
749
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/user/ban", form, person_1.BanPersonResponse)];
|
642
750
|
});
|
643
751
|
});
|
644
752
|
};
|
645
753
|
/**
|
646
754
|
* Get a list of banned users
|
755
|
+
*
|
756
|
+
* `HTTP.GET /user/banned`
|
647
757
|
*/
|
648
758
|
LemmyHttp.prototype.getBannedPersons = function (form) {
|
649
759
|
return __awaiter(this, void 0, void 0, function () {
|
650
760
|
return __generator(this, function (_a) {
|
651
|
-
return [2 /*return*/, this.wrapper(HttpType.Get, "/user/banned", form)];
|
761
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/user/banned", form, person_1.BannedPersonsResponse)];
|
652
762
|
});
|
653
763
|
});
|
654
764
|
};
|
655
765
|
/**
|
656
766
|
* Block a person.
|
767
|
+
*
|
768
|
+
* `HTTP.POST /user/block`
|
657
769
|
*/
|
658
770
|
LemmyHttp.prototype.blockPerson = function (form) {
|
659
771
|
return __awaiter(this, void 0, void 0, function () {
|
660
772
|
return __generator(this, function (_a) {
|
661
|
-
return [2 /*return*/, this.wrapper(HttpType.Post, "/user/block", form)];
|
773
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/user/block", form, person_1.BlockPersonResponse)];
|
662
774
|
});
|
663
775
|
});
|
664
776
|
};
|
665
777
|
/**
|
666
778
|
* Fetch a Captcha.
|
779
|
+
*
|
780
|
+
* `HTTP.GET /user/get_captcha`
|
667
781
|
*/
|
668
782
|
LemmyHttp.prototype.getCaptcha = function () {
|
669
783
|
return __awaiter(this, void 0, void 0, function () {
|
670
784
|
return __generator(this, function (_a) {
|
671
|
-
return [2 /*return*/, this.wrapper(HttpType.Get, "/user/get_captcha", {})];
|
785
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/user/get_captcha", {}, person_1.GetCaptchaResponse)];
|
672
786
|
});
|
673
787
|
});
|
674
788
|
};
|
675
789
|
/**
|
676
790
|
* Delete your account.
|
791
|
+
*
|
792
|
+
* `HTTP.POST /user/delete_account`
|
677
793
|
*/
|
678
794
|
LemmyHttp.prototype.deleteAccount = function (form) {
|
679
795
|
return __awaiter(this, void 0, void 0, function () {
|
680
796
|
return __generator(this, function (_a) {
|
681
|
-
return [2 /*return*/, this.wrapper(HttpType.Post, "/user/delete_account", form)];
|
797
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/user/delete_account", form, person_1.DeleteAccountResponse)];
|
682
798
|
});
|
683
799
|
});
|
684
800
|
};
|
685
801
|
/**
|
686
802
|
* Reset your password.
|
803
|
+
*
|
804
|
+
* `HTTP.POST /user/password_reset`
|
687
805
|
*/
|
688
806
|
LemmyHttp.prototype.passwordReset = function (form) {
|
689
807
|
return __awaiter(this, void 0, void 0, function () {
|
690
808
|
return __generator(this, function (_a) {
|
691
|
-
return [2 /*return*/, this.wrapper(HttpType.Post, "/user/password_reset", form)];
|
809
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/user/password_reset", form, person_1.PasswordResetResponse)];
|
692
810
|
});
|
693
811
|
});
|
694
812
|
};
|
695
813
|
/**
|
696
814
|
* Change your password from an email / token based reset.
|
815
|
+
*
|
816
|
+
* `HTTP.POST /user/password_change`
|
697
817
|
*/
|
698
818
|
LemmyHttp.prototype.passwordChange = function (form) {
|
699
819
|
return __awaiter(this, void 0, void 0, function () {
|
700
820
|
return __generator(this, function (_a) {
|
701
|
-
return [2 /*return*/, this.wrapper(HttpType.Post, "/user/password_change", form)];
|
821
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/user/password_change", form, person_1.LoginResponse)];
|
702
822
|
});
|
703
823
|
});
|
704
824
|
};
|
705
825
|
/**
|
706
826
|
* Mark all replies as read.
|
827
|
+
*
|
828
|
+
* `HTTP.POST /user/mark_all_as_read`
|
707
829
|
*/
|
708
830
|
LemmyHttp.prototype.markAllAsRead = function (form) {
|
709
831
|
return __awaiter(this, void 0, void 0, function () {
|
710
832
|
return __generator(this, function (_a) {
|
711
|
-
return [2 /*return*/, this.wrapper(HttpType.Post, "/user/mark_all_as_read", form)];
|
833
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/user/mark_all_as_read", form, person_1.GetRepliesResponse)];
|
712
834
|
});
|
713
835
|
});
|
714
836
|
};
|
715
837
|
/**
|
716
838
|
* Save your user settings.
|
839
|
+
*
|
840
|
+
* `HTTP.PUT /user/save_user_settings`
|
717
841
|
*/
|
718
842
|
LemmyHttp.prototype.saveUserSettings = function (form) {
|
719
843
|
return __awaiter(this, void 0, void 0, function () {
|
720
844
|
return __generator(this, function (_a) {
|
721
|
-
return [2 /*return*/, this.wrapper(HttpType.Put, "/user/save_user_settings", form)];
|
845
|
+
return [2 /*return*/, this.wrapper(HttpType.Put, "/user/save_user_settings", form, person_1.LoginResponse)];
|
722
846
|
});
|
723
847
|
});
|
724
848
|
};
|
725
849
|
/**
|
726
850
|
* Change your user password.
|
851
|
+
*
|
852
|
+
* `HTTP.PUT /user/change_password`
|
727
853
|
*/
|
728
854
|
LemmyHttp.prototype.changePassword = function (form) {
|
729
855
|
return __awaiter(this, void 0, void 0, function () {
|
730
856
|
return __generator(this, function (_a) {
|
731
|
-
return [2 /*return*/, this.wrapper(HttpType.Put, "/user/change_password", form)];
|
857
|
+
return [2 /*return*/, this.wrapper(HttpType.Put, "/user/change_password", form, person_1.LoginResponse)];
|
732
858
|
});
|
733
859
|
});
|
734
860
|
};
|
735
861
|
/**
|
736
862
|
* Get counts for your reports
|
863
|
+
*
|
864
|
+
* `HTTP.GET /user/report_count`
|
737
865
|
*/
|
738
866
|
LemmyHttp.prototype.getReportCount = function (form) {
|
739
867
|
return __awaiter(this, void 0, void 0, function () {
|
740
868
|
return __generator(this, function (_a) {
|
741
|
-
return [2 /*return*/, this.wrapper(HttpType.Get, "/user/report_count", form)];
|
869
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/user/report_count", form, person_1.GetReportCountResponse)];
|
742
870
|
});
|
743
871
|
});
|
744
872
|
};
|
745
873
|
/**
|
746
874
|
* Get your unread counts
|
875
|
+
*
|
876
|
+
* `HTTP.GET /user/unread_count`
|
747
877
|
*/
|
748
878
|
LemmyHttp.prototype.getUnreadCount = function (form) {
|
749
879
|
return __awaiter(this, void 0, void 0, function () {
|
750
880
|
return __generator(this, function (_a) {
|
751
|
-
return [2 /*return*/, this.wrapper(HttpType.Get, "/user/unread_count", form)];
|
881
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/user/unread_count", form, person_1.GetUnreadCountResponse)];
|
752
882
|
});
|
753
883
|
});
|
754
884
|
};
|
755
885
|
/**
|
756
886
|
* Verify your email
|
887
|
+
*
|
888
|
+
* `HTTP.POST /user/verify_email`
|
757
889
|
*/
|
758
890
|
LemmyHttp.prototype.verifyEmail = function (form) {
|
759
891
|
return __awaiter(this, void 0, void 0, function () {
|
760
892
|
return __generator(this, function (_a) {
|
761
|
-
return [2 /*return*/, this.wrapper(HttpType.Post, "/user/verify_email", form)];
|
893
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/user/verify_email", form, person_1.VerifyEmailResponse)];
|
762
894
|
});
|
763
895
|
});
|
764
896
|
};
|
765
897
|
/**
|
766
898
|
* Add an admin to your site.
|
899
|
+
*
|
900
|
+
* `HTTP.POST /admin/add`
|
767
901
|
*/
|
768
902
|
LemmyHttp.prototype.addAdmin = function (form) {
|
769
903
|
return __awaiter(this, void 0, void 0, function () {
|
770
904
|
return __generator(this, function (_a) {
|
771
|
-
return [2 /*return*/, this.wrapper(HttpType.Post, "/admin/add", form)];
|
905
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/admin/add", form, person_1.AddAdminResponse)];
|
772
906
|
});
|
773
907
|
});
|
774
908
|
};
|
775
909
|
/**
|
776
910
|
* Get the unread registration applications count.
|
911
|
+
*
|
912
|
+
* `HTTP.GET /admin/registration_application/count`
|
777
913
|
*/
|
778
914
|
LemmyHttp.prototype.getUnreadRegistrationApplicationCount = function (form) {
|
779
915
|
return __awaiter(this, void 0, void 0, function () {
|
780
916
|
return __generator(this, function (_a) {
|
781
|
-
return [2 /*return*/, this.wrapper(HttpType.Get, "/admin/registration_application/count", form)];
|
917
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/admin/registration_application/count", form, site_1.GetUnreadRegistrationApplicationCountResponse)];
|
782
918
|
});
|
783
919
|
});
|
784
920
|
};
|
785
921
|
/**
|
786
|
-
* List the
|
922
|
+
* List the registration applications.
|
923
|
+
*
|
924
|
+
* `HTTP.GET /admin/registration_application/list`
|
787
925
|
*/
|
788
926
|
LemmyHttp.prototype.listRegistrationApplications = function (form) {
|
789
927
|
return __awaiter(this, void 0, void 0, function () {
|
790
928
|
return __generator(this, function (_a) {
|
791
|
-
return [2 /*return*/, this.wrapper(HttpType.Get, "/admin/registration_application/list", form)];
|
929
|
+
return [2 /*return*/, this.wrapper(HttpType.Get, "/admin/registration_application/list", form, site_1.ListRegistrationApplicationsResponse)];
|
792
930
|
});
|
793
931
|
});
|
794
932
|
};
|
795
933
|
/**
|
796
934
|
* Approve a registration application
|
935
|
+
*
|
936
|
+
* `HTTP.PUT /admin/registration_application/approve`
|
797
937
|
*/
|
798
938
|
LemmyHttp.prototype.approveRegistrationApplication = function (form) {
|
799
939
|
return __awaiter(this, void 0, void 0, function () {
|
800
940
|
return __generator(this, function (_a) {
|
801
|
-
return [2 /*return*/, this.wrapper(HttpType.Put, "/admin/registration_application/approve", form)];
|
941
|
+
return [2 /*return*/, this.wrapper(HttpType.Put, "/admin/registration_application/approve", form, site_1.RegistrationApplicationResponse)];
|
942
|
+
});
|
943
|
+
});
|
944
|
+
};
|
945
|
+
/**
|
946
|
+
* Purge / Delete a person from the database.
|
947
|
+
*
|
948
|
+
* `HTTP.POST /admin/purge/person`
|
949
|
+
*/
|
950
|
+
LemmyHttp.prototype.purgePerson = function (form) {
|
951
|
+
return __awaiter(this, void 0, void 0, function () {
|
952
|
+
return __generator(this, function (_a) {
|
953
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/admin/purge/person", form, site_1.PurgeItemResponse)];
|
954
|
+
});
|
955
|
+
});
|
956
|
+
};
|
957
|
+
/**
|
958
|
+
* Purge / Delete a community from the database.
|
959
|
+
*
|
960
|
+
* `HTTP.POST /admin/purge/community`
|
961
|
+
*/
|
962
|
+
LemmyHttp.prototype.purgeCommunity = function (form) {
|
963
|
+
return __awaiter(this, void 0, void 0, function () {
|
964
|
+
return __generator(this, function (_a) {
|
965
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/admin/purge/community", form, site_1.PurgeItemResponse)];
|
966
|
+
});
|
967
|
+
});
|
968
|
+
};
|
969
|
+
/**
|
970
|
+
* Purge / Delete a post from the database.
|
971
|
+
*
|
972
|
+
* `HTTP.POST /admin/purge/post`
|
973
|
+
*/
|
974
|
+
LemmyHttp.prototype.purgePost = function (form) {
|
975
|
+
return __awaiter(this, void 0, void 0, function () {
|
976
|
+
return __generator(this, function (_a) {
|
977
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/admin/purge/post", form, site_1.PurgeItemResponse)];
|
978
|
+
});
|
979
|
+
});
|
980
|
+
};
|
981
|
+
/**
|
982
|
+
* Purge / Delete a comment from the database.
|
983
|
+
*
|
984
|
+
* `HTTP.POST /admin/purge/comment`
|
985
|
+
*/
|
986
|
+
LemmyHttp.prototype.purgeComment = function (form) {
|
987
|
+
return __awaiter(this, void 0, void 0, function () {
|
988
|
+
return __generator(this, function (_a) {
|
989
|
+
return [2 /*return*/, this.wrapper(HttpType.Post, "/admin/purge/comment", form, site_1.PurgeItemResponse)];
|
802
990
|
});
|
803
991
|
});
|
804
992
|
};
|
805
993
|
LemmyHttp.prototype.buildFullUrl = function (endpoint) {
|
806
994
|
return "".concat(this.apiUrl).concat(endpoint);
|
807
995
|
};
|
808
|
-
LemmyHttp.prototype.wrapper = function (type_, endpoint, form) {
|
996
|
+
LemmyHttp.prototype.wrapper = function (type_, endpoint, form, responseClass) {
|
809
997
|
return __awaiter(this, void 0, void 0, function () {
|
810
998
|
var getUrl;
|
811
999
|
return __generator(this, function (_a) {
|
@@ -814,14 +1002,22 @@ var LemmyHttp = /** @class */ (function () {
|
|
814
1002
|
return [2 /*return*/, (0, node_fetch_1.default)(getUrl, {
|
815
1003
|
method: "GET",
|
816
1004
|
headers: this.headers,
|
817
|
-
}).then(function (d) {
|
1005
|
+
}).then(function (d) {
|
1006
|
+
return d
|
1007
|
+
.text()
|
1008
|
+
.then(function (a) { return (0, class_transformer_1.deserialize)(responseClass, a); });
|
1009
|
+
})];
|
818
1010
|
}
|
819
1011
|
else {
|
820
1012
|
return [2 /*return*/, (0, node_fetch_1.default)(this.buildFullUrl(endpoint), {
|
821
1013
|
method: type_,
|
822
1014
|
headers: __assign({ "Content-Type": "application/json" }, this.headers),
|
823
|
-
body:
|
824
|
-
}).then(function (d) {
|
1015
|
+
body: (0, class_transformer_1.serialize)(form),
|
1016
|
+
}).then(function (d) {
|
1017
|
+
return d
|
1018
|
+
.text()
|
1019
|
+
.then(function (a) { return (0, class_transformer_1.deserialize)(responseClass, a); });
|
1020
|
+
})];
|
825
1021
|
}
|
826
1022
|
return [2 /*return*/];
|
827
1023
|
});
|
@@ -831,7 +1027,9 @@ var LemmyHttp = /** @class */ (function () {
|
|
831
1027
|
}());
|
832
1028
|
exports.LemmyHttp = LemmyHttp;
|
833
1029
|
function encodeGetParams(p) {
|
834
|
-
|
1030
|
+
// Necessary to remove the Options
|
1031
|
+
var serialized = JSON.parse((0, class_transformer_1.serialize)(p));
|
1032
|
+
return Object.entries(serialized)
|
835
1033
|
.map(function (kv) { return kv.map(encodeURIComponent).join("="); })
|
836
1034
|
.join("&");
|
837
1035
|
}
|