Skip to main content

SlackFacade

Trait SlackFacade 

Source
pub(crate) trait SlackFacade: Send + Sync {
Show 17 methods // Required methods fn conversations<'life0, 'life1, 'async_trait>( &'life0 self, caller: &'life1 SessionSlot, ) -> Pin<Box<dyn Future<Output = Result<(String, Vec<SlackConversation>), SlackReadError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn subscribed_targets( &self, caller: &SessionSlot, label: &str, ) -> Vec<SlackSubscription>; fn post<'life0, 'life1, 'async_trait>( &'life0 self, caller: &'life1 SessionSlot, request: SlackPostRequest, ) -> Pin<Box<dyn Future<Output = Result<SlackPostOutcome, SlackPostError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn edit<'life0, 'life1, 'async_trait>( &'life0 self, caller: &'life1 SessionSlot, request: SlackEditRequest, ) -> Pin<Box<dyn Future<Output = Result<(), SlackEditError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn react<'life0, 'life1, 'async_trait>( &'life0 self, caller: &'life1 SessionSlot, request: SlackReactRequest, ) -> Pin<Box<dyn Future<Output = Result<(), SlackReactError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn fetch_attachment<'life0, 'life1, 'async_trait>( &'life0 self, caller: &'life1 SessionSlot, request: SlackFetchRequest, ) -> Pin<Box<dyn Future<Output = Result<PathBuf, SlackAttachmentError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn post_attachment<'life0, 'life1, 'async_trait>( &'life0 self, caller: &'life1 SessionSlot, request: SlackUploadRequest, ) -> Pin<Box<dyn Future<Output = Result<(), SlackAttachmentError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn search<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, caller: &'life1 SessionSlot, query: &'life2 str, count: u32, conversation: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<(String, Vec<SlackSearchMatch>), SlackReadError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait; fn history<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, caller: &'life1 SessionSlot, conversation: &'life2 str, limit: u32, oldest: Option<&'life3 str>, newest: Option<&'life4 str>, ) -> Pin<Box<dyn Future<Output = Result<(String, Vec<SlackHistoryMessage>), SlackReadError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait; fn replies<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, caller: &'life1 SessionSlot, conversation: &'life2 str, ts: &'life3 str, limit: u32, ) -> Pin<Box<dyn Future<Output = Result<(String, Vec<SlackHistoryMessage>), SlackReadError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait; fn user<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, caller: &'life1 SessionSlot, user: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(String, SlackUser), SlackReadError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn users<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, caller: &'life1 SessionSlot, query: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(String, Vec<SlackUser>), SlackReadError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn me<'life0, 'life1, 'async_trait>( &'life0 self, caller: &'life1 SessionSlot, ) -> Pin<Box<dyn Future<Output = Result<(String, AuthTest), SlackReadError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn pins<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, caller: &'life1 SessionSlot, conversation: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(String, Vec<SlackPin>), SlackReadError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn bookmarks<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, caller: &'life1 SessionSlot, conversation: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(String, Vec<SlackBookmark>), SlackReadError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn subscribe( &self, caller: &SessionSlot, request: SlackSubscribeRequest, ) -> Result<Vec<SlackSubscription>, SlackSubscribeError>; fn unsubscribe( &self, caller: &SessionSlot, id: Uuid, ) -> Result<SlackSubscription, SlackUnsubscribeError>;
}
Expand description

The Slack tools’ view of the workspace.

Required Methods§

Source

fn conversations<'life0, 'life1, 'async_trait>( &'life0 self, caller: &'life1 SessionSlot, ) -> Pin<Box<dyn Future<Output = Result<(String, Vec<SlackConversation>), SlackReadError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Every conversation the caller’s workspace token is in, with the label it came from - the one resolution the tool’s result names, so a reload between calls cannot report a different workspace than the data was read from.

Source

fn subscribed_targets( &self, caller: &SessionSlot, label: &str, ) -> Vec<SlackSubscription>

The caller’s OWN subscriptions in label - a lead’s the lead’s, a worker’s its own, never another owner’s. slack__list passes the label its read resolved, so the mark and the rows cannot disagree about which workspace they are in. After a restart these ids are the only handle a session has to unsubscribe with.

Source

fn post<'life0, 'life1, 'async_trait>( &'life0 self, caller: &'life1 SessionSlot, request: SlackPostRequest, ) -> Pin<Box<dyn Future<Output = Result<SlackPostOutcome, SlackPostError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Post a message, held for the user’s decision first. Returns only once that decision is in, and nothing is sent unless it was an approval - a rejected or unanswered draft is Rejected.

