use crate::models::prelude::Embedded;
use crate::models::Response;
use derive_getters::Getters;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize, Getters)]
pub struct PathsResponse {
#[serde(rename = "_embedded")]
embedded: Embedded<Path>,
}
#[derive(Debug, Clone, Serialize, Deserialize, Getters)]
pub struct Path {
source_asset_type: String,
source_asset_code: Option<String>,
source_asset_issuer: Option<String>,
source_amount: String,
destination_asset_type: String,
destination_asset_code: Option<String>,
destination_asset_issuer: Option<String>,
destination_amount: String,
path: Vec<Asset>,
}
#[derive(Debug, Clone, Serialize, Deserialize, Getters)]
pub struct Asset {
asset_type: String,
asset_code: Option<String>,
asset_issuer: Option<String>,
}
impl Response for PathsResponse {
fn from_json(json: String) -> Result<Self, String> {
serde_json::from_str(&json).map_err(|e| e.to_string())
}
}