lemmy-js-client 0.17.0-rc.59 → 0.17.0-rc.60

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/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  export * from "./http";
2
2
  export * from "./interfaces";
3
- export * from "./utils";
4
3
  export * from "./websocket";
package/dist/index.js CHANGED
@@ -16,5 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./http"), exports);
18
18
  __exportStar(require("./interfaces"), exports);
19
- __exportStar(require("./utils"), exports);
20
19
  __exportStar(require("./websocket"), exports);
@@ -1,72 +1,64 @@
1
- import { Option } from "@sniptt/monads";
2
- import "reflect-metadata";
3
1
  import { CommentSortType, ListingType } from "../others";
4
2
  import { CommentReportView, CommentView } from "../views";
5
- export declare class CreateComment {
3
+ export interface CreateComment {
6
4
  content: string;
7
- parent_id: Option<number>;
8
- language_id: Option<number>;
5
+ parent_id?: number;
6
+ language_id?: number;
9
7
  post_id: number;
10
8
  /**
11
9
  * An optional front end ID, to tell which is comment is coming back.
12
10
  */
13
- form_id: Option<string>;
11
+ form_id?: string;
14
12
  auth: string;
15
- constructor(init: CreateComment);
16
13
  }
17
- export declare class EditComment {
14
+ export interface EditComment {
18
15
  comment_id: number;
19
- content: Option<string>;
16
+ content?: string;
20
17
  /**
21
18
  * "Distinguishes" a comment, or speak officially. Only doable by community mods or admins.
22
19
  */
23
- distinguished: Option<boolean>;
24
- language_id: Option<number>;
20
+ distinguished?: boolean;
21
+ language_id?: number;
25
22
  /**
26
23
  * An optional front end ID, to tell which is comment is coming back.
27
24
  */
28
- form_id: Option<string>;
25
+ form_id?: string;
29
26
  auth: string;
30
- constructor(init: EditComment);
31
27
  }
32
28
  /**
33
29
  * Only the creator can delete the comment.
34
30
  */
35
- export declare class DeleteComment {
31
+ export interface DeleteComment {
36
32
  comment_id: number;
37
33
  deleted: boolean;
38
34
  auth: string;
39
- constructor(init: DeleteComment);
40
35
  }
41
36
  /**
42
37
  * Only a mod or admin can remove the comment.
43
38
  */
44
- export declare class RemoveComment {
39
+ export interface RemoveComment {
45
40
  comment_id: number;
46
41
  removed: boolean;
47
- reason: Option<string>;
42
+ reason?: string;
48
43
  auth: string;
49
- constructor(init: RemoveComment);
50
44
  }
51
- export declare class SaveComment {
45
+ export interface SaveComment {
52
46
  comment_id: number;
53
47
  save: boolean;
54
48
  auth: string;
55
- constructor(init: SaveComment);
56
49
  }
57
- export declare class CommentResponse {
50
+ export interface CommentResponse {
58
51
  comment_view: CommentView;
59
52
  recipient_ids: number[];
60
53
  /**
61
54
  * An optional front end ID, to tell which is comment is coming back.
62
55
  */
63
- form_id: Option<string>;
56
+ form_id?: string;
64
57
  }
65
- export declare class CreateCommentLike {
58
+ export interface CreateCommentLike {
66
59
  comment_id: number;
67
60
  score: number;
68
61
  auth: string;
69
- constructor(init: CreateCommentLike);
70
62
  }
71
63
  /**
72
64
  * Comment listing types are `All, Subscribed, Community`
@@ -74,55 +66,51 @@ export declare class CreateCommentLike {
74
66
  * You can use either `community_id` or `community_name` as an id.
75
67
  * To get posts for a federated community by name, use `name@instance.tld` .
76
68
  */
77
- export declare class GetComments {
78
- type_: Option<ListingType>;
79
- sort: Option<CommentSortType>;
80
- max_depth: Option<number>;
81
- page: Option<number>;
82
- limit: Option<number>;
83
- community_id: Option<number>;
84
- community_name: Option<string>;
85
- post_id: Option<number>;
86
- parent_id: Option<number>;
87
- saved_only: Option<boolean>;
88
- auth: Option<string>;
89
- constructor(init: GetComments);
69
+ export interface GetComments {
70
+ type_?: ListingType;
71
+ sort?: CommentSortType;
72
+ max_depth?: number;
73
+ page?: number;
74
+ limit?: number;
75
+ community_id?: number;
76
+ community_name?: string;
77
+ post_id?: number;
78
+ parent_id?: number;
79
+ saved_only?: boolean;
80
+ auth?: string;
90
81
  }
91
- export declare class GetCommentsResponse {
82
+ export interface GetCommentsResponse {
92
83
  comments: CommentView[];
93
84
  }
94
- export declare class CreateCommentReport {
85
+ export interface CreateCommentReport {
95
86
  comment_id: number;
96
87
  reason: string;
97
88
  auth: string;
98
- constructor(init: CreateCommentReport);
99
89
  }
100
- export declare class CommentReportResponse {
90
+ export interface CommentReportResponse {
101
91
  comment_report_view: CommentReportView;
102
92
  }
103
- export declare class ResolveCommentReport {
93
+ export interface ResolveCommentReport {
104
94
  report_id: number;
105
95
  /**
106
96
  * Either resolve or unresolve a report.
107
97
  */
108
98
  resolved: boolean;
109
99
  auth: string;
110
- constructor(init: ResolveCommentReport);
111
100
  }
112
- export declare class ListCommentReports {
113
- page: Option<number>;
114
- limit: Option<number>;
101
+ export interface ListCommentReports {
102
+ page?: number;
103
+ limit?: number;
115
104
  /**
116
105
  * if no community is given, it returns reports for all communities moderated by the auth user.
117
106
  */
118
- community_id: Option<number>;
107
+ community_id?: number;
119
108
  /**
120
109
  * Only shows the unresolved reports.
121
110
  */
122
- unresolved_only: Option<boolean>;
111
+ unresolved_only?: boolean;
123
112
  auth: string;
124
- constructor(init: ListCommentReports);
125
113
  }
126
- export declare class ListCommentReportsResponse {
114
+ export interface ListCommentReportsResponse {
127
115
  comment_reports: CommentReportView[];
128
116
  }
@@ -1,395 +1,2 @@
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
- };
8
2
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.ListCommentReportsResponse = exports.ListCommentReports = exports.ResolveCommentReport = exports.CommentReportResponse = exports.CreateCommentReport = exports.GetCommentsResponse = exports.GetComments = exports.CreateCommentLike = exports.CommentResponse = exports.SaveComment = exports.RemoveComment = exports.DeleteComment = exports.EditComment = exports.CreateComment = void 0;
10
- var class_transformer_1 = require("class-transformer");
11
- require("reflect-metadata");
12
- var utils_1 = require("../../utils");
13
- var views_1 = require("../views");
14
- var CreateComment = /** @class */ (function () {
15
- function CreateComment(init) {
16
- Object.assign(this, init);
17
- }
18
- __decorate([
19
- (0, class_transformer_1.Transform)(function (_a) {
20
- var value = _a.value;
21
- return (0, utils_1.toOption)(value);
22
- }, { toClassOnly: true }),
23
- (0, class_transformer_1.Transform)(function (_a) {
24
- var value = _a.value;
25
- return (0, utils_1.toUndefined)(value);
26
- }, { toPlainOnly: true }),
27
- (0, class_transformer_1.Expose)()
28
- ], CreateComment.prototype, "parent_id", void 0);
29
- __decorate([
30
- (0, class_transformer_1.Transform)(function (_a) {
31
- var value = _a.value;
32
- return (0, utils_1.toOption)(value);
33
- }, { toClassOnly: true }),
34
- (0, class_transformer_1.Transform)(function (_a) {
35
- var value = _a.value;
36
- return (0, utils_1.toUndefined)(value);
37
- }, { toPlainOnly: true }),
38
- (0, class_transformer_1.Expose)()
39
- ], CreateComment.prototype, "language_id", void 0);
40
- __decorate([
41
- (0, class_transformer_1.Transform)(function (_a) {
42
- var value = _a.value;
43
- return (0, utils_1.toOption)(value);
44
- }, { toClassOnly: true }),
45
- (0, class_transformer_1.Transform)(function (_a) {
46
- var value = _a.value;
47
- return (0, utils_1.toUndefined)(value);
48
- }, { toPlainOnly: true }),
49
- (0, class_transformer_1.Expose)()
50
- ], CreateComment.prototype, "form_id", void 0);
51
- return CreateComment;
52
- }());
53
- exports.CreateComment = CreateComment;
54
- var EditComment = /** @class */ (function () {
55
- function EditComment(init) {
56
- Object.assign(this, init);
57
- }
58
- __decorate([
59
- (0, class_transformer_1.Transform)(function (_a) {
60
- var value = _a.value;
61
- return (0, utils_1.toOption)(value);
62
- }, { toClassOnly: true }),
63
- (0, class_transformer_1.Transform)(function (_a) {
64
- var value = _a.value;
65
- return (0, utils_1.toUndefined)(value);
66
- }, { toPlainOnly: true }),
67
- (0, class_transformer_1.Expose)()
68
- ], EditComment.prototype, "content", void 0);
69
- __decorate([
70
- (0, class_transformer_1.Transform)(function (_a) {
71
- var value = _a.value;
72
- return (0, utils_1.toOption)(value);
73
- }, { toClassOnly: true }),
74
- (0, class_transformer_1.Transform)(function (_a) {
75
- var value = _a.value;
76
- return (0, utils_1.toUndefined)(value);
77
- }, { toPlainOnly: true }),
78
- (0, class_transformer_1.Expose)()
79
- ], EditComment.prototype, "distinguished", void 0);
80
- __decorate([
81
- (0, class_transformer_1.Transform)(function (_a) {
82
- var value = _a.value;
83
- return (0, utils_1.toOption)(value);
84
- }, { toClassOnly: true }),
85
- (0, class_transformer_1.Transform)(function (_a) {
86
- var value = _a.value;
87
- return (0, utils_1.toUndefined)(value);
88
- }, { toPlainOnly: true }),
89
- (0, class_transformer_1.Expose)()
90
- ], EditComment.prototype, "language_id", void 0);
91
- __decorate([
92
- (0, class_transformer_1.Transform)(function (_a) {
93
- var value = _a.value;
94
- return (0, utils_1.toOption)(value);
95
- }, { toClassOnly: true }),
96
- (0, class_transformer_1.Transform)(function (_a) {
97
- var value = _a.value;
98
- return (0, utils_1.toUndefined)(value);
99
- }, { toPlainOnly: true }),
100
- (0, class_transformer_1.Expose)()
101
- ], EditComment.prototype, "form_id", void 0);
102
- return EditComment;
103
- }());
104
- exports.EditComment = EditComment;
105
- /**
106
- * Only the creator can delete the comment.
107
- */
108
- var DeleteComment = /** @class */ (function () {
109
- function DeleteComment(init) {
110
- Object.assign(this, init);
111
- }
112
- return DeleteComment;
113
- }());
114
- exports.DeleteComment = DeleteComment;
115
- /**
116
- * Only a mod or admin can remove the comment.
117
- */
118
- var RemoveComment = /** @class */ (function () {
119
- function RemoveComment(init) {
120
- Object.assign(this, init);
121
- }
122
- __decorate([
123
- (0, class_transformer_1.Transform)(function (_a) {
124
- var value = _a.value;
125
- return (0, utils_1.toOption)(value);
126
- }, { toClassOnly: true }),
127
- (0, class_transformer_1.Transform)(function (_a) {
128
- var value = _a.value;
129
- return (0, utils_1.toUndefined)(value);
130
- }, { toPlainOnly: true }),
131
- (0, class_transformer_1.Expose)()
132
- ], RemoveComment.prototype, "reason", void 0);
133
- return RemoveComment;
134
- }());
135
- exports.RemoveComment = RemoveComment;
136
- var SaveComment = /** @class */ (function () {
137
- function SaveComment(init) {
138
- Object.assign(this, init);
139
- }
140
- return SaveComment;
141
- }());
142
- exports.SaveComment = SaveComment;
143
- var CommentResponse = /** @class */ (function () {
144
- function CommentResponse() {
145
- }
146
- __decorate([
147
- (0, class_transformer_1.Type)(function () { return views_1.CommentView; })
148
- ], CommentResponse.prototype, "comment_view", 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
- ], CommentResponse.prototype, "form_id", void 0);
160
- return CommentResponse;
161
- }());
162
- exports.CommentResponse = CommentResponse;
163
- var CreateCommentLike = /** @class */ (function () {
164
- function CreateCommentLike(init) {
165
- Object.assign(this, init);
166
- }
167
- return CreateCommentLike;
168
- }());
169
- exports.CreateCommentLike = CreateCommentLike;
170
- /**
171
- * Comment listing types are `All, Subscribed, Community`
172
- *
173
- * You can use either `community_id` or `community_name` as an id.
174
- * To get posts for a federated community by name, use `name@instance.tld` .
175
- */
176
- var GetComments = /** @class */ (function () {
177
- function GetComments(init) {
178
- Object.assign(this, init);
179
- }
180
- __decorate([
181
- (0, class_transformer_1.Transform)(function (_a) {
182
- var value = _a.value;
183
- return (0, utils_1.toOption)(value);
184
- }, { toClassOnly: true }),
185
- (0, class_transformer_1.Transform)(function (_a) {
186
- var value = _a.value;
187
- return (0, utils_1.toUndefined)(value);
188
- }, { toPlainOnly: true }),
189
- (0, class_transformer_1.Expose)()
190
- ], GetComments.prototype, "type_", 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
- ], GetComments.prototype, "sort", void 0);
202
- __decorate([
203
- (0, class_transformer_1.Transform)(function (_a) {
204
- var value = _a.value;
205
- return (0, utils_1.toOption)(value);
206
- }, { toClassOnly: true }),
207
- (0, class_transformer_1.Transform)(function (_a) {
208
- var value = _a.value;
209
- return (0, utils_1.toUndefined)(value);
210
- }, { toPlainOnly: true }),
211
- (0, class_transformer_1.Expose)()
212
- ], GetComments.prototype, "max_depth", void 0);
213
- __decorate([
214
- (0, class_transformer_1.Transform)(function (_a) {
215
- var value = _a.value;
216
- return (0, utils_1.toOption)(value);
217
- }, { toClassOnly: true }),
218
- (0, class_transformer_1.Transform)(function (_a) {
219
- var value = _a.value;
220
- return (0, utils_1.toUndefined)(value);
221
- }, { toPlainOnly: true }),
222
- (0, class_transformer_1.Expose)()
223
- ], GetComments.prototype, "page", void 0);
224
- __decorate([
225
- (0, class_transformer_1.Transform)(function (_a) {
226
- var value = _a.value;
227
- return (0, utils_1.toOption)(value);
228
- }, { toClassOnly: true }),
229
- (0, class_transformer_1.Transform)(function (_a) {
230
- var value = _a.value;
231
- return (0, utils_1.toUndefined)(value);
232
- }, { toPlainOnly: true }),
233
- (0, class_transformer_1.Expose)()
234
- ], GetComments.prototype, "limit", void 0);
235
- __decorate([
236
- (0, class_transformer_1.Transform)(function (_a) {
237
- var value = _a.value;
238
- return (0, utils_1.toOption)(value);
239
- }, { toClassOnly: true }),
240
- (0, class_transformer_1.Transform)(function (_a) {
241
- var value = _a.value;
242
- return (0, utils_1.toUndefined)(value);
243
- }, { toPlainOnly: true }),
244
- (0, class_transformer_1.Expose)()
245
- ], GetComments.prototype, "community_id", void 0);
246
- __decorate([
247
- (0, class_transformer_1.Transform)(function (_a) {
248
- var value = _a.value;
249
- return (0, utils_1.toOption)(value);
250
- }, { toClassOnly: true }),
251
- (0, class_transformer_1.Transform)(function (_a) {
252
- var value = _a.value;
253
- return (0, utils_1.toUndefined)(value);
254
- }, { toPlainOnly: true }),
255
- (0, class_transformer_1.Expose)()
256
- ], GetComments.prototype, "community_name", void 0);
257
- __decorate([
258
- (0, class_transformer_1.Transform)(function (_a) {
259
- var value = _a.value;
260
- return (0, utils_1.toOption)(value);
261
- }, { toClassOnly: true }),
262
- (0, class_transformer_1.Transform)(function (_a) {
263
- var value = _a.value;
264
- return (0, utils_1.toUndefined)(value);
265
- }, { toPlainOnly: true }),
266
- (0, class_transformer_1.Expose)()
267
- ], GetComments.prototype, "post_id", void 0);
268
- __decorate([
269
- (0, class_transformer_1.Transform)(function (_a) {
270
- var value = _a.value;
271
- return (0, utils_1.toOption)(value);
272
- }, { toClassOnly: true }),
273
- (0, class_transformer_1.Transform)(function (_a) {
274
- var value = _a.value;
275
- return (0, utils_1.toUndefined)(value);
276
- }, { toPlainOnly: true }),
277
- (0, class_transformer_1.Expose)()
278
- ], GetComments.prototype, "parent_id", void 0);
279
- __decorate([
280
- (0, class_transformer_1.Transform)(function (_a) {
281
- var value = _a.value;
282
- return (0, utils_1.toOption)(value);
283
- }, { toClassOnly: true }),
284
- (0, class_transformer_1.Transform)(function (_a) {
285
- var value = _a.value;
286
- return (0, utils_1.toUndefined)(value);
287
- }, { toPlainOnly: true }),
288
- (0, class_transformer_1.Expose)()
289
- ], GetComments.prototype, "saved_only", void 0);
290
- __decorate([
291
- (0, class_transformer_1.Transform)(function (_a) {
292
- var value = _a.value;
293
- return (0, utils_1.toOption)(value);
294
- }, { toClassOnly: true }),
295
- (0, class_transformer_1.Transform)(function (_a) {
296
- var value = _a.value;
297
- return (0, utils_1.toUndefined)(value);
298
- }, { toPlainOnly: true }),
299
- (0, class_transformer_1.Expose)()
300
- ], GetComments.prototype, "auth", void 0);
301
- return GetComments;
302
- }());
303
- exports.GetComments = GetComments;
304
- var GetCommentsResponse = /** @class */ (function () {
305
- function GetCommentsResponse() {
306
- }
307
- __decorate([
308
- (0, class_transformer_1.Type)(function () { return views_1.CommentView; })
309
- ], GetCommentsResponse.prototype, "comments", void 0);
310
- return GetCommentsResponse;
311
- }());
312
- exports.GetCommentsResponse = GetCommentsResponse;
313
- var CreateCommentReport = /** @class */ (function () {
314
- function CreateCommentReport(init) {
315
- Object.assign(this, init);
316
- }
317
- return CreateCommentReport;
318
- }());
319
- exports.CreateCommentReport = CreateCommentReport;
320
- var CommentReportResponse = /** @class */ (function () {
321
- function CommentReportResponse() {
322
- }
323
- __decorate([
324
- (0, class_transformer_1.Type)(function () { return views_1.CommentReportView; })
325
- ], CommentReportResponse.prototype, "comment_report_view", void 0);
326
- return CommentReportResponse;
327
- }());
328
- exports.CommentReportResponse = CommentReportResponse;
329
- var ResolveCommentReport = /** @class */ (function () {
330
- function ResolveCommentReport(init) {
331
- Object.assign(this, init);
332
- }
333
- return ResolveCommentReport;
334
- }());
335
- exports.ResolveCommentReport = ResolveCommentReport;
336
- var ListCommentReports = /** @class */ (function () {
337
- function ListCommentReports(init) {
338
- Object.assign(this, init);
339
- }
340
- __decorate([
341
- (0, class_transformer_1.Transform)(function (_a) {
342
- var value = _a.value;
343
- return (0, utils_1.toOption)(value);
344
- }, { toClassOnly: true }),
345
- (0, class_transformer_1.Transform)(function (_a) {
346
- var value = _a.value;
347
- return (0, utils_1.toUndefined)(value);
348
- }, { toPlainOnly: true }),
349
- (0, class_transformer_1.Expose)()
350
- ], ListCommentReports.prototype, "page", void 0);
351
- __decorate([
352
- (0, class_transformer_1.Transform)(function (_a) {
353
- var value = _a.value;
354
- return (0, utils_1.toOption)(value);
355
- }, { toClassOnly: true }),
356
- (0, class_transformer_1.Transform)(function (_a) {
357
- var value = _a.value;
358
- return (0, utils_1.toUndefined)(value);
359
- }, { toPlainOnly: true }),
360
- (0, class_transformer_1.Expose)()
361
- ], ListCommentReports.prototype, "limit", void 0);
362
- __decorate([
363
- (0, class_transformer_1.Transform)(function (_a) {
364
- var value = _a.value;
365
- return (0, utils_1.toOption)(value);
366
- }, { toClassOnly: true }),
367
- (0, class_transformer_1.Transform)(function (_a) {
368
- var value = _a.value;
369
- return (0, utils_1.toUndefined)(value);
370
- }, { toPlainOnly: true }),
371
- (0, class_transformer_1.Expose)()
372
- ], ListCommentReports.prototype, "community_id", void 0);
373
- __decorate([
374
- (0, class_transformer_1.Transform)(function (_a) {
375
- var value = _a.value;
376
- return (0, utils_1.toOption)(value);
377
- }, { toClassOnly: true }),
378
- (0, class_transformer_1.Transform)(function (_a) {
379
- var value = _a.value;
380
- return (0, utils_1.toUndefined)(value);
381
- }, { toPlainOnly: true }),
382
- (0, class_transformer_1.Expose)()
383
- ], ListCommentReports.prototype, "unresolved_only", void 0);
384
- return ListCommentReports;
385
- }());
386
- exports.ListCommentReports = ListCommentReports;
387
- var ListCommentReportsResponse = /** @class */ (function () {
388
- function ListCommentReportsResponse() {
389
- }
390
- __decorate([
391
- (0, class_transformer_1.Type)(function () { return views_1.CommentReportView; })
392
- ], ListCommentReportsResponse.prototype, "comment_reports", void 0);
393
- return ListCommentReportsResponse;
394
- }());
395
- exports.ListCommentReportsResponse = ListCommentReportsResponse;