lemmy-js-client 0.20.0-api-v4.7 → 0.20.0-api-v4.8

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.
Files changed (34) hide show
  1. package/dist/http.d.ts +17 -4
  2. package/dist/http.js +18 -2
  3. package/dist/index.d.ts +9 -2
  4. package/dist/types/AdminAllowInstance.d.ts +10 -0
  5. package/dist/types/AdminAllowInstanceParams.d.ts +5 -0
  6. package/dist/types/AdminAllowInstanceView.d.ts +11 -0
  7. package/dist/types/AdminAllowInstanceView.js +2 -0
  8. package/dist/types/AdminBlockInstance.d.ts +11 -0
  9. package/dist/types/AdminBlockInstance.js +2 -0
  10. package/dist/types/AdminBlockInstanceParams.d.ts +6 -0
  11. package/dist/types/AdminBlockInstanceParams.js +3 -0
  12. package/dist/types/AdminBlockInstanceView.d.ts +11 -0
  13. package/dist/types/AdminBlockInstanceView.js +2 -0
  14. package/dist/types/CreateSite.d.ts +0 -2
  15. package/dist/types/EditSite.d.ts +0 -8
  16. package/dist/types/FederationBlockList.d.ts +7 -0
  17. package/dist/types/FederationBlockList.js +2 -0
  18. package/dist/types/FederationError.d.ts +1 -1
  19. package/dist/types/GetModlogResponse.d.ts +4 -0
  20. package/dist/types/GetPosts.d.ts +4 -0
  21. package/dist/types/HidePost.d.ts +1 -1
  22. package/dist/types/LemmyErrorType.d.ts +6 -1
  23. package/dist/types/LocalUser.d.ts +8 -0
  24. package/dist/types/MarkManyPostsAsRead.d.ts +7 -0
  25. package/dist/types/MarkManyPostsAsRead.js +2 -0
  26. package/dist/types/MarkPostAsRead.d.ts +1 -1
  27. package/dist/types/ModlogActionType.d.ts +1 -1
  28. package/dist/types/SaveUserSettings.d.ts +8 -0
  29. package/dist/types/{BlockInstance.d.ts → UserBlockInstanceParams.d.ts} +1 -1
  30. package/dist/types/UserBlockInstanceParams.js +2 -0
  31. package/package.json +1 -1
  32. package/dist/types/BlockInstanceResponse.d.ts +0 -3
  33. /package/dist/types/{BlockInstance.js → AdminAllowInstance.js} +0 -0
  34. /package/dist/types/{BlockInstanceResponse.js → AdminAllowInstanceParams.js} +0 -0
package/dist/http.d.ts CHANGED
@@ -124,8 +124,6 @@ import { TransferCommunity } from "./types/TransferCommunity";
124
124
  import { VerifyEmail } from "./types/VerifyEmail";
125
125
  import { DeleteImage, UploadImage, UploadImageResponse } from "./other_types";
126
126
  import { HideCommunity } from "./types/HideCommunity";
127
- import { BlockInstance } from "./types/BlockInstance";
128
- import { BlockInstanceResponse } from "./types/BlockInstanceResponse";
129
127
  import { GenerateTotpSecretResponse } from "./types/GenerateTotpSecretResponse";
130
128
  import { UpdateTotp } from "./types/UpdateTotp";
131
129
  import { UpdateTotpResponse } from "./types/UpdateTotpResponse";
@@ -155,6 +153,9 @@ import { ListCommunityPendingFollowsResponse } from "./types/ListCommunityPendin
155
153
  import { ListCommunityPendingFollows } from "./types/ListCommunityPendingFollows";
156
154
  import { CommunityId } from "./types/CommunityId";
157
155
  import { MyUserInfo } from "./types/MyUserInfo";
156
+ import { UserBlockInstanceParams } from "./types/UserBlockInstanceParams";
157
+ import { AdminAllowInstanceParams } from "./types/AdminAllowInstanceParams";
158
+ import { AdminBlockInstanceParams } from "./types/AdminBlockInstanceParams";
158
159
  type RequestOptions = Pick<RequestInit, "signal">;
