29 lines
750 B
Rust
29 lines
750 B
Rust
use async_trait::async_trait;
|
|
pub use crate::model::{
|
|
Conversation, Message, ConversationID
|
|
};
|
|
use crate::model::JwtToken;
|
|
|
|
pub mod http_client;
|
|
pub use http_client::HTTPAPIClient;
|
|
|
|
use self::http_client::Credentials;
|
|
|
|
#[async_trait]
|
|
pub trait APIInterface {
|
|
type Error;
|
|
|
|
// (GET) /version
|
|
async fn get_version(&mut self) -> Result<String, Self::Error>;
|
|
|
|
// (GET) /conversations
|
|
async fn get_conversations(&mut self) -> Result<Vec<Conversation>, Self::Error>;
|
|
|
|
// (GET) /messages
|
|
async fn get_messages(&mut self, conversation_id: &ConversationID) -> Result<Vec<Message>, Self::Error>;
|
|
|
|
// (POST) /authenticate
|
|
async fn authenticate(&mut self, credentials: Credentials) -> Result<JwtToken, Self::Error>;
|
|
}
|
|
|