Radish alpha
r
rad:z4D5UCArafTzTQpDZNQRuqswh3ury
Radicle desktop app
Radicle
Git
radicle-desktop crates radicle-types src domain inbox traits.rs
use radicle::identity;

use crate::domain::inbox::models::notification::{
    CountByRepo, ListNotificationsError, RepoGroupParams,
};

use super::models::notification::RepoGroup;

pub trait InboxStorage {
    fn counts_by_repo(
        &self,
    ) -> Result<
        impl Iterator<Item = Result<CountByRepo, ListNotificationsError>>,
        ListNotificationsError,
    >;

    fn notification_count(&self) -> Result<usize, ListNotificationsError>;

    fn repo_group(
        &self,
        params: RepoGroupParams,
    ) -> Result<Vec<(identity::RepoId, RepoGroup)>, ListNotificationsError>;
}

pub trait InboxService {
    /// Get the total notification count by repos.
    fn counts_by_repo(
        &self,
    ) -> Result<
        impl Iterator<Item = Result<CountByRepo, ListNotificationsError>>,
        ListNotificationsError,
    >;

    /// Get the total notification count.
    fn notification_count(&self) -> Result<usize, ListNotificationsError>;

    fn repo_group(
        &self,
        params: RepoGroupParams,
    ) -> Result<Vec<(identity::RepoId, RepoGroup)>, ListNotificationsError>;
}