#![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 RequestAccountInfoCommand {
#[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 RequestAccountInfoCommand {
pub fn with_params(account: String) -> Box<Self> {
Box::new(
RequestAccountInfoCommand {
id: 1,
command: "account_info".to_string(),
relation_type: None,
account: account,
ledger_index: "validated".to_string(),
}
)
}
}
impl CommandConversion for RequestAccountInfoCommand {
type T = RequestAccountInfoCommand;
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 RequestAccountInfoResponse {
#[serde(rename="Account")]
pub account: String,
#[serde(rename="Balance")]
pub balance: String,
#[serde(rename="Flags")]
pub flags: u64,
#[serde(rename="LedgerEntryType")]
pub ledger_entry_type: String,
#[serde(rename="OwnerCount")]
pub owner_count: u64,
#[serde(rename="PreviousTxnID")]
pub previous_txn_id: String,
#[serde(rename="PreviousTxnLgrSeq")]
pub previous_txn_lgr_seq: u64,
#[serde(rename="Sequence")]
pub sequence: u64,
#[serde(rename="index")]
pub index: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct AccounInfoSideKick {
pub error : String,
pub error_code : i32,
pub error_message : String,
pub id : u32,
pub request : RequestAccountInfoCommand,
pub status : String,
#[serde(rename="type")]
pub rtype : String,
}
impl fmt::Display for AccounInfoSideKick {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "AccounInfoSideKick is here!")
}
}
impl Error for AccounInfoSideKick {
fn description(&self) -> &str {
"I'm AccounInfoSideKick side kick"
}
}