1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use super::*;

#[serde_as]
#[derive(TypedBuilder, Serialize, Debug)]
pub struct Params {
    #[serde_as(as = "DisplayFromStr")]
    pair: Pair,
    order_ids: Vec<u64>,
}

pub use super::fetch_order::OrderInfo;

#[derive(Deserialize)]
struct Response {
    orders: Vec<OrderInfo>,
}

pub async fn post(cred: Credential, params: Params) -> anyhow::Result<Vec<OrderInfo>> {
    let json = serde_json::to_string(&params)?;
    let resp: Response = ApiExec { cred }
        .post("/v1/user/spot/order_info", json)
        .await?;
    Ok(resp.orders)
}