1
use crate::{
2
    commands::{
3
        Command, Request, RequestParserError, RequestParserResult, ResponseAttributes,
4
        ResponseParserError,
5
    },
6
    common::PlaylistName,
7
};
8

            
9
pub struct ListPlaylistInfo;
10

            
11
impl Command for ListPlaylistInfo {
12
    type Response = ();
13
    const COMMAND: &'static str = "listplaylistinfo";
14

            
15
    fn parse_request(mut parts: std::str::SplitWhitespace<'_>) -> RequestParserResult<'_> {
16
        let name = parts.next().ok_or(RequestParserError::UnexpectedEOF)?;
17
        let name = name
18
            .parse::<PlaylistName>()
19
            .map_err(|_| RequestParserError::SyntaxError(0, name.to_owned()))?;
20

            
21
        let range = parts
22
            .next()
23
            .map(|s| {
24
                s.parse()
25
                    .map_err(|_| RequestParserError::SyntaxError(0, s.to_owned()))
26
            })
27
            .transpose()?;
28

            
29
        debug_assert!(parts.next().is_none());
30

            
31
        Ok((Request::ListPlaylistInfo(name, range), ""))
32
    }
33

            
34
    fn parse_response(
35
        parts: ResponseAttributes<'_>,
36
    ) -> Result<Self::Response, ResponseParserError> {
37
        unimplemented!()
38
    }
39
}