Skip to main content

ncm_api_rs/api/
summary_annual.rs

1use super::Query;
2use crate::error::Result;
3/// 年度听歌报告2017-2023
4/// 对应 Node.js module/summary_annual.js
5use crate::request::{ApiClient, ApiResponse, CryptoType};
6use serde_json::json;
7
8impl ApiClient {
9    /// 年度听歌报告2017-2023
10    /// 对应 /summary/annual
11    pub async fn summary_annual(&self, query: &Query) -> Result<ApiResponse> {
12        let data = json!({});
13        let year = query.get_or("year", "2023");
14        let key = match year.as_str() {
15            "2017" | "2018" | "2019" => "userdata",
16            _ => "data",
17        };
18        let url = format!("/api/activity/summary/annual/{}/{}", year, key);
19        self.request(&url, data, query.to_option(CryptoType::default()))
20            .await
21    }
22}