Started working on attachment store
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
pub use crate::model::{Conversation, ConversationID, Message, MessageID, OutgoingMessage};
|
||||
|
||||
use async_trait::async_trait;
|
||||
pub use crate::model::{
|
||||
Conversation, Message, ConversationID, MessageID, OutgoingMessage,
|
||||
};
|
||||
use bytes::Bytes;
|
||||
use futures_util::Stream;
|
||||
|
||||
pub mod auth;
|
||||
pub use crate::api::auth::{AuthenticationStore, InMemoryAuthenticationStore};
|
||||
@@ -15,21 +16,23 @@ pub mod event_socket;
|
||||
pub use event_socket::EventSocket;
|
||||
|
||||
use self::http_client::Credentials;
|
||||
use std::fmt::Debug;
|
||||
use core::error::Error as StdError;
|
||||
use std::{fmt::Debug, io::BufRead};
|
||||
|
||||
#[async_trait]
|
||||
pub trait APIInterface {
|
||||
type Error: Debug;
|
||||
type ResponseStream: Stream<Item = Result<Bytes, Self::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,
|
||||
&mut self,
|
||||
conversation_id: &ConversationID,
|
||||
limit: Option<u32>,
|
||||
before: Option<MessageID>,
|
||||
@@ -38,13 +41,22 @@ pub trait APIInterface {
|
||||
|
||||
// (POST) /sendMessage
|
||||
async fn send_message(
|
||||
&mut self,
|
||||
&mut self,
|
||||
outgoing_message: &OutgoingMessage,
|
||||
) -> Result<Message, Self::Error>;
|
||||
|
||||
// (GET) /attachment
|
||||
async fn fetch_attachment_data(
|
||||
&mut self,
|
||||
guid: &String,
|
||||
) -> Result<Self::ResponseStream, Self::Error>;
|
||||
|
||||
// (POST) /authenticate
|
||||
async fn authenticate(&mut self, credentials: Credentials) -> Result<JwtToken, Self::Error>;
|
||||
|
||||
// (WS) /updates
|
||||
async fn open_event_socket(&mut self, update_seq: Option<u64>) -> Result<impl EventSocket, Self::Error>;
|
||||
async fn open_event_socket(
|
||||
&mut self,
|
||||
update_seq: Option<u64>,
|
||||
) -> Result<impl EventSocket, Self::Error>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user