lemmy-js-client 0.19.0-rc.12 → 0.19.0-rc.14

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/dist/http.d.ts CHANGED
@@ -124,10 +124,15 @@ import { SiteResponse } from "./types/SiteResponse";
124
124
  import { TransferCommunity } from "./types/TransferCommunity";
125
125
  import { VerifyEmail } from "./types/VerifyEmail";
126
126
  import { VerifyEmailResponse } from "./types/VerifyEmailResponse";
127
- import { UploadImage, UploadImageResponse } from "./types/others";
127
+ import { DeleteImage, UploadImage, UploadImageResponse } from "./types/others";
128
128
  import { HideCommunity } from "./types/HideCommunity";
129
129
  import { BlockInstance } from "./types/BlockInstance";
130
130
  import { BlockInstanceResponse } from "./types/BlockInstanceResponse";
131
+ import { GenerateTotpSecretResponse } from "./types/GenerateTotpSecretResponse";
132
+ import { UpdateTotp } from "./types/UpdateTotp";
133
+ import { UpdateTotpResponse } from "./types/UpdateTotpResponse";
134
+ import { SuccessResponse } from "./types/SuccessResponse";
135
+ import { LoginToken } from "./types/LoginToken";
131
136
  /**
132
137
  * Helps build lemmy HTTP requests.
133
138
  */
@@ -168,6 +173,49 @@ export declare class LemmyHttp {
168
173
  * `HTTP.POST /user/leave_admin`
169
174
  */
170
175
  leaveAdmin(): Promise<GetSiteResponse>;
176
+ /**
177
+ * Generate a TOTP / two-factor secret.
178
+ *
179
+ * Afterwards you need to call `/user/totp/update` with a valid token to enable it.
180
+ *
181
+ * `HTTP.POST /user/totp/generate`
182
+ */
183
+ generateTotpSecret(): Promise<GenerateTotpSecretResponse>;
184
+ /**
185
+ * Export a backup of your user settings, including your saved content,
186
+ * followed communities, and blocks.
187
+ *
188
+ * `HTTP.GET /user/export_settings`
189
+ */
190
+ exportSettings(): Promise<any>;
191
+ /**
192
+ * Import a backup of your user settings.
193
+ *
194
+ * `HTTP.POST /user/import_settings`
195
+ */
196
+ importSettings(form: any): Promise<SuccessResponse>;
197
+ /**
198
+ * List login tokens for your user
199
+ *
200
+ * `HTTP.GET /user/list_logins`
201
+ */
202
+ listLogins(): Promise<LoginToken[]>;
203
+ /**
204
+ * Returns an error message if your auth token is invalid
205
+ *
206
+ * `HTTP.GET /user/validate_auth`
207
+ */
208
+ validateAuth(): Promise<SuccessResponse>;
209
+ /**
210
+ * Enable / Disable TOTP / two-factor authentication.
211
+ *
212
+ * To enable, you need to first call `/user/totp/generate` and then pass a valid token to this.
213
+ *
214
+ * Disabling is only possible if 2FA was previously enabled. Again it is necessary to pass a valid token.
215
+ *
216
+ * `HTTP.POST /user/totp/update`
217
+ */
218
+ updateTotp(form: UpdateTotp): Promise<UpdateTotpResponse>;
171
219
  /**
172
220
  * Get the modlog.
173
221
  *
@@ -229,7 +277,7 @@ export declare class LemmyHttp {
229
277
  */
230
278
  deleteCommunity(form: DeleteCommunity): Promise<CommunityResponse>;
231
279
  /**
232
- * Hide a community from public view.
280
+ * Hide a community from public / "All" view. Admins only.
233
281
  *
234
282
  * `HTTP.PUT /community/hide`
235
283
  */
@@ -670,6 +718,10 @@ export declare class LemmyHttp {
670
718
  * Upload an image to the server.
671
719
  */
672
720
  uploadImage({ image, auth, }: UploadImage): Promise<UploadImageResponse>;
721
+ /**
722
+ * Delete a pictrs image
723
+ */
724
+ deleteImage({ token, filename, auth }: DeleteImage): Promise<any>;
673
725
  /**
674
726
  * Set the headers (can be used to set the auth header)
675
727
  */
package/dist/http.js CHANGED
@@ -90,6 +90,61 @@ class LemmyHttp {
90
90
  leaveAdmin() {
91
91
  return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/user/leave_admin", {});
92
92
  }
93
+ /**
94
+ * Generate a TOTP / two-factor secret.
95
+ *
96
+ * Afterwards you need to call `/user/totp/update` with a valid token to enable it.
97
+ *
98
+ * `HTTP.POST /user/totp/generate`
99
+ */
100
+ generateTotpSecret() {
101
+ return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/user/totp/generate", {});
102
+ }
103
+ /**
104
+ * Export a backup of your user settings, including your saved content,
105
+ * followed communities, and blocks.
106
+ *
107
+ * `HTTP.GET /user/export_settings`
108
+ */
109
+ exportSettings() {
110
+ return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/user/export_settings", {});
111
+ }
112
+ /**
113
+ * Import a backup of your user settings.
114
+ *
115
+ * `HTTP.POST /user/import_settings`
116
+ */
117
+ importSettings(form) {
118
+ return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/user/import_settings", form);
119
+ }
120
+ /**
121
+ * List login tokens for your user
122
+ *
123
+ * `HTTP.GET /user/list_logins`
124
+ */
125
+ listLogins() {
126
+ return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/user/list_logins", {});
127
+ }
128
+ /**
129
+ * Returns an error message if your auth token is invalid
130
+ *
131
+ * `HTTP.GET /user/validate_auth`
132
+ */
133
+ validateAuth() {
134
+ return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/user/validate_auth", {});
135
+ }
136
+ /**
137
+ * Enable / Disable TOTP / two-factor authentication.
138
+ *
139
+ * To enable, you need to first call `/user/totp/generate` and then pass a valid token to this.
140
+ *
141
+ * Disabling is only possible if 2FA was previously enabled. Again it is necessary to pass a valid token.
142
+ *
143
+ * `HTTP.POST /user/totp/update`
144
+ */
145
+ updateTotp(form) {
146
+ return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/user/totp/update", form);
147
+ }
93
148
  /**
94
149
  * Get the modlog.
95
150
  *
@@ -171,7 +226,7 @@ class LemmyHttp {
171
226
  return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/community/delete", form);
172
227
  }
173
228
  /**
174
- * Hide a community from public view.
229
+ * Hide a community from public / "All" view. Admins only.
175
230
  *
176
231
  * `HTTP.PUT /community/hide`
177
232
  */
@@ -787,6 +842,26 @@ class LemmyHttp {
787
842
  delete_url });
788
843
  });
