aboutsummaryrefslogtreecommitdiff
path: root/lockchain-http/src/models/mod.rs
blob: a80872c584a27a9100f17a31b4c7bb51d0e263a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//! Data models specific to the lockchain API

pub mod inputs;
pub mod responses;

use serde::{de::DeserializeOwned, Serialize};
use std::error::Error;

/// A wrapper model for various API response types
#[derive(Serialize, Deserialize)]
pub enum Response{
    /// Indicate general success of an operation
    Success,
    /// Indicate a failure of some kind
    Failure(responses::OperationFailed),
    /// Returns a login token
    Token(responses::TokenMessage),
    /// Returns general API information
    Api(responses::ApiInformation),
    /// Returns a list of all vaults
    Vaults(responses::VaultList),
}

#[derive(Debug, Serialize, Deserialize, Copy, Clone, Eq, PartialEq)]
pub struct NoneError;
impl Error for NoneError {}

use std::fmt::{Display, Formatter, Result};

impl Display for NoneError {
    fn fmt(&self, f: &mut Formatter) -> Result {
        write!(f, "<None>")
    }
}