rust_okx/api/account/requests/
loans.rs1use serde::Serialize;
2#[derive(Debug, Clone, Serialize)]
4pub struct SpotManualBorrowRepayRequest {
5 ccy: String,
6 side: String,
7 amt: String,
8}
9
10impl SpotManualBorrowRepayRequest {
11 pub fn new(ccy: impl Into<String>, side: impl Into<String>, amt: impl Into<String>) -> Self {
13 Self {
14 ccy: ccy.into(),
15 side: side.into(),
16 amt: amt.into(),
17 }
18 }
19}
20
21#[derive(Debug, Clone, Serialize)]
23pub struct SetAutoRepayRequest {
24 #[serde(rename = "autoRepay")]
25 auto_repay: bool,
26}
27
28impl SetAutoRepayRequest {
29 pub fn new(auto_repay: bool) -> Self {
31 Self { auto_repay }
32 }
33}
34
35#[derive(Debug, Clone, Default, Serialize)]
37pub struct SpotBorrowRepayHistoryRequest {
38 #[serde(skip_serializing_if = "Option::is_none")]
39 ccy: Option<String>,
40 #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
41 event_type: Option<String>,
42 #[serde(skip_serializing_if = "Option::is_none")]
43 after: Option<String>,
44 #[serde(skip_serializing_if = "Option::is_none")]
45 before: Option<String>,
46 #[serde(skip_serializing_if = "Option::is_none")]
47 limit: Option<u32>,
48}
49
50impl SpotBorrowRepayHistoryRequest {
51 pub fn new() -> Self {
53 Self::default()
54 }
55
56 pub fn currency(mut self, value: impl Into<String>) -> Self {
58 self.ccy = Some(value.into());
59 self
60 }
61
62 pub fn event_type(mut self, value: impl Into<String>) -> Self {
64 self.event_type = Some(value.into());
65 self
66 }
67
68 pub fn after(mut self, value: impl Into<String>) -> Self {
70 self.after = Some(value.into());
71 self
72 }
73
74 pub fn before(mut self, value: impl Into<String>) -> Self {
76 self.before = Some(value.into());
77 self
78 }
79
80 pub fn limit(mut self, value: u32) -> Self {
82 self.limit = Some(value);
83 self
84 }
85}
86
87#[derive(Debug, Clone, Serialize)]
89pub struct SetAutoEarnRequest {
90 #[serde(rename = "earnType")]
91 earn_type: String,
92 ccy: String,
93 action: String,
94}
95
96impl SetAutoEarnRequest {
97 pub fn new(
102 earn_type: impl Into<String>,
103 ccy: impl Into<String>,
104 action: impl Into<String>,
105 ) -> Self {
106 Self {
107 earn_type: earn_type.into(),
108 ccy: ccy.into(),
109 action: action.into(),
110 }
111 }
112}