pub mod appks; pub mod core; pub mod email; pub mod im; pub mod repo; use serde::{Deserialize, Serialize}; use tonic::transport::{Channel, Endpoint}; #[derive(Clone, PartialEq, Eq, Hash, prost::Message, Serialize, Deserialize, utoipa::ToSchema)] pub struct Timestamp { #[prost(int64, tag = "1")] pub seconds: i64, #[prost(int32, tag = "2")] pub nanos: i32, } impl From for Timestamp { fn from(t: prost_types::Timestamp) -> Self { Self { seconds: t.seconds, nanos: t.nanos, } } } impl From for prost_types::Timestamp { fn from(t: Timestamp) -> Self { Self { seconds: t.seconds, nanos: t.nanos, } } } #[derive(Clone)] pub struct RepoClient { pub repository: repo::repository_service_client::RepositoryServiceClient, pub commit: repo::commit_service_client::CommitServiceClient, pub branch: repo::branch_service_client::BranchServiceClient, pub tag: repo::tag_service_client::TagServiceClient, pub tree: repo::tree_service_client::TreeServiceClient, pub diff: repo::diff_service_client::DiffServiceClient, pub merge: repo::merge_service_client::MergeServiceClient, pub blame: repo::blame_service_client::BlameServiceClient, pub archive: repo::archive_service_client::ArchiveServiceClient, pub pack: repo::pack_service_client::PackServiceClient, pub ref_: repo::ref_service_client::RefServiceClient, pub remote: repo::remote_service_client::RemoteServiceClient, } impl RepoClient { pub async fn connect(addr: impl Into) -> Result> { let channel = Endpoint::from_shared(addr.into())?.connect().await?; Ok(Self::new(channel)) } pub fn lazy_connect(addr: impl Into) -> Result> { let channel = Endpoint::from_shared(addr.into())?.connect_lazy(); Ok(Self::new(channel)) } pub fn new(channel: Channel) -> Self { Self { repository: repo::repository_service_client::RepositoryServiceClient::new( channel.clone(), ), commit: repo::commit_service_client::CommitServiceClient::new(channel.clone()), branch: repo::branch_service_client::BranchServiceClient::new(channel.clone()), tag: repo::tag_service_client::TagServiceClient::new(channel.clone()), tree: repo::tree_service_client::TreeServiceClient::new(channel.clone()), diff: repo::diff_service_client::DiffServiceClient::new(channel.clone()), merge: repo::merge_service_client::MergeServiceClient::new(channel.clone()), blame: repo::blame_service_client::BlameServiceClient::new(channel.clone()), archive: repo::archive_service_client::ArchiveServiceClient::new(channel.clone()), pack: repo::pack_service_client::PackServiceClient::new(channel.clone()), ref_: repo::ref_service_client::RefServiceClient::new(channel.clone()), remote: repo::remote_service_client::RemoteServiceClient::new(channel), } } } #[derive(Clone)] pub struct EmailClient { inner: email::email_service_client::EmailServiceClient, } impl EmailClient { pub async fn connect(addr: impl Into) -> Result> { let channel = Endpoint::from_shared(addr.into())?.connect().await?; Ok(Self::new(channel)) } pub fn lazy_connect(addr: impl Into) -> Result> { let channel = Endpoint::from_shared(addr.into())?.connect_lazy(); Ok(Self::new(channel)) } pub fn new(channel: Channel) -> Self { Self { inner: email::email_service_client::EmailServiceClient::new(channel), } } } impl std::ops::Deref for EmailClient { type Target = email::email_service_client::EmailServiceClient; fn deref(&self) -> &Self::Target { &self.inner } } impl std::ops::DerefMut for EmailClient { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.inner } } // Section: Appks gRPC server traits // // Core services (package appks.core.v1) live in pb::core:: // - TokenService (JWT issue/refresh/revoke/verify, signing key distribution) // // App services (package appks.v1) live in pb::appks:: // - RepoService // // IM services (package appks.im.v1) live in pb::im:: // - ChannelService, MemberService, PermissionService // - ChannelRoleService, ChannelInvitationService, ChannelWebhookService // - ChannelSlashCommandService, ChannelRepoLinkService, ImIntegrationService // - CustomEmojiService, ForumTagService, VoiceService, StageService // - ChannelAuditService // // Implementations are in grpc/ and wired into the tonic server in grpc/mod.rs.