159
160
  /**
160
161
  * Helps build lemmy HTTP requests.
@@ -849,11 +850,23 @@ export declare class LemmyHttp {
849
850
  */
850
851
  getFederatedInstances(options?: RequestOptions): Promise<GetFederatedInstancesResponse>;
851
852
  /**
852
- * Block an instance.
853
+ * Block an instance as user.
853
854
  *
854
855
  * `HTTP.Post /site/block`
855
856
  */
856
- blockInstance(form: BlockInstance, options?: RequestOptions): Promise<BlockInstanceResponse>;
857
+ userBlockInstance(form: UserBlockInstanceParams, options?: RequestOptions): Promise<SuccessResponse>;
858
+ /**
859
+ * Globally block an instance as admin.
860
+ *
861
+ * `HTTP.Post /admin/block_instance`
862
+ */
863
+ adminBlockInstance(form: AdminBlockInstanceParams, options?: RequestOptions): Promise<SuccessResponse>;
864
+ /**
865
+ * Globally allow an instance as admin.
866
+ *
867
+ * `HTTP.Post /admin/allow_instance`
868
+ */
869
+ adminAllowInstance(form: AdminAllowInstanceParams, options?: RequestOptions): Promise<SuccessResponse>;
857
870
  /**
858
871
  * Upload an image to the server.
859
872
  */
package/dist/http.js CHANGED
@@ -959,13 +959,29 @@ class LemmyHttp {
959
959
  return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/federated_instances", {}, options);
960
960
  }
961
961
  /**
962
- * Block an instance.
962
+ * Block an instance as user.
963
963
  *
964
964
  * `HTTP.Post /site/block`
965
965
  */
