#![allow(unused)]
use serde_json::json;
use serde::{Deserialize, Serialize};
use serde_json::Result;
use std::any::Any;
use crate::message::common::command_trait::CommandConversion;
use std::error::Error;
use std::fmt;
#[derive(Serialize, Deserialize, Debug)]
pub struct RequestAccountTumsCommand {
#[serde(rename="id")]
id: u64,
#[serde(rename="command")]
command: String,
#[serde(rename="relation_type")]
relation_type: Option<String>,
#[serde(rename="account")]
account: String,
#[serde(rename="ledger_index")]
ledger_index: String,
}
impl RequestAccountTumsCommand {
pub fn with_params(account: String) -> Box<Self> {
Box::new(
RequestAccountTumsCommand {
id: 1,
command: "account_currencies".to_string(),
relation_type: None,
account: account,
ledger_index: "validated".to_string(),
}
)
}
}
impl CommandConversion for RequestAccountTumsCommand {
type T = RequestAccountTumsCommand;
fn to_string(&self) -> Result<String> {
let j = serde_json::to_string(&self)?;
Ok(j)
}
fn box_to_raw(&self) -> &dyn Any {
self
}
}
#[derive(Serialize, Deserialize, Debug)]
pub struct RequestAccountTumsResponse {
#[serde(rename="ledger_hash")]
pub ledger_hash: String,
#[serde(rename="ledger_index")]
pub ledger_index: u64,
#[serde(rename="receive_currencies")]
pub receive_currencies: Vec<String>,
#[serde(rename="send_currencies")]
pub send_currencies: Vec<String>,
#[serde(rename="validated")]
pub validated: bool,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct AccounTumSideKick {
pub error : String,
pub error_code : i32,
pub error_message : String,
pub id : u32,
pub request : RequestAccountTumsCommand,
pub status : String,
#[serde(rename="type")]
pub rtype : String,
}
impl fmt::Display for AccounTumSideKick {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "AccounTumSideKick is here!")
}
}
impl Error for AccounTumSideKick {
fn description(&self) -> &str {
"I'm AccounTumSideKick side kick"
}
}