diff --git a/src/commands/connection_settings/tag_types_available.rs b/src/commands/connection_settings/tag_types_available.rs index 3bada4da..7be954fd 100644 --- a/src/commands/connection_settings/tag_types_available.rs +++ b/src/commands/connection_settings/tag_types_available.rs @@ -1,12 +1,13 @@ use crate::{ - Request, - commands::{Command, RequestParserResult, ResponseAttributes, ResponseParserError}, + commands::{expect_property_type, Command, RequestParserResult, ResponseAttributes, ResponseParserError}, Request }; pub struct TagTypesAvailable; +pub type TagTypesAvailableResponse = Vec; + impl Command for TagTypesAvailable { - type Response = (); + type Response = TagTypesAvailableResponse; const COMMAND: &'static str = "tagtypes available"; fn parse_request(mut parts: std::str::SplitWhitespace<'_>) -> RequestParserResult<'_> { @@ -17,6 +18,19 @@ impl Command for TagTypesAvailable { fn parse_response( parts: ResponseAttributes<'_>, ) -> Result> { - unimplemented!() + let parts: Vec<_> = parts.into(); + + let mut tagtypes = Vec::with_capacity(parts.len()); + for (key, value) in parts.into_iter() { + if key != "tagtype" { + return Err(ResponseParserError::UnexpectedProperty(key)); + } + + let tagtype = expect_property_type!(Some(value), "tagtype", Text).to_string(); + + tagtypes.push(tagtype); + } + + Ok(tagtypes) } }