lemmy-js-client 1.0.0-emoji-shortcode.1 → 1.0.0-enum-for-api.1
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 +11 -12
- package/dist/http.js +8 -7
- package/dist/index.d.ts +5 -4
- package/dist/index.js +3 -0
- package/dist/types/AllLemmyErrors.d.ts +1 -0
- package/dist/types/AllLemmyErrors.js +116 -0
- package/dist/types/CommentReportView.d.ts +2 -0
- package/dist/types/CommunityReportView.d.ts +2 -0
- package/dist/types/GetComments.d.ts +5 -2
- package/dist/types/GetCommunity.d.ts +4 -4
- package/dist/types/GetMultiCommunity.d.ts +2 -1
- package/dist/types/GetPersonDetails.d.ts +3 -5
- package/dist/types/GetPosts.d.ts +6 -3
- package/dist/types/LemmyErrorType.d.ts +11 -15
- package/dist/types/ListPersonContent.d.ts +3 -5
- package/dist/types/MultiCommunityResponse.d.ts +4 -0
- package/dist/types/MultiCommunityView.d.ts +2 -0
- package/dist/types/NameOrId.d.ts +4 -0
- package/dist/types/Notification.d.ts +20 -0
- package/dist/types/NotificationData.d.ts +31 -1
- package/dist/types/NotificationType.d.ts +1 -1
- package/dist/types/PersonResponse.d.ts +7 -0
- package/dist/types/PostReportView.d.ts +2 -0
- package/dist/types/PrivateMessageReportView.d.ts +1 -0
- package/dist/types/UntranslatedError.d.ts +12 -0
- package/dist/types/UntranslatedError.js +3 -0
- package/package.json +2 -2
- package/dist/types/BanPersonResponse.d.ts +0 -8
- package/dist/types/BlockCommunityResponse.d.ts +0 -8
- package/dist/types/BlockPersonResponse.d.ts +0 -8
- package/dist/types/BlockPersonResponse.js +0 -2
- package/dist/types/FederationError.d.ts +0 -12
- /package/dist/types/{BanPersonResponse.js → MultiCommunityResponse.js} +0 -0
- /package/dist/types/{FederationError.js → NameOrId.js} +0 -0
- /package/dist/types/{BlockCommunityResponse.js → PersonResponse.js} +0 -0
package/dist/http.d.ts
CHANGED
|
@@ -9,11 +9,8 @@ import { BanFromCommunity } from "./types/BanFromCommunity";
|
|
|
9
9
|
import { BanFromCommunityResponse } from "./types/BanFromCommunityResponse";
|
|
10
10
|
import { MarkManyPostsAsRead } from "./types/MarkManyPostsAsRead";
|
|
11
11
|
import { BanPerson } from "./types/BanPerson";
|
|
12
|
-
import { BanPersonResponse } from "./types/BanPersonResponse";
|
|
13
12
|
import { BlockCommunity } from "./types/BlockCommunity";
|
|
14
|
-
import { BlockCommunityResponse } from "./types/BlockCommunityResponse";
|
|
15
13
|
import { BlockPerson } from "./types/BlockPerson";
|
|
16
|
-
import { BlockPersonResponse } from "./types/BlockPersonResponse";
|
|
17
14
|
import { ChangePassword } from "./types/ChangePassword";
|
|
18
15
|
import { CommentReportResponse } from "./types/CommentReportResponse";
|
|
19
16
|
import { CommentResponse } from "./types/CommentResponse";
|
|
@@ -149,6 +146,7 @@ import { ListNotificationsResponse } from "./types/ListNotificationsResponse";
|
|
|
149
146
|
import { ModEditPost } from "./types/ModEditPost";
|
|
150
147
|
import { UpdateCommunityNotifications } from "./types/UpdateCommunityNotifications";
|
|
151
148
|
import { UpdatePostNotifications } from "./types/UpdatePostNotifications";
|
|
149
|
+
import { PersonResponse } from "./types/PersonResponse";
|
|
152
150
|
type RequestOptions = Pick<RequestInit, "signal">;
|
|
153
151
|
/**
|
|
154
152
|
* Helps build lemmy HTTP requests.
|
|
@@ -255,7 +253,7 @@ export declare class LemmyHttp extends Controller {
|
|
|
255
253
|
/**
|
|
256
254
|
* @summary Get / fetch a community.
|
|
257
255
|
*/
|
|
258
|
-
getCommunity(form
|
|
256
|
+
getCommunity(form: GetCommunityI, options?: RequestOptions): Promise<GetCommunityResponse>;
|
|
259
257
|
/**
|
|
260
258
|
* @summary Edit a community.
|
|
261
259
|
*/
|
|
@@ -283,7 +281,7 @@ export declare class LemmyHttp extends Controller {
|
|
|
283
281
|
/**
|
|
284
282
|
* @summary Block a community.
|
|
285
283
|
*/
|
|
286
|
-
blockCommunity(form: BlockCommunity, options?: RequestOptions): Promise<
|
|
284
|
+
blockCommunity(form: BlockCommunity, options?: RequestOptions): Promise<CommunityResponse>;
|
|
287
285
|
/**
|
|
288
286
|
* @summary Delete a community.
|
|
289
287
|
*/
|
|
@@ -355,7 +353,7 @@ export declare class LemmyHttp extends Controller {
|
|
|
355
353
|
/**
|
|
356
354
|
* @summary Hide a post from list views.
|
|
357
355
|
*/
|
|
358
|
-
hidePost(form: HidePost, options?: RequestOptions): Promise<
|
|
356
|
+
hidePost(form: HidePost, options?: RequestOptions): Promise<PostResponse>;
|
|
359
357
|
/**
|
|
360
358
|
* @summary A moderator can lock a post ( IE disable new comments ).
|
|
361
359
|
*/
|
|
@@ -483,11 +481,11 @@ export declare class LemmyHttp extends Controller {
|
|
|
483
481
|
/**
|
|
484
482
|
* @summary Get the details for a person.
|
|
485
483
|
*/
|
|
486
|
-
getPersonDetails(form
|
|
484
|
+
getPersonDetails(form: GetPersonDetailsI, options?: RequestOptions): Promise<GetPersonDetailsResponse>;
|
|
487
485
|
/**
|
|
488
486
|
* @summary List the content for a person.
|
|
489
487
|
*/
|
|
490
|
-
listPersonContent(form
|
|
488
|
+
listPersonContent(form: ListPersonContentI, options?: RequestOptions): Promise<ListPersonContentResponse>;
|
|
491
489
|
/**
|
|
492
490
|
* @summary Make a note for a person.
|
|
493
491
|
*/
|
|
@@ -495,7 +493,7 @@ export declare class LemmyHttp extends Controller {
|
|
|
495
493
|
/**
|
|
496
494
|
* @summary Ban a person from your site.
|
|
497
495
|
*/
|
|
498
|
-
banPerson(form: BanPerson, options?: RequestOptions): Promise<
|
|
496
|
+
banPerson(form: BanPerson, options?: RequestOptions): Promise<PersonResponse>;
|
|
499
497
|
/**
|
|
500
498
|
* @summary Get a list of users.
|
|
501
499
|
*/
|
|
@@ -503,7 +501,7 @@ export declare class LemmyHttp extends Controller {
|
|
|
503
501
|
/**
|
|
504
502
|
* @summary Block a person.
|
|
505
503
|
*/
|
|
506
|
-
blockPerson(form: BlockPerson, options?: RequestOptions): Promise<
|
|
504
|
+
blockPerson(form: BlockPerson, options?: RequestOptions): Promise<PersonResponse>;
|
|
507
505
|
/**
|
|
508
506
|
* @summary Fetch a Captcha.
|
|
509
507
|
*/
|
|
@@ -525,7 +523,7 @@ export declare class LemmyHttp extends Controller {
|
|
|
525
523
|
*/
|
|
526
524
|
markAllNotificationsAsRead(options?: RequestOptions): Promise<SuccessResponse>;
|
|
527
525
|
/**
|
|
528
|
-
* @summary Mark a
|
|
526
|
+
* @summary Mark a notification as read.
|
|
529
527
|
*/
|
|
530
528
|
markNotificationAsRead(form: MarkNotificationAsRead, options?: RequestOptions): Promise<SuccessResponse>;
|
|
531
529
|
/**
|
|
@@ -781,6 +779,7 @@ export declare class LemmyHttp extends Controller {
|
|
|
781
779
|
* The msg is either an empty string, or extra non-translatable info.
|
|
782
780
|
*/
|
|
783
781
|
export declare class LemmyError extends Error {
|
|
784
|
-
|
|
782
|
+
status: number;
|
|
783
|
+
constructor(name: string, status: number, msg?: string);
|
|
785
784
|
}
|
|
786
785
|
export {};
|
package/dist/http.js
CHANGED
|
@@ -181,7 +181,7 @@ let LemmyHttp = class LemmyHttp extends runtime_1.Controller {
|
|
|
181
181
|
/**
|
|
182
182
|
* @summary Get / fetch a community.
|
|
183
183
|
*/
|
|
184
|
-
async getCommunity(form
|
|
184
|
+
async getCommunity(form, options) {
|
|
185
185
|
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/community", form, options);
|
|
186
186
|
}
|
|
187
187
|
/**
|
|
@@ -523,13 +523,13 @@ let LemmyHttp = class LemmyHttp extends runtime_1.Controller {
|
|
|
523
523
|
/**
|
|
524
524
|
* @summary Get the details for a person.
|
|
525
525
|
*/
|
|
526
|
-
async getPersonDetails(form
|
|
526
|
+
async getPersonDetails(form, options) {
|
|
527
527
|
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/person", form, options);
|
|
528
528
|
}
|
|
529
529
|
/**
|
|
530
530
|
* @summary List the content for a person.
|
|
531
531
|
*/
|
|
532
|
-
async listPersonContent(form
|
|
532
|
+
async listPersonContent(form, options) {
|
|
533
533
|
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/person/content", form, options);
|
|
534
534
|
}
|
|
535
535
|
/**
|
|
@@ -587,7 +587,7 @@ let LemmyHttp = class LemmyHttp extends runtime_1.Controller {
|
|
|
587
587
|
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/account/mark_as_read/all", {}, options);
|
|
588
588
|
}
|
|
589
589
|
/**
|
|
590
|
-
* @summary Mark a
|
|
590
|
+
* @summary Mark a notification as read.
|
|
591
591
|
*/
|
|
592
592
|
async markNotificationAsRead(form, options) {
|
|
593
593
|
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/account/mark_as_read", form, options);
|
|
@@ -1015,11 +1015,11 @@ _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, response.status);
|
|
1019
1019
|
}
|
|
1020
1020
|
if (!response.ok) {
|
|
1021
1021
|
console.error(`Request error while calling ${type_} ${endpoint} with ${form}`);
|
|
1022
|
-
let err = new LemmyError(json.error ?? response.statusText, json.message);
|
|
1022
|
+
let err = new LemmyError(json.error ?? response.statusText, response.status, json.message);
|
|
1023
1023
|
throw err;
|
|
1024
1024
|
}
|
|
1025
1025
|
else {
|
|
@@ -2114,9 +2114,10 @@ function createFormData(image) {
|
|
|
2114
2114
|
* The msg is either an empty string, or extra non-translatable info.
|
|
2115
2115
|
*/
|
|
2116
2116
|
class LemmyError extends Error {
|
|
2117
|
-
constructor(name, msg) {
|
|
2117
|
+
constructor(name, status, msg) {
|
|
2118
2118
|
super(msg ?? "");
|
|
2119
2119
|
this.name = name;
|
|
2120
|
+
this.status = status;
|
|
2120
2121
|
// Set the prototype explicitly.
|
|
2121
2122
|
Object.setPrototypeOf(this, LemmyError.prototype);
|
|
2122
2123
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -36,17 +36,15 @@ 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";
|
|
42
43
|
export { BanFromCommunity } from "./types/BanFromCommunity";
|
|
43
44
|
export { BanFromCommunityResponse } from "./types/BanFromCommunityResponse";
|
|
44
45
|
export { BanPerson } from "./types/BanPerson";
|
|
45
|
-
export { BanPersonResponse } from "./types/BanPersonResponse";
|
|
46
46
|
export { BlockCommunity } from "./types/BlockCommunity";
|
|
47
|
-
export { BlockCommunityResponse } from "./types/BlockCommunityResponse";
|
|
48
47
|
export { BlockPerson } from "./types/BlockPerson";
|
|
49
|
-
export { BlockPersonResponse } from "./types/BlockPersonResponse";
|
|
50
48
|
export { CaptchaResponse } from "./types/CaptchaResponse";
|
|
51
49
|
export { ChangePassword } from "./types/ChangePassword";
|
|
52
50
|
export { Comment } from "./types/Comment";
|
|
@@ -121,7 +119,6 @@ export { ExportDataResponse } from "./types/ExportDataResponse";
|
|
|
121
119
|
export { FeaturePost } from "./types/FeaturePost";
|
|
122
120
|
export { FederatedInstances } from "./types/FederatedInstances";
|
|
123
121
|
export { FederationBlockList } from "./types/FederationBlockList";
|
|
124
|
-
export { FederationError } from "./types/FederationError";
|
|
125
122
|
export { FederationMode } from "./types/FederationMode";
|
|
126
123
|
export { FollowCommunity } from "./types/FollowCommunity";
|
|
127
124
|
export { FollowMultiCommunity } from "./types/FollowMultiCommunity";
|
|
@@ -253,8 +250,10 @@ export { ModlogCombinedView } from "./types/ModlogCombinedView";
|
|
|
253
250
|
export { MultiCommunity } from "./types/MultiCommunity";
|
|
254
251
|
export { MultiCommunityFollow } from "./types/MultiCommunityFollow";
|
|
255
252
|
export { MultiCommunityId } from "./types/MultiCommunityId";
|
|
253
|
+
export { MultiCommunityResponse } from "./types/MultiCommunityResponse";
|
|
256
254
|
export { MultiCommunityView } from "./types/MultiCommunityView";
|
|
257
255
|
export { MyUserInfo } from "./types/MyUserInfo";
|
|
256
|
+
export { NameOrId } from "./types/NameOrId";
|
|
258
257
|
export { NotePerson } from "./types/NotePerson";
|
|
259
258
|
export { Notification } from "./types/Notification";
|
|
260
259
|
export { NotificationData } from "./types/NotificationData";
|
|
@@ -276,6 +275,7 @@ export { PersonContentCombinedView } from "./types/PersonContentCombinedView";
|
|
|
276
275
|
export { PersonContentType } from "./types/PersonContentType";
|
|
277
276
|
export { PersonId } from "./types/PersonId";
|
|
278
277
|
export { PersonLikedCombinedView } from "./types/PersonLikedCombinedView";
|
|
278
|
+
export { PersonResponse } from "./types/PersonResponse";
|
|
279
279
|
export { PersonSavedCombinedView } from "./types/PersonSavedCombinedView";
|
|
280
280
|
export { PersonView } from "./types/PersonView";
|
|
281
281
|
export { PluginMetadata } from "./types/PluginMetadata";
|
|
@@ -345,6 +345,7 @@ export { TaglineId } from "./types/TaglineId";
|
|
|
345
345
|
export { TaglineResponse } from "./types/TaglineResponse";
|
|
346
346
|
export { TagsView } from "./types/TagsView";
|
|
347
347
|
export { TransferCommunity } from "./types/TransferCommunity";
|
|
348
|
+
export { UntranslatedError } from "./types/UntranslatedError";
|
|
348
349
|
export { UpdateCommunityNotifications } from "./types/UpdateCommunityNotifications";
|
|
349
350
|
export { UpdateCommunityTag } from "./types/UpdateCommunityTag";
|
|
350
351
|
export { UpdateMultiCommunity } from "./types/UpdateMultiCommunity";
|
package/dist/index.js
CHANGED
|
@@ -14,4 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.AllLemmyErrors = void 0;
|
|
17
18
|
__exportStar(require("./http"), exports);
|
|
19
|
+
var AllLemmyErrors_1 = require("./types/AllLemmyErrors");
|
|
20
|
+
Object.defineProperty(exports, "AllLemmyErrors", { enumerable: true, get: function () { return AllLemmyErrors_1.AllLemmyErrors; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AllLemmyErrors: string[];
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AllLemmyErrors = void 0;
|
|
4
|
+
exports.AllLemmyErrors = [
|
|
5
|
+
"block_keyword_too_short",
|
|
6
|
+
"block_keyword_too_long",
|
|
7
|
+
"couldnt_update",
|
|
8
|
+
"couldnt_create",
|
|
9
|
+
"report_reason_required",
|
|
10
|
+
"report_too_long",
|
|
11
|
+
"not_a_moderator",
|
|
12
|
+
"not_an_admin",
|
|
13
|
+
"cant_block_yourself",
|
|
14
|
+
"cant_note_yourself",
|
|
15
|
+
"cant_block_admin",
|
|
16
|
+
"passwords_do_not_match",
|
|
17
|
+
"email_not_verified",
|
|
18
|
+
"email_required",
|
|
19
|
+
"cannot_leave_admin",
|
|
20
|
+
"cannot_leave_mod",
|
|
21
|
+
"cannot_leave_mod",
|
|
22
|
+
"cannot_leave_mod",
|
|
23
|
+
"pictrs_api_key_not_provided",
|
|
24
|
+
"pictrs_api_key_not_provided",
|
|
25
|
+
"no_content_type_header",
|
|
26
|
+
"not_an_image_type",
|
|
27
|
+
"image_upload_disabled",
|
|
28
|
+
"not_a_mod_or_admin",
|
|
29
|
+
"not_top_mod",
|
|
30
|
+
"not_logged_in",
|
|
31
|
+
"not_higher_mod",
|
|
32
|
+
"not_higher_admin",
|
|
33
|
+
"site_ban",
|
|
34
|
+
"deleted",
|
|
35
|
+
"person_is_blocked",
|
|
36
|
+
"community_is_blocked",
|
|
37
|
+
"instance_is_blocked",
|
|
38
|
+
"instance_is_private",
|
|
39
|
+
"invalid_password",
|
|
40
|
+
"site_description_length_overflow",
|
|
41
|
+
"honeypot_failed",
|
|
42
|
+
"registration_application_is_pending",
|
|
43
|
+
"locked",
|
|
44
|
+
"max_comment_depth_reached",
|
|
45
|
+
"no_comment_edit_allowed",
|
|
46
|
+
"only_admins_can_create_communities",
|
|
47
|
+
"already_exists",
|
|
48
|
+
"language_not_allowed",
|
|
49
|
+
"no_post_edit_allowed",
|
|
50
|
+
"nsfw_not_allowed",
|
|
51
|
+
"edit_private_message_not_allowed",
|
|
52
|
+
"application_question_required",
|
|
53
|
+
"invalid_default_post_listing_type",
|
|
54
|
+
"registration_closed",
|
|
55
|
+
"registration_application_answer_required",
|
|
56
|
+
"registration_username_required",
|
|
57
|
+
"email_already_taken",
|
|
58
|
+
"username_already_taken",
|
|
59
|
+
"person_is_banned_from_community",
|
|
60
|
+
"incorrect_login",
|
|
61
|
+
"no_email_setup",
|
|
62
|
+
"local_site_not_setup",
|
|
63
|
+
"local_site_not_setup",
|
|
64
|
+
"invalid_name",
|
|
65
|
+
"invalid_code_verifier",
|
|
66
|
+
"invalid_display_name",
|
|
67
|
+
"invalid_matrix_id",
|
|
68
|
+
"invalid_post_title",
|
|
69
|
+
"invalid_body_field",
|
|
70
|
+
"bio_length_overflow",
|
|
71
|
+
"alt_text_length_overflow",
|
|
72
|
+
"couldnt_parse_totp_secret",
|
|
73
|
+
"couldnt_generate_totp",
|
|
74
|
+
"missing_totp_token",
|
|
75
|
+
"missing_totp_secret",
|
|
76
|
+
"incorrect_totp_token",
|
|
77
|
+
"totp_already_enabled",
|
|
78
|
+
"blocked_url",
|
|
79
|
+
"invalid_url",
|
|
80
|
+
"email_send_failed",
|
|
81
|
+
"slurs",
|
|
82
|
+
"slurs",
|
|
83
|
+
"site_name_required",
|
|
84
|
+
"site_name_length_overflow",
|
|
85
|
+
"permissive_regex",
|
|
86
|
+
"invalid_regex",
|
|
87
|
+
"captcha_incorrect",
|
|
88
|
+
"couldnt_create_audio_captcha",
|
|
89
|
+
"couldnt_create_image_captcha",
|
|
90
|
+
"invalid_url_scheme",
|
|
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
|
+
"post_schedule_time_must_be_in_future",
|
|
105
|
+
"too_many_scheduled_posts",
|
|
106
|
+
"cannot_combine_federation_blocklist_and_allowlist",
|
|
107
|
+
"cannot_combine_federation_blocklist_and_allowlist",
|
|
108
|
+
"couldnt_parse_pagination_token",
|
|
109
|
+
"couldnt_parse_pagination_token",
|
|
110
|
+
"invalid_fetch_limit",
|
|
111
|
+
"email_notifications_disabled",
|
|
112
|
+
"multi_community_update_wrong_user",
|
|
113
|
+
"cannot_combine_community_id_and_multi_community_id",
|
|
114
|
+
"multi_community_entry_limit_reached",
|
|
115
|
+
"too_many_requests",
|
|
116
|
+
];
|
|
@@ -2,6 +2,7 @@ import type { CommentId } from "./CommentId";
|
|
|
2
2
|
import type { CommentSortType } from "./CommentSortType";
|
|
3
3
|
import type { CommunityId } from "./CommunityId";
|
|
4
4
|
import type { ListingType } from "./ListingType";
|
|
5
|
+
import type { NameOrId } from "./NameOrId";
|
|
5
6
|
import type { PaginationCursor } from "./PaginationCursor";
|
|
6
7
|
import type { PostId } from "./PostId";
|
|
7
8
|
/**
|
|
@@ -19,8 +20,10 @@ export type GetComments = {
|
|
|
19
20
|
page_cursor?: PaginationCursor;
|
|
20
21
|
page_back?: boolean;
|
|
21
22
|
limit?: number;
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Example: `star_trek`, or `star_trek@xyz.tld` or `12`
|
|
25
|
+
*/
|
|
26
|
+
community_name_or_id?: NameOrId<CommunityId>;
|
|
24
27
|
post_id?: PostId;
|
|
25
28
|
parent_id?: CommentId;
|
|
26
29
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { CommunityId } from "./CommunityId";
|
|
2
|
+
import type { NameOrId } from "./NameOrId";
|
|
2
3
|
/**
|
|
3
|
-
* Get a community. Must provide either an id, or a name.
|
|
4
|
+
* Get a community. Must provide either an id, or a name (eg star_trek or star_trek@xyz.tld).
|
|
4
5
|
*/
|
|
5
6
|
export type GetCommunity = {
|
|
6
|
-
id?: CommunityId;
|
|
7
7
|
/**
|
|
8
|
-
* Example: star_trek
|
|
8
|
+
* Example: `star_trek`, or `star_trek@xyz.tld` or `12`
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
name_or_id: NameOrId<CommunityId>;
|
|
11
11
|
};
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
+
import type { NameOrId } from "./NameOrId";
|
|
1
2
|
import type { PersonId } from "./PersonId";
|
|
2
3
|
/**
|
|
3
4
|
* Gets a person's details.
|
|
4
|
-
*
|
|
5
|
-
* Either person_id, or username are required.
|
|
6
5
|
*/
|
|
7
6
|
export type GetPersonDetails = {
|
|
8
|
-
person_id?: PersonId;
|
|
9
7
|
/**
|
|
10
|
-
* Example: dessalines
|
|
8
|
+
* Example: `dessalines`, or `dessalines@xyz.tld`, or `12`
|
|
11
9
|
*/
|
|
12
|
-
|
|
10
|
+
person_name_or_id: NameOrId<PersonId>;
|
|
13
11
|
};
|
package/dist/types/GetPosts.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CommunityId } from "./CommunityId";
|
|
2
2
|
import type { ListingType } from "./ListingType";
|
|
3
3
|
import type { MultiCommunityId } from "./MultiCommunityId";
|
|
4
|
+
import type { NameOrId } from "./NameOrId";
|
|
4
5
|
import type { PaginationCursor } from "./PaginationCursor";
|
|
5
6
|
import type { PostSortType } from "./PostSortType";
|
|
6
7
|
/**
|
|
@@ -15,9 +16,11 @@ export type GetPosts = {
|
|
|
15
16
|
* Use Zero to override the local_site and local_user time_range.
|
|
16
17
|
*/
|
|
17
18
|
time_range_seconds?: number;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Example: `star_trek`, or `star_trek@xyz.tld` or `12`
|
|
21
|
+
*/
|
|
22
|
+
community_name_or_id?: NameOrId<CommunityId>;
|
|
23
|
+
multi_community_name_or_id?: NameOrId<MultiCommunityId>;
|
|
21
24
|
show_hidden?: boolean;
|
|
22
25
|
/**
|
|
23
26
|
* If true, then show the read posts (even if your user setting is to hide them)
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { UntranslatedError } from "./UntranslatedError";
|
|
2
|
+
/**
|
|
3
|
+
* Errors used in the API, all of these are translated in lemmy-ui.
|
|
4
|
+
*/
|
|
2
5
|
export type LemmyErrorType = {
|
|
3
6
|
error: "block_keyword_too_short";
|
|
4
7
|
} | {
|
|
@@ -37,18 +40,15 @@ export type LemmyErrorType = {
|
|
|
37
40
|
} | {
|
|
38
41
|
error: "pictrs_purge_response_error";
|
|
39
42
|
message: string;
|
|
40
|
-
} | {
|
|
41
|
-
error: "image_url_missing_path_segments";
|
|
42
|
-
} | {
|
|
43
|
-
error: "image_url_missing_last_path_segment";
|
|
44
43
|
} | {
|
|
45
44
|
error: "pictrs_api_key_not_provided";
|
|
45
|
+
} | {
|
|
46
|
+
error: "pictrs_invalid_image_upload";
|
|
47
|
+
message: string;
|
|
46
48
|
} | {
|
|
47
49
|
error: "no_content_type_header";
|
|
48
50
|
} | {
|
|
49
51
|
error: "not_an_image_type";
|
|
50
|
-
} | {
|
|
51
|
-
error: "invalid_image_upload";
|
|
52
52
|
} | {
|
|
53
53
|
error: "image_upload_disabled";
|
|
54
54
|
} | {
|
|
@@ -115,8 +115,6 @@ export type LemmyErrorType = {
|
|
|
115
115
|
error: "username_already_taken";
|
|
116
116
|
} | {
|
|
117
117
|
error: "person_is_banned_from_community";
|
|
118
|
-
} | {
|
|
119
|
-
error: "no_id_given";
|
|
120
118
|
} | {
|
|
121
119
|
error: "incorrect_login";
|
|
122
120
|
} | {
|
|
@@ -183,8 +181,6 @@ export type LemmyErrorType = {
|
|
|
183
181
|
error: "couldnt_create_image_captcha";
|
|
184
182
|
} | {
|
|
185
183
|
error: "invalid_url_scheme";
|
|
186
|
-
} | {
|
|
187
|
-
error: "couldnt_send_webmention";
|
|
188
184
|
} | {
|
|
189
185
|
error: "contradicting_filters";
|
|
190
186
|
} | {
|
|
@@ -212,8 +208,6 @@ export type LemmyErrorType = {
|
|
|
212
208
|
error: "oauth_registration_closed";
|
|
213
209
|
} | {
|
|
214
210
|
error: "not_found";
|
|
215
|
-
} | {
|
|
216
|
-
error: "community_has_no_followers";
|
|
217
211
|
} | {
|
|
218
212
|
error: "post_schedule_time_must_be_in_future";
|
|
219
213
|
} | {
|
|
@@ -221,9 +215,9 @@ export type LemmyErrorType = {
|
|
|
221
215
|
} | {
|
|
222
216
|
error: "cannot_combine_federation_blocklist_and_allowlist";
|
|
223
217
|
} | {
|
|
224
|
-
error: "
|
|
218
|
+
error: "untranslated_error";
|
|
225
219
|
message: {
|
|
226
|
-
error?:
|
|
220
|
+
error?: UntranslatedError;
|
|
227
221
|
};
|
|
228
222
|
} | {
|
|
229
223
|
error: "couldnt_parse_pagination_token";
|
|
@@ -240,4 +234,6 @@ export type LemmyErrorType = {
|
|
|
240
234
|
error: "cannot_combine_community_id_and_multi_community_id";
|
|
241
235
|
} | {
|
|
242
236
|
error: "multi_community_entry_limit_reached";
|
|
237
|
+
} | {
|
|
238
|
+
error: "too_many_requests";
|
|
243
239
|
};
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
+
import type { NameOrId } from "./NameOrId";
|
|
1
2
|
import type { PaginationCursor } from "./PaginationCursor";
|
|
2
3
|
import type { PersonContentType } from "./PersonContentType";
|
|
3
4
|
import type { PersonId } from "./PersonId";
|
|
4
5
|
/**
|
|
5
6
|
* Gets a person's content (posts and comments)
|
|
6
|
-
*
|
|
7
|
-
* Either person_id, or username are required.
|
|
8
7
|
*/
|
|
9
8
|
export type ListPersonContent = {
|
|
10
9
|
type_?: PersonContentType;
|
|
11
|
-
person_id?: PersonId;
|
|
12
10
|
/**
|
|
13
|
-
* Example: dessalines
|
|
11
|
+
* Example: `dessalines`, or `dessalines@xyz.tld`, or `12`
|
|
14
12
|
*/
|
|
15
|
-
|
|
13
|
+
person_name_or_id: NameOrId<PersonId>;
|
|
16
14
|
page_cursor?: PaginationCursor;
|
|
17
15
|
page_back?: boolean;
|
|
18
16
|
limit?: number;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import type { CommunityFollowerState } from "./CommunityFollowerState";
|
|
1
2
|
import type { MultiCommunity } from "./MultiCommunity";
|
|
2
3
|
import type { Person } from "./Person";
|
|
3
4
|
export type MultiCommunityView = {
|
|
4
5
|
multi: MultiCommunity;
|
|
6
|
+
follow_state?: CommunityFollowerState;
|
|
5
7
|
owner: Person;
|
|
6
8
|
};
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
+
import type { AdminAddId } from "./AdminAddId";
|
|
2
|
+
import type { AdminBanId } from "./AdminBanId";
|
|
3
|
+
import type { AdminRemoveCommunityId } from "./AdminRemoveCommunityId";
|
|
1
4
|
import type { CommentId } from "./CommentId";
|
|
5
|
+
import type { ModAddToCommunityId } from "./ModAddToCommunityId";
|
|
6
|
+
import type { ModBanFromCommunityId } from "./ModBanFromCommunityId";
|
|
7
|
+
import type { ModLockCommentId } from "./ModLockCommentId";
|
|
8
|
+
import type { ModLockPostId } from "./ModLockPostId";
|
|
9
|
+
import type { ModRemoveCommentId } from "./ModRemoveCommentId";
|
|
10
|
+
import type { ModRemovePostId } from "./ModRemovePostId";
|
|
11
|
+
import type { ModTransferCommunityId } from "./ModTransferCommunityId";
|
|
2
12
|
import type { NotificationId } from "./NotificationId";
|
|
3
13
|
import type { NotificationType } from "./NotificationType";
|
|
4
14
|
import type { PersonId } from "./PersonId";
|
|
@@ -13,4 +23,14 @@ export type Notification = {
|
|
|
13
23
|
kind: NotificationType;
|
|
14
24
|
post_id?: PostId;
|
|
15
25
|
private_message_id?: PrivateMessageId;
|
|
26
|
+
admin_add_id?: AdminAddId;
|
|
27
|
+
mod_add_to_community_id?: ModAddToCommunityId;
|
|
28
|
+
admin_ban_id?: AdminBanId;
|
|
29
|
+
mod_ban_from_community_id?: ModBanFromCommunityId;
|
|
30
|
+
mod_lock_post_id?: ModLockPostId;
|
|
31
|
+
mod_remove_comment_id?: ModRemoveCommentId;
|
|
32
|
+
admin_remove_community_id?: AdminRemoveCommunityId;
|
|
33
|
+
mod_remove_post_id?: ModRemovePostId;
|
|
34
|
+
mod_lock_comment_id?: ModLockCommentId;
|
|
35
|
+
mod_transfer_community_id?: ModTransferCommunityId;
|
|
16
36
|
};
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
+
import type { AdminAdd } from "./AdminAdd";
|
|
2
|
+
import type { AdminBan } from "./AdminBan";
|
|
3
|
+
import type { AdminRemoveCommunity } from "./AdminRemoveCommunity";
|
|
1
4
|
import type { CommentView } from "./CommentView";
|
|
5
|
+
import type { ModAddToCommunity } from "./ModAddToCommunity";
|
|
6
|
+
import type { ModBanFromCommunity } from "./ModBanFromCommunity";
|
|
7
|
+
import type { ModLockComment } from "./ModLockComment";
|
|
8
|
+
import type { ModLockPost } from "./ModLockPost";
|
|
9
|
+
import type { ModRemoveComment } from "./ModRemoveComment";
|
|
10
|
+
import type { ModRemovePost } from "./ModRemovePost";
|
|
11
|
+
import type { ModTransferCommunity } from "./ModTransferCommunity";
|
|
2
12
|
import type { PostView } from "./PostView";
|
|
3
13
|
import type { PrivateMessageView } from "./PrivateMessageView";
|
|
4
14
|
export type NotificationData = ({
|
|
@@ -7,4 +17,24 @@ export type NotificationData = ({
|
|
|
7
17
|
type_: "Post";
|
|
8
18
|
} & PostView) | ({
|
|
9
19
|
type_: "PrivateMessage";
|
|
10
|
-
} & PrivateMessageView)
|
|
20
|
+
} & PrivateMessageView) | ({
|
|
21
|
+
type_: "AdminAdd";
|
|
22
|
+
} & AdminAdd) | ({
|
|
23
|
+
type_: "ModAddToCommunity";
|
|
24
|
+
} & ModAddToCommunity) | ({
|
|
25
|
+
type_: "AdminBan";
|
|
26
|
+
} & AdminBan) | ({
|
|
27
|
+
type_: "ModBanFromCommunity";
|
|
28
|
+
} & ModBanFromCommunity) | ({
|
|
29
|
+
type_: "ModLockPost";
|
|
30
|
+
} & ModLockPost) | ({
|
|
31
|
+
type_: "ModLockComment";
|
|
32
|
+
} & ModLockComment) | ({
|
|
33
|
+
type_: "ModRemovePost";
|
|
34
|
+
} & ModRemovePost) | ({
|
|
35
|
+
type_: "ModRemoveComment";
|
|
36
|
+
} & ModRemoveComment) | ({
|
|
37
|
+
type_: "AdminRemoveCommunity";
|
|
38
|
+
} & AdminRemoveCommunity) | ({
|
|
39
|
+
type_: "ModTransferCommunity";
|
|
40
|
+
} & ModTransferCommunity);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* These errors are only used for federation or internally and dont need to be translated.
|
|
3
|
+
*/
|
|
4
|
+
export type UntranslatedError = "InvalidCommunity" | "CannotCreatePostOrCommentInDeletedOrRemovedCommunity" | "CannotReceivePage" | "OnlyLocalAdminCanRemoveCommunity" | "OnlyLocalAdminCanRestoreCommunity" | "PostIsLocked" | {
|
|
5
|
+
PersonIsBannedFromSite: string;
|
|
6
|
+
} | "InvalidVoteValue" | "PageDoesNotSpecifyCreator" | "FederationDisabled" | {
|
|
7
|
+
DomainBlocked: string;
|
|
8
|
+
} | {
|
|
9
|
+
DomainNotInAllowList: string;
|
|
10
|
+
} | "FederationDisabledByStrictAllowList" | "ContradictingFilters" | "UrlWithoutDomain" | "InboxTimeout" | "CantDeleteSite" | "ObjectIsNotPublic" | "ObjectIsNotPrivate" | {
|
|
11
|
+
InvalidFollow: string;
|
|
12
|
+
} | "PurgeInvalidImageUrl" | "Unreachable" | "CouldntSendWebmention" | "CommunityHasNoFollowers";
|
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-enum-for-api.1",
|
|
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.18.0",
|
|
48
48
|
"types": "./dist/index.d.ts",
|
|
49
49
|
"lint-staged": {
|
|
50
50
|
"*.{ts,tsx,js}": [
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Federation related errors, these dont need to be translated.
|
|
3
|
-
*/
|
|
4
|
-
export type FederationError = "InvalidCommunity" | "CannotCreatePostOrCommentInDeletedOrRemovedCommunity" | "CannotReceivePage" | "OnlyLocalAdminCanRemoveCommunity" | "OnlyLocalAdminCanRestoreCommunity" | "PostIsLocked" | {
|
|
5
|
-
PersonIsBannedFromSite: string;
|
|
6
|
-
} | "InvalidVoteValue" | "PageDoesNotSpecifyCreator" | "FederationDisabled" | {
|
|
7
|
-
DomainBlocked: string;
|
|
8
|
-
} | {
|
|
9
|
-
DomainNotInAllowList: string;
|
|
10
|
-
} | "FederationDisabledByStrictAllowList" | "ContradictingFilters" | "UrlWithoutDomain" | "InboxTimeout" | "CantDeleteSite" | "ObjectIsNotPublic" | "ObjectIsNotPrivate" | {
|
|
11
|
-
InvalidFollow: string;
|
|
12
|
-
} | "Unreachable";
|
|
File without changes
|
|
File without changes
|
|
File without changes
|