rust_okx/api/finance/requests/
savings.rs1use std::borrow::Cow;
2
3use serde::Serialize;
4
5#[derive(Debug, Clone, Serialize)]
7pub struct SavingsPurchaseRedemptionRequest<'a> {
8 ccy: Cow<'a, str>,
9 amt: Cow<'a, str>,
10 side: Cow<'a, str>,
11 #[serde(skip_serializing_if = "Option::is_none")]
12 rate: Option<Cow<'a, str>>,
13}
14
15impl<'a> SavingsPurchaseRedemptionRequest<'a> {
16 pub fn new(
20 ccy: impl Into<Cow<'a, str>>,
21 amt: impl Into<Cow<'a, str>>,
22 side: impl Into<Cow<'a, str>>,
23 ) -> Self {
24 Self {
25 ccy: ccy.into(),
26 amt: amt.into(),
27 side: side.into(),
28 rate: None,
29 }
30 }
31
32 pub fn rate(mut self, rate: impl Into<Cow<'a, str>>) -> Self {
36 self.rate = Some(rate.into());
37 self
38 }
39}