966
- blockInstance(form, options) {
966
+ userBlockInstance(form, options) {
967
967
  return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/site/block", form, options);
968
968
  }
969
+ /**
970
+ * Globally block an instance as admin.
971
+ *
972
+ * `HTTP.Post /admin/block_instance`
973
+ */
974
+ adminBlockInstance(form, options) {
975
+ return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/admin/block_instance", form, options);
976
+ }
977
+ /**
978
+ * Globally allow an instance as admin.
979
+ *
980
+ * `HTTP.Post /admin/allow_instance`
981
+ */
982
+ adminAllowInstance(form, options) {
983
+ return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/admin/allow_instance", form, options);
984
+ }
969
985
  /**
970
986
  * Upload an image to the server.
971
987
  */
package/dist/index.d.ts CHANGED
@@ -5,6 +5,12 @@ export { AddAdmin } from "./types/AddAdmin";
5
5
  export { AddAdminResponse } from "./types/AddAdminResponse";
6
6
  export { AddModToCommunity } from "./types/AddModToCommunity";
7
7
  export { AddModToCommunityResponse } from "./types/AddModToCommunityResponse";
8
+ export { AdminAllowInstance } from "./types/AdminAllowInstance";
9
+ export { AdminAllowInstanceParams } from "./types/AdminAllowInstanceParams";
10
+ export { AdminAllowInstanceView } from "./types/AdminAllowInstanceView";
11
+ export { AdminBlockInstance } from "./types/AdminBlockInstance";
12
+ export { AdminBlockInstanceParams } from "./types/AdminBlockInstanceParams";
13
+ export { AdminBlockInstanceView } from "./types/AdminBlockInstanceView";
8
14
  export { AdminPurgeComment } from "./types/AdminPurgeComment";
9
15
  export { AdminPurgeCommentView } from "./types/AdminPurgeCommentView";
10
16
  export { AdminPurgeCommunity } from "./types/AdminPurgeCommunity";
@@ -23,8 +29,6 @@ export { BanPersonResponse } from "./types/BanPersonResponse";
23
29
  export { BannedPersonsResponse } from "./types/BannedPersonsResponse";
24
30
  export { BlockCommunity } from "./types/BlockCommunity";
25
31
  export { BlockCommunityResponse } from "./types/BlockCommunityResponse";
26
- export { BlockInstance } from "./types/BlockInstance";
27
- export { BlockInstanceResponse } from "./types/BlockInstanceResponse";
28
32
  export { BlockPerson } from "./types/BlockPerson";
29
33
  export { BlockPersonResponse } from "./types/BlockPersonResponse";
30
34
  export { CaptchaResponse } from "./types/CaptchaResponse";
@@ -90,6 +94,7 @@ export { EditPrivateMessage } from "./types/EditPrivateMessage";
90
94
  export { EditSite } from "./types/EditSite";
91
95
  export { FeaturePost } from "./types/FeaturePost";
92
96
  export { FederatedInstances } from "./types/FederatedInstances";
97
+ export { FederationBlockList } from "./types/FederationBlockList";
93
98
  export { FederationError } from "./types/FederationError";
94
99
  export { FederationMode } from "./types/FederationMode";
95
100
  export { FollowCommunity } from "./types/FollowCommunity";
@@ -174,6 +179,7 @@ export { Login } from "./types/Login";
174
179
  export { LoginResponse } from "./types/LoginResponse";
175
180
  export { LoginToken } from "./types/LoginToken";
176
181
  export { MarkCommentReplyAsRead } from "./types/MarkCommentReplyAsRead";
182
+ export { MarkManyPostsAsRead } from "./types/MarkManyPostsAsRead";
177
183
  export { MarkPersonMentionAsRead } from "./types/MarkPersonMentionAsRead";
178
184
  export { MarkPostAsRead } from "./types/MarkPostAsRead";
179
185
  export { MarkPrivateMessageAsRead } from "./types/MarkPrivateMessageAsRead";
@@ -280,5 +286,6 @@ export { TransferCommunity } from "./types/TransferCommunity";
280
286
  export { UpdateTagline } from "./types/UpdateTagline";
281
287
  export { UpdateTotp } from "./types/UpdateTotp";
282
288
  export { UpdateTotpResponse } from "./types/UpdateTotpResponse";
289
+ export { UserBlockInstanceParams } from "./types/UserBlockInstanceParams";
283
290
  export { VerifyEmail } from "./types/VerifyEmail";
284
291
  export { VoteView } from "./types/VoteView";
@@ -0,0 +1,10 @@
1
+ import type { InstanceId } from "./InstanceId";
2
+ import type { PersonId } from "./PersonId";
3
+ export type AdminAllowInstance = {
4
+ id: number;
5
+ instance_id: InstanceId;
6
+ admin_person_id: PersonId;
7
+ allowed: boolean;
8
+ reason?: string;
9
+ published: string;
10
+ };
@@ -0,0 +1,5 @@
1
+ export type AdminAllowInstanceParams = {
2
+ instance: string;
3
+ allow: boolean;
4
+ reason?: string;
5
+ };
@@ -0,0 +1,11 @@
1
+ import type { AdminAllowInstance } from "./AdminAllowInstance";
2
+ import type { Instance } from "./Instance";
3
+ import type { Person } from "./Person";
4
+ /**
5
+ * When an admin purges a post.
6
+ */
7
+ export type AdminAllowInstanceView = {
8
+ admin_block_instance: AdminAllowInstance;
9
+ instance: Instance;
10
+ admin?: Person;
11
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ import type { InstanceId } from "./InstanceId";
2
+ import type { PersonId } from "./PersonId";
3
+ export type AdminBlockInstance = {
4
+ id: number;
5
+ instance_id: InstanceId;
6
+ admin_person_id: PersonId;
7
+ blocked: boolean;
8
+ reason?: string;
9
+ expires?: string;
10
+ published: string;
11
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ export type AdminBlockInstanceParams = {
2
+ instance: string;
3
+ block: boolean;
4
+ reason?: string;
5
+ expires?: string;
6
+ };
@@ -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,11 @@
1
+ import type { AdminBlockInstance } from "./AdminBlockInstance";
2
+ import type { Instance } from "./Instance";
3
+ import type { Person } from "./Person";
4
+ /**
5
+ * When an admin purges a post.
6
+ */
7
+ export type AdminBlockInstanceView = {
8
+ admin_block_instance: AdminBlockInstance;
9
+ instance: Instance;
10
+ admin?: Person;
11
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -46,8 +46,6 @@ export type CreateSite = {
46
46
  federation_debug?: boolean;
47
47
  captcha_enabled?: boolean;
48
48
  captcha_difficulty?: string;
49
- allowed_instances?: Array<string>;
50
- blocked_instances?: Array<string>;
51
49
  registration_mode?: RegistrationMode;
52
50
  oauth_registration?: boolean;
53
51
  content_warning?: string;
@@ -136,14 +136,6 @@ export type EditSite = {
136
136
  * The captcha difficulty. Can be easy, medium, or hard
137
137
  */
138
138
  captcha_difficulty?: string;
139
- /**
140
- * A list of allowed instances. If none are set, federation is open.
141
- */
142
- allowed_instances?: Array<string>;
143
- /**
144
- * A list of blocked instances.
145
- */
146
- blocked_instances?: Array<string>;
147
139
  /**
148
140
  * A list of blocked URLs
149
141
  */
@@ -0,0 +1,7 @@
1
+ import type { InstanceId } from "./InstanceId";
2
+ export type FederationBlockList = {
3
+ instance_id: InstanceId;
4
+ published: string;
5
+ updated?: string;
6
+ expires?: string;
7
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -7,4 +7,4 @@ export type FederationError = "CouldntFindActivity" | "InvalidCommunity" | "Cann
7
7
  DomainBlocked: string;
8
8
  } | {
9
9
  DomainNotInAllowList: string;
10
- } | "FederationDisabledByStrictAllowList" | "ContradictingFilters" | "UrlWithoutDomain" | "InboxTimeout" | "CantDeleteSite" | "ObjectIsNotPublic" | "ObjectIsNotPrivate";
10
+ } | "FederationDisabledByStrictAllowList" | "ContradictingFilters" | "UrlWithoutDomain" | "InboxTimeout" | "CantDeleteSite" | "ObjectIsNotPublic" | "ObjectIsNotPrivate" | "Unreachable";
@@ -1,3 +1,5 @@
1
+ import type { AdminAllowInstanceView } from "./AdminAllowInstanceView";
2
+ import type { AdminBlockInstanceView } from "./AdminBlockInstanceView";
1
3
  import type { AdminPurgeCommentView } from "./AdminPurgeCommentView";
2
4
  import type { AdminPurgeCommunityView } from "./AdminPurgeCommunityView";
3
5
  import type { AdminPurgePersonView } from "./AdminPurgePersonView";
@@ -32,4 +34,6 @@ export type GetModlogResponse = {
32
34
  admin_purged_posts: Array<AdminPurgePostView>;
33
35
  admin_purged_comments: Array<AdminPurgeCommentView>;
34
36
  hidden_communities: Array<ModHideCommunityView>;
37
+ admin_block_instance: Array<AdminBlockInstanceView>;
38
+ admin_allow_instance: Array<AdminAllowInstanceView>;
35
39
  };
@@ -27,6 +27,10 @@ export type GetPosts = {
27
27
  * If true, then show the nsfw posts (even if your user setting is to hide them)
28
28
  */
29
29
  show_nsfw?: boolean;
30
+ /**
31
+ * Whether to automatically mark fetched posts as read.
32
+ */
33
+ mark_as_read?: boolean;
30
34
  /**
31
35
  * If true, then only show posts with no comments
32
36
  */
@@ -3,6 +3,6 @@ import type { PostId } from "./PostId";
3
3
  * Hide a post from list views
4
4
  */
5
5
  export type HidePost = {
6
- post_ids: Array<PostId>;
6
+ post_id: PostId;
7
7
  hide: boolean;
8
8
  };
@@ -124,7 +124,8 @@ export type LemmyErrorType = {
124
124
  } | {
125
125
  error: "email_smtp_server_needs_a_port";
126
126
  } | {
127
- error: "missing_an_email";
127
+ error: "invalid_email_address";
128
+ message: string;
128
129
  } | {
129
130
  error: "rate_limit_error";
130
131
  } | {
@@ -232,6 +233,8 @@ export type LemmyErrorType = {
232
233
  error: "captcha_incorrect";
233
234
  } | {
234
235
  error: "couldnt_create_audio_captcha";
236
+ } | {
237
+ error: "couldnt_create_image_captcha";
235
238
  } | {
236
239
  error: "invalid_url_scheme";
237
240
  } | {
@@ -271,6 +274,8 @@ export type LemmyErrorType = {
271
274
  error: "post_schedule_time_must_be_in_future";
272
275
  } | {
273
276
  error: "too_many_scheduled_posts";
277
+ } | {
278
+ error: "cannot_combine_federation_blocklist_and_allowlist";
274
279
  } | {
275
280
  error: "federation_error";
276
281
  message: {
@@ -71,9 +71,17 @@ export type LocalUser = {
71
71
  * should be paused
72
72
  */
73
73
  enable_animated_images: boolean;
74
+ /**
75
+ * Whether a user can send / receive private messages
76
+ */
77
+ enable_private_messages: boolean;
74
78
  /**
75
79
  * Whether to auto-collapse bot comments.
76
80
  */
77
81
  collapse_bot_comments: boolean;
78
82
  default_comment_sort_type: CommentSortType;
83
+ /**
84
+ * Whether to automatically mark fetched posts as read.
85
+ */
86
+ auto_mark_fetched_posts_as_read: boolean;
79
87
  };
@@ -0,0 +1,7 @@
1
+ import type { PostId } from "./PostId";
2
+ /**
3
+ * Mark several posts as read.
4
+ */
5
+ export type MarkManyPostsAsRead = {
6
+ post_ids: Array<PostId>;
7
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -3,6 +3,6 @@ import type { PostId } from "./PostId";
3
3
  * Mark a post as read.
4
4
  */
5
5
  export type MarkPostAsRead = {
6
- post_ids: Array<PostId>;
6
+ post_id: PostId;
7
7
  read: boolean;
8
8
  };
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * A list of possible types for the various modlog actions.
3
3
  */
4
- export type ModlogActionType = "All" | "ModRemovePost" | "ModLockPost" | "ModFeaturePost" | "ModRemoveComment" | "ModRemoveCommunity" | "ModBanFromCommunity" | "ModAddCommunity" | "ModTransferCommunity" | "ModAdd" | "ModBan" | "ModHideCommunity" | "AdminPurgePerson" | "AdminPurgeCommunity" | "AdminPurgePost" | "AdminPurgeComment";
4
+ export type ModlogActionType = "All" | "ModRemovePost" | "ModLockPost" | "ModFeaturePost" | "ModRemoveComment" | "ModRemoveCommunity" | "ModBanFromCommunity" | "ModAddCommunity" | "ModTransferCommunity" | "ModAdd" | "ModBan" | "ModHideCommunity" | "AdminPurgePerson" | "AdminPurgeCommunity" | "AdminPurgePost" | "AdminPurgeComment" | "AdminBlockInstance" | "AdminAllowInstance";
@@ -105,6 +105,10 @@ export type SaveUserSettings = {
105
105
  * should be paused
106
106
  */
107
107
  enable_animated_images?: boolean;
108
+ /**
109
+ * Whether a user can send / receive private messages
110
+ */
111
+ enable_private_messages?: boolean;
108
112
  /**
109
113
  * Whether to auto-collapse bot comments.
110
114
  */
@@ -116,4 +120,8 @@ export type SaveUserSettings = {
116
120
  show_upvotes?: boolean;
117
121
  show_downvotes?: boolean;
118
122
  show_upvote_percentage?: boolean;
123
+ /**
124
+ * Whether to automatically mark fetched posts as read.
125
+ */
126
+ auto_mark_fetched_posts_as_read?: boolean;
119
127
  };
@@ -2,7 +2,7 @@ import type { InstanceId } from "./InstanceId";
2
2
  /**
3
3
  * Block an instance as user
4
4
  */
5
- export type BlockInstance = {
5
+ export type UserBlockInstanceParams = {
6
6
  instance_id: InstanceId;
7
7
  block: boolean;
8
8
  };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
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.20.0-api-v4.7",
4
+ "version": "0.20.0-api-v4.8",
5
5
  "author": "Dessalines <tyhou13@gmx.com>",
6
6
  "license": "AGPL-3.0",
7
7
  "main": "./dist/index.js",
@@ -1,3 +0,0 @@
1
- export type BlockInstanceResponse = {
2
- blocked: boolean;
3
- };