diff --git a/src/structs.rs b/src/structs.rs index 477c55b..3c8b782 100644 --- a/src/structs.rs +++ b/src/structs.rs @@ -1,4 +1,4 @@ -use arma_rs::FromArma; +use arma_rs::{FromArma, FromArmaError}; use serde::{Deserialize, Serialize}; #[derive(Serialize)] @@ -13,10 +13,12 @@ pub struct Marker { pub hae: f64, pub api_address: String, pub api_auth_token: String, + pub api_auth_username: String, + pub api_auth_password: String, } impl FromArma for Marker { - fn from_arma(data: String) -> Result { + fn from_arma(data: String) -> Result { let ( uid, latitude, @@ -28,6 +30,8 @@ impl FromArma for Marker { hae, api_address, api_auth_token, + api_auth_username, + api_auth_password ) = <( String, f64, @@ -39,6 +43,8 @@ impl FromArma for Marker { f64, String, String, + String, + String )>::from_arma(data)?; Ok(Self { uid, @@ -51,11 +57,25 @@ impl FromArma for Marker { hae, api_address, api_auth_token, + api_auth_username, + api_auth_password }) } } #[derive(Debug, Serialize, Deserialize)] +pub struct MarkerPayload { + pub uid: String, + pub longitude: f64, + pub latitude: f64, + pub name: String, + pub r#type: String, + pub course: f64, + pub speed: f64, + pub hae: f64, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] pub struct LoginPayload { pub address: String, pub username: String, @@ -69,7 +89,7 @@ pub struct LoginInfo { } impl FromArma for LoginPayload { - fn from_arma(data: String) -> Result { + fn from_arma(data: String) -> Result { let (address, username, password) = <(String, String, String)>::from_arma(data)?; Ok(Self { address,