diff --git a/src/commands/queue/playlist.rs b/src/commands/queue/playlist.rs index 73ca6c9..5d465c3 100644 --- a/src/commands/queue/playlist.rs +++ b/src/commands/queue/playlist.rs @@ -1,4 +1,7 @@ +use serde::{Deserialize, Serialize}; + use crate::{ + Uri, commands::{Command, CommandResponse, ResponseParserError, empty_command_request}, response_tokenizer::ResponseAttributes, }; @@ -7,7 +10,8 @@ pub struct Playlist; empty_command_request!(Playlist, "playlist"); -pub struct PlaylistResponse(); +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct PlaylistResponse(Vec); impl CommandResponse<'_> for PlaylistResponse { fn into_response_enum(self) -> crate::Response { diff --git a/src/commands/queue/playlistfind.rs b/src/commands/queue/playlistfind.rs index b967954..5d1d430 100644 --- a/src/commands/queue/playlistfind.rs +++ b/src/commands/queue/playlistfind.rs @@ -1,10 +1,12 @@ use serde::{Deserialize, Serialize}; use crate::{ - commands::{Command, CommandRequest, RequestParserError, empty_command_response}, + DbSongInfo, Priority, Response, SongId, SongPosition, + commands::{Command, CommandRequest, CommandResponse, RequestParserError, ResponseParserError}, common::types::{Sort, WindowRange}, filter::Filter, request_tokenizer::RequestTokenizer, + response_tokenizer::ResponseAttributes, }; pub struct PlaylistFind; @@ -83,7 +85,30 @@ impl CommandRequest<'_> for PlaylistFindRequest { } } -empty_command_response!(PlaylistFind); +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct PlaylistFindResponse(Vec); + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct PlaylistFindResponseEntry { + pub position: SongPosition, + pub id: SongId, + pub priority: Option, + pub song_info: DbSongInfo, +} + +impl CommandResponse<'_> for PlaylistFindResponse { + fn into_response_enum(self) -> Response { + todo!() + } + + fn from_response_enum(response: Response) -> Option { + todo!() + } + + fn parse(_parts: ResponseAttributes<'_>) -> Result> { + unimplemented!() + } +} impl Command<'_, '_> for PlaylistFind { type Request = PlaylistFindRequest; diff --git a/src/commands/queue/playlistid.rs b/src/commands/queue/playlistid.rs index c580ecb..6e5414c 100644 --- a/src/commands/queue/playlistid.rs +++ b/src/commands/queue/playlistid.rs @@ -1,4 +1,7 @@ +use serde::{Deserialize, Serialize}; + use crate::{ + DbSongInfo, Priority, SongPosition, commands::{Command, CommandResponse, ResponseParserError, single_item_command_request}, common::types::SongId, response_tokenizer::ResponseAttributes, @@ -8,7 +11,16 @@ pub struct PlaylistId; single_item_command_request!(PlaylistId, "playlistid", SongId); -pub struct PlaylistIdResponse(); +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct PlaylistIdResponse(Vec); + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct PlaylistIdResponseEntry { + pub position: SongPosition, + pub id: SongId, + pub priority: Option, + pub song_info: DbSongInfo, +} impl CommandResponse<'_> for PlaylistIdResponse { fn into_response_enum(self) -> crate::Response { diff --git a/src/commands/queue/playlistinfo.rs b/src/commands/queue/playlistinfo.rs index 870409c..299cba1 100644 --- a/src/commands/queue/playlistinfo.rs +++ b/src/commands/queue/playlistinfo.rs @@ -1,6 +1,7 @@ use serde::{Deserialize, Serialize}; use crate::{ + DbSongInfo, Priority, SongId, SongPosition, commands::{ Command, CommandResponse, RequestParserError, ResponseParserError, single_optional_item_command_request, @@ -14,7 +15,15 @@ pub struct PlaylistInfo; single_optional_item_command_request!(PlaylistInfo, "playlistinfo", OneOrRange); #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] -pub struct PlaylistInfoResponse; +pub struct PlaylistInfoResponse(Vec); + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct PlaylistInfoResponseEntry { + pub position: SongPosition, + pub id: SongId, + pub priority: Option, + pub song_info: DbSongInfo, +} impl CommandResponse<'_> for PlaylistInfoResponse { fn into_response_enum(self) -> crate::Response { diff --git a/src/commands/queue/playlistsearch.rs b/src/commands/queue/playlistsearch.rs index 844a6f1..dcffe70 100644 --- a/src/commands/queue/playlistsearch.rs +++ b/src/commands/queue/playlistsearch.rs @@ -1,6 +1,7 @@ use serde::{Deserialize, Serialize}; use crate::{ + DbSongInfo, Priority, SongId, SongPosition, commands::{Command, CommandRequest, CommandResponse, RequestParserError, ResponseParserError}, common::types::{Sort, WindowRange}, filter::Filter, @@ -85,7 +86,15 @@ impl CommandRequest<'_> for PlaylistSearchRequest { } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] -pub struct PlaylistSearchResponse; +pub struct PlaylistSearchResponse(Vec); + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct PlaylistSearchResponseEntry { + pub position: SongPosition, + pub id: SongId, + pub priority: Option, + pub song_info: DbSongInfo, +} impl CommandResponse<'_> for PlaylistSearchResponse { fn from_response_enum(response: crate::Response) -> Option { diff --git a/src/commands/queue/plchanges.rs b/src/commands/queue/plchanges.rs index e487b16..c079fde 100644 --- a/src/commands/queue/plchanges.rs +++ b/src/commands/queue/plchanges.rs @@ -1,6 +1,7 @@ use serde::{Deserialize, Serialize}; use crate::{ + DbSongInfo, Priority, SongId, SongPosition, commands::{Command, CommandRequest, CommandResponse, RequestParserError, ResponseParserError}, common::types::{PlaylistVersion, WindowRange}, request_tokenizer::RequestTokenizer, @@ -59,7 +60,15 @@ impl CommandRequest<'_> for PlChangesRequest { } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] -pub struct PlChangesResponse; +pub struct PlChangesResponse(Vec); + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct PlChangesResponseEntry { + pub position: SongPosition, + pub id: SongId, + pub priority: Option, + pub song_info: DbSongInfo, +} impl CommandResponse<'_> for PlChangesResponse { fn from_response_enum(response: crate::Response) -> Option { diff --git a/src/commands/queue/plchangesposid.rs b/src/commands/queue/plchangesposid.rs index 947e69a..7fd497f 100644 --- a/src/commands/queue/plchangesposid.rs +++ b/src/commands/queue/plchangesposid.rs @@ -1,6 +1,7 @@ use serde::{Deserialize, Serialize}; use crate::{ + SongId, SongPosition, commands::{Command, CommandRequest, CommandResponse, RequestParserError, ResponseParserError}, common::types::{PlaylistVersion, WindowRange}, request_tokenizer::RequestTokenizer, @@ -59,7 +60,14 @@ impl CommandRequest<'_> for PlChangesPosIdRequest { } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] -pub struct PlChangesPosIdResponse; +pub struct PlChangesPosIdResponse(Vec); + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct PlChangesPosIdResponseEntry { + // 'cpos' + pub position: SongPosition, + pub id: SongId, +} impl CommandResponse<'_> for PlChangesPosIdResponse { fn from_response_enum(response: crate::Response) -> Option {