lemmy-js-client 0.17.0-rc.11 → 0.17.0-rc.12

Sign up to get free protection for your applications and to get access to all the features.
package/dist/http.d.ts CHANGED
@@ -2,7 +2,7 @@ import { CommentReportResponse, CommentResponse, CreateComment, CreateCommentLik
2
2
  import { AddModToCommunity, AddModToCommunityResponse, BanFromCommunity, BanFromCommunityResponse, BlockCommunity, BlockCommunityResponse, CommunityResponse, CreateCommunity, DeleteCommunity, EditCommunity, FollowCommunity, GetCommunity, GetCommunityResponse, ListCommunities, ListCommunitiesResponse, RemoveCommunity, TransferCommunity } from "./interfaces/api/community";
3
3
  import { AddAdmin, AddAdminResponse, BannedPersonsResponse, BanPerson, BanPersonResponse, BlockPerson, BlockPersonResponse, ChangePassword, CreatePrivateMessage, DeleteAccount, DeleteAccountResponse, DeletePrivateMessage, EditPrivateMessage, GetBannedPersons, GetCaptchaResponse, GetPersonDetails, GetPersonDetailsResponse, GetPersonMentions, GetPersonMentionsResponse, GetPrivateMessages, GetReplies, GetRepliesResponse, GetReportCount, GetReportCountResponse, GetUnreadCount, GetUnreadCountResponse, Login, LoginResponse, MarkAllAsRead, MarkPersonMentionAsRead, MarkPrivateMessageAsRead, PasswordChange, PasswordReset, PasswordResetResponse, PersonMentionResponse, PrivateMessageResponse, PrivateMessagesResponse, Register, SaveUserSettings, VerifyEmail, VerifyEmailResponse } from "./interfaces/api/person";
4
4
  import { CreatePost, CreatePostLike, CreatePostReport, DeletePost, EditPost, GetPost, GetPostResponse, GetPosts, GetPostsResponse, GetSiteMetadata, GetSiteMetadataResponse, ListPostReports, ListPostReportsResponse, LockPost, MarkPostAsRead, PostReportResponse, PostResponse, RemovePost, ResolvePostReport, SavePost, StickyPost } from "./interfaces/api/post";
5
- import { ApproveRegistrationApplication, CreateSite, EditSite, GetModlog, GetModlogResponse, GetSite, GetSiteConfig, GetSiteConfigResponse, GetSiteResponse, GetUnreadRegistrationApplicationCount, GetUnreadRegistrationApplicationCountResponse, LeaveAdmin, ListRegistrationApplications, ListRegistrationApplicationsResponse, RegistrationApplicationResponse, ResolveObject, ResolveObjectResponse, SaveSiteConfig, Search, SearchResponse, SiteResponse } from "./interfaces/api/site";
5
+ import { ApproveRegistrationApplication, CreateSite, EditSite, GetModlog, GetModlogResponse, GetSite, GetSiteConfig, GetSiteConfigResponse, GetSiteResponse, GetUnreadRegistrationApplicationCount, GetUnreadRegistrationApplicationCountResponse, LeaveAdmin, ListRegistrationApplications, ListRegistrationApplicationsResponse, PurgeComment, PurgeCommunity, PurgeItemResponse, PurgePerson, PurgePost, RegistrationApplicationResponse, ResolveObject, ResolveObjectResponse, SaveSiteConfig, Search, SearchResponse, SiteResponse } from "./interfaces/api/site";
6
6
  /**
7
7
  * Helps build lemmy HTTP requests.
8
8
  */
@@ -387,6 +387,26 @@ export declare class LemmyHttp {
387
387
  * `HTTP.PUT /admin/registration_application/approve`
388
388
  */
389
389
  approveRegistrationApplication(form: ApproveRegistrationApplication): Promise<RegistrationApplicationResponse>;
390
+ /**
391
+ * Purge / Delete a person from the database.
392
+ * `HTTP.POST /admin/purge/person`
393
+ */
394
+ purgePerson(form: PurgePerson): Promise<PurgeItemResponse>;
395
+ /**
396
+ * Purge / Delete a community from the database.
397
+ * `HTTP.POST /admin/purge/community`
398
+ */
399
+ purgeCommunity(form: PurgeCommunity): Promise<PurgeItemResponse>;
400
+ /**
401
+ * Purge / Delete a post from the database.
402
+ * `HTTP.POST /admin/purge/post`
403
+ */
404
+ purgePost(form: PurgePost): Promise<PurgeItemResponse>;
405
+ /**
406
+ * Purge / Delete a comment from the database.
407
+ * `HTTP.POST /admin/purge/comment`
408
+ */
409
+ purgeComment(form: PurgeComment): Promise<PurgeItemResponse>;
390
410
  private buildFullUrl;
391
411
  private wrapper;
392
412
  }
package/dist/http.js CHANGED
@@ -886,6 +886,50 @@ var LemmyHttp = /** @class */ (function () {
886
886
  });
887
887
  });
