pub use crate::model::{Conversation, ConversationID, Message, MessageID, OutgoingMessage}; use async_trait::async_trait; use bytes::Bytes; use futures_util::Stream; pub mod auth; pub use crate::api::auth::{AuthenticationStore, InMemoryAuthenticationStore}; use crate::model::JwtToken; pub mod http_client; pub use http_client::HTTPAPIClient; pub mod event_socket; pub use event_socket::EventSocket; use self::http_client::Credentials; use core::error::Error as StdError; use std::{fmt::Debug, io::BufRead}; #[async_trait] pub trait APIInterface { type Error: Debug; type ResponseStream: Stream>; // (GET) /version async fn get_version(&mut self) -> Result; // (GET) /conversations async fn get_conversations(&mut self) -> Result, Self::Error>; // (GET) /messages async fn get_messages( &mut self, conversation_id: &ConversationID, limit: Option, before: Option, after: Option, ) -> Result, Self::Error>; // (POST) /sendMessage async fn send_message( &mut self, outgoing_message: &OutgoingMessage, ) -> Result; // (GET) /attachment async fn fetch_attachment_data( &mut self, guid: &String, preview: bool, ) -> Result; // (POST) /authenticate async fn authenticate(&mut self, credentials: Credentials) -> Result; // (WS) /updates async fn open_event_socket( &mut self, update_seq: Option, ) -> Result; }