add tests to api

This commit is contained in:
2025-12-31 18:45:46 -05:00
parent 42a09e8b0f
commit 4aa86da14a
17 changed files with 803 additions and 26 deletions

View File

@@ -11,25 +11,25 @@ pub struct CommandParameterDefinition {
pub data_type: DataType,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct CommandDefinition {
pub name: String,
pub parameters: Vec<CommandParameterDefinition>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct CommandHeader {
pub timestamp: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Command {
#[serde(flatten)]
pub header: CommandHeader,
pub parameters: HashMap<String, DataValue>,
}
#[derive(Debug, Error)]
#[derive(Debug, PartialEq, Eq, Error)]
pub enum IntoCommandDefinitionError {
#[error("Parameter Missing: {0}")]
ParameterMissing(String),

View File

@@ -1,7 +1,7 @@
use derive_more::{From, TryInto};
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Copy, Serialize, Deserialize, From, TryInto)]
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, From, TryInto)]
pub enum DataValue {
Float32(f32),
Float64(f64),