add tests to api
This commit is contained in:
@@ -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),
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user