lemmy-js-client 0.17.0-rc.3 → 0.17.0-rc.32

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from "./http";
2
2
  export * from "./interfaces";
3
+ export * from "./utils";
3
4
  export * from "./websocket";
package/dist/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -12,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
12
16
  Object.defineProperty(exports, "__esModule", { value: true });
13
17
  __exportStar(require("./http"), exports);
14
18
  __exportStar(require("./interfaces"), exports);
19
+ __exportStar(require("./utils"), exports);
15
20
  __exportStar(require("./websocket"), exports);
@@ -1,65 +1,75 @@
1
+ import { Option } from "@sniptt/monads";
2
+ import "reflect-metadata";
3
+ import { ListingType, SortType } from "../others";
1
4
  import { CommentReportView, CommentView } from "../views";
2
- export interface CreateComment {
5
+ export declare class CreateComment {
3
6
  content: string;
4
- parent_id?: number;
7
+ parent_id: Option<number>;
5
8
  post_id: number;
6
9
  /**
7
10
  * An optional front end ID, to tell which is comment is coming back.
8
11
  */
9
- form_id?: string;
12
+ form_id: Option<string>;
10
13
  auth: string;
14
+ constructor(init: CreateComment);
11
15
  }
12
- export interface EditComment {
16
+ export declare class EditComment {
13
17
  content: string;
14
18
  comment_id: number;
15
19
  /**
16
20
  * An optional front end ID, to tell which is comment is coming back.
17
21
  */
18
- form_id?: string;
22
+ form_id: Option<string>;
19
23
  auth: string;
24
+ constructor(init: EditComment);
20
25
  }
21
26
  /**
22
27
  * Only the creator can delete the comment.
23
28
  */
24
- export interface DeleteComment {
29
+ export declare class DeleteComment {
25
30
  comment_id: number;
26
31
  deleted: boolean;
27
32
  auth: string;
33
+ constructor(init: DeleteComment);
28
34
  }
29
35
  /**
30
36
  * Only a mod or admin can remove the comment.
31
37
  */
32
- export interface RemoveComment {
38
+ export declare class RemoveComment {
33
39
  comment_id: number;
34
40
  removed: boolean;
35
- reason?: string;
41
+ reason: Option<string>;
36
42
  auth: string;
43
+ constructor(init: RemoveComment);
37
44
  }
38
45
  /**
39
46
  * Only the recipient can do this.
40
47
  */
41
- export interface MarkCommentAsRead {
48
+ export declare class MarkCommentAsRead {
42
49
  comment_id: number;
43
50
  read: boolean;
44
51
  auth: string;
52
+ constructor(init: MarkCommentAsRead);
45
53
  }
46
- export interface SaveComment {
54
+ export declare class SaveComment {
47
55
  comment_id: number;
48
56
  save: boolean;
49
57
  auth: string;
58
+ constructor(init: SaveComment);
50
59
  }
51
- export interface CommentResponse {
60
+ export declare class CommentResponse {
52
61
  comment_view: CommentView;
53
62
  recipient_ids: number[];
54
63
  /**
55
64
  * An optional front end ID, to tell which is comment is coming back.
56
65
  */
57
- form_id?: string;
66
+ form_id: Option<string>;
58
67
  }
59
- export interface CreateCommentLike {
68
+ export declare class CreateCommentLike {
60
69
  comment_id: number;
61
70
  score: number;
62
71
  auth: string;
72
+ constructor(init: CreateCommentLike);
63
73
  }
64
74
  /**
65
75
  * Comment listing types are `All, Subscribed, Community`
@@ -67,54 +77,52 @@ export interface CreateCommentLike {
67
77
  * You can use either `community_id` or `community_name` as an id.
68
78
  * To get posts for a federated community by name, use `name@instance.tld` .
69
79
  */
70
- export interface GetComments {
71
- /**
72
- * The [[ListingType]].
73
- */
74
- type_?: string;
75
- /**
76
- * The [[SortType]].
77
- */
78
- sort?: string;
79
- page?: number;
80
- limit?: number;
81
- community_id?: number;
82
- community_name?: string;
83
- saved_only?: boolean;
84
- auth?: string;
80
+ export declare class GetComments {
81
+ type_: Option<ListingType>;
82
+ sort: Option<SortType>;
83
+ page: Option<number>;
84
+ limit: Option<number>;
85
+ community_id: Option<number>;
86
+ community_name: Option<string>;
87
+ saved_only: Option<boolean>;
88
+ auth: Option<string>;
89
+ constructor(init: GetComments);
85
90
  }
86
- export interface GetCommentsResponse {
91
+ export declare class GetCommentsResponse {
87
92
  comments: CommentView[];
88
93
  }
89
- export interface CreateCommentReport {
94
+ export declare class CreateCommentReport {
90
95
  comment_id: number;
91
96
  reason: string;
92
97
  auth: string;
98
+ constructor(init: CreateCommentReport);
93
99
  }
94
- export interface CommentReportResponse {
100
+ export declare class CommentReportResponse {
95
101
  comment_report_view: CommentReportView;
96
102
  }
97
- export interface ResolveCommentReport {
103
+ export declare class ResolveCommentReport {
98
104
  report_id: number;
99
105
  /**
100
106
  * Either resolve or unresolve a report.
101
107
  */
102
108
  resolved: boolean;
103
109
  auth: string;
110
+ constructor(init: ResolveCommentReport);
104
111
  }
105
- export interface ListCommentReports {
106
- page?: number;
107
- limit?: number;
112
+ export declare class ListCommentReports {
113
+ page: Option<number>;
114
+ limit: Option<number>;
108
115
  /**
109
116
  * if no community is given, it returns reports for all communities moderated by the auth user.
110
117
  */
111
- community_id?: number;
118
+ community_id: Option<number>;
112
119
  /**
113
120
  * Only shows the unresolved reports.
114
121
  */
115
- unresolved_only?: boolean;
122
+ unresolved_only: Option<boolean>;
116
123
  auth: string;
124
+ constructor(init: ListCommentReports);
117
125
  }
118
- export interface ListCommentReportsResponse {
126
+ export declare class ListCommentReportsResponse {
119
127
  comment_reports: CommentReportView[];
120
128
  }
@@ -1,2 +1,328 @@
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.ListCommentReportsResponse = exports.ListCommentReports = exports.ResolveCommentReport = exports.CommentReportResponse = exports.CreateCommentReport = exports.GetCommentsResponse = exports.GetComments = exports.CreateCommentLike = exports.CommentResponse = exports.SaveComment = exports.MarkCommentAsRead = 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, "form_id", void 0);
40
+ return CreateComment;
41
+ }());
42
+ exports.CreateComment = CreateComment;
43
+ var EditComment = /** @class */ (function () {
44
+ function EditComment(init) {
45
+ Object.assign(this, init);
46
+ }
47
+ __decorate([
48
+ (0, class_transformer_1.Transform)(function (_a) {
49
+ var value = _a.value;
50
+ return (0, utils_1.toOption)(value);
51
+ }, { toClassOnly: true }),
52
+ (0, class_transformer_1.Transform)(function (_a) {
53
+ var value = _a.value;
54
+ return (0, utils_1.toUndefined)(value);
55
+ }, { toPlainOnly: true }),
56
+ (0, class_transformer_1.Expose)()
57
+ ], EditComment.prototype, "form_id", void 0);
58
+ return EditComment;
59
+ }());
60
+ exports.EditComment = EditComment;
61
+ /**
62
+ * Only the creator can delete the comment.
63
+ */
64
+ var DeleteComment = /** @class */ (function () {
65
+ function DeleteComment(init) {
66
+ Object.assign(this, init);
67
+ }
68
+ return DeleteComment;
69
+ }());
70
+ exports.DeleteComment = DeleteComment;
71
+ /**
72
+ * Only a mod or admin can remove the comment.
73
+ */
74
+ var RemoveComment = /** @class */ (function () {
75
+ function RemoveComment(init) {
76
+ Object.assign(this, init);
77
+ }
78
+ __decorate([
79
+ (0, class_transformer_1.Transform)(function (_a) {
80
+ var value = _a.value;
81
+ return (0, utils_1.toOption)(value);
82
+ }, { toClassOnly: true }),
83
+ (0, class_transformer_1.Transform)(function (_a) {
84
+ var value = _a.value;
85
+ return (0, utils_1.toUndefined)(value);
86
+ }, { toPlainOnly: true }),
87
+ (0, class_transformer_1.Expose)()
88
+ ], RemoveComment.prototype, "reason", void 0);
89
+ return RemoveComment;
90
+ }());
91
+ exports.RemoveComment = RemoveComment;
92
+ /**
93
+ * Only the recipient can do this.
94
+ */
95
+ var MarkCommentAsRead = /** @class */ (function () {
96
+ function MarkCommentAsRead(init) {
97
+ Object.assign(this, init);
98
+ }
99
+ return MarkCommentAsRead;
100
+ }());
101
+ exports.MarkCommentAsRead = MarkCommentAsRead;
102
+ var SaveComment = /** @class */ (function () {
103
+ function SaveComment(init) {
104
+ Object.assign(this, init);
105
+ }
106
+ return SaveComment;
107
+ }());
108
+ exports.SaveComment = SaveComment;
109
+ var CommentResponse = /** @class */ (function () {
110
+ function CommentResponse() {
111
+ }
112
+ __decorate([
113
+ (0, class_transformer_1.Type)(function () { return views_1.CommentView; })
114
+ ], CommentResponse.prototype, "comment_view", void 0);
115
+ __decorate([
116
+ (0, class_transformer_1.Transform)(function (_a) {
117
+ var value = _a.value;
118
+ return (0, utils_1.toOption)(value);
119
+ }, { toClassOnly: true }),
120
+ (0, class_transformer_1.Transform)(function (_a) {
121
+ var value = _a.value;
122
+ return (0, utils_1.toUndefined)(value);
123
+ }, { toPlainOnly: true }),
124
+ (0, class_transformer_1.Expose)()
125
+ ], CommentResponse.prototype, "form_id", void 0);
126
+ return CommentResponse;
127
+ }());
128
+ exports.CommentResponse = CommentResponse;
129
+ var CreateCommentLike = /** @class */ (function () {
130
+ function CreateCommentLike(init) {
131
+ Object.assign(this, init);
132
+ }
133
+ return CreateCommentLike;
134
+ }());
135
+ exports.CreateCommentLike = CreateCommentLike;
136
+ /**
137
+ * Comment listing types are `All, Subscribed, Community`
138
+ *
139
+ * You can use either `community_id` or `community_name` as an id.
140
+ * To get posts for a federated community by name, use `name@instance.tld` .
141
+ */
142
+ var GetComments = /** @class */ (function () {
143
+ function GetComments(init) {
144
+ Object.assign(this, init);
145
+ }
146
+ __decorate([
147
+ (0, class_transformer_1.Transform)(function (_a) {
148
+ var value = _a.value;
149
+ return (0, utils_1.toOption)(value);
150
+ }, { toClassOnly: true }),
151
+ (0, class_transformer_1.Transform)(function (_a) {
152
+ var value = _a.value;
153
+ return (0, utils_1.toUndefined)(value);
154
+ }, { toPlainOnly: true }),
155
+ (0, class_transformer_1.Expose)()
156
+ ], GetComments.prototype, "type_", void 0);
157
+ __decorate([
158
+ (0, class_transformer_1.Transform)(function (_a) {
159
+ var value = _a.value;
160
+ return (0, utils_1.toOption)(value);
161
+ }, { toClassOnly: true }),
162
+ (0, class_transformer_1.Transform)(function (_a) {
163
+ var value = _a.value;
164
+ return (0, utils_1.toUndefined)(value);
165
+ }, { toPlainOnly: true }),
166
+ (0, class_transformer_1.Expose)()
167
+ ], GetComments.prototype, "sort", void 0);
168
+ __decorate([
169
+ (0, class_transformer_1.Transform)(function (_a) {
170
+ var value = _a.value;
171
+ return (0, utils_1.toOption)(value);
172
+ }, { toClassOnly: true }),
173
+ (0, class_transformer_1.Transform)(function (_a) {
174
+ var value = _a.value;
175
+ return (0, utils_1.toUndefined)(value);
176
+ }, { toPlainOnly: true }),
177
+ (0, class_transformer_1.Expose)()
178
+ ], GetComments.prototype, "page", void 0);
179
+ __decorate([
180
+ (0, class_transformer_1.Transform)(function (_a) {
181
+ var value = _a.value;
182
+ return (0, utils_1.toOption)(value);
183
+ }, { toClassOnly: true }),
184
+ (0, class_transformer_1.Transform)(function (_a) {
185
+ var value = _a.value;
186
+ return (0, utils_1.toUndefined)(value);
187
+ }, { toPlainOnly: true }),
188
+ (0, class_transformer_1.Expose)()
189
+ ], GetComments.prototype, "limit", void 0);
190
+ __decorate([
191
+ (0, class_transformer_1.Transform)(function (_a) {
192
+ var value = _a.value;
193
+ return (0, utils_1.toOption)(value);
194
+ }, { toClassOnly: true }),
195
+ (0, class_transformer_1.Transform)(function (_a) {
196
+ var value = _a.value;
197
+ return (0, utils_1.toUndefined)(value);
198
+ }, { toPlainOnly: true }),
199
+ (0, class_transformer_1.Expose)()
200
+ ], GetComments.prototype, "community_id", void 0);
201
+ __decorate([
202
+ (0, class_transformer_1.Transform)(function (_a) {
203
+ var value = _a.value;
204
+ return (0, utils_1.toOption)(value);
205
+ }, { toClassOnly: true }),
206
+ (0, class_transformer_1.Transform)(function (_a) {
207
+ var value = _a.value;
208
+ return (0, utils_1.toUndefined)(value);
209
+ }, { toPlainOnly: true }),
210
+ (0, class_transformer_1.Expose)()
211
+ ], GetComments.prototype, "community_name", void 0);
212
+ __decorate([
213
+ (0, class_transformer_1.Transform)(function (_a) {
214
+ var value = _a.value;
215
+ return (0, utils_1.toOption)(value);
216
+ }, { toClassOnly: true }),
217
+ (0, class_transformer_1.Transform)(function (_a) {
218
+ var value = _a.value;
219
+ return (0, utils_1.toUndefined)(value);
220
+ }, { toPlainOnly: true }),
221
+ (0, class_transformer_1.Expose)()
222
+ ], GetComments.prototype, "saved_only", void 0);
223
+ __decorate([
224
+ (0, class_transformer_1.Transform)(function (_a) {
225
+ var value = _a.value;
226
+ return (0, utils_1.toOption)(value);
227
+ }, { toClassOnly: true }),
228
+ (0, class_transformer_1.Transform)(function (_a) {
229
+ var value = _a.value;
230
+ return (0, utils_1.toUndefined)(value);
231
+ }, { toPlainOnly: true }),
232
+ (0, class_transformer_1.Expose)()
233
+ ], GetComments.prototype, "auth", void 0);
234
+ return GetComments;
235
+ }());
236
+ exports.GetComments = GetComments;
237
+ var GetCommentsResponse = /** @class */ (function () {
238
+ function GetCommentsResponse() {
239
+ }
240
+ __decorate([
241
+ (0, class_transformer_1.Type)(function () { return views_1.CommentView; })
242
+ ], GetCommentsResponse.prototype, "comments", void 0);
243
+ return GetCommentsResponse;
244
+ }());
245
+ exports.GetCommentsResponse = GetCommentsResponse;
246
+ var CreateCommentReport = /** @class */ (function () {
247
+ function CreateCommentReport(init) {
248
+ Object.assign(this, init);
249
+ }
250
+ return CreateCommentReport;
251
+ }());
252
+ exports.CreateCommentReport = CreateCommentReport;
253
+ var CommentReportResponse = /** @class */ (function () {
254
+ function CommentReportResponse() {
255
+ }
256
+ __decorate([
257
+ (0, class_transformer_1.Type)(function () { return views_1.CommentReportView; })
258
+ ], CommentReportResponse.prototype, "comment_report_view", void 0);
259
+ return CommentReportResponse;
260
+ }());
261
+ exports.CommentReportResponse = CommentReportResponse;
262
+ var ResolveCommentReport = /** @class */ (function () {
263
+ function ResolveCommentReport(init) {
264
+ Object.assign(this, init);
265
+ }
266
+ return ResolveCommentReport;
267
+ }());
268
+ exports.ResolveCommentReport = ResolveCommentReport;
269
+ var ListCommentReports = /** @class */ (function () {
270
+ function ListCommentReports(init) {
271
+ Object.assign(this, init);
272
+ }
273
+ __decorate([
274
+ (0, class_transformer_1.Transform)(function (_a) {
275
+ var value = _a.value;
276
+ return (0, utils_1.toOption)(value);
277
+ }, { toClassOnly: true }),
278
+ (0, class_transformer_1.Transform)(function (_a) {
279
+ var value = _a.value;
280
+ return (0, utils_1.toUndefined)(value);
281
+ }, { toPlainOnly: true }),
282
+ (0, class_transformer_1.Expose)()
283
+ ], ListCommentReports.prototype, "page", void 0);
284
+ __decorate([
285
+ (0, class_transformer_1.Transform)(function (_a) {
286
+ var value = _a.value;
287
+ return (0, utils_1.toOption)(value);
288
+ }, { toClassOnly: true }),
289
+ (0, class_transformer_1.Transform)(function (_a) {
290
+ var value = _a.value;
291
+ return (0, utils_1.toUndefined)(value);
292
+ }, { toPlainOnly: true }),
293
+ (0, class_transformer_1.Expose)()
294
+ ], ListCommentReports.prototype, "limit", void 0);
295
+ __decorate([
296
+ (0, class_transformer_1.Transform)(function (_a) {
297
+ var value = _a.value;
298
+ return (0, utils_1.toOption)(value);
299
+ }, { toClassOnly: true }),
300
+ (0, class_transformer_1.Transform)(function (_a) {
301
+ var value = _a.value;
302
+ return (0, utils_1.toUndefined)(value);
303
+ }, { toPlainOnly: true }),
304
+ (0, class_transformer_1.Expose)()
305
+ ], ListCommentReports.prototype, "community_id", void 0);
306
+ __decorate([
307
+ (0, class_transformer_1.Transform)(function (_a) {
308
+ var value = _a.value;
309
+ return (0, utils_1.toOption)(value);
310
+ }, { toClassOnly: true }),
311
+ (0, class_transformer_1.Transform)(function (_a) {
312
+ var value = _a.value;
313
+ return (0, utils_1.toUndefined)(value);
314
+ }, { toPlainOnly: true }),
315
+ (0, class_transformer_1.Expose)()
316
+ ], ListCommentReports.prototype, "unresolved_only", void 0);
317
+ return ListCommentReports;
318
+ }());
319
+ exports.ListCommentReports = ListCommentReports;
320
+ var ListCommentReportsResponse = /** @class */ (function () {
321
+ function ListCommentReportsResponse() {
322
+ }
323
+ __decorate([
324
+ (0, class_transformer_1.Type)(function () { return views_1.CommentReportView; })
325
+ ], ListCommentReportsResponse.prototype, "comment_reports", void 0);
326
+ return ListCommentReportsResponse;
327
+ }());
328
+ exports.ListCommentReportsResponse = ListCommentReportsResponse;