Skip to main content

ncm_api_rs/api/
weblog.rs

1use super::Query;
2use crate::error::Result;
3/// Weblog
4/// 对应 Node.js module/weblog.js
5use crate::request::{ApiClient, ApiResponse, CryptoType};
6use serde_json::json;
7
8impl ApiClient {
9    /// Weblog 上报
10    /// 对应 /weblog
11    pub async fn weblog(&self, query: &Query) -> Result<ApiResponse> {
12        // 通用 weblog 接口,data 由调用方传入
13        let data = if let Some(data_str) = query.get("data") {
14            serde_json::from_str(data_str).unwrap_or(json!({}))
15        } else {
16            json!({})
17        };
18        self.request(
19            "/api/feedback/weblog",
20            data,
21            query.to_option(CryptoType::Weapi),
22        )
23        .await
24    }
25}