use crate::{ BilibiliRequest, BpiClient, BpiError, BpiResponse };
use serde::{ Deserialize, Serialize };
#[derive(Debug, Serialize, Clone, Deserialize)]
pub struct SeasonTask {
#[serde(default)]
pub id: String,
#[serde(default)]
pub title: String,
}
#[derive(Debug, Serialize, Clone, Deserialize)]
pub struct SeasonWelfare {
#[serde(default)]
pub id: String,
#[serde(default)]
pub title: String,
}
#[derive(Debug, Serialize, Clone, Deserialize)]
pub struct SeasonText {
#[serde(default)]
pub title: String,
}
#[derive(Debug, Serialize, Clone, Deserialize)]
pub struct SeasonRank {
}
#[derive(Debug, Serialize, Clone, Deserialize)]
pub struct SeasonInfoData {
pub current_time: String,
pub start_time: String,
pub end_time: String,
pub remain_amount: i32,
pub season_id: String,
pub tasks: Vec<SeasonTask>,
pub welfare: Vec<SeasonWelfare>,
pub cover: String,
pub today_tasks: Vec<SeasonTask>,
#[serde(default)]
pub text: Option<SeasonText>,
pub season_title: String,
#[serde(default)]
pub rank: Option<SeasonRank>,
}
pub type SeasonInfoResponse = BpiResponse<SeasonInfoData>;
impl BpiClient {
pub async fn manga_season_info(&self) -> Result<SeasonInfoResponse, BpiError> {
self
.post("https://manga.bilibili.com/twirp/user.v1.Season/GetSeasonInfo")
.send_bpi("获取漫画赛季信息").await
}
}
#[cfg(test)]
mod tests {
use super::*;
#[tokio::test]
async fn test_get_manga_season_info() -> Result<(), Box<BpiError>> {
let bpi = BpiClient::new();
let result = bpi.manga_season_info().await?;
let data = result.into_data()?;
tracing::info!("{:#?}", data);
Ok(())
}
}