lemmy-js-client 0.17.0-rc.6 → 0.17.0-rc.60
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +4 -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 +13 -17
- package/dist/interfaces/api/community.d.ts +8 -8
- package/dist/interfaces/api/index.js +5 -1
- package/dist/interfaces/api/person.d.ts +39 -12
- package/dist/interfaces/api/post.d.ts +21 -18
- package/dist/interfaces/api/site.d.ts +97 -31
- 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 -19
- 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 -28
@@ -1,4 +1,3 @@
|
|
1
|
-
import { Option } from "@sniptt/monads";
|
2
1
|
export interface LocalUserSettings {
|
3
2
|
id: number;
|
4
3
|
person_id: number;
|
@@ -7,9 +6,10 @@ export interface LocalUserSettings {
|
|
7
6
|
theme: string;
|
8
7
|
default_sort_type: number;
|
9
8
|
default_listing_type: number;
|
10
|
-
|
9
|
+
interface_language: string;
|
11
10
|
show_avatars: boolean;
|
12
11
|
send_notifications_to_email: boolean;
|
12
|
+
validator_time: string;
|
13
13
|
show_bot_accounts: boolean;
|
14
14
|
show_scores: boolean;
|
15
15
|
show_read_posts: boolean;
|
@@ -31,34 +31,77 @@ export interface PersonSafe {
|
|
31
31
|
banner?: string;
|
32
32
|
deleted: boolean;
|
33
33
|
inbox_url: string;
|
34
|
-
shared_inbox_url
|
34
|
+
shared_inbox_url?: string;
|
35
35
|
matrix_user_id?: string;
|
36
36
|
admin: boolean;
|
37
37
|
bot_account: boolean;
|
38
38
|
ban_expires?: string;
|
39
|
+
instance_id: number;
|
39
40
|
}
|
40
41
|
export interface Site {
|
41
42
|
id: number;
|
42
43
|
name: string;
|
43
|
-
sidebar
|
44
|
+
sidebar?: string;
|
44
45
|
published: string;
|
45
46
|
updated?: string;
|
46
|
-
enable_downvotes: boolean;
|
47
|
-
open_registration: boolean;
|
48
|
-
enable_nsfw: boolean;
|
49
47
|
icon?: string;
|
50
|
-
banner
|
48
|
+
banner?: string;
|
51
49
|
description?: string;
|
50
|
+
actor_id: string;
|
51
|
+
last_refreshed_at: string;
|
52
|
+
inbox_url: string;
|
53
|
+
private_key?: string;
|
54
|
+
public_key: string;
|
55
|
+
instance_id: number;
|
56
|
+
}
|
57
|
+
export declare enum RegistrationMode {
|
58
|
+
Closed = "closed",
|
59
|
+
RequireApplication = "require_application",
|
60
|
+
Open = "open"
|
61
|
+
}
|
62
|
+
export interface LocalSite {
|
63
|
+
id: number;
|
64
|
+
site_id: number;
|
65
|
+
site_setup: boolean;
|
66
|
+
enable_downvotes: boolean;
|
67
|
+
registration_mode: RegistrationMode;
|
68
|
+
enable_nsfw: boolean;
|
52
69
|
community_creation_admin_only: boolean;
|
53
70
|
require_email_verification: boolean;
|
54
|
-
require_application: boolean;
|
55
71
|
application_question?: string;
|
56
72
|
private_instance: boolean;
|
57
73
|
default_theme: string;
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
74
|
+
default_post_listing_type: string;
|
75
|
+
legal_information?: string;
|
76
|
+
hide_modlog_mod_names: boolean;
|
77
|
+
application_email_admins: boolean;
|
78
|
+
slur_filter_regex?: string;
|
79
|
+
actor_name_max_length: number;
|
80
|
+
federation_enabled: boolean;
|
81
|
+
federation_debug: boolean;
|
82
|
+
federation_worker_count: number;
|
83
|
+
captcha_enabled: boolean;
|
84
|
+
captcha_difficulty: string;
|
85
|
+
published: string;
|
86
|
+
updated?: string;
|
87
|
+
}
|
88
|
+
export interface LocalSiteRateLimit {
|
89
|
+
id: number;
|
90
|
+
local_site_id: number;
|
91
|
+
message: number;
|
92
|
+
message_per_second: number;
|
93
|
+
post: number;
|
94
|
+
post_per_second: number;
|
95
|
+
register: number;
|
96
|
+
register_per_second: number;
|
97
|
+
image: number;
|
98
|
+
image_per_second: number;
|
99
|
+
comment: number;
|
100
|
+
comment_per_second: number;
|
101
|
+
search: number;
|
102
|
+
search_per_second: number;
|
103
|
+
published: string;
|
104
|
+
updated?: string;
|
62
105
|
}
|
63
106
|
export interface PrivateMessage {
|
64
107
|
id: number;
|
@@ -98,13 +141,15 @@ export interface Post {
|
|
98
141
|
updated?: string;
|
99
142
|
deleted: boolean;
|
100
143
|
nsfw: boolean;
|
101
|
-
stickied: boolean;
|
102
144
|
embed_title?: string;
|
103
145
|
embed_description?: string;
|
104
|
-
|
146
|
+
embed_video_url?: string;
|
105
147
|
thumbnail_url?: string;
|
106
148
|
ap_id: string;
|
107
149
|
local: boolean;
|
150
|
+
language_id: number;
|
151
|
+
featured_community: boolean;
|
152
|
+
featured_local: boolean;
|
108
153
|
}
|
109
154
|
export interface PasswordResetRequest {
|
110
155
|
id: number;
|
@@ -127,11 +172,12 @@ export interface ModLockPost {
|
|
127
172
|
locked?: boolean;
|
128
173
|
when_: string;
|
129
174
|
}
|
130
|
-
export interface
|
175
|
+
export interface ModFeaturePost {
|
131
176
|
id: number;
|
132
177
|
mod_person_id: number;
|
133
178
|
post_id: number;
|
134
|
-
|
179
|
+
featured: boolean;
|
180
|
+
is_featured_community: boolean;
|
135
181
|
when_: string;
|
136
182
|
}
|
137
183
|
export interface ModRemoveComment {
|
@@ -193,6 +239,32 @@ export interface ModAdd {
|
|
193
239
|
removed?: boolean;
|
194
240
|
when_: string;
|
195
241
|
}
|
242
|
+
export interface AdminPurgePerson {
|
243
|
+
id: number;
|
244
|
+
admin_person_id: number;
|
245
|
+
reason?: string;
|
246
|
+
when_: string;
|
247
|
+
}
|
248
|
+
export interface AdminPurgeCommunity {
|
249
|
+
id: number;
|
250
|
+
admin_person_id: number;
|
251
|
+
reason?: string;
|
252
|
+
when_: string;
|
253
|
+
}
|
254
|
+
export interface AdminPurgePost {
|
255
|
+
id: number;
|
256
|
+
admin_person_id: number;
|
257
|
+
community_id: number;
|
258
|
+
reason?: string;
|
259
|
+
when_: string;
|
260
|
+
}
|
261
|
+
export interface AdminPurgeComment {
|
262
|
+
id: number;
|
263
|
+
admin_person_id: number;
|
264
|
+
post_id: number;
|
265
|
+
reason?: string;
|
266
|
+
when_: string;
|
267
|
+
}
|
196
268
|
export interface CommunitySafe {
|
197
269
|
id: number;
|
198
270
|
name: string;
|
@@ -207,7 +279,9 @@ export interface CommunitySafe {
|
|
207
279
|
local: boolean;
|
208
280
|
icon?: string;
|
209
281
|
banner?: string;
|
282
|
+
hidden: boolean;
|
210
283
|
posting_restricted_to_mods: boolean;
|
284
|
+
instance_id: number;
|
211
285
|
}
|
212
286
|
export interface CommentReport {
|
213
287
|
id: number;
|
@@ -224,15 +298,16 @@ export interface Comment {
|
|
224
298
|
id: number;
|
225
299
|
creator_id: number;
|
226
300
|
post_id: number;
|
227
|
-
parent_id?: number;
|
228
301
|
content: string;
|
229
302
|
removed: boolean;
|
230
|
-
read: boolean;
|
231
303
|
published: string;
|
232
304
|
updated?: string;
|
233
305
|
deleted: boolean;
|
234
306
|
ap_id: string;
|
235
307
|
local: boolean;
|
308
|
+
path: string;
|
309
|
+
distinguished: boolean;
|
310
|
+
language_id: number;
|
236
311
|
}
|
237
312
|
export interface PersonMention {
|
238
313
|
id: number;
|
@@ -241,6 +316,13 @@ export interface PersonMention {
|
|
241
316
|
read: boolean;
|
242
317
|
published: string;
|
243
318
|
}
|
319
|
+
export interface CommentReply {
|
320
|
+
id: number;
|
321
|
+
recipient_id: number;
|
322
|
+
comment_id: number;
|
323
|
+
read: boolean;
|
324
|
+
published: string;
|
325
|
+
}
|
244
326
|
export interface RegistrationApplication {
|
245
327
|
id: number;
|
246
328
|
local_user_id: number;
|
@@ -249,3 +331,26 @@ export interface RegistrationApplication {
|
|
249
331
|
deny_reason?: string;
|
250
332
|
published: string;
|
251
333
|
}
|
334
|
+
export interface Language {
|
335
|
+
id: number;
|
336
|
+
code: string;
|
337
|
+
name: string;
|
338
|
+
}
|
339
|
+
export interface PrivateMessageReport {
|
340
|
+
id: number;
|
341
|
+
creator_id: number;
|
342
|
+
private_message_id: number;
|
343
|
+
original_pm_text: string;
|
344
|
+
reason: string;
|
345
|
+
resolved: boolean;
|
346
|
+
resolver_id?: number;
|
347
|
+
published: string;
|
348
|
+
updated?: string;
|
349
|
+
}
|
350
|
+
export interface Tagline {
|
351
|
+
id: number;
|
352
|
+
local_site_id: number;
|
353
|
+
content: string;
|
354
|
+
published: string;
|
355
|
+
updated?: string;
|
356
|
+
}
|
@@ -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"] = "require_application";
|
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;
|