789
844
  }
845
+ /**
846
+ * Delete a pictrs image
847
+ */
848
+ deleteImage({ token, filename, auth }) {
849
+ var _a, _b, _c, _d;
850
+ return __awaiter(this, void 0, void 0, function* () {
851
+ // If auth cookie not already set by browser, set it with passed in auth
852
+ const headers = {};
853
+ if (!((_b = (_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) === null || _a === void 0 ? void 0 : _a.cookie) === null || _b === void 0 ? void 0 : _b.includes("auth=")) &&
854
+ !((_d = (_c = __classPrivateFieldGet(this, _LemmyHttp_headers, "f")) === null || _c === void 0 ? void 0 : _c.Cookie) === null || _d === void 0 ? void 0 : _d.includes("auth="))) {
855
+ headers.Cookie = `auth=${auth}`;
856
+ }
857
+ const deleteUrl = `${__classPrivateFieldGet(this, _LemmyHttp_pictrsUrl, "f")}/delete/${token}/${filename}`;
858
+ const response = yield __classPrivateFieldGet(this, _LemmyHttp_fetchFunction, "f").call(this, deleteUrl, {
859
+ method: HttpType.Get,
860
+ headers: Object.assign(Object.assign({}, __classPrivateFieldGet(this, _LemmyHttp_headers, "f")), headers),
861
+ });
862
+ return yield response.json();
863
+ });
864
+ }
790
865
  /**
791
866
  * Set the headers (can be used to set the auth header)
792
867
  */
