lemmy-js-client 1.0.0-error-status-code.0 → 1.0.0-errors-array.0
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 +1 -2
- package/dist/http.js +3 -5
- package/dist/index.d.ts +1 -0
- package/dist/types/AdminAllowInstance.d.ts +1 -1
- package/dist/types/AdminAllowInstanceParams.d.ts +1 -1
- package/dist/types/AdminBan.d.ts +1 -1
- package/dist/types/AdminBlockInstance.d.ts +1 -1
- package/dist/types/AdminBlockInstanceParams.d.ts +1 -1
- package/dist/types/AdminPurgeComment.d.ts +1 -1
- package/dist/types/AdminPurgeCommunity.d.ts +1 -1
- package/dist/types/AdminPurgePerson.d.ts +1 -1
- package/dist/types/AdminPurgePost.d.ts +1 -1
- package/dist/types/AdminRemoveCommunity.d.ts +1 -1
- package/dist/types/AllLemmyErrors.d.ts +116 -0
- package/dist/types/AllLemmyErrors.js +2 -0
- package/dist/types/BanFromCommunity.d.ts +1 -1
- package/dist/types/BanPerson.d.ts +1 -1
- package/dist/types/CreateSite.d.ts +1 -0
- package/dist/types/EditSite.d.ts +4 -0
- package/dist/types/HideCommunity.d.ts +1 -1
- package/dist/types/LemmyErrorType.d.ts +0 -2
- package/dist/types/LocalSite.d.ts +4 -0
- package/dist/types/LocalUser.d.ts +9 -9
- package/dist/types/LockComment.d.ts +1 -4
- package/dist/types/LockPost.d.ts +1 -1
- package/dist/types/ModBanFromCommunity.d.ts +1 -1
- package/dist/types/ModLockComment.d.ts +5 -5
- package/dist/types/ModLockCommentView.d.ts +0 -2
- package/dist/types/ModLockPost.d.ts +1 -1
- package/dist/types/ModRemoveComment.d.ts +1 -1
- package/dist/types/ModRemovePost.d.ts +1 -1
- package/dist/types/Post.d.ts +0 -2
- package/dist/types/PostOrCommentOrPrivateMessage.d.ts +7 -7
- package/dist/types/PurgeComment.d.ts +1 -1
- package/dist/types/PurgeCommunity.d.ts +1 -1
- package/dist/types/PurgePerson.d.ts +1 -1
- package/dist/types/PurgePost.d.ts +1 -1
- package/dist/types/RemoveComment.d.ts +1 -1
- package/dist/types/RemoveCommunity.d.ts +1 -1
- package/dist/types/RemovePost.d.ts +1 -1
- package/dist/types/SaveUserSettings.d.ts +1 -1
- package/package.json +2 -2
package/dist/http.d.ts
CHANGED
|
@@ -781,7 +781,6 @@ export declare class LemmyHttp extends Controller {
|
|
|
781
781
|
* The msg is either an empty string, or extra non-translatable info.
|
|
782
782
|
*/
|
|
783
783
|
export declare class LemmyError extends Error {
|
|
784
|
-
|
|
785
|
-
constructor(name: string, status: number, msg?: string);
|
|
784
|
+
constructor(name: string, msg?: string);
|
|
786
785
|
}
|
|
787
786
|
export {};
|
package/dist/http.js
CHANGED
|
@@ -1015,11 +1015,10 @@ _LemmyHttp_wrapper = async function _LemmyHttp_wrapper(type_, endpoint, form, op
|
|
|
1015
1015
|
json = await response.json();
|
|
1016
1016
|
}
|
|
1017
1017
|
catch {
|
|
1018
|
-
throw new LemmyError(response.statusText
|
|
1018
|
+
throw new LemmyError(response.statusText);
|
|
1019
1019
|
}
|
|
1020
1020
|
if (!response.ok) {
|
|
1021
|
-
|
|
1022
|
-
let err = new LemmyError(json.error ?? response.statusText, response.status, json.message);
|
|
1021
|
+
let err = new LemmyError(json.error ?? response.statusText, json.message);
|
|
1023
1022
|
throw err;
|
|
1024
1023
|
}
|
|
1025
1024
|
else {
|
|
@@ -2114,10 +2113,9 @@ function createFormData(image) {
|
|
|
2114
2113
|
* The msg is either an empty string, or extra non-translatable info.
|
|
2115
2114
|
*/
|
|
2116
2115
|
class LemmyError extends Error {
|
|
2117
|
-
constructor(name,
|
|
2116
|
+
constructor(name, msg) {
|
|
2118
2117
|
super(msg ?? "");
|
|
2119
2118
|
this.name = name;
|
|
2120
|
-
this.status = status;
|
|
2121
2119
|
// Set the prototype explicitly.
|
|
2122
2120
|
Object.setPrototypeOf(this, LemmyError.prototype);
|
|
2123
2121
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -36,6 +36,7 @@ export { AdminPurgePostView } from "./types/AdminPurgePostView";
|
|
|
36
36
|
export { AdminRemoveCommunity } from "./types/AdminRemoveCommunity";
|
|
37
37
|
export { AdminRemoveCommunityId } from "./types/AdminRemoveCommunityId";
|
|
38
38
|
export { AdminRemoveCommunityView } from "./types/AdminRemoveCommunityView";
|
|
39
|
+
export { AllLemmyErrors } from "./types/AllLemmyErrors";
|
|
39
40
|
export { ApproveCommunityPendingFollower } from "./types/ApproveCommunityPendingFollower";
|
|
40
41
|
export { ApproveRegistrationApplication } from "./types/ApproveRegistrationApplication";
|
|
41
42
|
export { AuthenticateWithOauth } from "./types/AuthenticateWithOauth";
|
package/dist/types/AdminBan.d.ts
CHANGED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
export type AllLemmyErrors = [
|
|
2
|
+
"block_keyword_too_short",
|
|
3
|
+
"block_keyword_too_long",
|
|
4
|
+
"couldnt_update",
|
|
5
|
+
"couldnt_create",
|
|
6
|
+
"report_reason_required",
|
|
7
|
+
"report_too_long",
|
|
8
|
+
"not_a_moderator",
|
|
9
|
+
"not_an_admin",
|
|
10
|
+
"cant_block_yourself",
|
|
11
|
+
"cant_note_yourself",
|
|
12
|
+
"cant_block_admin",
|
|
13
|
+
"passwords_do_not_match",
|
|
14
|
+
"email_not_verified",
|
|
15
|
+
"email_required",
|
|
16
|
+
"cannot_leave_admin",
|
|
17
|
+
"cannot_leave_admin",
|
|
18
|
+
"cannot_leave_admin",
|
|
19
|
+
"image_url_missing_path_segments",
|
|
20
|
+
"image_url_missing_last_path_segment",
|
|
21
|
+
"pictrs_api_key_not_provided",
|
|
22
|
+
"no_content_type_header",
|
|
23
|
+
"not_an_image_type",
|
|
24
|
+
"invalid_image_upload",
|
|
25
|
+
"image_upload_disabled",
|
|
26
|
+
"not_a_mod_or_admin",
|
|
27
|
+
"not_top_mod",
|
|
28
|
+
"not_logged_in",
|
|
29
|
+
"not_higher_mod",
|
|
30
|
+
"not_higher_admin",
|
|
31
|
+
"site_ban",
|
|
32
|
+
"deleted",
|
|
33
|
+
"person_is_blocked",
|
|
34
|
+
"community_is_blocked",
|
|
35
|
+
"instance_is_blocked",
|
|
36
|
+
"instance_is_private",
|
|
37
|
+
"invalid_password",
|
|
38
|
+
"site_description_length_overflow",
|
|
39
|
+
"honeypot_failed",
|
|
40
|
+
"registration_application_is_pending",
|
|
41
|
+
"locked",
|
|
42
|
+
"max_comment_depth_reached",
|
|
43
|
+
"no_comment_edit_allowed",
|
|
44
|
+
"only_admins_can_create_communities",
|
|
45
|
+
"already_exists",
|
|
46
|
+
"language_not_allowed",
|
|
47
|
+
"no_post_edit_allowed",
|
|
48
|
+
"nsfw_not_allowed",
|
|
49
|
+
"edit_private_message_not_allowed",
|
|
50
|
+
"application_question_required",
|
|
51
|
+
"invalid_default_post_listing_type",
|
|
52
|
+
"registration_closed",
|
|
53
|
+
"registration_application_answer_required",
|
|
54
|
+
"registration_username_required",
|
|
55
|
+
"email_already_taken",
|
|
56
|
+
"username_already_taken",
|
|
57
|
+
"person_is_banned_from_community",
|
|
58
|
+
"no_id_given",
|
|
59
|
+
"incorrect_login",
|
|
60
|
+
"no_email_setup",
|
|
61
|
+
"local_site_not_setup",
|
|
62
|
+
"local_site_not_setup",
|
|
63
|
+
"invalid_name",
|
|
64
|
+
"invalid_code_verifier",
|
|
65
|
+
"invalid_display_name",
|
|
66
|
+
"invalid_matrix_id",
|
|
67
|
+
"invalid_post_title",
|
|
68
|
+
"invalid_body_field",
|
|
69
|
+
"bio_length_overflow",
|
|
70
|
+
"alt_text_length_overflow",
|
|
71
|
+
"couldnt_parse_totp_secret",
|
|
72
|
+
"couldnt_generate_totp",
|
|
73
|
+
"missing_totp_token",
|
|
74
|
+
"missing_totp_secret",
|
|
75
|
+
"incorrect_totp_token",
|
|
76
|
+
"totp_already_enabled",
|
|
77
|
+
"blocked_url",
|
|
78
|
+
"invalid_url",
|
|
79
|
+
"email_send_failed",
|
|
80
|
+
"slurs",
|
|
81
|
+
"slurs",
|
|
82
|
+
"site_name_required",
|
|
83
|
+
"site_name_length_overflow",
|
|
84
|
+
"permissive_regex",
|
|
85
|
+
"invalid_regex",
|
|
86
|
+
"captcha_incorrect",
|
|
87
|
+
"couldnt_create_audio_captcha",
|
|
88
|
+
"couldnt_create_image_captcha",
|
|
89
|
+
"invalid_url_scheme",
|
|
90
|
+
"couldnt_send_webmention",
|
|
91
|
+
"contradicting_filters",
|
|
92
|
+
"too_many_items",
|
|
93
|
+
"ban_expiration_in_past",
|
|
94
|
+
"invalid_unix_time",
|
|
95
|
+
"invalid_bot_action",
|
|
96
|
+
"tag_not_in_community",
|
|
97
|
+
"cant_block_local_instance",
|
|
98
|
+
"cant_block_local_instance",
|
|
99
|
+
"url_length_overflow",
|
|
100
|
+
"oauth_authorization_invalid",
|
|
101
|
+
"oauth_login_failed",
|
|
102
|
+
"oauth_registration_closed",
|
|
103
|
+
"not_found",
|
|
104
|
+
"community_has_no_followers",
|
|
105
|
+
"post_schedule_time_must_be_in_future",
|
|
106
|
+
"too_many_scheduled_posts",
|
|
107
|
+
"cannot_combine_federation_blocklist_and_allowlist",
|
|
108
|
+
"cannot_combine_federation_blocklist_and_allowlist",
|
|
109
|
+
"couldnt_parse_pagination_token",
|
|
110
|
+
"couldnt_parse_pagination_token",
|
|
111
|
+
"invalid_fetch_limit",
|
|
112
|
+
"email_notifications_disabled",
|
|
113
|
+
"multi_community_update_wrong_user",
|
|
114
|
+
"cannot_combine_community_id_and_multi_community_id",
|
|
115
|
+
"multi_community_entry_limit_reached"
|
|
116
|
+
];
|
|
@@ -12,7 +12,7 @@ export type BanFromCommunity = {
|
|
|
12
12
|
* If ban is true, then this means remove. If ban is false, it means restore.
|
|
13
13
|
*/
|
|
14
14
|
remove_or_restore_data?: boolean;
|
|
15
|
-
reason
|
|
15
|
+
reason?: string;
|
|
16
16
|
/**
|
|
17
17
|
* A time that the ban will expire, in unix epoch seconds.
|
|
18
18
|
*
|
|
@@ -10,7 +10,7 @@ export type BanPerson = {
|
|
|
10
10
|
* If ban is true, then this means remove. If ban is false, it means restore.
|
|
11
11
|
*/
|
|
12
12
|
remove_or_restore_data?: boolean;
|
|
13
|
-
reason
|
|
13
|
+
reason?: string;
|
|
14
14
|
/**
|
|
15
15
|
* A time that the ban will expire, in unix epoch seconds.
|
|
16
16
|
*
|
|
@@ -27,6 +27,7 @@ export type CreateSite = {
|
|
|
27
27
|
application_email_admins?: boolean;
|
|
28
28
|
discussion_languages?: Array<LanguageId>;
|
|
29
29
|
slur_filter_regex?: string;
|
|
30
|
+
actor_name_max_length?: number;
|
|
30
31
|
rate_limit_message_max_requests?: number;
|
|
31
32
|
rate_limit_message_interval_seconds?: number;
|
|
32
33
|
rate_limit_post_max_requests?: number;
|
package/dist/types/EditSite.d.ts
CHANGED
|
@@ -79,6 +79,10 @@ export type EditSite = {
|
|
|
79
79
|
* A regex string of items to filter.
|
|
80
80
|
*/
|
|
81
81
|
slur_filter_regex?: string;
|
|
82
|
+
/**
|
|
83
|
+
* The max length of actor names.
|
|
84
|
+
*/
|
|
85
|
+
actor_name_max_length?: number;
|
|
82
86
|
/**
|
|
83
87
|
* The number of messages allowed in a given time frame.
|
|
84
88
|
*/
|
|
@@ -72,24 +72,24 @@ export type LocalUser = {
|
|
|
72
72
|
* should be paused
|
|
73
73
|
*/
|
|
74
74
|
enable_animated_images: boolean;
|
|
75
|
-
/**
|
|
76
|
-
* Whether to auto-collapse bot comments.
|
|
77
|
-
*/
|
|
78
|
-
collapse_bot_comments: boolean;
|
|
79
|
-
/**
|
|
80
|
-
* The last time a donation request was shown to this user. If this is more than a year ago,
|
|
81
|
-
* a new notification request should be shown.
|
|
82
|
-
*/
|
|
83
|
-
last_donation_notification_at: string;
|
|
84
75
|
/**
|
|
85
76
|
* Whether a user can send / receive private messages
|
|
86
77
|
*/
|
|
87
78
|
enable_private_messages: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Whether to auto-collapse bot comments.
|
|
81
|
+
*/
|
|
82
|
+
collapse_bot_comments: boolean;
|
|
88
83
|
default_comment_sort_type: CommentSortType;
|
|
89
84
|
/**
|
|
90
85
|
* Whether to automatically mark fetched posts as read.
|
|
91
86
|
*/
|
|
92
87
|
auto_mark_fetched_posts_as_read: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* The last time a donation request was shown to this user. If this is more than a year ago,
|
|
90
|
+
* a new notification request should be shown.
|
|
91
|
+
*/
|
|
92
|
+
last_donation_notification_at: string;
|
|
93
93
|
/**
|
|
94
94
|
* Whether to hide posts containing images/videos
|
|
95
95
|
*/
|
package/dist/types/LockPost.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ModLockCommentId } from "./ModLockCommentId";
|
|
1
|
+
import type { ModLockPostId } from "./ModLockPostId";
|
|
3
2
|
import type { PersonId } from "./PersonId";
|
|
3
|
+
import type { PostId } from "./PostId";
|
|
4
4
|
/**
|
|
5
5
|
* When a moderator locks a comment (prevents new replies to a comment or its children).
|
|
6
6
|
*/
|
|
7
7
|
export type ModLockComment = {
|
|
8
|
-
id:
|
|
8
|
+
id: ModLockPostId;
|
|
9
9
|
mod_person_id: PersonId;
|
|
10
|
-
comment_id:
|
|
10
|
+
comment_id: PostId;
|
|
11
11
|
locked: boolean;
|
|
12
|
-
reason
|
|
12
|
+
reason?: string;
|
|
13
13
|
published_at: string;
|
|
14
14
|
};
|
|
@@ -2,7 +2,6 @@ import type { Comment } from "./Comment";
|
|
|
2
2
|
import type { Community } from "./Community";
|
|
3
3
|
import type { ModLockComment } from "./ModLockComment";
|
|
4
4
|
import type { Person } from "./Person";
|
|
5
|
-
import type { Post } from "./Post";
|
|
6
5
|
/**
|
|
7
6
|
* When a moderator locks a comment (prevents replies to it or its children).
|
|
8
7
|
*/
|
|
@@ -11,6 +10,5 @@ export type ModLockCommentView = {
|
|
|
11
10
|
moderator?: Person;
|
|
12
11
|
other_person: Person;
|
|
13
12
|
comment: Comment;
|
|
14
|
-
post: Post;
|
|
15
13
|
community: Community;
|
|
16
14
|
};
|
package/dist/types/Post.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Comment } from "./Comment";
|
|
2
2
|
import type { Post } from "./Post";
|
|
3
3
|
import type { PrivateMessage } from "./PrivateMessage";
|
|
4
|
-
export type PostOrCommentOrPrivateMessage =
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
}
|
|
4
|
+
export type PostOrCommentOrPrivateMessage = {
|
|
5
|
+
Post: Post;
|
|
6
|
+
} | {
|
|
7
|
+
Comment: Comment;
|
|
8
|
+
} | {
|
|
9
|
+
PrivateMessage: PrivateMessage;
|
|
10
|
+
};
|
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": "1.0.0-
|
|
4
|
+
"version": "1.0.0-errors-array.0",
|
|
5
5
|
"author": "Dessalines",
|
|
6
6
|
"license": "AGPL-3.0",
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"typescript": "^5.5.4",
|
|
45
45
|
"typescript-eslint": "^8.7.0"
|
|
46
46
|
},
|
|
47
|
-
"packageManager": "pnpm@10.
|
|
47
|
+
"packageManager": "pnpm@10.15.1",
|
|
48
48
|
"types": "./dist/index.d.ts",
|
|
49
49
|
"lint-staged": {
|
|
50
50
|
"*.{ts,tsx,js}": [
|