Private
Public Access
1
0
Files
Kordophone/kordophone/src/tests/test_client.rs
2024-04-21 23:09:37 -07:00

35 lines
719 B
Rust

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