lemmy-js-client 0.17.0-rc.9 → 0.17.2-rc.2
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/README.md +23 -4
- package/dist/http.d.ts +198 -16
- package/dist/http.js +245 -26
- package/dist/index.js +5 -1
- package/dist/interfaces/aggregates.d.ts +3 -0
- package/dist/interfaces/api/comment.d.ts +12 -11
- package/dist/interfaces/api/community.d.ts +5 -0
- package/dist/interfaces/api/index.js +5 -1
- package/dist/interfaces/api/person.d.ts +40 -6
- package/dist/interfaces/api/post.d.ts +19 -8
- package/dist/interfaces/api/site.d.ts +96 -21
- package/dist/interfaces/index.js +5 -1
- package/dist/interfaces/others.d.ts +122 -85
- package/dist/interfaces/others.js +133 -59
- package/dist/interfaces/source.d.ts +124 -16
- package/dist/interfaces/source.js +7 -0
- package/dist/interfaces/views.d.ts +66 -18
- package/dist/utils.d.ts +0 -0
- package/dist/utils.js +0 -0
- package/dist/websocket.d.ts +44 -14
- package/dist/websocket.js +67 -19
- package/package.json +26 -24
@@ -6,15 +6,17 @@ export interface LocalUserSettings {
|
|
6
6
|
theme: string;
|
7
7
|
default_sort_type: number;
|
8
8
|
default_listing_type: number;
|
9
|
-
|
9
|
+
interface_language: string;
|
10
10
|
show_avatars: boolean;
|
11
11
|
send_notifications_to_email: boolean;
|
12
|
+
validator_time: string;
|
12
13
|
show_bot_accounts: boolean;
|
13
14
|
show_scores: boolean;
|
14
15
|
show_read_posts: boolean;
|
15
16
|
show_new_post_notifs: boolean;
|
16
17
|
email_verified: boolean;
|
17
18
|
accepted_application: boolean;
|
19
|
+
totp_url?: string;
|
18
20
|
}
|
19
21
|
export interface PersonSafe {
|
20
22
|
id: number;
|
@@ -30,11 +32,12 @@ export interface PersonSafe {
|
|
30
32
|
banner?: string;
|
31
33
|
deleted: boolean;
|
32
34
|
inbox_url: string;
|
33
|
-
shared_inbox_url
|
35
|
+
shared_inbox_url?: string;
|
34
36
|
matrix_user_id?: string;
|
35
37
|
admin: boolean;
|
36
38
|
bot_account: boolean;
|
37
39
|
ban_expires?: string;
|
40
|
+
instance_id: number;
|
38
41
|
}
|
39
42
|
export interface Site {
|
40
43
|
id: number;
|
@@ -42,22 +45,65 @@ export interface Site {
|
|
42
45
|
sidebar?: string;
|
43
46
|
published: string;
|
44
47
|
updated?: string;
|
45
|
-
enable_downvotes: boolean;
|
46
|
-
open_registration: boolean;
|
47
|
-
enable_nsfw: boolean;
|
48
48
|
icon?: string;
|
49
49
|
banner?: string;
|
50
50
|
description?: string;
|
51
|
+
actor_id: string;
|
52
|
+
last_refreshed_at: string;
|
53
|
+
inbox_url: string;
|
54
|
+
private_key?: string;
|
55
|
+
public_key: string;
|
56
|
+
instance_id: number;
|
57
|
+
}
|
58
|
+
export declare enum RegistrationMode {
|
59
|
+
Closed = "closed",
|
60
|
+
RequireApplication = "requireapplication",
|
61
|
+
Open = "open"
|
62
|
+
}
|
63
|
+
export interface LocalSite {
|
64
|
+
id: number;
|
65
|
+
site_id: number;
|
66
|
+
site_setup: boolean;
|
67
|
+
enable_downvotes: boolean;
|
68
|
+
registration_mode: RegistrationMode;
|
69
|
+
enable_nsfw: boolean;
|
51
70
|
community_creation_admin_only: boolean;
|
52
71
|
require_email_verification: boolean;
|
53
|
-
require_application: boolean;
|
54
72
|
application_question?: string;
|
55
73
|
private_instance: boolean;
|
56
74
|
default_theme: string;
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
75
|
+
default_post_listing_type: string;
|
76
|
+
legal_information?: string;
|
77
|
+
hide_modlog_mod_names: boolean;
|
78
|
+
application_email_admins: boolean;
|
79
|
+
reports_email_admins: boolean;
|
80
|
+
slur_filter_regex?: string;
|
81
|
+
actor_name_max_length: number;
|
82
|
+
federation_enabled: boolean;
|
83
|
+
federation_debug: boolean;
|
84
|
+
federation_worker_count: number;
|
85
|
+
captcha_enabled: boolean;
|
86
|
+
captcha_difficulty: string;
|
87
|
+
published: string;
|
88
|
+
updated?: string;
|
89
|
+
}
|
90
|
+
export interface LocalSiteRateLimit {
|
91
|
+
id: number;
|
92
|
+
local_site_id: number;
|
93
|
+
message: number;
|
94
|
+
message_per_second: number;
|
95
|
+
post: number;
|
96
|
+
post_per_second: number;
|
97
|
+
register: number;
|
98
|
+
register_per_second: number;
|
99
|
+
image: number;
|
100
|
+
image_per_second: number;
|
101
|
+
comment: number;
|
102
|
+
comment_per_second: number;
|
103
|
+
search: number;
|
104
|
+
search_per_second: number;
|
105
|
+
published: string;
|
106
|
+
updated?: string;
|
61
107
|
}
|
62
108
|
export interface PrivateMessage {
|
63
109
|
id: number;
|
@@ -97,13 +143,15 @@ export interface Post {
|
|
97
143
|
updated?: string;
|
98
144
|
deleted: boolean;
|
99
145
|
nsfw: boolean;
|
100
|
-
stickied: boolean;
|
101
146
|
embed_title?: string;
|
102
147
|
embed_description?: string;
|
103
|
-
|
148
|
+
embed_video_url?: string;
|
104
149
|
thumbnail_url?: string;
|
105
150
|
ap_id: string;
|
106
151
|
local: boolean;
|
152
|
+
language_id: number;
|
153
|
+
featured_community: boolean;
|
154
|
+
featured_local: boolean;
|
107
155
|
}
|
108
156
|
export interface PasswordResetRequest {
|
109
157
|
id: number;
|
@@ -126,11 +174,12 @@ export interface ModLockPost {
|
|
126
174
|
locked?: boolean;
|
127
175
|
when_: string;
|
128
176
|
}
|
129
|
-
export interface
|
177
|
+
export interface ModFeaturePost {
|
130
178
|
id: number;
|
131
179
|
mod_person_id: number;
|
132
180
|
post_id: number;
|
133
|
-
|
181
|
+
featured: boolean;
|
182
|
+
is_featured_community: boolean;
|
134
183
|
when_: string;
|
135
184
|
}
|
136
185
|
export interface ModRemoveComment {
|
@@ -192,6 +241,32 @@ export interface ModAdd {
|
|
192
241
|
removed?: boolean;
|
193
242
|
when_: string;
|
194
243
|
}
|
244
|
+
export interface AdminPurgePerson {
|
245
|
+
id: number;
|
246
|
+
admin_person_id: number;
|
247
|
+
reason?: string;
|
248
|
+
when_: string;
|
249
|
+
}
|
250
|
+
export interface AdminPurgeCommunity {
|
251
|
+
id: number;
|
252
|
+
admin_person_id: number;
|
253
|
+
reason?: string;
|
254
|
+
when_: string;
|
255
|
+
}
|
256
|
+
export interface AdminPurgePost {
|
257
|
+
id: number;
|
258
|
+
admin_person_id: number;
|
259
|
+
community_id: number;
|
260
|
+
reason?: string;
|
261
|
+
when_: string;
|
262
|
+
}
|
263
|
+
export interface AdminPurgeComment {
|
264
|
+
id: number;
|
265
|
+
admin_person_id: number;
|
266
|
+
post_id: number;
|
267
|
+
reason?: string;
|
268
|
+
when_: string;
|
269
|
+
}
|
195
270
|
export interface CommunitySafe {
|
196
271
|
id: number;
|
197
272
|
name: string;
|
@@ -206,7 +281,9 @@ export interface CommunitySafe {
|
|
206
281
|
local: boolean;
|
207
282
|
icon?: string;
|
208
283
|
banner?: string;
|
284
|
+
hidden: boolean;
|
209
285
|
posting_restricted_to_mods: boolean;
|
286
|
+
instance_id: number;
|
210
287
|
}
|
211
288
|
export interface CommentReport {
|
212
289
|
id: number;
|
@@ -223,15 +300,16 @@ export interface Comment {
|
|
223
300
|
id: number;
|
224
301
|
creator_id: number;
|
225
302
|
post_id: number;
|
226
|
-
parent_id?: number;
|
227
303
|
content: string;
|
228
304
|
removed: boolean;
|
229
|
-
read: boolean;
|
230
305
|
published: string;
|
231
306
|
updated?: string;
|
232
307
|
deleted: boolean;
|
233
308
|
ap_id: string;
|
234
309
|
local: boolean;
|
310
|
+
path: string;
|
311
|
+
distinguished: boolean;
|
312
|
+
language_id: number;
|
235
313
|
}
|
236
314
|
export interface PersonMention {
|
237
315
|
id: number;
|
@@ -240,6 +318,13 @@ export interface PersonMention {
|
|
240
318
|
read: boolean;
|
241
319
|
published: string;
|
242
320
|
}
|
321
|
+
export interface CommentReply {
|
322
|
+
id: number;
|
323
|
+
recipient_id: number;
|
324
|
+
comment_id: number;
|
325
|
+
read: boolean;
|
326
|
+
published: string;
|
327
|
+
}
|
243
328
|
export interface RegistrationApplication {
|
244
329
|
id: number;
|
245
330
|
local_user_id: number;
|
@@ -248,3 +333,26 @@ export interface RegistrationApplication {
|
|
248
333
|
deny_reason?: string;
|
249
334
|
published: string;
|
250
335
|
}
|
336
|
+
export interface Language {
|
337
|
+
id: number;
|
338
|
+
code: string;
|
339
|
+
name: string;
|
340
|
+
}
|
341
|
+
export interface PrivateMessageReport {
|
342
|
+
id: number;
|
343
|
+
creator_id: number;
|
344
|
+
private_message_id: number;
|
345
|
+
original_pm_text: string;
|
346
|
+
reason: string;
|
347
|
+
resolved: boolean;
|
348
|
+
resolver_id?: number;
|
349
|
+
published: string;
|
350
|
+
updated?: string;
|
351
|
+
}
|
352
|
+
export interface Tagline {
|
353
|
+
id: number;
|
354
|
+
local_site_id: number;
|
355
|
+
content: string;
|
356
|
+
published: string;
|
357
|
+
updated?: string;
|
358
|
+
}
|
@@ -1,2 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.RegistrationMode = void 0;
|
4
|
+
var RegistrationMode;
|
5
|
+
(function (RegistrationMode) {
|
6
|
+
RegistrationMode["Closed"] = "closed";
|
7
|
+
RegistrationMode["RequireApplication"] = "requireapplication";
|
8
|
+
RegistrationMode["Open"] = "open";
|
9
|
+
})(RegistrationMode = exports.RegistrationMode || (exports.RegistrationMode = {}));
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { CommentAggregates, CommunityAggregates, PersonAggregates, PostAggregates, SiteAggregates } from "./aggregates";
|
2
|
-
import {
|
2
|
+
import { SubscribedType } from "./others";
|
3
|
+
import { AdminPurgeComment, AdminPurgeCommunity, AdminPurgePerson, AdminPurgePost, Comment, CommentReply, CommentReport, CommunitySafe, LocalSite, LocalSiteRateLimit, LocalUserSettings, ModAdd, ModAddCommunity, ModBan, ModBanFromCommunity, ModFeaturePost, ModLockPost, ModRemoveComment, ModRemoveCommunity, ModRemovePost, ModTransferCommunity, PersonMention, PersonSafe, Post, PostReport, PrivateMessage, PrivateMessageReport, RegistrationApplication, Site, Tagline } from "./source";
|
3
4
|
export interface PersonViewSafe {
|
4
5
|
person: PersonSafe;
|
5
6
|
counts: PersonAggregates;
|
@@ -13,7 +14,7 @@ export interface PersonMentionView {
|
|
13
14
|
recipient: PersonSafe;
|
14
15
|
counts: CommentAggregates;
|
15
16
|
creator_banned_from_community: boolean;
|
16
|
-
subscribed:
|
17
|
+
subscribed: SubscribedType;
|
17
18
|
saved: boolean;
|
18
19
|
creator_blocked: boolean;
|
19
20
|
my_vote?: number;
|
@@ -25,6 +26,9 @@ export interface LocalUserSettingsView {
|
|
25
26
|
}
|
26
27
|
export interface SiteView {
|
27
28
|
site: Site;
|
29
|
+
local_site: LocalSite;
|
30
|
+
local_site_rate_limit: LocalSiteRateLimit;
|
31
|
+
taglines?: Tagline[];
|
28
32
|
counts: SiteAggregates;
|
29
33
|
}
|
30
34
|
export interface PrivateMessageView {
|
@@ -38,11 +42,12 @@ export interface PostView {
|
|
38
42
|
community: CommunitySafe;
|
39
43
|
creator_banned_from_community: boolean;
|
40
44
|
counts: PostAggregates;
|
41
|
-
subscribed:
|
45
|
+
subscribed: SubscribedType;
|
42
46
|
saved: boolean;
|
43
47
|
read: boolean;
|
44
48
|
creator_blocked: boolean;
|
45
49
|
my_vote?: number;
|
50
|
+
unread_comments: number;
|
46
51
|
}
|
47
52
|
export interface PostReportView {
|
48
53
|
post_report: PostReport;
|
@@ -58,12 +63,25 @@ export interface PostReportView {
|
|
58
63
|
export interface CommentView {
|
59
64
|
comment: Comment;
|
60
65
|
creator: PersonSafe;
|
61
|
-
recipient?: PersonSafe;
|
62
66
|
post: Post;
|
63
67
|
community: CommunitySafe;
|
64
68
|
counts: CommentAggregates;
|
65
69
|
creator_banned_from_community: boolean;
|
66
|
-
subscribed:
|
70
|
+
subscribed: SubscribedType;
|
71
|
+
saved: boolean;
|
72
|
+
creator_blocked: boolean;
|
73
|
+
my_vote?: number;
|
74
|
+
}
|
75
|
+
export interface CommentReplyView {
|
76
|
+
comment_reply: CommentReply;
|
77
|
+
comment: Comment;
|
78
|
+
creator: PersonSafe;
|
79
|
+
post: Post;
|
80
|
+
community: CommunitySafe;
|
81
|
+
recipient: PersonSafe;
|
82
|
+
counts: CommentAggregates;
|
83
|
+
creator_banned_from_community: boolean;
|
84
|
+
subscribed: SubscribedType;
|
67
85
|
saved: boolean;
|
68
86
|
creator_blocked: boolean;
|
69
87
|
my_vote?: number;
|
@@ -82,41 +100,41 @@ export interface CommentReportView {
|
|
82
100
|
}
|
83
101
|
export interface ModAddCommunityView {
|
84
102
|
mod_add_community: ModAddCommunity;
|
85
|
-
moderator
|
103
|
+
moderator?: PersonSafe;
|
86
104
|
community: CommunitySafe;
|
87
105
|
modded_person: PersonSafe;
|
88
106
|
}
|
89
107
|
export interface ModTransferCommunityView {
|
90
108
|
mod_transfer_community: ModTransferCommunity;
|
91
|
-
moderator
|
109
|
+
moderator?: PersonSafe;
|
92
110
|
community: CommunitySafe;
|
93
111
|
modded_person: PersonSafe;
|
94
112
|
}
|
95
113
|
export interface ModAddView {
|
96
114
|
mod_add: ModAdd;
|
97
|
-
moderator
|
115
|
+
moderator?: PersonSafe;
|
98
116
|
modded_person: PersonSafe;
|
99
117
|
}
|
100
118
|
export interface ModBanFromCommunityView {
|
101
119
|
mod_ban_from_community: ModBanFromCommunity;
|
102
|
-
moderator
|
120
|
+
moderator?: PersonSafe;
|
103
121
|
community: CommunitySafe;
|
104
122
|
banned_person: PersonSafe;
|
105
123
|
}
|
106
124
|
export interface ModBanView {
|
107
125
|
mod_ban: ModBan;
|
108
|
-
moderator
|
126
|
+
moderator?: PersonSafe;
|
109
127
|
banned_person: PersonSafe;
|
110
128
|
}
|
111
129
|
export interface ModLockPostView {
|
112
130
|
mod_lock_post: ModLockPost;
|
113
|
-
moderator
|
131
|
+
moderator?: PersonSafe;
|
114
132
|
post: Post;
|
115
133
|
community: CommunitySafe;
|
116
134
|
}
|
117
135
|
export interface ModRemoveCommentView {
|
118
136
|
mod_remove_comment: ModRemoveComment;
|
119
|
-
moderator
|
137
|
+
moderator?: PersonSafe;
|
120
138
|
comment: Comment;
|
121
139
|
commenter: PersonSafe;
|
122
140
|
post: Post;
|
@@ -124,21 +142,39 @@ export interface ModRemoveCommentView {
|
|
124
142
|
}
|
125
143
|
export interface ModRemoveCommunityView {
|
126
144
|
mod_remove_community: ModRemoveCommunity;
|
127
|
-
moderator
|
145
|
+
moderator?: PersonSafe;
|
128
146
|
community: CommunitySafe;
|
129
147
|
}
|
130
148
|
export interface ModRemovePostView {
|
131
149
|
mod_remove_post: ModRemovePost;
|
132
|
-
moderator
|
150
|
+
moderator?: PersonSafe;
|
133
151
|
post: Post;
|
134
152
|
community: CommunitySafe;
|
135
153
|
}
|
136
|
-
export interface
|
137
|
-
|
138
|
-
moderator
|
154
|
+
export interface ModFeaturePostView {
|
155
|
+
mod_feature_post: ModFeaturePost;
|
156
|
+
moderator?: PersonSafe;
|
139
157
|
post: Post;
|
140
158
|
community: CommunitySafe;
|
141
159
|
}
|
160
|
+
export interface AdminPurgeCommunityView {
|
161
|
+
admin_purge_community: AdminPurgeCommunity;
|
162
|
+
admin?: PersonSafe;
|
163
|
+
}
|
164
|
+
export interface AdminPurgePersonView {
|
165
|
+
admin_purge_person: AdminPurgePerson;
|
166
|
+
admin?: PersonSafe;
|
167
|
+
}
|
168
|
+
export interface AdminPurgePostView {
|
169
|
+
admin_purge_post: AdminPurgePost;
|
170
|
+
admin?: PersonSafe;
|
171
|
+
community: CommunitySafe;
|
172
|
+
}
|
173
|
+
export interface AdminPurgeCommentView {
|
174
|
+
admin_purge_comment: AdminPurgeComment;
|
175
|
+
admin?: PersonSafe;
|
176
|
+
post: Post;
|
177
|
+
}
|
142
178
|
export interface CommunityFollowerView {
|
143
179
|
community: CommunitySafe;
|
144
180
|
follower: PersonSafe;
|
@@ -161,7 +197,7 @@ export interface PersonBlockView {
|
|
161
197
|
}
|
162
198
|
export interface CommunityView {
|
163
199
|
community: CommunitySafe;
|
164
|
-
subscribed:
|
200
|
+
subscribed: SubscribedType;
|
165
201
|
blocked: boolean;
|
166
202
|
counts: CommunityAggregates;
|
167
203
|
}
|
@@ -171,3 +207,15 @@ export interface RegistrationApplicationView {
|
|
171
207
|
creator: PersonSafe;
|
172
208
|
admin?: PersonSafe;
|
173
209
|
}
|
210
|
+
export interface CommentNode {
|
211
|
+
comment_view: CommentView | PersonMentionView | CommentReplyView;
|
212
|
+
children: CommentNode[];
|
213
|
+
depth: number;
|
214
|
+
}
|
215
|
+
export interface PrivateMessageReportView {
|
216
|
+
private_message_report: PrivateMessageReport;
|
217
|
+
private_message: PrivateMessage;
|
218
|
+
private_message_creator: PersonSafe;
|
219
|
+
creator: PersonSafe;
|
220
|
+
resolver?: PersonSafe;
|
221
|
+
}
|
package/dist/utils.d.ts
ADDED
File without changes
|
package/dist/utils.js
ADDED
File without changes
|
package/dist/websocket.d.ts
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
-
import { CreateComment, CreateCommentLike, CreateCommentReport, DeleteComment, EditComment, GetComments, ListCommentReports,
|
1
|
+
import { CreateComment, CreateCommentLike, CreateCommentReport, DeleteComment, EditComment, GetComments, ListCommentReports, RemoveComment, ResolveCommentReport, SaveComment } from "./interfaces/api/comment";
|
2
2
|
import { AddModToCommunity, BanFromCommunity, BlockCommunity, CreateCommunity, DeleteCommunity, EditCommunity, FollowCommunity, GetCommunity, ListCommunities, RemoveCommunity, TransferCommunity } from "./interfaces/api/community";
|
3
|
-
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
|
5
|
-
import { ApproveRegistrationApplication, CreateSite, EditSite, GetModlog, GetSite,
|
3
|
+
import { AddAdmin, BanPerson, BlockPerson, ChangePassword, CreatePrivateMessage, CreatePrivateMessageReport, DeleteAccount, DeletePrivateMessage, EditPrivateMessage, GetBannedPersons, GetPersonDetails, GetPersonMentions, GetPrivateMessages, GetReplies, GetReportCount, GetUnreadCount, ListPrivateMessageReports, Login, MarkAllAsRead, MarkCommentReplyAsRead, MarkPersonMentionAsRead, MarkPrivateMessageAsRead, PasswordChange, PasswordReset, Register, ResolvePrivateMessageReport, SaveUserSettings, VerifyEmail } from "./interfaces/api/person";
|
4
|
+
import { CreatePost, CreatePostLike, CreatePostReport, DeletePost, EditPost, FeaturePost, GetPost, GetPosts, GetSiteMetadata, ListPostReports, LockPost, MarkPostAsRead, RemovePost, ResolvePostReport, SavePost } from "./interfaces/api/post";
|
5
|
+
import { ApproveRegistrationApplication, CreateSite, EditSite, GetModlog, GetSite, GetUnreadRegistrationApplicationCount, LeaveAdmin, ListRegistrationApplications, PurgeComment, PurgeCommunity, PurgePerson, PurgePost, ResolveObject, Search } from "./interfaces/api/site";
|
6
6
|
import { CommunityJoin, PostJoin, UserJoin } from "./interfaces/api/websocket";
|
7
|
+
import { UserOperation } from "./interfaces/others";
|
7
8
|
/**
|
8
9
|
* Helps build lemmy websocket message requests, that you can use in your Websocket sends.
|
9
10
|
*
|
@@ -100,7 +101,7 @@ export declare class LemmyWebsocket {
|
|
100
101
|
/**
|
101
102
|
* Mark a comment as read.
|
102
103
|
*/
|
103
|
-
|
104
|
+
markCommentReplyAsRead(form: MarkCommentReplyAsRead): string;
|
104
105
|
/**
|
105
106
|
* Like / vote on a comment.
|
106
107
|
*/
|
@@ -150,9 +151,13 @@ export declare class LemmyWebsocket {
|
|
150
151
|
*/
|
151
152
|
lockPost(form: LockPost): string;
|
152
153
|
/**
|
153
|
-
* A moderator can
|
154
|
+
* A moderator can feature a post ( IE stick it to the top of a community ).
|
154
155
|
*/
|
155
|
-
|
156
|
+
featurePost(form: FeaturePost): string;
|
157
|
+
/**
|
158
|
+
* Mark a post as read.
|
159
|
+
*/
|
160
|
+
markPostAsRead(form: MarkPostAsRead): string;
|
156
161
|
/**
|
157
162
|
* Save a post.
|
158
163
|
*/
|
@@ -244,11 +249,7 @@ export declare class LemmyWebsocket {
|
|
244
249
|
/**
|
245
250
|
* Gets the site, and your user data.
|
246
251
|
*/
|
247
|
-
getSite(form
|
248
|
-
/**
|
249
|
-
* Get your site configuration.
|
250
|
-
*/
|
251
|
-
getSiteConfig(form: GetSiteConfig): string;
|
252
|
+
getSite(form: GetSite): string;
|
252
253
|
/**
|
253
254
|
* Search lemmy.
|
254
255
|
*/
|
@@ -314,9 +315,17 @@ export declare class LemmyWebsocket {
|
|
314
315
|
*/
|
315
316
|
getPrivateMessages(form: GetPrivateMessages): string;
|
316
317
|
/**
|
317
|
-
*
|
318
|
+
* Create a report for a private message.
|
318
319
|
*/
|
319
|
-
|
320
|
+
createPrivateMessageReport(form: CreatePrivateMessageReport): string;
|
321
|
+
/**
|
322
|
+
* Resolve a report for a private message.
|
323
|
+
*/
|
324
|
+
resolvePrivateMessageReport(form: ResolvePrivateMessageReport): string;
|
325
|
+
/**
|
326
|
+
* List private message reports.
|
327
|
+
*/
|
328
|
+
listPrivateMessageReports(form: ListPrivateMessageReports): string;
|
320
329
|
/**
|
321
330
|
* Block a person.
|
322
331
|
*/
|
@@ -325,4 +334,25 @@ export declare class LemmyWebsocket {
|
|
325
334
|
* Block a community.
|
326
335
|
*/
|
327
336
|
blockCommunity(form: BlockCommunity): string;
|
337
|
+
/**
|
338
|
+
* Purge / Delete a person from the database.
|
339
|
+
*/
|
340
|
+
purgePerson(form: PurgePerson): string;
|
341
|
+
/**
|
342
|
+
* Purge / Delete a community from the database.
|
343
|
+
*/
|
344
|
+
purgeCommunity(form: PurgeCommunity): string;
|
345
|
+
/**
|
346
|
+
* Purge / Delete a post from the database.
|
347
|
+
*/
|
348
|
+
purgePost(form: PurgePost): string;
|
349
|
+
/**
|
350
|
+
* Purge / Delete a comment from the database.
|
351
|
+
*/
|
352
|
+
purgeComment(form: PurgeComment): string;
|
328
353
|
}
|
354
|
+
export declare function wsUserOp(msg: any): UserOperation;
|
355
|
+
/**
|
356
|
+
* Converts a websocket string response to a usable result
|
357
|
+
*/
|
358
|
+
export declare function wsJsonToRes<ResponseType>(msg: any): ResponseType;
|
package/dist/websocket.js
CHANGED
@@ -1,6 +1,6 @@
|
|
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
4
|
var others_1 = require("./interfaces/others");
|
5
5
|
/**
|
6
6
|
* Helps build lemmy websocket message requests, that you can use in your Websocket sends.
|
@@ -137,8 +137,8 @@ var LemmyWebsocket = /** @class */ (function () {
|
|
137
137
|
/**
|
138
138
|
* Mark a comment as read.
|
139
139
|
*/
|
140
|
-
LemmyWebsocket.prototype.
|
141
|
-
return wrapper(others_1.UserOperation.
|
140
|
+
LemmyWebsocket.prototype.markCommentReplyAsRead = function (form) {
|
141
|
+
return wrapper(others_1.UserOperation.MarkCommentReplyAsRead, form);
|
142
142
|
};
|
143
143
|
/**
|
144
144
|
* Like / vote on a comment.
|
@@ -213,10 +213,16 @@ var LemmyWebsocket = /** @class */ (function () {
|
|
213
213
|
return wrapper(others_1.UserOperation.LockPost, form);
|
214
214
|
};
|
215
215
|
/**
|
216
|
-
* A moderator can
|
216
|
+
* A moderator can feature a post ( IE stick it to the top of a community ).
|
217
217
|
*/
|
218
|
-
LemmyWebsocket.prototype.
|
219
|
-
return wrapper(others_1.UserOperation.
|
218
|
+
LemmyWebsocket.prototype.featurePost = function (form) {
|
219
|
+
return wrapper(others_1.UserOperation.FeaturePost, form);
|
220
|
+
};
|
221
|
+
/**
|
222
|
+
* Mark a post as read.
|
223
|
+
*/
|
224
|
+
LemmyWebsocket.prototype.markPostAsRead = function (form) {
|
225
|
+
return wrapper(others_1.UserOperation.MarkPostAsRead, form);
|
220
226
|
};
|
221
227
|
/**
|
222
228
|
* Save a post.
|
@@ -354,15 +360,8 @@ var LemmyWebsocket = /** @class */ (function () {
|
|
354
360
|
* Gets the site, and your user data.
|
355
361
|
*/
|
356
362
|
LemmyWebsocket.prototype.getSite = function (form) {
|
357
|
-
if (form === void 0) { form = {}; }
|
358
363
|
return wrapper(others_1.UserOperation.GetSite, form);
|
359
364
|
};
|
360
|
-
/**
|
361
|
-
* Get your site configuration.
|
362
|
-
*/
|
363
|
-
LemmyWebsocket.prototype.getSiteConfig = function (form) {
|
364
|
-
return wrapper(others_1.UserOperation.GetSiteConfig, form);
|
365
|
-
};
|
366
365
|
/**
|
367
366
|
* Search lemmy.
|
368
367
|
*/
|
@@ -460,10 +459,22 @@ var LemmyWebsocket = /** @class */ (function () {
|
|
460
459
|
return wrapper(others_1.UserOperation.GetPrivateMessages, form);
|
461
460
|
};
|
462
461
|
/**
|
463
|
-
*
|
462
|
+
* Create a report for a private message.
|
463
|
+
*/
|
464
|
+
LemmyWebsocket.prototype.createPrivateMessageReport = function (form) {
|
465
|
+
return wrapper(others_1.UserOperation.CreatePrivateMessageReport, form);
|
466
|
+
};
|
467
|
+
/**
|
468
|
+
* Resolve a report for a private message.
|
464
469
|
*/
|
465
|
-
LemmyWebsocket.prototype.
|
466
|
-
return wrapper(others_1.UserOperation.
|
470
|
+
LemmyWebsocket.prototype.resolvePrivateMessageReport = function (form) {
|
471
|
+
return wrapper(others_1.UserOperation.ResolvePrivateMessageReport, form);
|
472
|
+
};
|
473
|
+
/**
|
474
|
+
* List private message reports.
|
475
|
+
*/
|
476
|
+
LemmyWebsocket.prototype.listPrivateMessageReports = function (form) {
|
477
|
+
return wrapper(others_1.UserOperation.ListPrivateMessageReports, form);
|
467
478
|
};
|
468
479
|
/**
|
469
480
|
* Block a person.
|
@@ -477,11 +488,48 @@ var LemmyWebsocket = /** @class */ (function () {
|
|
477
488
|
LemmyWebsocket.prototype.blockCommunity = function (form) {
|
478
489
|
return wrapper(others_1.UserOperation.BlockCommunity, form);
|
479
490
|
};
|
491
|
+
/**
|
492
|
+
* Purge / Delete a person from the database.
|
493
|
+
*/
|
494
|
+
LemmyWebsocket.prototype.purgePerson = function (form) {
|
495
|
+
return wrapper(others_1.UserOperation.PurgePerson, form);
|
496
|
+
};
|
497
|
+
/**
|
498
|
+
* Purge / Delete a community from the database.
|
499
|
+
*/
|
500
|
+
LemmyWebsocket.prototype.purgeCommunity = function (form) {
|
501
|
+
return wrapper(others_1.UserOperation.PurgeCommunity, form);
|
502
|
+
};
|
503
|
+
/**
|
504
|
+
* Purge / Delete a post from the database.
|
505
|
+
*/
|
506
|
+
LemmyWebsocket.prototype.purgePost = function (form) {
|
507
|
+
return wrapper(others_1.UserOperation.PurgePost, form);
|
508
|
+
};
|
509
|
+
/**
|
510
|
+
* Purge / Delete a comment from the database.
|
511
|
+
*/
|
512
|
+
LemmyWebsocket.prototype.purgeComment = function (form) {
|
513
|
+
return wrapper(others_1.UserOperation.PurgeComment, form);
|
514
|
+
};
|
480
515
|
return LemmyWebsocket;
|
481
516
|
}());
|
482
517
|
exports.LemmyWebsocket = LemmyWebsocket;
|
483
518
|
function wrapper(op, data) {
|
484
|
-
var send = { op: others_1.UserOperation[op], data: data };
|
485
|
-
|
486
|
-
|
519
|
+
var send = JSON.stringify({ op: others_1.UserOperation[op], data: data });
|
520
|
+
return send;
|
521
|
+
}
|
522
|
+
function wsUserOp(msg) {
|
523
|
+
var opStr = msg.op;
|
524
|
+
return others_1.UserOperation[opStr];
|
525
|
+
}
|
526
|
+
exports.wsUserOp = wsUserOp;
|
527
|
+
/**
|
528
|
+
* Converts a websocket string response to a usable result
|
529
|
+
*/
|
530
|
+
// TODO is this still necessary?
|
531
|
+
function wsJsonToRes(msg) {
|
532
|
+
// Have to deserialize the response again into the correct class
|
533
|
+
return msg.data;
|
487
534
|
}
|
535
|
+
exports.wsJsonToRes = wsJsonToRes;
|