gateio_rs/api/spot/
get_order.rs1use crate::http::{Credentials, Method, request::Request};
2
3pub struct GetOrder {
5 pub order_id: String,
7 pub currency_pair: String,
9 pub account: Option<String>,
11 pub credentials: Option<Credentials>,
13}
14
15impl GetOrder {
16 pub fn new(order_id: &str, currency_pair: &str) -> Self {
18 Self {
19 order_id: order_id.into(),
20 currency_pair: currency_pair.into(),
21 account: None,
22 credentials: None,
23 }
24 }
25
26 pub fn account(mut self, account: &str) -> Self {
28 self.account = Some(account.into());
29 self
30 }
31
32 pub fn credentials(mut self, creds: Credentials) -> Self {
34 self.credentials = Some(creds);
35 self
36 }
37}
38
39impl From<GetOrder> for Request {
40 fn from(request: GetOrder) -> Request {
41 let mut params = Vec::new();
42
43 params.push(("currency_pair".into(), request.currency_pair));
44
45 if let Some(account) = request.account {
46 params.push(("account".into(), account));
47 }
48
49 Request {
50 method: Method::Get,
51 path: format!("/api/v4/spot/orders/{}", request.order_id),
52 params,
53 payload: "".to_string(),
54 x_gate_exp_time: None,
55 credentials: request.credentials,
56 sign: true,
57 }
58 }
59}