use std::borrow::Cow;
use serde::Serialize;
#[derive(Debug, Clone, Default, Serialize)]
pub struct CurrencyRequest<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
ccy: Option<Cow<'a, str>>,
}
impl<'a> CurrencyRequest<'a> {
pub fn new() -> Self {
Self::default()
}
pub fn currency(mut self, ccy: impl Into<Cow<'a, str>>) -> Self {
self.ccy = Some(ccy.into());
self
}
}
#[derive(Debug, Clone, Serialize)]
pub struct SetLendingRateRequest<'a> {
ccy: Cow<'a, str>,
rate: Cow<'a, str>,
}
impl<'a> SetLendingRateRequest<'a> {
pub fn new(ccy: impl Into<Cow<'a, str>>, rate: impl Into<Cow<'a, str>>) -> Self {
Self {
ccy: ccy.into(),
rate: rate.into(),
}
}
}
#[derive(Debug, Clone, Serialize)]
pub struct AmountRequest<'a> {
amt: Cow<'a, str>,
}
impl<'a> AmountRequest<'a> {
pub fn new(amt: impl Into<Cow<'a, str>>) -> Self {
Self { amt: amt.into() }
}
}
#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct CancelRedeemRequest<'a> {
ord_id: Cow<'a, str>,
}
impl<'a> CancelRedeemRequest<'a> {
pub fn new(ord_id: impl Into<Cow<'a, str>>) -> Self {
Self {
ord_id: ord_id.into(),
}
}
}
#[derive(Debug, Clone, Serialize)]
pub struct ApyHistoryRequest<'a> {
days: Cow<'a, str>,
}
impl<'a> ApyHistoryRequest<'a> {
pub fn new(days: impl Into<Cow<'a, str>>) -> Self {
Self { days: days.into() }
}
}
#[derive(Debug, Clone, Default, Serialize)]
pub struct FinanceHistoryRequest<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
ccy: Option<Cow<'a, str>>,
#[serde(skip_serializing_if = "Option::is_none")]
after: Option<Cow<'a, str>>,
#[serde(skip_serializing_if = "Option::is_none")]
before: Option<Cow<'a, str>>,
#[serde(skip_serializing_if = "Option::is_none")]
limit: Option<u32>,
}
impl<'a> FinanceHistoryRequest<'a> {
pub fn new() -> Self {
Self::default()
}
pub fn currency(mut self, ccy: impl Into<Cow<'a, str>>) -> Self {
self.ccy = Some(ccy.into());
self
}
pub fn after(mut self, after: impl Into<Cow<'a, str>>) -> Self {
self.after = Some(after.into());
self
}
pub fn before(mut self, before: impl Into<Cow<'a, str>>) -> Self {
self.before = Some(before.into());
self
}
pub fn limit(mut self, limit: u32) -> Self {
self.limit = Some(limit);
self
}
}