lemmy-js-client 0.11.4-rc.9 → 0.12.3-rc.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SearchType = exports.ListingType = exports.SortType = exports.UserOperation = exports.VERSION = void 0;
4
4
  exports.VERSION = 'v3';
5
5
  /**
6
- * All of the websocket operations available
6
+ * All of the websocket operations available.
7
7
  */
8
8
  var UserOperation;
9
9
  (function (UserOperation) {
@@ -47,41 +47,83 @@ var UserOperation;
47
47
  UserOperation[UserOperation["AddAdmin"] = 37] = "AddAdmin";
48
48
  UserOperation[UserOperation["BanPerson"] = 38] = "BanPerson";
49
49
  UserOperation[UserOperation["Search"] = 39] = "Search";
50
- UserOperation[UserOperation["MarkAllAsRead"] = 40] = "MarkAllAsRead";
51
- UserOperation[UserOperation["SaveUserSettings"] = 41] = "SaveUserSettings";
52
- UserOperation[UserOperation["TransferCommunity"] = 42] = "TransferCommunity";
53
- UserOperation[UserOperation["TransferSite"] = 43] = "TransferSite";
54
- UserOperation[UserOperation["DeleteAccount"] = 44] = "DeleteAccount";
55
- UserOperation[UserOperation["PasswordReset"] = 45] = "PasswordReset";
56
- UserOperation[UserOperation["PasswordChange"] = 46] = "PasswordChange";
57
- UserOperation[UserOperation["CreatePrivateMessage"] = 47] = "CreatePrivateMessage";
58
- UserOperation[UserOperation["EditPrivateMessage"] = 48] = "EditPrivateMessage";
59
- UserOperation[UserOperation["DeletePrivateMessage"] = 49] = "DeletePrivateMessage";
60
- UserOperation[UserOperation["MarkPrivateMessageAsRead"] = 50] = "MarkPrivateMessageAsRead";
61
- UserOperation[UserOperation["GetPrivateMessages"] = 51] = "GetPrivateMessages";
62
- UserOperation[UserOperation["UserJoin"] = 52] = "UserJoin";
63
- UserOperation[UserOperation["GetComments"] = 53] = "GetComments";
64
- UserOperation[UserOperation["GetSiteConfig"] = 54] = "GetSiteConfig";
65
- UserOperation[UserOperation["SaveSiteConfig"] = 55] = "SaveSiteConfig";
66
- UserOperation[UserOperation["PostJoin"] = 56] = "PostJoin";
67
- UserOperation[UserOperation["CommunityJoin"] = 57] = "CommunityJoin";
68
- UserOperation[UserOperation["ChangePassword"] = 58] = "ChangePassword";
69
- UserOperation[UserOperation["BlockCommunity"] = 59] = "BlockCommunity";
70
- UserOperation[UserOperation["BlockPerson"] = 60] = "BlockPerson";
50
+ UserOperation[UserOperation["ResolveObject"] = 40] = "ResolveObject";
51
+ UserOperation[UserOperation["MarkAllAsRead"] = 41] = "MarkAllAsRead";
52
+ UserOperation[UserOperation["SaveUserSettings"] = 42] = "SaveUserSettings";
53
+ UserOperation[UserOperation["TransferCommunity"] = 43] = "TransferCommunity";
54
+ UserOperation[UserOperation["TransferSite"] = 44] = "TransferSite";
55
+ UserOperation[UserOperation["DeleteAccount"] = 45] = "DeleteAccount";
56
+ UserOperation[UserOperation["PasswordReset"] = 46] = "PasswordReset";
57
+ UserOperation[UserOperation["PasswordChange"] = 47] = "PasswordChange";
58
+ UserOperation[UserOperation["CreatePrivateMessage"] = 48] = "CreatePrivateMessage";
59
+ UserOperation[UserOperation["EditPrivateMessage"] = 49] = "EditPrivateMessage";
60
+ UserOperation[UserOperation["DeletePrivateMessage"] = 50] = "DeletePrivateMessage";
61
+ UserOperation[UserOperation["MarkPrivateMessageAsRead"] = 51] = "MarkPrivateMessageAsRead";
62
+ UserOperation[UserOperation["GetPrivateMessages"] = 52] = "GetPrivateMessages";
63
+ UserOperation[UserOperation["UserJoin"] = 53] = "UserJoin";
64
+ UserOperation[UserOperation["GetComments"] = 54] = "GetComments";
65
+ UserOperation[UserOperation["GetSiteConfig"] = 55] = "GetSiteConfig";
66
+ UserOperation[UserOperation["SaveSiteConfig"] = 56] = "SaveSiteConfig";
67
+ UserOperation[UserOperation["PostJoin"] = 57] = "PostJoin";
68
+ UserOperation[UserOperation["CommunityJoin"] = 58] = "CommunityJoin";
69
+ UserOperation[UserOperation["ChangePassword"] = 59] = "ChangePassword";
70
+ UserOperation[UserOperation["GetSiteMetadata"] = 60] = "GetSiteMetadata";
71
+ UserOperation[UserOperation["BlockCommunity"] = 61] = "BlockCommunity";
72
+ UserOperation[UserOperation["BlockPerson"] = 62] = "BlockPerson";
73
+ UserOperation[UserOperation["CreateCommentReport"] = 63] = "CreateCommentReport";
74
+ UserOperation[UserOperation["ResolveCommentReport"] = 64] = "ResolveCommentReport";
75
+ UserOperation[UserOperation["ListCommentReports"] = 65] = "ListCommentReports";
76
+ UserOperation[UserOperation["CreatePostReport"] = 66] = "CreatePostReport";
77
+ UserOperation[UserOperation["ResolvePostReport"] = 67] = "ResolvePostReport";
78
+ UserOperation[UserOperation["ListPostReports"] = 68] = "ListPostReports";
79
+ UserOperation[UserOperation["GetReportCount"] = 69] = "GetReportCount";
71
80
  })(UserOperation = exports.UserOperation || (exports.UserOperation = {}));
