pub mod git; pub mod github; pub mod user; use async_trait::async_trait; use std::error::Error; use crate::{ messages::{ repository::{ CreateRepositoryRequest, CreateRepositoryResponse, RepositoryFileInspectRequest, RepositoryFileInspectionResponse, RepositoryInfoRequest, RepositoryIssueLabelsRequest, RepositoryIssueLabelsResponse, RepositoryIssuesCountRequest, RepositoryIssuesCountResponse, RepositoryIssuesRequest, RepositoryIssuesResponse, }, user::{ UserBioRequest, UserBioResponse, UserDisplayImageRequest, UserDisplayImageResponse, UserDisplayNameRequest, UserDisplayNameResponse, }, ValidatedUserAuthenticated, }, model::repository::RepositoryView, }; #[async_trait] pub trait RepositoryBackend: IssuesBackend { async fn create_repository( &mut self, request: &ValidatedUserAuthenticated, ) -> Result>; async fn repository_info( &mut self, request: &ValidatedUserAuthenticated, ) -> Result>; fn repository_file_inspect( &mut self, request: &ValidatedUserAuthenticated, ) -> Result>; } pub trait IssuesBackend { fn issues_count( &mut self, request: &ValidatedUserAuthenticated, ) -> Result>; fn issue_labels( &mut self, request: &ValidatedUserAuthenticated, ) -> Result>; fn issues( &mut self, request: &ValidatedUserAuthenticated, ) -> Result>; } #[async_trait::async_trait] pub trait AuthBackend { async fn register(&mut self, request: ()) -> Result<(), Box>; async fn login(&mut self, request: ()) -> Result<(), Box>; } #[async_trait::async_trait] pub trait UserBackend: AuthBackend { async fn display_name( &mut self, request: UserDisplayNameRequest, ) -> Result>; async fn display_image( &mut self, request: UserDisplayImageRequest, ) -> Result>; async fn bio( &mut self, request: UserBioRequest, ) -> Result>; }