puniyu_adapter_api/
lib.rs1use std::any::Any;
17
18use async_trait::async_trait;
19use puniyu_account::AccountInfo;
20use puniyu_adapter_types::{AdapterInfo, SendMsgType};
21use puniyu_common::Response;
22use puniyu_contact::ContactType;
23use puniyu_error::Result;
24use puniyu_message::Message;
25
26#[async_trait]
27pub trait AdapterApi: Any + Send + Sync {
28 async fn send_message(
29 &self,
30 contact: &ContactType<'_>,
31 message: &Message,
32 ) -> Result<SendMsgType>;
33
34 fn adapter_info(&self) -> AdapterInfo;
35
36 fn account_info(&self) -> AccountInfo;
37
38 async fn call_api(
43 &self,
44 action: &str,
45 params: serde_json::Value,
46 ) -> Result<Response<serde_json::Value>>;
47}