Skip to main content

ncm_api_rs/api/
toplist_artist.rs

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