package/dist/index.d.ts CHANGED
@@ -82,6 +82,7 @@ export { EditSite } from "./types/EditSite";
82
82
  export { FeaturePost } from "./types/FeaturePost";
83
83
  export { FederatedInstances } from "./types/FederatedInstances";
84
84
  export { FollowCommunity } from "./types/FollowCommunity";
85
+ export { GenerateTotpSecretResponse } from "./types/GenerateTotpSecretResponse";
85
86
  export { GetCaptchaResponse } from "./types/GetCaptchaResponse";
86
87
  export { GetComment } from "./types/GetComment";
87
88
  export { GetComments } from "./types/GetComments";
@@ -138,6 +139,7 @@ export { LocalUserView } from "./types/LocalUserView";
138
139
  export { LockPost } from "./types/LockPost";
139
140
  export { Login } from "./types/Login";
140
141
  export { LoginResponse } from "./types/LoginResponse";
142
+ export { LoginToken } from "./types/LoginToken";
141
143
  export { MarkCommentReplyAsRead } from "./types/MarkCommentReplyAsRead";
142
144
  export { MarkPersonMentionAsRead } from "./types/MarkPersonMentionAsRead";
143
145
  export { MarkPostAsRead } from "./types/MarkPostAsRead";
@@ -234,8 +236,11 @@ export { SiteResponse } from "./types/SiteResponse";
234
236
  export { SiteView } from "./types/SiteView";
235
237
  export { SortType } from "./types/SortType";
236
238
  export { SubscribedType } from "./types/SubscribedType";
239
+ export { SuccessResponse } from "./types/SuccessResponse";
237
240
  export { Tagline } from "./types/Tagline";
238
241
  export { TransferCommunity } from "./types/TransferCommunity";
242
+ export { UpdateTotp } from "./types/UpdateTotp";
243
+ export { UpdateTotpResponse } from "./types/UpdateTotpResponse";
239
244
  export { VerifyEmail } from "./types/VerifyEmail";
240
245
  export { VerifyEmailResponse } from "./types/VerifyEmailResponse";
241
- export { UploadImage, UploadImageResponse, ImageFile } from "./types/others";
246
+ export { UploadImage, UploadImageResponse, ImageFile, DeleteImage, } from "./types/others";
@@ -7,6 +7,4 @@ export interface CommentAggregates {
7
7
  downvotes: number;
8
8
  published: string;
9
9
  child_count: number;
10
- hot_rank: number;
11
- controversy_rank: number;
12
10
  }
@@ -10,5 +10,4 @@ export interface CommunityAggregates {
10
10
  users_active_week: number;
11
11
  users_active_month: number;
12
12
  users_active_half_year: number;
13
- hot_rank: number;
14
13
  }
