lemmy-js-client 0.17.0-rc.5 → 0.17.0-rc.51

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.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,956 @@ 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.markCommentAsRead = function (form) {
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)];
666
+ });
667
+ });
668
+ };
669
+ /**
670
+ * Create a report for a private message.
671
+ *
672
+ * `HTTP.POST /private_message/report`
673
+ */
674
+ LemmyHttp.prototype.createPrivateMessageReport = function (form) {
675
+ return __awaiter(this, void 0, void 0, function () {
676
+ return __generator(this, function (_a) {
677
+ return [2 /*return*/, this.wrapper(HttpType.Post, "/private_message/report", form, person_1.PrivateMessageReportResponse)];
678
+ });
679
+ });
680
+ };
681
+ /**
682
+ * Resolve a report for a private message.
683
+ *
684
+ * `HTTP.PUT /private_message/report/resolve`
685
+ */
686
+ LemmyHttp.prototype.resolvePrivateMessageReport = function (form) {
687
+ return __awaiter(this, void 0, void 0, function () {
688
+ return __generator(this, function (_a) {
689
+ return [2 /*return*/, this.wrapper(HttpType.Put, "/private_message/report/resolve", form, person_1.PrivateMessageReportResponse)];
690
+ });
691
+ });
692
+ };
693
+ /**
694
+ * List private message reports.
695
+ *
696
+ * `HTTP.GET /private_message/report/list`
697
+ */
698
+ LemmyHttp.prototype.listPrivateMessageReports = function (form) {
699
+ return __awaiter(this, void 0, void 0, function () {
700
+ return __generator(this, function (_a) {
701
+ return [2 /*return*/, this.wrapper(HttpType.Get, "/private_message/report/list", form, person_1.ListPrivateMessageReportsResponse)];
572
702
  });
573
703
  });
574
704
  };
575
705
  /**
576
706
  * Register a new user.
707
+ *
708
+ * `HTTP.POST /user/register`
577
709
  */
578
710
  LemmyHttp.prototype.register = function (form) {
579
711
  return __awaiter(this, void 0, void 0, function () {
580
712
  return __generator(this, function (_a) {
581
- return [2 /*return*/, this.wrapper(HttpType.Post, "/user/register", form)];
713
+ return [2 /*return*/, this.wrapper(HttpType.Post, "/user/register", form, person_1.LoginResponse)];
582
714
  });
583
715
  });
584
716
  };
585
717
  /**
586
718
  * Log into lemmy.
719
+ *
720
+ * `HTTP.POST /user/login`
587
721
  */
588
722
  LemmyHttp.prototype.login = function (form) {
589
723
  return __awaiter(this, void 0, void 0, function () {
590
724
  return __generator(this, function (_a) {
591
- return [2 /*return*/, this.wrapper(HttpType.Post, "/user/login", form)];
725
+ return [2 /*return*/, this.wrapper(HttpType.Post, "/user/login", form, person_1.LoginResponse)];
592
726
  });
593
727
  });
594
728
  };
595
729
  /**
596
730
  * Get the details for a person.
731
+ *
732
+ * `HTTP.GET /user`
597
733
  */
598
734
  LemmyHttp.prototype.getPersonDetails = function (form) {
599
735
  return __awaiter(this, void 0, void 0, function () {
600
736
  return __generator(this, function (_a) {
601
- return [2 /*return*/, this.wrapper(HttpType.Get, "/user", form)];
737
+ return [2 /*return*/, this.wrapper(HttpType.Get, "/user", form, person_1.GetPersonDetailsResponse)];
602
738
  });
603
739
  });
604
740
  };
605
741
  /**
606
742
  * Get mentions for your user.
743
+ *
744
+ * `HTTP.GET /user/mention`
607
745
  */
608
746
  LemmyHttp.prototype.getPersonMentions = function (form) {
609
747
  return __awaiter(this, void 0, void 0, function () {
610
748
  return __generator(this, function (_a) {
611
- return [2 /*return*/, this.wrapper(HttpType.Get, "/user/mention", form)];
749
+ return [2 /*return*/, this.wrapper(HttpType.Get, "/user/mention", form, person_1.GetPersonMentionsResponse)];
612
750
  });
613
751
  });
614
752
  };
