Private
Public Access
1
0

Retry auth automatically, remove tower dep

This commit is contained in:
2024-06-14 20:23:44 -07:00
parent 0dde0b9c53
commit cabd3b502a
8 changed files with 413 additions and 778 deletions

View File

@@ -1,7 +1,7 @@
use async_trait::async_trait;
pub use crate::APIInterface;
use crate::model::Conversation;
use crate::{api::http_client::Credentials, model::{Conversation, JwtToken}};
pub struct TestClient {
pub version: &'static str,
@@ -24,11 +24,15 @@ impl TestClient {
impl APIInterface for TestClient {
type Error = TestError;
async fn get_version(&self) -> Result<String, Self::Error> {
async fn authenticate(&mut self, credentials: Credentials) -> Result<JwtToken, Self::Error> {
Ok(JwtToken::dummy())
}
async fn get_version(&mut self) -> Result<String, Self::Error> {
Ok(self.version.to_string())
}
async fn get_conversations(&self) -> Result<Vec<Conversation>, Self::Error> {
async fn get_conversations(&mut self) -> Result<Vec<Conversation>, Self::Error> {
Ok(self.conversations.clone())
}
}