41 lines
1.2 KiB
Rust
41 lines
1.2 KiB
Rust
use crate as git;
|
|
use git_next_config as config;
|
|
|
|
#[async_trait::async_trait]
|
|
pub trait ForgeLike {
|
|
fn name(&self) -> String;
|
|
|
|
/// Checks that the message has a valid authorisation
|
|
fn is_message_authorised(
|
|
&self,
|
|
message: &config::WebhookMessage,
|
|
expected: &config::WebhookAuth,
|
|
) -> bool;
|
|
|
|
/// Parses the webhook body into Some(Push) struct if appropriate, or None if not.
|
|
fn parse_webhook_body(
|
|
&self,
|
|
body: &config::webhook::message::Body,
|
|
) -> git::forge::webhook::Result<config::webhook::push::Push>;
|
|
|
|
/// Checks the results of any (e.g. CI) status checks for the commit.
|
|
async fn commit_status(&self, commit: &git::Commit) -> git::forge::commit::Status;
|
|
|
|
// Lists all the webhooks
|
|
async fn list_webhooks(
|
|
&self,
|
|
url: &config::server::WebhookUrl,
|
|
) -> git::forge::webhook::Result<Vec<config::WebhookId>>;
|
|
|
|
// Unregisters a webhook
|
|
async fn unregister_webhook(
|
|
&self,
|
|
webhook: &config::WebhookId,
|
|
) -> git::forge::webhook::Result<()>;
|
|
|
|
// Registers a webhook
|
|
async fn register_webhook(
|
|
&self,
|
|
webhook_url: &config::server::WebhookUrl,
|
|
) -> git::forge::webhook::Result<config::RegisteredWebhook>;
|
|
}
|