From dff3b2ebef4efdc3cb295c740773f0013c92290a Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Tue, 26 Nov 2024 10:54:09 +0100 Subject: [PATCH 01/12] Instance blocks with mod log entry and expiration --- src/index.ts | 11 +++++++++-- src/types/AdminAllowInstance.ts | 12 ++++++++++++ src/types/AdminAllowInstanceParams.ts | 8 ++++++++ src/types/AdminAllowInstanceView.ts | 13 +++++++++++++ src/types/AdminBlockInstance.ts | 13 +++++++++++++ src/types/AdminBlockInstanceParams.ts | 9 +++++++++ src/types/AdminBlockInstanceView.ts | 13 +++++++++++++ src/types/BlockInstanceResponse.ts | 3 --- src/types/FederationBlockList.ts | 9 +++++++++ src/types/FederationError.ts | 3 ++- src/types/GetModlogResponse.ts | 4 ++++ src/types/GetPosts.ts | 4 ++++ src/types/HidePost.ts | 2 +- src/types/LemmyErrorType.ts | 4 +++- src/types/LocalUser.ts | 8 ++++++++ src/types/MarkManyPostsAsRead.ts | 7 +++++++ src/types/MarkPostAsRead.ts | 2 +- src/types/ModlogActionType.ts | 4 +++- src/types/SaveUserSettings.ts | 8 ++++++++ ...{BlockInstance.ts => UserBlockInstanceParams.ts} | 5 ++++- 20 files changed, 131 insertions(+), 11 deletions(-) create mode 100644 src/types/AdminAllowInstance.ts create mode 100644 src/types/AdminAllowInstanceParams.ts create mode 100644 src/types/AdminAllowInstanceView.ts create mode 100644 src/types/AdminBlockInstance.ts create mode 100644 src/types/AdminBlockInstanceParams.ts create mode 100644 src/types/AdminBlockInstanceView.ts delete mode 100644 src/types/BlockInstanceResponse.ts create mode 100644 src/types/FederationBlockList.ts create mode 100644 src/types/MarkManyPostsAsRead.ts rename src/types/{BlockInstance.ts => UserBlockInstanceParams.ts} (68%) diff --git a/src/index.ts b/src/index.ts index 6bec7c1..eb60cf4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -10,6 +10,12 @@ export { AddAdmin } from "./types/AddAdmin"; export { AddAdminResponse } from "./types/AddAdminResponse"; export { AddModToCommunity } from "./types/AddModToCommunity"; export { AddModToCommunityResponse } from "./types/AddModToCommunityResponse"; +export { AdminAllowInstance } from "./types/AdminAllowInstance"; +export { AdminAllowInstanceParams } from "./types/AdminAllowInstanceParams"; +export { AdminAllowInstanceView } from "./types/AdminAllowInstanceView"; +export { AdminBlockInstance } from "./types/AdminBlockInstance"; +export { AdminBlockInstanceParams } from "./types/AdminBlockInstanceParams"; +export { AdminBlockInstanceView } from "./types/AdminBlockInstanceView"; export { AdminPurgeComment } from "./types/AdminPurgeComment"; export { AdminPurgeCommentView } from "./types/AdminPurgeCommentView"; export { AdminPurgeCommunity } from "./types/AdminPurgeCommunity"; @@ -28,8 +34,6 @@ export { BanPersonResponse } from "./types/BanPersonResponse"; export { BannedPersonsResponse } from "./types/BannedPersonsResponse"; export { BlockCommunity } from "./types/BlockCommunity"; export { BlockCommunityResponse } from "./types/BlockCommunityResponse"; -export { BlockInstance } from "./types/BlockInstance"; -export { BlockInstanceResponse } from "./types/BlockInstanceResponse"; export { BlockPerson } from "./types/BlockPerson"; export { BlockPersonResponse } from "./types/BlockPersonResponse"; export { CaptchaResponse } from "./types/CaptchaResponse"; @@ -95,6 +99,7 @@ export { EditPrivateMessage } from "./types/EditPrivateMessage"; export { EditSite } from "./types/EditSite"; export { FeaturePost } from "./types/FeaturePost"; export { FederatedInstances } from "./types/FederatedInstances"; +export { FederationBlockList } from "./types/FederationBlockList"; export { FederationError } from "./types/FederationError"; export { FederationMode } from "./types/FederationMode"; export { FollowCommunity } from "./types/FollowCommunity"; @@ -179,6 +184,7 @@ export { Login } from "./types/Login"; export { LoginResponse } from "./types/LoginResponse"; export { LoginToken } from "./types/LoginToken"; export { MarkCommentReplyAsRead } from "./types/MarkCommentReplyAsRead"; +export { MarkManyPostsAsRead } from "./types/MarkManyPostsAsRead"; export { MarkPersonMentionAsRead } from "./types/MarkPersonMentionAsRead"; export { MarkPostAsRead } from "./types/MarkPostAsRead"; export { MarkPrivateMessageAsRead } from "./types/MarkPrivateMessageAsRead"; @@ -285,5 +291,6 @@ export { TransferCommunity } from "./types/TransferCommunity"; export { UpdateTagline } from "./types/UpdateTagline"; export { UpdateTotp } from "./types/UpdateTotp"; export { UpdateTotpResponse } from "./types/UpdateTotpResponse"; +export { UserBlockInstanceParams } from "./types/UserBlockInstanceParams"; export { VerifyEmail } from "./types/VerifyEmail"; export { VoteView } from "./types/VoteView"; diff --git a/src/types/AdminAllowInstance.ts b/src/types/AdminAllowInstance.ts new file mode 100644 index 0000000..3d347cd --- /dev/null +++ b/src/types/AdminAllowInstance.ts @@ -0,0 +1,12 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { InstanceId } from "./InstanceId"; +import type { PersonId } from "./PersonId"; + +export type AdminAllowInstance = { + id: number; + instance_id: InstanceId; + admin_person_id: PersonId; + allowed: boolean; + reason?: string; + published: string; +}; diff --git a/src/types/AdminAllowInstanceParams.ts b/src/types/AdminAllowInstanceParams.ts new file mode 100644 index 0000000..0ba3efa --- /dev/null +++ b/src/types/AdminAllowInstanceParams.ts @@ -0,0 +1,8 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { InstanceId } from "./InstanceId"; + +export type AdminAllowInstanceParams = { + instance_id: InstanceId; + allow: boolean; + reason?: string; +}; diff --git a/src/types/AdminAllowInstanceView.ts b/src/types/AdminAllowInstanceView.ts new file mode 100644 index 0000000..53876ac --- /dev/null +++ b/src/types/AdminAllowInstanceView.ts @@ -0,0 +1,13 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { AdminAllowInstance } from "./AdminAllowInstance"; +import type { Instance } from "./Instance"; +import type { Person } from "./Person"; + +/** + * When an admin purges a post. + */ +export type AdminAllowInstanceView = { + admin_block_instance: AdminAllowInstance; + instance: Instance; + admin?: Person; +}; diff --git a/src/types/AdminBlockInstance.ts b/src/types/AdminBlockInstance.ts new file mode 100644 index 0000000..98b0758 --- /dev/null +++ b/src/types/AdminBlockInstance.ts @@ -0,0 +1,13 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { InstanceId } from "./InstanceId"; +import type { PersonId } from "./PersonId"; + +export type AdminBlockInstance = { + id: number; + instance_id: InstanceId; + admin_person_id: PersonId; + blocked: boolean; + reason?: string; + expires?: string; + published: string; +}; diff --git a/src/types/AdminBlockInstanceParams.ts b/src/types/AdminBlockInstanceParams.ts new file mode 100644 index 0000000..80c69d3 --- /dev/null +++ b/src/types/AdminBlockInstanceParams.ts @@ -0,0 +1,9 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { InstanceId } from "./InstanceId"; + +export type AdminBlockInstanceParams = { + instance_id: InstanceId; + block: boolean; + reason?: string; + expires?: string; +}; diff --git a/src/types/AdminBlockInstanceView.ts b/src/types/AdminBlockInstanceView.ts new file mode 100644 index 0000000..bf13333 --- /dev/null +++ b/src/types/AdminBlockInstanceView.ts @@ -0,0 +1,13 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { AdminBlockInstance } from "./AdminBlockInstance"; +import type { Instance } from "./Instance"; +import type { Person } from "./Person"; + +/** + * When an admin purges a post. + */ +export type AdminBlockInstanceView = { + admin_block_instance: AdminBlockInstance; + instance: Instance; + admin?: Person; +}; diff --git a/src/types/BlockInstanceResponse.ts b/src/types/BlockInstanceResponse.ts deleted file mode 100644 index c4cc5b2..0000000 --- a/src/types/BlockInstanceResponse.ts +++ /dev/null @@ -1,3 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type BlockInstanceResponse = { blocked: boolean }; diff --git a/src/types/FederationBlockList.ts b/src/types/FederationBlockList.ts new file mode 100644 index 0000000..8938ed2 --- /dev/null +++ b/src/types/FederationBlockList.ts @@ -0,0 +1,9 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { InstanceId } from "./InstanceId"; + +export type FederationBlockList = { + instance_id: InstanceId; + published: string; + updated?: string; + expires?: string; +}; diff --git a/src/types/FederationError.ts b/src/types/FederationError.ts index 35a371e..9574192 100644 --- a/src/types/FederationError.ts +++ b/src/types/FederationError.ts @@ -25,4 +25,5 @@ export type FederationError = | "InboxTimeout" | "CantDeleteSite" | "ObjectIsNotPublic" - | "ObjectIsNotPrivate"; + | "ObjectIsNotPrivate" + | "Unreachable"; diff --git a/src/types/GetModlogResponse.ts b/src/types/GetModlogResponse.ts index 3e20647..3f57f26 100644 --- a/src/types/GetModlogResponse.ts +++ b/src/types/GetModlogResponse.ts @@ -1,4 +1,6 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { AdminAllowInstanceView } from "./AdminAllowInstanceView"; +import type { AdminBlockInstanceView } from "./AdminBlockInstanceView"; import type { AdminPurgeCommentView } from "./AdminPurgeCommentView"; import type { AdminPurgeCommunityView } from "./AdminPurgeCommunityView"; import type { AdminPurgePersonView } from "./AdminPurgePersonView"; @@ -34,4 +36,6 @@ export type GetModlogResponse = { admin_purged_posts: Array; admin_purged_comments: Array; hidden_communities: Array; + admin_block_instance: Array; + admin_allow_instance: Array; }; diff --git a/src/types/GetPosts.ts b/src/types/GetPosts.ts index 1857c3c..58b9429 100644 --- a/src/types/GetPosts.ts +++ b/src/types/GetPosts.ts @@ -29,6 +29,10 @@ export type GetPosts = { * If true, then show the nsfw posts (even if your user setting is to hide them) */ show_nsfw?: boolean; + /** + * Whether to automatically mark fetched posts as read. + */ + mark_as_read?: boolean; /** * If true, then only show posts with no comments */ diff --git a/src/types/HidePost.ts b/src/types/HidePost.ts index 763a4a3..2ab19ed 100644 --- a/src/types/HidePost.ts +++ b/src/types/HidePost.ts @@ -4,4 +4,4 @@ import type { PostId } from "./PostId"; /** * Hide a post from list views */ -export type HidePost = { post_ids: Array; hide: boolean }; +export type HidePost = { post_id: PostId; hide: boolean }; diff --git a/src/types/LemmyErrorType.ts b/src/types/LemmyErrorType.ts index dbedaaa..eaf3cbf 100644 --- a/src/types/LemmyErrorType.ts +++ b/src/types/LemmyErrorType.ts @@ -63,7 +63,7 @@ export type LemmyErrorType = | { error: "no_email_setup" } | { error: "local_site_not_setup" } | { error: "email_smtp_server_needs_a_port" } - | { error: "missing_an_email" } + | { error: "invalid_email_address"; message: string } | { error: "rate_limit_error" } | { error: "invalid_name" } | { error: "invalid_display_name" } @@ -116,6 +116,7 @@ export type LemmyErrorType = | { error: "invalid_regex" } | { error: "captcha_incorrect" } | { error: "couldnt_create_audio_captcha" } + | { error: "couldnt_create_image_captcha" } | { error: "invalid_url_scheme" } | { error: "couldnt_send_webmention" } | { error: "contradicting_filters" } @@ -135,4 +136,5 @@ export type LemmyErrorType = | { error: "community_has_no_followers" } | { error: "post_schedule_time_must_be_in_future" } | { error: "too_many_scheduled_posts" } + | { error: "cannot_combine_federation_blocklist_and_allowlist" } | { error: "federation_error"; message: { error?: FederationError } }; diff --git a/src/types/LocalUser.ts b/src/types/LocalUser.ts index d03da9e..dc9a4a3 100644 --- a/src/types/LocalUser.ts +++ b/src/types/LocalUser.ts @@ -73,9 +73,17 @@ export type LocalUser = { * should be paused */ enable_animated_images: boolean; + /** + * Whether a user can send / receive private messages + */ + enable_private_messages: boolean; /** * Whether to auto-collapse bot comments. */ collapse_bot_comments: boolean; default_comment_sort_type: CommentSortType; + /** + * Whether to automatically mark fetched posts as read. + */ + auto_mark_fetched_posts_as_read: boolean; }; diff --git a/src/types/MarkManyPostsAsRead.ts b/src/types/MarkManyPostsAsRead.ts new file mode 100644 index 0000000..a61b5b5 --- /dev/null +++ b/src/types/MarkManyPostsAsRead.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { PostId } from "./PostId"; + +/** + * Mark several posts as read. + */ +export type MarkManyPostsAsRead = { post_ids: Array }; diff --git a/src/types/MarkPostAsRead.ts b/src/types/MarkPostAsRead.ts index bfb8188..bb4ea46 100644 --- a/src/types/MarkPostAsRead.ts +++ b/src/types/MarkPostAsRead.ts @@ -4,4 +4,4 @@ import type { PostId } from "./PostId"; /** * Mark a post as read. */ -export type MarkPostAsRead = { post_ids: Array; read: boolean }; +export type MarkPostAsRead = { post_id: PostId; read: boolean }; diff --git a/src/types/ModlogActionType.ts b/src/types/ModlogActionType.ts index 438c7ca..069a1f9 100644 --- a/src/types/ModlogActionType.ts +++ b/src/types/ModlogActionType.ts @@ -19,4 +19,6 @@ export type ModlogActionType = | "AdminPurgePerson" | "AdminPurgeCommunity" | "AdminPurgePost" - | "AdminPurgeComment"; + | "AdminPurgeComment" + | "AdminBlockInstance" + | "AdminAllowInstance"; diff --git a/src/types/SaveUserSettings.ts b/src/types/SaveUserSettings.ts index 6488384..431a8dd 100644 --- a/src/types/SaveUserSettings.ts +++ b/src/types/SaveUserSettings.ts @@ -107,6 +107,10 @@ export type SaveUserSettings = { * should be paused */ enable_animated_images?: boolean; + /** + * Whether a user can send / receive private messages + */ + enable_private_messages?: boolean; /** * Whether to auto-collapse bot comments. */ @@ -118,4 +122,8 @@ export type SaveUserSettings = { show_upvotes?: boolean; show_downvotes?: boolean; show_upvote_percentage?: boolean; + /** + * Whether to automatically mark fetched posts as read. + */ + auto_mark_fetched_posts_as_read?: boolean; }; diff --git a/src/types/BlockInstance.ts b/src/types/UserBlockInstanceParams.ts similarity index 68% rename from src/types/BlockInstance.ts rename to src/types/UserBlockInstanceParams.ts index ce30a75..4001f0d 100644 --- a/src/types/BlockInstance.ts +++ b/src/types/UserBlockInstanceParams.ts @@ -4,4 +4,7 @@ import type { InstanceId } from "./InstanceId"; /** * Block an instance as user */ -export type BlockInstance = { instance_id: InstanceId; block: boolean }; +export type UserBlockInstanceParams = { + instance_id: InstanceId; + block: boolean; +}; From dc21cc8513a2a3899fe071a7e759c99a2b325319 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Tue, 26 Nov 2024 10:55:48 +0100 Subject: [PATCH 02/12] 0.20.0-instance-blocks.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0852699..d6ee653 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "lemmy-js-client", "description": "A javascript / typescript client for Lemmy", - "version": "0.20.0-alpha.18", + "version": "0.20.0-instance-blocks.0", "author": "Dessalines ", "license": "AGPL-3.0", "main": "./dist/index.js", From 28c4b5545b5e965e0c32c6d77c4b84b9be52b1eb Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Tue, 26 Nov 2024 11:02:06 +0100 Subject: [PATCH 03/12] fix methods --- src/http.ts | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/src/http.ts b/src/http.ts index 2d69587..daa129a 100644 --- a/src/http.ts +++ b/src/http.ts @@ -129,8 +129,6 @@ import { VERSION, } from "./other_types"; import { HideCommunity } from "./types/HideCommunity"; -import { BlockInstance } from "./types/BlockInstance"; -import { BlockInstanceResponse } from "./types/BlockInstanceResponse"; import { GenerateTotpSecretResponse } from "./types/GenerateTotpSecretResponse"; import { UpdateTotp } from "./types/UpdateTotp"; import { UpdateTotpResponse } from "./types/UpdateTotpResponse"; @@ -160,6 +158,9 @@ import { GetCommunityPendingFollowsCountResponse } from "./types/GetCommunityPen import { ListCommunityPendingFollowsResponse } from "./types/ListCommunityPendingFollowsResponse"; import { ListCommunityPendingFollows } from "./types/ListCommunityPendingFollows"; import { CommunityId } from "./types/CommunityId"; +import { UserBlockInstanceParams } from "./types/UserBlockInstanceParams"; +import { AdminAllowInstanceParams } from "./types/AdminAllowInstanceParams"; +import { AdminBlockInstanceParams } from "./types/AdminBlockInstanceParams"; enum HttpType { Get = "GET", @@ -1786,12 +1787,12 @@ export class LemmyHttp { } /** - * Block an instance. + * Block an instance as user. * * `HTTP.Post /site/block` */ - blockInstance(form: BlockInstance, options?: RequestOptions) { - return this.#wrapper( + userBlockInstance(form: UserBlockInstanceParams, options?: RequestOptions) { + return this.#wrapper( HttpType.Post, "/site/block", form, @@ -1799,6 +1800,34 @@ export class LemmyHttp { ); } + /** + * Globally block an instance as admin. + * + * `HTTP.Post /admin/block_instance` + */ + adminBlockInstance(form: AdminBlockInstanceParams, options?: RequestOptions) { + return this.#wrapper( + HttpType.Post, + "/admin/block_instance", + form, + options, + ); + } + + /** + * Globally allow an instance as admin. + * + * `HTTP.Post /admin/allow_instance` + */ + adminAllowInstance(form: AdminAllowInstanceParams, options?: RequestOptions) { + return this.#wrapper( + HttpType.Post, + "/admin/allow_instance", + form, + options, + ); + } + /** * Upload an image to the server. */ From 44208e3519900457496be2ad0c79d82ab1486f64 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Tue, 26 Nov 2024 11:02:13 +0100 Subject: [PATCH 04/12] 0.20.0-instance-blocks.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d6ee653..8adede6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "lemmy-js-client", "description": "A javascript / typescript client for Lemmy", - "version": "0.20.0-instance-blocks.0", + "version": "0.20.0-instance-blocks.1", "author": "Dessalines ", "license": "AGPL-3.0", "main": "./dist/index.js", From a639f0c535897b111b54440968ff1b9cbb868609 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Tue, 26 Nov 2024 11:09:05 +0100 Subject: [PATCH 05/12] remove params --- src/types/CreateSite.ts | 2 -- src/types/EditSite.ts | 8 -------- 2 files changed, 10 deletions(-) diff --git a/src/types/CreateSite.ts b/src/types/CreateSite.ts index eb09f31..f36bfde 100644 --- a/src/types/CreateSite.ts +++ b/src/types/CreateSite.ts @@ -48,8 +48,6 @@ export type CreateSite = { federation_debug?: boolean; captcha_enabled?: boolean; captcha_difficulty?: string; - allowed_instances?: Array; - blocked_instances?: Array; registration_mode?: RegistrationMode; oauth_registration?: boolean; content_warning?: string; diff --git a/src/types/EditSite.ts b/src/types/EditSite.ts index e9657dc..82a0b1e 100644 --- a/src/types/EditSite.ts +++ b/src/types/EditSite.ts @@ -138,14 +138,6 @@ export type EditSite = { * The captcha difficulty. Can be easy, medium, or hard */ captcha_difficulty?: string; - /** - * A list of allowed instances. If none are set, federation is open. - */ - allowed_instances?: Array; - /** - * A list of blocked instances. - */ - blocked_instances?: Array; /** * A list of blocked URLs */ From ecfce3551cf409eebaaceb1ece28c999922a4c96 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Tue, 26 Nov 2024 11:09:12 +0100 Subject: [PATCH 06/12] 0.20.0-instance-blocks.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8adede6..f83bdc8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "lemmy-js-client", "description": "A javascript / typescript client for Lemmy", - "version": "0.20.0-instance-blocks.1", + "version": "0.20.0-instance-blocks.2", "author": "Dessalines ", "license": "AGPL-3.0", "main": "./dist/index.js", From a8a1a7f22cdccd84c53766d6c2fd1101dc5677e8 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Tue, 26 Nov 2024 11:34:07 +0100 Subject: [PATCH 07/12] pass domain --- src/index.ts | 1 + src/types/AdminAllowInstanceParams.ts | 4 ++-- src/types/AdminBlockInstanceParams.ts | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/index.ts b/src/index.ts index eb60cf4..fc9bc59 100644 --- a/src/index.ts +++ b/src/index.ts @@ -140,6 +140,7 @@ export { HidePost } from "./types/HidePost"; export { ImageDetails } from "./types/ImageDetails"; export { Instance } from "./types/Instance"; export { InstanceId } from "./types/InstanceId"; +export { InstanceIdOrDomain } from "./types/InstanceIdOrDomain"; export { InstanceWithFederationState } from "./types/InstanceWithFederationState"; export { Language } from "./types/Language"; export { LanguageId } from "./types/LanguageId"; diff --git a/src/types/AdminAllowInstanceParams.ts b/src/types/AdminAllowInstanceParams.ts index 0ba3efa..9f1c41e 100644 --- a/src/types/AdminAllowInstanceParams.ts +++ b/src/types/AdminAllowInstanceParams.ts @@ -1,8 +1,8 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { InstanceId } from "./InstanceId"; +import type { InstanceIdOrDomain } from "./InstanceIdOrDomain"; export type AdminAllowInstanceParams = { - instance_id: InstanceId; + instance: InstanceIdOrDomain; allow: boolean; reason?: string; }; diff --git a/src/types/AdminBlockInstanceParams.ts b/src/types/AdminBlockInstanceParams.ts index 80c69d3..33cda0d 100644 --- a/src/types/AdminBlockInstanceParams.ts +++ b/src/types/AdminBlockInstanceParams.ts @@ -1,8 +1,8 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { InstanceId } from "./InstanceId"; +import type { InstanceIdOrDomain } from "./InstanceIdOrDomain"; export type AdminBlockInstanceParams = { - instance_id: InstanceId; + instance: InstanceIdOrDomain; block: boolean; reason?: string; expires?: string; From 35f6ca5a14829f1850322c42abe940fc8eb6d147 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Tue, 26 Nov 2024 11:34:13 +0100 Subject: [PATCH 08/12] 0.20.0-instance-blocks.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f83bdc8..794d542 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "lemmy-js-client", "description": "A javascript / typescript client for Lemmy", - "version": "0.20.0-instance-blocks.2", + "version": "0.20.0-instance-blocks.3", "author": "Dessalines ", "license": "AGPL-3.0", "main": "./dist/index.js", From 444b837cba2d81300aeddc88e39a083373fb5345 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Tue, 26 Nov 2024 11:37:02 +0100 Subject: [PATCH 09/12] add file --- src/types/InstanceIdOrDomain.ts | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 src/types/InstanceIdOrDomain.ts diff --git a/src/types/InstanceIdOrDomain.ts b/src/types/InstanceIdOrDomain.ts new file mode 100644 index 0000000..00e9c7e --- /dev/null +++ b/src/types/InstanceIdOrDomain.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { InstanceId } from "./InstanceId"; + +export type InstanceIdOrDomain = + | { InstanceId: InstanceId } + | { Domain: string }; From c9159d89ecc4295dea44cac6877d768bbfd0d6a7 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Tue, 26 Nov 2024 11:37:06 +0100 Subject: [PATCH 10/12] 0.20.0-instance-blocks.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 794d542..0241d41 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "lemmy-js-client", "description": "A javascript / typescript client for Lemmy", - "version": "0.20.0-instance-blocks.3", + "version": "0.20.0-instance-blocks.4", "author": "Dessalines ", "license": "AGPL-3.0", "main": "./dist/index.js", From 36d0e693911d3368e0dfb5ca9775e9979e76b85b Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Tue, 26 Nov 2024 11:48:46 +0100 Subject: [PATCH 11/12] pass instance domain --- src/index.ts | 1 - src/types/AdminAllowInstanceParams.ts | 3 +-- src/types/AdminBlockInstanceParams.ts | 3 +-- src/types/InstanceIdOrDomain.ts | 6 ------ 4 files changed, 2 insertions(+), 11 deletions(-) delete mode 100644 src/types/InstanceIdOrDomain.ts diff --git a/src/index.ts b/src/index.ts index fc9bc59..eb60cf4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -140,7 +140,6 @@ export { HidePost } from "./types/HidePost"; export { ImageDetails } from "./types/ImageDetails"; export { Instance } from "./types/Instance"; export { InstanceId } from "./types/InstanceId"; -export { InstanceIdOrDomain } from "./types/InstanceIdOrDomain"; export { InstanceWithFederationState } from "./types/InstanceWithFederationState"; export { Language } from "./types/Language"; export { LanguageId } from "./types/LanguageId"; diff --git a/src/types/AdminAllowInstanceParams.ts b/src/types/AdminAllowInstanceParams.ts index 9f1c41e..226bf4d 100644 --- a/src/types/AdminAllowInstanceParams.ts +++ b/src/types/AdminAllowInstanceParams.ts @@ -1,8 +1,7 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { InstanceIdOrDomain } from "./InstanceIdOrDomain"; export type AdminAllowInstanceParams = { - instance: InstanceIdOrDomain; + instance: string; allow: boolean; reason?: string; }; diff --git a/src/types/AdminBlockInstanceParams.ts b/src/types/AdminBlockInstanceParams.ts index 33cda0d..4fb9898 100644 --- a/src/types/AdminBlockInstanceParams.ts +++ b/src/types/AdminBlockInstanceParams.ts @@ -1,8 +1,7 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { InstanceIdOrDomain } from "./InstanceIdOrDomain"; export type AdminBlockInstanceParams = { - instance: InstanceIdOrDomain; + instance: string; block: boolean; reason?: string; expires?: string; diff --git a/src/types/InstanceIdOrDomain.ts b/src/types/InstanceIdOrDomain.ts deleted file mode 100644 index 00e9c7e..0000000 --- a/src/types/InstanceIdOrDomain.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { InstanceId } from "./InstanceId"; - -export type InstanceIdOrDomain = - | { InstanceId: InstanceId } - | { Domain: string }; From bb2224beca5abca4236ac6c6a407f78bda197304 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Tue, 26 Nov 2024 11:48:53 +0100 Subject: [PATCH 12/12] 0.20.0-instance-blocks.5 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0241d41..6cbaab1 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "lemmy-js-client", "description": "A javascript / typescript client for Lemmy", - "version": "0.20.0-instance-blocks.4", + "version": "0.20.0-instance-blocks.5", "author": "Dessalines ", "license": "AGPL-3.0", "main": "./dist/index.js",