Source

fn edit<'life0, 'life1, 'async_trait>( &'life0 self, caller: &'life1 SessionSlot, request: SlackEditRequest, ) -> Pin<Box<dyn Future<Output = Result<(), SlackEditError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Replace the body of one of the user’s own messages, or delete it when text is None.

Both arms are gated exactly as slack__post is. A replacement puts new words in front of people as the user, which is the same act a post is; a deletion changes what they see on a message attributed to him and, unlike a bad edit, cannot be fixed by editing again. Either way the call waits for the decision and fails closed on a rejected or unanswered draft.

Source

fn react<'life0, 'life1, 'async_trait>( &'life0 self, caller: &'life1 SessionSlot, request: SlackReactRequest, ) -> Pin<Box<dyn Future<Output = Result<(), SlackReactError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Add or remove one reaction, held for the user’s decision first - a reaction is authored content in the user’s name.

Source

fn fetch_attachment<'life0, 'life1, 'async_trait>( &'life0 self, caller: &'life1 SessionSlot, request: SlackFetchRequest, ) -> Pin<Box<dyn Future<Output = Result<PathBuf, SlackAttachmentError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetch one Slack file to request.dir and return where it landed. Not gated: reading a file is not posting one, and the name is sanitised so it cannot escape the directory.

Source

fn post_attachment<'life0, 'life1, 'async_trait>( &'life0 self, caller: &'life1 SessionSlot, request: SlackUploadRequest, ) -> Pin<Box<dyn Future<Output = Result<(), SlackAttachmentError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Upload a local file into a conversation, held for the user’s decision first - an upload posts new content, so it is a first send and belongs behind the same gate as slack__post.

Source

fn search<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, caller: &'life1 SessionSlot, query: &'life2 str, count: u32, conversation: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<(String, Vec<SlackSearchMatch>), SlackReadError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

search.messages in a workspace, always timestamp-ordered. It matches text; it cannot find every message that mentions a user. conversation keeps only hits from that conversation id.

Source

fn history<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, caller: &'life1 SessionSlot, conversation: &'life2 str, limit: u32, oldest: Option<&'life3 str>, newest: Option<&'life4 str>, ) -> Pin<Box<dyn Future<Output = Result<(String, Vec<SlackHistoryMessage>), SlackReadError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

One page of a conversation’s messages. oldest and newest are exclusive bounds, so a caller pages backwards by feeding the earliest ts it saw back as newest.

Source

fn replies<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, caller: &'life1 SessionSlot, conversation: &'life2 str, ts: &'life3 str, limit: u32, ) -> Pin<Box<dyn Future<Output = Result<(String, Vec<SlackHistoryMessage>), SlackReadError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Every reply in one thread, the parent first, up to limit rows.

Source

fn user<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, caller: &'life1 SessionSlot, user: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(String, SlackUser), SlackReadError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

users.info for one user id.

Source

fn users<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, caller: &'life1 SessionSlot, query: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(String, Vec<SlackUser>), SlackReadError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Every member whose handle, real name or display name contains query, case-insensitively. Every match is returned: silently picking one of several is how a mention reaches the wrong person. Deactivated members are excluded.

Source

fn me<'life0, 'life1, 'async_trait>( &'life0 self, caller: &'life1 SessionSlot, ) -> Pin<Box<dyn Future<Output = Result<(String, AuthTest), SlackReadError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

auth.test: the resolved [[slack]] label and the identity the workspace’s token acts as. The label is returned alongside because it can differ from the team’s name (Subspace is team Autonomys).

Source

fn pins<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, caller: &'life1 SessionSlot, conversation: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(String, Vec<SlackPin>), SlackReadError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

pins.list for one conversation.

Source

fn bookmarks<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, caller: &'life1 SessionSlot, conversation: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(String, Vec<SlackBookmark>), SlackReadError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

bookmarks.list for one conversation.

Source

fn subscribe( &self, caller: &SessionSlot, request: SlackSubscribeRequest, ) -> Result<Vec<SlackSubscription>, SlackSubscribeError>

Record what the caller wants to watch in its project’s workspace, one record per target. Returns the records as they now stand, so a caller can name what it created.

Source

fn unsubscribe( &self, caller: &SessionSlot, id: Uuid, ) -> Result<SlackSubscription, SlackUnsubscribeError>

Remove one of the caller’s OWN subscriptions by id within its project, returning the row as it stood. A refusal says which case it is: SlackUnsubscribeError::NoSuchSubscription when the project has no such id, SlackUnsubscribeError::NotOwnedByCaller when it has one under another owner.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§