615
753
  /**
616
754
  * Mark a person mention as read.
755
+ *
756
+ * `HTTP.POST /user/mention/mark_as_read`
617
757
  */
618
758
  LemmyHttp.prototype.markPersonMentionAsRead = function (form) {
619
759
  return __awaiter(this, void 0, void 0, function () {
620
760
  return __generator(this, function (_a) {
621
- return [2 /*return*/, this.wrapper(HttpType.Post, "/user/mention/mark_as_read", form)];
761
+ return [2 /*return*/, this.wrapper(HttpType.Post, "/user/mention/mark_as_read", form, person_1.PersonMentionResponse)];
622
762
  });
623
763
  });
624
764
  };
625
765
  /**
626
766
  * Get comment replies.
767
+ *
768
+ * `HTTP.GET /user/replies`
627
769
  */
628
770
  LemmyHttp.prototype.getReplies = function (form) {
629
771
  return __awaiter(this, void 0, void 0, function () {
630
772
  return __generator(this, function (_a) {
631
- return [2 /*return*/, this.wrapper(HttpType.Get, "/user/replies", form)];
773
+ return [2 /*return*/, this.wrapper(HttpType.Get, "/user/replies", form, person_1.GetRepliesResponse)];
632
774
  });
633
775
  });
634
776
  };
635
777
  /**
636
778
  * Ban a person from your site.
779
+ *
780
+ * `HTTP.POST /user/ban`
637
781
  */
638
782
  LemmyHttp.prototype.banPerson = function (form) {
639
783
  return __awaiter(this, void 0, void 0, function () {
640
784
  return __generator(this, function (_a) {
641
- return [2 /*return*/, this.wrapper(HttpType.Post, "/user/ban", form)];
785
+ return [2 /*return*/, this.wrapper(HttpType.Post, "/user/ban", form, person_1.BanPersonResponse)];
642
786
  });
643
787
  });
644
788
  };
645
789
  /**
646
790
  * Get a list of banned users
791
+ *
792
+ * `HTTP.GET /user/banned`
647
793
  */
648
794
  LemmyHttp.prototype.getBannedPersons = function (form) {
649
795
  return __awaiter(this, void 0, void 0, function () {
650
796
  return __generator(this, function (_a) {
651
- return [2 /*return*/, this.wrapper(HttpType.Get, "/user/banned", form)];
797
+ return [2 /*return*/, this.wrapper(HttpType.Get, "/user/banned", form, person_1.BannedPersonsResponse)];
652
798
  });
653
799
  });
654
800
  };
655
801
  /**
656
802
  * Block a person.
803
+ *
804
+ * `HTTP.POST /user/block`
657
805
  */
658
806
  LemmyHttp.prototype.blockPerson = function (form) {
659
807
  return __awaiter(this, void 0, void 0, function () {
660
808
  return __generator(this, function (_a) {
661
- return [2 /*return*/, this.wrapper(HttpType.Post, "/user/block", form)];
809
+ return [2 /*return*/, this.wrapper(HttpType.Post, "/user/block", form, person_1.BlockPersonResponse)];
662
810
  });
663
811
  });
664
812
  };
665
813
  /**
666
814
  * Fetch a Captcha.
815
+ *
816
+ * `HTTP.GET /user/get_captcha`
667
817
  */
668
818
  LemmyHttp.prototype.getCaptcha = function () {
669
819
  return __awaiter(this, void 0, void 0, function () {
670
820
  return __generator(this, function (_a) {
671
- return [2 /*return*/, this.wrapper(HttpType.Get, "/user/get_captcha", {})];
821
+ return [2 /*return*/, this.wrapper(HttpType.Get, "/user/get_captcha", {}, person_1.GetCaptchaResponse)];
672
822
  });
673
823
  });
674
824
  };
675
825
  /**
676
826
  * Delete your account.
827
+ *
828
+ * `HTTP.POST /user/delete_account`
677
829
  */
