gateio_rs/api/spot/
get_price_orders.rs1use crate::http::{Credentials, Method, request::Request};
2
3pub struct GetPriceOrders {
17 pub status: Option<String>,
19 pub market: Option<String>,
21 pub account: Option<String>,
23 pub limit: Option<i32>,
25 pub offset: Option<i32>,
27 pub credentials: Option<Credentials>,
29}
30
31impl GetPriceOrders {
32 pub fn new() -> Self {
34 Self {
35 status: None,
36 market: None,
37 account: None,
38 limit: None,
39 offset: None,
40 credentials: None,
41 }
42 }
43
44 pub fn status(mut self, status: &str) -> Self {
51 self.status = Some(status.into());
52 self
53 }
54
55 pub fn market(mut self, market: &str) -> Self {
57 self.market = Some(market.into());
58 self
59 }
60
61 pub fn account(mut self, account: &str) -> Self {
66 self.account = Some(account.into());
67 self
68 }
69
70 pub fn limit(mut self, limit: i32) -> Self {
72 self.limit = Some(limit);
73 self
74 }
75
76 pub fn offset(mut self, offset: i32) -> Self {
78 self.offset = Some(offset);
79 self
80 }
81
82 pub fn credentials(mut self, creds: Credentials) -> Self {
84 self.credentials = Some(creds);
85 self
86 }
87}
88
89impl From<GetPriceOrders> for Request {
90 fn from(request: GetPriceOrders) -> Request {
91 let mut params = Vec::new();
92
93 if let Some(status) = request.status {
94 params.push(("status".into(), status));
95 }
96
97 if let Some(market) = request.market {
98 params.push(("market".into(), market));
99 }
100
101 if let Some(account) = request.account {
102 params.push(("account".into(), account));
103 }
104
105 if let Some(limit) = request.limit {
106 params.push(("limit".into(), limit.to_string()));
107 }
108
109 if let Some(offset) = request.offset {
110 params.push(("offset".into(), offset.to_string()));
111 }
112
113 Request {
114 method: Method::Get,
115 path: "/api/v4/spot/price_orders".into(),
116 params,
117 payload: "".to_string(),
118 x_gate_exp_time: None,
119 credentials: request.credentials,
120 sign: true,
121 }
122 }
123}