use crate::error::Result;
use crate::http::{BaseClient, RequestOptions};
use crate::models::{TradeDate, Variety};
const PATH_GET_CURR_TRADE_DATE: &str = "/dceapi/forward/publicweb/maxTradeDate";
const PATH_GET_VARIETY_LIST: &str = "/dceapi/forward/publicweb/variety";
#[derive(Debug, Clone)]
pub struct CommonService {
client: BaseClient,
}
impl CommonService {
pub fn new(client: BaseClient) -> Self {
CommonService { client }
}
pub async fn get_curr_trade_date(&self, opts: Option<RequestOptions>) -> Result<TradeDate> {
self.client.do_get(PATH_GET_CURR_TRADE_DATE, opts).await
}
pub async fn get_variety_list(&self, opts: Option<RequestOptions>) -> Result<Vec<Variety>> {
self.client.do_get(PATH_GET_VARIETY_LIST, opts).await
}
}