Trait ForgeLike

Source
pub trait ForgeLike:
    Debug
    + Send
    + Sync {
    // Required methods
    fn duplicate(&self) -> Box<dyn ForgeLike>;
    fn name(&self) -> String;
    fn is_message_authorised(
        &self,
        message: &ForgeNotification,
        expected: &WebhookAuth,
    ) -> bool;
    fn parse_webhook_body(&self, body: &Body) -> Result<Push>;
    fn commit_status<'life0, 'life1, 'async_trait>(
        &'life0 self,
        commit: &'life1 Commit,
    ) -> Pin<Box<dyn Future<Output = Result<Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list_webhooks<'life0, 'life1, 'async_trait>(
        &'life0 self,
        repo_listen_url: &'life1 RepoListenUrl,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<WebhookId>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn unregister_webhook<'life0, 'life1, 'async_trait>(
        &'life0 self,
        webhook: &'life1 WebhookId,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn register_webhook<'life0, 'life1, 'async_trait>(
        &'life0 self,
        repo_listen_url: &'life1 RepoListenUrl,
    ) -> Pin<Box<dyn Future<Output = Result<RegisteredWebhook>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn should_ignore_message(&self, message: &ForgeNotification) -> bool { ... }
}

Required Methods§

Source

fn duplicate(&self) -> Box<dyn ForgeLike>

Source

fn name(&self) -> String

Source

fn is_message_authorised( &self, message: &ForgeNotification, expected: &WebhookAuth, ) -> bool

Checks that the message has a valid authorisation.

Source

fn parse_webhook_body(&self, body: &Body) -> Result<Push>

Parses the webhook body into Some(Push) struct if appropriate, or None if not.

§Errors

Will return an Err if the body is not a message in the expected format.

Source

fn commit_status<'life0, 'life1, 'async_trait>( &'life0 self, commit: &'life1 Commit, ) -> Pin<Box<dyn Future<Output = Result<Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Checks the results of any (e.g. CI) status checks for the commit.

Source

fn list_webhooks<'life0, 'life1, 'async_trait>( &'life0 self, repo_listen_url: &'life1 RepoListenUrl, ) -> Pin<Box<dyn Future<Output = Result<Vec<WebhookId>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn unregister_webhook<'life0, 'life1, 'async_trait>( &'life0 self, webhook: &'life1 WebhookId, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn register_webhook<'life0, 'life1, 'async_trait>( &'life0 self, repo_listen_url: &'life1 RepoListenUrl, ) -> Pin<Box<dyn Future<Output = Result<RegisteredWebhook>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Provided Methods§

Source

fn should_ignore_message(&self, message: &ForgeNotification) -> bool

Checks if the message should be ignored.

Default implementation says that no messages should be ignored.

Implementors§