Skip to main content

ncm_api_rs/api/
artist_songs.rs

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