888
888
  };
889
+ /**
890
+ * Purge / Delete a person from the database.
891
+ * `HTTP.POST /admin/purge/person`
892
+ */
893
+ LemmyHttp.prototype.purgePerson = function (form) {
894
+ return __awaiter(this, void 0, void 0, function () {
895
+ return __generator(this, function (_a) {
896
+ return [2 /*return*/, this.wrapper(HttpType.Post, "/admin/purge/person", form)];
897
+ });
898
+ });
899
+ };
900
+ /**
901
+ * Purge / Delete a community from the database.
902
+ * `HTTP.POST /admin/purge/community`
903
+ */
904
+ LemmyHttp.prototype.purgeCommunity = function (form) {
905
+ return __awaiter(this, void 0, void 0, function () {
906
+ return __generator(this, function (_a) {
907
+ return [2 /*return*/, this.wrapper(HttpType.Post, "/admin/purge/community", form)];
908
+ });
909
+ });
910
+ };
911
+ /**
912
+ * Purge / Delete a post from the database.
913
+ * `HTTP.POST /admin/purge/post`
914
+ */
915
+ LemmyHttp.prototype.purgePost = function (form) {
916
+ return __awaiter(this, void 0, void 0, function () {
917
+ return __generator(this, function (_a) {
918
+ return [2 /*return*/, this.wrapper(HttpType.Post, "/admin/purge/post", form)];
919
+ });
920
+ });
921
+ };
922
+ /**
923
+ * Purge / Delete a comment from the database.
924
+ * `HTTP.POST /admin/purge/comment`
925
+ */
926
+ LemmyHttp.prototype.purgeComment = function (form) {
927
+ return __awaiter(this, void 0, void 0, function () {
928
+ return __generator(this, function (_a) {
929
+ return [2 /*return*/, this.wrapper(HttpType.Post, "/admin/purge/comment", form)];
930
+ });
931
+ });
932
+ };
889
933
  LemmyHttp.prototype.buildFullUrl = function (endpoint) {
890
934
  return "".concat(this.apiUrl).concat(endpoint);
891
935
  };
@@ -1,5 +1,5 @@
1
1
  import { ListingType, SearchType, SortType } from "../others";
2
- import { CommentView, CommunityBlockView, CommunityFollowerView, CommunityModeratorView, CommunityView, LocalUserSettingsView, ModAddCommunityView, ModAddView, ModBanFromCommunityView, ModBanView, ModLockPostView, ModRemoveCommentView, ModRemoveCommunityView, ModRemovePostView, ModStickyPostView, ModTransferCommunityView, PersonBlockView, PersonViewSafe, PostView, RegistrationApplicationView, SiteView } from "../views";
2
+ import { AdminPurgeCommentView, AdminPurgeCommunityView, AdminPurgePersonView, AdminPurgePostView, CommentView, CommunityBlockView, CommunityFollowerView, CommunityModeratorView, CommunityView, LocalUserSettingsView, ModAddCommunityView, ModAddView, ModBanFromCommunityView, ModBanView, ModLockPostView, ModRemoveCommentView, ModRemoveCommunityView, ModRemovePostView, ModStickyPostView, ModTransferCommunityView, PersonBlockView, PersonViewSafe, PostView, RegistrationApplicationView, SiteView } from "../views";
3
3
  /**
4
4
  * Search lemmy for different types of data.
5
5
  */
