use crate::{
git, server::RepoListenUrl, webhook, ForgeNotification, RegisteredWebhook, WebhookAuth,
WebhookId,
};
#[mockall::automock]
#[async_trait::async_trait]
pub trait ForgeLike: std::fmt::Debug + Send + Sync {
fn duplicate(&self) -> Box<dyn ForgeLike>;
fn name(&self) -> String;
fn is_message_authorised(&self, message: &ForgeNotification, expected: &WebhookAuth) -> bool;
#[allow(unused_variables)]
fn should_ignore_message(&self, message: &ForgeNotification) -> bool {
false
}
fn parse_webhook_body(
&self,
body: &webhook::forge_notification::Body,
) -> git::forge::webhook::Result<webhook::push::Push>;
async fn commit_status(&self, commit: &git::Commit) -> git::forge::commit::Status;
async fn list_webhooks(
&self,
repo_listen_url: &RepoListenUrl,
) -> git::forge::webhook::Result<Vec<WebhookId>>;
async fn unregister_webhook(&self, webhook: &WebhookId) -> git::forge::webhook::Result<()>;
async fn register_webhook(
&self,
repo_listen_url: &RepoListenUrl,
) -> git::forge::webhook::Result<RegisteredWebhook>;
}