81
+ /**
82
+ * Different sort types used in lemmy.
83
+ */
72
84
  var SortType;
73
85
  (function (SortType) {
86
+ /**
87
+ * Posts sorted by the most recent comment.
88
+ */
74
89
  SortType["Active"] = "Active";
90
+ /**
91
+ * Posts sorted by the published time.
92
+ */
75
93
  SortType["Hot"] = "Hot";
76
94
  SortType["New"] = "New";
95
+ /**
96
+ * The top posts for this last day.
97
+ */
77
98
  SortType["TopDay"] = "TopDay";
99
+ /**
100
+ * The top posts for this last week.
101
+ */
78
102
  SortType["TopWeek"] = "TopWeek";
103
+ /**
104
+ * The top posts for this last month.
105
+ */
79
106
  SortType["TopMonth"] = "TopMonth";
107
+ /**
108
+ * The top posts for this last year.
109
+ */
80
110
  SortType["TopYear"] = "TopYear";
111
+ /**
112
+ * The top posts of all time.
113
+ */
81
114
  SortType["TopAll"] = "TopAll";
115
+ /**
116
+ * Posts sorted by the most comments.
117
+ */
82
118
  SortType["MostComments"] = "MostComments";
119
+ /**
120
+ * Posts sorted by the newest comments, with no necrobumping. IE a forum sort.
121
+ */
83
122
  SortType["NewComments"] = "NewComments";
84
123
  })(SortType = exports.SortType || (exports.SortType = {}));
124
+ /**
125
+ * The different listing types for post and comment fetches.
126
+ */
85
127
  var ListingType;
86
128
  (function (ListingType) {
87
129
  ListingType["All"] = "All";
@@ -89,6 +131,9 @@ var ListingType;
89
131
  ListingType["Subscribed"] = "Subscribed";
90
132
  ListingType["Community"] = "Community";
91
133
  })(ListingType = exports.ListingType || (exports.ListingType = {}));
134
+ /**
135
+ * Search types for lemmy's search.
136
+ */
92
137
  var SearchType;
