2024-04-21 23:09:37 -07:00
|
|
|
use async_trait::async_trait;
|
|
|
|
|
|
2024-04-21 15:14:16 -07:00
|
|
|
pub use crate::APIInterface;
|
|
|
|
|
use crate::model::Conversation;
|
|
|
|
|
|
2024-04-21 23:09:37 -07:00
|
|
|
pub struct TestClient {
|
|
|
|
|
pub version: &'static str,
|
|
|
|
|
pub conversations: Vec<Conversation>,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
|
pub enum TestError {}
|
2024-04-21 15:14:16 -07:00
|
|
|
|
2024-04-21 23:09:37 -07:00
|
|
|
impl TestClient {
|
|
|
|
|
pub fn new() -> TestClient {
|
|
|
|
|
TestClient {
|
|
|
|
|
version: "KordophoneTest-1.0",
|
|
|
|
|
conversations: vec![],
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[async_trait]
|
2024-04-21 15:14:16 -07:00
|
|
|
impl APIInterface for TestClient {
|
2024-04-21 23:09:37 -07:00
|
|
|
type Error = TestError;
|
|
|
|
|
|
|
|
|
|
async fn get_version(&self) -> Result<String, Self::Error> {
|
|
|
|
|
Ok(self.version.to_string())
|
2024-04-21 15:14:16 -07:00
|
|
|
}
|
|
|
|
|
|
2024-04-21 23:09:37 -07:00
|
|
|
async fn get_conversations(&self) -> Result<Vec<Conversation>, Self::Error> {
|
|
|
|
|
Ok(self.conversations.clone())
|
2024-04-21 15:14:16 -07:00
|
|
|
}
|
|
|
|
|
}
|