Skip to main content

GotifyFacade

Trait GotifyFacade 

Source
pub(crate) trait GotifyFacade: Send + Sync {
    // Required methods
    fn subscribe<'life0, 'life1, 'async_trait>(
        &'life0 self,
        caller: &'life1 SessionSlot,
        applications: Vec<String>,
        min_priority: Option<u8>,
    ) -> Pin<Box<dyn Future<Output = Result<SubscribeOutcome, GotifySubscribeError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list(&self, caller: &SessionSlot) -> Vec<GotifySubscription>;
    fn unsubscribe(
        &self,
        caller: &SessionSlot,
        id: Uuid,
    ) -> Result<GotifySubscription, GotifyUnsubscribeError>;
    fn apps<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, GotifyReadError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn recent<'life0, 'async_trait>(
        &'life0 self,
        applications: Vec<String>,
        min_priority: Option<u8>,
        limit: usize,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<GotifyRecent>, GotifyReadError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

The Gotify tools’ view of the workspace. The subscription mutations are synchronous state writes; the read-only apps / recent lookups hit the server’s REST API and are async.

Required Methods§

Source

fn subscribe<'life0, 'life1, 'async_trait>( &'life0 self, caller: &'life1 SessionSlot, applications: Vec<String>, min_priority: Option<u8>, ) -> Pin<Box<dyn Future<Output = Result<SubscribeOutcome, GotifySubscribeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Subscribe the caller’s durable identity to the configured server, optionally filtered by application names and/or minimum priority. An empty applications matches any app. Persists when the identity is durable. Async because a filter that names applications refreshes the app index before returning.

Source

fn list(&self, caller: &SessionSlot) -> Vec<GotifySubscription>

The caller’s own subscriptions in its project - a lead’s, or one worker’s, never another owner’s.

Source

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

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: GotifyUnsubscribeError::NoSuchSubscription when the project has no such id, GotifyUnsubscribeError::NotOwnedByCaller when it has one under another owner.

Source

fn apps<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, GotifyReadError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

The application NAMEs on the configured server (GET /application) so a session can self-discover what it may subscribe to.

Source

fn recent<'life0, 'async_trait>( &'life0 self, applications: Vec<String>, min_priority: Option<u8>, limit: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<GotifyRecent>, GotifyReadError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

The most recent notifications, newest first, filtered by application NAME (empty = any) and min_priority (None = any), capped at limit. A catch-up read for a woken or live session.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§