Skip to content

Commit

Permalink
expose trait funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
Flemmli97 committed Dec 20, 2024
1 parent 9f8e7e2 commit 58b5c3a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions warp/src/constellation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ pub type ConstellationProgressStream = BoxStream<'static, Progression>;

/// Interface that would provide functionality around the filesystem.
#[async_trait::async_trait]
#[impl_funcs(name = "constellation_impls")]
pub trait Constellation: ConstellationEvent + Extension + Sync + Send + SingleHandle {
/// Provides the timestamp of when the file system was modified
fn modified(&self) -> DateTime<Utc>;
Expand Down
6 changes: 6 additions & 0 deletions warp/src/multipass/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ pub enum IdentityImportOption<'a> {
pub type MultiPassEventStream = BoxStream<'static, MultiPassEventKind>;

#[async_trait::async_trait]
#[impl_funcs(name = "multipass_impls")]
pub trait MultiPass:
Extension
+ IdentityInformation
Expand All @@ -92,6 +93,7 @@ pub trait MultiPass:
}

#[async_trait::async_trait]
#[impl_funcs(name = "multipass_local_id_impls")]
pub trait LocalIdentity: Sync + Send {
/// Reference to the local [`Identity`]
async fn identity(&self) -> Result<Identity, Error>;
Expand All @@ -109,6 +111,7 @@ pub trait LocalIdentity: Sync + Send {
}

#[async_trait::async_trait]
#[impl_funcs(name = "multipass_im_export_impls")]
pub trait MultiPassImportExport: Sync + Send {
/// Import identity from a specific location
async fn import_identity<'a>(
Expand All @@ -125,6 +128,7 @@ pub trait MultiPassImportExport: Sync + Send {
}

#[async_trait::async_trait]
#[impl_funcs(name = "multipass_friends_impls")]
pub trait Friends: Sync + Send {
/// Send friend request to corresponding public key
async fn send_request(&mut self, _: &DID) -> Result<(), Error> {
Expand Down Expand Up @@ -203,6 +207,7 @@ pub trait Friends: Sync + Send {
}

#[async_trait::async_trait]
#[impl_funcs(name = "multipass_event_impls")]
pub trait MultiPassEvent: Sync + Send {
/// Subscribe to an stream of events
async fn multipass_subscribe(&mut self) -> Result<MultiPassEventStream, Error> {
Expand All @@ -211,6 +216,7 @@ pub trait MultiPassEvent: Sync + Send {
}

#[async_trait::async_trait]
#[impl_funcs(name = "multipass_identity_impls")]
pub trait IdentityInformation: Send + Sync {
/// Profile picture belonging to the `Identity`
async fn identity_picture(&self, _: &DID) -> Result<IdentityImage, Error> {
Expand Down
3 changes: 3 additions & 0 deletions warp/src/raygun/group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ impl GroupInvitation {
}

// General/Base GroupChat Trait
#[impl_funcs(name = "raygun_group_chat_impls")]
pub trait GroupChat: GroupInvite + GroupChatManagement {
/// Join a existing group
fn join_group(&mut self, _: Uuid) -> Result<(), Error> {
Expand All @@ -172,6 +173,7 @@ pub trait GroupChat: GroupInvite + GroupChatManagement {
}

// Group Invite Management Trait
#[impl_funcs(name = "raygun_group_invite_impls")]
pub trait GroupInvite {
/// Sends a invite to join a group
fn send_invite(&mut self, _: Uuid, _: DID) -> Result<(), Error> {
Expand All @@ -195,6 +197,7 @@ pub trait GroupInvite {
}

// Group Admin Management Trait
#[impl_funcs(name = "raygun_group_management_impls")]
pub trait GroupChatManagement {
/// Create a group
fn create_group(&mut self, _: &str) -> Result<Group, Error> {
Expand Down
5 changes: 5 additions & 0 deletions warp/src/raygun/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1400,6 +1400,7 @@ impl PartialEq for Location {
impl Eq for Location {}

#[async_trait::async_trait]
#[impl_funcs(name = "raygun_impls")]
pub trait RayGun:
RayGunStream
+ RayGunGroupConversation
Expand Down Expand Up @@ -1587,6 +1588,7 @@ pub trait RayGunGroupConversation: Sync + Send {
}

#[async_trait::async_trait]
#[impl_funcs(name = "raygun_attachment_impls")]
pub trait RayGunAttachment: Sync + Send {
/// Send files to a conversation.
/// If no files is provided in the array, it will throw an error
Expand Down Expand Up @@ -1625,6 +1627,7 @@ pub trait RayGunAttachment: Sync + Send {
}

#[async_trait::async_trait]
#[impl_funcs(name = "raygun_stream_impls")]
pub trait RayGunStream: Sync + Send {
/// Subscribe to an stream of events from the conversation
async fn get_conversation_stream(&mut self, _: Uuid) -> Result<MessageEventStream, Error> {
Expand All @@ -1638,6 +1641,7 @@ pub trait RayGunStream: Sync + Send {
}

#[async_trait::async_trait]
#[impl_funcs(name = "raygun_events_impls")]
pub trait RayGunEvents: Sync + Send {
/// Send an event to a conversation
async fn send_event(&mut self, _: Uuid, _: MessageEvent) -> Result<(), Error> {
Expand All @@ -1651,6 +1655,7 @@ pub trait RayGunEvents: Sync + Send {
}

#[async_trait::async_trait]
#[impl_funcs(name = "raygun_conversations_impls")]
pub trait RayGunConversationInformation: Sync + Send {
/// Set a description to a conversation
async fn set_conversation_description(
Expand Down

0 comments on commit 58b5c3a

Please sign in to comment.