open_lark/service/cloud_docs/comments/
mod.rs

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