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