import type { NotificationCategory } from "./community.enums"; import type { AuthToken } from "./token"; import type { RequestOptions, RequestInternalError } from "@seayoo-web/request"; export declare class CommunityApi { private token; private req; constructor(authToken: AuthToken); /** * 获取社区版块列表,仅返回启用状态的版块 * * https://kdocs.cn/l/cbggfJodHLIz?linkname=QaqUa2K0z0 */ getForums(requestOptions?: RequestOptions): Promise; /** * 获取社区话题列表,仅返回启用状态的话题 * * https://kdocs.cn/l/cbggfJodHLIz?linkname=mIwpymAQom */ getTopics(requestOptions?: RequestOptions): Promise; /** * 根据话题 ID 获取社区话题信息 * * https://kdocs.cn/l/cbggfJodHLIz?linkname=Jvw7xMK31K */ getTopic(topicId: number, requestOptions?: RequestOptions): Promise; /** * 获取社区帖子列表 * * https://kdocs.cn/l/cbggfJodHLIz?linkname=XKI9lDVrPq */ getPosts(option: { /** 查询返回最大帖子数 */ max_results: number; /** 查询类型 */ query_type: "all" | "forum" | "topic" | "user"; /** * 查询对应的值 * * - 论坛ID * - 话题ID * - 用户ID */ query_value?: string | number; /** 搜索内容 */ search_value?: string; /** 分页标识,不传默认首次查询 */ next_token?: string; /** * 帖子排序键,默认按照发布时间倒序 * * - post_time_desc 帖子发布时间倒序 * - post_like 帖子点赞数排序 */ sort_key?: "post_time_desc" | "post_like"; }, requestOptions?: RequestOptions): Promise<{ posts: import("./community.define").Post[]; next_token: string | undefined; } | { message: string; error: RequestInternalError | "forum_not_found" | "topic_not_found"; }>; /** * 获取社区置顶帖子列表 * * https://kdocs.cn/l/cbggfJodHLIz?linkname=yXubbZuDlC */ getPinnedPosts(forumId: number, maxResults: number, nextToken?: string, requestOptions?: RequestOptions): Promise<{ posts: import("./community.define").Post[]; next_token: string | undefined; } | { message: string; error: RequestInternalError | "forum_not_found"; }>; /** * 根据帖子 id 获取帖子详情 * * https://kdocs.cn/l/cbggfJodHLIz?linkname=hj1AZy5rcP */ getPost(postId: number, requestOptions?: RequestOptions): Promise; /** * 发布帖子 * * https://kdocs.cn/l/cbggfJodHLIz?linkname=M5okHBuaVk */ post(option: { forum_id: number; content: string; title?: string; image_urls?: string[]; topic_ids?: number[]; }, requestOptions?: RequestOptions): Promise<{ post: import("./community.define").Post | undefined; antispam: import("./community.define").Antispam | undefined; } | { message: string; error: RequestInternalError | "post_body_too_long" | "post_subject_too_long" | "post_tag_already_exists" | "moderation_check_text_error" | "moderation_check_image_error" | "unknown_moderation_suggestion" | "invalid_content_length" | "forum_disabled" | "not_allowed_to_post" | "please_real_name" | "post_tag_not_exists"; }>; /** * 获取社区帖子评论列表 * * https://kdocs.cn/l/cbggfJodHLIz?linkname=djKbX7lFdp */ getComments(option: { /** 查询类型 */ query_type: "post" | "user"; /** 帖子 ID 或 用户 ID */ query_value: string | number; /** 查询返回的数量 */ max_results: number; /** 分页token */ next_token?: string; }, requestOptions?: RequestOptions): Promise<{ comments: import("./community.define").Comment[]; next_token: string | undefined; } | { message: string; error: RequestInternalError | "post_not_found" | "post_deleted"; }>; /** * 根据评论 id 获取评论详情 * * https://kdocs.cn/l/cbggfJodHLIz?linkname=RIc7oxVGae */ getComment(commentId: number, requestOptions?: RequestOptions): Promise; /** * 帖子下发表评论 * * https://kdocs.cn/l/cbggfJodHLIz?linkname=Nv7lk0nTmr */ comment(option: { /** 帖子 ID */ post_id: number; /** 评论内容 */ content: string; /** 评论内容图片地址 */ image_url?: string; }, requestOptions?: RequestOptions): Promise<{ comment: import("./community.define").Comment | undefined; antispam: import("./community.define").Comment | undefined; } | { message: string; error: RequestInternalError | "moderation_check_text_error" | "moderation_check_image_error" | "unknown_moderation_suggestion" | "invalid_content_length" | "forum_disabled" | "post_not_found" | "post_already_deleted"; }>; /** * 获取社区帖子评论回复列表 * * https://kdocs.cn/l/cbggfJodHLIz?linkname=sVKBbY83MY */ getReplies(option: { /** 查询返回最大回复数 */ max_results?: number; /** 查询类型 */ query_type: "comment" | "user"; /** 查询对应的值 */ query_value: string; /** 分页标识,不传默认首次查询 */ next_token?: string; }, requestOptions?: RequestOptions): Promise<{ replies: import("./community.define").Reply[]; next_token: string; }>; /** * 根据回复 id 获取回复详情 * * https://kdocs.cn/l/cbggfJodHLIz?linkname=kxhcSXD3MG */ getReply(replyId: number, requestOptions?: RequestOptions): Promise; /** * 回复帖子评论或回复 * * https://kdocs.cn/l/cbggfJodHLIz?linkname=KA8WpTX2pg */ reply(option: { /** 评论 ID */ comment_id: number; /** 评论内容 */ content: string; /** 回复的回复 ID (仅当回复回复的时候需要) */ reply_id?: number; }, requestOptions?: RequestOptions): Promise<{ reply: import("./community.define").Reply | undefined; antispam: import("./community.define").Antispam | undefined; } | { message: string; error: RequestInternalError | "moderation_check_text_error" | "moderation_check_image_error" | "comment_not_found" | "comment_deleted" | "reply_not_found" | "reply_deleted"; }>; /** * 对 帖子/评论/回复 点赞 * * https://kdocs.cn/l/cbggfJodHLIz?linkname=CR3m6PyXfZ */ like(option: { /** 点赞目标类型 */ target_type: "post" | "comment" | "reply"; /** 目标 ID */ target_id: number; }, requestOptions?: RequestOptions): Promise; /** * 对 帖子/评论/回复 取消点赞 * * https://kdocs.cn/l/cbggfJodHLIz?linkname=CR3m6PyXfZ */ unlike(option: { /** 点赞目标类型 */ target_type: "post" | "comment" | "reply"; /** 目标 ID */ target_id: number; }, requestOptions?: RequestOptions): Promise; /** * 获取资源预上传地址 * * https://kdocs.cn/l/cbggfJodHLIz?linkname=dWWhpoShxZ */ getMediaPresignedUrl(option: { /** 资源文件大小 */ content_length: number; /** 资源文件 MIME 类型 */ content_type: string; /** 资源文件名 */ filename: string; /** 资源文件内容的 SHA-256 哈希值,用于校验上传对象的完整性 */ content_sha256: string; }, requestOptions?: RequestOptions): Promise; /** * 获取用户社区通知 * * 了解更多[通知的分类](https://kdocs.cn/l/cbggfJodHLIz?linkname=AiCR5khgOr)。 * * https://kdocs.cn/l/cbggfJodHLIz?linkname=W5lceDgbBG */ getNotifications(option: { /** 社区通知分类 */ category: NotificationCategory; /** 查询返回最大通知数量 */ max_results?: number; /** 分页标识,不传默认首次查询 */ next_token?: string; }, requestOptions?: RequestOptions): Promise<{ notifications: (import("./community.define").NotificationSystem | import("./community.define").NotificationPost | import("./community.define").NotificationPostComment | import("./community.define").NotificationCommentReply | import("./community.define").NotificationComment | import("./community.define").NotificationReplyReplied | import("./community.define").NotificationReply)[]; next_token: string; }>; /** * 获取用户未读通知数量 * * https://kdocs.cn/l/cbggfJodHLIz?linkname=CwIOMjAfMU */ getUnreadNotificationsCount(requestOptions?: RequestOptions): Promise<{ system: number; comment: number; like: number; } | null>; /** * 社区用户将通知标为已读 * * https://kdocs.cn/l/cbggfJodHLIz?linkname=TCJQxnOjJe */ clearUnreadNotifications(category: NotificationCategory, requestOptions?: RequestOptions): Promise; }