use serde::Serializer;
use serde_derive::Serialize;
#[derive(Debug, Default)]
pub struct EmptyBody {}
impl serde::Serialize for EmptyBody {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
serializer.serialize_str("")
}
}
#[derive(Debug, Default, Serialize)]
pub struct EmptyQuery {}
#[derive(Debug, Default, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct CreateAddressParams {
label: String,
}
impl CreateAddressParams {
pub fn new(label: String) -> CreateAddressParams {
CreateAddressParams { label }
}
}
#[derive(Debug, Default, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ListTransfersParams<'a> {
pub limit: Option<i32>,
pub prev_id: Option<&'a str>,
}
impl<'a> ListTransfersParams<'a> {
pub fn default() -> ListTransfersParams<'a> {
ListTransfersParams {
limit: None,
prev_id: None,
}
}
}
#[derive(Debug, Default, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SendCoinsParams<'a> {
wallet_passphrase: &'a str,
address: &'a str,
amount: i64,
comment: Option<&'a str>,
}
impl<'a> SendCoinsParams<'a> {
pub fn new(
wallet_passphrase: &'a str,
address: &'a str,
amount: i64,
comment: Option<&'a str>,
) -> SendCoinsParams<'a> {
SendCoinsParams {
wallet_passphrase,
address,
amount,
comment,
}
}
}