678
830
  LemmyHttp.prototype.deleteAccount = function (form) {
679
831
  return __awaiter(this, void 0, void 0, function () {
680
832
  return __generator(this, function (_a) {
681
- return [2 /*return*/, this.wrapper(HttpType.Post, "/user/delete_account", form)];
833
+ return [2 /*return*/, this.wrapper(HttpType.Post, "/user/delete_account", form, person_1.DeleteAccountResponse)];
682
834
  });
683
835
  });
684
836
  };
685
837
  /**
686
838
  * Reset your password.
839
+ *
840
+ * `HTTP.POST /user/password_reset`
687
841
  */
688
842
  LemmyHttp.prototype.passwordReset = function (form) {
689
843
  return __awaiter(this, void 0, void 0, function () {
690
844
  return __generator(this, function (_a) {
691
- return [2 /*return*/, this.wrapper(HttpType.Post, "/user/password_reset", form)];
845
+ return [2 /*return*/, this.wrapper(HttpType.Post, "/user/password_reset", form, person_1.PasswordResetResponse)];
692
846
  });
693
847
  });
694
848
  };
695
849
  /**
696
850
  * Change your password from an email / token based reset.
851
+ *
852
+ * `HTTP.POST /user/password_change`
697
853
  */
698
854
  LemmyHttp.prototype.passwordChange = function (form) {
699
855
  return __awaiter(this, void 0, void 0, function () {
700
856
  return __generator(this, function (_a) {
701
- return [2 /*return*/, this.wrapper(HttpType.Post, "/user/password_change", form)];
857
+ return [2 /*return*/, this.wrapper(HttpType.Post, "/user/password_change", form, person_1.LoginResponse)];
702
858
  });
703
859
  });
704
860
  };
705
861
  /**
706
862
  * Mark all replies as read.
863
+ *
864
+ * `HTTP.POST /user/mark_all_as_read`
707
865
  */
708
866
  LemmyHttp.prototype.markAllAsRead = function (form) {
709
867
  return __awaiter(this, void 0, void 0, function () {
710
868
  return __generator(this, function (_a) {
711
- return [2 /*return*/, this.wrapper(HttpType.Post, "/user/mark_all_as_read", form)];
869
+ return [2 /*return*/, this.wrapper(HttpType.Post, "/user/mark_all_as_read", form, person_1.GetRepliesResponse)];
712
870
  });
713
871
  });
714
872
  };
715
873
  /**
716
874
  * Save your user settings.
875
+ *
876
+ * `HTTP.PUT /user/save_user_settings`
717
877
  */
718
878
  LemmyHttp.prototype.saveUserSettings = function (form) {
719
879
  return __awaiter(this, void 0, void 0, function () {
720
880
  return __generator(this, function (_a) {
721
- return [2 /*return*/, this.wrapper(HttpType.Put, "/user/save_user_settings", form)];
881
+ return [2 /*return*/, this.wrapper(HttpType.Put, "/user/save_user_settings", form, person_1.LoginResponse)];
722
882
  });
723
883
  });
724
884
  };
725
885
  /**
726
886
  * Change your user password.
887
+ *
888
+ * `HTTP.PUT /user/change_password`
727
889
  */
728
890
  LemmyHttp.prototype.changePassword = function (form) {
729
891
  return __awaiter(this, void 0, void 0, function () {
730
892
  return __generator(this, function (_a) {
731
- return [2 /*return*/, this.wrapper(HttpType.Put, "/user/change_password", form)];
893
+ return [2 /*return*/, this.wrapper(HttpType.Put, "/user/change_password", form, person_1.LoginResponse)];
732
894
  });
733
895
  });
734
896
  };
735
897
  /**
736
898
  * Get counts for your reports
899
+ *
900
+ * `HTTP.GET /user/report_count`
737
901
  */
738
902
  LemmyHttp.prototype.getReportCount = function (form) {
739
903
  return __awaiter(this, void 0, void 0, function () {
740
904
  return __generator(this, function (_a) {
741
- return [2 /*return*/, this.wrapper(HttpType.Get, "/user/report_count", form)];
905
+ return [2 /*return*/, this.wrapper(HttpType.Get, "/user/report_count", form, person_1.GetReportCountResponse)];
742
906
  });
743
907
  });
744
908
  };
