use crate::data::{ResponseType, VideoInfo};
use crate::{Client, Parameter, SubsonicError};
impl Client {
pub async fn get_video_info(&self, id: impl Into<String>) -> Result<VideoInfo, SubsonicError> {
let mut paras = Parameter::new();
paras.push("id", id);
let body = self.request("getVideoInfo", Some(paras), None).await?;
if let ResponseType::VideoInfo { video_info } = body.data {
Ok(video_info)
} else {
Err(SubsonicError::Submarine(String::from(
"expected type VideoInfo but found wrong type",
)))
}
}
}