Skip to main content

ncm_api_rs/api/
msg_comments.rs

1use super::Query;
2use crate::error::Result;
3/// 评论
4/// 对应 Node.js module/msg_comments.js
5use crate::request::{ApiClient, ApiResponse, CryptoType};
6use serde_json::json;
7
8impl ApiClient {
9    /// 评论
10    /// 对应 /msg/comments
11    pub async fn msg_comments(&self, query: &Query) -> Result<ApiResponse> {
12        let uid = query.get_or("uid", "0");
13        let data = json!({
14            "beforeTime": query.get_or("before", "-1"),
15            "limit": query.get_or("limit", "30").parse::<i64>().unwrap_or(30),
16            "total": "true",
17            "uid": uid
18        });
19        self.request(
20            &format!("/api/v1/user/comments/{}", uid),
21            data,
22            query.to_option(CryptoType::Weapi),
23        )
24        .await
25    }
26}