open_lark/service/cloud_docs/comments/
mod.rs

1use crate::core::{config::Config, req_option::RequestOption, SDKResult};
2
3pub use batch_query::{
4    batch_query_comments, BatchQueryCommentsRequest, BatchQueryCommentsResponse,
5};
6pub use create::{
7    create_comment, ContentBuilder, CreateCommentRequest, CreateCommentResponse, CreatedComment,
8};
9pub use delete_reply::{delete_reply, DeleteReplyRequest, DeleteReplyResponse, DeletedReply};
10pub use get::{get_comment, GetCommentRequest, GetCommentResponse};
11pub use list::{
12    list_comments, Comment, ContentElement, ListCommentsRequest, ListCommentsResponse, Reply,
13    ReplyContent, TextRun,
14};
15pub use list_replies::{list_replies, ListRepliesRequest, ListRepliesResponse};
16pub use patch::{patch_comment, PatchCommentRequest, PatchCommentResponse};
17pub use update_reply::{update_reply, UpdateReplyRequest, UpdateReplyResponse, UpdatedReply};
18
19mod batch_query;
20mod create;
21mod delete_reply;
22mod get;
23mod list;
24mod list_replies;
25mod patch;
26mod update_reply;
27
28/// 评论服务
29pub struct CommentsService {
30    config: Config,
31}
32
33impl CommentsService {
34    pub fn new(config: Config) -> Self {
35        Self { config }
36    }
37
38    /// 使用共享配置(实验性)
39    pub fn new_from_shared(shared: std::sync::Arc<Config>) -> Self {
40        Self {
41            config: (*shared).clone(),
42        }
43    }
44
45    /// 获取云文档所有评论
46    pub async fn list(
47        &self,
48        request: ListCommentsRequest,
49        option: Option<RequestOption>,
50    ) -> SDKResult<crate::core::api_resp::BaseResponse<ListCommentsResponse>> {
51        list_comments(request, &self.config, option).await
52    }
53
54    /// 批量获取评论
55    pub async fn batch_query(
56        &self,
57        request: BatchQueryCommentsRequest,
58        option: Option<RequestOption>,
59    ) -> SDKResult<crate::core::api_resp::BaseResponse<BatchQueryCommentsResponse>> {
60        batch_query_comments(request, &self.config, option).await
61    }
62
63    /// 解决/恢复评论
64    pub async fn patch(
65        &self,
66        request: PatchCommentRequest,
67        option: Option<RequestOption>,
68    ) -> SDKResult<crate::core::api_resp::BaseResponse<PatchCommentResponse>> {
69        patch_comment(request, &self.config, option).await
70    }
71
72    /// 添加全文评论
73    pub async fn create(
74        &self,
75        request: CreateCommentRequest,
76        option: Option<RequestOption>,
77    ) -> SDKResult<crate::core::api_resp::BaseResponse<CreateCommentResponse>> {
78        create_comment(request, &self.config, option).await
79    }
80
81    /// 获取全文评论
82    pub async fn get(
83        &self,
84        request: GetCommentRequest,
85        option: Option<RequestOption>,
86    ) -> SDKResult<crate::core::api_resp::BaseResponse<GetCommentResponse>> {
87        get_comment(request, &self.config, option).await
88    }
89
90    /// 获取回复信息
91    pub async fn list_replies(
92        &self,
93        request: ListRepliesRequest,
94        option: Option<RequestOption>,
95    ) -> SDKResult<crate::core::api_resp::BaseResponse<ListRepliesResponse>> {
96        list_replies(request, &self.config, option).await
97    }
98
99    /// 更新回复的内容
100    pub async fn update_reply(
101        &self,
102        request: UpdateReplyRequest,
103        option: Option<RequestOption>,
104    ) -> SDKResult<crate::core::api_resp::BaseResponse<UpdateReplyResponse>> {
105        update_reply(request, &self.config, option).await
106    }
107
108    /// 删除回复
109    pub async fn delete_reply(
110        &self,
111        request: DeleteReplyRequest,
112        option: Option<RequestOption>,
113    ) -> SDKResult<crate::core::api_resp::BaseResponse<DeleteReplyResponse>> {
114        delete_reply(request, &self.config, option).await
115    }
116}