1use crate::payload;
15use crate::proto::common::*;
16use crate::{client::Client, error::Error};
17
18impl Client {
19 pub async fn account_logout(
32 &self,
33 ctid_trader_account_id: i64,
34 ) -> Result<ProtoOaAccountLogoutRes, Error> {
35 let req = ProtoOaAccountLogoutReq {
36 payload_type: Some(payload::OA_ACCOUNT_LOGOUT_REQ as i32),
37 ctid_trader_account_id,
38 };
39 self.command(
40 payload::OA_ACCOUNT_LOGOUT_REQ,
41 req,
42 payload::OA_ACCOUNT_LOGOUT_RES,
43 )
44 .await
45 }
46
47 pub async fn get_accounts_by_access_token(
59 &self,
60 access_token: &str,
61 ) -> Result<ProtoOaGetAccountListByAccessTokenRes, Error> {
62 let req = ProtoOaGetAccountListByAccessTokenReq {
63 payload_type: Some(payload::OA_GET_ACCOUNTS_BY_ACCESS_TOKEN_REQ as i32),
64 access_token: access_token.to_string(),
65 };
66 self.command(
67 payload::OA_GET_ACCOUNTS_BY_ACCESS_TOKEN_REQ,
68 req,
69 payload::OA_GET_ACCOUNTS_BY_ACCESS_TOKEN_RES,
70 )
71 .await
72 }
73
74 pub async fn get_trader(&self, ctid_trader_account_id: i64) -> Result<ProtoOaTraderRes, Error> {
85 let req = ProtoOaTraderReq {
86 payload_type: Some(payload::OA_TRADER_REQ as i32),
87 ctid_trader_account_id,
88 };
89 self.command(payload::OA_TRADER_REQ, req, payload::OA_TRADER_RES)
90 .await
91 }
92}
93
94#[cfg(test)]
95mod tests {
96
97 #[async_std::test]
98 async fn test() {}
99}