bpi_rs/login/member_center/
exp.rs

1//! 查询每日投币获得经验数
2//!
3//! 文档:https://socialsisteryi.github.io/bilibili-API-collect/docs/login/member_center.html#查询每日投币获得经验数
4
5use crate::{ BilibiliRequest, BpiClient, BpiError, BpiResponse };
6
7impl BpiClient {
8    /// 查询每日投币获得经验数
9    ///
10    /// 文档: https://github.com/SocialSisterYi/bilibili-API-collect/tree/master/docs/login
11    pub async fn member_center_today_coin_exp(&self) -> Result<BpiResponse<u32>, BpiError> {
12        self
13            .get("https://api.bilibili.com/x/web-interface/coin/today/exp")
14            .send_bpi("每日投币经验").await
15    }
16}
17
18#[cfg(test)]
19mod tests {
20    use super::*;
21
22    #[tokio::test]
23    async fn test_get_today_coin_exp() {
24        let bpi = BpiClient::new();
25
26        match bpi.member_center_today_coin_exp().await {
27            Ok(resp) => {
28                if resp.code == 0 {
29                    tracing::info!("今日投币获得经验: {:?}", resp.data.unwrap());
30                } else {
31                    tracing::info!("请求失败: code={}, message={}", resp.code, resp.message);
32                }
33            }
34            Err(err) => {
35                panic!("请求出错: {}", err);
36            }
37        }
38    }
39}