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 page_size: Option<i32>,
25 skip: Option<i32>,
26 ) -> Result<FetchManyResponseKind<WebHook>, MappedErrors>;
27
28 async fn list_by_trigger(
33 &self,
34 trigger: WebHookTrigger,
35 ) -> Result<FetchManyResponseKind<WebHook>, MappedErrors>;
36
37 async fn fetch_execution_event(
38 &self,
39 max_events: u32,
40 max_attempts: u32,
41 status: Option<Vec<WebHookExecutionStatus>>,
42 ) -> Result<FetchManyResponseKind<WebHookPayloadArtifact>, MappedErrors>;
43}