Skip to main content

ncm_api_rs/api/
calendar.rs

1use super::Query;
2use crate::error::Result;
3/// 音乐日历
4/// 对应 Node.js module/calendar.js
5use crate::request::{ApiClient, ApiResponse, CryptoType};
6use serde_json::json;
7
8impl ApiClient {
9    /// 音乐日历
10    /// 对应 /calendar
11    pub async fn calendar(&self, query: &Query) -> Result<ApiResponse> {
12        let now = chrono::Utc::now().timestamp_millis().to_string();
13        let data = json!({
14            "startTime": query.get_or("startTime", &now).parse::<i64>().unwrap_or(0),
15            "endTime": query.get_or("endTime", &now).parse::<i64>().unwrap_or(0)
16        });
17        self.request(
18            "/api/mcalendar/detail",
19            data,
20            query.to_option(CryptoType::Weapi),
21        )
22        .await
23    }
24}