diff options
Diffstat (limited to 'lockchain-http/src/models/responses.rs')
-rw-r--r-- | lockchain-http/src/models/responses.rs | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/lockchain-http/src/models/responses.rs b/lockchain-http/src/models/responses.rs index ac4e74b..436d3e6 100644 --- a/lockchain-http/src/models/responses.rs +++ b/lockchain-http/src/models/responses.rs @@ -1,7 +1,5 @@ - - -use lockchain::errors::Error as LockError; use serde::{de::DeserializeOwned, Serialize}; +use std::error::Error; /// A generic container that json/error wraps lockchain-types /// @@ -9,8 +7,13 @@ use serde::{de::DeserializeOwned, Serialize}; /// to send both encrypted and cleartext data via the API endpoint, using /// the same code. #[derive(Serialize, Deserialize)] -pub struct CarrierMessage<T: Serialize + DeserializeOwned> { - pub error: Result<(), LockError>, +pub struct CarrierMessage<T, E> +where + T: Serialize + DeserializeOwned, + E: Error + Serialize + DeserializeOwned, +{ + #[serde(bound(deserialize = "E: Serialize + DeserializeOwned"))] + pub error: Result<(), E>, #[serde(bound(deserialize = "T: Serialize + DeserializeOwned"))] pub data: Option<T>, } @@ -22,6 +25,13 @@ pub struct OperationFailed { pub code: u32, } +/// Message that returns a token +#[derive(Serialize, Deserialize)] +pub struct TokenMessage { + pub username: String, + pub token: String, +} + /// **Returns** Api information #[derive(Serialize, Deserialize)] pub struct ApiInformation { @@ -44,4 +54,4 @@ pub struct VaultCreateResponse { pub name: String, pub created: bool, pub error: Option<String>, -}
\ No newline at end of file +} |