submarine 0.1.0

A library for connecting with a subsonic server
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::data::{Child, ResponseType};
use crate::{Client, SubsonicError};

impl Client {
    /// reference: http://www.subsonic.org/pages/api.jsp#getVideos
    pub async fn get_videos(&self) -> Result<Vec<Child>, SubsonicError> {
        let body = self.request("getVideos", None, None).await?;
        if let ResponseType::Videos { videos } = body.data {
            Ok(videos.video)
        } else {
            Err(SubsonicError::Submarine(String::from(
                "expected type Videos but found wrong type",
            )))
        }
    }
}

//TODO add test