Skip to main content

ephemeris_forge_github/api/operations/
webhooks.rs

1use ephemeris_forge::RepoRef;
2
3use crate::api::error::ForgeError;
4use crate::api::model::Webhook;
5use crate::api::request::{WebhookBody, WebhookPatch};
6
7/// The webhooks operations of the GitHub API.
8pub trait WebhooksApi {
9    /// Create a webhook.
10    fn create_webhook(
11        &self,
12        repository: &RepoRef,
13        webhook: &WebhookBody,
14    ) -> impl Future<Output = Result<(), ForgeError>> + Send;
15
16    /// Delete the webhook `id`.
17    fn delete_webhook(
18        &self,
19        repository: &RepoRef,
20        id: u64,
21    ) -> impl Future<Output = Result<(), ForgeError>> + Send;
22
23    /// Update the webhook `id`.
24    fn update_webhook(
25        &self,
26        repository: &RepoRef,
27        id: u64,
28        webhook: &WebhookPatch,
29    ) -> impl Future<Output = Result<(), ForgeError>> + Send;
30
31    /// Read the repository's webhooks.
32    fn webhooks(
33        &self,
34        repository: &RepoRef,
35    ) -> impl Future<Output = Result<Vec<Webhook>, ForgeError>> + Send;
36}