dceapi_rs/services/
common.rs1use crate::error::Result;
4use crate::http::{BaseClient, RequestOptions};
5use crate::models::{TradeDate, Variety};
6
7const PATH_GET_CURR_TRADE_DATE: &str = "/dceapi/forward/publicweb/maxTradeDate";
9
10const PATH_GET_VARIETY_LIST: &str = "/dceapi/forward/publicweb/variety";
12
13#[derive(Debug, Clone)]
15pub struct CommonService {
16 client: BaseClient,
17}
18
19impl CommonService {
20 pub fn new(client: BaseClient) -> Self {
22 CommonService { client }
23 }
24
25 pub async fn get_curr_trade_date(&self, opts: Option<RequestOptions>) -> Result<TradeDate> {
30 self.client.do_get(PATH_GET_CURR_TRADE_DATE, opts).await
31 }
32
33 pub async fn get_variety_list(&self, opts: Option<RequestOptions>) -> Result<Vec<Variety>> {
38 self.client.do_get(PATH_GET_VARIETY_LIST, opts).await
39 }
40}