mod detection;
mod factory;
mod github;
mod gitlab;
pub use detection::{detect_platform, parse_repo_info};
pub use factory::create_platform_service;
pub use github::GitHubService;
pub use gitlab::GitLabService;
use crate::error::Result;
use crate::types::{PlatformConfig, PrComment, PullRequest};
use async_trait::async_trait;
#[async_trait]
pub trait PlatformService: Send + Sync {
async fn find_existing_pr(&self, head_branch: &str) -> Result<Option<PullRequest>>;
async fn create_pr(&self, head: &str, base: &str, title: &str) -> Result<PullRequest> {
self.create_pr_with_options(head, base, title, false).await
}
async fn create_pr_with_options(
&self,
head: &str,
base: &str,
title: &str,
draft: bool,
) -> Result<PullRequest>;
async fn update_pr_base(&self, pr_number: u64, new_base: &str) -> Result<PullRequest>;
async fn publish_pr(&self, pr_number: u64) -> Result<PullRequest>;
async fn list_pr_comments(&self, pr_number: u64) -> Result<Vec<PrComment>>;
async fn create_pr_comment(&self, pr_number: u64, body: &str) -> Result<()>;
async fn update_pr_comment(&self, pr_number: u64, comment_id: u64, body: &str) -> Result<()>;
fn config(&self) -> &PlatformConfig;
}