745
909
  /**
746
910
  * Get your unread counts
911
+ *
912
+ * `HTTP.GET /user/unread_count`
747
913
  */
748
914
  LemmyHttp.prototype.getUnreadCount = function (form) {
749
915
  return __awaiter(this, void 0, void 0, function () {
750
916
  return __generator(this, function (_a) {
751
- return [2 /*return*/, this.wrapper(HttpType.Get, "/user/unread_count", form)];
917
+ return [2 /*return*/, this.wrapper(HttpType.Get, "/user/unread_count", form, person_1.GetUnreadCountResponse)];
752
918
  });
753
919
  });
754
920
  };
755
921
  /**
756
922
  * Verify your email
923
+ *
924
+ * `HTTP.POST /user/verify_email`
757
925
  */
758
926
  LemmyHttp.prototype.verifyEmail = function (form) {
759
927
  return __awaiter(this, void 0, void 0, function () {
760
928
  return __generator(this, function (_a) {
761
- return [2 /*return*/, this.wrapper(HttpType.Post, "/user/verify_email", form)];
929
+ return [2 /*return*/, this.wrapper(HttpType.Post, "/user/verify_email", form, person_1.VerifyEmailResponse)];
762
930
  });
763
931
  });
764
932
  };
765
933
  /**
766
934
  * Add an admin to your site.
935
+ *
936
+ * `HTTP.POST /admin/add`
767
937
  */
768
938
  LemmyHttp.prototype.addAdmin = function (form) {
769
939
  return __awaiter(this, void 0, void 0, function () {
770
940
  return __generator(this, function (_a) {
771
- return [2 /*return*/, this.wrapper(HttpType.Post, "/admin/add", form)];
941
+ return [2 /*return*/, this.wrapper(HttpType.Post, "/admin/add", form, person_1.AddAdminResponse)];
772
942
  });
773
943
  });
774
944
  };
775
945
  /**
776
946
  * Get the unread registration applications count.
947
+ *
948
+ * `HTTP.GET /admin/registration_application/count`
777
949
  */
778
950
  LemmyHttp.prototype.getUnreadRegistrationApplicationCount = function (form) {
779
951
  return __awaiter(this, void 0, void 0, function () {
780
952
  return __generator(this, function (_a) {
781
- return [2 /*return*/, this.wrapper(HttpType.Get, "/admin/registration_application/count", form)];
953
+ return [2 /*return*/, this.wrapper(HttpType.Get, "/admin/registration_application/count", form, site_1.GetUnreadRegistrationApplicationCountResponse)];
782
954
  });
783
955
  });
784
956
  };
785
957
  /**
786
- * List the unread registration applications.
958
+ * List the registration applications.
959
+ *
960
+ * `HTTP.GET /admin/registration_application/list`
787
961
  */
788
962
  LemmyHttp.prototype.listRegistrationApplications = function (form) {
789
963
  return __awaiter(this, void 0, void 0, function () {
790
964
  return __generator(this, function (_a) {
791
- return [2 /*return*/, this.wrapper(HttpType.Get, "/admin/registration_application/list", form)];
965
+ return [2 /*return*/, this.wrapper(HttpType.Get, "/admin/registration_application/list", form, site_1.ListRegistrationApplicationsResponse)];
792
966
  });
793
967
  });
794
968
  };
795
969
  /**
796
970
  * Approve a registration application
971
+ *
972
+ * `HTTP.PUT /admin/registration_application/approve`
797
973
  */
