Skip to main content

UserProvider

Trait UserProvider 

Source
pub trait UserProvider: Send + Sync {
    // Required method
    fn provider_name(&self) -> &'static str;

    // Provided methods
    fn get_user_profile<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _user_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<User>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn lookup_user_by_email<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _email: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<User>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

Provider for working with user profiles across issue trackers and messengers (issue #177).

Existing providers expose users piecemeal: IssueProvider::get_users returns a paginated list scoped to an issue tracker, MessengerProvider resolves user IDs inside a chat. This trait standardises the “fetch a User by stable id / email” surface so cross-provider lookups (e.g. when a meeting participant mentioned by email needs to be matched to a Slack handle) have a single contract.

Default methods return Error::ProviderUnsupported so providers only implement what they actually support.

Required Methods§

Source

fn provider_name(&self) -> &'static str

Provider name for logging / error reporting.

Provided Methods§

Source

fn get_user_profile<'life0, 'life1, 'async_trait>( &'life0 self, _user_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<User>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Resolve a user by their provider-native id (Slack U0123, Jira accountId / name, ClickUp user id, etc.).

Source

fn lookup_user_by_email<'life0, 'life1, 'async_trait>( &'life0 self, _email: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<User>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Look up a user by email. Returns None if the provider can issue the query but there is no match, Error::ProviderUnsupported when the provider simply doesn’t expose an email lookup.

Implementors§