Skip to main content

ncm_api_rs/api/
top_artists.rs

1use super::Query;
2use crate::error::Result;
3/// 热门歌手
4/// 对应 Node.js module/top_artists.js
5use crate::request::{ApiClient, ApiResponse, CryptoType};
6use serde_json::json;
7
8impl ApiClient {
9    /// 热门歌手
10    /// 对应 /top/artists
11    pub async fn top_artists(&self, query: &Query) -> Result<ApiResponse> {
12        let data = json!({
13            "limit": query.get_or("limit", "50").parse::<i64>().unwrap_or(50),
14            "offset": query.get_or("offset", "0").parse::<i64>().unwrap_or(0),
15            "total": true
16        });
17        self.request("/api/artist/top", data, query.to_option(CryptoType::Weapi))
18            .await
19    }
20}