use async_trait::async_trait; pub use crate::APIInterface; use crate::{api::http_client::Credentials, model::{Conversation, JwtToken}}; pub struct TestClient { pub version: &'static str, pub conversations: Vec, } #[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 authenticate(&mut self, credentials: Credentials) -> Result { Ok(JwtToken::dummy()) } async fn get_version(&mut self) -> Result { Ok(self.version.to_string()) } async fn get_conversations(&mut self) -> Result, Self::Error> { Ok(self.conversations.clone()) } }