From d3d7f817411cb2b273c77ff2d533a6d6b87c6a63 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Mon, 2 Dec 2024 17:28:27 -0500 Subject: [PATCH 1/7] Adding list reports. --- src/http.ts | 65 +++---------------- src/index.ts | 23 ++++--- src/types/AdminAllowInstance.ts | 12 ++++ src/types/AdminAllowInstanceParams.ts | 7 ++ src/types/AdminAllowInstanceView.ts | 13 ++++ src/types/AdminBlockInstance.ts | 13 ++++ src/types/AdminBlockInstanceParams.ts | 8 +++ src/types/AdminBlockInstanceView.ts | 13 ++++ src/types/AuthenticateWithOauth.ts | 1 + src/types/CommentAggregates.ts | 2 + src/types/CreateOAuthProvider.ts | 1 + src/types/CreateSite.ts | 2 - src/types/EditOAuthProvider.ts | 1 + src/types/EditSite.ts | 8 --- src/types/FederationBlockList.ts | 9 +++ src/types/FederationError.ts | 3 +- src/types/GetModlogResponse.ts | 4 ++ src/types/GetPosts.ts | 5 ++ src/types/GetReportCountResponse.ts | 8 +-- src/types/HidePost.ts | 2 +- src/types/LemmyErrorType.ts | 5 +- src/types/ListCommentReports.ts | 20 ------ src/types/ListCommentReportsResponse.ts | 9 --- src/types/ListPrivateMessageReports.ts | 13 ---- .../ListPrivateMessageReportsResponse.ts | 9 --- .../{ListPostReports.ts => ListReports.ts} | 11 ++-- ...ortsResponse.ts => ListReportsResponse.ts} | 4 +- src/types/LocalUser.ts | 8 +++ src/types/MarkManyPostsAsRead.ts | 7 ++ src/types/MarkPostAsRead.ts | 2 +- src/types/ModlogActionType.ts | 4 +- src/types/OAuthProvider.ts | 4 ++ src/types/PostAggregates.ts | 2 + src/types/ReportCombined.ts | 16 +++++ ...nstanceResponse.ts => ReportCombinedId.ts} | 5 +- src/types/ReportCombinedPaginationCursor.ts | 6 ++ src/types/ReportCombinedView.ts | 9 +++ src/types/SaveUserSettings.ts | 8 +++ ...Instance.ts => UserBlockInstanceParams.ts} | 5 +- 39 files changed, 199 insertions(+), 148 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 create mode 100644 src/types/FederationBlockList.ts delete mode 100644 src/types/ListCommentReports.ts delete mode 100644 src/types/ListCommentReportsResponse.ts delete mode 100644 src/types/ListPrivateMessageReports.ts delete mode 100644 src/types/ListPrivateMessageReportsResponse.ts rename src/types/{ListPostReports.ts => ListReports.ts} (65%) rename src/types/{ListPostReportsResponse.ts => ListReportsResponse.ts} (51%) create mode 100644 src/types/MarkManyPostsAsRead.ts create mode 100644 src/types/ReportCombined.ts rename src/types/{BlockInstanceResponse.ts => ReportCombinedId.ts} (60%) create mode 100644 src/types/ReportCombinedPaginationCursor.ts create mode 100644 src/types/ReportCombinedView.ts rename src/types/{BlockInstance.ts => UserBlockInstanceParams.ts} (68%) diff --git a/src/http.ts b/src/http.ts index 2d695874..05df92b9 100644 --- a/src/http.ts +++ b/src/http.ts @@ -75,14 +75,8 @@ import { GetSiteMetadataResponse } from "./types/GetSiteMetadataResponse"; import { GetSiteResponse } from "./types/GetSiteResponse"; import { GetUnreadCountResponse } from "./types/GetUnreadCountResponse"; import { GetUnreadRegistrationApplicationCountResponse } from "./types/GetUnreadRegistrationApplicationCountResponse"; -import { ListCommentReports } from "./types/ListCommentReports"; -import { ListCommentReportsResponse } from "./types/ListCommentReportsResponse"; import { ListCommunities } from "./types/ListCommunities"; import { ListCommunitiesResponse } from "./types/ListCommunitiesResponse"; -import { ListPostReports } from "./types/ListPostReports"; -import { ListPostReportsResponse } from "./types/ListPostReportsResponse"; -import { ListPrivateMessageReports } from "./types/ListPrivateMessageReports"; -import { ListPrivateMessageReportsResponse } from "./types/ListPrivateMessageReportsResponse"; import { ListRegistrationApplications } from "./types/ListRegistrationApplications"; import { ListRegistrationApplicationsResponse } from "./types/ListRegistrationApplicationsResponse"; import { LockPost } from "./types/LockPost"; @@ -129,8 +123,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 +152,8 @@ import { GetCommunityPendingFollowsCountResponse } from "./types/GetCommunityPen import { ListCommunityPendingFollowsResponse } from "./types/ListCommunityPendingFollowsResponse"; import { ListCommunityPendingFollows } from "./types/ListCommunityPendingFollows"; import { CommunityId } from "./types/CommunityId"; +import { ListReports } from "./types/ListReports"; +import { ListReportsResponse } from "./types/ListReportsResponse"; enum HttpType { Get = "GET", @@ -843,20 +837,6 @@ export class LemmyHttp { ); } - /** - * List post reports. - * - * `HTTP.GET /post/report/list` - */ - listPostReports(form: ListPostReports, options?: RequestOptions) { - return this.#wrapper( - HttpType.Get, - "/post/report/list", - form, - options, - ); - } - /** * Fetch metadata for any given site. * @@ -1056,20 +1036,6 @@ export class LemmyHttp { ); } - /** - * List comment reports. - * - * `HTTP.GET /comment/report/list` - */ - listCommentReports(form: ListCommentReports, options?: RequestOptions) { - return this.#wrapper( - HttpType.Get, - "/comment/report/list", - form, - options, - ); - } - /** * Get / fetch private messages. * @@ -1173,21 +1139,6 @@ export class LemmyHttp { >(HttpType.Put, "/private_message/report/resolve", form, options); } - /** - * List private message reports. - * - * `HTTP.GET /private_message/report/list` - */ - listPrivateMessageReports( - form: ListPrivateMessageReports, - options?: RequestOptions, - ) { - return this.#wrapper< - ListPrivateMessageReports, - ListPrivateMessageReportsResponse - >(HttpType.Get, "/private_message/report/list", form, options); - } - /** * Register a new user. * @@ -1786,14 +1737,14 @@ export class LemmyHttp { } /** - * Block an instance. + * List post reports. * - * `HTTP.Post /site/block` + * `HTTP.GET //report/list` */ - blockInstance(form: BlockInstance, options?: RequestOptions) { - return this.#wrapper( - HttpType.Post, - "/site/block", + listReports(form: ListReports, options?: RequestOptions) { + return this.#wrapper( + HttpType.Get, + "/report/list", form, options, ); diff --git a/src/index.ts b/src/index.ts index 6bec7c17..72acbd50 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"; @@ -142,8 +147,6 @@ export { LemmyErrorType } from "./types/LemmyErrorType"; export { LinkMetadata } from "./types/LinkMetadata"; export { ListCommentLikes } from "./types/ListCommentLikes"; export { ListCommentLikesResponse } from "./types/ListCommentLikesResponse"; -export { ListCommentReports } from "./types/ListCommentReports"; -export { ListCommentReportsResponse } from "./types/ListCommentReportsResponse"; export { ListCommunities } from "./types/ListCommunities"; export { ListCommunitiesResponse } from "./types/ListCommunitiesResponse"; export { ListCommunityPendingFollows } from "./types/ListCommunityPendingFollows"; @@ -155,12 +158,10 @@ export { ListMedia } from "./types/ListMedia"; export { ListMediaResponse } from "./types/ListMediaResponse"; export { ListPostLikes } from "./types/ListPostLikes"; export { ListPostLikesResponse } from "./types/ListPostLikesResponse"; -export { ListPostReports } from "./types/ListPostReports"; -export { ListPostReportsResponse } from "./types/ListPostReportsResponse"; -export { ListPrivateMessageReports } from "./types/ListPrivateMessageReports"; -export { ListPrivateMessageReportsResponse } from "./types/ListPrivateMessageReportsResponse"; export { ListRegistrationApplications } from "./types/ListRegistrationApplications"; export { ListRegistrationApplicationsResponse } from "./types/ListRegistrationApplicationsResponse"; +export { ListReports } from "./types/ListReports"; +export { ListReportsResponse } from "./types/ListReportsResponse"; export { ListTaglines } from "./types/ListTaglines"; export { ListTaglinesResponse } from "./types/ListTaglinesResponse"; export { ListingType } from "./types/ListingType"; @@ -179,6 +180,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"; @@ -259,6 +261,10 @@ export { RegistrationMode } from "./types/RegistrationMode"; export { RemoveComment } from "./types/RemoveComment"; export { RemoveCommunity } from "./types/RemoveCommunity"; export { RemovePost } from "./types/RemovePost"; +export { ReportCombined } from "./types/ReportCombined"; +export { ReportCombinedId } from "./types/ReportCombinedId"; +export { ReportCombinedPaginationCursor } from "./types/ReportCombinedPaginationCursor"; +export { ReportCombinedView } from "./types/ReportCombinedView"; export { ResolveCommentReport } from "./types/ResolveCommentReport"; export { ResolveObject } from "./types/ResolveObject"; export { ResolveObjectResponse } from "./types/ResolveObjectResponse"; @@ -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 00000000..d4fdd74f --- /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; + when_: string; +}; diff --git a/src/types/AdminAllowInstanceParams.ts b/src/types/AdminAllowInstanceParams.ts new file mode 100644 index 00000000..226bf4d4 --- /dev/null +++ b/src/types/AdminAllowInstanceParams.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. + +export type AdminAllowInstanceParams = { + instance: string; + allow: boolean; + reason?: string; +}; diff --git a/src/types/AdminAllowInstanceView.ts b/src/types/AdminAllowInstanceView.ts new file mode 100644 index 00000000..53876acf --- /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 00000000..e51008e9 --- /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; + when_: string; +}; diff --git a/src/types/AdminBlockInstanceParams.ts b/src/types/AdminBlockInstanceParams.ts new file mode 100644 index 00000000..4fb9898b --- /dev/null +++ b/src/types/AdminBlockInstanceParams.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. + +export type AdminBlockInstanceParams = { + instance: string; + block: boolean; + reason?: string; + expires?: string; +}; diff --git a/src/types/AdminBlockInstanceView.ts b/src/types/AdminBlockInstanceView.ts new file mode 100644 index 00000000..bf133330 --- /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/AuthenticateWithOauth.ts b/src/types/AuthenticateWithOauth.ts index 862017f1..c1f64400 100644 --- a/src/types/AuthenticateWithOauth.ts +++ b/src/types/AuthenticateWithOauth.ts @@ -17,4 +17,5 @@ export type AuthenticateWithOauth = { * An answer is mandatory if require application is enabled on the server */ answer?: string; + pkce_code_verifier?: string; }; diff --git a/src/types/CommentAggregates.ts b/src/types/CommentAggregates.ts index f25ba705..5938cf31 100644 --- a/src/types/CommentAggregates.ts +++ b/src/types/CommentAggregates.ts @@ -14,4 +14,6 @@ export type CommentAggregates = { * The total number of children in this comment branch. */ child_count: number; + report_count: number; + unresolved_report_count: number; }; diff --git a/src/types/CreateOAuthProvider.ts b/src/types/CreateOAuthProvider.ts index 9c9e17c3..856bc4cc 100644 --- a/src/types/CreateOAuthProvider.ts +++ b/src/types/CreateOAuthProvider.ts @@ -15,5 +15,6 @@ export type CreateOAuthProvider = { scopes: string; auto_verify_email?: boolean; account_linking_enabled?: boolean; + use_pkce?: boolean; enabled?: boolean; }; diff --git a/src/types/CreateSite.ts b/src/types/CreateSite.ts index eb09f313..f36bfde6 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/EditOAuthProvider.ts b/src/types/EditOAuthProvider.ts index 472e7f11..86421890 100644 --- a/src/types/EditOAuthProvider.ts +++ b/src/types/EditOAuthProvider.ts @@ -15,5 +15,6 @@ export type EditOAuthProvider = { scopes?: string; auto_verify_email?: boolean; account_linking_enabled?: boolean; + use_pkce?: boolean; enabled?: boolean; }; diff --git a/src/types/EditSite.ts b/src/types/EditSite.ts index e9657dca..82a0b1ef 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 */ diff --git a/src/types/FederationBlockList.ts b/src/types/FederationBlockList.ts new file mode 100644 index 00000000..8938ed29 --- /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 35a371e5..95741929 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 3e20647b..3f57f26b 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 1857c3cb..77b15dd9 100644 --- a/src/types/GetPosts.ts +++ b/src/types/GetPosts.ts @@ -29,9 +29,14 @@ 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 */ no_comments_only?: boolean; page_cursor?: PaginationCursor; + page_back?: boolean; }; diff --git a/src/types/GetReportCountResponse.ts b/src/types/GetReportCountResponse.ts index 356f643d..2a6d2ec4 100644 --- a/src/types/GetReportCountResponse.ts +++ b/src/types/GetReportCountResponse.ts @@ -1,12 +1,6 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { CommunityId } from "./CommunityId"; /** * A response for the number of reports. */ -export type GetReportCountResponse = { - community_id?: CommunityId; - comment_reports: number; - post_reports: number; - private_message_reports?: number; -}; +export type GetReportCountResponse = { count: number }; diff --git a/src/types/HidePost.ts b/src/types/HidePost.ts index 763a4a34..2ab19edb 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 dbedaaad..32b9c9e9 100644 --- a/src/types/LemmyErrorType.ts +++ b/src/types/LemmyErrorType.ts @@ -63,9 +63,10 @@ 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_code_verifier" } | { error: "invalid_display_name" } | { error: "invalid_matrix_id" } | { error: "invalid_post_title" } @@ -116,6 +117,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 +137,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/ListCommentReports.ts b/src/types/ListCommentReports.ts deleted file mode 100644 index 8cb33dc6..00000000 --- a/src/types/ListCommentReports.ts +++ /dev/null @@ -1,20 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { CommentId } from "./CommentId"; -import type { CommunityId } from "./CommunityId"; - -/** - * List comment reports. - */ -export type ListCommentReports = { - comment_id?: CommentId; - page?: number; - limit?: number; - /** - * Only shows the unresolved reports - */ - unresolved_only?: boolean; - /** - * if no community is given, it returns reports for all communities moderated by the auth user - */ - community_id?: CommunityId; -}; diff --git a/src/types/ListCommentReportsResponse.ts b/src/types/ListCommentReportsResponse.ts deleted file mode 100644 index 7bfbbeff..00000000 --- a/src/types/ListCommentReportsResponse.ts +++ /dev/null @@ -1,9 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { CommentReportView } from "./CommentReportView"; - -/** - * The comment report list response. - */ -export type ListCommentReportsResponse = { - comment_reports: Array; -}; diff --git a/src/types/ListPrivateMessageReports.ts b/src/types/ListPrivateMessageReports.ts deleted file mode 100644 index 7c43dd0d..00000000 --- a/src/types/ListPrivateMessageReports.ts +++ /dev/null @@ -1,13 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * List private message reports. - */ -export type ListPrivateMessageReports = { - page?: number; - limit?: number; - /** - * Only shows the unresolved reports - */ - unresolved_only?: boolean; -}; diff --git a/src/types/ListPrivateMessageReportsResponse.ts b/src/types/ListPrivateMessageReportsResponse.ts deleted file mode 100644 index a5742806..00000000 --- a/src/types/ListPrivateMessageReportsResponse.ts +++ /dev/null @@ -1,9 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { PrivateMessageReportView } from "./PrivateMessageReportView"; - -/** - * The response for list private message reports. - */ -export type ListPrivateMessageReportsResponse = { - private_message_reports: Array; -}; diff --git a/src/types/ListPostReports.ts b/src/types/ListReports.ts similarity index 65% rename from src/types/ListPostReports.ts rename to src/types/ListReports.ts index 0964ab94..00f88388 100644 --- a/src/types/ListPostReports.ts +++ b/src/types/ListReports.ts @@ -1,13 +1,11 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { CommunityId } from "./CommunityId"; -import type { PostId } from "./PostId"; +import type { ReportCombinedPaginationCursor } from "./ReportCombinedPaginationCursor"; /** - * List post reports. + * List reports. */ -export type ListPostReports = { - page?: number; - limit?: number; +export type ListReports = { /** * Only shows the unresolved reports */ @@ -16,5 +14,6 @@ export type ListPostReports = { * if no community is given, it returns reports for all communities moderated by the auth user */ community_id?: CommunityId; - post_id?: PostId; + page_cursor?: ReportCombinedPaginationCursor; + page_back?: boolean; }; diff --git a/src/types/ListPostReportsResponse.ts b/src/types/ListReportsResponse.ts similarity index 51% rename from src/types/ListPostReportsResponse.ts rename to src/types/ListReportsResponse.ts index 94e7ca1e..afced0d4 100644 --- a/src/types/ListPostReportsResponse.ts +++ b/src/types/ListReportsResponse.ts @@ -1,7 +1,7 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { PostReportView } from "./PostReportView"; +import type { ReportCombinedView } from "./ReportCombinedView"; /** * The post reports response. */ -export type ListPostReportsResponse = { post_reports: Array }; +export type ListReportsResponse = { reports: Array }; diff --git a/src/types/LocalUser.ts b/src/types/LocalUser.ts index d03da9ea..dc9a4a37 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 00000000..a61b5b53 --- /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 bfb8188e..bb4ea463 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 438c7cac..069a1f9a 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/OAuthProvider.ts b/src/types/OAuthProvider.ts index fb9cc3bd..2716f823 100644 --- a/src/types/OAuthProvider.ts +++ b/src/types/OAuthProvider.ts @@ -58,4 +58,8 @@ export type OAuthProvider = { enabled: boolean; published: string; updated?: string; + /** + * switch to enable or disable PKCE + */ + use_pkce: boolean; }; diff --git a/src/types/PostAggregates.ts b/src/types/PostAggregates.ts index 850d6947..ffb9dd59 100644 --- a/src/types/PostAggregates.ts +++ b/src/types/PostAggregates.ts @@ -15,4 +15,6 @@ export type PostAggregates = { * The time of the newest comment in the post. */ newest_comment_time: string; + report_count: number; + unresolved_report_count: number; }; diff --git a/src/types/ReportCombined.ts b/src/types/ReportCombined.ts new file mode 100644 index 00000000..4e0788e4 --- /dev/null +++ b/src/types/ReportCombined.ts @@ -0,0 +1,16 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { CommentReportId } from "./CommentReportId"; +import type { PostReportId } from "./PostReportId"; +import type { PrivateMessageReportId } from "./PrivateMessageReportId"; +import type { ReportCombinedId } from "./ReportCombinedId"; + +/** + * A combined reports table. + */ +export type ReportCombined = { + id: ReportCombinedId; + published: string; + post_report_id?: PostReportId; + comment_report_id?: CommentReportId; + private_message_report_id?: PrivateMessageReportId; +}; diff --git a/src/types/BlockInstanceResponse.ts b/src/types/ReportCombinedId.ts similarity index 60% rename from src/types/BlockInstanceResponse.ts rename to src/types/ReportCombinedId.ts index c4cc5b21..d54a9058 100644 --- a/src/types/BlockInstanceResponse.ts +++ b/src/types/ReportCombinedId.ts @@ -1,3 +1,6 @@ // 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 }; +/** + * The report combined id + */ +export type ReportCombinedId = number; diff --git a/src/types/ReportCombinedPaginationCursor.ts b/src/types/ReportCombinedPaginationCursor.ts new file mode 100644 index 00000000..312df7fd --- /dev/null +++ b/src/types/ReportCombinedPaginationCursor.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. + +/** + * like PaginationCursor but for the report_combined table + */ +export type ReportCombinedPaginationCursor = string; diff --git a/src/types/ReportCombinedView.ts b/src/types/ReportCombinedView.ts new file mode 100644 index 00000000..d9e8a5c6 --- /dev/null +++ b/src/types/ReportCombinedView.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 { CommentReportView } from "./CommentReportView"; +import type { PostReportView } from "./PostReportView"; +import type { PrivateMessageReportView } from "./PrivateMessageReportView"; + +export type ReportCombinedView = + | { Post: PostReportView } + | { Comment: CommentReportView } + | { PrivateMessage: PrivateMessageReportView }; diff --git a/src/types/SaveUserSettings.ts b/src/types/SaveUserSettings.ts index 64883845..431a8dd2 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 ce30a757..4001f0d4 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 db2081cbc8ea432a9deff5806100c16e87b32c76 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Mon, 2 Dec 2024 17:38:03 -0500 Subject: [PATCH 2/7] 0.20.0-reports-combined.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b4ad899b..22fae41f 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-pkce.1", + "version": "0.20.0-reports-combined.0", "author": "Dessalines ", "license": "AGPL-3.0", "main": "./dist/index.js", From 54e4b0a70743a8248c1d9729646a9cb74d9423b4 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Mon, 2 Dec 2024 17:39:06 -0500 Subject: [PATCH 3/7] Fix comment. --- src/http.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/http.ts b/src/http.ts index 67c67ab0..4fbc926e 100644 --- a/src/http.ts +++ b/src/http.ts @@ -1740,7 +1740,7 @@ export class LemmyHttp { } /** - * List post reports. + * List user reports. * * `HTTP.GET /report/list` */ From 355af9753821cd316b89d936d1ede08fb5e88816 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Mon, 2 Dec 2024 18:04:52 -0500 Subject: [PATCH 4/7] Use internal tagging. --- src/types/ReportCombinedView.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/types/ReportCombinedView.ts b/src/types/ReportCombinedView.ts index d9e8a5c6..b8d4420a 100644 --- a/src/types/ReportCombinedView.ts +++ b/src/types/ReportCombinedView.ts @@ -4,6 +4,6 @@ import type { PostReportView } from "./PostReportView"; import type { PrivateMessageReportView } from "./PrivateMessageReportView"; export type ReportCombinedView = - | { Post: PostReportView } - | { Comment: CommentReportView } - | { PrivateMessage: PrivateMessageReportView }; + | ({ type_: "Post" } & PostReportView) + | ({ type_: "Comment" } & CommentReportView) + | ({ type_: "PrivateMessage" } & PrivateMessageReportView); From d21d6005901e2804603e10cded06c02088ccb94d Mon Sep 17 00:00:00 2001 From: Dessalines Date: Mon, 2 Dec 2024 18:04:58 -0500 Subject: [PATCH 5/7] 0.20.0-reports-combined.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 22fae41f..8e2dae02 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-reports-combined.0", + "version": "0.20.0-reports-combined.1", "author": "Dessalines ", "license": "AGPL-3.0", "main": "./dist/index.js", From 6e70e451d4c9f98f9b82149a07fd2262f876eb4d Mon Sep 17 00:00:00 2001 From: Dessalines Date: Mon, 2 Dec 2024 18:05:03 -0500 Subject: [PATCH 6/7] 0.20.0-reports-combined.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8e2dae02..dd86eb44 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-reports-combined.1", + "version": "0.20.0-reports-combined.2", "author": "Dessalines ", "license": "AGPL-3.0", "main": "./dist/index.js", From 92ff77edf6c2a6a38c90dce79fe6b93d19e804d3 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Sat, 7 Dec 2024 21:14:46 -0500 Subject: [PATCH 7/7] 0.20.0-reports-combined.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a1eda16d..7c773cd4 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-api-v4.17", + "version": "0.20.0-reports-combined.3", "author": "Dessalines ", "license": "AGPL-3.0", "main": "./dist/index.js",