lemmy-js-client 0.17.0-rc.3 → 0.17.0-rc.30
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/http.d.ts +156 -4
- package/dist/http.js +255 -80
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6 -1
- package/dist/interfaces/api/comment.d.ts +46 -38
- package/dist/interfaces/api/comment.js +326 -0
- package/dist/interfaces/api/community.d.ts +57 -55
- package/dist/interfaces/api/community.js +433 -0
- package/dist/interfaces/api/index.js +5 -1
- package/dist/interfaces/api/person.d.ts +121 -100
- package/dist/interfaces/api/person.js +894 -0
- package/dist/interfaces/api/post.d.ts +68 -51
- package/dist/interfaces/api/post.js +434 -0
- package/dist/interfaces/api/site.d.ts +100 -90
- package/dist/interfaces/api/site.js +893 -0
- package/dist/interfaces/index.js +5 -1
- package/dist/interfaces/others.d.ts +62 -92
- package/dist/interfaces/others.js +118 -55
- package/dist/interfaces/source.d.ts +79 -76
- package/dist/interfaces/source.js +746 -0
- package/dist/interfaces/views.d.ts +37 -37
- package/dist/interfaces/views.js +522 -0
- package/dist/utils.d.ts +9 -0
- package/dist/utils.js +18 -0
- package/dist/websocket.d.ts +13 -2
- package/dist/websocket.js +23 -5
- package/package.json +14 -11
package/dist/interfaces/views.js
CHANGED
@@ -1,2 +1,524 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
+
};
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
9
|
+
exports.RegistrationApplicationView = exports.CommunityView = exports.PersonBlockView = exports.CommunityPersonBanView = exports.CommunityModeratorView = exports.CommunityBlockView = exports.CommunityFollowerView = exports.ModStickyPostView = exports.ModRemovePostView = exports.ModRemoveCommunityView = exports.ModRemoveCommentView = exports.ModLockPostView = exports.ModBanView = exports.ModBanFromCommunityView = exports.ModAddView = exports.ModTransferCommunityView = exports.ModAddCommunityView = exports.CommentReportView = exports.CommentView = exports.PostReportView = exports.PostView = exports.PrivateMessageView = exports.SiteView = exports.LocalUserSettingsView = exports.PersonMentionView = exports.PersonViewSafe = void 0;
|
10
|
+
var class_transformer_1 = require("class-transformer");
|
11
|
+
require("reflect-metadata");
|
12
|
+
var utils_1 = require("../utils");
|
13
|
+
var source_1 = require("./source");
|
14
|
+
var PersonViewSafe = /** @class */ (function () {
|
15
|
+
function PersonViewSafe() {
|
16
|
+
}
|
17
|
+
__decorate([
|
18
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonSafe; })
|
19
|
+
], PersonViewSafe.prototype, "person", void 0);
|
20
|
+
return PersonViewSafe;
|
21
|
+
}());
|
22
|
+
exports.PersonViewSafe = PersonViewSafe;
|
23
|
+
var PersonMentionView = /** @class */ (function () {
|
24
|
+
function PersonMentionView() {
|
25
|
+
}
|
26
|
+
__decorate([
|
27
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonMention; })
|
28
|
+
], PersonMentionView.prototype, "person_mention", void 0);
|
29
|
+
__decorate([
|
30
|
+
(0, class_transformer_1.Type)(function () { return source_1.Comment; })
|
31
|
+
], PersonMentionView.prototype, "comment", void 0);
|
32
|
+
__decorate([
|
33
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonSafe; })
|
34
|
+
], PersonMentionView.prototype, "creator", void 0);
|
35
|
+
__decorate([
|
36
|
+
(0, class_transformer_1.Type)(function () { return source_1.Post; })
|
37
|
+
], PersonMentionView.prototype, "post", void 0);
|
38
|
+
__decorate([
|
39
|
+
(0, class_transformer_1.Type)(function () { return source_1.CommunitySafe; })
|
40
|
+
], PersonMentionView.prototype, "community", void 0);
|
41
|
+
__decorate([
|
42
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonSafe; })
|
43
|
+
], PersonMentionView.prototype, "recipient", void 0);
|
44
|
+
__decorate([
|
45
|
+
(0, class_transformer_1.Transform)(function (_a) {
|
46
|
+
var value = _a.value;
|
47
|
+
return (0, utils_1.toOption)(value);
|
48
|
+
}, { toClassOnly: true }),
|
49
|
+
(0, class_transformer_1.Transform)(function (_a) {
|
50
|
+
var value = _a.value;
|
51
|
+
return (0, utils_1.toUndefined)(value);
|
52
|
+
}, { toPlainOnly: true }),
|
53
|
+
(0, class_transformer_1.Expose)()
|
54
|
+
], PersonMentionView.prototype, "my_vote", void 0);
|
55
|
+
return PersonMentionView;
|
56
|
+
}());
|
57
|
+
exports.PersonMentionView = PersonMentionView;
|
58
|
+
var LocalUserSettingsView = /** @class */ (function () {
|
59
|
+
function LocalUserSettingsView() {
|
60
|
+
}
|
61
|
+
__decorate([
|
62
|
+
(0, class_transformer_1.Type)(function () { return source_1.LocalUserSettings; })
|
63
|
+
], LocalUserSettingsView.prototype, "local_user", void 0);
|
64
|
+
__decorate([
|
65
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonSafe; })
|
66
|
+
], LocalUserSettingsView.prototype, "person", void 0);
|
67
|
+
return LocalUserSettingsView;
|
68
|
+
}());
|
69
|
+
exports.LocalUserSettingsView = LocalUserSettingsView;
|
70
|
+
var SiteView = /** @class */ (function () {
|
71
|
+
function SiteView() {
|
72
|
+
}
|
73
|
+
__decorate([
|
74
|
+
(0, class_transformer_1.Type)(function () { return source_1.Site; })
|
75
|
+
], SiteView.prototype, "site", void 0);
|
76
|
+
return SiteView;
|
77
|
+
}());
|
78
|
+
exports.SiteView = SiteView;
|
79
|
+
var PrivateMessageView = /** @class */ (function () {
|
80
|
+
function PrivateMessageView() {
|
81
|
+
}
|
82
|
+
__decorate([
|
83
|
+
(0, class_transformer_1.Type)(function () { return source_1.PrivateMessage; })
|
84
|
+
], PrivateMessageView.prototype, "private_message", void 0);
|
85
|
+
__decorate([
|
86
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonSafe; })
|
87
|
+
], PrivateMessageView.prototype, "creator", void 0);
|
88
|
+
__decorate([
|
89
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonSafe; })
|
90
|
+
], PrivateMessageView.prototype, "recipient", void 0);
|
91
|
+
return PrivateMessageView;
|
92
|
+
}());
|
93
|
+
exports.PrivateMessageView = PrivateMessageView;
|
94
|
+
var PostView = /** @class */ (function () {
|
95
|
+
function PostView() {
|
96
|
+
}
|
97
|
+
__decorate([
|
98
|
+
(0, class_transformer_1.Type)(function () { return source_1.Post; })
|
99
|
+
], PostView.prototype, "post", void 0);
|
100
|
+
__decorate([
|
101
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonSafe; })
|
102
|
+
], PostView.prototype, "creator", void 0);
|
103
|
+
__decorate([
|
104
|
+
(0, class_transformer_1.Type)(function () { return source_1.CommunitySafe; })
|
105
|
+
], PostView.prototype, "community", void 0);
|
106
|
+
__decorate([
|
107
|
+
(0, class_transformer_1.Transform)(function (_a) {
|
108
|
+
var value = _a.value;
|
109
|
+
return (0, utils_1.toOption)(value);
|
110
|
+
}, { toClassOnly: true }),
|
111
|
+
(0, class_transformer_1.Transform)(function (_a) {
|
112
|
+
var value = _a.value;
|
113
|
+
return (0, utils_1.toUndefined)(value);
|
114
|
+
}, { toPlainOnly: true }),
|
115
|
+
(0, class_transformer_1.Expose)()
|
116
|
+
], PostView.prototype, "my_vote", void 0);
|
117
|
+
return PostView;
|
118
|
+
}());
|
119
|
+
exports.PostView = PostView;
|
120
|
+
var PostReportView = /** @class */ (function () {
|
121
|
+
function PostReportView() {
|
122
|
+
}
|
123
|
+
__decorate([
|
124
|
+
(0, class_transformer_1.Type)(function () { return source_1.PostReport; })
|
125
|
+
], PostReportView.prototype, "post_report", void 0);
|
126
|
+
__decorate([
|
127
|
+
(0, class_transformer_1.Type)(function () { return source_1.Post; })
|
128
|
+
], PostReportView.prototype, "post", void 0);
|
129
|
+
__decorate([
|
130
|
+
(0, class_transformer_1.Type)(function () { return source_1.CommunitySafe; })
|
131
|
+
], PostReportView.prototype, "community", void 0);
|
132
|
+
__decorate([
|
133
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonSafe; })
|
134
|
+
], PostReportView.prototype, "creator", void 0);
|
135
|
+
__decorate([
|
136
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonSafe; })
|
137
|
+
], PostReportView.prototype, "post_creator", void 0);
|
138
|
+
__decorate([
|
139
|
+
(0, class_transformer_1.Transform)(function (_a) {
|
140
|
+
var value = _a.value;
|
141
|
+
return (0, utils_1.toOption)(value);
|
142
|
+
}, { toClassOnly: true }),
|
143
|
+
(0, class_transformer_1.Transform)(function (_a) {
|
144
|
+
var value = _a.value;
|
145
|
+
return (0, utils_1.toUndefined)(value);
|
146
|
+
}, { toPlainOnly: true }),
|
147
|
+
(0, class_transformer_1.Expose)()
|
148
|
+
], PostReportView.prototype, "my_vote", void 0);
|
149
|
+
__decorate([
|
150
|
+
(0, class_transformer_1.Transform)(function (_a) {
|
151
|
+
var value = _a.value;
|
152
|
+
return (0, utils_1.toOption)(value);
|
153
|
+
}, { toClassOnly: true }),
|
154
|
+
(0, class_transformer_1.Transform)(function (_a) {
|
155
|
+
var value = _a.value;
|
156
|
+
return (0, utils_1.toUndefined)(value);
|
157
|
+
}, { toPlainOnly: true }),
|
158
|
+
(0, class_transformer_1.Expose)(),
|
159
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonSafe; })
|
160
|
+
], PostReportView.prototype, "resolver", void 0);
|
161
|
+
return PostReportView;
|
162
|
+
}());
|
163
|
+
exports.PostReportView = PostReportView;
|
164
|
+
var CommentView = /** @class */ (function () {
|
165
|
+
function CommentView() {
|
166
|
+
}
|
167
|
+
__decorate([
|
168
|
+
(0, class_transformer_1.Type)(function () { return source_1.Comment; })
|
169
|
+
], CommentView.prototype, "comment", void 0);
|
170
|
+
__decorate([
|
171
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonSafe; })
|
172
|
+
], CommentView.prototype, "creator", void 0);
|
173
|
+
__decorate([
|
174
|
+
(0, class_transformer_1.Transform)(function (_a) {
|
175
|
+
var value = _a.value;
|
176
|
+
return (0, utils_1.toOption)(value);
|
177
|
+
}, { toClassOnly: true }),
|
178
|
+
(0, class_transformer_1.Transform)(function (_a) {
|
179
|
+
var value = _a.value;
|
180
|
+
return (0, utils_1.toUndefined)(value);
|
181
|
+
}, { toPlainOnly: true }),
|
182
|
+
(0, class_transformer_1.Expose)(),
|
183
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonSafe; })
|
184
|
+
], CommentView.prototype, "recipient", void 0);
|
185
|
+
__decorate([
|
186
|
+
(0, class_transformer_1.Type)(function () { return source_1.Post; })
|
187
|
+
], CommentView.prototype, "post", void 0);
|
188
|
+
__decorate([
|
189
|
+
(0, class_transformer_1.Type)(function () { return source_1.CommunitySafe; })
|
190
|
+
], CommentView.prototype, "community", void 0);
|
191
|
+
__decorate([
|
192
|
+
(0, class_transformer_1.Transform)(function (_a) {
|
193
|
+
var value = _a.value;
|
194
|
+
return (0, utils_1.toOption)(value);
|
195
|
+
}, { toClassOnly: true }),
|
196
|
+
(0, class_transformer_1.Transform)(function (_a) {
|
197
|
+
var value = _a.value;
|
198
|
+
return (0, utils_1.toUndefined)(value);
|
199
|
+
}, { toPlainOnly: true }),
|
200
|
+
(0, class_transformer_1.Expose)()
|
201
|
+
], CommentView.prototype, "my_vote", void 0);
|
202
|
+
return CommentView;
|
203
|
+
}());
|
204
|
+
exports.CommentView = CommentView;
|
205
|
+
var CommentReportView = /** @class */ (function () {
|
206
|
+
function CommentReportView() {
|
207
|
+
}
|
208
|
+
__decorate([
|
209
|
+
(0, class_transformer_1.Type)(function () { return source_1.CommentReport; })
|
210
|
+
], CommentReportView.prototype, "comment_report", void 0);
|
211
|
+
__decorate([
|
212
|
+
(0, class_transformer_1.Type)(function () { return source_1.Comment; })
|
213
|
+
], CommentReportView.prototype, "comment", void 0);
|
214
|
+
__decorate([
|
215
|
+
(0, class_transformer_1.Type)(function () { return source_1.Post; })
|
216
|
+
], CommentReportView.prototype, "post", void 0);
|
217
|
+
__decorate([
|
218
|
+
(0, class_transformer_1.Type)(function () { return source_1.CommunitySafe; })
|
219
|
+
], CommentReportView.prototype, "community", void 0);
|
220
|
+
__decorate([
|
221
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonSafe; })
|
222
|
+
], CommentReportView.prototype, "creator", void 0);
|
223
|
+
__decorate([
|
224
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonSafe; })
|
225
|
+
], CommentReportView.prototype, "comment_creator", void 0);
|
226
|
+
__decorate([
|
227
|
+
(0, class_transformer_1.Transform)(function (_a) {
|
228
|
+
var value = _a.value;
|
229
|
+
return (0, utils_1.toOption)(value);
|
230
|
+
}, { toClassOnly: true }),
|
231
|
+
(0, class_transformer_1.Transform)(function (_a) {
|
232
|
+
var value = _a.value;
|
233
|
+
return (0, utils_1.toUndefined)(value);
|
234
|
+
}, { toPlainOnly: true }),
|
235
|
+
(0, class_transformer_1.Expose)()
|
236
|
+
], CommentReportView.prototype, "my_vote", void 0);
|
237
|
+
__decorate([
|
238
|
+
(0, class_transformer_1.Transform)(function (_a) {
|
239
|
+
var value = _a.value;
|
240
|
+
return (0, utils_1.toOption)(value);
|
241
|
+
}, { toClassOnly: true }),
|
242
|
+
(0, class_transformer_1.Transform)(function (_a) {
|
243
|
+
var value = _a.value;
|
244
|
+
return (0, utils_1.toUndefined)(value);
|
245
|
+
}, { toPlainOnly: true }),
|
246
|
+
(0, class_transformer_1.Expose)(),
|
247
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonSafe; })
|
248
|
+
], CommentReportView.prototype, "resolver", void 0);
|
249
|
+
return CommentReportView;
|
250
|
+
}());
|
251
|
+
exports.CommentReportView = CommentReportView;
|
252
|
+
var ModAddCommunityView = /** @class */ (function () {
|
253
|
+
function ModAddCommunityView() {
|
254
|
+
}
|
255
|
+
__decorate([
|
256
|
+
(0, class_transformer_1.Type)(function () { return source_1.ModAddCommunity; })
|
257
|
+
], ModAddCommunityView.prototype, "mod_add_community", void 0);
|
258
|
+
__decorate([
|
259
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonSafe; })
|
260
|
+
], ModAddCommunityView.prototype, "moderator", void 0);
|
261
|
+
__decorate([
|
262
|
+
(0, class_transformer_1.Type)(function () { return source_1.CommunitySafe; })
|
263
|
+
], ModAddCommunityView.prototype, "community", void 0);
|
264
|
+
__decorate([
|
265
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonSafe; })
|
266
|
+
], ModAddCommunityView.prototype, "modded_person", void 0);
|
267
|
+
return ModAddCommunityView;
|
268
|
+
}());
|
269
|
+
exports.ModAddCommunityView = ModAddCommunityView;
|
270
|
+
var ModTransferCommunityView = /** @class */ (function () {
|
271
|
+
function ModTransferCommunityView() {
|
272
|
+
}
|
273
|
+
__decorate([
|
274
|
+
(0, class_transformer_1.Type)(function () { return source_1.ModTransferCommunity; })
|
275
|
+
], ModTransferCommunityView.prototype, "mod_transfer_community", void 0);
|
276
|
+
__decorate([
|
277
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonSafe; })
|
278
|
+
], ModTransferCommunityView.prototype, "moderator", void 0);
|
279
|
+
__decorate([
|
280
|
+
(0, class_transformer_1.Type)(function () { return source_1.CommunitySafe; })
|
281
|
+
], ModTransferCommunityView.prototype, "community", void 0);
|
282
|
+
__decorate([
|
283
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonSafe; })
|
284
|
+
], ModTransferCommunityView.prototype, "modded_person", void 0);
|
285
|
+
return ModTransferCommunityView;
|
286
|
+
}());
|
287
|
+
exports.ModTransferCommunityView = ModTransferCommunityView;
|
288
|
+
var ModAddView = /** @class */ (function () {
|
289
|
+
function ModAddView() {
|
290
|
+
}
|
291
|
+
__decorate([
|
292
|
+
(0, class_transformer_1.Type)(function () { return source_1.ModAdd; })
|
293
|
+
], ModAddView.prototype, "mod_add", void 0);
|
294
|
+
__decorate([
|
295
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonSafe; })
|
296
|
+
], ModAddView.prototype, "moderator", void 0);
|
297
|
+
__decorate([
|
298
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonSafe; })
|
299
|
+
], ModAddView.prototype, "modded_person", void 0);
|
300
|
+
return ModAddView;
|
301
|
+
}());
|
302
|
+
exports.ModAddView = ModAddView;
|
303
|
+
var ModBanFromCommunityView = /** @class */ (function () {
|
304
|
+
function ModBanFromCommunityView() {
|
305
|
+
}
|
306
|
+
__decorate([
|
307
|
+
(0, class_transformer_1.Type)(function () { return source_1.ModBanFromCommunity; })
|
308
|
+
], ModBanFromCommunityView.prototype, "mod_ban_from_community", void 0);
|
309
|
+
__decorate([
|
310
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonSafe; })
|
311
|
+
], ModBanFromCommunityView.prototype, "moderator", void 0);
|
312
|
+
__decorate([
|
313
|
+
(0, class_transformer_1.Type)(function () { return source_1.CommunitySafe; })
|
314
|
+
], ModBanFromCommunityView.prototype, "community", void 0);
|
315
|
+
__decorate([
|
316
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonSafe; })
|
317
|
+
], ModBanFromCommunityView.prototype, "banned_person", void 0);
|
318
|
+
return ModBanFromCommunityView;
|
319
|
+
}());
|
320
|
+
exports.ModBanFromCommunityView = ModBanFromCommunityView;
|
321
|
+
var ModBanView = /** @class */ (function () {
|
322
|
+
function ModBanView() {
|
323
|
+
}
|
324
|
+
__decorate([
|
325
|
+
(0, class_transformer_1.Type)(function () { return source_1.ModBan; })
|
326
|
+
], ModBanView.prototype, "mod_ban", void 0);
|
327
|
+
__decorate([
|
328
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonSafe; })
|
329
|
+
], ModBanView.prototype, "moderator", void 0);
|
330
|
+
__decorate([
|
331
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonSafe; })
|
332
|
+
], ModBanView.prototype, "banned_person", void 0);
|
333
|
+
return ModBanView;
|
334
|
+
}());
|
335
|
+
exports.ModBanView = ModBanView;
|
336
|
+
var ModLockPostView = /** @class */ (function () {
|
337
|
+
function ModLockPostView() {
|
338
|
+
}
|
339
|
+
__decorate([
|
340
|
+
(0, class_transformer_1.Type)(function () { return source_1.ModLockPost; })
|
341
|
+
], ModLockPostView.prototype, "mod_lock_post", void 0);
|
342
|
+
__decorate([
|
343
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonSafe; })
|
344
|
+
], ModLockPostView.prototype, "moderator", void 0);
|
345
|
+
__decorate([
|
346
|
+
(0, class_transformer_1.Type)(function () { return source_1.Post; })
|
347
|
+
], ModLockPostView.prototype, "post", void 0);
|
348
|
+
__decorate([
|
349
|
+
(0, class_transformer_1.Type)(function () { return source_1.CommunitySafe; })
|
350
|
+
], ModLockPostView.prototype, "community", void 0);
|
351
|
+
return ModLockPostView;
|
352
|
+
}());
|
353
|
+
exports.ModLockPostView = ModLockPostView;
|
354
|
+
var ModRemoveCommentView = /** @class */ (function () {
|
355
|
+
function ModRemoveCommentView() {
|
356
|
+
}
|
357
|
+
__decorate([
|
358
|
+
(0, class_transformer_1.Type)(function () { return source_1.ModRemoveComment; })
|
359
|
+
], ModRemoveCommentView.prototype, "mod_remove_comment", void 0);
|
360
|
+
__decorate([
|
361
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonSafe; })
|
362
|
+
], ModRemoveCommentView.prototype, "moderator", void 0);
|
363
|
+
__decorate([
|
364
|
+
(0, class_transformer_1.Type)(function () { return source_1.Comment; })
|
365
|
+
], ModRemoveCommentView.prototype, "comment", void 0);
|
366
|
+
__decorate([
|
367
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonSafe; })
|
368
|
+
], ModRemoveCommentView.prototype, "commenter", void 0);
|
369
|
+
__decorate([
|
370
|
+
(0, class_transformer_1.Type)(function () { return source_1.Post; })
|
371
|
+
], ModRemoveCommentView.prototype, "post", void 0);
|
372
|
+
__decorate([
|
373
|
+
(0, class_transformer_1.Type)(function () { return source_1.CommunitySafe; })
|
374
|
+
], ModRemoveCommentView.prototype, "community", void 0);
|
375
|
+
return ModRemoveCommentView;
|
376
|
+
}());
|
377
|
+
exports.ModRemoveCommentView = ModRemoveCommentView;
|
378
|
+
var ModRemoveCommunityView = /** @class */ (function () {
|
379
|
+
function ModRemoveCommunityView() {
|
380
|
+
}
|
381
|
+
__decorate([
|
382
|
+
(0, class_transformer_1.Type)(function () { return source_1.ModRemoveCommunity; })
|
383
|
+
], ModRemoveCommunityView.prototype, "mod_remove_community", void 0);
|
384
|
+
__decorate([
|
385
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonSafe; })
|
386
|
+
], ModRemoveCommunityView.prototype, "moderator", void 0);
|
387
|
+
__decorate([
|
388
|
+
(0, class_transformer_1.Type)(function () { return source_1.CommunitySafe; })
|
389
|
+
], ModRemoveCommunityView.prototype, "community", void 0);
|
390
|
+
return ModRemoveCommunityView;
|
391
|
+
}());
|
392
|
+
exports.ModRemoveCommunityView = ModRemoveCommunityView;
|
393
|
+
var ModRemovePostView = /** @class */ (function () {
|
394
|
+
function ModRemovePostView() {
|
395
|
+
}
|
396
|
+
__decorate([
|
397
|
+
(0, class_transformer_1.Type)(function () { return source_1.ModRemovePost; })
|
398
|
+
], ModRemovePostView.prototype, "mod_remove_post", void 0);
|
399
|
+
__decorate([
|
400
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonSafe; })
|
401
|
+
], ModRemovePostView.prototype, "moderator", void 0);
|
402
|
+
__decorate([
|
403
|
+
(0, class_transformer_1.Type)(function () { return source_1.Post; })
|
404
|
+
], ModRemovePostView.prototype, "post", void 0);
|
405
|
+
__decorate([
|
406
|
+
(0, class_transformer_1.Type)(function () { return source_1.CommunitySafe; })
|
407
|
+
], ModRemovePostView.prototype, "community", void 0);
|
408
|
+
return ModRemovePostView;
|
409
|
+
}());
|
410
|
+
exports.ModRemovePostView = ModRemovePostView;
|
411
|
+
var ModStickyPostView = /** @class */ (function () {
|
412
|
+
function ModStickyPostView() {
|
413
|
+
}
|
414
|
+
__decorate([
|
415
|
+
(0, class_transformer_1.Type)(function () { return source_1.ModStickyPost; })
|
416
|
+
], ModStickyPostView.prototype, "mod_sticky_post", void 0);
|
417
|
+
__decorate([
|
418
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonSafe; })
|
419
|
+
], ModStickyPostView.prototype, "moderator", void 0);
|
420
|
+
__decorate([
|
421
|
+
(0, class_transformer_1.Type)(function () { return source_1.Post; })
|
422
|
+
], ModStickyPostView.prototype, "post", void 0);
|
423
|
+
__decorate([
|
424
|
+
(0, class_transformer_1.Type)(function () { return source_1.CommunitySafe; })
|
425
|
+
], ModStickyPostView.prototype, "community", void 0);
|
426
|
+
return ModStickyPostView;
|
427
|
+
}());
|
428
|
+
exports.ModStickyPostView = ModStickyPostView;
|
429
|
+
var CommunityFollowerView = /** @class */ (function () {
|
430
|
+
function CommunityFollowerView() {
|
431
|
+
}
|
432
|
+
__decorate([
|
433
|
+
(0, class_transformer_1.Type)(function () { return source_1.CommunitySafe; })
|
434
|
+
], CommunityFollowerView.prototype, "community", void 0);
|
435
|
+
__decorate([
|
436
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonSafe; })
|
437
|
+
], CommunityFollowerView.prototype, "follower", void 0);
|
438
|
+
return CommunityFollowerView;
|
439
|
+
}());
|
440
|
+
exports.CommunityFollowerView = CommunityFollowerView;
|
441
|
+
var CommunityBlockView = /** @class */ (function () {
|
442
|
+
function CommunityBlockView() {
|
443
|
+
}
|
444
|
+
__decorate([
|
445
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonSafe; })
|
446
|
+
], CommunityBlockView.prototype, "person", void 0);
|
447
|
+
__decorate([
|
448
|
+
(0, class_transformer_1.Type)(function () { return source_1.CommunitySafe; })
|
449
|
+
], CommunityBlockView.prototype, "community", void 0);
|
450
|
+
return CommunityBlockView;
|
451
|
+
}());
|
452
|
+
exports.CommunityBlockView = CommunityBlockView;
|
453
|
+
var CommunityModeratorView = /** @class */ (function () {
|
454
|
+
function CommunityModeratorView() {
|
455
|
+
}
|
456
|
+
__decorate([
|
457
|
+
(0, class_transformer_1.Type)(function () { return source_1.CommunitySafe; })
|
458
|
+
], CommunityModeratorView.prototype, "community", void 0);
|
459
|
+
__decorate([
|
460
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonSafe; })
|
461
|
+
], CommunityModeratorView.prototype, "moderator", void 0);
|
462
|
+
return CommunityModeratorView;
|
463
|
+
}());
|
464
|
+
exports.CommunityModeratorView = CommunityModeratorView;
|
465
|
+
var CommunityPersonBanView = /** @class */ (function () {
|
466
|
+
function CommunityPersonBanView() {
|
467
|
+
}
|
468
|
+
__decorate([
|
469
|
+
(0, class_transformer_1.Type)(function () { return source_1.CommunitySafe; })
|
470
|
+
], CommunityPersonBanView.prototype, "community", void 0);
|
471
|
+
__decorate([
|
472
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonSafe; })
|
473
|
+
], CommunityPersonBanView.prototype, "person", void 0);
|
474
|
+
return CommunityPersonBanView;
|
475
|
+
}());
|
476
|
+
exports.CommunityPersonBanView = CommunityPersonBanView;
|
477
|
+
var PersonBlockView = /** @class */ (function () {
|
478
|
+
function PersonBlockView() {
|
479
|
+
}
|
480
|
+
__decorate([
|
481
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonSafe; })
|
482
|
+
], PersonBlockView.prototype, "person", void 0);
|
483
|
+
__decorate([
|
484
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonSafe; })
|
485
|
+
], PersonBlockView.prototype, "target", void 0);
|
486
|
+
return PersonBlockView;
|
487
|
+
}());
|
488
|
+
exports.PersonBlockView = PersonBlockView;
|
489
|
+
var CommunityView = /** @class */ (function () {
|
490
|
+
function CommunityView() {
|
491
|
+
}
|
492
|
+
__decorate([
|
493
|
+
(0, class_transformer_1.Type)(function () { return source_1.CommunitySafe; })
|
494
|
+
], CommunityView.prototype, "community", void 0);
|
495
|
+
return CommunityView;
|
496
|
+
}());
|
497
|
+
exports.CommunityView = CommunityView;
|
498
|
+
var RegistrationApplicationView = /** @class */ (function () {
|
499
|
+
function RegistrationApplicationView() {
|
500
|
+
}
|
501
|
+
__decorate([
|
502
|
+
(0, class_transformer_1.Type)(function () { return source_1.RegistrationApplication; })
|
503
|
+
], RegistrationApplicationView.prototype, "registration_application", void 0);
|
504
|
+
__decorate([
|
505
|
+
(0, class_transformer_1.Type)(function () { return source_1.LocalUserSettings; })
|
506
|
+
], RegistrationApplicationView.prototype, "creator_local_user", void 0);
|
507
|
+
__decorate([
|
508
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonSafe; })
|
509
|
+
], RegistrationApplicationView.prototype, "creator", void 0);
|
510
|
+
__decorate([
|
511
|
+
(0, class_transformer_1.Transform)(function (_a) {
|
512
|
+
var value = _a.value;
|
513
|
+
return (0, utils_1.toOption)(value);
|
514
|
+
}, { toClassOnly: true }),
|
515
|
+
(0, class_transformer_1.Transform)(function (_a) {
|
516
|
+
var value = _a.value;
|
517
|
+
return (0, utils_1.toUndefined)(value);
|
518
|
+
}, { toPlainOnly: true }),
|
519
|
+
(0, class_transformer_1.Expose)(),
|
520
|
+
(0, class_transformer_1.Type)(function () { return source_1.PersonSafe; })
|
521
|
+
], RegistrationApplicationView.prototype, "admin", void 0);
|
522
|
+
return RegistrationApplicationView;
|
523
|
+
}());
|
524
|
+
exports.RegistrationApplicationView = RegistrationApplicationView;
|
package/dist/utils.d.ts
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
import { Option } from "@sniptt/monads";
|
2
|
+
/**
|
3
|
+
* Converts an option to an undefined. Necessary for API requests.
|
4
|
+
*/
|
5
|
+
export declare function toUndefined<T>(opt: Option<T>): T;
|
6
|
+
/**
|
7
|
+
* Converts a null value to an option.
|
8
|
+
*/
|
9
|
+
export declare function toOption<T>(val: T): Option<T>;
|
package/dist/utils.js
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.toOption = exports.toUndefined = void 0;
|
4
|
+
var monads_1 = require("@sniptt/monads");
|
5
|
+
/**
|
6
|
+
* Converts an option to an undefined. Necessary for API requests.
|
7
|
+
*/
|
8
|
+
function toUndefined(opt) {
|
9
|
+
return opt.isSome() ? opt.unwrap() : undefined;
|
10
|
+
}
|
11
|
+
exports.toUndefined = toUndefined;
|
12
|
+
/**
|
13
|
+
* Converts a null value to an option.
|
14
|
+
*/
|
15
|
+
function toOption(val) {
|
16
|
+
return (0, monads_1.Some)(val || undefined);
|
17
|
+
}
|
18
|
+
exports.toOption = toOption;
|
package/dist/websocket.d.ts
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
+
import { ClassConstructor } from "class-transformer";
|
1
2
|
import { CreateComment, CreateCommentLike, CreateCommentReport, DeleteComment, EditComment, GetComments, ListCommentReports, MarkCommentAsRead, RemoveComment, ResolveCommentReport, SaveComment } from "./interfaces/api/comment";
|
2
3
|
import { AddModToCommunity, BanFromCommunity, BlockCommunity, CreateCommunity, DeleteCommunity, EditCommunity, FollowCommunity, GetCommunity, ListCommunities, RemoveCommunity, TransferCommunity } from "./interfaces/api/community";
|
3
4
|
import { AddAdmin, BanPerson, BlockPerson, ChangePassword, CreatePrivateMessage, DeleteAccount, DeletePrivateMessage, EditPrivateMessage, GetBannedPersons, GetPersonDetails, GetPersonMentions, GetPrivateMessages, GetReplies, GetReportCount, GetUnreadCount, Login, MarkAllAsRead, MarkPersonMentionAsRead, MarkPrivateMessageAsRead, PasswordChange, PasswordReset, Register, SaveUserSettings, VerifyEmail } from "./interfaces/api/person";
|
4
|
-
import { CreatePost, CreatePostLike, CreatePostReport, DeletePost, EditPost, GetPost, GetPosts, GetSiteMetadata, ListPostReports, LockPost, RemovePost, ResolvePostReport, SavePost, StickyPost } from "./interfaces/api/post";
|
5
|
+
import { CreatePost, CreatePostLike, CreatePostReport, DeletePost, EditPost, GetPost, GetPosts, GetSiteMetadata, ListPostReports, LockPost, MarkPostAsRead, RemovePost, ResolvePostReport, SavePost, StickyPost } from "./interfaces/api/post";
|
5
6
|
import { ApproveRegistrationApplication, CreateSite, EditSite, GetModlog, GetSite, GetSiteConfig, GetUnreadRegistrationApplicationCount, LeaveAdmin, ListRegistrationApplications, ResolveObject, SaveSiteConfig, Search } from "./interfaces/api/site";
|
6
7
|
import { CommunityJoin, PostJoin, UserJoin } from "./interfaces/api/websocket";
|
8
|
+
import { UserOperation } from "./interfaces/others";
|
7
9
|
/**
|
8
10
|
* Helps build lemmy websocket message requests, that you can use in your Websocket sends.
|
9
11
|
*
|
@@ -153,6 +155,10 @@ export declare class LemmyWebsocket {
|
|
153
155
|
* A moderator can sticky a post ( IE stick it to the top of a community ).
|
154
156
|
*/
|
155
157
|
stickyPost(form: StickyPost): string;
|
158
|
+
/**
|
159
|
+
* Mark a post as read.
|
160
|
+
*/
|
161
|
+
markPostAsRead(form: MarkPostAsRead): string;
|
156
162
|
/**
|
157
163
|
* Save a post.
|
158
164
|
*/
|
@@ -244,7 +250,7 @@ export declare class LemmyWebsocket {
|
|
244
250
|
/**
|
245
251
|
* Gets the site, and your user data.
|
246
252
|
*/
|
247
|
-
getSite(form
|
253
|
+
getSite(form: GetSite): string;
|
248
254
|
/**
|
249
255
|
* Get your site configuration.
|
250
256
|
*/
|
@@ -326,3 +332,8 @@ export declare class LemmyWebsocket {
|
|
326
332
|
*/
|
327
333
|
blockCommunity(form: BlockCommunity): string;
|
328
334
|
}
|
335
|
+
export declare function wsUserOp(msg: any): UserOperation;
|
336
|
+
/**
|
337
|
+
* Converts a websocket string response to a usable result
|
338
|
+
*/
|
339
|
+
export declare function wsJsonToRes<ResponseType>(msg: any, responseClass: ClassConstructor<ResponseType>): ResponseType;
|
package/dist/websocket.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.LemmyWebsocket = void 0;
|
3
|
+
exports.wsJsonToRes = exports.wsUserOp = exports.LemmyWebsocket = void 0;
|
4
|
+
var class_transformer_1 = require("class-transformer");
|
4
5
|
var others_1 = require("./interfaces/others");
|
5
6
|
/**
|
6
7
|
* Helps build lemmy websocket message requests, that you can use in your Websocket sends.
|
@@ -218,6 +219,12 @@ var LemmyWebsocket = /** @class */ (function () {
|
|
218
219
|
LemmyWebsocket.prototype.stickyPost = function (form) {
|
219
220
|
return wrapper(others_1.UserOperation.StickyPost, form);
|
220
221
|
};
|
222
|
+
/**
|
223
|
+
* Mark a post as read.
|
224
|
+
*/
|
225
|
+
LemmyWebsocket.prototype.markPostAsRead = function (form) {
|
226
|
+
return wrapper(others_1.UserOperation.MarkPostAsRead, form);
|
227
|
+
};
|
221
228
|
/**
|
222
229
|
* Save a post.
|
223
230
|
*/
|
@@ -354,7 +361,6 @@ var LemmyWebsocket = /** @class */ (function () {
|
|
354
361
|
* Gets the site, and your user data.
|
355
362
|
*/
|
356
363
|
LemmyWebsocket.prototype.getSite = function (form) {
|
357
|
-
if (form === void 0) { form = {}; }
|
358
364
|
return wrapper(others_1.UserOperation.GetSite, form);
|
359
365
|
};
|
360
366
|
/**
|
@@ -481,7 +487,19 @@ var LemmyWebsocket = /** @class */ (function () {
|
|
481
487
|
}());
|
482
488
|
exports.LemmyWebsocket = LemmyWebsocket;
|
483
489
|
function wrapper(op, data) {
|
484
|
-
var send = { op: others_1.UserOperation[op], data: data };
|
485
|
-
|
486
|
-
|
490
|
+
var send = (0, class_transformer_1.serialize)({ op: others_1.UserOperation[op], data: data });
|
491
|
+
return send;
|
492
|
+
}
|
493
|
+
function wsUserOp(msg) {
|
494
|
+
var opStr = msg.op;
|
495
|
+
return others_1.UserOperation[opStr];
|
496
|
+
}
|
497
|
+
exports.wsUserOp = wsUserOp;
|
498
|
+
/**
|
499
|
+
* Converts a websocket string response to a usable result
|
500
|
+
*/
|
501
|
+
function wsJsonToRes(msg, responseClass) {
|
502
|
+
// Have to deserialize the response again into the correct class
|
503
|
+
return (0, class_transformer_1.deserialize)(responseClass, (0, class_transformer_1.serialize)(msg.data));
|
487
504
|
}
|
505
|
+
exports.wsJsonToRes = wsJsonToRes;
|