798
974
  LemmyHttp.prototype.approveRegistrationApplication = function (form) {
799
975
  return __awaiter(this, void 0, void 0, function () {
800
976
  return __generator(this, function (_a) {
801
- return [2 /*return*/, this.wrapper(HttpType.Put, "/admin/registration_application/approve", form)];
977
+ return [2 /*return*/, this.wrapper(HttpType.Put, "/admin/registration_application/approve", form, site_1.RegistrationApplicationResponse)];
978
+ });
979
+ });
980
+ };
981
+ /**
982
+ * Purge / Delete a person from the database.
983
+ *
984
+ * `HTTP.POST /admin/purge/person`
985
+ */
986
+ LemmyHttp.prototype.purgePerson = 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/person", form, site_1.PurgeItemResponse)];
990
+ });
991
+ });
992
+ };
993
+ /**
994
+ * Purge / Delete a community from the database.
995
+ *
996
+ * `HTTP.POST /admin/purge/community`
997
+ */
998
+ LemmyHttp.prototype.purgeCommunity = function (form) {
999
+ return __awaiter(this, void 0, void 0, function () {
1000
+ return __generator(this, function (_a) {
1001
+ return [2 /*return*/, this.wrapper(HttpType.Post, "/admin/purge/community", form, site_1.PurgeItemResponse)];
1002
+ });
1003
+ });
1004
+ };
1005
+ /**
1006
+ * Purge / Delete a post from the database.
1007
+ *
1008
+ * `HTTP.POST /admin/purge/post`
1009
+ */
1010
+ LemmyHttp.prototype.purgePost = function (form) {
1011
+ return __awaiter(this, void 0, void 0, function () {
1012
+ return __generator(this, function (_a) {
1013
+ return [2 /*return*/, this.wrapper(HttpType.Post, "/admin/purge/post", form, site_1.PurgeItemResponse)];
1014
+ });
1015
+ });
1016
+ };
1017
+ /**
1018
+ * Purge / Delete a comment from the database.
1019
+ *
1020
+ * `HTTP.POST /admin/purge/comment`
1021
+ */
1022
+ LemmyHttp.prototype.purgeComment = function (form) {
1023
+ return __awaiter(this, void 0, void 0, function () {
1024
+ return __generator(this, function (_a) {
1025
+ return [2 /*return*/, this.wrapper(HttpType.Post, "/admin/purge/comment", form, site_1.PurgeItemResponse)];
802
1026
  });
803
1027
  });
804
1028
  };
805
1029
  LemmyHttp.prototype.buildFullUrl = function (endpoint) {
806
1030
  return "".concat(this.apiUrl).concat(endpoint);
807
1031
  };
808
- LemmyHttp.prototype.wrapper = function (type_, endpoint, form) {
1032
+ LemmyHttp.prototype.wrapper = function (type_, endpoint, form, responseClass) {
809
1033
  return __awaiter(this, void 0, void 0, function () {
810
1034
  var getUrl;
811
1035
  return __generator(this, function (_a) {
@@ -814,14 +1038,22 @@ var LemmyHttp = /** @class */ (function () {
814
1038
  return [2 /*return*/, (0, node_fetch_1.default)(getUrl, {
815
1039
  method: "GET",
816
1040
  headers: this.headers,
817
- }).then(function (d) { return d.json(); })];
1041
+ }).then(function (d) {
1042
+ return d
1043
+ .text()
1044
+ .then(function (a) { return (0, class_transformer_1.deserialize)(responseClass, a); });
1045
+ })];
818
1046
  }
819
1047
  else {
820
1048
  return [2 /*return*/, (0, node_fetch_1.default)(this.buildFullUrl(endpoint), {
821
1049
  method: type_,
822
1050
  headers: __assign({ "Content-Type": "application/json" }, this.headers),
823
- body: JSON.stringify(form),
824
- }).then(function (d) { return d.json(); })];
1051
+ body: (0, class_transformer_1.serialize)(form),
1052
+ }).then(function (d) {
1053
+ return d
1054
+ .text()
1055
+ .then(function (a) { return (0, class_transformer_1.deserialize)(responseClass, a); });
1056
+ })];
825
1057
  }
826
1058
  return [2 /*return*/];
827
1059
  });
@@ -831,7 +1063,9 @@ var LemmyHttp = /** @class */ (function () {
831
1063
  }());
832
1064
  exports.LemmyHttp = LemmyHttp;
833
1065
  function encodeGetParams(p) {
834
- return Object.entries(p)
1066
+ // Necessary to remove the Options
1067
+ var serialized = JSON.parse((0, class_transformer_1.serialize)(p));
1068
+ return Object.entries(serialized)
835
1069
  .map(function (kv) { return kv.map(encodeURIComponent).join("="); })
836
1070
  .join("&");
837
1071
  }