@@ -46,6 +46,10 @@ export interface GetModlogResponse {
46
46
  added_to_community: ModAddCommunityView[];
47
47
  transferred_to_community: ModTransferCommunityView[];
48
48
  added: ModAddView[];
49
+ admin_purged_persons: AdminPurgePersonView[];
50
+ admin_purged_communities: AdminPurgeCommunityView[];
51
+ admin_purged_posts: AdminPurgePostView[];
52
+ admin_purged_comments: AdminPurgeCommentView[];
49
53
  }
50
54
  export interface CreateSite {
51
55
  name: string;
@@ -142,6 +146,29 @@ export interface ResolveObjectResponse {
142
146
  community?: CommunityView;
143
147
  person?: PersonViewSafe;
144
148
  }
149
+ export interface PurgePerson {
150
+ person_id: number;
151
+ reason?: string;
152
+ auth: string;
153
+ }
154
+ export interface PurgeCommunity {
155
+ community_id: number;
156
+ reason?: string;
157
+ auth: string;
158
+ }
159
+ export interface PurgePost {
160
+ post_id: number;
161
+ reason?: string;
162
+ auth: string;
163
+ }
164
+ export interface PurgeComment {
165
+ comment_id: number;
166
+ reason?: string;
167
+ auth: string;
168
+ }
169
+ export interface PurgeItemResponse {
170
+ success: boolean;
171
+ }
145
172
  export interface ListRegistrationApplications {
146
173
  /**
147
174
  * Only shows the unread applications (IE those without an admin actor)
@@ -71,15 +71,19 @@ export declare enum UserOperation {
71
71
  GetSiteMetadata = 65,
72
72
  BlockCommunity = 66,
73
73
  BlockPerson = 67,
74
- CreateCommentReport = 68,
75
- ResolveCommentReport = 69,
76
- ListCommentReports = 70,
77
- CreatePostReport = 71,
78
- ResolvePostReport = 72,
79
- ListPostReports = 73,
80
- GetReportCount = 74,
81
- GetUnreadCount = 75,
82
- VerifyEmail = 76
74
+ PurgePerson = 68,
75
+ PurgeCommunity = 69,
76
+ PurgePost = 70,
77
+ PurgeComment = 71,
78
+ CreateCommentReport = 72,
79
+ ResolveCommentReport = 73,
80
+ ListCommentReports = 74,
81
+ CreatePostReport = 75,
82
+ ResolvePostReport = 76,
83
+ ListPostReports = 77,
84
+ GetReportCount = 78,
85
+ GetUnreadCount = 79,
86
+ VerifyEmail = 80
83
87
  }
84
88
  /**
85
89
  * Different sort types used in lemmy.
@@ -143,14 +147,6 @@ export declare enum SearchType {
143
147
  Users = "Users",
144
148
  Url = "Url"
145
149
  }
146
- /**
147
- * Different Subscribed states
148
- */
149
- export declare enum SubscribedType {
150
- Subscribed = "Subscribed",
151
- NotSubscribed = "NotSubscribed",
152
- Pending = "Pending"
153
- }
154
150
  /**
155
151
  * A websocket response. Includes the return type.
156
152
  * Can be used like:
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SubscribedType = exports.SearchType = exports.ListingType = exports.SortType = exports.UserOperation = exports.VERSION = void 0;
3
+ exports.SearchType = exports.ListingType = exports.SortType = exports.UserOperation = exports.VERSION = void 0;
4
4
  exports.VERSION = "v3";
5
5
  /**
6
6
  * All of the websocket operations available.
@@ -75,15 +75,19 @@ var UserOperation;
75
75
  UserOperation[UserOperation["GetSiteMetadata"] = 65] = "GetSiteMetadata";
76
76
  UserOperation[UserOperation["BlockCommunity"] = 66] = "BlockCommunity";
77
77
  UserOperation[UserOperation["BlockPerson"] = 67] = "BlockPerson";
78
- UserOperation[UserOperation["CreateCommentReport"] = 68] = "CreateCommentReport";
79
- UserOperation[UserOperation["ResolveCommentReport"] = 69] = "ResolveCommentReport";
80
- UserOperation[UserOperation["ListCommentReports"] = 70] = "ListCommentReports";
81
- UserOperation[UserOperation["CreatePostReport"] = 71] = "CreatePostReport";
82
- UserOperation[UserOperation["ResolvePostReport"] = 72] = "ResolvePostReport";
83
- UserOperation[UserOperation["ListPostReports"] = 73] = "ListPostReports";
84
- UserOperation[UserOperation["GetReportCount"] = 74] = "GetReportCount";
85
- UserOperation[UserOperation["GetUnreadCount"] = 75] = "GetUnreadCount";
86
- UserOperation[UserOperation["VerifyEmail"] = 76] = "VerifyEmail";
78
+ UserOperation[UserOperation["PurgePerson"] = 68] = "PurgePerson";
79
+ UserOperation[UserOperation["PurgeCommunity"] = 69] = "PurgeCommunity";
80
+ UserOperation[UserOperation["PurgePost"] = 70] = "PurgePost";
81
+ UserOperation[UserOperation["PurgeComment"] = 71] = "PurgeComment";
82
+ UserOperation[UserOperation["CreateCommentReport"] = 72] = "CreateCommentReport";
83
+ UserOperation[UserOperation["ResolveCommentReport"] = 73] = "ResolveCommentReport";
84
+ UserOperation[UserOperation["ListCommentReports"] = 74] = "ListCommentReports";
85
+ UserOperation[UserOperation["CreatePostReport"] = 75] = "CreatePostReport";
86
+ UserOperation[UserOperation["ResolvePostReport"] = 76] = "ResolvePostReport";
87
+ UserOperation[UserOperation["ListPostReports"] = 77] = "ListPostReports";
88
+ UserOperation[UserOperation["GetReportCount"] = 78] = "GetReportCount";
89
+ UserOperation[UserOperation["GetUnreadCount"] = 79] = "GetUnreadCount";
90
+ UserOperation[UserOperation["VerifyEmail"] = 80] = "VerifyEmail";
87
91
  })(UserOperation = exports.UserOperation || (exports.UserOperation = {}));
88
92
  /**
89
93
  * Different sort types used in lemmy.
@@ -150,12 +154,3 @@ var SearchType;
150
154
  SearchType["Users"] = "Users";
151
155
  SearchType["Url"] = "Url";
152
156
  })(SearchType = exports.SearchType || (exports.SearchType = {}));
153
- /**
154
- * Different Subscribed states
155
- */
156
- var SubscribedType;
157
- (function (SubscribedType) {
158
- SubscribedType["Subscribed"] = "Subscribed";
159
- SubscribedType["NotSubscribed"] = "NotSubscribed";
160
- SubscribedType["Pending"] = "Pending";
161
- })(SubscribedType = exports.SubscribedType || (exports.SubscribedType = {}));
@@ -194,6 +194,32 @@ export interface ModAdd {
194
194
  removed?: boolean;
195
195
  when_: string;
196
196
  }
197
+ export interface AdminPurgePerson {
198
+ id: number;
199
+ admin_person_id: number;
200
+ reason?: string;
201
+ when_: string;
202
+ }
203
+ export interface AdminPurgeCommunity {
204
+ id: number;
205
+ admin_person_id: number;
206
+ reason?: string;
207
+ when_: string;
208
+ }
209
+ export interface AdminPurgePost {
210
+ id: number;
211
+ admin_person_id: number;
212
+ community_id: number;
213
+ reason?: string;
214
+ when_: string;
215
+ }
216
+ export interface AdminPurgeComment {
217
+ id: number;
218
+ admin_person_id: number;
219
+ post_id: number;
220
+ reason?: string;
221
+ when_: string;
222
+ }
197
223
  export interface CommunitySafe {
198
224
  id: number;
199
225
  name: string;
@@ -1,6 +1,5 @@
1
1
  import { CommentAggregates, CommunityAggregates, PersonAggregates, PostAggregates, SiteAggregates } from "./aggregates";
2
- import { SubscribedType } from "./others";
3
- import { Comment, CommentReport, CommunitySafe, LocalUserSettings, ModAdd, ModAddCommunity, ModBan, ModBanFromCommunity, ModLockPost, ModRemoveComment, ModRemoveCommunity, ModRemovePost, ModStickyPost, ModTransferCommunity, PersonMention, PersonSafe, Post, PostReport, PrivateMessage, RegistrationApplication, Site } from "./source";
2
+ import { AdminPurgeComment, AdminPurgeCommunity, AdminPurgePerson, AdminPurgePost, Comment, CommentReport, CommunitySafe, LocalUserSettings, ModAdd, ModAddCommunity, ModBan, ModBanFromCommunity, ModLockPost, ModRemoveComment, ModRemoveCommunity, ModRemovePost, ModStickyPost, ModTransferCommunity, PersonMention, PersonSafe, Post, PostReport, PrivateMessage, RegistrationApplication, Site } from "./source";
4
3
  export interface PersonViewSafe {
5
4
  person: PersonSafe;
6
5
  counts: PersonAggregates;
@@ -14,7 +13,7 @@ export interface PersonMentionView {
14
13
  recipient: PersonSafe;
15
14
  counts: CommentAggregates;
16
15
  creator_banned_from_community: boolean;
17
- subscribed: SubscribedType;
16
+ subscribed: boolean;
18
17
  saved: boolean;
19
18
  creator_blocked: boolean;
20
19
  my_vote?: number;
@@ -39,7 +38,7 @@ export interface PostView {
39
38
  community: CommunitySafe;
40
39
  creator_banned_from_community: boolean;
41
40
  counts: PostAggregates;
42
- subscribed: SubscribedType;
41
+ subscribed: boolean;
43
42
  saved: boolean;
44
43
  read: boolean;
45
44
  creator_blocked: boolean;
@@ -64,7 +63,7 @@ export interface CommentView {
64
63
  community: CommunitySafe;
65
64
  counts: CommentAggregates;
66
65
  creator_banned_from_community: boolean;
67
- subscribed: SubscribedType;
66
+ subscribed: boolean;
68
67
  saved: boolean;
69
68
  creator_blocked: boolean;
70
69
  my_vote?: number;
@@ -140,10 +139,27 @@ export interface ModStickyPostView {
140
139
  post: Post;
141
140
  community: CommunitySafe;
142
141
  }
142
+ export interface AdminPurgeCommunityView {
143
+ admin_purge_community: AdminPurgeCommunity;
144
+ admin: PersonSafe;
145
+ }
146
+ export interface AdminPurgePersonView {
147
+ admin_purge_person: AdminPurgePerson;
148
+ admin: PersonSafe;
149
+ }
150
+ export interface AdminPurgePostView {
151
+ admin_purge_post: AdminPurgePost;
152
+ admin: PersonSafe;
153
+ community: CommunitySafe;
154
+ }
155
+ export interface AdminPurgeCommentView {
156
+ admin_purge_comment: AdminPurgeComment;
157
+ admin: PersonSafe;
158
+ post: Post;
159
+ }
143
160
  export interface CommunityFollowerView {
144
161
  community: CommunitySafe;
145
162
  follower: PersonSafe;
146
- pending: boolean;
147
163
  }
148
164
  export interface CommunityBlockView {
149
165
  person: PersonSafe;
@@ -163,7 +179,7 @@ export interface PersonBlockView {
163
179
  }
164
180
  export interface CommunityView {
165
181
  community: CommunitySafe;
166
- subscribed: SubscribedType;
182
+ subscribed: boolean;
167
183
  blocked: boolean;
168
184
  counts: CommunityAggregates;
169
185
  }
@@ -2,7 +2,7 @@ import { CreateComment, CreateCommentLike, CreateCommentReport, DeleteComment, E
2
2
  import { AddModToCommunity, BanFromCommunity, BlockCommunity, CreateCommunity, DeleteCommunity, EditCommunity, FollowCommunity, GetCommunity, ListCommunities, RemoveCommunity, TransferCommunity } from "./interfaces/api/community";
3
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
4
  import { CreatePost, CreatePostLike, CreatePostReport, DeletePost, EditPost, GetPost, GetPosts, GetSiteMetadata, ListPostReports, LockPost, MarkPostAsRead, RemovePost, ResolvePostReport, SavePost, StickyPost } from "./interfaces/api/post";
5
- import { ApproveRegistrationApplication, CreateSite, EditSite, GetModlog, GetSite, GetSiteConfig, GetUnreadRegistrationApplicationCount, LeaveAdmin, ListRegistrationApplications, ResolveObject, SaveSiteConfig, Search } from "./interfaces/api/site";
5
+ import { ApproveRegistrationApplication, CreateSite, EditSite, GetModlog, GetSite, GetSiteConfig, GetUnreadRegistrationApplicationCount, LeaveAdmin, ListRegistrationApplications, PurgeComment, PurgeCommunity, PurgePerson, PurgePost, ResolveObject, SaveSiteConfig, Search } from "./interfaces/api/site";
6
6
  import { CommunityJoin, PostJoin, UserJoin } from "./interfaces/api/websocket";
7
7
  /**
8
8
  * Helps build lemmy websocket message requests, that you can use in your Websocket sends.
@@ -329,4 +329,20 @@ export declare class LemmyWebsocket {
329
329
  * Block a community.
330
330
  */
331
331
  blockCommunity(form: BlockCommunity): string;
332
+ /**
333
+ * Purge / Delete a person from the database.
334
+ */
335
+ purgePerson(form: PurgePerson): string;
336
+ /**
337
+ * Purge / Delete a community from the database.
338
+ */
339
+ purgeCommunity(form: PurgeCommunity): string;
340
+ /**
341
+ * Purge / Delete a post from the database.
342
+ */
343
+ purgePost(form: PurgePost): string;
344
+ /**
345
+ * Purge / Delete a comment from the database.
346
+ */
347
+ purgeComment(form: PurgeComment): string;
332
348
  }
package/dist/websocket.js CHANGED
@@ -483,6 +483,30 @@ var LemmyWebsocket = /** @class */ (function () {
483
483
  LemmyWebsocket.prototype.blockCommunity = function (form) {
484
484
  return wrapper(others_1.UserOperation.BlockCommunity, form);
485
485
  };
486
+ /**
487
+ * Purge / Delete a person from the database.
488
+ */
489
+ LemmyWebsocket.prototype.purgePerson = function (form) {
490
+ return wrapper(others_1.UserOperation.PurgePerson, form);
491
+ };
492
+ /**
493
+ * Purge / Delete a community from the database.
494
+ */
495
+ LemmyWebsocket.prototype.purgeCommunity = function (form) {
496
+ return wrapper(others_1.UserOperation.PurgeCommunity, form);
497
+ };
498
+ /**
499
+ * Purge / Delete a post from the database.
500
+ */
501
+ LemmyWebsocket.prototype.purgePost = function (form) {
502
+ return wrapper(others_1.UserOperation.PurgePost, form);
503
+ };
504
+ /**
505
+ * Purge / Delete a comment from the database.
506
+ */
507
+ LemmyWebsocket.prototype.purgeComment = function (form) {
508
+ return wrapper(others_1.UserOperation.PurgeComment, form);
509
+ };
486
510
  return LemmyWebsocket;
487
511
  }());
488
512
  exports.LemmyWebsocket = LemmyWebsocket;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "lemmy-js-client",
3
3
  "description": "A javascript / typescript client for Lemmy",
4
- "version": "0.17.0-rc.11",
4
+ "version": "0.17.0-rc.12",
5
5
  "author": "Dessalines <tyhou13@gmx.com>",
6
6
  "license": "AGPL-3.0",
7
7
  "main": "./dist/index.js",