@@ -0,0 +1,3 @@
1
+ export interface GenerateTotpSecretResponse {
2
+ totp_secret_url: string;
3
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,277 +1,304 @@
1
1
  export type LemmyErrorType = {
2
- error_type: "ReportReasonRequired";
2
+ error: "report_reason_required";
3
3
  } | {
4
- error_type: "ReportTooLong";
4
+ error: "report_too_long";
5
5
  } | {
6
- error_type: "NotAModerator";
6
+ error: "not_a_moderator";
7
7
  } | {
8
- error_type: "NotAnAdmin";
8
+ error: "not_an_admin";
9
9
  } | {
10
- error_type: "CannotBlockYourself";
10
+ error: "cant_block_yourself";
11
11
  } | {
12
- error_type: "CannotBlockAdmin";
12
+ error: "cant_block_admin";
13
13
  } | {
14
- error_type: "CouldNotUpdateUser";
14
+ error: "couldnt_update_user";
15
15
  } | {
16
- error_type: "PasswordsDoNotMatch";
16
+ error: "passwords_do_not_match";
17
17
  } | {
18
- error_type: "PasswordIncorrect";
18
+ error: "email_not_verified";
19
19
  } | {
20
- error_type: "EmailNotVerified";
20
+ error: "email_required";
21
21
  } | {
22
- error_type: "EmailRequired";
22
+ error: "couldnt_update_comment";
23
23
  } | {
24
- error_type: "CouldNotUpdateComment";
24
+ error: "couldnt_update_private_message";
25
25
  } | {
26
- error_type: "CouldNotUpdatePrivateMessage";
26
+ error: "cannot_leave_admin";
27
27
  } | {
28
- error_type: "CannotLeaveAdmin";
28
+ error: "no_lines_in_html";
29
29
  } | {
30
- error_type: "NoLinesInHtml";
30
+ error: "site_metadata_page_is_not_doctype_html";
31
31
  } | {
32
- error_type: "SiteMetadataPageIsNotDoctypeHtml";
33
- } | {
34
- error_type: "PictrsResponseError";
32
+ error: "pictrs_response_error";
35
33
  message: string;
36
34
  } | {
37
- error_type: "PictrsPurgeResponseError";
35
+ error: "pictrs_purge_response_error";
38
36
  message: string;
39
37
  } | {
40
- error_type: "ImageUrlMissingPathSegments";
38
+ error: "pictrs_caching_disabled";
41
39
  } | {
42
- error_type: "ImageUrlMissingLastPathSegment";
40
+ error: "image_url_missing_path_segments";
43
41
  } | {
44
- error_type: "PictrsApiKeyNotProvided";
42
+ error: "image_url_missing_last_path_segment";
45
43
  } | {
46
- error_type: "NoContentTypeHeader";
44
+ error: "pictrs_api_key_not_provided";
47
45
  } | {
48
- error_type: "NotAnImageType";
46
+ error: "no_content_type_header";
49
47
  } | {
50
- error_type: "NotAModOrAdmin";
48
+ error: "not_an_image_type";
51
49
  } | {
52
- error_type: "NoAdmins";
50
+ error: "not_a_mod_or_admin";
53
51
  } | {
54
- error_type: "NotTopAdmin";
52
+ error: "no_admins";
55
53
  } | {
56
- error_type: "NotTopMod";
54
+ error: "not_top_admin";
57
55
  } | {
58
- error_type: "NotLoggedIn";
56
+ error: "not_top_mod";
59
57
  } | {
60
- error_type: "SiteBan";
58
+ error: "not_logged_in";
61
59
  } | {
62
- error_type: "Deleted";
60
+ error: "site_ban";
63
61
  } | {
64
- error_type: "BannedFromCommunity";
62
+ error: "deleted";
65
63
  } | {
66
- error_type: "CouldNotFindCommunity";
64
+ error: "banned_from_community";
67
65
  } | {
68
- error_type: "PersonIsBlocked";
66
+ error: "couldnt_find_community";
69
67
  } | {
70
- error_type: "DownvotesAreDisabled";
68
+ error: "couldnt_find_person";
71
69
  } | {
72
- error_type: "InstanceIsPrivate";
70
+ error: "person_is_blocked";
73
71
  } | {
74
- error_type: "InvalidPassword";
72
+ error: "downvotes_are_disabled";
75
73
  } | {
76
- error_type: "SiteDescriptionLengthOverflow";
74
+ error: "instance_is_private";
77
75
  } | {
78
- error_type: "HoneypotFailed";
76
+ error: "invalid_password";
79
77
  } | {
80
- error_type: "RegistrationApplicationIsPending";
78
+ error: "site_description_length_overflow";
81
79
  } | {
82
- error_type: "PrivateInstanceCannotHaveFederationEnabled";
80
+ error: "honeypot_failed";
83
81
  } | {
84
- error_type: "Locked";
82
+ error: "registration_application_is_pending";
85
83
  } | {
86
- error_type: "CouldNotCreateComment";
84
+ error: "cant_enable_private_instance_and_federation_together";
87
85
  } | {
88
- error_type: "MaxCommentDepthReached";
86
+ error: "locked";
89
87
  } | {
90
- error_type: "EditCommentNotAllowed";
88
+ error: "couldnt_create_comment";
91
89
  } | {
92
- error_type: "OnlyAdminsCanCreateCommunities";
90
+ error: "max_comment_depth_reached";
93
91
  } | {
94
- error_type: "CommunityAlreadyExists";
92
+ error: "no_comment_edit_allowed";
95
93
  } | {
96
- error_type: "LanguageNotAllowed";
94
+ error: "only_admins_can_create_communities";
97
95
  } | {
98
- error_type: "OnlyModsCanPostInCommunity";
96
+ error: "community_already_exists";
99
97
  } | {
100
- error_type: "CouldNotUpdatePost";
98
+ error: "language_not_allowed";
101
99
  } | {
102
- error_type: "EditPostNotAllowed";
100
+ error: "only_mods_can_post_in_community";
103
101
  } | {
104
- error_type: "CouldNotFindPost";
102
+ error: "couldnt_update_post";
105
103
  } | {
106
- error_type: "EditPrivateMessageNotAllowed";
104
+ error: "no_post_edit_allowed";
107
105
  } | {
108
- error_type: "SiteAlreadyExists";
106
+ error: "couldnt_find_post";
109
107
  } | {
110
- error_type: "ApplicationQuestionRequired";
108
+ error: "edit_private_message_not_allowed";
111
109
  } | {
112
- error_type: "InvalidDefaultPostListingType";
110
+ error: "site_already_exists";
113
111
  } | {
114
- error_type: "RegistrationClosed";
112
+ error: "application_question_required";
115
113
  } | {
116
- error_type: "RegistrationApplicationAnswerRequired";
114
+ error: "invalid_default_post_listing_type";
117
115
  } | {
118
- error_type: "EmailAlreadyExists";
116
+ error: "registration_closed";
119
117
  } | {
120
- error_type: "FederationError";
121
- message: string;
118
+ error: "registration_application_answer_required";
119
+ } | {
120
+ error: "email_already_exists";
121
+ } | {
122
+ error: "federation_forbidden_by_strict_allow_list";
123
+ } | {
124
+ error: "person_is_banned_from_community";
122
125
  } | {
123
- error_type: "FederationForbiddenByStrictAllowList";
126
+ error: "object_is_not_public";
124
127
  } | {
125
- error_type: "PersonIsBannedFromCommunity";
128
+ error: "invalid_community";
126
129
  } | {
127
- error_type: "ObjectIsNotPublic";
130
+ error: "cannot_create_post_or_comment_in_deleted_or_removed_community";
128
131
  } | {
129
- error_type: "InvalidCommunity";
132
+ error: "cannot_receive_page";
130
133
  } | {
131
- error_type: "CannotCreatePostOrCommentInDeletedOrRemovedCommunity";
134
+ error: "new_post_cannot_be_locked";
132
135
  } | {
133
- error_type: "CannotReceivePage";
136
+ error: "only_local_admin_can_remove_community";
134
137
  } | {
135
- error_type: "NewPostCannotBeLocked";
138
+ error: "only_local_admin_can_restore_community";
136
139
  } | {
137
- error_type: "OnlyLocalAdminCanRemoveCommunity";
140
+ error: "no_id_given";
138
141
  } | {
139
- error_type: "OnlyLocalAdminCanRestoreCommunity";
142
+ error: "incorrect_login";
140
143
  } | {
141
- error_type: "NoIdGiven";
144
+ error: "invalid_query";
145
+ } | {
146
+ error: "object_not_local";
147
+ } | {
148
+ error: "post_is_locked";
149
+ } | {
150
+ error: "person_is_banned_from_site";
151
+ message: string;
142
152
  } | {
143
- error_type: "CouldNotFindUsernameOrEmail";
153
+ error: "invalid_vote_value";
144
154
  } | {
145
- error_type: "InvalidQuery";
155
+ error: "page_does_not_specify_creator";
146
156
  } | {
147
- error_type: "ObjectNotLocal";
157
+ error: "page_does_not_specify_group";
148
158
  } | {
149
- error_type: "PostIsLocked";
159
+ error: "no_community_found_in_cc";
150
160
  } | {
151
- error_type: "PersonIsBannedFromSite";
161
+ error: "no_email_setup";
152
162
  } | {
153
- error_type: "InvalidVoteValue";
163
+ error: "email_smtp_server_needs_a_port";
154
164
  } | {
155
- error_type: "PageDoesNotSpecifyCreator";
165
+ error: "missing_an_email";
156
166
  } | {
157
- error_type: "PageDoesNotSpecifyGroup";
167
+ error: "rate_limit_error";
158
168
  } | {
159
- error_type: "NoCommunityFoundInCC";
169
+ error: "invalid_name";
160
170
  } | {
161
- error_type: "NoEmailSetup";
171
+ error: "invalid_display_name";
162
172
  } | {
163
- error_type: "EmailSmtpServerNeedsAPort";
173
+ error: "invalid_matrix_id";
164
174
  } | {
165
- error_type: "MissingAnEmail";
175
+ error: "invalid_post_title";
166
176
  } | {
167
- error_type: "RateLimitError";
177
+ error: "invalid_body_field";
168
178
  } | {
169
- error_type: "InvalidName";
179
+ error: "bio_length_overflow";
170
180
  } | {
171
- error_type: "InvalidDisplayName";
181
+ error: "missing_totp_token";
172
182
  } | {
173
- error_type: "InvalidMatrixId";
183
+ error: "missing_totp_secret";
174
184
  } | {
175
- error_type: "InvalidPostTitle";
185
+ error: "incorrect_totp_token";
176
186
  } | {
177
- error_type: "InvalidBodyField";
187
+ error: "couldnt_parse_totp_secret";
178
188
  } | {
179
- error_type: "BioLengthOverflow";
189
+ error: "couldnt_generate_totp";
180
190
  } | {
181
- error_type: "MissingTotpToken";
191
+ error: "totp_already_enabled";
182
192
  } | {
183
- error_type: "IncorrectTotpToken";
193
+ error: "couldnt_like_comment";
184
194
  } | {
185
- error_type: "CouldNotParseTotpSecret";
195
+ error: "couldnt_save_comment";
186
196
  } | {
187
- error_type: "CouldNotLikeComment";
197
+ error: "couldnt_create_report";
188
198
  } | {
189
- error_type: "CouldNotSaveComment";
199
+ error: "couldnt_resolve_report";
190
200
  } | {
191
- error_type: "CouldNotCreateReport";
201
+ error: "community_moderator_already_exists";
192
202
  } | {
193
- error_type: "CouldNotResolveReport";
203
+ error: "community_user_already_banned";
194
204
  } | {
195
- error_type: "CommunityModeratorAlreadyExists";
205
+ error: "community_block_already_exists";
196
206
  } | {
197
- error_type: "CommunityUserIsAlreadyBanned";
207
+ error: "community_follower_already_exists";
198
208
  } | {
199
- error_type: "CommunityBlockAlreadyExists";
209
+ error: "couldnt_update_community_hidden_status";
200
210
  } | {
201
- error_type: "CommunityFollowerAlreadyExists";
211
+ error: "person_block_already_exists";
202
212
  } | {
203
- error_type: "CouldNotUpdateCommunityHiddenStatus";
213
+ error: "user_already_exists";
204
214
  } | {
205
- error_type: "PersonBlockAlreadyExists";
215
+ error: "token_not_found";
206
216
  } | {
207
- error_type: "UserAlreadyExists";
217
+ error: "couldnt_like_post";
208
218
  } | {
209
- error_type: "TokenNotFound";
219
+ error: "couldnt_save_post";
210
220
  } | {
211
- error_type: "CouldNotLikePost";
221
+ error: "couldnt_mark_post_as_read";
212
222
  } | {
213
- error_type: "CouldNotSavePost";
223
+ error: "couldnt_update_community";
214
224
  } | {
215
- error_type: "CouldNotMarkPostAsRead";
225
+ error: "couldnt_update_replies";
216
226
  } | {
217
- error_type: "CouldNotUpdateCommunity";
227
+ error: "couldnt_update_person_mentions";
218
228
  } | {
219
- error_type: "CouldNotUpdateReplies";
229
+ error: "post_title_too_long";
220
230
  } | {
221
- error_type: "CouldNotUpdatePersonMentions";
231
+ error: "couldnt_create_post";
222
232
  } | {
223
- error_type: "PostTitleTooLong";
233
+ error: "couldnt_create_private_message";
224
234
  } | {
225
- error_type: "CouldNotCreatePost";
235
+ error: "couldnt_update_private";
226
236
  } | {
227
- error_type: "CouldNotCreatePrivateMessage";
237
+ error: "system_err_login";
228
238
  } | {
229
- error_type: "CouldNotUpdatePrivate";
239
+ error: "couldnt_set_all_registrations_accepted";
230
240
  } | {
231
- error_type: "SystemErrLogin";
241
+ error: "couldnt_set_all_email_verified";
232
242
  } | {
233
- error_type: "CouldNotSetAllRegistrationsAccepted";
243
+ error: "banned";
234
244
  } | {
235
- error_type: "CouldNotSetAllEmailVerified";
245
+ error: "couldnt_get_comments";
236
246
  } | {
237
- error_type: "Banned";
247
+ error: "couldnt_get_posts";
238
248
  } | {
239
- error_type: "CouldNotGetComments";
249
+ error: "invalid_url";
240
250
  } | {
241
- error_type: "CouldNotGetPosts";
251
+ error: "email_send_failed";
242
252
  } | {
243
- error_type: "InvalidUrl";
253
+ error: "slurs";
244
254
  } | {
245
- error_type: "EmailSendFailed";
255
+ error: "couldnt_find_object";
246
256
  } | {
247
- error_type: "Slurs";
257
+ error: "registration_denied";
258
+ message: string | null;
248
259
  } | {
249
- error_type: "CouldNotGenerateTotp";
260
+ error: "federation_disabled";
250
261
  } | {
251
- error_type: "CouldNotFindObject";
262
+ error: "domain_blocked";
263
+ message: string;
252
264
  } | {
253
- error_type: "RegistrationDenied";
265
+ error: "domain_not_in_allow_list";
254
266
  message: string;
255
267
  } | {
256
- error_type: "FederationDisabled";
268
+ error: "federation_disabled_by_strict_allow_list";
269
+ } | {
270
+ error: "site_name_required";
271
+ } | {
272
+ error: "site_name_length_overflow";
273
+ } | {
274
+ error: "permissive_regex";
275
+ } | {
276
+ error: "invalid_regex";
257
277
  } | {
258
- error_type: "DomainBlocked";
278
+ error: "captcha_incorrect";
259
279
  } | {
260
- error_type: "DomainNotInAllowList";
280
+ error: "password_reset_limit_reached";
261
281
  } | {
262
- error_type: "FederationDisabledByStrictAllowList";
282
+ error: "couldnt_create_audio_captcha";
263
283
  } | {
264
- error_type: "SiteNameRequired";
284
+ error: "invalid_url_scheme";
265
285
  } | {
266
- error_type: "SiteNameLengthOverflow";
286
+ error: "couldnt_send_webmention";
267
287
  } | {
268
- error_type: "PermissiveRegex";
288
+ error: "contradicting_filters";
269
289
  } | {
270
- error_type: "InvalidRegex";
290
+ error: "instance_block_already_exists";
271
291
  } | {
272
- error_type: "CaptchaIncorrect";
292
+ error: "auth_cookie_insecure";
273
293
  } | {
274
- error_type: "PasswordResetLimitReached";
294
+ error: "too_many_items";
275
295
  } | {
276
- error_type: "CouldNotCreateAudioCaptcha";
296
+ error: "community_has_no_followers";
297
+ } | {
298
+ error: "ban_expiration_in_past";
299
+ } | {
300
+ error: "invalid_unix_time";
301
+ } | {
302
+ error: "unknown";
303
+ message: string;
277
304
  };
@@ -16,4 +16,6 @@ export interface LocalSiteRateLimit {
16
16
  search_per_second: number;
17
17
  published: string;
18
18
  updated?: string;
19
+ import_user_settings: number;
20
+ import_user_settings_per_second: number;
19
21
  }
@@ -14,18 +14,18 @@ export interface LocalUser {
14
14
  interface_language: string;
15
15
  show_avatars: boolean;
16
16
  send_notifications_to_email: boolean;
17
- validator_time: string;
18
17
  show_scores: boolean;
19
18
  show_bot_accounts: boolean;
20
19
  show_read_posts: boolean;
21
- show_new_post_notifs: boolean;
22
20
  email_verified: boolean;
23
21
  accepted_application: boolean;
24
- totp_2fa_url?: string;
25
22
  open_links_in_new_tab: boolean;
26
23
  blur_nsfw: boolean;
27
24
  auto_expand: boolean;
28
25
  infinite_scroll_enabled: boolean;
29
26
  admin: boolean;
30
27
  post_listing_mode: PostListingMode;
28
+ totp_2fa_enabled: boolean;
29
+ enable_keyboard_navigation: boolean;
30
+ enable_animated_images: boolean;
31
31
  }
@@ -0,0 +1,8 @@
1
+ import type { LocalUserId } from "./LocalUserId";
2
+ export interface LoginToken {
3
+ id: number;
4
+ user_id: LocalUserId;
5
+ published: string;
6
+ ip?: string;
7
+ user_agent?: string;
8
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +1,6 @@
1
1
  import type { PostId } from "./PostId";
2
2
  export interface MarkPostAsRead {
3
- post_id: PostId;
3
+ post_id?: PostId;
4
+ post_ids?: Array<PostId>;
4
5
  read: boolean;
5
6
  }
@@ -6,6 +6,5 @@ export interface ModRemoveCommunity {
6
6
  community_id: CommunityId;
7
7
  reason?: string;
8
8
  removed: boolean;
9
- expires?: string;
10
9
  when_: string;
11
10
  }
@@ -1,6 +1,3 @@
1
- import type { CommunityId } from "./CommunityId";
2
- import type { InstanceId } from "./InstanceId";
3
- import type { PersonId } from "./PersonId";
4
1
  import type { PostId } from "./PostId";
5
2
  export interface PostAggregates {
6
3
  id: number;
@@ -10,15 +7,4 @@ export interface PostAggregates {
10
7
  upvotes: number;
11
8
  downvotes: number;
12
9
  published: string;
13
- newest_comment_time_necro: string;
14
- newest_comment_time: string;
15
- featured_community: boolean;
16
- featured_local: boolean;
17
- hot_rank: number;
18
- hot_rank_active: number;
19
- community_id: CommunityId;
20
- creator_id: PersonId;
21
- controversy_rank: number;
22
- instance_id: InstanceId;
23
- scaled_rank: number;
24
10
  }
@@ -3,5 +3,4 @@ export interface RemoveCommunity {
3
3
  community_id: CommunityId;
4
4
  removed: boolean;
5
5
  reason?: string;
6
- expires?: number;
7
6
  }
@@ -1,5 +1,6 @@
1
1
  import type { LanguageId } from "./LanguageId";
2
2
  import type { ListingType } from "./ListingType";
3
+ import type { PostListingMode } from "./PostListingMode";
3
4
  import type { SortType } from "./SortType";
4
5
  export interface SaveUserSettings {
5
6
  show_nsfw?: boolean;
@@ -23,7 +24,9 @@ export interface SaveUserSettings {
23
24
  show_read_posts?: boolean;
24
25
  show_new_post_notifs?: boolean;
25
26
  discussion_languages?: Array<LanguageId>;
26
- generate_totp_2fa?: boolean;
27
27
  open_links_in_new_tab?: boolean;
28
28
  infinite_scroll_enabled?: boolean;
29
+ post_listing_mode?: PostListingMode;
30
+ enable_keyboard_navigation?: boolean;
31
+ enable_animated_images?: boolean;
29
32
  }
@@ -0,0 +1,3 @@
1
+ export interface SuccessResponse {
2
+ success: boolean;
3
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ export interface UpdateTotp {
2
+ totp_token: string;
3
+ enabled: boolean;
4
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export interface UpdateTotpResponse {
2
+ enabled: boolean;
3
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -20,3 +20,11 @@ export interface ImageFile {
20
20
  file: string;
21
21
  delete_token: string;
22
22
  }
23
+ export interface DeleteImage {
24
+ token: string;
25
+ filename: string;
26
+ /**
27
+ * Optional if cookie with jwt set is already present. Otherwise, auth is required.
28
+ */
29
+ auth?: string;
30
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lemmy-js-client",
3
- "version": "0.19.0-rc.12",
3
+ "version": "0.19.0-rc.14",
4
4
  "description": "A javascript / typescript client for Lemmy",
5
5
  "repository": "https://github.com/LemmyNet/lemmy-js-client",
6
6
  "license": "AGPL-3.0",