lemmy-js-client 0.17.0-rc.17 → 0.17.0-rc.18

Sign up to get free protection for your applications and to get access to all the features.
package/dist/http.js CHANGED
@@ -1003,10 +1003,8 @@ var LemmyHttp = /** @class */ (function () {
1003
1003
  }());
1004
1004
  exports.LemmyHttp = LemmyHttp;
1005
1005
  function encodeGetParams(p) {
1006
- console.log(p);
1007
1006
  // Necessary to remove the Options
1008
1007
  var serialized = JSON.parse((0, class_transformer_1.serialize)(p));
1009
- console.log(serialized);
1010
1008
  return (Object.entries(serialized)
1011
1009
  // TODO test this, it might serialize the undefineds
1012
1010
  .map(function (kv) { return kv.map(encodeURIComponent).join("="); })
@@ -10,7 +10,7 @@ export declare class CreateComment {
10
10
  */
11
11
  form_id: Option<string>;
12
12
  auth: string;
13
- constructor(content: string, parent_id: Option<number>, post_id: number, form_id: Option<string>, auth: string);
13
+ constructor(init: CreateComment);
14
14
  }
15
15
  export declare class EditComment {
16
16
  content: string;
@@ -20,7 +20,7 @@ export declare class EditComment {
20
20
  */
21
21
  form_id: Option<string>;
22
22
  auth: string;
23
- constructor(content: string, comment_id: number, form_id: Option<string>, auth: string);
23
+ constructor(init: EditComment);
24
24
  }
25
25
  /**
26
26
  * Only the creator can delete the comment.
@@ -29,7 +29,7 @@ export declare class DeleteComment {
29
29
  comment_id: number;
30
30
  deleted: boolean;
31
31
  auth: string;
32
- constructor(comment_id: number, deleted: boolean, auth: string);
32
+ constructor(init: DeleteComment);
33
33
  }
34
34
  /**
35
35
  * Only a mod or admin can remove the comment.
@@ -39,7 +39,7 @@ export declare class RemoveComment {
39
39
  removed: boolean;
40
40
  reason: Option<string>;
41
41
  auth: string;
42
- constructor(comment_id: number, removed: boolean, reason: Option<string>, auth: string);
42
+ constructor(init: RemoveComment);
43
43
  }
44
44
  /**
45
45
  * Only the recipient can do this.
@@ -48,13 +48,13 @@ export declare class MarkCommentAsRead {
48
48
  comment_id: number;
49
49
  read: boolean;
50
50
  auth: string;
51
- constructor(comment_id: number, read: boolean, auth: string);
51
+ constructor(init: MarkCommentAsRead);
52
52
  }
53
53
  export declare class SaveComment {
54
54
  comment_id: number;
55
55
  save: boolean;
56
56
  auth: string;
57
- constructor(comment_id: number, save: boolean, auth: string);
57
+ constructor(init: SaveComment);
58
58
  }
59
59
  export declare class CommentResponse {
60
60
  comment_view: CommentView;
@@ -68,7 +68,7 @@ export declare class CreateCommentLike {
68
68
  comment_id: number;
69
69
  score: number;
70
70
  auth: string;
71
- constructor(comment_id: number, score: number, auth: string);
71
+ constructor(init: CreateCommentLike);
72
72
  }
73
73
  /**
74
74
  * Comment listing types are `All, Subscribed, Community`
@@ -85,7 +85,7 @@ export declare class GetComments {
85
85
  community_name: Option<string>;
86
86
  saved_only: Option<boolean>;
87
87
  auth: Option<string>;
88
- constructor(type_: Option<ListingType>, sort: Option<SortType>, page: Option<number>, limit: Option<number>, community_id: Option<number>, community_name: Option<string>, saved_only: Option<boolean>, auth: Option<string>);
88
+ constructor(init: GetComments);
89
89
  }
90
90
  export declare class GetCommentsResponse {
91
91
  comments: CommentView[];
@@ -94,7 +94,7 @@ export declare class CreateCommentReport {
94
94
  comment_id: number;
95
95
  reason: string;
96
96
  auth: string;
97
- constructor(comment_id: number, reason: string, auth: string);
97
+ constructor(init: CreateCommentReport);
98
98
  }
99
99
  export declare class CommentReportResponse {
100
100
  comment_report_view: CommentReportView;
@@ -106,7 +106,7 @@ export declare class ResolveCommentReport {
106
106
  */
107
107
  resolved: boolean;
108
108
  auth: string;
109
- constructor(report_id: number, resolved: boolean, auth: string);
109
+ constructor(init: ResolveCommentReport);
110
110
  }
111
111
  export declare class ListCommentReports {
112
112
  page: Option<number>;
@@ -120,7 +120,7 @@ export declare class ListCommentReports {
120
120
  */
121
121
  unresolved_only: Option<boolean>;
122
122
  auth: string;
123
- constructor(page: Option<number>, limit: Option<number>, community_id: Option<number>, unresolved_only: Option<boolean>, auth: string);
123
+ constructor(init: ListCommentReports);
124
124
  }
125
125
  export declare class ListCommentReportsResponse {
126
126
  comment_reports: CommentReportView[];
@@ -11,12 +11,8 @@ var monads_1 = require("@sniptt/monads");
11
11
  var class_transformer_1 = require("class-transformer");
12
12
  var utils_1 = require("../../utils");
13
13
  var CreateComment = /** @class */ (function () {
14
- function CreateComment(content, parent_id, post_id, form_id, auth) {
15
- this.content = content;
16
- this.parent_id = parent_id;
17
- this.post_id = post_id;
18
- this.form_id = form_id;
19
- this.auth = auth;
14
+ function CreateComment(init) {
15
+ Object.assign(this, init);
20
16
  }
21
17
  __decorate([
22
18
  (0, class_transformer_1.Transform)(function (_a) {
@@ -44,11 +40,8 @@ var CreateComment = /** @class */ (function () {
44
40
  }());
45
41
  exports.CreateComment = CreateComment;
46
42
  var EditComment = /** @class */ (function () {
47
- function EditComment(content, comment_id, form_id, auth) {
48
- this.content = content;
49
- this.comment_id = comment_id;
50
- this.form_id = form_id;
51
- this.auth = auth;
43
+ function EditComment(init) {
44
+ Object.assign(this, init);
52
45
  }
53
46
  __decorate([
54
47
  (0, class_transformer_1.Transform)(function (_a) {
@@ -68,10 +61,8 @@ exports.EditComment = EditComment;
68
61
  * Only the creator can delete the comment.
69
62
  */
70
63
  var DeleteComment = /** @class */ (function () {
71
- function DeleteComment(comment_id, deleted, auth) {
72
- this.comment_id = comment_id;
73
- this.deleted = deleted;
74
- this.auth = auth;
64
+ function DeleteComment(init) {
65
+ Object.assign(this, init);
75
66
  }
76
67
  return DeleteComment;
77
68
  }());
@@ -80,11 +71,8 @@ exports.DeleteComment = DeleteComment;
80
71
  * Only a mod or admin can remove the comment.
81
72
  */
82
73
  var RemoveComment = /** @class */ (function () {
83
- function RemoveComment(comment_id, removed, reason, auth) {
84
- this.comment_id = comment_id;
85
- this.removed = removed;
86
- this.reason = reason;
87
- this.auth = auth;
74
+ function RemoveComment(init) {
75
+ Object.assign(this, init);
88
76
  }
89
77
  __decorate([
90
78
  (0, class_transformer_1.Transform)(function (_a) {
@@ -104,19 +92,15 @@ exports.RemoveComment = RemoveComment;
104
92
  * Only the recipient can do this.
105
93
  */
106
94
  var MarkCommentAsRead = /** @class */ (function () {
107
- function MarkCommentAsRead(comment_id, read, auth) {
108
- this.comment_id = comment_id;
109
- this.read = read;
110
- this.auth = auth;
95
+ function MarkCommentAsRead(init) {
96
+ Object.assign(this, init);
111
97
  }
112
98
  return MarkCommentAsRead;
113
99
  }());
114
100
  exports.MarkCommentAsRead = MarkCommentAsRead;
115
101
  var SaveComment = /** @class */ (function () {
116
- function SaveComment(comment_id, save, auth) {
117
- this.comment_id = comment_id;
118
- this.save = save;
119
- this.auth = auth;
102
+ function SaveComment(init) {
103
+ Object.assign(this, init);
120
104
  }
121
105
  return SaveComment;
122
106
  }());
@@ -139,10 +123,8 @@ var CommentResponse = /** @class */ (function () {
139
123
  }());
140
124
  exports.CommentResponse = CommentResponse;
141
125
  var CreateCommentLike = /** @class */ (function () {
142
- function CreateCommentLike(comment_id, score, auth) {
143
- this.comment_id = comment_id;
144
- this.score = score;
145
- this.auth = auth;
126
+ function CreateCommentLike(init) {
127
+ Object.assign(this, init);
146
128
  }
147
129
  return CreateCommentLike;
148
130
  }());
@@ -154,15 +136,8 @@ exports.CreateCommentLike = CreateCommentLike;
154
136
  * To get posts for a federated community by name, use `name@instance.tld` .
155
137
  */
156
138
  var GetComments = /** @class */ (function () {
157
- function GetComments(type_, sort, page, limit, community_id, community_name, saved_only, auth) {
158
- this.type_ = type_;
159
- this.sort = sort;
160
- this.page = page;
161
- this.limit = limit;
162
- this.community_id = community_id;
163
- this.community_name = community_name;
164
- this.saved_only = saved_only;
165
- this.auth = auth;
139
+ function GetComments(init) {
140
+ Object.assign(this, init);
166
141
  }
167
142
  __decorate([
168
143
  (0, class_transformer_1.Transform)(function (_a) {
@@ -262,10 +237,8 @@ var GetCommentsResponse = /** @class */ (function () {
262
237
  }());
263
238
  exports.GetCommentsResponse = GetCommentsResponse;
264
239
  var CreateCommentReport = /** @class */ (function () {
265
- function CreateCommentReport(comment_id, reason, auth) {
266
- this.comment_id = comment_id;
267
- this.reason = reason;
268
- this.auth = auth;
240
+ function CreateCommentReport(init) {
241
+ Object.assign(this, init);
269
242
  }
270
243
  return CreateCommentReport;
271
244
  }());
@@ -277,21 +250,15 @@ var CommentReportResponse = /** @class */ (function () {
277
250
  }());
278
251
  exports.CommentReportResponse = CommentReportResponse;
279
252
  var ResolveCommentReport = /** @class */ (function () {
280
- function ResolveCommentReport(report_id, resolved, auth) {
281
- this.report_id = report_id;
282
- this.resolved = resolved;
283
- this.auth = auth;
253
+ function ResolveCommentReport(init) {
254
+ Object.assign(this, init);
284
255
  }
285
256
  return ResolveCommentReport;
286
257
  }());
287
258
  exports.ResolveCommentReport = ResolveCommentReport;
288
259
  var ListCommentReports = /** @class */ (function () {
289
- function ListCommentReports(page, limit, community_id, unresolved_only, auth) {
290
- this.page = page;
291
- this.limit = limit;
292
- this.community_id = community_id;
293
- this.unresolved_only = unresolved_only;
294
- this.auth = auth;
260
+ function ListCommentReports(init) {
261
+ Object.assign(this, init);
295
262
  }
296
263
  __decorate([
297
264
  (0, class_transformer_1.Transform)(function (_a) {
@@ -11,7 +11,7 @@ export declare class GetCommunity {
11
11
  id: Option<number>;
12
12
  name: Option<string>;
13
13
  auth: Option<string>;
14
- constructor(id: Option<number>, name: Option<string>, auth: Option<string>);
14
+ constructor(init: GetCommunity);
15
15
  }
16
16
  export declare class GetCommunityResponse {
17
17
  community_view: CommunityView;
@@ -28,7 +28,7 @@ export declare class CreateCommunity {
28
28
  nsfw: Option<boolean>;
29
29
  posting_restricted_to_mods: Option<boolean>;
30
30
  auth: string;
31
- constructor(name: string, title: string, description: Option<string>, icon: Option<string>, banner: Option<string>, nsfw: Option<boolean>, posting_restricted_to_mods: Option<boolean>, auth: string);
31
+ constructor(init: CreateCommunity);
32
32
  }
33
33
  export declare class CommunityResponse {
34
34
  community_view: CommunityView;
@@ -39,7 +39,7 @@ export declare class ListCommunities {
39
39
  page: Option<number>;
40
40
  limit: Option<number>;
41
41
  auth: Option<string>;
42
- constructor(type_: Option<ListingType>, sort: Option<SortType>, page: Option<number>, limit: Option<number>, auth: Option<string>);
42
+ constructor(init: ListCommunities);
43
43
  }
44
44
  export declare class ListCommunitiesResponse {
45
45
  communities: CommunityView[];
@@ -58,7 +58,7 @@ export declare class BanFromCommunity {
58
58
  */
59
59
  expires: Option<number>;
60
60
  auth: string;
61
- constructor(community_id: number, person_id: number, ban: boolean, remove_data: Option<boolean>, reason: Option<string>, expires: Option<number>, auth: string);
61
+ constructor(init: BanFromCommunity);
62
62
  }
63
63
  export declare class BanFromCommunityResponse {
64
64
  person_view: PersonViewSafe;
@@ -69,7 +69,7 @@ export declare class AddModToCommunity {
69
69
  person_id: number;
70
70
  added: boolean;
71
71
  auth: string;
72
- constructor(community_id: number, person_id: number, added: boolean, auth: string);
72
+ constructor(init: AddModToCommunity);
73
73
  }
74
74
  export declare class AddModToCommunityResponse {
75
75
  moderators: CommunityModeratorView[];
@@ -86,13 +86,13 @@ export declare class EditCommunity {
86
86
  nsfw: Option<boolean>;
87
87
  posting_restricted_to_mods: Option<boolean>;
88
88
  auth: string;
89
- constructor(community_id: number, title: Option<string>, description: Option<string>, icon: Option<string>, banner: Option<string>, nsfw: Option<boolean>, posting_restricted_to_mods: Option<boolean>, auth: string);
89
+ constructor(init: EditCommunity);
90
90
  }
91
91
  export declare class DeleteCommunity {
92
92
  community_id: number;
93
93
  deleted: boolean;
94
94
  auth: string;
95
- constructor(community_id: number, deleted: boolean, auth: string);
95
+ constructor(init: DeleteCommunity);
96
96
  }
97
97
  /**
98
98
  * Only admins can remove a community.
@@ -106,25 +106,25 @@ export declare class RemoveCommunity {
106
106
  */
107
107
  expires: Option<number>;
108
108
  auth: string;
109
- constructor(community_id: number, removed: boolean, reason: Option<string>, expires: Option<number>, auth: string);
109
+ constructor(init: RemoveCommunity);
110
110
  }
111
111
  export declare class FollowCommunity {
112
112
  community_id: number;
113
113
  follow: boolean;
114
114
  auth: string;
115
- constructor(community_id: number, follow: boolean, auth: string);
115
+ constructor(init: FollowCommunity);
116
116
  }
117
117
  export declare class TransferCommunity {
118
118
  community_id: number;
119
119
  person_id: number;
120
120
  auth: string;
121
- constructor(community_id: number, person_id: number, auth: string);
121
+ constructor(init: TransferCommunity);
122
122
  }
123
123
  export declare class BlockCommunity {
124
124
  community_id: number;
125
125
  block: boolean;
126
126
  auth: string;
127
- constructor(community_id: number, block: boolean, auth: string);
127
+ constructor(init: BlockCommunity);
128
128
  }
129
129
  export declare class BlockCommunityResponse {
130
130
  community_view: CommunityView;
@@ -16,10 +16,8 @@ var utils_1 = require("../../utils");
16
16
  * To get a federated community by name, use `name@instance.tld` .
17
17
  */
18
18
  var GetCommunity = /** @class */ (function () {
19
- function GetCommunity(id, name, auth) {
20
- this.id = id;
21
- this.name = name;
22
- this.auth = auth;
19
+ function GetCommunity(init) {
20
+ Object.assign(this, init);
23
21
  }
24
22
  __decorate([
25
23
  (0, class_transformer_1.Transform)(function (_a) {
@@ -75,15 +73,8 @@ var GetCommunityResponse = /** @class */ (function () {
75
73
  }());
76
74
  exports.GetCommunityResponse = GetCommunityResponse;
77
75
  var CreateCommunity = /** @class */ (function () {
78
- function CreateCommunity(name, title, description, icon, banner, nsfw, posting_restricted_to_mods, auth) {
79
- this.name = name;
80
- this.title = title;
81
- this.description = description;
82
- this.icon = icon;
83
- this.banner = banner;
84
- this.nsfw = nsfw;
85
- this.posting_restricted_to_mods = posting_restricted_to_mods;
86
- this.auth = auth;
76
+ function CreateCommunity(init) {
77
+ Object.assign(this, init);
87
78
  }
88
79
  __decorate([
89
80
  (0, class_transformer_1.Transform)(function (_a) {
@@ -150,12 +141,8 @@ var CommunityResponse = /** @class */ (function () {
150
141
  }());
151
142
  exports.CommunityResponse = CommunityResponse;
152
143
  var ListCommunities = /** @class */ (function () {
153
- function ListCommunities(type_, sort, page, limit, auth) {
154
- this.type_ = type_;
155
- this.sort = sort;
156
- this.page = page;
157
- this.limit = limit;
158
- this.auth = auth;
144
+ function ListCommunities(init) {
145
+ Object.assign(this, init);
159
146
  }
160
147
  __decorate([
161
148
  (0, class_transformer_1.Transform)(function (_a) {
@@ -222,14 +209,8 @@ var ListCommunitiesResponse = /** @class */ (function () {
222
209
  }());
223
210
  exports.ListCommunitiesResponse = ListCommunitiesResponse;
224
211
  var BanFromCommunity = /** @class */ (function () {
225
- function BanFromCommunity(community_id, person_id, ban, remove_data, reason, expires, auth) {
226
- this.community_id = community_id;
227
- this.person_id = person_id;
228
- this.ban = ban;
229
- this.remove_data = remove_data;
230
- this.reason = reason;
231
- this.expires = expires;
232
- this.auth = auth;
212
+ function BanFromCommunity(init) {
213
+ Object.assign(this, init);
233
214
  }
234
215
  __decorate([
235
216
  (0, class_transformer_1.Transform)(function (_a) {
@@ -274,11 +255,8 @@ var BanFromCommunityResponse = /** @class */ (function () {
274
255
  }());
275
256
  exports.BanFromCommunityResponse = BanFromCommunityResponse;
276
257
  var AddModToCommunity = /** @class */ (function () {
277
- function AddModToCommunity(community_id, person_id, added, auth) {
278
- this.community_id = community_id;
279
- this.person_id = person_id;
280
- this.added = added;
281
- this.auth = auth;
258
+ function AddModToCommunity(init) {
259
+ Object.assign(this, init);
282
260
  }
283
261
  return AddModToCommunity;
284
262
  }());
@@ -293,15 +271,8 @@ exports.AddModToCommunityResponse = AddModToCommunityResponse;
293
271
  * Only mods can edit a community.
294
272
  */
295
273
  var EditCommunity = /** @class */ (function () {
296
- function EditCommunity(community_id, title, description, icon, banner, nsfw, posting_restricted_to_mods, auth) {
297
- this.community_id = community_id;
298
- this.title = title;
299
- this.description = description;
300
- this.icon = icon;
301
- this.banner = banner;
302
- this.nsfw = nsfw;
303
- this.posting_restricted_to_mods = posting_restricted_to_mods;
304
- this.auth = auth;
274
+ function EditCommunity(init) {
275
+ Object.assign(this, init);
305
276
  }
306
277
  __decorate([
307
278
  (0, class_transformer_1.Transform)(function (_a) {
@@ -373,10 +344,8 @@ var EditCommunity = /** @class */ (function () {
373
344
  }());
374
345
  exports.EditCommunity = EditCommunity;
375
346
  var DeleteCommunity = /** @class */ (function () {
376
- function DeleteCommunity(community_id, deleted, auth) {
377
- this.community_id = community_id;
378
- this.deleted = deleted;
379
- this.auth = auth;
347
+ function DeleteCommunity(init) {
348
+ Object.assign(this, init);
380
349
  }
381
350
  return DeleteCommunity;
382
351
  }());
@@ -385,12 +354,8 @@ exports.DeleteCommunity = DeleteCommunity;
385
354
  * Only admins can remove a community.
386
355
  */
387
356
  var RemoveCommunity = /** @class */ (function () {
388
- function RemoveCommunity(community_id, removed, reason, expires, auth) {
389
- this.community_id = community_id;
390
- this.removed = removed;
391
- this.reason = reason;
392
- this.expires = expires;
393
- this.auth = auth;
357
+ function RemoveCommunity(init) {
358
+ Object.assign(this, init);
394
359
  }
395
360
  __decorate([
396
361
  (0, class_transformer_1.Transform)(function (_a) {
@@ -418,28 +383,22 @@ var RemoveCommunity = /** @class */ (function () {
418
383
  }());
419
384
  exports.RemoveCommunity = RemoveCommunity;
420
385
  var FollowCommunity = /** @class */ (function () {
421
- function FollowCommunity(community_id, follow, auth) {
422
- this.community_id = community_id;
423
- this.follow = follow;
424
- this.auth = auth;
386
+ function FollowCommunity(init) {
387
+ Object.assign(this, init);
425
388
  }
426
389
  return FollowCommunity;
427
390
  }());
428
391
  exports.FollowCommunity = FollowCommunity;
429
392
  var TransferCommunity = /** @class */ (function () {
430
- function TransferCommunity(community_id, person_id, auth) {
431
- this.community_id = community_id;
432
- this.person_id = person_id;
433
- this.auth = auth;
393
+ function TransferCommunity(init) {
394
+ Object.assign(this, init);
434
395
  }
435
396
  return TransferCommunity;
436
397
  }());
437
398
  exports.TransferCommunity = TransferCommunity;
438
399
  var BlockCommunity = /** @class */ (function () {
439
- function BlockCommunity(community_id, block, auth) {
440
- this.community_id = community_id;
441
- this.block = block;
442
- this.auth = auth;
400
+ function BlockCommunity(init) {
401
+ Object.assign(this, init);
443
402
  }
444
403
  return BlockCommunity;
445
404
  }());