93
138
  (function (SearchType) {
94
139
  SearchType["All"] = "All";
@@ -166,6 +166,14 @@ export interface ModAddCommunity {
166
166
  removed?: boolean;
167
167
  when_: string;
168
168
  }
169
+ export interface ModTransferCommunity {
170
+ id: number;
171
+ mod_person_id: number;
172
+ other_person_id: number;
173
+ community_id: number;
174
+ removed?: boolean;
175
+ when_: string;
176
+ }
169
177
  export interface ModAdd {
170
178
  id: number;
171
179
  mod_person_id: number;
@@ -1,5 +1,5 @@
1
1
  import { CommentAggregates, CommunityAggregates, PostAggregates, SiteAggregates, PersonAggregates } from './aggregates';
2
- import { Comment, CommentReport, CommunitySafe, ModAdd, ModAddCommunity, ModBan, ModBanFromCommunity, ModLockPost, ModRemoveComment, ModRemoveCommunity, ModRemovePost, ModStickyPost, Post, PostReport, PrivateMessage, Site, PersonMention, PersonSafe, LocalUserSettings } from './source';
2
+ import { Comment, CommentReport, CommunitySafe, ModAdd, ModAddCommunity, ModTransferCommunity, ModBan, ModBanFromCommunity, ModLockPost, ModRemoveComment, ModRemoveCommunity, ModRemovePost, ModStickyPost, Post, PostReport, PrivateMessage, Site, PersonMention, PersonSafe, LocalUserSettings } from './source';
3
3
  export interface PersonViewSafe {
4
4
  person: PersonSafe;
5
5
  counts: PersonAggregates;
@@ -81,6 +81,12 @@ export interface ModAddCommunityView {
81
81
  community: CommunitySafe;
82
82
  modded_person: PersonSafe;
83
83
  }
84
+ export interface ModTransferCommunityView {
85
+ mod_transfer_community: ModTransferCommunity;
86
+ moderator: PersonSafe;
87
+ community: CommunitySafe;
88
+ modded_person: PersonSafe;
89
+ }
84
90
  export interface ModAddView {
85
91
  mod_add: ModAdd;
86
92
  moderator: PersonSafe;
@@ -1,73 +1,304 @@
1
- import { CreateComment, CreateCommentLike, DeleteComment, EditComment, GetComments, MarkCommentAsRead, RemoveComment, SaveComment } from './interfaces/api/comment';
1
+ import { CreateComment, CreateCommentLike, CreateCommentReport, DeleteComment, EditComment, GetComments, ListCommentReports, MarkCommentAsRead, 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 { CreatePost, CreatePostLike, DeletePost, EditPost, GetPost, GetPosts, LockPost, RemovePost, SavePost, StickyPost } from './interfaces/api/post';
4
- import { CreateSite, EditSite, GetModlog, GetSite, GetSiteConfig, SaveSiteConfig, Search, TransferSite } from './interfaces/api/site';
5
- import { AddAdmin, BanPerson, CreatePrivateMessage, DeleteAccount, DeletePrivateMessage, EditPrivateMessage, GetPrivateMessages, GetReplies, GetPersonDetails, GetPersonMentions, Login, MarkAllAsRead, MarkPrivateMessageAsRead, MarkPersonMentionAsRead, PasswordChange, PasswordReset, Register, SaveUserSettings, ChangePassword, BlockPerson } from './interfaces/api/person';
3
+ import { CreatePost, CreatePostLike, CreatePostReport, DeletePost, EditPost, GetPost, GetPosts, GetSiteMetadata, ListPostReports, LockPost, RemovePost, ResolvePostReport, SavePost, StickyPost } from './interfaces/api/post';
4
+ import { CreateSite, EditSite, GetModlog, GetSite, GetSiteConfig, ResolveObject, SaveSiteConfig, Search, TransferSite } from './interfaces/api/site';
5
+ import { AddAdmin, BanPerson, CreatePrivateMessage, DeleteAccount, DeletePrivateMessage, EditPrivateMessage, GetPrivateMessages, GetReplies, GetPersonDetails, GetPersonMentions, Login, MarkAllAsRead, MarkPrivateMessageAsRead, MarkPersonMentionAsRead, PasswordChange, PasswordReset, Register, SaveUserSettings, ChangePassword, BlockPerson, GetReportCount } from './interfaces/api/person';
6
6
  import { UserJoin, PostJoin, CommunityJoin } from './interfaces/api/websocket';
7
7
  /**
8
- * Helps build lemmy websocket message requests, that you can use in your Websocket sends
8
+ * Helps build lemmy websocket message requests, that you can use in your Websocket sends.
9
+ *
10
+ * You'll receive back a [[WebSocketResponse]].
11
+ *
12
+ * The return types for these are given in [[LemmyHttp]]
9
13
  */
10
14
  export declare class LemmyWebsocket {
11
15
  constructor();
16
+ /**
17
+ * Log into lemmy.
18
+ */
12
19
  login(form: Login): string;
20
+ /**
21
+ * A websocket join for your user.
22
+ *
23
+ * Allows your user to receive private messages and notifications.
24
+ */
13
25
  userJoin(form: UserJoin): string;
26
+ /**
27
+ * A websocket join for the current post room.
28
+ *
29
+ * Allows your user to receive new comments and updates for that post.
30
+ */
14
31
  postJoin(form: PostJoin): string;
32
+ /**
33
+ * A websocket join for a given community.
34
+ *
35
+ * Allows your user to receive community updates.
36
+ *
37
+ * Note: community_id: 0, is your front page.
38
+ */
15
39
  communityJoin(form: CommunityJoin): string;
40
+ /**
41
+ * Register a new user.
42
+ */
16
43
  register(register: Register): string;
44
+ /**
45
+ * Fetch a Captcha.
46
+ */
17
47
  getCaptcha(): string;
48
+ /**
49
+ * Create a new community.
50
+ */
18
51
  createCommunity(form: CreateCommunity): string;
52
+ /**
53
+ * Edit a community.
54
+ */
19
55
  editCommunity(form: EditCommunity): string;
56
+ /**
57
+ * Delete a community.
58
+ */
20
59
  deleteCommunity(form: DeleteCommunity): string;
60
+ /**
61
+ * A moderator remove for a community.
62
+ */
21
63
  removeCommunity(form: RemoveCommunity): string;
64
+ /**
65
+ * Follow / subscribe to a community.
66
+ */
22
67
  followCommunity(form: FollowCommunity): string;
68
+ /**
69
+ * List communities, with various filters.
70
+ */
23
71
  listCommunities(form: ListCommunities): string;
72
+ /**
73
+ * Create a post.
74
+ */
24
75
  createPost(form: CreatePost): string;
76
+ /**
77
+ * Get / fetch a post.
78
+ */
25
79
  getPost(form: GetPost): string;
80
+ /**
81
+ * Get / fetch a community.
82
+ */
26
83
  getCommunity(form: GetCommunity): string;
84
+ /**
85
+ * Create a comment.
86
+ */
27
87
  createComment(form: CreateComment): string;
88
+ /**
89
+ * Edit a comment.
90
+ */
28
91
  editComment(form: EditComment): string;
92
+ /**
93
+ * Delete a comment.
94
+ */
29
95
  deleteComment(form: DeleteComment): string;
96
+ /**
97
+ * A moderator remove for a comment.
98
+ */
30
99
  removeComment(form: RemoveComment): string;
100
+ /**
101
+ * Mark a comment as read.
102
+ */
31
103
  markCommentAsRead(form: MarkCommentAsRead): string;
104
+ /**
105
+ * Like / vote on a comment.
106
+ */
32
107
  likeComment(form: CreateCommentLike): string;
108
+ /**
109
+ * Save a comment.
110
+ */
33
111
  saveComment(form: SaveComment): string;
112
+ /**
113
+ * Report a comment.
114
+ */
115
+ createCommentReport(form: CreateCommentReport): string;
116
+ /**
117
+ * Resolve a comment report. Only a mod can do this.
118
+ */
119
+ resolveCommentReport(form: ResolveCommentReport): string;
120
+ /**
121
+ * List comment reports.
122
+ */
123
+ listCommentReports(form: ListCommentReports): string;
124
+ /**
125
+ * Get / fetch posts, with various filters.
126
+ */
34
127
  getPosts(form: GetPosts): string;
128
+ /**
129
+ * Get / fetch comments.
130
+ */
35
131
  getComments(form: GetComments): string;
132
+ /**
133
+ * Like / vote on a post.
134
+ */
36
135
  likePost(form: CreatePostLike): string;
136
+ /**
137
+ * Edit a post.
138
+ */
37
139
  editPost(form: EditPost): string;
140
+ /**
141
+ * Delete a post.
142
+ */
38
143
  deletePost(form: DeletePost): string;
144
+ /**
145
+ * A moderator remove for a post.
146
+ */
39
147
  removePost(form: RemovePost): string;
148
+ /**
149
+ * A moderator can lock a post ( IE disable new comments ).
150
+ */
40
151
  lockPost(form: LockPost): string;
152
+ /**
153
+ * A moderator can sticky a post ( IE stick it to the top of a community ).
154
+ */
41
155
  stickyPost(form: StickyPost): string;
156
+ /**
157
+ * Save a post.
158
+ */
42
159
  savePost(form: SavePost): string;
160
+ /**
161
+ * Report a post.
162
+ */
163
+ createPostReport(form: CreatePostReport): string;
164
+ /**
165
+ * Resolve a post report. Only a mod can do this.
166
+ */
167
+ resolvePostReport(form: ResolvePostReport): string;
168
+ /**
169
+ * List post reports.
170
+ */
171
+ listPostReports(form: ListPostReports): string;
172
+ /**
173
+ * Fetch metadata for any given site.
174
+ */
175
+ getSiteMetadata(form: GetSiteMetadata): string;
176
+ /**
177
+ * Ban a user from a community.
178
+ */
43
179
  banFromCommunity(form: BanFromCommunity): string;
180
+ /**
181
+ * Add a moderator to your community.
182
+ */
44
183
  addModToCommunity(form: AddModToCommunity): string;
184
+ /**
185
+ * Transfer your community to an existing moderator.
186
+ */
45
187
  transferCommunity(form: TransferCommunity): string;
188
+ /**
189
+ * Transfer your site to another user.
190
+ */
46
191
  transferSite(form: TransferSite): string;
192
+ /**
193
+ * Ban a person from your site.
194
+ */
47
195
  banPerson(form: BanPerson): string;
196
+ /**
197
+ * Add an admin to your site.
198
+ */
48
199
  addAdmin(form: AddAdmin): string;
200
+ /**
201
+ * Get the details for a person.
202
+ */
49
203
  getPersonDetails(form: GetPersonDetails): string;
204
+ /**
205
+ * Get comment replies.
206
+ */
50
207
  getReplies(form: GetReplies): string;
208
+ /**
209
+ * Get mentions for your user.
210
+ */
51
211
  getPersonMentions(form: GetPersonMentions): string;
212
+ /**
213
+ * Mark a person mention as read.
214
+ */
52
215
  markPersonMentionAsRead(form: MarkPersonMentionAsRead): string;
216
+ /**
217
+ * Get the modlog.
218
+ */
53
219
  getModlog(form: GetModlog): string;
220
+ /**
221
+ * Create your site.
222
+ */
54
223
  createSite(form: CreateSite): string;
224
+ /**
225
+ * Edit your site.
226
+ */
55
227
  editSite(form: EditSite): string;
228
+ /**
229
+ * Gets the site, and your user data.
230
+ */
56
231
  getSite(form?: GetSite): string;
232
+ /**
233
+ * Get your site configuration.
234
+ */
57
235
  getSiteConfig(form: GetSiteConfig): string;
236
+ /**
237
+ * Search lemmy.
238
+ */
58
239
  search(form: Search): string;
240
+ /**
241
+ * Fetch a non-local / federated object.
242
+ */
243
+ resolveObject(form: ResolveObject): string;
244
+ /**
245
+ * Mark all replies as read.
246
+ */
59
247
  markAllAsRead(form: MarkAllAsRead): string;
248
+ /**
249
+ * Save your user settings.
250
+ */
60
251
  saveUserSettings(form: SaveUserSettings): string;
252
+ /**
253
+ * Change your user password.
254
+ */
61
255
  changePassword(form: ChangePassword): string;
256
+ /**
257
+ * Get counts for your reports
258
+ */
259
+ getReportCount(form: GetReportCount): string;
260
+ /**
261
+ * Delete your account.
262
+ */
62
263
  deleteAccount(form: DeleteAccount): string;
264
+ /**
265
+ * Reset your password.
266
+ */
63
267
  passwordReset(form: PasswordReset): string;
268
+ /**
269
+ * Change your password from an email / token based reset.
270
+ */
64
271
  passwordChange(form: PasswordChange): string;
272
+ /**
273
+ * Create a private message.
274
+ */
65
275
  createPrivateMessage(form: CreatePrivateMessage): string;
276
+ /**
277
+ * Edit a private message.
278
+ */
66
279
  editPrivateMessage(form: EditPrivateMessage): string;
280
+ /**
281
+ * Delete a private message.
282
+ */
67
283
  deletePrivateMessage(form: DeletePrivateMessage): string;
284
+ /**
285
+ * Mark a private message as read.
286
+ */
68
287
  markPrivateMessageAsRead(form: MarkPrivateMessageAsRead): string;
288
+ /**
289
+ * Get / fetch private messages.
290
+ */
69
291
  getPrivateMessages(form: GetPrivateMessages): string;
292
+ /**
293
+ * Save your site config.
294
+ */
70
295
  saveSiteConfig(form: SaveSiteConfig): string;
296
+ /**
297
+ * Block a person.
298
+ */
71
299
  blockPerson(form: BlockPerson): string;
300
+ /**
301
+ * Block a community.
302
+ */
72
303
  blockCommunity(form: BlockCommunity): string;
73
304
  }