use serde::{Deserialize, Serialize};
#[cfg(test)]
use super::params::{PopularSeriesOneParams, VideoPopularListParams};
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct PopularListData {
pub list: Vec<serde_json::Value>, pub no_more: bool,
}
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct PopularSeriesItem {
pub number: u32,
pub subject: String,
pub status: u8,
pub name: String,
}
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct PopularSeriesListData {
pub list: Vec<PopularSeriesItem>,
}
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct PopularSeriesConfig {
pub id: u64,
#[serde(rename = "type")]
pub type_name: String,
pub number: u32,
pub subject: String,
pub stime: u64,
pub etime: u64,
pub status: u8,
pub name: String,
pub label: String,
pub hint: String,
pub color: u32,
pub cover: String,
pub share_title: String,
pub share_subtitle: String,
pub media_id: u64,
}
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct PopularSeriesOneData {
pub config: PopularSeriesConfig,
pub reminder: Option<String>,
pub list: Vec<serde_json::Value>,
}
#[cfg(test)]
mod tests {
use super::*;
use crate::BpiClient;
use tracing::info;
#[ignore = "legacy live API test; requires explicit BPI_LIVE_TEST review"]
#[tokio::test]
async fn test_video_popular_list() {
let bpi = BpiClient::new().expect("client should build");
let params = VideoPopularListParams::new()
.with_page(1)
.expect("page is valid")
.with_page_size(2)
.expect("page size is valid");
let resp = bpi.video_ranking().popular_list(params).await;
info!("{:?}", resp);
assert!(resp.is_ok());
let data = resp.unwrap();
info!("no_more: {}", data.no_more);
info!("first item: {:?}", data.list.first());
}
#[ignore = "legacy live API test; requires explicit BPI_LIVE_TEST review"]
#[tokio::test]
async fn test_video_popular_series_list() {
let bpi = BpiClient::new().expect("client should build");
let resp = bpi.video_ranking().popular_series_list().await;
info!("{:?}", resp);
assert!(resp.is_ok());
let data = resp.unwrap();
info!("first series: {:?}", data.list.first());
}
#[ignore = "legacy live API test; requires explicit BPI_LIVE_TEST review"]
#[tokio::test]
async fn test_video_popular_series_one() {
let bpi = BpiClient::new().expect("client should build");
let params = PopularSeriesOneParams::new(1).expect("number is valid");
let resp = bpi.video_ranking().popular_series_one(params).await;
info!("{:?}", resp);
assert!(resp.is_ok());
let data = resp.unwrap();
info!("config: {:?}", data.config);
info!("first video: {:?}", data.list.first());
}
}