use crate::{ BilibiliRequest, BpiClient, BpiError, BpiResponse };
use serde::{ Deserialize, Serialize };
#[derive(Debug, Serialize, Clone, Deserialize)]
pub struct ShareComicData {
pub point: i32,
}
pub type ShareComicResponse = BpiResponse<ShareComicData>;
impl BpiClient {
pub async fn manga_share_comic(&self) -> Result<ShareComicResponse, BpiError> {
let params = [("platform", "android")];
self
.post("https://manga.bilibili.com/twirp/activity.v1.Activity/ShareComic")
.form(¶ms)
.send_bpi("分享漫画").await
}
}
#[cfg(test)]
mod tests {
use super::*;
#[tokio::test]
async fn test_share_comic() -> Result<(), Box<BpiError>> {
let bpi = BpiClient::new();
let result = bpi.manga_share_comic().await?;
let data = result.into_data()?;
assert_eq!(data.point, 5);
Ok(())
}
}