myc_core/domain/entities/webhook/
webhook_fetching.rs1use crate::domain::dtos::webhook::{
2 WebHook, WebHookExecutionStatus, WebHookPayloadArtifact, WebHookTrigger,
3};
4
5use async_trait::async_trait;
6use mycelium_base::{
7 entities::{FetchManyResponseKind, FetchResponseKind},
8 utils::errors::MappedErrors,
9};
10use shaku::Interface;
11use uuid::Uuid;
12
13#[async_trait]
14pub trait WebHookFetching: Interface + Send + Sync {
15 async fn get(
16 &self,
17 id: Uuid,
18 ) -> Result<FetchResponseKind<WebHook, Uuid>, MappedErrors>;
19
20 async fn list(
21 &self,
22 name: Option<String>,
23 trigger: Option<WebHookTrigger>,
24 ) -> Result<FetchManyResponseKind<WebHook>, MappedErrors>;
25
26 async fn list_by_trigger(
31 &self,
32 trigger: WebHookTrigger,
33 ) -> Result<FetchManyResponseKind<WebHook>, MappedErrors>;
34
35 async fn fetch_execution_event(
36 &self,
37 max_events: u32,
38 max_attempts: u32,
39 status: Option<Vec<WebHookExecutionStatus>>,
40 ) -> Result<FetchManyResponseKind<WebHookPayloadArtifact>, MappedErrors>;
41}