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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//! DTOs for the first version of the API.

pub mod oauth;
pub mod public;
pub mod user;
pub mod otp;
pub mod friends;
pub mod transactions;

pub use oauth::*;
pub use public::*;
pub use user::*;
pub use otp::*;
pub use friends::*;
pub use transactions::*;

use DTO;

/// Response Data Transfer Object
#[derive(Debug, Clone, RustcDecodable, RustcEncodable)]
pub struct ResponseDTO {
    /// The message
    pub message: String,
}

impl ResponseDTO {
    /// creates a new response dto
    pub fn new<S: AsRef<str>>(message: S) -> ResponseDTO {
        ResponseDTO { message: String::from(message.as_ref()) }
    }
    /// Sets the message of the response
    pub fn set_message<S: AsRef<str>>(&mut self, message: S) {
        self.message = String::from(message.as_ref());
    }
}

impl DTO for ResponseDTO {}

// /// Holds both public and signing keys encoded in base64
// #[derive(RustcEncodable, RustcDecodable)]
// pub struct PublicKeysDTO {
//     /// the public ntrumls key in base 64
//     pub public_sign_key: String,
//     /// the public ntru key in base 64
//     pub public_encrypt_key: String,
// }
//
// impl DTO for PublicKeysDTO {}